From 919eea722c3f1baa9b87becf77e5ca013e75da03 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 28 Jul 2016 09:31:55 -0500 Subject: [PATCH] wwww cleanings --- {src => 16/src}/lib/fmapread.c | 0 {src => 16/src}/lib/fmapread.h | 0 {src => 16/src}/lib/planar.c | 0 {src => 16/src}/lib/planar.h | 0 makefile | 33 +- pcx2vrl | Bin 14456 -> 10128 bytes pcxsscut | Bin 23696 -> 21640 bytes scroll.smp | Bin 2563 -> 0 bytes src/lib/16_in.h | 1 - src/lib/dl/8254.c | 107 - src/lib/dl/8254.h | 146 - src/lib/dl/8259.c | 99 - src/lib/dl/8259.h | 116 - src/lib/dl/adlib.c | 289 - src/lib/dl/adlib.h | 138 - src/lib/dl/cpu.c | 181 - src/lib/dl/cpu.h | 236 - src/lib/dl/dos.c | 308 - src/lib/dl/dos.h | 445 - src/lib/dl/emm.c | 507 - src/lib/dl/emm.h | 82 - src/lib/dl/ext/buildall.bat | 61 - src/lib/dl/ext/bzip2/CLEAN.BAT | 17 - src/lib/dl/ext/bzip2/MAKE.BAT | 26 - src/lib/dl/ext/bzip2/blocksrt.c | 1094 -- src/lib/dl/ext/bzip2/bzip2.c | 2014 -- src/lib/dl/ext/bzip2/bzip2rec.c | 514 - src/lib/dl/ext/bzip2/bzlib.c | 1572 -- src/lib/dl/ext/bzip2/bzlib.h | 282 - src/lib/dl/ext/bzip2/bzlibprv.h | 509 - src/lib/dl/ext/bzip2/common.mak | 41 - src/lib/dl/ext/bzip2/compress.c | 672 - src/lib/dl/ext/bzip2/crctable.c | 104 - src/lib/dl/ext/bzip2/decomprs.c | 646 - src/lib/dl/ext/bzip2/huffman.c | 205 - src/lib/dl/ext/bzip2/randtabl.c | 84 - src/lib/dl/ext/clean.bat | 5 - src/lib/dl/ext/flac/CLEAN.BAT | 17 - src/lib/dl/ext/flac/MAKE.BAT | 26 - src/lib/dl/ext/flac/all.h | 370 - src/lib/dl/ext/flac/analyze.c | 247 - src/lib/dl/ext/flac/analyze.h | 31 - src/lib/dl/ext/flac/assert.h | 45 - src/lib/dl/ext/flac/bitmath.c | 149 - src/lib/dl/ext/flac/bitreader.c | 1382 -- src/lib/dl/ext/flac/bitwriter.c | 895 - src/lib/dl/ext/flac/callback.h | 184 - src/lib/dl/ext/flac/common.mak | 36 - src/lib/dl/ext/flac/config.h | 135 - src/lib/dl/ext/flac/cpu.c | 418 - src/lib/dl/ext/flac/crc.c | 142 - src/lib/dl/ext/flac/cuesheet.c | 611 - src/lib/dl/ext/flac/decode.c | 1385 -- src/lib/dl/ext/flac/decode.h | 74 - src/lib/dl/ext/flac/encode.c | 2941 --- src/lib/dl/ext/flac/encode.h | 122 - src/lib/dl/ext/flac/export.h | 91 - src/lib/dl/ext/flac/fast_float_math_hack.h | 39 - src/lib/dl/ext/flac/file.c | 192 - src/lib/dl/ext/flac/fixed.c | 435 - src/lib/dl/ext/flac/float.c | 308 - src/lib/dl/ext/flac/foreign_metadata.c | 593 - src/lib/dl/ext/flac/foreign_metadata.h | 59 - src/lib/dl/ext/flac/format.c | 593 - src/lib/dl/ext/flac/format.h | 1010 - src/lib/dl/ext/flac/getopt.c | 1047 - src/lib/dl/ext/flac/getopt.h | 171 - src/lib/dl/ext/flac/getopt1.c | 188 - src/lib/dl/ext/flac/iffscan.c | 0 src/lib/dl/ext/flac/local_string_utils.c | 109 - src/lib/dl/ext/flac/local_string_utils.h | 27 - src/lib/dl/ext/flac/lpc.c | 1377 -- src/lib/dl/ext/flac/main.c | 2181 --- src/lib/dl/ext/flac/md5.c | 424 - src/lib/dl/ext/flac/memory.c | 221 - src/lib/dl/ext/flac/metadata.h | 2181 --- src/lib/dl/ext/flac/metadata_iterators.c | 3368 ---- src/lib/dl/ext/flac/metadata_object.c | 1819 -- src/lib/dl/ext/flac/ogg_decoder_aspect.c | 253 - src/lib/dl/ext/flac/ogg_encoder_aspect.c | 227 - src/lib/dl/ext/flac/ogg_helper.c | 209 - src/lib/dl/ext/flac/ogg_mapping.c | 47 - src/lib/dl/ext/flac/operations.c | 682 - src/lib/dl/ext/flac/operations.h | 26 - src/lib/dl/ext/flac/operations_shorthand.h | 25 - .../ext/flac/operations_shorthand_cuesheet.c | 217 - .../ext/flac/operations_shorthand_picture.c | 173 - .../ext/flac/operations_shorthand_seektable.c | 217 - .../flac/operations_shorthand_streaminfo.c | 129 - .../flac/operations_shorthand_vorbiscomment.c | 368 - src/lib/dl/ext/flac/options.c | 1109 -- src/lib/dl/ext/flac/options.h | 215 - src/lib/dl/ext/flac/ordinals.h | 80 - src/lib/dl/ext/flac/picture.c | 407 - src/lib/dl/ext/flac/private/all.h | 49 - src/lib/dl/ext/flac/private/bitmath.h | 42 - src/lib/dl/ext/flac/private/bitreader.h | 99 - src/lib/dl/ext/flac/private/bitwriter.h | 103 - src/lib/dl/ext/flac/private/cpu.h | 88 - src/lib/dl/ext/flac/private/crc.h | 61 - src/lib/dl/ext/flac/private/fixed.h | 97 - src/lib/dl/ext/flac/private/float.h | 97 - src/lib/dl/ext/flac/private/format.h | 44 - src/lib/dl/ext/flac/private/lpc.h | 214 - src/lib/dl/ext/flac/private/md5.h | 44 - src/lib/dl/ext/flac/private/memory.h | 56 - src/lib/dl/ext/flac/private/metadata.h | 45 - .../dl/ext/flac/private/ogg_decoder_aspect.h | 79 - .../dl/ext/flac/private/ogg_encoder_aspect.h | 62 - src/lib/dl/ext/flac/private/ogg_helper.h | 43 - src/lib/dl/ext/flac/private/ogg_mapping.h | 63 - .../ext/flac/private/stream_encoder_framing.h | 45 - src/lib/dl/ext/flac/private/window.h | 71 - src/lib/dl/ext/flac/protected/all.h | 38 - .../dl/ext/flac/protected/stream_decoder.h | 58 - .../dl/ext/flac/protected/stream_encoder.h | 110 - src/lib/dl/ext/flac/replaygain.c | 666 - src/lib/dl/ext/flac/replaygain_analysis.c | 430 - src/lib/dl/ext/flac/replaygain_synthesis.c | 467 - src/lib/dl/ext/flac/seektable.c | 132 - src/lib/dl/ext/flac/share/alloc.h | 212 - src/lib/dl/ext/flac/share/getopt.h | 184 - src/lib/dl/ext/flac/share/grabbag.h | 29 - src/lib/dl/ext/flac/share/grabbag/cuesheet.h | 42 - src/lib/dl/ext/flac/share/grabbag/file.h | 63 - src/lib/dl/ext/flac/share/grabbag/picture.h | 46 - .../dl/ext/flac/share/grabbag/replaygain.h | 72 - src/lib/dl/ext/flac/share/grabbag/seektable.h | 38 - .../dl/ext/flac/share/replaygain_analysis.h | 59 - .../dl/ext/flac/share/replaygain_synthesis.h | 51 - src/lib/dl/ext/flac/share/utf8.h | 25 - src/lib/dl/ext/flac/stream_decoder.c | 3392 ---- src/lib/dl/ext/flac/stream_decoder.h | 1559 -- src/lib/dl/ext/flac/stream_encoder.c | 4364 ----- src/lib/dl/ext/flac/stream_encoder.h | 1768 -- src/lib/dl/ext/flac/stream_encoder_framing.c | 553 - src/lib/dl/ext/flac/usage.c | 325 - src/lib/dl/ext/flac/usage.h | 25 - src/lib/dl/ext/flac/utils.c | 316 - src/lib/dl/ext/flac/utils.h | 63 - src/lib/dl/ext/flac/vorbiscomment.c | 228 - src/lib/dl/ext/flac/vorbiscomment.h | 26 - src/lib/dl/ext/flac/window.c | 225 - src/lib/dl/ext/lame/CLEAN.BAT | 17 - src/lib/dl/ext/lame/MAKE.BAT | 26 - src/lib/dl/ext/lame/amiga_mpega.c | 139 - src/lib/dl/ext/lame/bitstream.c | 1111 -- src/lib/dl/ext/lame/bitstream.h | 40 - src/lib/dl/ext/lame/brhist.c | 382 - src/lib/dl/ext/lame/brhist.h | 40 - src/lib/dl/ext/lame/common.c | 359 - src/lib/dl/ext/lame/common.h | 43 - src/lib/dl/ext/lame/common.mak | 42 - src/lib/dl/ext/lame/config.h | 370 - src/lib/dl/ext/lame/console.c | 296 - src/lib/dl/ext/lame/console.h | 64 - src/lib/dl/ext/lame/dct64_i386.c | 348 - src/lib/dl/ext/lame/dct64_i386.h | 30 - src/lib/dl/ext/lame/decode_i386.c | 224 - src/lib/dl/ext/lame/decode_i386.h | 33 - src/lib/dl/ext/lame/encoder.c | 558 - src/lib/dl/ext/lame/encoder.h | 156 - src/lib/dl/ext/lame/fft.c | 329 - src/lib/dl/ext/lame/fft.h | 35 - src/lib/dl/ext/lame/gain_analysis.c | 518 - src/lib/dl/ext/lame/gain_analysis.h | 109 - src/lib/dl/ext/lame/get_audio.c | 2218 --- src/lib/dl/ext/lame/get_audio.h | 90 - src/lib/dl/ext/lame/gpkplotting.c | 331 - src/lib/dl/ext/lame/gpkplotting.h | 51 - src/lib/dl/ext/lame/gtkanal.c | 1640 -- src/lib/dl/ext/lame/gtkanal.h | 25 - src/lib/dl/ext/lame/huffman.h | 353 - src/lib/dl/ext/lame/id3tag.c | 1850 -- src/lib/dl/ext/lame/id3tag.h | 65 - src/lib/dl/ext/lame/interface.c | 711 - src/lib/dl/ext/lame/interface.h | 56 - src/lib/dl/ext/lame/l2tables.h | 183 - src/lib/dl/ext/lame/l3side.h | 94 - src/lib/dl/ext/lame/lame-analysis.h | 96 - src/lib/dl/ext/lame/lame.c | 2643 --- src/lib/dl/ext/lame/lame.h | 1329 -- src/lib/dl/ext/lame/lame_global_flags.h | 184 - src/lib/dl/ext/lame/lame_main.c | 729 - src/lib/dl/ext/lame/lameerror.h | 26 - src/lib/dl/ext/lame/lametime.c | 149 - src/lib/dl/ext/lame/lametime.h | 41 - src/lib/dl/ext/lame/layer1.c | 221 - src/lib/dl/ext/lame/layer1.h | 29 - src/lib/dl/ext/lame/layer2.c | 400 - src/lib/dl/ext/lame/layer2.h | 39 - src/lib/dl/ext/lame/layer3.c | 1871 -- src/lib/dl/ext/lame/layer3.h | 32 - src/lib/dl/ext/lame/machine.h | 192 - src/lib/dl/ext/lame/main.c | 475 - src/lib/dl/ext/lame/main.h | 109 - src/lib/dl/ext/lame/mp3rtp.c | 257 - src/lib/dl/ext/lame/mp3x.c | 65 - src/lib/dl/ext/lame/mpg123.h | 152 - src/lib/dl/ext/lame/mpglib.h | 96 - src/lib/dl/ext/lame/mpglib_interface.c | 476 - src/lib/dl/ext/lame/newmdct.c | 1039 - src/lib/dl/ext/lame/newmdct.h | 27 - src/lib/dl/ext/lame/parse.c | 2396 --- src/lib/dl/ext/lame/parse.h | 24 - src/lib/dl/ext/lame/presets.c | 400 - src/lib/dl/ext/lame/psymodel.c | 2168 --- src/lib/dl/ext/lame/psymodel.h | 64 - src/lib/dl/ext/lame/quantize.c | 2035 -- src/lib/dl/ext/lame/quantize.h | 38 - src/lib/dl/ext/lame/quantize_pvt.c | 1044 - src/lib/dl/ext/lame/quantize_pvt.h | 128 - src/lib/dl/ext/lame/reservoir.c | 293 - src/lib/dl/ext/lame/reservoir.h | 31 - src/lib/dl/ext/lame/rtp.c | 366 - src/lib/dl/ext/lame/rtp.h | 44 - src/lib/dl/ext/lame/set_get.c | 2277 --- src/lib/dl/ext/lame/set_get.h | 76 - src/lib/dl/ext/lame/tabinit.c | 146 - src/lib/dl/ext/lame/tabinit.h | 32 - src/lib/dl/ext/lame/tables.c | 564 - src/lib/dl/ext/lame/tables.h | 95 - src/lib/dl/ext/lame/takehiro.c | 1375 -- src/lib/dl/ext/lame/timestatus.c | 438 - src/lib/dl/ext/lame/timestatus.h | 46 - src/lib/dl/ext/lame/util.c | 990 - src/lib/dl/ext/lame/util.h | 618 - src/lib/dl/ext/lame/vbrquantize.c | 1607 -- src/lib/dl/ext/lame/vbrquantize.h | 28 - src/lib/dl/ext/lame/vbrtag.c | 1082 -- src/lib/dl/ext/lame/vbrtag.h | 79 - src/lib/dl/ext/lame/vector/lame_intrin.h | 33 - src/lib/dl/ext/lame/vector/xmm_quantize_sub.c | 232 - src/lib/dl/ext/lame/version.c | 254 - src/lib/dl/ext/lame/version.h | 68 - src/lib/dl/ext/libmad/CLEAN.BAT | 17 - src/lib/dl/ext/libmad/MAKE.BAT | 26 - src/lib/dl/ext/libmad/bit.c | 237 - src/lib/dl/ext/libmad/bit.h | 47 - src/lib/dl/ext/libmad/common.mak | 34 - src/lib/dl/ext/libmad/config.h | 138 - src/lib/dl/ext/libmad/d.dat | 607 - src/lib/dl/ext/libmad/decoder.c | 582 - src/lib/dl/ext/libmad/decoder.h | 91 - src/lib/dl/ext/libmad/fixed.c | 81 - src/lib/dl/ext/libmad/fixed.h | 499 - src/lib/dl/ext/libmad/frame.c | 504 - src/lib/dl/ext/libmad/frame.h | 118 - src/lib/dl/ext/libmad/global.h | 58 - src/lib/dl/ext/libmad/huffman.c | 3109 --- src/lib/dl/ext/libmad/huffman.h | 66 - src/lib/dl/ext/libmad/imdct_s.dat | 62 - src/lib/dl/ext/libmad/layer12.c | 534 - src/lib/dl/ext/libmad/layer12.h | 31 - src/lib/dl/ext/libmad/layer3.c | 2739 --- src/lib/dl/ext/libmad/layer3.h | 30 - src/lib/dl/ext/libmad/mad.h | 969 - src/lib/dl/ext/libmad/playcom.h | 86 - src/lib/dl/ext/libmad/qc_table.dat | 77 - src/lib/dl/ext/libmad/readme | 54 - src/lib/dl/ext/libmad/rq_table.dat | 8747 --------- src/lib/dl/ext/libmad/sf_table.dat | 106 - src/lib/dl/ext/libmad/stream.c | 161 - src/lib/dl/ext/libmad/stream.h | 108 - src/lib/dl/ext/libmad/synth.c | 857 - src/lib/dl/ext/libmad/synth.h | 69 - src/lib/dl/ext/libmad/timer.c | 485 - src/lib/dl/ext/libmad/timer.h | 100 - src/lib/dl/ext/libmad/version.c | 91 - src/lib/dl/ext/libmad/version.h | 47 - src/lib/dl/ext/libogg/CLEAN.BAT | 17 - src/lib/dl/ext/libogg/MAKE.BAT | 26 - src/lib/dl/ext/libogg/bitwise.c | 857 - src/lib/dl/ext/libogg/common.mak | 29 - src/lib/dl/ext/libogg/config.h | 102 - src/lib/dl/ext/libogg/config_types.h | 25 - src/lib/dl/ext/libogg/framing.c | 2093 -- src/lib/dl/ext/libogg/ogg.h | 210 - src/lib/dl/ext/libogg/os_types.h | 147 - src/lib/dl/ext/readme | 16 - src/lib/dl/ext/speex/CLEAN.BAT | 17 - src/lib/dl/ext/speex/MAKE.BAT | 26 - src/lib/dl/ext/speex/_kiss_fft_guts.h | 160 - src/lib/dl/ext/speex/arch.h | 239 - src/lib/dl/ext/speex/bits.c | 372 - src/lib/dl/ext/speex/buffer.c | 176 - src/lib/dl/ext/speex/cb_search.c | 612 - src/lib/dl/ext/speex/cb_search.h | 103 - src/lib/dl/ext/speex/cb_search_arm4.h | 137 - src/lib/dl/ext/speex/cb_search_bfin.h | 112 - src/lib/dl/ext/speex/cb_search_sse.h | 84 - src/lib/dl/ext/speex/common.mak | 43 - src/lib/dl/ext/speex/config.h | 166 - src/lib/dl/ext/speex/exc_10_16_table.c | 50 - src/lib/dl/ext/speex/exc_10_32_table.c | 66 - src/lib/dl/ext/speex/exc_20_32_table.c | 66 - src/lib/dl/ext/speex/exc_5_256_table.c | 290 - src/lib/dl/ext/speex/exc_5_64_table.c | 98 - src/lib/dl/ext/speex/exc_8_128_table.c | 162 - src/lib/dl/ext/speex/fftwrap.c | 397 - src/lib/dl/ext/speex/fftwrap.h | 58 - src/lib/dl/ext/speex/filterbank.c | 227 - src/lib/dl/ext/speex/filterbank.h | 66 - src/lib/dl/ext/speex/filters.c | 821 - src/lib/dl/ext/speex/filters.h | 90 - src/lib/dl/ext/speex/filters_arm4.h | 96 - src/lib/dl/ext/speex/filters_bfin.h | 515 - src/lib/dl/ext/speex/filters_sse.h | 336 - src/lib/dl/ext/speex/fixed_arm4.h | 148 - src/lib/dl/ext/speex/fixed_arm5e.h | 178 - src/lib/dl/ext/speex/fixed_bfin.h | 173 - src/lib/dl/ext/speex/fixed_debug.h | 487 - src/lib/dl/ext/speex/fixed_generic.h | 106 - src/lib/dl/ext/speex/gain_table.c | 160 - src/lib/dl/ext/speex/gain_table_lbr.c | 64 - src/lib/dl/ext/speex/getopt.c | 1047 - src/lib/dl/ext/speex/getopt.h | 171 - src/lib/dl/ext/speex/getopt1.c | 188 - src/lib/dl/ext/speex/getopt_win.h | 169 - src/lib/dl/ext/speex/hexc_10_32_table.c | 66 - src/lib/dl/ext/speex/hexc_table.c | 162 - src/lib/dl/ext/speex/high_lsp_tables.c | 163 - src/lib/dl/ext/speex/jitter.c | 843 - src/lib/dl/ext/speex/kiss_fft.c | 523 - src/lib/dl/ext/speex/kiss_fft.h | 108 - src/lib/dl/ext/speex/kiss_fftr.c | 297 - src/lib/dl/ext/speex/kiss_fftr.h | 51 - src/lib/dl/ext/speex/lpc.c | 201 - src/lib/dl/ext/speex/lpc.h | 53 - src/lib/dl/ext/speex/lpc_bfin.h | 131 - src/lib/dl/ext/speex/lsp.c | 656 - src/lib/dl/ext/speex/lsp.h | 64 - src/lib/dl/ext/speex/lsp_bfin.h | 89 - src/lib/dl/ext/speex/lsp_tables_nb.c | 360 - src/lib/dl/ext/speex/ltp.c | 839 - src/lib/dl/ext/speex/ltp.h | 141 - src/lib/dl/ext/speex/ltp_arm4.h | 187 - src/lib/dl/ext/speex/ltp_bfin.h | 419 - src/lib/dl/ext/speex/ltp_sse.h | 92 - src/lib/dl/ext/speex/math_approx.h | 332 - src/lib/dl/ext/speex/mdf.c | 1285 -- src/lib/dl/ext/speex/misc_bfin.h | 54 - src/lib/dl/ext/speex/modes.c | 366 - src/lib/dl/ext/speex/modes.h | 161 - src/lib/dl/ext/speex/modes_wb.c | 300 - src/lib/dl/ext/speex/nb_celp.c | 1903 -- src/lib/dl/ext/speex/nb_celp.h | 203 - src/lib/dl/ext/speex/os_support.h | 169 - src/lib/dl/ext/speex/preprocess.c | 1219 -- src/lib/dl/ext/speex/pseudofloat.h | 379 - src/lib/dl/ext/speex/quant_lsp.c | 385 - src/lib/dl/ext/speex/quant_lsp.h | 74 - src/lib/dl/ext/speex/quant_lsp_bfin.h | 165 - src/lib/dl/ext/speex/resample.c | 1131 -- src/lib/dl/ext/speex/resample_sse.h | 128 - src/lib/dl/ext/speex/sb_celp.c | 1488 -- src/lib/dl/ext/speex/sb_celp.h | 155 - src/lib/dl/ext/speex/scal.c | 293 - src/lib/dl/ext/speex/skeleton.c | 188 - src/lib/dl/ext/speex/skeleton.h | 78 - src/lib/dl/ext/speex/smallft.c | 1261 -- src/lib/dl/ext/speex/smallft.h | 46 - src/lib/dl/ext/speex/speex.c | 250 - src/lib/dl/ext/speex/speex.h | 424 - src/lib/dl/ext/speex/speex_bits.h | 174 - src/lib/dl/ext/speex/speex_buffer.h | 68 - src/lib/dl/ext/speex/speex_callbacks.c | 144 - src/lib/dl/ext/speex/speex_callbacks.h | 134 - src/lib/dl/ext/speex/speex_config_types.h | 11 - src/lib/dl/ext/speex/speex_echo.h | 170 - src/lib/dl/ext/speex/speex_header.c | 200 - src/lib/dl/ext/speex/speex_header.h | 94 - src/lib/dl/ext/speex/speex_jitter.h | 197 - src/lib/dl/ext/speex/speex_preprocess.h | 219 - src/lib/dl/ext/speex/speex_resampler.h | 340 - src/lib/dl/ext/speex/speex_stereo.h | 91 - src/lib/dl/ext/speex/speex_types.h | 126 - src/lib/dl/ext/speex/speexdec.c | 808 - src/lib/dl/ext/speex/speexenc.c | 996 - src/lib/dl/ext/speex/stack_alloc.h | 115 - src/lib/dl/ext/speex/stereo.c | 296 - src/lib/dl/ext/speex/testdenoise.c | 44 - src/lib/dl/ext/speex/testecho.c | 53 - src/lib/dl/ext/speex/testenc.c | 146 - src/lib/dl/ext/speex/testenc_uwb.c | 137 - src/lib/dl/ext/speex/testenc_wb.c | 140 - src/lib/dl/ext/speex/testjitter.c | 75 - src/lib/dl/ext/speex/vbr.c | 275 - src/lib/dl/ext/speex/vbr.h | 70 - src/lib/dl/ext/speex/vorbis_psy.h | 97 - src/lib/dl/ext/speex/vq.c | 147 - src/lib/dl/ext/speex/vq.h | 54 - src/lib/dl/ext/speex/vq_arm4.h | 115 - src/lib/dl/ext/speex/vq_bfin.h | 107 - src/lib/dl/ext/speex/vq_sse.h | 120 - src/lib/dl/ext/speex/wav_io.c | 232 - src/lib/dl/ext/speex/wav_io.h | 66 - src/lib/dl/ext/speex/wave_out.c | 220 - src/lib/dl/ext/speex/wave_out.h | 71 - src/lib/dl/ext/speex/window.c | 102 - src/lib/dl/ext/vorbis/CLEAN.BAT | 17 - src/lib/dl/ext/vorbis/MAKE.BAT | 26 - src/lib/dl/ext/vorbis/analysis.c | 120 - src/lib/dl/ext/vorbis/backends.h | 144 - src/lib/dl/ext/vorbis/barkmel.c | 64 - src/lib/dl/ext/vorbis/bitrate.c | 253 - src/lib/dl/ext/vorbis/bitrate.h | 59 - src/lib/dl/ext/vorbis/block.c | 1046 - .../ext/vorbis/books/coupled/res_books_51.h | 12257 ------------ .../vorbis/books/coupled/res_books_stereo.h | 15783 ---------------- .../dl/ext/vorbis/books/floor/floor_books.h | 1547 -- .../books/uncoupled/res_books_uncoupled.h | 7758 -------- src/lib/dl/ext/vorbis/codebook.c | 479 - src/lib/dl/ext/vorbis/codebook.h | 119 - src/lib/dl/ext/vorbis/codec.h | 243 - src/lib/dl/ext/vorbis/codec_internal.h | 167 - src/lib/dl/ext/vorbis/common.mak | 40 - src/lib/dl/ext/vorbis/config.h | 92 - src/lib/dl/ext/vorbis/envelope.c | 375 - src/lib/dl/ext/vorbis/envelope.h | 80 - src/lib/dl/ext/vorbis/floor0.c | 222 - src/lib/dl/ext/vorbis/floor1.c | 1099 -- src/lib/dl/ext/vorbis/highlevel.h | 58 - src/lib/dl/ext/vorbis/info.c | 664 - src/lib/dl/ext/vorbis/lookup.c | 94 - src/lib/dl/ext/vorbis/lookup.h | 32 - src/lib/dl/ext/vorbis/lookup_data.h | 192 - src/lib/dl/ext/vorbis/lpc.c | 160 - src/lib/dl/ext/vorbis/lpc.h | 29 - src/lib/dl/ext/vorbis/lsp.c | 456 - src/lib/dl/ext/vorbis/lsp.h | 28 - src/lib/dl/ext/vorbis/mapping0.c | 816 - src/lib/dl/ext/vorbis/masking.h | 785 - src/lib/dl/ext/vorbis/mdct.c | 563 - src/lib/dl/ext/vorbis/mdct.h | 71 - src/lib/dl/ext/vorbis/misc.h | 57 - src/lib/dl/ext/vorbis/modes/floor_all.h | 260 - src/lib/dl/ext/vorbis/modes/psych_11.h | 51 - src/lib/dl/ext/vorbis/modes/psych_16.h | 133 - src/lib/dl/ext/vorbis/modes/psych_44.h | 642 - src/lib/dl/ext/vorbis/modes/psych_8.h | 101 - src/lib/dl/ext/vorbis/modes/residue_16.h | 163 - src/lib/dl/ext/vorbis/modes/residue_44.h | 292 - src/lib/dl/ext/vorbis/modes/residue_44p51.h | 451 - src/lib/dl/ext/vorbis/modes/residue_44u.h | 318 - src/lib/dl/ext/vorbis/modes/residue_8.h | 109 - src/lib/dl/ext/vorbis/modes/setup_11.h | 143 - src/lib/dl/ext/vorbis/modes/setup_16.h | 153 - src/lib/dl/ext/vorbis/modes/setup_22.h | 128 - src/lib/dl/ext/vorbis/modes/setup_32.h | 132 - src/lib/dl/ext/vorbis/modes/setup_44.h | 117 - src/lib/dl/ext/vorbis/modes/setup_44p51.h | 74 - src/lib/dl/ext/vorbis/modes/setup_44u.h | 74 - src/lib/dl/ext/vorbis/modes/setup_8.h | 149 - src/lib/dl/ext/vorbis/modes/setup_x.h | 225 - src/lib/dl/ext/vorbis/os.h | 186 - src/lib/dl/ext/vorbis/psy.c | 1203 -- src/lib/dl/ext/vorbis/psy.h | 154 - src/lib/dl/ext/vorbis/registry.c | 45 - src/lib/dl/ext/vorbis/registry.h | 32 - src/lib/dl/ext/vorbis/res0.c | 889 - src/lib/dl/ext/vorbis/scales.h | 90 - src/lib/dl/ext/vorbis/sharedbook.c | 579 - src/lib/dl/ext/vorbis/smallft.c | 1255 -- src/lib/dl/ext/vorbis/smallft.h | 34 - src/lib/dl/ext/vorbis/synthesis.c | 184 - src/lib/dl/ext/vorbis/vorbisenc.c | 1215 -- src/lib/dl/ext/vorbis/vorbisenc.h | 436 - src/lib/dl/ext/vorbis/vorbisfile.c | 2337 --- src/lib/dl/ext/vorbis/vorbisfile.h | 206 - src/lib/dl/ext/vorbis/window.c | 2135 --- src/lib/dl/ext/vorbis/window.h | 26 - src/lib/dl/ext/vorbtool/CLEAN.BAT | 17 - src/lib/dl/ext/vorbtool/MAKE.BAT | 26 - src/lib/dl/ext/vorbtool/audio.c | 917 - src/lib/dl/ext/vorbtool/audio.h | 72 - src/lib/dl/ext/vorbtool/charmaps.h | 57 - src/lib/dl/ext/vorbtool/charset.c | 525 - src/lib/dl/ext/vorbtool/charset.h | 72 - src/lib/dl/ext/vorbtool/charset_test.c | 263 - src/lib/dl/ext/vorbtool/charsetmap.h | 79 - src/lib/dl/ext/vorbtool/common.mak | 56 - src/lib/dl/ext/vorbtool/config.h | 445 - src/lib/dl/ext/vorbtool/easyflac.c | 384 - src/lib/dl/ext/vorbtool/easyflac.h | 141 - src/lib/dl/ext/vorbtool/encode.c | 836 - src/lib/dl/ext/vorbtool/encode.h | 149 - src/lib/dl/ext/vorbtool/flac.c | 377 - src/lib/dl/ext/vorbtool/flac.h | 54 - src/lib/dl/ext/vorbtool/getopt.c | 1047 - src/lib/dl/ext/vorbtool/getopt.h | 171 - src/lib/dl/ext/vorbtool/getopt1.c | 188 - src/lib/dl/ext/vorbtool/i18n.h | 18 - src/lib/dl/ext/vorbtool/iconvert.c | 247 - src/lib/dl/ext/vorbtool/lyrics.c | 59 - src/lib/dl/ext/vorbtool/lyrics.h | 29 - src/lib/dl/ext/vorbtool/makemap.c | 81 - src/lib/dl/ext/vorbtool/oggdec.c | 471 - src/lib/dl/ext/vorbtool/oggenc.c | 1090 -- src/lib/dl/ext/vorbtool/ogginfo2.c | 1193 -- src/lib/dl/ext/vorbtool/platform.c | 336 - src/lib/dl/ext/vorbtool/platform.h | 44 - src/lib/dl/ext/vorbtool/resample.c | 444 - src/lib/dl/ext/vorbtool/resample.h | 107 - src/lib/dl/ext/vorbtool/skeleton.c | 215 - src/lib/dl/ext/vorbtool/skeleton.h | 63 - src/lib/dl/ext/vorbtool/theora.c | 225 - src/lib/dl/ext/vorbtool/theora.h | 185 - src/lib/dl/ext/vorbtool/utf8.c | 0 src/lib/dl/ext/vorbtool/utf8.h | 0 src/lib/dl/ext/zlib/CLEAN.BAT | 17 - src/lib/dl/ext/zlib/MAKE.BAT | 26 - src/lib/dl/ext/zlib/adler32.c | 169 - src/lib/dl/ext/zlib/common.mak | 43 - src/lib/dl/ext/zlib/compress.c | 80 - src/lib/dl/ext/zlib/crc32.c | 442 - src/lib/dl/ext/zlib/crc32.h | 441 - src/lib/dl/ext/zlib/deflate.c | 1834 -- src/lib/dl/ext/zlib/deflate.h | 342 - src/lib/dl/ext/zlib/example.c | 571 - src/lib/dl/ext/zlib/gzclose.c | 25 - src/lib/dl/ext/zlib/gzguts.h | 132 - src/lib/dl/ext/zlib/gzlib.c | 537 - src/lib/dl/ext/zlib/gzread.c | 688 - src/lib/dl/ext/zlib/gzwrite.c | 577 - src/lib/dl/ext/zlib/infback.c | 632 - src/lib/dl/ext/zlib/inffast.c | 340 - src/lib/dl/ext/zlib/inffast.h | 11 - src/lib/dl/ext/zlib/inffixed.h | 94 - src/lib/dl/ext/zlib/inflate.c | 1480 -- src/lib/dl/ext/zlib/inflate.h | 122 - src/lib/dl/ext/zlib/inftrees.c | 330 - src/lib/dl/ext/zlib/inftrees.h | 62 - src/lib/dl/ext/zlib/minigzip.c | 440 - src/lib/dl/ext/zlib/trees.c | 1244 -- src/lib/dl/ext/zlib/trees.h | 128 - src/lib/dl/ext/zlib/uncompr.c | 59 - src/lib/dl/ext/zlib/zconf.h | 435 - src/lib/dl/ext/zlib/zlib.h | 1613 -- src/lib/dl/ext/zlib/zutil.c | 327 - src/lib/dl/ext/zlib/zutil.h | 277 - src/lib/dl/himemsys.c | 672 - src/lib/dl/himemsys.h | 62 - src/lib/mapread.c | 2 +- src/lib/modex16.h | 2 +- src/lib/scroll16.h | 1 - src/pcxtest.c | 6 +- src/pcxtest2.c | 6 +- src/test2.c | 2 +- test.smp | Bin 1841 -> 0 bytes vrl2vrs | Bin 19944 -> 17088 bytes vrsdump | Bin 14104 -> 11024 bytes x-demo.smp | Bin 32352 -> 0 bytes x_demo.smp | Bin 15619 -> 0 bytes 554 files changed, 25 insertions(+), 243759 deletions(-) rename {src => 16/src}/lib/fmapread.c (100%) rename {src => 16/src}/lib/fmapread.h (100%) rename {src => 16/src}/lib/planar.c (100%) rename {src => 16/src}/lib/planar.h (100%) delete mode 100755 scroll.smp delete mode 100755 src/lib/dl/8254.c delete mode 100755 src/lib/dl/8254.h delete mode 100755 src/lib/dl/8259.c delete mode 100755 src/lib/dl/8259.h delete mode 100755 src/lib/dl/adlib.c delete mode 100755 src/lib/dl/adlib.h delete mode 100755 src/lib/dl/cpu.c delete mode 100755 src/lib/dl/cpu.h delete mode 100755 src/lib/dl/dos.c delete mode 100755 src/lib/dl/dos.h delete mode 100755 src/lib/dl/emm.c delete mode 100755 src/lib/dl/emm.h delete mode 100755 src/lib/dl/ext/buildall.bat delete mode 100755 src/lib/dl/ext/bzip2/CLEAN.BAT delete mode 100755 src/lib/dl/ext/bzip2/MAKE.BAT delete mode 100755 src/lib/dl/ext/bzip2/blocksrt.c delete mode 100755 src/lib/dl/ext/bzip2/bzip2.c delete mode 100755 src/lib/dl/ext/bzip2/bzip2rec.c delete mode 100755 src/lib/dl/ext/bzip2/bzlib.c delete mode 100755 src/lib/dl/ext/bzip2/bzlib.h delete mode 100755 src/lib/dl/ext/bzip2/bzlibprv.h delete mode 100755 src/lib/dl/ext/bzip2/common.mak delete mode 100755 src/lib/dl/ext/bzip2/compress.c delete mode 100755 src/lib/dl/ext/bzip2/crctable.c delete mode 100755 src/lib/dl/ext/bzip2/decomprs.c delete mode 100755 src/lib/dl/ext/bzip2/huffman.c delete mode 100755 src/lib/dl/ext/bzip2/randtabl.c delete mode 100755 src/lib/dl/ext/clean.bat delete mode 100755 src/lib/dl/ext/flac/CLEAN.BAT delete mode 100755 src/lib/dl/ext/flac/MAKE.BAT delete mode 100755 src/lib/dl/ext/flac/all.h delete mode 100755 src/lib/dl/ext/flac/analyze.c delete mode 100755 src/lib/dl/ext/flac/analyze.h delete mode 100755 src/lib/dl/ext/flac/assert.h delete mode 100755 src/lib/dl/ext/flac/bitmath.c delete mode 100755 src/lib/dl/ext/flac/bitreader.c delete mode 100755 src/lib/dl/ext/flac/bitwriter.c delete mode 100755 src/lib/dl/ext/flac/callback.h delete mode 100755 src/lib/dl/ext/flac/common.mak delete mode 100755 src/lib/dl/ext/flac/config.h delete mode 100755 src/lib/dl/ext/flac/cpu.c delete mode 100755 src/lib/dl/ext/flac/crc.c delete mode 100755 src/lib/dl/ext/flac/cuesheet.c delete mode 100755 src/lib/dl/ext/flac/decode.c delete mode 100755 src/lib/dl/ext/flac/decode.h delete mode 100755 src/lib/dl/ext/flac/encode.c delete mode 100755 src/lib/dl/ext/flac/encode.h delete mode 100755 src/lib/dl/ext/flac/export.h delete mode 100755 src/lib/dl/ext/flac/fast_float_math_hack.h delete mode 100755 src/lib/dl/ext/flac/file.c delete mode 100755 src/lib/dl/ext/flac/fixed.c delete mode 100755 src/lib/dl/ext/flac/float.c delete mode 100755 src/lib/dl/ext/flac/foreign_metadata.c delete mode 100755 src/lib/dl/ext/flac/foreign_metadata.h delete mode 100755 src/lib/dl/ext/flac/format.c delete mode 100755 src/lib/dl/ext/flac/format.h delete mode 100755 src/lib/dl/ext/flac/getopt.c delete mode 100755 src/lib/dl/ext/flac/getopt.h delete mode 100755 src/lib/dl/ext/flac/getopt1.c delete mode 100755 src/lib/dl/ext/flac/iffscan.c delete mode 100755 src/lib/dl/ext/flac/local_string_utils.c delete mode 100755 src/lib/dl/ext/flac/local_string_utils.h delete mode 100755 src/lib/dl/ext/flac/lpc.c delete mode 100755 src/lib/dl/ext/flac/main.c delete mode 100755 src/lib/dl/ext/flac/md5.c delete mode 100755 src/lib/dl/ext/flac/memory.c delete mode 100755 src/lib/dl/ext/flac/metadata.h delete mode 100755 src/lib/dl/ext/flac/metadata_iterators.c delete mode 100755 src/lib/dl/ext/flac/metadata_object.c delete mode 100755 src/lib/dl/ext/flac/ogg_decoder_aspect.c delete mode 100755 src/lib/dl/ext/flac/ogg_encoder_aspect.c delete mode 100755 src/lib/dl/ext/flac/ogg_helper.c delete mode 100755 src/lib/dl/ext/flac/ogg_mapping.c delete mode 100755 src/lib/dl/ext/flac/operations.c delete mode 100755 src/lib/dl/ext/flac/operations.h delete mode 100755 src/lib/dl/ext/flac/operations_shorthand.h delete mode 100755 src/lib/dl/ext/flac/operations_shorthand_cuesheet.c delete mode 100755 src/lib/dl/ext/flac/operations_shorthand_picture.c delete mode 100755 src/lib/dl/ext/flac/operations_shorthand_seektable.c delete mode 100755 src/lib/dl/ext/flac/operations_shorthand_streaminfo.c delete mode 100755 src/lib/dl/ext/flac/operations_shorthand_vorbiscomment.c delete mode 100755 src/lib/dl/ext/flac/options.c delete mode 100755 src/lib/dl/ext/flac/options.h delete mode 100755 src/lib/dl/ext/flac/ordinals.h delete mode 100755 src/lib/dl/ext/flac/picture.c delete mode 100755 src/lib/dl/ext/flac/private/all.h delete mode 100755 src/lib/dl/ext/flac/private/bitmath.h delete mode 100755 src/lib/dl/ext/flac/private/bitreader.h delete mode 100755 src/lib/dl/ext/flac/private/bitwriter.h delete mode 100755 src/lib/dl/ext/flac/private/cpu.h delete mode 100755 src/lib/dl/ext/flac/private/crc.h delete mode 100755 src/lib/dl/ext/flac/private/fixed.h delete mode 100755 src/lib/dl/ext/flac/private/float.h delete mode 100755 src/lib/dl/ext/flac/private/format.h delete mode 100755 src/lib/dl/ext/flac/private/lpc.h delete mode 100755 src/lib/dl/ext/flac/private/md5.h delete mode 100755 src/lib/dl/ext/flac/private/memory.h delete mode 100755 src/lib/dl/ext/flac/private/metadata.h delete mode 100755 src/lib/dl/ext/flac/private/ogg_decoder_aspect.h delete mode 100755 src/lib/dl/ext/flac/private/ogg_encoder_aspect.h delete mode 100755 src/lib/dl/ext/flac/private/ogg_helper.h delete mode 100755 src/lib/dl/ext/flac/private/ogg_mapping.h delete mode 100755 src/lib/dl/ext/flac/private/stream_encoder_framing.h delete mode 100755 src/lib/dl/ext/flac/private/window.h delete mode 100755 src/lib/dl/ext/flac/protected/all.h delete mode 100755 src/lib/dl/ext/flac/protected/stream_decoder.h delete mode 100755 src/lib/dl/ext/flac/protected/stream_encoder.h delete mode 100755 src/lib/dl/ext/flac/replaygain.c delete mode 100755 src/lib/dl/ext/flac/replaygain_analysis.c delete mode 100755 src/lib/dl/ext/flac/replaygain_synthesis.c delete mode 100755 src/lib/dl/ext/flac/seektable.c delete mode 100755 src/lib/dl/ext/flac/share/alloc.h delete mode 100755 src/lib/dl/ext/flac/share/getopt.h delete mode 100755 src/lib/dl/ext/flac/share/grabbag.h delete mode 100755 src/lib/dl/ext/flac/share/grabbag/cuesheet.h delete mode 100755 src/lib/dl/ext/flac/share/grabbag/file.h delete mode 100755 src/lib/dl/ext/flac/share/grabbag/picture.h delete mode 100755 src/lib/dl/ext/flac/share/grabbag/replaygain.h delete mode 100755 src/lib/dl/ext/flac/share/grabbag/seektable.h delete mode 100755 src/lib/dl/ext/flac/share/replaygain_analysis.h delete mode 100755 src/lib/dl/ext/flac/share/replaygain_synthesis.h delete mode 100755 src/lib/dl/ext/flac/share/utf8.h delete mode 100755 src/lib/dl/ext/flac/stream_decoder.c delete mode 100755 src/lib/dl/ext/flac/stream_decoder.h delete mode 100755 src/lib/dl/ext/flac/stream_encoder.c delete mode 100755 src/lib/dl/ext/flac/stream_encoder.h delete mode 100755 src/lib/dl/ext/flac/stream_encoder_framing.c delete mode 100755 src/lib/dl/ext/flac/usage.c delete mode 100755 src/lib/dl/ext/flac/usage.h delete mode 100755 src/lib/dl/ext/flac/utils.c delete mode 100755 src/lib/dl/ext/flac/utils.h delete mode 100755 src/lib/dl/ext/flac/vorbiscomment.c delete mode 100755 src/lib/dl/ext/flac/vorbiscomment.h delete mode 100755 src/lib/dl/ext/flac/window.c delete mode 100755 src/lib/dl/ext/lame/CLEAN.BAT delete mode 100755 src/lib/dl/ext/lame/MAKE.BAT delete mode 100755 src/lib/dl/ext/lame/amiga_mpega.c delete mode 100755 src/lib/dl/ext/lame/bitstream.c delete mode 100755 src/lib/dl/ext/lame/bitstream.h delete mode 100755 src/lib/dl/ext/lame/brhist.c delete mode 100755 src/lib/dl/ext/lame/brhist.h delete mode 100755 src/lib/dl/ext/lame/common.c delete mode 100755 src/lib/dl/ext/lame/common.h delete mode 100755 src/lib/dl/ext/lame/common.mak delete mode 100755 src/lib/dl/ext/lame/config.h delete mode 100755 src/lib/dl/ext/lame/console.c delete mode 100755 src/lib/dl/ext/lame/console.h delete mode 100755 src/lib/dl/ext/lame/dct64_i386.c delete mode 100755 src/lib/dl/ext/lame/dct64_i386.h delete mode 100755 src/lib/dl/ext/lame/decode_i386.c delete mode 100755 src/lib/dl/ext/lame/decode_i386.h delete mode 100755 src/lib/dl/ext/lame/encoder.c delete mode 100755 src/lib/dl/ext/lame/encoder.h delete mode 100755 src/lib/dl/ext/lame/fft.c delete mode 100755 src/lib/dl/ext/lame/fft.h delete mode 100755 src/lib/dl/ext/lame/gain_analysis.c delete mode 100755 src/lib/dl/ext/lame/gain_analysis.h delete mode 100755 src/lib/dl/ext/lame/get_audio.c delete mode 100755 src/lib/dl/ext/lame/get_audio.h delete mode 100755 src/lib/dl/ext/lame/gpkplotting.c delete mode 100755 src/lib/dl/ext/lame/gpkplotting.h delete mode 100755 src/lib/dl/ext/lame/gtkanal.c delete mode 100755 src/lib/dl/ext/lame/gtkanal.h delete mode 100755 src/lib/dl/ext/lame/huffman.h delete mode 100755 src/lib/dl/ext/lame/id3tag.c delete mode 100755 src/lib/dl/ext/lame/id3tag.h delete mode 100755 src/lib/dl/ext/lame/interface.c delete mode 100755 src/lib/dl/ext/lame/interface.h delete mode 100755 src/lib/dl/ext/lame/l2tables.h delete mode 100755 src/lib/dl/ext/lame/l3side.h delete mode 100755 src/lib/dl/ext/lame/lame-analysis.h delete mode 100755 src/lib/dl/ext/lame/lame.c delete mode 100755 src/lib/dl/ext/lame/lame.h delete mode 100755 src/lib/dl/ext/lame/lame_global_flags.h delete mode 100755 src/lib/dl/ext/lame/lame_main.c delete mode 100755 src/lib/dl/ext/lame/lameerror.h delete mode 100755 src/lib/dl/ext/lame/lametime.c delete mode 100755 src/lib/dl/ext/lame/lametime.h delete mode 100755 src/lib/dl/ext/lame/layer1.c delete mode 100755 src/lib/dl/ext/lame/layer1.h delete mode 100755 src/lib/dl/ext/lame/layer2.c delete mode 100755 src/lib/dl/ext/lame/layer2.h delete mode 100755 src/lib/dl/ext/lame/layer3.c delete mode 100755 src/lib/dl/ext/lame/layer3.h delete mode 100755 src/lib/dl/ext/lame/machine.h delete mode 100755 src/lib/dl/ext/lame/main.c delete mode 100755 src/lib/dl/ext/lame/main.h delete mode 100755 src/lib/dl/ext/lame/mp3rtp.c delete mode 100755 src/lib/dl/ext/lame/mp3x.c delete mode 100755 src/lib/dl/ext/lame/mpg123.h delete mode 100755 src/lib/dl/ext/lame/mpglib.h delete mode 100755 src/lib/dl/ext/lame/mpglib_interface.c delete mode 100755 src/lib/dl/ext/lame/newmdct.c delete mode 100755 src/lib/dl/ext/lame/newmdct.h delete mode 100755 src/lib/dl/ext/lame/parse.c delete mode 100755 src/lib/dl/ext/lame/parse.h delete mode 100755 src/lib/dl/ext/lame/presets.c delete mode 100755 src/lib/dl/ext/lame/psymodel.c delete mode 100755 src/lib/dl/ext/lame/psymodel.h delete mode 100755 src/lib/dl/ext/lame/quantize.c delete mode 100755 src/lib/dl/ext/lame/quantize.h delete mode 100755 src/lib/dl/ext/lame/quantize_pvt.c delete mode 100755 src/lib/dl/ext/lame/quantize_pvt.h delete mode 100755 src/lib/dl/ext/lame/reservoir.c delete mode 100755 src/lib/dl/ext/lame/reservoir.h delete mode 100755 src/lib/dl/ext/lame/rtp.c delete mode 100755 src/lib/dl/ext/lame/rtp.h delete mode 100755 src/lib/dl/ext/lame/set_get.c delete mode 100755 src/lib/dl/ext/lame/set_get.h delete mode 100755 src/lib/dl/ext/lame/tabinit.c delete mode 100755 src/lib/dl/ext/lame/tabinit.h delete mode 100755 src/lib/dl/ext/lame/tables.c delete mode 100755 src/lib/dl/ext/lame/tables.h delete mode 100755 src/lib/dl/ext/lame/takehiro.c delete mode 100755 src/lib/dl/ext/lame/timestatus.c delete mode 100755 src/lib/dl/ext/lame/timestatus.h delete mode 100755 src/lib/dl/ext/lame/util.c delete mode 100755 src/lib/dl/ext/lame/util.h delete mode 100755 src/lib/dl/ext/lame/vbrquantize.c delete mode 100755 src/lib/dl/ext/lame/vbrquantize.h delete mode 100755 src/lib/dl/ext/lame/vbrtag.c delete mode 100755 src/lib/dl/ext/lame/vbrtag.h delete mode 100755 src/lib/dl/ext/lame/vector/lame_intrin.h delete mode 100755 src/lib/dl/ext/lame/vector/xmm_quantize_sub.c delete mode 100755 src/lib/dl/ext/lame/version.c delete mode 100755 src/lib/dl/ext/lame/version.h delete mode 100755 src/lib/dl/ext/libmad/CLEAN.BAT delete mode 100755 src/lib/dl/ext/libmad/MAKE.BAT delete mode 100755 src/lib/dl/ext/libmad/bit.c delete mode 100755 src/lib/dl/ext/libmad/bit.h delete mode 100755 src/lib/dl/ext/libmad/common.mak delete mode 100755 src/lib/dl/ext/libmad/config.h delete mode 100755 src/lib/dl/ext/libmad/d.dat delete mode 100755 src/lib/dl/ext/libmad/decoder.c delete mode 100755 src/lib/dl/ext/libmad/decoder.h delete mode 100755 src/lib/dl/ext/libmad/fixed.c delete mode 100755 src/lib/dl/ext/libmad/fixed.h delete mode 100755 src/lib/dl/ext/libmad/frame.c delete mode 100755 src/lib/dl/ext/libmad/frame.h delete mode 100755 src/lib/dl/ext/libmad/global.h delete mode 100755 src/lib/dl/ext/libmad/huffman.c delete mode 100755 src/lib/dl/ext/libmad/huffman.h delete mode 100755 src/lib/dl/ext/libmad/imdct_s.dat delete mode 100755 src/lib/dl/ext/libmad/layer12.c delete mode 100755 src/lib/dl/ext/libmad/layer12.h delete mode 100755 src/lib/dl/ext/libmad/layer3.c delete mode 100755 src/lib/dl/ext/libmad/layer3.h delete mode 100755 src/lib/dl/ext/libmad/mad.h delete mode 100755 src/lib/dl/ext/libmad/playcom.h delete mode 100755 src/lib/dl/ext/libmad/qc_table.dat delete mode 100755 src/lib/dl/ext/libmad/readme delete mode 100755 src/lib/dl/ext/libmad/rq_table.dat delete mode 100755 src/lib/dl/ext/libmad/sf_table.dat delete mode 100755 src/lib/dl/ext/libmad/stream.c delete mode 100755 src/lib/dl/ext/libmad/stream.h delete mode 100755 src/lib/dl/ext/libmad/synth.c delete mode 100755 src/lib/dl/ext/libmad/synth.h delete mode 100755 src/lib/dl/ext/libmad/timer.c delete mode 100755 src/lib/dl/ext/libmad/timer.h delete mode 100755 src/lib/dl/ext/libmad/version.c delete mode 100755 src/lib/dl/ext/libmad/version.h delete mode 100755 src/lib/dl/ext/libogg/CLEAN.BAT delete mode 100755 src/lib/dl/ext/libogg/MAKE.BAT delete mode 100755 src/lib/dl/ext/libogg/bitwise.c delete mode 100755 src/lib/dl/ext/libogg/common.mak delete mode 100755 src/lib/dl/ext/libogg/config.h delete mode 100755 src/lib/dl/ext/libogg/config_types.h delete mode 100755 src/lib/dl/ext/libogg/framing.c delete mode 100755 src/lib/dl/ext/libogg/ogg.h delete mode 100755 src/lib/dl/ext/libogg/os_types.h delete mode 100755 src/lib/dl/ext/readme delete mode 100755 src/lib/dl/ext/speex/CLEAN.BAT delete mode 100755 src/lib/dl/ext/speex/MAKE.BAT delete mode 100755 src/lib/dl/ext/speex/_kiss_fft_guts.h delete mode 100755 src/lib/dl/ext/speex/arch.h delete mode 100755 src/lib/dl/ext/speex/bits.c delete mode 100755 src/lib/dl/ext/speex/buffer.c delete mode 100755 src/lib/dl/ext/speex/cb_search.c delete mode 100755 src/lib/dl/ext/speex/cb_search.h delete mode 100755 src/lib/dl/ext/speex/cb_search_arm4.h delete mode 100755 src/lib/dl/ext/speex/cb_search_bfin.h delete mode 100755 src/lib/dl/ext/speex/cb_search_sse.h delete mode 100755 src/lib/dl/ext/speex/common.mak delete mode 100755 src/lib/dl/ext/speex/config.h delete mode 100755 src/lib/dl/ext/speex/exc_10_16_table.c delete mode 100755 src/lib/dl/ext/speex/exc_10_32_table.c delete mode 100755 src/lib/dl/ext/speex/exc_20_32_table.c delete mode 100755 src/lib/dl/ext/speex/exc_5_256_table.c delete mode 100755 src/lib/dl/ext/speex/exc_5_64_table.c delete mode 100755 src/lib/dl/ext/speex/exc_8_128_table.c delete mode 100755 src/lib/dl/ext/speex/fftwrap.c delete mode 100755 src/lib/dl/ext/speex/fftwrap.h delete mode 100755 src/lib/dl/ext/speex/filterbank.c delete mode 100755 src/lib/dl/ext/speex/filterbank.h delete mode 100755 src/lib/dl/ext/speex/filters.c delete mode 100755 src/lib/dl/ext/speex/filters.h delete mode 100755 src/lib/dl/ext/speex/filters_arm4.h delete mode 100755 src/lib/dl/ext/speex/filters_bfin.h delete mode 100755 src/lib/dl/ext/speex/filters_sse.h delete mode 100755 src/lib/dl/ext/speex/fixed_arm4.h delete mode 100755 src/lib/dl/ext/speex/fixed_arm5e.h delete mode 100755 src/lib/dl/ext/speex/fixed_bfin.h delete mode 100755 src/lib/dl/ext/speex/fixed_debug.h delete mode 100755 src/lib/dl/ext/speex/fixed_generic.h delete mode 100755 src/lib/dl/ext/speex/gain_table.c delete mode 100755 src/lib/dl/ext/speex/gain_table_lbr.c delete mode 100755 src/lib/dl/ext/speex/getopt.c delete mode 100755 src/lib/dl/ext/speex/getopt.h delete mode 100755 src/lib/dl/ext/speex/getopt1.c delete mode 100755 src/lib/dl/ext/speex/getopt_win.h delete mode 100755 src/lib/dl/ext/speex/hexc_10_32_table.c delete mode 100755 src/lib/dl/ext/speex/hexc_table.c delete mode 100755 src/lib/dl/ext/speex/high_lsp_tables.c delete mode 100755 src/lib/dl/ext/speex/jitter.c delete mode 100755 src/lib/dl/ext/speex/kiss_fft.c delete mode 100755 src/lib/dl/ext/speex/kiss_fft.h delete mode 100755 src/lib/dl/ext/speex/kiss_fftr.c delete mode 100755 src/lib/dl/ext/speex/kiss_fftr.h delete mode 100755 src/lib/dl/ext/speex/lpc.c delete mode 100755 src/lib/dl/ext/speex/lpc.h delete mode 100755 src/lib/dl/ext/speex/lpc_bfin.h delete mode 100755 src/lib/dl/ext/speex/lsp.c delete mode 100755 src/lib/dl/ext/speex/lsp.h delete mode 100755 src/lib/dl/ext/speex/lsp_bfin.h delete mode 100755 src/lib/dl/ext/speex/lsp_tables_nb.c delete mode 100755 src/lib/dl/ext/speex/ltp.c delete mode 100755 src/lib/dl/ext/speex/ltp.h delete mode 100755 src/lib/dl/ext/speex/ltp_arm4.h delete mode 100755 src/lib/dl/ext/speex/ltp_bfin.h delete mode 100755 src/lib/dl/ext/speex/ltp_sse.h delete mode 100755 src/lib/dl/ext/speex/math_approx.h delete mode 100755 src/lib/dl/ext/speex/mdf.c delete mode 100755 src/lib/dl/ext/speex/misc_bfin.h delete mode 100755 src/lib/dl/ext/speex/modes.c delete mode 100755 src/lib/dl/ext/speex/modes.h delete mode 100755 src/lib/dl/ext/speex/modes_wb.c delete mode 100755 src/lib/dl/ext/speex/nb_celp.c delete mode 100755 src/lib/dl/ext/speex/nb_celp.h delete mode 100755 src/lib/dl/ext/speex/os_support.h delete mode 100755 src/lib/dl/ext/speex/preprocess.c delete mode 100755 src/lib/dl/ext/speex/pseudofloat.h delete mode 100755 src/lib/dl/ext/speex/quant_lsp.c delete mode 100755 src/lib/dl/ext/speex/quant_lsp.h delete mode 100755 src/lib/dl/ext/speex/quant_lsp_bfin.h delete mode 100755 src/lib/dl/ext/speex/resample.c delete mode 100755 src/lib/dl/ext/speex/resample_sse.h delete mode 100755 src/lib/dl/ext/speex/sb_celp.c delete mode 100755 src/lib/dl/ext/speex/sb_celp.h delete mode 100755 src/lib/dl/ext/speex/scal.c delete mode 100755 src/lib/dl/ext/speex/skeleton.c delete mode 100755 src/lib/dl/ext/speex/skeleton.h delete mode 100755 src/lib/dl/ext/speex/smallft.c delete mode 100755 src/lib/dl/ext/speex/smallft.h delete mode 100755 src/lib/dl/ext/speex/speex.c delete mode 100755 src/lib/dl/ext/speex/speex.h delete mode 100755 src/lib/dl/ext/speex/speex_bits.h delete mode 100755 src/lib/dl/ext/speex/speex_buffer.h delete mode 100755 src/lib/dl/ext/speex/speex_callbacks.c delete mode 100755 src/lib/dl/ext/speex/speex_callbacks.h delete mode 100755 src/lib/dl/ext/speex/speex_config_types.h delete mode 100755 src/lib/dl/ext/speex/speex_echo.h delete mode 100755 src/lib/dl/ext/speex/speex_header.c delete mode 100755 src/lib/dl/ext/speex/speex_header.h delete mode 100755 src/lib/dl/ext/speex/speex_jitter.h delete mode 100755 src/lib/dl/ext/speex/speex_preprocess.h delete mode 100755 src/lib/dl/ext/speex/speex_resampler.h delete mode 100755 src/lib/dl/ext/speex/speex_stereo.h delete mode 100755 src/lib/dl/ext/speex/speex_types.h delete mode 100755 src/lib/dl/ext/speex/speexdec.c delete mode 100755 src/lib/dl/ext/speex/speexenc.c delete mode 100755 src/lib/dl/ext/speex/stack_alloc.h delete mode 100755 src/lib/dl/ext/speex/stereo.c delete mode 100755 src/lib/dl/ext/speex/testdenoise.c delete mode 100755 src/lib/dl/ext/speex/testecho.c delete mode 100755 src/lib/dl/ext/speex/testenc.c delete mode 100755 src/lib/dl/ext/speex/testenc_uwb.c delete mode 100755 src/lib/dl/ext/speex/testenc_wb.c delete mode 100755 src/lib/dl/ext/speex/testjitter.c delete mode 100755 src/lib/dl/ext/speex/vbr.c delete mode 100755 src/lib/dl/ext/speex/vbr.h delete mode 100755 src/lib/dl/ext/speex/vorbis_psy.h delete mode 100755 src/lib/dl/ext/speex/vq.c delete mode 100755 src/lib/dl/ext/speex/vq.h delete mode 100755 src/lib/dl/ext/speex/vq_arm4.h delete mode 100755 src/lib/dl/ext/speex/vq_bfin.h delete mode 100755 src/lib/dl/ext/speex/vq_sse.h delete mode 100755 src/lib/dl/ext/speex/wav_io.c delete mode 100755 src/lib/dl/ext/speex/wav_io.h delete mode 100755 src/lib/dl/ext/speex/wave_out.c delete mode 100755 src/lib/dl/ext/speex/wave_out.h delete mode 100755 src/lib/dl/ext/speex/window.c delete mode 100755 src/lib/dl/ext/vorbis/CLEAN.BAT delete mode 100755 src/lib/dl/ext/vorbis/MAKE.BAT delete mode 100755 src/lib/dl/ext/vorbis/analysis.c delete mode 100755 src/lib/dl/ext/vorbis/backends.h delete mode 100755 src/lib/dl/ext/vorbis/barkmel.c delete mode 100755 src/lib/dl/ext/vorbis/bitrate.c delete mode 100755 src/lib/dl/ext/vorbis/bitrate.h delete mode 100755 src/lib/dl/ext/vorbis/block.c delete mode 100755 src/lib/dl/ext/vorbis/books/coupled/res_books_51.h delete mode 100755 src/lib/dl/ext/vorbis/books/coupled/res_books_stereo.h delete mode 100755 src/lib/dl/ext/vorbis/books/floor/floor_books.h delete mode 100755 src/lib/dl/ext/vorbis/books/uncoupled/res_books_uncoupled.h delete mode 100755 src/lib/dl/ext/vorbis/codebook.c delete mode 100755 src/lib/dl/ext/vorbis/codebook.h delete mode 100755 src/lib/dl/ext/vorbis/codec.h delete mode 100755 src/lib/dl/ext/vorbis/codec_internal.h delete mode 100755 src/lib/dl/ext/vorbis/common.mak delete mode 100755 src/lib/dl/ext/vorbis/config.h delete mode 100755 src/lib/dl/ext/vorbis/envelope.c delete mode 100755 src/lib/dl/ext/vorbis/envelope.h delete mode 100755 src/lib/dl/ext/vorbis/floor0.c delete mode 100755 src/lib/dl/ext/vorbis/floor1.c delete mode 100755 src/lib/dl/ext/vorbis/highlevel.h delete mode 100755 src/lib/dl/ext/vorbis/info.c delete mode 100755 src/lib/dl/ext/vorbis/lookup.c delete mode 100755 src/lib/dl/ext/vorbis/lookup.h delete mode 100755 src/lib/dl/ext/vorbis/lookup_data.h delete mode 100755 src/lib/dl/ext/vorbis/lpc.c delete mode 100755 src/lib/dl/ext/vorbis/lpc.h delete mode 100755 src/lib/dl/ext/vorbis/lsp.c delete mode 100755 src/lib/dl/ext/vorbis/lsp.h delete mode 100755 src/lib/dl/ext/vorbis/mapping0.c delete mode 100755 src/lib/dl/ext/vorbis/masking.h delete mode 100755 src/lib/dl/ext/vorbis/mdct.c delete mode 100755 src/lib/dl/ext/vorbis/mdct.h delete mode 100755 src/lib/dl/ext/vorbis/misc.h delete mode 100755 src/lib/dl/ext/vorbis/modes/floor_all.h delete mode 100755 src/lib/dl/ext/vorbis/modes/psych_11.h delete mode 100755 src/lib/dl/ext/vorbis/modes/psych_16.h delete mode 100755 src/lib/dl/ext/vorbis/modes/psych_44.h delete mode 100755 src/lib/dl/ext/vorbis/modes/psych_8.h delete mode 100755 src/lib/dl/ext/vorbis/modes/residue_16.h delete mode 100755 src/lib/dl/ext/vorbis/modes/residue_44.h delete mode 100755 src/lib/dl/ext/vorbis/modes/residue_44p51.h delete mode 100755 src/lib/dl/ext/vorbis/modes/residue_44u.h delete mode 100755 src/lib/dl/ext/vorbis/modes/residue_8.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_11.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_16.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_22.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_32.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_44.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_44p51.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_44u.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_8.h delete mode 100755 src/lib/dl/ext/vorbis/modes/setup_x.h delete mode 100755 src/lib/dl/ext/vorbis/os.h delete mode 100755 src/lib/dl/ext/vorbis/psy.c delete mode 100755 src/lib/dl/ext/vorbis/psy.h delete mode 100755 src/lib/dl/ext/vorbis/registry.c delete mode 100755 src/lib/dl/ext/vorbis/registry.h delete mode 100755 src/lib/dl/ext/vorbis/res0.c delete mode 100755 src/lib/dl/ext/vorbis/scales.h delete mode 100755 src/lib/dl/ext/vorbis/sharedbook.c delete mode 100755 src/lib/dl/ext/vorbis/smallft.c delete mode 100755 src/lib/dl/ext/vorbis/smallft.h delete mode 100755 src/lib/dl/ext/vorbis/synthesis.c delete mode 100755 src/lib/dl/ext/vorbis/vorbisenc.c delete mode 100755 src/lib/dl/ext/vorbis/vorbisenc.h delete mode 100755 src/lib/dl/ext/vorbis/vorbisfile.c delete mode 100755 src/lib/dl/ext/vorbis/vorbisfile.h delete mode 100755 src/lib/dl/ext/vorbis/window.c delete mode 100755 src/lib/dl/ext/vorbis/window.h delete mode 100755 src/lib/dl/ext/vorbtool/CLEAN.BAT delete mode 100755 src/lib/dl/ext/vorbtool/MAKE.BAT delete mode 100755 src/lib/dl/ext/vorbtool/audio.c delete mode 100755 src/lib/dl/ext/vorbtool/audio.h delete mode 100755 src/lib/dl/ext/vorbtool/charmaps.h delete mode 100755 src/lib/dl/ext/vorbtool/charset.c delete mode 100755 src/lib/dl/ext/vorbtool/charset.h delete mode 100755 src/lib/dl/ext/vorbtool/charset_test.c delete mode 100755 src/lib/dl/ext/vorbtool/charsetmap.h delete mode 100755 src/lib/dl/ext/vorbtool/common.mak delete mode 100755 src/lib/dl/ext/vorbtool/config.h delete mode 100755 src/lib/dl/ext/vorbtool/easyflac.c delete mode 100755 src/lib/dl/ext/vorbtool/easyflac.h delete mode 100755 src/lib/dl/ext/vorbtool/encode.c delete mode 100755 src/lib/dl/ext/vorbtool/encode.h delete mode 100755 src/lib/dl/ext/vorbtool/flac.c delete mode 100755 src/lib/dl/ext/vorbtool/flac.h delete mode 100755 src/lib/dl/ext/vorbtool/getopt.c delete mode 100755 src/lib/dl/ext/vorbtool/getopt.h delete mode 100755 src/lib/dl/ext/vorbtool/getopt1.c delete mode 100755 src/lib/dl/ext/vorbtool/i18n.h delete mode 100755 src/lib/dl/ext/vorbtool/iconvert.c delete mode 100755 src/lib/dl/ext/vorbtool/lyrics.c delete mode 100755 src/lib/dl/ext/vorbtool/lyrics.h delete mode 100755 src/lib/dl/ext/vorbtool/makemap.c delete mode 100755 src/lib/dl/ext/vorbtool/oggdec.c delete mode 100755 src/lib/dl/ext/vorbtool/oggenc.c delete mode 100755 src/lib/dl/ext/vorbtool/ogginfo2.c delete mode 100755 src/lib/dl/ext/vorbtool/platform.c delete mode 100755 src/lib/dl/ext/vorbtool/platform.h delete mode 100755 src/lib/dl/ext/vorbtool/resample.c delete mode 100755 src/lib/dl/ext/vorbtool/resample.h delete mode 100755 src/lib/dl/ext/vorbtool/skeleton.c delete mode 100755 src/lib/dl/ext/vorbtool/skeleton.h delete mode 100755 src/lib/dl/ext/vorbtool/theora.c delete mode 100755 src/lib/dl/ext/vorbtool/theora.h delete mode 100755 src/lib/dl/ext/vorbtool/utf8.c delete mode 100755 src/lib/dl/ext/vorbtool/utf8.h delete mode 100755 src/lib/dl/ext/zlib/CLEAN.BAT delete mode 100755 src/lib/dl/ext/zlib/MAKE.BAT delete mode 100755 src/lib/dl/ext/zlib/adler32.c delete mode 100755 src/lib/dl/ext/zlib/common.mak delete mode 100755 src/lib/dl/ext/zlib/compress.c delete mode 100755 src/lib/dl/ext/zlib/crc32.c delete mode 100755 src/lib/dl/ext/zlib/crc32.h delete mode 100755 src/lib/dl/ext/zlib/deflate.c delete mode 100755 src/lib/dl/ext/zlib/deflate.h delete mode 100755 src/lib/dl/ext/zlib/example.c delete mode 100755 src/lib/dl/ext/zlib/gzclose.c delete mode 100755 src/lib/dl/ext/zlib/gzguts.h delete mode 100755 src/lib/dl/ext/zlib/gzlib.c delete mode 100755 src/lib/dl/ext/zlib/gzread.c delete mode 100755 src/lib/dl/ext/zlib/gzwrite.c delete mode 100755 src/lib/dl/ext/zlib/infback.c delete mode 100755 src/lib/dl/ext/zlib/inffast.c delete mode 100755 src/lib/dl/ext/zlib/inffast.h delete mode 100755 src/lib/dl/ext/zlib/inffixed.h delete mode 100755 src/lib/dl/ext/zlib/inflate.c delete mode 100755 src/lib/dl/ext/zlib/inflate.h delete mode 100755 src/lib/dl/ext/zlib/inftrees.c delete mode 100755 src/lib/dl/ext/zlib/inftrees.h delete mode 100755 src/lib/dl/ext/zlib/minigzip.c delete mode 100755 src/lib/dl/ext/zlib/trees.c delete mode 100755 src/lib/dl/ext/zlib/trees.h delete mode 100755 src/lib/dl/ext/zlib/uncompr.c delete mode 100755 src/lib/dl/ext/zlib/zconf.h delete mode 100755 src/lib/dl/ext/zlib/zlib.h delete mode 100755 src/lib/dl/ext/zlib/zutil.c delete mode 100755 src/lib/dl/ext/zlib/zutil.h delete mode 100755 src/lib/dl/himemsys.c delete mode 100755 src/lib/dl/himemsys.h delete mode 100755 test.smp delete mode 100755 x-demo.smp delete mode 100755 x_demo.smp diff --git a/src/lib/fmapread.c b/16/src/lib/fmapread.c similarity index 100% rename from src/lib/fmapread.c rename to 16/src/lib/fmapread.c diff --git a/src/lib/fmapread.h b/16/src/lib/fmapread.h similarity index 100% rename from src/lib/fmapread.h rename to 16/src/lib/fmapread.h diff --git a/src/lib/planar.c b/16/src/lib/planar.c similarity index 100% rename from src/lib/planar.c rename to 16/src/lib/planar.c diff --git a/src/lib/planar.h b/16/src/lib/planar.h similarity index 100% rename from src/lib/planar.h rename to 16/src/lib/planar.h diff --git a/makefile b/makefile index 0f0c5660..1258874e 100755 --- a/makefile +++ b/makefile @@ -92,9 +92,8 @@ FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS) VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ) DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) 16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ) - -GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ) 16_vrs.$(OBJ) $(DOSLIBLIBS) - +GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16_vrs.$(OBJ) $(DOSLIBLIBS) +#planar.$(OBJ) 16planar.$(OBJ) DOSLIBLIBS=$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib !ifeq DEBUGSERIAL 1 @@ -103,8 +102,8 @@ DOSLIBOBJ += 8250.$(OBJ) DOSLIBLIBS += $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)8250$(DIRSEP)dos86h$(DIRSEP)8250.lib !endif -TESTEXEC = test.exe test0.exe pcxtest.exe pcxtest2.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe planrpcx.exe exmmtest.exe - +TESTEXEC = test.exe test0.exe pcxtest.exe pcxtest2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe exmmtest.exe +#planrpcx.exe test2.exe EXEC = 16.exe bakapi.exe tesuto.exe 0.exe $(TESTEXEC) all: $(EXEC) joytest.exe @@ -161,8 +160,8 @@ tesuto.$(OBJ): $(SRC)tesuto.c test.exe: test.$(OBJ) gfx.lib $(DOSLIBLIBS) $(16LIB) wcl $(FLAGS) test.$(OBJ) gfx.lib $(DOSLIBLIBS) $(16LIB) -fm=test.mah -test2.exe: test2.$(OBJ) $(DOSLIBLIBS) gfx.lib - wcl $(FLAGS) test2.$(OBJ) $(DOSLIBLIBS) gfx.lib -fm=test2.mah +#test2.exe: test2.$(OBJ) $(DOSLIBLIBS) gfx.lib +# wcl $(FLAGS) test2.$(OBJ) $(DOSLIBLIBS) gfx.lib -fm=test2.mah test0.exe: test0.$(OBJ) wcl $(FLAGS) test0.$(OBJ) -fm=test0.mah @@ -194,8 +193,8 @@ palettel.exe: palettel.$(OBJ) gfx.lib #$(16LIB) pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib wcl $(FLAGS) pcxtest2.$(OBJ) gfx.lib -fm=pcxtest2.mah -planrpcx.exe: planrpcx.$(OBJ) gfx.lib - wcl $(FLAGS) planrpcx.$(OBJ) gfx.lib -fm=planrpcx.mah +##planrpcx.exe: planrpcx.$(OBJ) gfx.lib +## wcl $(FLAGS) planrpcx.$(OBJ) gfx.lib -fm=planrpcx.mah maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib wcl $(FLAGS) maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIB) gfx.lib -fm=maptest.mah @@ -224,8 +223,8 @@ bakapi.$(OBJ): $(SRC)bakapi.h $(SRC)bakapi.c test.$(OBJ): $(SRC)test.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)test.c -test2.$(OBJ): $(SRC)test2.c $(SRCLIB)modex16.h - wcl $(FLAGS) -c $(SRC)test2.c +#test2.$(OBJ): $(SRC)test2.c $(SRCLIB)modex16.h +# wcl $(FLAGS) -c $(SRC)test2.c test0.$(OBJ): $(SRC)test0.c wcl $(FLAGS) -c $(SRC)test0.c @@ -233,8 +232,8 @@ test0.$(OBJ): $(SRC)test0.c pcxtest.$(OBJ): $(SRC)pcxtest.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)pcxtest.c -planrpcx.$(OBJ): $(SRC)planrpcx.c $(SRCLIB)modex16.h - wcl $(FLAGS) -c $(SRC)planrpcx.c +##planrpcx.$(OBJ): $(SRC)planrpcx.c $(SRCLIB)modex16.h +## wcl $(FLAGS) -c $(SRC)planrpcx.c pcxtest2.$(OBJ): $(SRC)pcxtest2.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)pcxtest2.c @@ -334,8 +333,8 @@ bakapee.$(OBJ): $(SRCLIB)bakapee.h $(SRCLIB)bakapee.c 16render.$(OBJ): $(MODEXLIB)16render.h $(MODEXLIB)16render.c wcl $(FLAGS) -c $(MODEXLIB)16render.c -16planar.$(OBJ): $(MODEXLIB)16planar.h $(MODEXLIB)16planar.c - wcl $(FLAGS) -c $(MODEXLIB)16planar.c +##16planar.$(OBJ): $(MODEXLIB)16planar.h $(MODEXLIB)16planar.c +## wcl $(FLAGS) -c $(MODEXLIB)16planar.c 16_vrs.$(OBJ): $(SRCLIB)16_vrs.h $(SRCLIB)16_vrs.c wcl $(FLAGS) -c $(SRCLIB)16_vrs.c @@ -343,8 +342,8 @@ bakapee.$(OBJ): $(SRCLIB)bakapee.h $(SRCLIB)bakapee.c bitmap.$(OBJ): $(SRCLIB)bitmap.h $(SRCLIB)bitmap.c wcl $(FLAGS) -c $(SRCLIB)bitmap.c -planar.$(OBJ): $(SRCLIB)planar.h $(SRCLIB)planar.c - wcl $(FLAGS) -c $(SRCLIB)planar.c +##planar.$(OBJ): $(SRCLIB)planar.h $(SRCLIB)planar.c +## wcl $(FLAGS) -c $(SRCLIB)planar.c scroll16.$(OBJ): $(SRCLIB)scroll16.h $(SRCLIB)scroll16.c wcl $(FLAGS) -c $(SRCLIB)scroll16.c diff --git a/pcx2vrl b/pcx2vrl index 3d9ac6e6d0e4fe19bb8f1962de5fd02253dea7be..bd947e55158b82b4f9d900234745aca806cde60e 100755 GIT binary patch literal 10128 zcmb7K4|G&jdcTty*cf9b{83R*Uo|Lr%m|pJL_ib5191T(Bq*i&oMc{j6O)g7{ch&9Lu2R-NZRs}W=pu)1F$4q`J*QdA*|J-Dnx19t#Ke|mDPnb<{(kqq zH+dP??e^x}x%YR!?|%2Y-~H}=_fNj1uU_Hv`GgxvgkMOsGf-NC!r|)`rABC?RLl|A zikV_Eib$*J1`ndFfJ&247C`iq23)fPbi`@EjHFREqYSKzIO_@_7+GIbD!MFt6*R;q zRQMc~*)HiNNalcl4rq)yU`Eo}2IF0*a~IlXTn^0W(i(qdN5thQ_zv1flzs8g?W*kEy)BfAhZZQ=q_J-+*EZu<>B%}8BHNyhNZXM9uRq-XWb(yV z-uup9S6v8P(h%PJQg$KxMLSW3w1rk8t^;Z2#UO{7ezvUWBb8Jf{fXT7>l?94o?C7vYD1yI%{G(*9G# zRpL^lOP+OcPza1=E5~r5Fjn1Tr0hsEW~5VQL>NXml`@mI(H4$&h)%OJW!fk-lgU`z z=!mz5?PxqEl4dv}+7fBIRdl3G^I?&)lXg6f3gHeg0Y*?mv~5jBZBw*%#8ak-C(Ib? zB%?9Ajr^^h2`1o+C(!~mf+Arw-5HL8GijPA-rO0FImL!pxq8*I24g{J9=e11;QcGc zF3ktO;-B(i)~k$0FC+I`1PGO|)8tZRuSsw^4ft!QP{kC^Ifp46_!g!x=sc!y)EcI6 z^hHd+2KzFFoI0kLVD2$3!+d0l0a(qnT!==d(4dKFg%I~M#gP0dQ%t6Zm`)KQ!W7Q6 zJ~LLDdlU-oIAUO8WHX=V^ZA|uds1#Ew9gzZ-E>6czdi%p`PsAZ%Rc32vlkY#Bg0_N z&t`8d(nf|PX0I$x-H`!_**j|nalgdurKJ(SEHQg)%^}_`F?(%s97eh&X78;<#0iOM z1*?wuA&F@X>n`F(iD?z9k+@D`TF1Jdc%H=mQ>si}~ z&whb|*|eh7O*||yt!eEd9s-{K@q@kpo;h>2v1y&9VP07M&jd>E-C(`-B-T{}_0PBM z_WosORUPr-11X5BPT(hVaq^a{4?wQKkW6Xr{Z(dcx*ZGEideNSFP*(iFo+>L=HmaH*sG6+U_v4$$(!KNv2oULMlCL!P7*sqq ziDf=C(YE_Q6+Q^r%AOC>lSZHG+ag@K=afQ?c`0%vjcQ85o^I4_Y`>%3XVszqxl3Ub zwCWVsptzgG=YKn13^#0SFUvhMfpaQ2e?-m`9?r)0MJRrk#czD6IPe^bzc-=yc51=m zo(aXZD1MB^F;)DNBYmr@0vNUYH$O)&*58{MOZ2{XTt80>9oNsQWK1RRbIOmrjNh#O zeqW=nxB30P={=-n8v?$etmxH;vieYPzgSWo>}dvHMj!IICH6V=*4mH8^XZ}74>99l z91QT4EI!~Azu*?9gSl5>l>@TLC7Al;`Ui*Wn+2}xzEYF(BcDJq)_U8iwfGOHb#~;i zQ|qu(YtkQ3YiuOz)H>qS`p3_l?xjOtpl+NK7Bs7 zM`_!uAINka5Zf2#&Y~a-dU<2cbZCRJ*>zyIK9`MtPZ5;3KbPVH?Ijd=ASYabZ|>-N zvl|Qj)<1Hl!7Mo7wcmyVe*8buLaO>ERL|;f?j3>+_V7nG{R_pi_b5yG(=(8ELABiOQ>it>0pYx$Cy;A1tN|yN2OH|gsq%=KWW$RIT zBeQQc24qrK+EzQ5nx={-tD-U#C0#YIf|~8J|DSs7I1Oql=4HXR2KJt$YLr@63Wyo2 zKmcIwVDHf0Qw4gNmp<90pJqqMv^0--xV3x_3zqWBzs1#~9C|!KJ+ATUk;S(>dpVnz z)zKA~e;W9oA^*o0J$i2fzY?CuMA}k*d{X7#V4XmIv`m)oC6==GPG^pmUh0Em1$Vvy zE@^Ew%sW0}v2UnXKb6%_(e~xRo~OYBB-gA{a(psfW5RwE?qK}@-LdMiDaohDaxW;Y z#%IEZC~#)NCWls-31ikP=t*PlS#MW%V>?5!+@I&ur|2<{E4t%9Zz|-NhZYU~-JtaM zk3Nwm>DBjTy7q~Jt6vL~9i_<*D!Q67bI?v!-`A_3oFEAc@IH3_^*!`U7-6K_+jrPw zm;PFCzy8|n0hBN0PkJ43X86us`g?omyS4hMWXWi_U@%o_^oFc{Qd;n2aDVe_yDCxZ zy-d!BS|BXeUq_wE-CggA^goXVi&$N;sdB{{e7qf>O*MtM$P8SNJ%{dcvKI}@*_?1K z<1SG5puicHqpB`uGQYoApw2qO@|hwibA5^dhS>JXcG0Il-I)7A5s&LnZ&(yV_LnlM#yRr%^a2yZ1b#kzp80mq?+Uj;)pOGQj_a>e z-U#-^7^#!J`pd`k6Zj;aEIF$!8myBM|B1f5{-C*tRI`L=Fq|9ks+N%mrEta%@^!xg9naYQ4j_h zFG-(1(W?(<^?_df460xPL6k^WWV%j^G#1mBG2uq%v)?xA4)-;7qik0teli1o(#lZU zJ2+nG%Ql~eZuA5UWAO2F_yiXkJtmmP+}U!K^(m&fHIIwYFPZz8GycW%lKCK=Ywi%7 zvC(3d&R7i+Hc%NjoAlONJr{hule;?gnOdXhavR-eUfj6pfxhtPo(=cz=KJR7H>}U4 z!MEecMqFZK#%5(Zs^;~*Q4Y)Gets^W@5_`TJNMY(FG_kY*f;gwCcFFgpy+6PV)|}DBLGiqN0v=c3d_K4RFrYs-wTB?m8UtwPSrsGpdJ!pH{8dpH#O2k=cm-%v}ylbT1yc?y0I5Wk^ARh}_oO+%`ItYyH z|2yzb*{$>;+PZ)^xhGJ11>%i}3lUc!Za{29+=93h@p;5o5%(h=L;M-yhlm#tU3n`T z8gAF-EH_)CSO;rDwV?&o^XJV~IZ;Gh6soD7PZ}~pgi_l(?QjcH+%U@2a&x#yG?NJt z!n`s=^~+XO+u_X)+8j%VTGCP6R!1WuL}Z0imIy_*#~@Foc2ZHcn8_6HG$oq@4A7Eh z2l-Vd(P4{FG#16LZEnMF8vsc0NZ1aGkZBohSYS-UilC;8R1G7XOoq3s8g9P56>Jb5 z?u@pg;Wz~1CnQ@@5?fL!5yHo$(~Q}!6(^>AV_=E%av|^i6;|GC73lOXA?S~aP7hW7 zsIc@>>8A?QTZM4_$S-hEMWCNC^-IrF{-`h~tnyQZ7rcMAl+oB_ChEnvJ;z{iMfMk#*h1TZ}4L^;9PV=K>Rw-9=q-P&^~L_ zIsGp||3knD53UDx*C5jG1AYSSQLYcQ+mLd-K>|EY^daTCMNIzhBIWu-?1Mez&WZqm z`V1oF*4&lHb&$6L^bE>Bjg)6H7k>oI)0T@b0P|SuVm}1&OyJ_Fz&wk)SOezi(Z#p2 zVQda7;hJo(7MQzEmwq=ek2Nml{oH5hAHN;!-=6?;4@%GV!9M^Cf&ELNV8-)q|EGu@ zz+U?on2{lWALy<<1?=^GVAnr<@Q>GkU3-##5ZLt(A6Drh)`!1x=1qlu!@zE!H=ZlP zC2ERF77f4G0?$ML*x#uomx&r+*WWZTL)-~WeGQjuXq;>PBVcuTm$h}iLD z$_S^o2_9B(x-cW5g$w?;7LtDllff^Y`feHc7A3diWsYCENV>CgJF0k)!4KpF*6~f~ z_))+%bCrW^}VL` zDRr1IjK+0(Q`1IcMf2K*rd9W>HH^@0x7{`mJzKG^evNMEYnQ{$%II!>LO=0lx_sl> z`ZcQ>z~!OHw@hKITz${7`qjogD^{%6n~bLVWvg|Hlh2*4skAh&^Bh`NH~zrM6NDEV ztD4prA8D;;|{)Ur)*AK@BRKF4~+@paXU4O4DA zhJ5(f+kLRHch+JaH$MY7!VdkAcUWNw|c~&AH_qT)KyBT@6U6wOG zjL5SU^W682flou;+b*DZ1d+R6^6`9D4yCD&E02BPBA-Dd-!ep==VpPxa~}D)H+1=) zLY}&^9eyA7fp7!zZXh4SlZY-K_tirn$g{VkDjmrCtcOp2?;!YkXZuZ7>dL?~v@4JM zgerW5cm{QY+wS*KKtA@D-^)edJ4WCHm+w_zmrw57anQwKt`JPJ5A3#-0@?_WUYSdfqVLH_?0 z^#$lwI>FrGtn<#8WofsgID!Igax z1uUn2+#e>u_acE4>YVhqNGWfggUMIx%V ZNNz`@e)KK+yjNcTwa~#;9yC|p{{q#?cm@Cf literal 14456 zcmeHOe{@vUoxhV|AO^?;1mu_UB%)x=2oz$#SSJY&UN`|FCW3VF%_Q?eMw6N8{D8nI z8VGSSXQbt{)q_2|J?xRXEONGNPm6AJA%IKRv$e+Vw#&A3H`X7UG3rL~2in!y&-cE2 zCvRRduKUOCUtZ3<@BMzhKkoPbeDB^|9#QMo7C0PCrULd2M%idC?nKH{?Un22L5SKEcMt5cp$pj;krE-iy)D>OzT)<_ zKv`Qbl;|kys3j8`xzmW&8&Vz5wgYV9R-vfLao5T7R`jBH- zCq%+HYo=jU&UD=$iy6_l-r^6ov38?9X2by+(P${Fw}qSi@nAT_qJ}@fS|W*fGi!?( z#zQO?kH*6Z82HeBQf z&Tl53x-#9#`Srw87p5beuO^*$$v1Y+ zdk)@sw@ll9h6I^GC?6n@Z9m^a$s_sGByZIAy~`b({oDx$T5?1?J9M|^xS+lAd3NhVmFq3t*=u&-Q);fu45Yai$fOAG(Nkfz%=reG}5$w^(ruQvN|H@5Yc}11!{`)B|KB=3kT~R$;KD7 z!`i_af6vuY-Q3zSprz0NYM+);``o8kWtqGCVVG!LYM&#E#YZT6`YnW`CHsepKg(n= zduMX+Z2^ArUj!y*JV)+_{0RCv9>9;#v|RB$p*UbFF8LBsT}{uSSg7nP!uoq(-g+ec zJA}fmKNQvtU*38s{pZs9V_`kZv|jx`MczwIaGD;}T1#Qo!sR_R<)y9wRKQK9CvopSa3f!hlWts-m5G=31o!He)v}u zZuY}0?pM7k<1)+bg2SYGv}^BCw!32J$Dd|0DTbK;3^1k?;y5>xhkNyOg*A@(**MN% zO-!jrdui$Au3`N!++a){*7of^+=(@K*J3!@O^z^2={we(RomckXkpe<0-n%Whm)?q zhHA=n49{dAwcszgKi4BX6juikj5Kn36XoIb`mEDk!OIIzq zKc}UpE=C45(2~DIQP;vUc`oJp8o*WO;#5Z846_Vce9gcgr!s=sGG4%I0uEsPb9jcu zZ^)u+s8dV2{)w_F*NY&jnS>{QrD4t`UFS@}GenZ=AyoVjO~0Z9#t3D-1(l9Owa7aw z3lrrcUj_VDo`1G}f=RuFEvwGOXgVHpKU+UhfJFeKRDsO3W(DSCEATW`;24568|jaD z?+K%7_p^OT*D@X)dGi(mz~Ujq6TmGwmmEmCrjM!=<)}=|s$4<2DOVcLyE2%@yQZdG zgT&C6+D;0rMFd8#MYCo5C@^<6uqFhSn)wv>^A~ucmSpD{4kMMjs88|Rt-H)DwDoUCHBsKE}()pFP z?=6z??o+XBssq$vQ{3H8a9u#uPRT~<-Pfn1$-DLrvG}*4IMjO-RX$yXIg*|5MF@6u z;@$SKn0Tdt&52h_E>ev{r(Z?gvSv>~(d@Lf_;}G$8wP0d(caP=zgIqjBR&?Fkjt4n z;3ee>;_3d$Ide93LZBtp9>mwf_$>OjX($S_=mu28Y)>`^?fIwKvVMyXC)A?{W*1X4 zujM{x3ZIxl5YU)bJGGSS58RhJkbcV6Drl^p?nh{`I>pJNJ}BHpk3@@rx(4s=QJ;sC zACr?+>Oiz$cn{oXTQ=)s_-lYKiUz;vKJ_>`?kRDfQlIY{a&RXQ->G)O!^F+f!W#(nFmwx(P^ z#n@~~c5elca{ZObY@^^09waw3I>?hbI)42D+^DaEXXzn~#(s5>^7wYR=q>f3S~KS% z!j$^D9OV6KXZ_7SmflK3mzpox9f8*iYA<~uTrB8UFO!3Q^%9Zc1zqZ(BjtMEjrr22 zIn;qJ^^#-X-bEY&yJQ{-DQPN1$DCF8*T5^(KZCgzm1#FkMC! z9^ne^13R-QMpBsSNJAs3o=mBON%aJRLfJcI*(bZy6OQ3B=$yo`SI9hr-1qE4{ z`b?sxbMJBI&Se;p$F+|yp)D{<)#FRl6Yf)u$5XDC;m4ejT!;`!czHNTnXWzz;p4+7 z{Wzm=;Wj&Pu_QowdQamsaP&-1Ny>Equ6S#s#+MykdoNQ}ZcMojW9+U{PsC=KQBhN` zglfe(Hy=L3^Q~?%g{VdO6zWZ?ms9GAq&i5JsNw*evc$DrdoQuXR4v7a0N{(mYp8AF zN=m(au)b3WdP<~5S0Aj%gdU>ZQ-cW5{|a}JP;t{-_aZ z-i;PQHH8P1ANhjv&G@NQ(F#ho0XA+ql|VVuLXR5LRMz zXh)%-;}BdC6Xxbw9`&GfVwKVnpsCKA(d=d_HI|4(!qK=9DB|OSN@xo1Fd3Zp1u?uT zF&+YOoLh*Jn&AwC%@!k*Vt%Gb3IU^;MrTu^rNuy-ixK2$W&x%0E+x={4l!^9iPJ-z z%guA%SpiCiD=Xg3Wava8@SmAX1L(GqOy&gWT1=>4fF8wm$amjZJ)Z*FSajM12!3k>d;>TQC@zO^pYQ+^@lQtB4+lniyikDUuFRm_Ds*7hs zzq+`P*PGho68xAe13CLDeboYAwZK;`@Kp=^f44y78ZR%hUQk&+y-FxaI>ls}Hp$C# z@^3B;vrL|jV0cn|oXj)1?BD<9N?yq6eMAYb9-cn@JQJpjufU7v=->ETCzw3FV=46% zc!@CiLG?4vF-ET}O0!MEW(q2aQ)EVN^zod0_nZ_Jl*ppOdrgrN5L*45OkRu-=@nu6FDtnjSzEH7KO zbcvZ`HerQlMcFcvA;Xv_w!1yx7TA3%XI|P3wjYmz%P9qwlKUs4%!RU}hjW$0Sh+L#C&OE_T5YM>L zfoBUC$ie}C+|N8ltKNc7Y(sAiz*cgmh3=0={ku&InSZbuYVhuF4>qIdFdX9H;iZ@! zn_@BM!S<@%2*vH~IUet%*ST*FlvKl$rHTcWtcz%kQoX5HPle6ntEJLmu7kO_ zoB3vWtq{*UaZ5nn=dlW%xH-{*y}vy<=_ZF*H?1-!ZVVKTi_c*6XGVK+VpSY({yW($ zChsR$ZJg{nCfCbcd^S70&}W5s-f6k_VHG-=T>VE;S_dbv_vqj{C((Pxfn9<pTjPS_$dxbE%-UcY0rbesa*MOb@R99CHBLvHkaco}&I+Owq8hukRs7V?D8F7+WdihqPW;Yz6w zIrDB7Q70-$_)VogV)>mdqSFPwxYS2%7FPs*Td9xWEPlJdy`?^aS&4X|t`ayMrc#=~ zpNy>+c!LdZ1WxVwgy=867lq9>uJ2}a6h_I#pAD0;i+CbZdc<{O%a!IEQi`@8`iwV5sD1 zn#^q+A3GoK0FG5-Oj-}T1Yb#Xy}_F9;re6Ou`PN0JeUXX&VxUh2S1SqKa&T4B@aFV zoa$v?mp;p*KMmt|y!N>nxMFP>kzWaXTET2~#MW-rgtO6gUXK5Jxc{k)uBlKm_>(a| z#|2{{3E(A|r(4B*k)l1qkGzj7@qI$y-j4@`KHZC<#Lsd-zsGS7gRV2& z4m5TIWB9<+H95^Xm8&Q6AP!)XJ3x$=)vOXQEy!5C%r5dZPp=|)V!OR z<&01un~w$e7^4h7`OLEX{4>k78o?c{aTZR*;Vv4CjOKK^C}tiM>w5iWwV~mDeQo2$ znugj<8+G0D_3}F^P_wn0t2U^*x^WHK*=%%~mC>1*!aShb^-vzU1`ZFKoJCU5iRDw>yhb1_{XPS>I(_$^h* zEbWQx_TK?UZ9?%;lIL<74GJXtj?3QvN$6PZ<$gCJ?D^l4xF_>LS1l+>`UB*x_VWAW zhzRtj@_>+AjoJy8{m^DF_sV%N9xzkr$>KWQ)bFNMmN zv%ds23Q^k2{WfkB@MJH~&i@`-H1?#uJXe^laP#c{hmzw{+RO3tCe*Cu%kzh!8%=wu zZ*rsKU*f|ydwEVVBJ7VzLqVmTq#xMq<-XzYLeoITDcwjr$$yFrVY2>x3w>O4OxPcm z0**4~6;u*B_@MePm4Kkqew7U;T}qNpL*7;dm%l2?FO-TL9kmlI_fsGl3mqvnnE_E@ dx_`PFKUsgde$)IMul&B-O#3@*6UG(}`)_KaO$7h| diff --git a/pcxsscut b/pcxsscut index d743ac3b8ac58a73b3cb2380e2367aee9b167169..1deec74dc0487422bfdb03acb381df671e83a049 100755 GIT binary patch literal 21640 zcmeHveSB2qo$oWr1jiUM0l|Wx9u*WUgg`0F>zWV_Z{=kO3FybR4ZycDOw=k)K+vC^Lm7 zJYtf#S&S3IfFf;X4|tHI0EEhbb0d|K26*OH(2=eO%tRV>Gs%mxNN2tv1QX>&l|`>b zxgT_-Z4l_`^T>KhF9E3n^a{|JGJu(A7wceJ3Yn#-n`seXCY$E_tr=g&B_IT$QM7c#!lsmJHUL?s(Naht z15Y#tQ8o%~3Bb_SK)4NtNA3Iq4-Bvn6sYx~w^oB-oE- z7~pQ?*MR0>jzM3+91}wob9D45=9mD+FvkQkp7}MHN0@trn85s6Ato^|7h(!?1V#<> z3e3CAQQvIll|syCj!>y(4ucmlAA$LiIf8fvb4<`a=9r`!nU5CY9_BX)@nzvJ#$1Zy79RPeUv>kzO-M%MM7G-ZR(@*?tMriw3L| z*#i=$Hw}&O9tqQ{#w5bKBuwubHH3R4OfMU=3Aam_-Zp9p-!EZ$-B?Q4Ct-Tu@DZ++ zFnhtchj5LA*&D|Fgf$7XR}3~NTP0!kj?qq7NSM83bP_)IDG(FcTSgDz(-LN{89N9M zNSM86>>}JRVfLc&1mOb`W^WpM2=9?Fd)4?p;aw7D?-~aP_ehw%Y#b!qE@Aez(NFk( z3A5LY6NG&dX73vVgli?tC@@YDu8}aK!8lD=lQ5&g$PlgqJpK1yP5nA~=A5sw!5F~2 zX55c|Yt|Wu{tMRiThRXVExVk5>G2beIN^iap>FCn{7YUOw)sZdEf88Gno_?_o*iY7 zkQ+!It$O8yBfI*{JH$a^B>$m{C8@)Qes_y&;GZs<k~x`I?fXVBbI7 zNtT`kN1;F@u9tkC%odn#7%-)3R!eP0>m%Sn~l1jLkv zz5S5&ZPGWnjB{vuCjCh+hgvQ4OrU2!1++N?y%^|rqQ5c(y#(lkL@yqKt^ry+4fHez z8e`J8sXQ|UeNd?GdT>rBXPJZ3x2YcJr9}TLMs9(dHt!_*jUi}qzfN@j5cF)I$2({Mav-K>4JN1*} z`WbfEas9N)-c%VQ6G*u)IHvz2iqCMG&Q8Jnl-8f=^SM$@&-9JzC0n}Q?HWjnlzt$s zAMm~)=1=wZ{uy|58@_IH&10XfhlKNl&+p02gWvNrym6p_KOKN{!>RNcgm7QwQKWEXm z<>^<}dM5i3oJ3p3T2ib22&vQALzdJyOKQv?A@yc9ZAsl^Nxk#$cDt*u;H~6Y_a?DP z_%eT`D)>ur*zFlyEQc0o=r2QqGGFGnqN`q6ixt$#QYTp~e<_w4u%OO)rQV&daG-Rb z5$3RD_i2Idy#s-%xXQr==WG(W#F>m+Rgu!4NOnIVx@Kke0g(p1!k0OrT9P^}t8DPyEf7!ZkL|01 z5BBn(ta^cB+2a-d?inPXw*VcGtV zob891ig}^;#r}PxXd1QFdH`bfP=Fi2$d)m zXxBhWKbY1J(w`OH-bcU#NY04|rO%VyZwm84bg{7?6NXWTNi&ytGjoTksSw>S17St? z?=DF16{7o1;}clt%dByl_m)RSx4|3aT;d?3pia@PnAoQvtI70|_u0cThP$i^^qtA> zogyE;H^U9%{}yhTqv$Gp6R0Px?@Z~>579IL92>u5FJlc($o4qf4u9;>w|igEw@>T` zegXd_8VDy(-@QYBdN1Q~j(#v!G8o7^ObHF%p4Ok29(>;WLeusgRgii*nQ=i1gn9Z7 z$PDZ0ep)2n81xpg+G^t!iq-p#P1rZ6VZn*R`=N9#Y?lLAdg^rMQO-L@tBOYQJi4M< z2`E==!YxIz`;_o*yVsih?*&gTaVqnkVoT{g$?l$lN5{aU_fgGz=N$v$cBsiEdNwTp z)g<*5MJ3J++z*KRk;2JY_l)tPtfwclTGb=5r;S%F>>LZrP`g3W-Zb8}XgApsu(Jo- zmsSNI*V!XtaDBR|KQ-X$cMTjmU0T-jGP<&N3tX0#|J5KJP(a_(@?`hx!YoVcuMd_T zJdXi=cLVAQtx-|y$7o1>HQr~VnSCne^6*82k14=qLn}YK>9`YLr-R} zf~2gYGdQh`BDY1CTh{DbxZkr{k^M2sS8B-c{DhI}ZFIH_Gs?Ntk9bRxZ!9LEi+P{~ zbQ=)f7f;z`&RdpClKtf{eNFC1RGgE#u%T-388tNb(f8T7n!KF51-l$?9vlWRKlT_Y zTPXCB6sl4I_wTs3wfJACE#FpPr%N6u`!}8JuNK%}gvA5)Ja@%yq)XjC zW7+|?r?2;3xYd_=MH$x9{g1-D<{+m~#NQ!g_O$A=Ie)H{+SBUXOdCY4Y4uwc&Du2d zJx=8f*3^2zY0Wny$H0LpF+CCpJsD4w`CehcsQJVR_(s5jZ>l#)}Ki>NQ z2TW@X))E?iJFh;PhnU7e93YBgi?Q$ z+2FXOe$pl7UHZYKe$=(K`{<`2BuWOy$wti4PsT^c1rPIb8TW^?51X&rByVy9X2v42 zcN_Q85-E1{cA#>UQ~Lh2eln%+fgyH<`;+<}*WjeIz8@>WT*+yc4BkepWzzm0aQAdS z^>x@&ZdJM`_A_8gI^1j$O2XUA8N#w|hyLU-eK%{**Esl~RfGOyVt!Be?$XV7VTsxO z(J7aX6-VDaS>J<&XSe0W!^FcN;!h0vSxEL{G1@(d3U|YYd$5DC)~j?A7)S1CdJ^(a z?x?bjPUhkuzB|0bFLj?p=J00HeYSY$Lm_pfSp*9TlO z=;!DI-fv9d{$K4{T@b~(>s&9q+h<}6FK76^(7Ai>`>OvdeSwdU$UFZrQp}UNOR4Si z!7yxXQ~LQqEcfRDr<%?mW2Bv*r+Z?fkaJsBZoXrchMT8ep(-4&jgpJZf*eM=_mMDK z1XWz^I46&kw7y+@1OaqQ%I6_f&A_)=jF`LkxwBReoVQo(^WN=Cj1{ICsm$a>P{_pr7`Yvl4q+_RT`X|>@PWV+KpIc7bpAODgEQL{xSL!s~~#&V^~*Ci!c|_QVknM zl+ah2rEAP_{haKEd9ruUU8?YGT0d*4@%BE<&H~H|%q>%L^eY^H^Ce6w0?xwJ^1;faUhsU!qwiq3;QjEfSZ;CQp9otZ6X%Wyn{^hH~hrzFvS*y6H^#HCD0p zFg3s-C2mc*o!CsbRg&&TwSkS-v7=z?j+hiC`=9#i}&bYb^d zktkRD;%DTkfUUQ$cMom@eVKKZxoYtB=_h=ddWFh*lt38BXwaW%KXy_VW2(PxnW{{6bIn1s4{@vlX&=qm+?@V}LG6 zj3nCf#og+tmTtYQRrK*kGFA?}Yx@9aeivL>-gD>eGfMF!+?Uxogr_9?KfuG@${xrw z!!7ea@9mu+x0OTOK$E?_Ti|xt1g~xUdh0xgldN2%zOGqkRX1S&JRB8g9#i!qC`7hZ z*7=d^v)v50V1i2N=d%0YGYO5HgE5`t(QW3j_t1;jEzmv~?EP^+?+U%Vk?5a@HyQAd zAW@rX`%Eq@nBclGuVlX8bOgiadER;s6LqTTT>5d=)3@A}>Qfbt+);I9>oFydC@8J< z_TDX*sB=SN0q6y|v$pzYXrOV?5q+{w%yqB)R(5MkN*~CULxd6H?G>_wKyt>)_3DIK z4r)1@CtS|xF?rDw*?TQf(-N)tY|*zA zS+@6POLVg(`cJ3r_FlHuzs!rC%>G86HsCR{CHie!)Z2T4x7C;FsOG%*&$9c$qk{Fn zp_Grt0c-3ZE;;lL9-PT-?rHkvYgRSW3f1hE1A$&vE9jMHOD?HbreZF2%*nM0Yr$m{ zVFvvV1Y^-~v%n!U=yqinx96v^U#rX>v4XhAGJNyfmTSGe3#H0G)^I4aS11&d{WwHC z=Y6=BE7bd_^vd&{y+WP*OfE$H|JN1jyO&O9m-FwP%6+zf%LiK+727T6j{TJ#w=-1W zIrmgUr`KO8R$EcU;7w}fmAeV~;A|I^`Z5<3A7(x512a$LE5LEG#Ju~K-JjbA5Q3N6 zaP2!MSuV5T`k6Y{<%Y{r_o7mV!;}wS8S-{Q%dV#N({tybXZM1#AGbYwzJ z-w!LW&}4r7Cg#wj2gS+94t-kEd%?W3?*%wjq!&$?otiQswP=C|#hJ+6xySyVjLGA! zIUgn7P97aE_tk^LcR8;Qj#%&8{7*D`>ydG+kuTU_uD}gRiSX6mvvzHLQ=^7+JZ)t( z7}D<1_==br(&9!aWCDnUO*0hJCe=^YX4Fidr7e%P1xzE*rqu^p+c$(F5p18SM{5a3 zLRxDgZfYAs+KeyGn%W$VL}OY@G}an0wT`f9$XeP1kq|UiQ%v|`(T%Y{E2xo(7HSQf zP!KW0?a+iXMyWEc1>#yT91As@p`f;*Yp8v!6q?MaW*Q-_zNw)>U)89sU)}JfWviBG zi@ zK!mTpb!p&>n{l+Ey}2_UZ%&xnebIKl8W;bHY?r1@HQKfLc!w?Aw((E3;%hyfG1X{h z^`VwqWjMkvxQ@FJGcEV@Kk#6`Qn+m20b541%)+O#-gq}kB! zoEX0op%o8lQ>Rj(JkNlJAgm{%8%2Gftu1P5eBn}yM-#DTIEg-|@D#}+y8vNnMx$Ds z?@qEA7({4Txh<|!-nui1u!}>;^!ma zgC_39Ekm234CBAZ#(X>EtDR&BhMGBHY)G`=eav#PwmBAVH%Gnlk1kF*1Ybt|N}T@5*iO^j<36HQWI2!kntL0&Fap;Oe97z=IW z5N8`OOc>mlznU?vV31ops!k4~iSgQr2@Nyfq=|_s6BCm$hqdO*Q7}YX`m|_&kP3ru7$7JnK3xXPEr%7F(H*92H&%}5&rpEjvSlujw+WZAtumyuSgtvh4 zuCBlvx_vkqQB}^En8XFxNP+*Z7miuj3-$oRX6LF5MVm4kR5gZw!hT=NO-_i<-<3i%kkmNN<)d%OxPFW1)^glmh(HLk+# zCcg$OUh@@=sP`OTQR!J+S+U%Eo$2lrci%Ygt{D?pWu*&U zFGCM$_Y-|8mwO)XD2qiEF0rJltRx{8drK4T!>X<+No=VaR+8wfDlJKvrQfYQ1dh5R zb;s(C*S%a171DucKrMtB`gc1^P|U|Etr6Mak0AM_ex-0Tb=aAgzXv zRv<6vSSodp?t$!spz~p1o?iM@*^VhdO#=QU_%!IGFWz4Iusc~+y541(OpBD??g8H) za2%WEgp&8mZ_8QXY@j+pKY?v&0A)q5tE|{wT3=c9u)D5uRI+SUWlhP_%29PkDy!;_ zRaVp;uk_TtTx%pUVBX%`0;Rl1<-G}hQYtT=MPGzG?@{|i{A~f1-^&2zJPQL=@&@vB3(clw%zTy z0qG8;SxAeK)*-bZZAN++>Dx%(LwW(}7}770-bK2AGz{NRxB=-7q*+Ldk=7x#AZt9k|KUbTyD6}DrL-v`~bE;=donA9pl|&J7cJ<7u(@8@?i0XJ(s~OmU9KXYsxnY;^ zqwi3xT~y=XEL2^$aM@Hdu+f4xwk4`JB*OTDK{zO?3E`B<5Y@r1Ht18i8B-J-md5!5 zaLHx?e$Zl}2>Df^Jz|RLa9bGv%}^))<3KwMQZyJa1EM-)_~ogH-v~m|hLnUq5R2jD zLrU1?P0e6~@<40285KvN5dW%WElT5tcwAIBM_XHYgmT%7-<=>qea%9B3qrx_&e+J) z8I3|PeifY&t>Ra~jA|9v3TAW*VaHu5-?PBQxMW@`BUQz(g7Ll(F2=QjIV#lnQZPq{ z5W5g>3g+m;<5ep@N(D!u8i&kF1rJMbW`S|Zyj0+4L%8@I3+APA#NeFa2R6*ngv*Ne zQo&KB#xL_yIl3^u@^p3TV~>wgYt-^L?1~>h2*<_ot6+{=A+{W{;V}~CuUc6s#WxF_ zS1D!>j$Qk5i$CPpV!M79W&=v}TkS7F`>O$;bHH_g?Kz9|^?>CsaFM$p-GZF+6EeWp zi$3I>=LnPkJ1pesBZYj^j5u7h=LidU>6dm=-#-%%n2|yFE#&-}kPQz4<_~~u_#?pl zoth2v436)x+wk>(`I9djz7;TkS75_6fNKF)Av9UvT)=#r*`|L9FyFej;dOu?MEiKo z#`fKZobNU>a$SfI6R>@;eGdUne8=tKnHl+e0rvyu85!YkBVYerw`YY#e;V*Uz&!sV z{m015{sP}kv0!BRi~4^G#OWW}{vRQJ3E0`cd1e&I{~qXee+k6rMZk9axe$LY4q2a4VdvwetwhVr6T%I0f%?vCkhzqwCC+2`X7qm67(~FmJW3oy<^0+YDyvqd7PmZ z!BYTpT~_o;F{6mS2ryr@v+Y}5L=P0falm$aS$|Ivov*jpmxjVVz&)0|BTB}I0}eXv z?Fa1qM#;~M=x-On?-#-Hpwz06`ffl&`1YyY9*qU-B7H#->??u;MQ{gTer6y5S@zHN zBKi|W@Kb<$Rt~rNXRLU(i2f7Ot@(-iUIWbenQS94{{Dq@*e~u^@$wtMh5jBZ{tYm{ zcffOS%AY4c-mn#TnU?YO31ItTdn?tFBvBgv-{ycx{~};pKl`W7K_~xxfVsaz5%pas z0uDOmV?}Vf2o}vTGj8H3ARhnt{mbhc{418NZS?!`6oZem;@Eij%~n6Y5QE3s_;k!A zD8D}#^>2(sHv}U7pc#$D{eeWMz`I* zL~CmoL>!Qx8~4U3m6v`sJf%5sx+d!C>d=`!ab54+ryQKBFrD@{wvDl#ku= zka}z;@Q@Db@UXN{@)wih>iM(Z?`zN-8}IcmZdxTD|M>mYUzqtPGw7VSVYbI%d$R#Y z2|hFPtH)S=yuHz?5Paq&LFEbgY|D=aM`7%nLinss+$`dQ&lWe-tE zhzEnhzv$jobt{+EgUdmYpXm|)B`a1htXtt+S*i?kUTPjWrLyrL#w|l+t{U#@y_0cCMO1_QZM8JY(^%*HA z))7n$KOw(pRbZHIeY~oGf%iFXi$7*Hgu#m5mUh3LXY~ zR4m`@Z?NXL`UpR-g|BH{8i{^CV%Z*L403y392(-XW%AovL+WsTwreQC@s+It0Uy)* zBQM_5W4ncYo%Ovw0KDI}FVcA3j>J11^2zV&fuNymU-l9;9SEC`_gDt_CfH2KZN5b) z<9GQ{>f^oFPK(c8YRJd53W;|}SFqi85_vJzS%MDA4!zMLu5Jk!(KRJMIFXd=@XM$_Da2 z>fqxZr3c0|+-fl)qpiH2K(h65Z~6MV-ubeR<-I^{p)R6qzE@G^9WnWMPvNdD z(16PG{Q_lHLq6V{cxnqYpz?gbL>aD?e7q;As8#O^5XX!4vVYGY+4^{|e7?4z10=~u z-Yk;M$9tHIwb-ixXJ6!DdLPN=x6J&LU~D%fY$0HOeSP%lF7~sNqkBT z4$(}~43dx-M-nAE`JLZ6_uQL%hq+>Dp2H#Zl_$O|2r53?%_#W`xQ0Q6n=1;0 zTU;V0i?P5s@z2c^DrHTVeM+@13lv{I$}v>WQ;0mbtf=xL2?<=(1lKrb{hNeWQODss3G* z=LSTun+manf72!V0=VkmMe3>EI!`jR&U14`mrW8abgAXO3OVkdqJL3QtQclA1vbo? zJ)^0GV9XasJa^TO(fqy** zerFDRAP1g?Ycx9_%YlD92i}(hZ{)zcbKt*`1Aj{n{Ea#AFXq5sn*;w;4*ZXE;LCF0 ze*?UMf7w?%5Tp5dat{23Iql`XgcDZUVj8-yHTw zz~&EyT7urDpsy|x2)2ljzph?1v_>O7(G>RkZxao^reN4lVv%69Ni^3rftTB?3;TV| ztx(~MbhP@t8%PNV_0T99+CqT{OZgfBDbvVONT2{uFa%NRg*P0jgQ3lJffg9bgocpc z59-F|V2h%9#j+Juiz~ge%C5C)v&yc6GxARRzii%oNILi*)+^=K^8$f!l%YNZOt|QU zfip?&Q$h#-zqw+(-ejenaBZ=b(AZ20qR{5x%UTEq0U%Z8tz zktlcD@b);_XTx7$SuT{!4!h2K8EKLOre+B&G0OODdbW+8NQle z3boWWhNlpGKEa&~Uq~>8R;rcZa|x!9O4Tx4NHB#`s+!?Ef+>VjZiYXZ1DHZ5RnG8- z1XIYQ42It$m_j9040z@rs^Tx->WRPOiT!q{dTrI=zS@~?;W>O@sGN$!j}^H^@&p+F z)Zn^wi4gl-m9?VAQ(Az+6B{n_#DBMG@;+$ea60Ff=ZG*e0OqZP6t_IzKv$WDdx>7- z+44tLaNuM<6nNr8o&(A2J&r@3mrq6}SlZ6g+FX~C9&W#L(H7V*qUY2=Fxi3uy5*3w z1t`Zy&r`fUSL`Okt`||~;C+y@lzl(~BmK9eZifujF$-ou&J#bd--MyP6w=SNqw~pq z=q{+|DC%sB+DFvyO6o_~N!g_qb(pB%l+;%hmA0o+vwIe(w@T_>MJ>0e-9)AFL%R<# z_0V&LpeDcm8RNQ?#Cev)(X4MJQq*)WCteHcF-g7V6xmv${!CKG zDe7EH^Dd%3D5?K7Tl!$WMNJa5T~c3GRN5*_A55JM>enRoNkv^?Q5%W65Y$_q=keL{ z{t#&KXD`BldE!seZ1o&Ahk-+2nna^AsmcLW9;fn<`Mfx6KFV1tgxr)cAML4j#A_b) z?C|uAf00=eU98d3?@1sC%w3*@xy!XjEG%_(O@xRiX6|xWxX2Jydmn{~p7`P9*iT1B zkUb|b@-c<{;QtUZI-Wx=`4Bp?j}4eq3~eO+BgJ?`GEO@UtB$9hgbtQ|TuFcX^rZ(< zQ7!#bCA~sQp9v2+QtLJKNkuI?eci*UNm}|TB|Y>BJK%KsHI#Y-gTVdTtE8Veed%QC zds_NwB^{B{^S{Wa`)TZZ>4(PgaY%JL8)q3}a200WrKorkHM@HIq*ghS)4(K0ay6C- zuno^tY`?a%xQ=#Z8QiME6tAw1X7hZ?CxZBdSP8!%5cYYnL3FkWe#{0;F3&G=w zJ4@LV=ap1o4v^AgZS7pMB@iNiE*!?f*yF{|Bj~W zK#LztIR694c?ToZMvH2r*lMGO+BgAD>4NWJ;fDf9=TpZM&aEU7OLoHMEmTc7Lnsmx z2p>P@K{kjxTP5KpD&k%3ly?$bPY{u`R5$uZE#wDEf8rVd3zE>vgq%D@Tvyku3g^EN?viJKi)e$QDAp9awt2yS*f`%^@A)Y!FSzV8^Pq-!$nCS7#7h_v`L|21J`$( zk6;wOLQ3YD`$EoCCm6`}+Sitv!7`wCEA(#Ho(D*Gcd=`a`A973U_Br&V7o$jgJU~4 zKO&+>2WeS7RSIpsK3%pMK8HD^pzF?gvRgkODrS1sM?7JrOPu!+Hen7CWk!(@Dm%?) z<^%iF+39U^?6ZH;L+QgU2cl&_xVF;RLd8JuXL8h&8^Hy4-bn4no~1&L*4x*R1qb#| zghS+LjgZntOKA})O-MoTEwcC~&HYbT!UQ- zEAMTw6B~)hfqyXtujYx_d6r10ahKw1?>X?{$jD*y1(+cQZ%fp?;EDHp9DOv`4h-ab zoMKrm4Ctz6?{neelyd|PFtVq*5X~MJ5u`Ws_@Hy&4r(#M4y%YC@x)*D#1Hm91f-mP zeP}OczTikW%P=<jv$g#I3fUu3@e7Vg8f+#Yw~Rw*`7iKX4Nh{V2ci7m5 z5UpI2^I7KPHEOA9I(@UYjhcQ5u9S|5rkh5(D)jVp(P2UF>)^8H*#87~=jP|JjeD9_ zjX~$r2Wat-th}1U|J`Dq4Q9Q0TabM1k7_AtrorRQ+mlzp8$AzjGa0MN{{PZO4bTc= z#Rs_{?kuJhW8tW?apy1vU{6;$EZ)yMA)2w2??%w9E;Pb=-XI?yIbYITOmznZ(Lh zEWEYVfdmgo?pSV`e{+#H&~GCe&f>i@a({{H=hL}d4pFGI^mpUv2{YMbMwRBf_-NtoJ-k+`$I>7%4-`#9YsyJ zx?VyTVC-uphUhl$J7jJrf7n`2CBUE?Gw+L5c5dFDziB2`)a{-V$2|@ctE{`P}ZB`=IE)?&5@VBUI72 zndtFRM{M&^>dIva=l`HtX5Jq@Us^@3o(R^t2VGrj;k?0%>}s(EAdm7E;NiG=G-2K! zH<1I)9dPhIC>7E3Vw;bM=r}|Ug#ggI2bYjM9mTE!OI9f1cmEPx;3|3bx251?k6@)diu|p_WQeOd-yBVo=Z`#cw|rt?dOo6 z*6;E4W0v$1gqcj^-onV6x;ifM za;D~l^FI-bi$*YgUH9HELp(|AHLVrnkpn>O*+!3esm+FXbpe$wxhP!4b$LI*JBXg; zg;=@8TsJbrOLFlJqmzeCe$0~kU+7q(=F?I33$DFNF||DJV06{!Y@QxZVY*EUkff)l z6)5L7rx>CteuTCTANCfr0c!JpC;5ySJ%u^6#`+48(a6EqrTD1gGAV$BkK6>!y&k*9 za%ha1pJLqp0TI2x{M2>#l@ycY7%c6y>aJ7(Ex8eQ!Wji4oit5oLIoj`=>j--SuH!* zlPK`S(W(c+)~20^N5Xv`G$~(*iZ*;D)`jdS}KC*pis-z!VokKDYdSyzb8ux zu}5s}b8YPbsKQ_{GWsw;l%g*3Rop2Jjn0C$^+^3)l1J)_(HT`d4Iy9)2VHWoKDe9* zt8Gi_F>Ralfotmn8o|bP-DNX2l%oNj0g>t)R2k0F8wlrVqqAYwQaIxtmSzgA}|k6ByU$gDc^5K+&QRbjNk?tn}nI;AYp> z%hHG`K+tSIhFC{1DgvB0MNi$ILPx^<)D!5NT7ZF#^%>ac|8p%C^y)li;1rs;3vEn2 zyNN?ndBaP08P5JoXs!-{KJxq%*|DEY z&}VSTgJ@m3f6Mzj>Bc_(Y$I;d51Au4Up|R{pJB+l2-W*z*~8>2>RcRyM0Z=!Le7k- zzc~xCJzbqR*vM?57A<&s%-xw&emStI*Z3d-UW6PqFv7MTPHrX z%DC|n$7%SRyu+!_97_G1+$<62;-F>775iIYk_*V|3EKUr(e=1`u`Q$9au?l;^_9>& zCUDKNWbqfXj$u~p(X_UO-i%neCR&1V9YO-5Q#54$2RKT4mILgO2Atbn{P{h@G}n7{ynV)KgQ2X$y$Q9rA6|gJc^UuXJ0l|v*g2*igCIo{)+4SV;_Pv? z7iZ=P=bIO+B+0`z>q0qf7ebvJwl`_meh!s9Y;914SUjy^Qvr-oqx7Kznv!RF;O>Ot z(;T?lCU7&~a4wI1u-{6$eeL>8`HtBPg_tOl2&dQ_F6t<%tx% zo`Gq8y!R?)!IfWVK}5>_EYpHZ|3VAOq?SFYcR35gf~%DUkN%2%fc%=v2Oolie31H~ zmYuF-8^2I?kCc5P)uLs~li$QwT)R&tliC#U|Kz!63@AXL4@{Hi^|0MUydzjy#j<&{Y_?Q2| z5wLYEQr&1f#u+#k9c9P(7S8VFj!~-p7pTGE)@Q#^?+aC|uZWLStgDKDTv1aMf3;%m zik_0;A_K1=^^{V1!-{FYoB4+4z-Re%;GTTzI4tb?L*x?uzS4^Ldn@7}FM*Dc@o#!! z&pSNx2BYuM3v)N$Qt|bQTPkj?@ZuFG>;0yWp2x(XckI+Fb@YBJUDcI0-f%-@%~}KJ zug1z?z2CUepf`Raek0uI_eTIU1tJlD$e3C=&6rg_bB?h**isj1tZOkU>zZ3P_?w!r zXD2;IL!ilTG)Kb`V}swAb={m&U$7|{G8%%R=DLW{7Kk)*E3I`+erTj;l8_4pH-_q( zL2YU>{LO&~6f{KwtcU2SAmsN&{Po6$j!gTgQD}+;jYy;4sH|DD#$2`5 zSigGBSE^PmGnQ1XF)P=uUUO5KQPa}o4~LD?4kHkT3coMV5b)PeH(G5L6bgSkOkh*_ zjbS6uzX%WFx_#5vJGVsY{q(=wzW5mv7I@Ad*V#REk*1&ch+6BefciwzdXC zm{o;5f2oBHfsGQN$VE0-h{;eN!F#OAP#=^bH)Po;G@0MxCx&{zkCMrTXaiooFBCWU zLV?zZ6q{Nao`&HG!8ts~3Pqb(ioYhnYBek5GfRp<{#x*bbmhk6nK^0*e(mHgNE9cNO8HGju0ye8zs>i z*5}70YeE7j6ss^OGF^uJ8)^DeA25A%z$3r;kamy+6rXIDCRj<>T@p2r8K;&+rKibz{rIB~{Aq@~ytqorXGaw%)>o`qMG2e+yd*qdJGp8J#=uI#k-FP3 zZLlI((1b%u`VRyfL=(F<}9#8>(@RuVa z11RUbiWf+*@tuOxLj&bEQMyr@IQp(d`Hv_&QC8r2#7>lbc+}E|l1|MAP!6G-Dz_Q@ z_jyn$9Jj9#j`m{5Y0`GvRwIN~3AX=G#wZHS`c zr9~5$yUuDW=oHsqxZvt*ub2WX^DII6IP{WjqN1qyuDr@|WAp#cfu@;W4|LfpBO~wA zBV~*J`(jPs3iKy9tNI#Bi=J0QWR`yv=-D{<{6&WT7cBiRfc_SImP`J(pkMI&k&%Zp zSTmsY*(05?l>PKBHE-Jn^&n%kw zoqV&%=ow=cO})qIDJs8ftfy#h?2MH~?xv!-6-DJ0MN=0S8H%y15u9AyGe5!t`z!U+!8i zCQHcr`_>CJtmw3s(1n!F*Pl<01gTP+=f-dPZ~VKR62^HlU)_0bF4ZKguj z+aGEbWwpih>Okfh+II81-b z&1?$rf)>K&lLS<)wJ9RX0xbdjM*Qvg#c@Uev|xQ*q)wFi8@;^8^)}W+Rzp(4TNesp zAIlQD{tX}4puMg+;6u|vD8x@0w<0xe2!}zvVt8?_9mVy0+jkS}#C)Mwmo%30>=^L@ zy#kYQ(K_b9?mF9kTEFtdIN{F94`mA9nT4-V`0RCaJ?oz&Je9SmrPt2}uAk~pdOwQV z9mvxE5c8ipE_84{TECuW{z;;JFzJ`4{Kcz>nrny7wbJ+b?x9 zC*Mn=)}`?8D?HzW0{@`GKXq9q|Bn>jHAUk2o)i4^teN!x^m2*kdrjbh9@Uy|Le8w{><7Y(i5oxmFz8YJ)!j6XGR{2+&(XLI0RX8br&UgBoOe26@H8*zGYWM1`B#X)WxN7x#gBk5hM&btjW#UK43!@J zeKt+p3p|Yry->`TDh?<;+41>rN)LU{fi6CaLwQW=`R7_fT)e^jT+R6TLk>J8 zSR;c|0^@-nZM>%Cz<)Uhehu(6F4_IM75LHGZO@_SJB&YdpLTx^{vQKB>i3&`p-4D_ zr!F{Z_j;FCuJNv@x?!!?ixXmcbP&dkfH%_Y#mATMh!J09ItAtR)(5>Cn}Qqan!NRq zU?}XZi?$2wuJK3~Pm0Rs%$YM2nnz*s(mr4A+P&C`hdPAZ=hsJ@n>!$4gS>Qmkin`S zqr&X;v%iR!AN`4N$ma!vF6F12EC>%{tU5gpNdx={%L4fkhXu(;6ao)KpbihG(lu{3 zDJ-A+dA-$Z%(ZK8@-D4e#YgL2Z`rkTXO)w4!i|yEFl_fV!cl^rOL*lY0xzDVH%kPa z=QAih!Oso6IFt|IF2;{9R)r&3eDK-QH5DsOueoXoMow5nodRVBD= z6#fF1@Ge`idU3@H@9L#XZ!p(-*H$cEVUjxjNR}@g<$=Rs`TcIU{u&m20}Fof$&Ybm z;Ql|`*uyV9GEwzVrODc083ZD{ffx?j_y$6puA6qR4;%Ea-5LT{L#)4@pGRgc6woDY}Xr{NDTQeEd*VD3)_@Y}TChK!)P#X?<@%l$S zhQeF58pBy1Xz@nF{(6pRisP_7xF{Ue=iRat)5KNLfCpyM9gxKByu$MHL7Fx^Iq1o7 zrUw2bT_(!Ae3N&L%4(HO^sPGnG#!0oE|Za_Cq8SJiIkt0%fxxT2w^=1DYkXe%!q6R z6F365 zsfJ~cFS$EV0E$)kM`y8GzB|ti2;Xhf2<-3ZqVrtxla|-#rt5$s7R|2DZMs#1`n(q` ze31_Obt?cmYt{1ld}o_FKz1u;ZNKKz@@E0rsGeO^uSbe54V{~h4SC(7LP`BNc~xUx@5$X5Fm2Vj@i z=Tvx~gD-yeYZIVHxOD0Ae$?&qdY@XX9w4kKVRq|B%W1@Sv*h*jg?b8XTsVQtxU%iv z2`aU({jbl*T9v%zFr`KNPk~}rw!Ato)8FH5(u}IiZhudfygqLmm?s5ZA>(XUcKdyx z72%(nCc-+Ga|4Mhn?D;q3LY2!X?cC0U*HB3S2lk(d>lMvqL$a^WW{bEab@#o!*s4h zv8UzrdEi7hkhuC)|8;z7c^wDug2&#zJ~vEOuz1e)wH|qXm2O|3FAiyW)xOl0?vIxL zQ&#)>esfq&NNs1fyoNtPg>>ouyDMt}0awX|=u7C9B~7Fd#i!w5VtoZQ8VJ z5g4>AXyYOx6Dn{h@(079Tto{u(vY}l=RM~e@q^oY%!B#fne)E$ou7N}dm|Tz{rq5h zD4ZOdsFcHWFnW75EoS;^e_wywz9Z&g!kEAqGyTniT&>nozr@P6?EG`@^1Q?T%j;f`sYf;(&;m$shit6!G-2+V>UDD#DXh`;;PL52-z)_*!xOxG^cedPVTJ;%D1i%72n-To3xS=?!oag!!I!kHcKn+jJ>ZvIo zI`ukF7~>TX^-*nPMCBh;8J=l7tR3b+QffYUQm|$R5$5KIxkr}a{auS*VNCH_o7lr! z!iQZ^&yRNTBNleIt^VxzF5-j3OxI>Ubijch8JPo{t8%kI$BlKF zTo1a2XJ)_j4$n)w;ZiUlY7UT1W~N{NBiZDE>N9V7w!m?fx-=9vgVSb8O1~tuX{*y zW=)qlUyGX(*V(%%%&JxuuX&j|dZzY0J?}uo@>EO2ca0y$+S%AsiHSio{#1ek{?AXcGXwoDe?2c>=O+{50pk06xLG{* Qnb~WSW@D|X>6o>*0VYzqe*gdg diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 5d9da94a..c88da99d 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -31,7 +31,6 @@ #include "src/lib/16_head.h" #include "src/lib/16_timer.h" #include "src/lib/bitmap.h" -#include "src/lib/planar.h" #ifdef __WATCOMC__ #include "src/lib/16_dbg.h" #endif diff --git a/src/lib/dl/8254.c b/src/lib/dl/8254.c deleted file mode 100755 index 3d940b0b..00000000 --- a/src/lib/dl/8254.c +++ /dev/null @@ -1,107 +0,0 @@ -/* 8254.c - * - * 8254 programmable interrupt timer control library. - * (C) 2008-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS [pure DOS mode, or Windows or OS/2 DOS Box] - * - * The 8254 Programmable Interrupt Timer is used on the PC platform for - * several purposes. 3 Timers are provided, which are used as: - * - * Timer 0 - System timer. This is tied to IRQ 0 and under normal operation - * provides the usual IRQ 0 18.2 ticks per second. DOS programs that - * need higher resolution reprogram this timer to get it. - * - * Timer 1 - Misc, varies. On older PC hardware this was tied to DRAM refresh. - * Modern hardware cycles it for whatever purpose. Don't assume it's function. - * - * Timer 2 - PC Speaker. This timer is configured to run as a square wave and it's - * output is gated through the 8042 before going directly to a speaker in the - * PC's computer case. When used, this timer allows your program to generate - * audible beeps. - * - * On modern hardware this chip is either integrated into the core motherboard chipset or - * emulated for backwards compatibility. - */ - -#include -#include /* this is where Open Watcom hides the outp() etc. functions */ -#include - -#include "src/lib/doslib/8254.h" - -uint32_t t8254_counter[3] = {0x10000,0x10000,0x10000}; -int8_t probed_8254_result = -1; - -int probe_8254() { - if (probed_8254_result >= 0) - return (int)probed_8254_result; - - /* NTS: Reading port 0x43 does nothing. Intel's datasheet even mentions this in one of the tables. - * Actual hardware experience tells me some motherboards DO return something but the correct - * response (as seen in emulators in DOSBox) is to ignore, returning 0xFF */ - { - /* read timer 0 and see if it comes back non-0xFF */ - /* NTS: We MUST use the read_8254 function to read it in order. The previous - * version of this code read it byte-wise. For some reason it seems, - * some emulators including DOSBox don't take that well and they fail - * to reset the MSB/LSB flip-flop. When that happens our timer counter - * readings come out byte-swapped and we cannot provide proper timing - * and sleep routines. Symptoms: A DOS program using our timing code - * would have proper timing only on every other run. */ - unsigned int patience = 128,cc; - unsigned short c; - do { - c = read_8254(0); - if (c == 0xFFFF) c = read_8254(0); - if (c != 0xFFFF) break; - for (cc=0;cc != 0xFFFFU;) cc++; /* delay */ - } while (patience-- > 0); - - if (c == 0xFF) - return (probed_8254_result=0); - } - - return (probed_8254_result=1); -} - -unsigned long t8254_us2ticks(unsigned long a) { - /* FIXME: can you write a version that doesn't require 64-bit integers? */ - uint64_t b; - if (a == 0) return 0; - b = (uint64_t)a * (uint64_t)T8254_REF_CLOCK_HZ; - return (unsigned long)(b / 1000000ULL); -} - -unsigned long t8254_us2ticksr(unsigned long a,unsigned long *rem) { - /* FIXME: can you write a version that doesn't require 64-bit integers? */ - uint64_t b; - if (a == 0) return 0; - b = (uint64_t)a * (uint64_t)T8254_REF_CLOCK_HZ; - *rem = (unsigned long)(b % 1000000ULL); - return (unsigned long)(b / 1000000ULL); -} - -void t8254_wait(unsigned long ticks) { - uint16_t dec; - t8254_time_t pr,cr; - if (ticks <= 1) return; - ticks--; - cr = read_8254(0); - do { - pr = cr; - cr = read_8254(0); - if (cr > pr) - dec = (pr + (uint16_t)t8254_counter[0] - cr); - else - dec = (pr - cr); - - ticks -= dec; - } while ((signed long)ticks >= 0L); -} - diff --git a/src/lib/dl/8254.h b/src/lib/dl/8254.h deleted file mode 100755 index 22de1321..00000000 --- a/src/lib/dl/8254.h +++ /dev/null @@ -1,146 +0,0 @@ -/* 8254.h - * - * 8254 programmable interrupt timer control library. - * (C) 2008-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS [pure DOS mode, or Windows or OS/2 DOS Box] */ - -#ifndef __HW_8254_8254_H -#define __HW_8254_8254_H - -#include "src/lib/doslib/cpu.h" -#include - -/* WARNING: When calling these functions it is recommended that you disable interrupts - * during the programming procedure. In MS-DOS mode there is nothing to stop - * the BIOS from trying to use the 8254 chip at the same time you are. It is - * entirely possible that it might read values back during an interrupt. If - * you do not watch for that, you will get erroneous results from these - * routines. Use hw/cpu.h _cli() and _sti() functions. - * - * In contrast, it is extremely rare for interrupt handlers to mess with the - * PC speaker gate port (and even if they do, the worst that can happen is - * our code overrides what the IRQ is trying to do) */ - -#define PC_SPEAKER_GATE 0x61 - -/* 1.19318MHz from which the counter values divide down from */ -#define T8254_REF_CLOCK_HZ 1193180 - -#define T8254_IRQ 0 - -#define T8254_PORT(x) ((x) + 0x40) -#define T8254_TIMER_PORT(x) T8254_PORT(x) -#define T8254_CONTROL_PORT T8254_PORT(3) - -#define T8254_MODE_0_INT_ON_TERMINAL_COUNT 0 -#define T8254_MODE_1_HARDWARE_RETRIGGERABLE_ONE_SHOT 1 -#define T8254_MODE_2_RATE_GENERATOR 2 -#define T8254_MODE_3_SQUARE_WAVE_MODE 3 -#define T8254_MODE_4_SOFTWARE_TRIGGERED_STROBE 4 -#define T8254_MODE_5_HARDWARE_TRIGGERED_STROBE 5 - -#define T8254_READBACK_COUNT 0x20 -#define T8254_READBACK_STATUS 0x10 -#define T8254_READBACK_TIMER_2 0x08 -#define T8254_READBACK_TIMER_1 0x04 -#define T8254_READBACK_TIMER_0 0x02 -#define T8254_READBACK_ALL 0x3E - -/* this represents one counter value in the 8254/8253 chipset library, including the - * value the chip reloads on finishing countdown. - * NTS: In 8254 hardware, a value of 0 is treated as 65536 because the chip decrements - * THEN checks against zero. This allows the rate to drop as low as - * 1193180 / 65536 = 18.20648Hz on PC hardware */ -typedef uint16_t t8254_time_t; - -/* the 8254 (NOT 8253!) has a command that allows us to read the status and counter - * value of one or more latches (though contemporary hardware fails to emulate multi- - * counter latching from one command!). The status allows us to know what the counter - * was programmed as, the output of the counter at the time, and whether a new counter - * value was being loaded. The t8254_readback_t structure is used to read this info */ -struct t8254_readback_entry_t { - unsigned char status; - t8254_time_t count; -}; - -struct t8254_readback_t { - struct t8254_readback_entry_t timer[3]; -}; - -extern uint32_t t8254_counter[3]; -extern int8_t probed_8254_result; - -int probe_8254(); -void readback_8254(unsigned char what,struct t8254_readback_t *t); /* WARNING: 8254 only, will not work on 8253 chips in original PC/XT hardware */ -unsigned long t8254_us2ticks(unsigned long a); -unsigned long t8254_us2ticksr(unsigned long a,unsigned long *rem); -void t8254_wait(unsigned long ticks); - -static inline t8254_time_t read_8254_ncli(unsigned char timer) { - t8254_time_t x; - - if (timer > 2) return 0; - outp(T8254_CONTROL_PORT,(timer << 6) | (0 << 4) | 0); /* latch counter N, counter latch read */ - x = (t8254_time_t)inp(T8254_TIMER_PORT(timer)); - x |= (t8254_time_t)inp(T8254_TIMER_PORT(timer)) << 8U; - return x; -} - -static inline t8254_time_t read_8254(unsigned char timer) { - unsigned int flags; - t8254_time_t x; - - flags = get_cpu_flags(); - x = read_8254_ncli(timer); - _sti_if_flags(flags); - return x; -} - -/* NTS: At the hardware level, count == 0 is equivalent to programming 0x10000 into it. - * t8254_time_t is a 16-bit integer, and we write 16 bits, so 0 and 0x10000 is - * the same thing to us anyway */ -static inline void write_8254_ncli(unsigned char timer,t8254_time_t count,unsigned char mode) { - if (timer > 2) return; - outp(T8254_CONTROL_PORT,(timer << 6) | (3 << 4) | (mode << 1)); /* set new time */ - outp(T8254_TIMER_PORT(timer),count); - outp(T8254_TIMER_PORT(timer),count >> 8); - /* for our own timing code, keep track of what that count was. we can't read it back from H/W anyway */ - t8254_counter[timer] = (count == 0 ? 0x10000 : count); -} - -static inline void write_8254(unsigned char timer,t8254_time_t count,unsigned char mode) { - unsigned int flags; - - flags = get_cpu_flags(); - write_8254_ncli(timer,count,mode); - _sti_if_flags(flags); -} - -static inline unsigned char t8254_pc_speaker_read_gate() { - return inp(PC_SPEAKER_GATE) & 3; -} - -static inline void t8254_pc_speaker_set_gate(unsigned char m) { - unsigned char x; - - x = inp(PC_SPEAKER_GATE); - x = (x & ~0x3) | (m & 3); - outp(PC_SPEAKER_GATE,x); -} - -static inline void write_8254_system_timer(t8254_time_t max) { - write_8254(0,max,T8254_MODE_2_RATE_GENERATOR); -} - -static inline void write_8254_pc_speaker(t8254_time_t max) { - write_8254(2,max,T8254_MODE_3_SQUARE_WAVE_MODE); -} - -#endif /* __HW_8254_8254_H */ - diff --git a/src/lib/dl/8259.c b/src/lib/dl/8259.c deleted file mode 100755 index c83b3ddc..00000000 --- a/src/lib/dl/8259.c +++ /dev/null @@ -1,99 +0,0 @@ -/* 8259.c - * - * 8259 programmable interrupt controller library. - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS [pure DOS mode, or Windows or OS/2 DOS Box] - * - * In PC hardware the 8259 is responsible for taking IRQ signals off the ISA bus, prioritizing - * them, and interrupting the CPU to service the interrupts. The chip includes logic to keep - * track of what interrupts are pending, active, not yet acknowledged by the CPU, etc. so that - * the x86 CPU can properly handle them. - * - * In mid 1990s hardware the PIC was retained and often connected through a PCI core chipset - * that routed both ISA and PCI interrupts into it. Some chipsets have additional registers - * that allow "routing control", to determine whether a particular IRQ is to be associated - * with a PCI device or the ISA bus. - * - * Starting in late 1990s hardware, the APIC (Advanced Programmable Interrupt Controller) - * appeared on motherboards and was either put alongside with, or replaced, the traditional - * PIC. But the traditional I/O ports are emulated just the same to ensure compatibility with - * older software. Even today (in 2012) DOS programs can still communicate with I/O ports - * 20-21h and A0-A1h to manage interrupts, at least until an APIC aware OS or program takes - * control. - */ - -/* NTS: As of 2011/02/27 the 8254 routines no longer do cli/sti for us, we are expected - * to do them ourself. This is for performance reasons as well as for sanity reasons - * should we ever need to use the subroutines from within an interrupt handler */ - -#include -#include /* this is where Open Watcom hides the outp() etc. functions */ -#include -#include -#include -#include - -#include "src/lib/doslib/8259.h" - -unsigned char p8259_slave_present = 0; -signed char p8259_probed = 0; - -void p8259_ICW(unsigned char a,unsigned char b,unsigned char c,unsigned char d) { - outp(p8259_irq_to_base_port(c,0),a | 0x10); /* D4 == 1 */ - outp(p8259_irq_to_base_port(c,1),b); - outp(p8259_irq_to_base_port(c,1),c); - if (a & 1) outp(p8259_irq_to_base_port(c,1),d); -} - -/* NTS: bit 7 is set if there was an interrupt */ -/* WARNING: This code crashes DOSBox 0.74 with "PIC poll not handled" error message */ -unsigned char p8259_poll(unsigned char c) { - /* issue poll command to read and ack an interrupt */ - p8259_OCW3(c,0x0C); /* OCW3 = POLL=1 SMM=0 RR=0 */ - return inp(p8259_irq_to_base_port(c,0)); -} - -int probe_8259() { - unsigned char om,cm,c2; - unsigned int flags; - - if (p8259_probed < 0) - return (int)p8259_probed; - - /* don't let the BIOS fiddle with the mask during - the test. Fixes: Pentium machine where 1 out of - 100 times programs fail with "cannot init PIC" */ - flags = get_cpu_flags(); _cli(); - om = p8259_read_mask(0); - p8259_write_mask(0,0xFF); - cm = p8259_read_mask(0); - p8259_write_mask(0,0x00); - c2 = p8259_read_mask(0); - p8259_write_mask(0,om); - set_cpu_flags(flags); - - if (cm != 0xFF || c2 != 0x00) - return (p8259_probed=0); - - /* is a slave present too? */ - flags = get_cpu_flags(); _cli(); - om = p8259_read_mask(8); - p8259_write_mask(8,0xFF); - cm = p8259_read_mask(8); - p8259_write_mask(8,0x00); - c2 = p8259_read_mask(8); - p8259_write_mask(8,om); - set_cpu_flags(flags); - - if (cm == 0xFF && c2 == 0x00) - p8259_slave_present = 1; - - return (p8259_probed=1); -} - diff --git a/src/lib/dl/8259.h b/src/lib/dl/8259.h deleted file mode 100755 index 647616eb..00000000 --- a/src/lib/dl/8259.h +++ /dev/null @@ -1,116 +0,0 @@ -/* 8259.h - * - * 8259 programmable interrupt controller library. - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS [pure DOS mode, or Windows or OS/2 DOS Box] */ - -#ifndef __HW_8259_8259_H -#define __HW_8259_8259_H - -#include "src/lib/doslib/cpu.h" -#include - -/* PIC hardware register description - * - * ICW1 I/O port base + 0 (NTS: bit D4 == 1 when writing this) - * ICW2 I/O port base + 1 - * ICW3 I/O port base + 1 - * ICW4 I/O port base + 1 - * - * OCW1 R/W interrupt mask register. setting the bit masks the interrupt. Use I/O port base + 0 - * OCW2 R/? EOI and rotate command opcodes (NTS: bit D3-4 == 0). I/O port base + 1 - * OCW3 R/? poll/read/etc command opcodes (NTS: bit D3-4 == 1) I/O port base + 1 - * - */ -/* PIC library warning: - * - * For performance and sanity reasons this code does NOT mask interrupts during the function. You are - * expected to wrap your calls with cli/sti functions. Though it is unlikely, leaving interrupts enabled - * while doing this can cause problems in case the BIOS fiddles with the PIC during an IRQ */ - -#define P8259_MASTER_DATA 0x20 -#define P8259_MASTER_MASK 0x21 - -#define P8259_SLAVE_DATA 0xA0 -#define P8259_SLAVE_MASK 0xA1 - -/* OCW2 command bits. For most commands you are expected to OR the low 3 bits with the IRQ for the command to take effect on */ -#define P8259_OCW2_ROTATE_AUTO_EOI_CLEAR (0U << 5U) -#define P8259_OCW2_NON_SPECIFIC_EOI (1U << 5U) -#define P8259_OCW2_NO_OP (2U << 5U) -#define P8259_OCW2_SPECIFIC_EOI (3U << 5U) -#define P8259_OCW2_ROTATE_AUTO_EOI_SET (4U << 5U) -#define P8259_OCW2_ROTATE_NON_SPECIFIC_EOI (5U << 5U) -#define P8259_OCW2_SET_PRIORITY (6U << 5U) -#define P8259_OCW2_ROTATE_SPECIFIC_EOI (7U << 5U) - -#define P8259_MASK_BIT(x) (1U << ((x)&7U)) - -extern unsigned char p8259_slave_present; - -/* c = IRQ which = I/O port */ -static inline unsigned char p8259_irq_to_base_port(unsigned char c,unsigned char which) { - return ((c & 8) ? P8259_SLAVE_DATA : P8259_MASTER_DATA) + which; -} - -/* c = IRQ. */ -static inline unsigned char p8259_read_mask(unsigned char c) { /* mask register AKA OCW1 */ - outp(p8259_irq_to_base_port(c,0),P8259_OCW2_NO_OP); /* issue NO-OP to make sure the PIC is ready to accept OCW1 */ - return inp(p8259_irq_to_base_port(c,1)); /* mask register */ -} - -static inline void p8259_write_mask(unsigned char c,unsigned char m) { /* mask register AKA OCW1 */ - outp(p8259_irq_to_base_port(c,0),P8259_OCW2_NO_OP); /* issue NO-OP to make sure the PIC is ready to accept OCW1 */ - outp(p8259_irq_to_base_port(c,1),m); /* write mask register */ -} - -static inline void p8259_OCW2(unsigned char c,unsigned char w) { - outp(p8259_irq_to_base_port(c,0),w & 0xE7); /* D3-4 == 0 */ -} - -static inline void p8259_OCW3(unsigned char c,unsigned char w) { - outp(p8259_irq_to_base_port(c,0),(w & 0xE7) | 0x08); /* D3-4 == 1 */ -} - -static inline unsigned char p8259_read_IRR(unsigned char c) { - p8259_OCW3(c,0x02); /* OCW3 = read register command RR=1 RIS=0 */ - return inp(p8259_irq_to_base_port(c,0)); /* mask register */ -} - -static inline unsigned char p8259_read_ISR(unsigned char c) { - p8259_OCW3(c,0x03); /* OCW3 = read register command RR=1 RIS=1 */ - return inp(p8259_irq_to_base_port(c,0)); /* mask register */ -} - -static inline unsigned char irq2int(unsigned char c) { - c &= 0xF; - if (c & 8) return c-8+0x70; - return c+0x08; -} - -static inline void p8259_unmask(unsigned char c) { - unsigned char m = p8259_read_mask(c); - p8259_write_mask(c,m & ~(1 << (c&7))); -} - -static inline void p8259_mask(unsigned char c) { - unsigned char m = p8259_read_mask(c); - p8259_write_mask(c,m | (1 << (c&7))); -} - -static inline unsigned char p8259_is_masked(unsigned char c) { - return (p8259_read_mask(c) & (1 << (c&7))); -} - -void p8259_ICW(unsigned char a,unsigned char b,unsigned char c,unsigned char d); -unsigned char p8259_poll(unsigned char c); -int probe_8259(); - -#endif /* __HW_8259_8259_H */ - diff --git a/src/lib/dl/adlib.c b/src/lib/dl/adlib.c deleted file mode 100755 index dcb80eb9..00000000 --- a/src/lib/dl/adlib.c +++ /dev/null @@ -1,289 +0,0 @@ -/* adlib.c - * - * Adlib OPL2/OPL3 FM synthesizer chipset controller library. - * (C) 2010-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS [pure DOS mode, or Windows or OS/2 DOS Box] - * - * On most Sound Blaster compatible cards all the way up to the late 1990s, a - * Yamaha OPL2 or OPL3 chipset exists (or may be emulated on PCI cards) that - * responds to ports 388h-389h. Through these I/O ports you control the FM - * synthesizer engine. On some cards, a second OPL2 may exist at 38A-38Bh, - * and on ISA PnP cards, the OPL3 may be located at 38C-38Dh if software - * configured. */ -/* TODO: ISA PnP complementary library */ -/* TODO: Modifications to the library to support OPL2/OPL3 chipsets at I/O ports - * other than 388h */ - -#include -#include /* this is where Open Watcom hides the outp() etc. functions */ -#include -#include -#include -#include -#include -#include - -#include "src/lib/doslib/adlib.h" - -unsigned short adlib_voice_to_op_opl2[9] = {0x00,0x01,0x02, 0x08,0x09,0x0A, 0x10,0x11,0x12}; -/* NTS: There is a HOWTO out there stating that the registers line up 0,1,2,6,7,8,... == WRONG! */ -unsigned short adlib_voice_to_op_opl3[18] = {0x00,0x01,0x02, 0x08,0x09,0x0A, 0x10,0x11,0x12, 0x100,0x101,0x102, 0x108,0x109,0x10A, 0x110,0x111,0x112}; -unsigned short* adlib_voice_to_op = adlib_voice_to_op_opl2; - -struct adlib_reg_bd adlib_reg_bd; -struct adlib_fm_channel adlib_fm[ADLIB_FM_VOICES]; -int adlib_fm_voices = 0; -unsigned char adlib_flags = 0; - -struct adlib_fm_channel adlib_fm_preset_violin_opl3 = { - .mod = {0, 1, 1, 1, 1, 1, 42, 6, 1, 1, 4, 0, - 3, 456, 1, 1, 1, 1, 4, 0, 5}, - .car = {0, 1, 1, 1, 1, 1, 63, 4, 1, 1, 4, 0, - 3, 456, 1, 1, 1, 1, 0, 0, 2} -}; - -struct adlib_fm_channel adlib_fm_preset_violin_opl2 = { - .mod = {0, 1, 1, 1, 1, 1, 42, 6, 1, 1, 4, 0, - 3, 456, 1, 1, 1, 1, 2, 0, 1}, - .car = {0, 1, 1, 1, 1, 1, 63, 4, 1, 1, 4, 0, - 3, 456, 1, 1, 1, 1, 0, 0, 2} -}; - -struct adlib_fm_channel adlib_fm_preset_piano = { - .mod = {0, 0, 1, 1, 1, 1, 42, 10, 4, 2, 3, 0, - 4, 456, 1, 1, 1, 1, 4, 0, 0}, - .car = {0, 0, 1, 1, 1, 1, 63, 10, 1, 8, 3, 0, - 4, 456, 1, 1, 1, 1, 0, 0, 0} -}; - -struct adlib_fm_channel adlib_fm_preset_harpsichord = { - .mod = {0, 0, 1, 1, 1, 1, 42, 10, 3, 2, 3, 0, - 4, 456, 1, 1, 1, 1, 2, 0, 3}, - .car = {0, 0, 1, 1, 1, 1, 63, 10, 5, 3, 3, 0, - 4, 456, 1, 1, 1, 1, 0, 0, 3} -}; - -/* NTS: adjust the modulator total level value to vary between muted (27) and open (47) with - * further adjustment if you want to mimick the change in sound when you blow harder */ -struct adlib_fm_channel adlib_fm_preset_horn = { - .mod = {0, 0, 1, 0, 1, 0, 47, 6, 1, 1, 7, 0, - 4, 514, 1, 1, 1, 1, 0, 0, 0}, - .car = {0, 0, 1, 0, 1, 0, 47, 8, 2, 2, 7, 0, - 4, 456, 1, 1, 1, 1, 0, 0, 0} -}; - -struct adlib_fm_channel adlib_fm_preset_deep_bass_drum = { - .mod = {0, 0, 0, 0, 1, 0, 13, 7, 1, 0, 1, 0, - 2, 456, 1, 1, 1, 1, 7, 0, 1}, - .car = {0, 0, 1, 1, 1, 1, 63, 15, 2, 6, 1, 0, - 2, 456, 1, 1, 1, 1, 0, 0, 0} -}; - -/* NTS: You can simulate hitting software or harder by adjusting the modulator total volume - * as well as raising or lowering the frequency */ -struct adlib_fm_channel adlib_fm_preset_small_drum = { - .mod = {0, 0, 0, 1, 1, 1, 54, 15, 10, 15, 15, 0, - 3, 456, 1, 1, 1, 1, 1, 0, 0}, - .car = {0, 0, 1, 1, 1, 1, 63, 15, 7, 15, 15, 0, - 3, 456, 1, 1, 1, 1, 1, 0, 0} -}; - -unsigned char adlib_read(unsigned short i) { - unsigned char c; - outp(ADLIB_IO_INDEX+((i>>8)*2),(unsigned char)i); - adlib_wait(); - c = inp(ADLIB_IO_DATA+((i>>8)*2)); - adlib_wait(); - return c; -} - -void adlib_write(unsigned short i,unsigned char d) { - outp(ADLIB_IO_INDEX+((i>>8)*2),(unsigned char)i); - adlib_wait(); - outp(ADLIB_IO_DATA+((i>>8)*2),d); - adlib_wait(); -} - -/* TODO: adlib_write_imm_1() and adlib_write_imm_2() - * this would allow DOS programs to use this ADLIB library from within - * an interrupt routine */ - -int probe_adlib(unsigned char sec) { - unsigned char a,b,retry=3; - unsigned short bas = sec ? 0x100 : 0; - - /* this code uses the 8254 for timing */ - if (!probe_8254()) - return 1; - - do { - adlib_write(0x04+bas,0x60); /* reset both timers */ - adlib_write(0x04+bas,0x80); /* enable interrupts */ - a = adlib_status(sec); - adlib_write(0x02+bas,0xFF); /* timer 1 */ - adlib_write(0x04+bas,0x21); /* start timer 1 */ - t8254_wait(t8254_us2ticks(100)); - b = adlib_status(sec); - adlib_write(0x04+bas,0x60); /* reset both timers */ - adlib_write(0x04+bas,0x00); /* disable interrupts */ - - if ((a&0xE0) == 0x00 && (b&0xE0) == 0xC0) - return 1; - - } while (--retry != 0); - - return 0; -} - -int init_adlib() { - adlib_flags = 0; - if (!probe_adlib(0)) - return 0; - - adlib_write(0x01,0x20); /* enable waveform select */ - adlib_voice_to_op = adlib_voice_to_op_opl2; - adlib_fm_voices = 9; - - if (probe_adlib(1)) { - adlib_fm_voices = 18; - adlib_flags = ADLIB_FM_DUAL_OPL2; - } - else { - /* NTS: "unofficial" method of detecting OPL3 */ - if ((adlib_status(0) & 0x06) == 0) { - adlib_fm_voices = 18; - adlib_flags = ADLIB_FM_OPL3; - adlib_voice_to_op = adlib_voice_to_op_opl3; - - /* init like an OPL3 */ - adlib_write(0x105,0x01); /* set OPL3 bit */ - probe_adlib(0); - adlib_write(0x104,0x00); /* disable any 4op connections */ - } - } - - return 1; -} - -void shutdown_adlib_opl3() { - if (adlib_flags & ADLIB_FM_OPL3) { - adlib_write(0x105,0x00); /* clear OPL3 bit */ - probe_adlib(0); - adlib_fm_voices = 9; - adlib_voice_to_op = adlib_voice_to_op_opl2; - adlib_flags &= ~ADLIB_FM_OPL3; - } -} - -void shutdown_adlib() { - shutdown_adlib_opl3(); -} - -void adlib_update_group20(unsigned int op,struct adlib_fm_operator *f) { - adlib_write(0x20+op, (f->am << 7) | - (f->vibrato << 6) | - (f->sustain << 5) | - (f->key_scaling_rate << 4) | - (f->mod_multiple << 0)); -} - -void adlib_update_group40(unsigned int op,struct adlib_fm_operator *f) { - adlib_write(0x40+op, (f->level_key_scale << 6) | - ((f->total_level^63) << 0)); -} - -void adlib_update_group60(unsigned int op,struct adlib_fm_operator *f) { - adlib_write(0x60+op, (f->attack_rate << 4) | - (f->decay_rate << 0)); -} - -void adlib_update_group80(unsigned int op,struct adlib_fm_operator *f) { - adlib_write(0x80+op, (f->sustain_level << 4) | - (f->release_rate << 0)); -} - -void adlib_update_groupA0(unsigned int channel,struct adlib_fm_channel *ch) { - struct adlib_fm_operator *f = &ch->mod; - unsigned int x = (channel >= 9) ? 0x100 : 0; - adlib_write(0xA0+(channel%9)+x, f->f_number); - adlib_write(0xB0+(channel%9)+x, (f->key_on << 5) | - (f->octave << 2) | - (f->f_number >> 8)); -} - -void adlib_update_groupC0(unsigned int channel,struct adlib_fm_channel *ch) { - struct adlib_fm_operator *f = &ch->mod; - unsigned int x = (channel >= 9) ? 0x100 : 0; - adlib_write(0xC0+(channel%9)+x, (f->feedback << 1) | - (f->connection << 0) | - (f->ch_d << 7) | - (f->ch_c << 6) | - (f->ch_b << 5) | - (f->ch_a << 4)); -} - -void adlib_update_groupE0(unsigned int op,struct adlib_fm_operator *f) { - adlib_write(0xE0+op, (f->waveform << 0)); -} - -void adlib_update_operator(unsigned int op,struct adlib_fm_operator *f) { - adlib_update_group20(op,f); - adlib_update_group40(op,f); - adlib_update_group60(op,f); - adlib_update_group80(op,f); - adlib_update_groupE0(op,f); -} - -void adlib_update_bd(struct adlib_reg_bd *b) { - adlib_write(0xBD, (b->am_depth << 7) | - (b->vibrato_depth << 6) | - (b->rythm_enable << 5) | - (b->bass_drum_on << 4) | - (b->snare_drum_on << 3) | - (b->tom_tom_on << 2) | - (b->cymbal_on << 1) | - (b->hi_hat_on << 0)); -} - -void adlib_apply_all() { - struct adlib_fm_operator *f; - unsigned short op; - int ch; - - for (ch=0;ch < adlib_fm_voices;ch++) { - f = &adlib_fm[ch].mod; op = adlib_voice_to_op[ch]; adlib_update_operator(op,f); - f = &adlib_fm[ch].car; op = adlib_voice_to_op[ch]+3; adlib_update_operator(op,f); - adlib_update_groupA0(ch,&adlib_fm[ch]); - adlib_update_groupC0(ch,&adlib_fm[ch]); - } - adlib_update_bd(&adlib_reg_bd); -} - -double adlib_fm_op_to_freq(struct adlib_fm_operator *f) { - unsigned long t = (unsigned long)f->f_number * 49716UL; - return (double)t / (1UL << (20UL - (unsigned long)f->octave)); -} - -void adlib_freq_to_fm_op(struct adlib_fm_operator *f,double freq) { - unsigned long l; - - freq *= (1UL << (20UL - (unsigned long)f->octave)); - l = (unsigned long)freq / 49716UL; - f->octave = 4; - while (l > 1023UL) { - f->octave++; - l >>= 1UL; - } - while (l != 0UL && l < 256UL) { - f->octave--; - l <<= 1UL; - } - f->f_number = l; -} - diff --git a/src/lib/dl/adlib.h b/src/lib/dl/adlib.h deleted file mode 100755 index 74a8a1f2..00000000 --- a/src/lib/dl/adlib.h +++ /dev/null @@ -1,138 +0,0 @@ -/* adlib.h - * - * Adlib OPL2/OPL3 FM synthesizer chipset controller library. - * (C) 2010-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS [pure DOS mode, or Windows or OS/2 DOS Box] */ - -//#include "src/lib/doslib/cpu.h" -#include "src/lib/doslib/8254.h" /* 8254 timer */ -#include - -#define ADLIB_FM_VOICES 18 - -#define ADLIB_IO_INDEX 0x388 -#define ADLIB_IO_STATUS 0x388 -#define ADLIB_IO_DATA 0x389 - -#define ADLIB_IO_INDEX2 0x38A -#define ADLIB_IO_STATUS2 0x38A -#define ADLIB_IO_DATA2 0x38B - -/* Adlib status */ -#define ADLIB_STATUS_TIMERS_EXPIRED 0x80 -#define ADLIB_STATUS_TIMER1_EXPIRED 0x40 -#define ADLIB_STATUS_TIMER2_EXPIRED 0x20 - -enum { - ADLIB_FM_DUAL_OPL2=0x01, - ADLIB_FM_OPL3=0x02 -}; - -struct adlib_fm_operator { - /* 0x20-0x3F */ - uint8_t am:1; /* bit 7: Apply amplitude modulation */ - uint8_t vibrato:1; /* bit 6: Apply vibrato */ - uint8_t sustain:1; /* bit 5: maintain sustain level */ - uint8_t key_scaling_rate:1; /* bit 4: increase ADSR enevelope speed as pitch increases */ - uint8_t mod_multiple:4; /* bits 0-3: modulator multiple (1=voice frequency, 2=one octave above) */ - /* 0x40-0x5F */ - uint8_t level_key_scale:2; /* bits 7-6: decrease volume as frequency rises (0=none 1=1.5dB/8ve 2=3dB/8ve 3=6dB/8ve) */ - uint8_t total_level:6; /* bits 5-0: total output level (for sanity's sake, we maintain here as 0=silent 0x3F=full even though hardware is opposite) */ - /* 0x60-0x7F */ - uint8_t attack_rate:4; /* bits 7-4: attack rate */ - uint8_t decay_rate:4; /* bits 3-0: decay rate */ - /* 0x80-0x9F */ - uint8_t sustain_level:4; /* bits 7-4: sustain level */ - uint8_t release_rate:4; /* bits 3-0: release rate */ - /* 0xA0-0xBF */ - uint16_t key_on:1; /* bit 5: voice the channel */ - uint16_t octave:3; /* bits 4-2: octave */ - uint16_t f_number:10; /* bits 1-0, then bits 7-0: F-number (frequency) */ - /* 0xC0-0xCF */ - uint8_t ch_a:1; /* bit 4: OPL3: Channel A output */ - uint8_t ch_b:1; /* bit 5: OPL3: Channel B output */ - uint8_t ch_c:1; /* bit 6: OPL3: Channel C output */ - uint8_t ch_d:1; /* bit 7: OPL3: Channel D output */ - uint8_t feedback:3; /* bits 3-1: feedback strength */ - uint8_t connection:1; /* bit 0: connection (operator 1 and 2 independent if set) */ - /* 0xE0-0xFF */ - uint8_t waveform:3; /* bits 1-0: which waveform to use */ -}; - -struct adlib_fm_channel { - struct adlib_fm_operator mod,car; -}; - -struct adlib_reg_bd { - uint8_t am_depth:1; - uint8_t vibrato_depth:1; - uint8_t rythm_enable:1; - uint8_t bass_drum_on:1; - uint8_t snare_drum_on:1; - uint8_t tom_tom_on:1; - uint8_t cymbal_on:1; - uint8_t hi_hat_on:1; -}; - -int init_adlib(); -void shutdown_adlib(); -void shutdown_adlib_opl3(); -int probe_adlib(unsigned char sec); -unsigned char adlib_read(unsigned short i); -void adlib_write(unsigned short i,unsigned char d); -void adlib_update_group20(unsigned int op,struct adlib_fm_operator *f); -void adlib_update_group40(unsigned int op,struct adlib_fm_operator *f); -void adlib_update_group60(unsigned int op,struct adlib_fm_operator *f); -void adlib_update_group80(unsigned int op,struct adlib_fm_operator *f); -void adlib_update_groupA0(unsigned int channel,struct adlib_fm_channel *ch); -void adlib_update_groupC0(unsigned int channel,struct adlib_fm_channel *ch); -void adlib_update_groupE0(unsigned int op,struct adlib_fm_operator *f); -void adlib_update_operator(unsigned int op,struct adlib_fm_operator *f); -void adlib_freq_to_fm_op(struct adlib_fm_operator *f,double freq); -double adlib_fm_op_to_freq(struct adlib_fm_operator *f); -void adlib_update_bd(struct adlib_reg_bd *b); -void adlib_apply_all(); - -extern unsigned short adlib_voice_to_op_opl2[9]; -extern unsigned short adlib_voice_to_op_opl3[18]; -extern unsigned short* adlib_voice_to_op; - -extern struct adlib_reg_bd adlib_reg_bd; -extern struct adlib_fm_channel adlib_fm[ADLIB_FM_VOICES]; -extern int adlib_fm_voices; -extern unsigned char adlib_flags; - -extern struct adlib_fm_channel adlib_fm_preset_deep_bass_drum; -extern struct adlib_fm_channel adlib_fm_preset_violin_opl3; -extern struct adlib_fm_channel adlib_fm_preset_violin_opl2; -extern struct adlib_fm_channel adlib_fm_preset_harpsichord; -extern struct adlib_fm_channel adlib_fm_preset_small_drum; -extern struct adlib_fm_channel adlib_fm_preset_piano; -extern struct adlib_fm_channel adlib_fm_preset_horn; - -/* NTS: I have a Creative CT1350B card where we really do have to wait at least - * 33us per I/O access, because the OPL2 chip on it really is that slow. - * - * Peior to this fix, the adlib code would often fail on a real CT1350B - * (unless run just after the Sound Blaster test program) and even if it - * did run, only about 1/3rd of the voices would work. Upping the delay - * to 40us for OPL3 and 100us for OPL2 resolved these issues. */ -static inline void adlib_wait() { - t8254_wait(t8254_us2ticks((adlib_flags & ADLIB_FM_OPL3) ? 40 : 100)); -} - -static inline unsigned char adlib_status(unsigned char which) { - adlib_wait(); - return inp(ADLIB_IO_STATUS+(which*2)); -} - -static inline unsigned char adlib_status_imm(unsigned char which) { - return inp(ADLIB_IO_STATUS+(which*2)); -} - diff --git a/src/lib/dl/cpu.c b/src/lib/dl/cpu.c deleted file mode 100755 index 8e111690..00000000 --- a/src/lib/dl/cpu.c +++ /dev/null @@ -1,181 +0,0 @@ -/* cpu.c - * - * Runtime CPU detection library. - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - * Compiles for intended target environments: - * - MS-DOS - * - Windows 3.0/3.1/95/98/ME - * - Windows NT 3.1/3.51/4.0/2000/XP/Vista/7 - * - OS/2 16-bit - * - OS/2 32-bit - * - * A common library to autodetect the CPU at runtime. If the program calling us - * is interested, we can also provide Pentium CPUID and extended CPUID information. - * Also includes code to autodetect at runtime 1) if SSE is present and 2) if SSE - * is enabled by the OS and 3) if we can enable SSE. */ - -/* FIXME: The 16-bit real mode DOS builds of this program are unable to detect CPUID under OS/2 2.x and OS/2 Warp 3. Why? */ - -#if defined(TARGET_WINDOWS) && TARGET_MSDOS == 16 -/* Win16: We're probably on a 386, but we could be on a 286 if Windows 3.1 is in standard mode. - * If the user manages to run us under Windows 3.0, we could also run in 8086 real mode. - * We still do the tests so the Windows API cannot deceive us, but we still need GetWinFlags - * to tell between 8086 real mode + virtual8086 mode and protected mode. */ -# include -# include -#endif - -#include -#include /* this is where Open Watcom hides the outp() etc. functions */ -#include -#include -#include -#include -#include -#include - -#include "src/lib/doslib/cpu.h" - -/* DEBUG: Flush out calls that aren't there */ -#ifdef TARGET_OS2 -# define int86 ___EVIL___ -# define ntvdm_RegisterModule ___EVIL___ -# define ntvdm_UnregisterModule ___EVIL___ -# define _dos_getvect ___EVIL___ -# define _dos_setvect ___EVIL___ -#endif - -#if defined(TARGET_WINDOWS) && TARGET_MSDOS == 16 -# include -#endif - -char cpu_cpuid_vendor[13]={0}; -struct cpu_cpuid_features cpu_cpuid_features = {0}; -signed char cpu_basic_level = -1; -uint32_t cpu_cpuid_max = 0; -unsigned char cpu_flags = 0; -uint16_t cpu_tmp1 = 0; - -void cpu_probe() { -#if TARGET_MSDOS == 32 - /* we're obviously in 32-bit protected mode, or else this code would not be running at all */ - /* Applies to: 32-bit DOS, Win32, Win95/98/ME/NT/2000/XP/etc. */ - cpu_flags = CPU_FLAG_PROTECTED_MODE | CPU_FLAG_PROTECTED_MODE_32; -#else - cpu_flags = 0; -#endif - - cpu_basic_level = cpu_basic_probe(); - -#if defined(TARGET_OS2) - /* OS/2 wouldn't let a program like myself touch control registers. Are you crazy?!? */ - cpu_flags |= CPU_FLAG_DONT_WRITE_RDTSC; -#elif defined(TARGET_WINDOWS) && TARGET_MSDOS == 32 - /* Under Windows 3.1 Win32s and Win 9x/ME/NT it's pretty much a given any attempt to work with - * control registers will fail. Win 9x/ME will silently ignore, and NT will fault it */ - cpu_flags |= CPU_FLAG_DONT_WRITE_RDTSC; -#elif !defined(TARGET_WINDOWS) && TARGET_MSDOS == 32 - /* 32-bit DOS: Generally yes we can, but only if we're Ring 0 */ - { - unsigned int s=0; - - __asm { - xor eax,eax - mov ax,cs - and ax,3 - mov s,eax - } - - if (s != 0) cpu_flags |= CPU_FLAG_DONT_WRITE_RDTSC; - } -#endif - -#if defined(TARGET_WINDOWS) && TARGET_MSDOS == 16 - /* Windows 3.0/3.1 specific: are we in 32-bit protected mode? 16-bit protected mode? real mode? - * real mode with v86 mode (does Windows even work that way?). Note that GetWinFlags only appeared - * in Windows 3.0. If we're under Windows 2.x we have to use alternative detection methods, or - * else assume Real Mode since Windows 2.x usually does run that way. But: There are 286 and 386 - * enhanced versions of Windows 2.x, so how do we detect those? - * - * NTS: This code doesn't even run under Windows 2.x. If we patch the binary to report itself as - * a 2.x compatible and try to run it under Windows 2.11, the Windows kernel says it's - * "out of memory" and then everything freezes (?!?). */ - { -# if TARGET_WINDOWS >= 30 /* If targeting Windows 3.0 or higher at compile time, then assume GetWinFlags() exists */ - DWORD flags = GetWinFlags(); - if (1) { -# elif TARGET_WINDOWS >= 20 /* If targeting Windows 2.0 or higher, then check the system first in case we're run under 3.0 or higher */ - /* FIXME: If locating the function by name fails, what ordinal do we search by? */ - DWORD (PASCAL FAR *__GetWinFlags)() = (LPVOID)GetProcAddress(GetModuleHandle("KERNEL"),"GETWINFLAGS"); - if (__GetWinFlags != NULL) { - DWORD flags = __GetWinFlags(); - MessageBox(NULL,"Found it","",MB_OK); -# else /* don't try. Windows 1.0 does not have GetWinFlags() and does not have any dynamic library functions either. There is - no GetModuleHandle, GetProcAddress, etc. */ - if (0) { -# endif - if (WF_PMODE) { - cpu_flags |= CPU_FLAG_DONT_WRITE_RDTSC; - if (flags & WF_ENHANCED) - cpu_flags |= CPU_FLAG_PROTECTED_MODE | CPU_FLAG_PROTECTED_MODE_32; - else if (flags & WF_STANDARD) - cpu_flags |= CPU_FLAG_PROTECTED_MODE; - } - /* I highly doubt Windows 3.0 "real mode" every involves virtual 8086 mode, but - * just in case, check the machine status register. Since Windows 3.0 could run - * on an 8086, we must be cautious to do this test only on a 286 or higher */ - else if (cpu_basic_level >= 2) { - unsigned int tmp=0; - - __asm { - .286 - smsw tmp - } - - if (tmp & 1) { - /* if the PE bit is set, we're under Protected Mode - * that must mean that all of windows is in Real Mode, but overall - * the whole show is in virtual 8086 mode. - * We're assuming here that Windows would not lie to us about what mode is active. - * - * THEORY: Could this happen if Windows 3.0 were started in Real Mode - * while EMM386.EXE is resident and active? */ - cpu_flags |= CPU_FLAG_V86_ACTIVE; - cpu_flags |= CPU_FLAG_DONT_WRITE_RDTSC; - } - } - } - } -#endif -} - -int cpu_basic_probe() -{ - __asm - { - push bx - push cx - push dx - push si - push di - push bp -// BUGFIX: Calling near a function that returns far is like taking a long walk off a short pier -// push cs - -// call cpu_basic_probe_f_ - - pop bp - pop di - pop si - pop dx - pop cx - pop bx - //retnative - } - return 0; -} diff --git a/src/lib/dl/cpu.h b/src/lib/dl/cpu.h deleted file mode 100755 index 5498a3cc..00000000 --- a/src/lib/dl/cpu.h +++ /dev/null @@ -1,236 +0,0 @@ -/* cpu.h - * - * Runtime CPU detection library. - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - * - */ - -#ifndef __HW_CPU_CPU_H -#define __HW_CPU_CPU_H - -#include -#include -#include "src/lib/16_head.h" - -#if !defined(FAR) -# if defined(TARGET_WINDOWS) -# include -# else -# if TARGET_MSDOS == 32 -# define FAR -# else -# define FAR far -# endif -# endif -#endif - -/* FIX: Open Watcom does not provide inpd/outpd in 16-bit real mode, so we have to provide it ourself */ -/* We assume for the same stupid reasons the pragma aux function can't be used because it's a 386 level instruction */ -#if TARGET_MSDOS == 16 -uint32_t __cdecl inpd(uint16_t port); -void __cdecl outpd(uint16_t port,uint32_t data); -#endif - -#if TARGET_MSDOS == 16 -static inline uint32_t ptr2phys(void far *p) { - return (((uint32_t)FP_SEG(p)) << 4UL) + - ((uint32_t)FP_OFF(p)); -} -#endif - -#pragma pack(push,1) -struct cpu_cpuid_features { - union { - uint32_t raw[4]; /* EAX, EBX, EDX, ECX */ - struct { - uint32_t todo[4]; - } f; - } a; -}; - -struct cpu_cpuid_ext_features { - union { - uint32_t raw[4]; /* EAX, EBX, ECX, EDX */ - struct { - uint32_t todo[4]; - } f; - } a; -}; - -struct cpu_cpuid_ext_cache_tlb { - union { - uint32_t raw[4]; /* EAX, EBX, ECX, EDX */ - struct { - uint32_t todo[4]; - } f; - } a; -}; - -struct cpu_cpuid_ext_cache_tlb_l2 { - union { - uint32_t raw[4]; /* EAX, EBX, ECX, EDX */ - struct { - uint32_t todo[4]; - } f; - } a; -}; - -struct cpu_cpuid_ext_longmode { - union { - uint32_t raw[4]; /* EAX, EBX, ECX, EDX */ - struct { - uint32_t todo[4]; - } f; - } a; -}; - -struct cpu_cpuid_ext_apm { - union { - uint32_t raw[1]; /* EAX */ - struct { - uint32_t todo[1]; - } f; - } a; -}; - -struct cpuid_result { - uint32_t eax,ebx,ecx,edx; -}; -#pragma pack(pop) - -/* "Basic" CPU level */ -enum { - CPU_8086=0, /* 0 */ - CPU_186, - CPU_286, - CPU_386, - CPU_486, - CPU_586, - CPU_686, - CPU_MAX -}; - -extern const char * cpu_basic_level_str[CPU_MAX]; -extern char cpu_cpuid_vendor[13]; -extern struct cpu_cpuid_features cpu_cpuid_features; -extern signed char cpu_basic_level; -extern uint32_t cpu_cpuid_max; -extern unsigned char cpu_flags; -extern uint16_t cpu_tmp1; - -/* compatability */ -#define cpu_v86_active (cpu_flags & CPU_FLAG_V86_ACTIVE) - -#define cpu_basic_level_to_string(x) (x >= 0 ? cpu_basic_level_str[x] : "?") - -/* CPU flag: CPU supports CPUID */ -#define CPU_FLAG_CPUID (1 << 0) -#define CPU_FLAG_FPU (1 << 1) -#define CPU_FLAG_CPUID_EXT (1 << 2) -#define CPU_FLAG_V86_ACTIVE (1 << 3) -#define CPU_FLAG_PROTECTED_MODE (1 << 4) -#define CPU_FLAG_PROTECTED_MODE_32 (1 << 5) -/* ^ Windows-specific: we are not only a 16-bit Win16 app, but Windows is running in 386 enhanced mode - * and we can safely use 32-bit registers and hacks. This will always be set for - * Win32 and 32-bit DOS, obviously. If set, PROTECTED_MODE is also set. */ -#define CPU_FLAG_DONT_WRITE_RDTSC (1 << 6) - -void cpu_probe(); -int cpu_basic_probe(); /* external assembly language function */ - -static void _cli(); -#pragma aux _cli = "cli" -static void _sti(); -#pragma aux _sti = "sti" - -static inline void _sti_if_flags(unsigned int f) { - if (f&0x200) _sti(); /* if IF bit was set, then restore interrupts by STI */ -} - -/* NTS: remember for Watcom: 16-bit realmode sizeof(int) == 2, 32-bit flat mode sizeof(int) == 4 */ -static unsigned int get_cpu_flags(); -#if TARGET_MSDOS == 32 -#pragma aux get_cpu_flags = \ - "pushfd" \ - "pop eax" \ - value [eax]; -#else -#pragma aux get_cpu_flags = \ - "pushf" \ - "pop ax" \ - value [ax]; -#endif - -static void set_cpu_flags(unsigned int f); -#if TARGET_MSDOS == 32 -#pragma aux set_cpu_flags = \ - "push eax" \ - "popfd " \ - parm [eax]; -#else -#pragma aux set_cpu_flags = \ - "push ax" \ - "popf " \ - parm [ax]; -#endif - -#if defined(TARGET_WINDOWS) && TARGET_MSDOS == 32 -/* Watcom does not offer int86/int386 for Win32s/Win9x/NT/etc */ -#else -static inline void just_int86(unsigned char c,union REGS *r1,union REGS *r2) { -# ifdef __386__ - int386(c,r1,r2); -# else - int86(c,r1,r2); -# endif -} -#endif - -#if TARGET_MSDOS == 32 -static inline void cpu_cpuid(uint32_t idx,struct cpuid_result *x); -#pragma aux cpu_cpuid = \ - ".586p" \ - "xor ebx,ebx" \ - "mov ecx,ebx" \ - "mov edx,ebx" \ - "cpuid" \ - "mov [esi],eax" \ - "mov [esi+4],ebx" \ - "mov [esi+8],ecx" \ - "mov [esi+12],edx" \ - parm [eax] [esi] \ - modify [ebx ecx edx] -#else -void cpu_cpuid(uint32_t idx,struct cpuid_result *x); -#endif - -#if TARGET_MSDOS == 32 -static inline uint64_t cpu_rdmsr(const uint32_t idx); -#pragma aux cpu_rdmsr = \ - ".586p" \ - "rdmsr" \ - parm [ecx] \ - value [edx eax] - -static inline void cpu_wrmsr(const uint32_t idx,const uint64_t val); -#pragma aux cpu_wrmsr = \ - ".586p" \ - "wrmsr" \ - parm [ecx] [edx eax] -#else -/* This is too much code to inline insert everywhere---unless you want extra-large EXEs. - * It's better to conform to Watcom's register calling convention and make it a function. - * Note that if you look at the assembly language most of the code is shuffling the values - * around to convert EDX:EAX to AX:BX:CX:DX and disabling interrupts during the call. */ -/* see CPUASM.ASM */ -uint64_t cpu_rdmsr(const uint32_t idx); -void cpu_wrmsr(const uint32_t idx,const uint64_t val); -#endif - -int cpu_basic_probe(); - -#endif /* __HW_CPU_CPU_H */ diff --git a/src/lib/dl/dos.c b/src/lib/dl/dos.c deleted file mode 100755 index 86b4c321..00000000 --- a/src/lib/dl/dos.c +++ /dev/null @@ -1,308 +0,0 @@ -/* dos.c - * - * Code to detect the surrounding DOS/Windows environment and support routines to work with it - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - */ - -#ifdef TARGET_WINDOWS -//# include -#endif - -#include -#include /* this is where Open Watcom hides the outp() etc. functions */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "src/lib/doslib/cpu.h" -#include "src/lib/doslib/dos.h" -//#include -//#include - -/* DEBUG: Flush out calls that aren't there */ -#ifdef TARGET_OS2 -# define int86 ___EVIL___ -# define int386 ___EVIL___ -# define ntvdm_RegisterModule ___EVIL___ -# define ntvdm_UnregisterModule ___EVIL___ -# define _dos_getvect ___EVIL___ -# define _dos_setvect ___EVIL___ -#endif - -struct lib_dos_options lib_dos_option={0}; - -/* DOS version info */ -uint8_t dos_flavor = 0; -uint16_t dos_version = 0; -uint32_t freedos_kernel_version = 0; -const char *dos_version_method = NULL; - -#if TARGET_MSDOS == 32 -char *freedos_kernel_version_str = NULL; -#else -char far *freedos_kernel_version_str = NULL; -#endif - -void probe_dos() { -#if TARGET_MSDOS == 32 && 0 - assert(sizeof(struct dpmi_realmode_call) == 0x32); - assert(offsetof(struct dpmi_realmode_call,ss) == 0x30); - assert(offsetof(struct dpmi_realmode_call,cs) == 0x2C); -#endif - - if (dos_version == 0) { -#ifdef TARGET_WINDOWS -# if TARGET_MSDOS == 32 -# ifdef WIN386 -/* =================== Windows 3.0/3.1 Win386 ================= */ - DWORD raw = GetVersion(); /* NTS: The Win16 version does not tell us if we're running under Windows NT */ - - dos_version_method = "GetVersion"; - dos_version = (((raw >> 24UL) & 0xFFUL) << 8UL) | (((raw >> 16UL) & 0xFFUL) << 0UL); - - /* Windows NT/2000/XP NTVDM.EXE lies to us, reporting Windows 95 numbers and MS-DOS 5.0 */ - if (dos_version == 0x500) { - uint16_t x = 0; - - /* Sorry Microsoft, but you make it hard for us to detect and we have to break your OS to find the info we need */ - __asm { - mov ax,0x3306 - mov bx,0 - int 21h - jc err1 - mov x,bx -err1: - } - - if (x != 0 && x != 0x005) { /* Once pushed to reveal the true DOS version, NTVDM.EXE responds with v5.50 */ - dos_version = (x >> 8) | (x << 8); - dos_version_method = "INT 21h AX=3306h/NTVDM.EXE"; - } - } -# else -/* =================== Windows 32-bit ================== */ - DWORD raw; - /* GetVersion() 32-bit doesn't return the DOS version at all. The upper WORD has build number instead. */ - /* Instead, use GetVersionEx() to detect system. If system is Windows 3.1 or 9x/ME we might be able - * to get away with abusing the DPMI server deep within Windows to get what we want. Else, if it's - * Windows NT, we simply assume v5.50 */ - - /* assume v5.0 */ - dos_version = 0x500; - dos_version_method = "Guessing"; - - /* use the Win32 version of GetVersion() to determine what OS we're under */ - raw = GetVersion(); - if (raw & 0x80000000UL) { /* Windows 9x/ME */ - /* Start by guessing the version number based on which version of Windows we're under */ - unsigned char major = raw & 0xFF,minor = (raw >> 8) & 0xFF,ok=0; - - dos_version_method = "Guessing by Windows version"; - if (major < 4) { /* Windows 3.1 Win32s */ - dos_version = 0x616; /* Assume MS-DOS 6.22, though it could be 6.20 or even 6.00 */ - } - else if (major == 4) { /* Windows 95/98/ME */ - if (minor >= 90) - dos_version = 0x800; /* Windows ME (8.00) */ - else if (minor >= 10) - dos_version = 0x70A; /* Windows 98 (7.10) */ - else - dos_version = 0x700; /* Windows 95 */ - } - - /* Try: Windows 9x/ME QT_Thunk hack to call down into the Win16 layer's version of GetVersion() */ - if (!ok && major == 4 && Win9xQT_ThunkInit()) { - DWORD fptr,raw=0; - - fptr = GetProcAddress16(win9x_kernel_win16,"GETVERSION"); - if (fptr != 0) { - dos_version_method = "Read from Win16 GetVersion() [32->16 QT_Thunk]"; - - { - __asm { - mov edx,fptr - mov eax,dword ptr [QT_Thunk] - - ; QT_Thunk needs 0x40 byte of data storage at [EBP] - ; give it some, right here on the stack - push ebp - mov ebp,esp - sub esp,0x40 - - call eax ; <- QT_Thunk - - ; release stack storage - mov esp,ebp - pop ebp - - ; take Win16 response in DX:AX translate to EAX - shl edx,16 - and eax,0xFFFF - or eax,edx - mov raw,eax - } - } - - if (raw != 0) { - dos_version = (((raw >> 24UL) & 0xFFUL) << 8UL) | (((raw >> 16UL) & 0xFFUL) << 0UL); - ok = 1; - } - } - } - /* Tried: Windows 3.1 with Win32s. Microsoft Win32 documentation gleefully calls Dos3Call "obsolete", - * yet inspection of the Win32s DLLs shows that W32SKRNL.DLL has a _Dos3Call@0 symbol in it - * that acts just like the Win16 version, calling down into DOS, and most of the Win32s DLLs - * rely on it quite heavily to implement Win32 functions (the GetSystemTime function for example - * using it to call INT 21h AH=2Ah). - * - * Some old MSDN documentation I have has a list of INT 21h calls and corresponding Win32 - * functions to use. Again of course, they skip right over "Get MS-DOS version", no help there. - * - * Anyway, calling this function with AX=0x3306 or AH=0x30 yields no results. Apparently, Microsoft - * implemented passing through file I/O, date/time, and code page conversions, yet never considered - * people might use it for something like... asking DOS it's version number. Attempting to make - * these calls yields zero in AX and BX, or for AX=3306, a false return number that would imply - * MS-DOS v1.0 (EAX=1). So, _Dos3Call@0 is not an option. - * - * But then that means we have absolutely no way to determine the DOS kernel version (short of - * poking our nose into segments and memory locations we have no business being in!). We can't - * use _Dos3Call@0, we can't use GetVersion() because the Win32 GetVersion() doesn't return - * the DOS version, and we can't use Win95 style thunks because Win32s doesn't have a publicly - * available and documented way to thunk down into Win16. We have absolutely jack shit to go by. - * - * Hey, Microsoft... When you released Win32s in 1993, did you ever stop to consider someone - * might want to do something as simple as query the DOS version? Why couldn't you guys have - * done something straightforward like a "GetDOSVersion()" API function that works under - * Windows 9x/ME and returns an error under NT? I know it's silly of me to ask this in 2012 - * when Windows 8 is around the corner and Win32s are long dead, but often it seems like you - * guys really don't stop to think about things like that and you make really stupid mistakes - * with your APIs. */ - } - else { - dos_version = 0x532; /* Windows NT v5.50 */ - } -# endif -# elif TARGET_MSDOS == 16 -/* =================== Windows 16-bit ================== */ - DWORD raw = GetVersion(); /* NTS: The Win16 version does not tell us if we're running under Windows NT */ - - dos_version_method = "GetVersion"; - dos_version = (((raw >> 24UL) & 0xFFUL) << 8UL) | (((raw >> 16UL) & 0xFFUL) << 0UL); - - /* Windows NT/2000/XP NTVDM.EXE lies to us, reporting Windows 95 numbers and MS-DOS 5.0 */ - if (dos_version == 0x500) { - uint16_t x = 0; - - /* Sorry Microsoft, but you make it hard for us to detect and we have to break your OS to find the info we need */ - __asm { - mov ax,0x3306 - mov bx,0 - int 21h - jc err1 - mov x,bx -err1: - } - - if (x != 0 && x != 0x005) { /* Once pushed to reveal the true DOS version, NTVDM.EXE responds with v5.50 */ - dos_version = (x >> 8) | (x << 8); - dos_version_method = "INT 21h AX=3306h/NTVDM.EXE"; - } - } - - /* TODO: DOS "flavor" detection */ - /* TODO: If FreeDOS, get the kernel version and allocate a selector to point at FreeDOS's revision string */ -# else -# error dunno -# endif -#elif defined(TARGET_OS2) -/* =================== OS/2 ==================== */ - dos_version = (10 << 8) | 0; - dos_version_method = "Blunt guess"; - -# if TARGET_MSDOS == 32 - { - ULONG major=0,minor=0,rev=0; - DosQuerySysInfo(QSV_VERSION_MAJOR,QSV_VERSION_MAJOR,&major,sizeof(major)); - DosQuerySysInfo(QSV_VERSION_MINOR,QSV_VERSION_MINOR,&minor,sizeof(minor)); - DosQuerySysInfo(QSV_VERSION_REVISION,QSV_VERSION_REVISION,&rev,sizeof(rev)); - if (major != 0) { - dos_version_method = "DosQuerySysInfo (OS/2)"; - dos_version = (major << 8) | minor; - /* TODO: store the revision value too somewhere! */ - } - } -# elif TARGET_MSDOS == 16 - { - USHORT x=0; - DosGetVersion(&x); - if (x != 0) { - dos_version_method = "DosGetVersion (OS/2)"; - dos_version = x; - } - } -# else -# error dunno -# endif -#else -/* =================== MS-DOS ================== */ - union REGS regs; - - regs.w.ax = 0x3000; -# if TARGET_MSDOS == 32 - int386(0x21,®s,®s); -# else - int86(0x21,®s,®s); -# endif - dos_version = (regs.h.al << 8) | regs.h.ah; - dos_version_method = "INT 21h AH=30h"; - - if (dos_version >= 0x500 && regs.h.bh == 0xFD) { - dos_flavor = DOS_FLAVOR_FREEDOS; - freedos_kernel_version = (((uint32_t)regs.h.ch) << 16UL) | - (((uint32_t)regs.h.cl) << 8UL) | - ((uint32_t)regs.h.bl); - - /* now retrieve the FreeDOS kernel string */ - /* FIXME: Does this syscall have a way to return an error or indicate that it didn't return a string? */ - regs.w.ax = 0x33FF; -# if TARGET_MSDOS == 32 - int386(0x21,®s,®s); -# else - int86(0x21,®s,®s); -# endif - -# if TARGET_MSDOS == 32 - freedos_kernel_version_str = (unsigned char*)(((uint32_t)regs.w.dx << 4UL) + (uint32_t)regs.w.ax); -# else - freedos_kernel_version_str = MK_FP(regs.w.dx,regs.w.ax); -# endif - } - else if (dos_version >= 0x200 && regs.h.bh == 0xFF) - dos_flavor = DOS_FLAVOR_MSDOS; - - /* but, SETVER can arrange for DOS to lie to us. so get the real version via - * undocumented subfunctions (DOS 5.0+ or later, apparently) */ - regs.w.ax = 0x3306; /* AH=0x33 AL=0x06 */ - regs.w.bx = 0; /* in case early DOS versions fail to set CF set BX to zero */ -# if TARGET_MSDOS == 32 - int386(0x21,®s,®s); -# else - int86(0x21,®s,®s); -# endif - if ((regs.w.cflag & 1) == 0 && regs.h.bl >= 5 && regs.h.bl <= 8) { - dos_version = (regs.h.bl << 8) | regs.h.bh; - dos_version_method = "INT 21h AX=3306h"; - } -#endif - } -} - diff --git a/src/lib/dl/dos.h b/src/lib/dl/dos.h deleted file mode 100755 index 2ae46b5b..00000000 --- a/src/lib/dl/dos.h +++ /dev/null @@ -1,445 +0,0 @@ -/* dos.h - * - * Code to detect the surrounding DOS/Windows environment and support routines to work with it - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - */ - -#ifndef __HW_DOS_DOS_H -#define __HW_DOS_DOS_H - -#include "src/lib/doslib/cpu.h" -//#include "src/lib/16_head.h" -#include - -#if !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -/* NTVDM.EXE DOSNTAST.VDD call support */ -//#include -#endif - -#if defined(TARGET_OS2) -# define INCL_DOSMISC -# ifdef FAR /* <- conflict between OS/2 headers and cpu.h definition of "FAR" */ -# undef FAR -# endif -# include -#endif - -extern unsigned char FAR *dos_LOL; - -#if TARGET_MSDOS == 32 && !defined(TARGET_OS2) -extern int8_t dpmi_no_0301h; /* -1 = not tested 0 = avail 1 = N/A */ -#else -# define dpmi_no_0301h 0 /* FIXME: Is it possible for DOS extenders to run non-4GW non-LE executables? */ -#endif - -#define DPMI_ENTER_AUTO 0xFF - -/* DOS "Flavor" we are running under. - * I originally didn't care too much until one day some really strange - * fatal bugs popped up when running this code under FreeDOS 1.0, almost - * as if the FreeDOS kernel does something to fuck with the DOS extender's - * mind if our code attempts certain things like reading the ROM area... */ -enum { - DOS_FLAVOR_NONE=0, /* generic DOS */ - DOS_FLAVOR_MSDOS, /* Microsoft MS-DOS */ - DOS_FLAVOR_FREEDOS, /* FreeDOS */ -}; - -extern uint8_t dos_flavor; -extern uint16_t dos_version; -extern const char *dos_version_method; -extern uint32_t freedos_kernel_version; -#if TARGET_MSDOS == 32 -extern char *freedos_kernel_version_str; -#else -extern char far *freedos_kernel_version_str; -#endif -extern unsigned char vcpi_present; -extern unsigned char vcpi_major_version,vcpi_minor_version; - -struct dos_mcb_enum { - uint16_t segment; - uint16_t counter; - /* acquired data */ - unsigned char FAR *ptr; /* pointer to actual memory content */ - uint16_t size,psp,cur_segment; - uint8_t type; - char name[9]; -}; - -#pragma pack(push,1) -struct dpmi_realmode_call { - uint32_t edi,esi,ebp,reserved; - uint32_t ebx,edx,ecx,eax; - uint16_t flags,es,ds,fs,gs,ip,cs,sp,ss; -}; -#pragma pack(pop) - -#ifndef TARGET_OS2 -# if TARGET_MSDOS == 32 -/* WARNING: This is only 100% reliable if the memory in question is below the 1MB mark! - * This may happen to work for pointers above the 1MB mark because DOS4GW and DOS32a tend to - * allocate that way, but that 1:1 correspondence is not guaranteed */ -static inline uint32_t ptr2phys_low1mb(unsigned char *x) { - return (uint32_t)x; -} -# else -static inline uint32_t ptr2phys_low1mb(unsigned char far *x) { - uint32_t r = (uint32_t)FP_SEG(x) << 4UL; - return r + (uint32_t)FP_OFF(x); -} -# endif -#endif - -#if TARGET_MSDOS == 16 && !defined(TARGET_OS2) -static inline void far *normalize_realmode_far_ptr(void far *p) { - return MK_FP( - FP_SEG(p) + (FP_OFF(p) >> 4), - FP_OFF(p) & 0xF); -} -#endif - -#ifndef TARGET_OS2 -# if TARGET_MSDOS == 32 -int _dos_xread(int fd,void *buffer,int bsz); -# else -int _dos_xread(int fd,void far *buffer,int bsz); -# endif - -# if TARGET_MSDOS == 32 -int _dos_xwrite(int fd,void *buffer,int bsz); -# else -int _dos_xwrite(int fd,void far *buffer,int bsz); -# endif -#endif - -#if TARGET_MSDOS == 32 && !defined(TARGET_OS2) -# define dpmi_alloc_descriptor() dpmi_alloc_descriptors(1) - -void *dpmi_alloc_dos(unsigned long len,uint16_t *selector); -void dpmi_free_dos(uint16_t selector); - -void dpmi_free_descriptor(uint16_t d); -uint16_t dpmi_alloc_descriptors(uint16_t c); -unsigned int dpmi_set_segment_base(uint16_t sel,uint32_t base); -unsigned int dpmi_set_segment_limit(uint16_t sel,uint32_t limit); -unsigned int dpmi_set_segment_access(uint16_t sel,uint16_t access); -void *dpmi_phys_addr_map(uint32_t phys,uint32_t size); -void dpmi_phys_addr_free(void *base); -#endif - -#if TARGET_MSDOS == 32 -unsigned char *dos_list_of_lists(); -#else -unsigned char far *dos_list_of_lists(); -#endif - -#if TARGET_MSDOS == 32 && !defined(TARGET_OS2) -int dpmi_alternate_rm_call(struct dpmi_realmode_call *rc); -int dpmi_alternate_rm_call_stacko(struct dpmi_realmode_call *rc); -#endif - -#if TARGET_MSDOS == 32 && !defined(TARGET_OS2) -# if defined(TARGET_WINDOWS) -/* as a 32-bit Windows program: even if DPMI is present, it's useless to us because we can't call into that part of Windows */ -# define dpmi_present 0 -# endif -#endif -#if TARGET_MSDOS == 16 || (TARGET_MSDOS == 32 && !defined(TARGET_WINDOWS)) -/* as a 16-bit program (DOS or Windows), DPMI might be present. Note that DPMI can be present even under NTVDM.EXE under Windows NT, - * because NTVDM.EXE will emulate some DPMI functions. */ -extern unsigned char dpmi_present; -extern uint16_t dpmi_flags; -extern unsigned char dpmi_init; -extern uint32_t dpmi_entry_point; /* NTS: This is the real-mode address, even for 32-bit builds */ -extern unsigned char dpmi_processor_type; -extern uint16_t dpmi_version; -extern uint16_t dpmi_private_data_length_paragraphs; -extern uint16_t dpmi_private_data_segment; -extern unsigned char dpmi_entered; /* 0=not yet entered, 16=entered as 16bit, 32=entered as 32bit */ -extern uint64_t dpmi_rm_entry; -extern uint32_t dpmi_pm_entry; -extern uint16_t dpmi_pm_cs,dpmi_pm_ds,dpmi_pm_es,dpmi_pm_ss; - -void __cdecl dpmi_enter_core(); /* Watcom's inline assembler is too limiting to carry out the DPMI entry and switch back */ -#endif - -#if TARGET_MSDOS == 16 && !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -int dpmi_private_alloc(); -int dpmi_enter(unsigned char mode); -#endif - -void probe_dos(); -void probe_dpmi(); -int probe_vcpi(); - -uint16_t dos_mcb_first_segment(); -int mcb_name_is_junk(char *s/*8 char*/); -int dos_mcb_next(struct dos_mcb_enum *e); -int dos_mcb_first(struct dos_mcb_enum *e); -void mcb_filter_name(struct dos_mcb_enum *e); -unsigned char FAR *dos_mcb_get_psp(struct dos_mcb_enum *e); - -struct dos_psp_cooked { - unsigned char FAR *raw; - uint16_t memsize,callpsp,env; - char cmd[130]; -}; - -int dos_parse_psp(uint16_t seg,struct dos_psp_cooked *e); - -struct dos_device_enum { - unsigned char FAR *raw,FAR *next; - uint16_t ns,no,attr,entry,intent,count; - char name[9]; -}; - -int dos_device_first(struct dos_device_enum *e); -int dos_device_next(struct dos_device_enum *e); - -#if TARGET_MSDOS == 16 && !defined(TARGET_OS2) -uint32_t dos_linear_to_phys_vcpi(uint32_t pn); -#endif - -#if TARGET_MSDOS == 32 -extern struct dos_linear_to_phys_info dos_ltp_info; -extern unsigned char dos_ltp_info_init; - -int dos_ltp_probe(); - -/* NTS: The return value is 64-bit so that in scenarios where we hack DPMI to support PSE and PAE modes, - * the function will still return the physical address associated with the page even when it's above - * the 4GB boundary. But as a 32-bit DOS program, the linear addresses will never exceed 32-bit. */ -uint64_t dos_linear_to_phys(uint32_t linear); - -int dpmi_linear_lock(uint32_t lin,uint32_t size); -int dpmi_linear_unlock(uint32_t lin,uint32_t size); -void *dpmi_linear_alloc(uint32_t try_lin,uint32_t size,uint32_t flags,uint32_t *handle); -int dpmi_linear_free(uint32_t handle); - -#define DOS_LTP_FAILED 0xFFFFFFFFFFFFFFFFULL - -struct dos_linear_to_phys_info { - unsigned char paging:1; /* paging is enabled, therefore mapping will occur. if not set, then linear == physical memory addresses */ - unsigned char dos_remap:1; /* if set, the lower 1MB region (DOS conventional memory) is remapped. if clear, we can assume 1:1 mapping below 1MB */ - unsigned char should_lock_pages:1; /* if set, the program should call DPMI functions to lock pages before attempting to get physical memory address */ - unsigned char cant_xlate:1; /* if set, resources to determine physical memory addresses are not available (such as: running in a Windows DOS Box). however dos_remap=0 means we can assume 1:1 mapping below 1MB */ - unsigned char using_pae:1; /* if set, the DOS extender or DPMI host has PAE/PSE extensions enabled. This changes how page tables are parsed, and can prevent us from mapping */ - unsigned char dma_dos_xlate:1; /* usually set if dos_remap=1 to say the DOS extender or environment translates DMA addresses (i.e. Windows DOS Box), but we can't actually know the physical memory address. We can do DMA from DOS memory */ - unsigned char vcpi_xlate:1; /* use VCPI to translate linear -> phys */ - unsigned char reserved:1; - uint32_t cr0; - uint32_t cr3; /* last known copy of the CR3 (page table base) register */ - uint32_t cr4; /* last known copy of the CR4 register */ -}; -#endif - -#define BIOS_KS_ALT 0x08 -#define BIOS_KT_CTRL 0x04 - -static inline unsigned char read_bios_keystate() { /* from 0x40:0x17 */ -#if TARGET_MSDOS == 32 - return *((unsigned char*)(0x400 + 0x17)); -#else - return *((unsigned char far*)MK_FP(0x40,0x17)); -#endif -} - -#if defined(TARGET_WINDOWS) && TARGET_MSDOS == 16 -void far *win16_getexhandler(unsigned char n); -int win16_setexhandler(unsigned char n,void far *x); -void far *win16_getvect(unsigned char n); -int win16_setvect(unsigned char n,void far *x); -#endif - -#if defined(TARGET_WINDOWS) && TARGET_MSDOS == 32 -typedef struct Win32OrdinalLookupInfo { - DWORD entries,base,base_addr; - DWORD* table; -} Win32OrdinalLookupInfo; - -DWORD *Win32GetExportOrdinalTable(HMODULE mod,DWORD *entries,DWORD *base,DWORD *base_addr); -void *Win32GetOrdinalAddress(Win32OrdinalLookupInfo *nfo,unsigned int ord); -int Win32GetOrdinalLookupInfo(HMODULE mod,Win32OrdinalLookupInfo *info); -#endif - -#if defined(TARGET_WINDOWS) && TARGET_MSDOS == 16 -extern DWORD genthunk32w_ntdll; -extern DWORD genthunk32w_kernel32; -extern DWORD genthunk32w_kernel32_GetVersion; -extern DWORD genthunk32w_kernel32_GetVersionEx; -extern DWORD genthunk32w_kernel32_GetLastError; -extern BOOL __GenThunksExist; -extern BOOL __GenThunksChecked; -extern DWORD (PASCAL FAR *__LoadLibraryEx32W)(LPCSTR lpName,DWORD a,DWORD b); -extern BOOL (PASCAL FAR *__FreeLibrary32W)(DWORD hinst); -extern DWORD (PASCAL FAR *__GetProcAddress32W)(DWORD hinst,LPCSTR name); -extern DWORD (PASCAL FAR *__GetVDMPointer32W)(LPVOID ptr,UINT mask); -extern DWORD (_cdecl _far *__CallProcEx32W)(DWORD params,DWORD convertMask,DWORD procaddr32,...); - -/* NOTE: You call it as if it were declared CallProc32W(..., DWORD hinst,DWORD convertMask,DWORD procaddr32); Ick */ -extern DWORD (PASCAL FAR *__CallProc32W)(DWORD hinst,DWORD convertMask,DWORD procaddr32,...); - -/* it would be nice if Open Watcom defined these constants for Win16 */ -#define CPEX_DEST_STDCALL 0x00000000UL -#define CPEX_DEST_CDECL 0x80000000UL - -int genthunk32_init(); -void genthunk32_free(); -#endif - -#if TARGET_MSDOS == 16 || !defined(TARGET_WINDOWS) -#pragma pack(push,4) -/* OpenWatcom does not define the OSVERSIONINFO struct for Win16 */ -typedef struct OSVERSIONINFO { - uint32_t dwOSVersionInfoSize; - uint32_t dwMajorVersion; - uint32_t dwMinorVersion; - uint32_t dwBuildNumber; - uint32_t dwPlatformId; - char szCSDVersion[128]; -} OSVERSIONINFO; - -#define MAXPNAMELEN 32 - -#define WAVECAPS_PITCH 0x0001 -#define WAVECAPS_PLAYBACKRATE 0x0002 -#define WAVECAPS_VOLUME 0x0004 -#define WAVECAPS_LRVOLUME 0x0008 -#define WAVECAPS_SYNC 0x0010 -#define WAVECAPS_SAMPLEACCURATE 0x0020 - -typedef struct WAVEOUTCAPS { - uint16_t wMid; - uint16_t wPid; - uint32_t vDriverVersion; - char szPname[MAXPNAMELEN]; - uint32_t dwFormats; - uint16_t wChannels; - uint16_t wReserved1; - uint32_t dwSupport; -} WAVEOUTCAPS; -#pragma pack(pop) -#endif - -#if !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -void far *dpmi_getexhandler(unsigned char n); -int dpmi_setexhandler(unsigned char n,void far *x); -#endif - -#if TARGET_MSDOS == 32 && !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -/* TODO: This should be moved into the hw/DOS library */ -extern unsigned char nmi_32_hooked; -extern int nmi_32_refcount; -extern void (interrupt *nmi_32_old_vec)(); - -void do_nmi_32_unhook(); -void do_nmi_32_hook(); -#endif - -#if defined(TARGET_MSDOS) && !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -enum { - DOS_CLOSE_AWARENESS_NOT_ACK=0, - DOS_CLOSE_AWARENESS_ACKED=1 -}; - -void dos_vm_yield(); -void dos_close_awareness_ack(); -int dos_close_awareness_query(); -void dos_close_awareness_cancel(); -int dos_close_awareness_available(); -int dos_close_awareness_enable(unsigned char en); -#endif - -/* unlike DOSBox, VirtualBox's ROM BIOS contains it's version number, which we copy down here */ -extern char virtualbox_version_str[64]; - -int detect_virtualbox_emu(); - -#if TARGET_MSDOS == 16 && !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -int __cdecl dpmi_lin2fmemcpy_32(unsigned char far *dst,uint32_t lsrc,uint32_t sz); -int __cdecl dpmi_lin2fmemcpy_16(unsigned char far *dst,uint32_t lsrc,uint32_t sz); -int dpmi_lin2fmemcpy(unsigned char far *dst,uint32_t lsrc,uint32_t sz); -int dpmi_lin2fmemcpy_init(); -#endif - -struct lib_dos_options { - uint8_t dont_load_dosntast:1; /* do not automatically load DOSNTAST, but use it if loaded. */ - /* if not loaded and the program wants it later on, it should - * call ntvdm_dosntast_load_vdd(); */ - uint8_t dont_use_dosntast:1; /* do not use DOSNTAST, even if loaded */ - uint8_t __reserved__:6; -}; - -extern struct lib_dos_options lib_dos_option; - -# define DOSNTAST_HANDLE_UNASSIGNED 0xFFFFU - -# define DOSNTAST_INIT_REPORT_HANDLE 0xD0500000 -# define DOSNTAST_INIT_REPORT_HANDLE_C 0xD0500000ULL -/* in: EBX = DOSNTAST_INIT_REPORT_HANDLE - * ECX = NTVDM handle - * out: EBX = 0x55AA55AA - * ECX = flat memory address where signature is stored (must be in BIOS data area) */ - -# define DOSNTAST_GETVERSIONEX 0xD0500001 -# define DOSNTAST_GETVERSIONEX_C 0xD0500001ULL -/* in: EBX = - * ECX = protected mode call (1) or real-mode call (0) - * DS:ESI = OSVERSIONINFO struct - * out: EBX = result - * DS:ESI = filled in with OS struct */ - -# define DOSNTAST_GET_TICK_COUNT 0xD0500002 -# define DOSNTAST_GET_TICK_COUNT_C 0xD0500002ULL -/* in: EBX = - * out: EBX = tick count */ - -# define DOSNTAST_GET_IO_PORT 0xD0500003 -# define DOSNTAST_GET_IO_PORT_C 0xD0500003ULL -/* in: EBX = - * out: EBX = 0x55AA55AA - * EDX = I/O port base */ - -# define DOSNTAST_NOTIFY_UNLOAD 0xD050FFFF -# define DOSNTAST_NOTIFY_UNLOAD_C 0xD050FFFFULL -/* in: EBX = - * out: EBX = none */ - -# define DOSNTAST_FUNCTION_GENERAL 0x1000 -# define DOSNTAST_FUN_GEN_SUB_MESSAGEBOX 0x0000 - -# define DOSNTAST_FUNCTION_WINMM 0x1001 -# define DOSNTAST_FUN_WINMM_SUB_waveOutGetNumDevs 0x0000 -# define DOSNTAST_FUN_WINMM_SUB_waveOutGetDevCaps 0x0001 -# define DOSNTAST_FUN_WINMM_SUB_waveOutOpen 0x0002 - -const char *dos_flavor_str(uint8_t f); - -/* Windows NT-friendly version of Win386 MapAliasToFlat. - * The library version is naive and assumes Windows 3.x/9x/ME behavior. - * If you need to convert pointers NOT given by Win386's AllocAlias() functions - * (such as 16:16 pointers given by Window messages) and need the code to gracefully - * handle itself under Windows NT, use this function not MapAliasToFlat() */ -#if TARGET_MSDOS == 32 && defined(WIN386) -void far *win386_alt_winnt_MapAliasToFlat(DWORD farptr); -void far *win386_help_MapAliasToFlat(DWORD farptr); -#endif - -#if (TARGET_MSDOS == 16 || TARGET_MSDOS == 32) && !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -extern unsigned short smartdrv_version; -extern int smartdrv_fd; - -int smartdrv_close(); -int smartdrv_flush(); -int smartdrv_detect(); -#endif - -uint32_t dos_linear_to_phys_vcpi(uint32_t pn); - -#endif /* __HW_DOS_DOS_H */ - diff --git a/src/lib/dl/emm.c b/src/lib/dl/emm.c deleted file mode 100755 index f15b7063..00000000 --- a/src/lib/dl/emm.c +++ /dev/null @@ -1,507 +0,0 @@ -/* emm.c - * - * Expanded Memory Manager library. - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - */ - -/* api library for DOS programs that want to use Expanded Memory (usually, EMM386.EXE) - * - * NOTES: - * This code is intended for use with 16-bit real-mode programs. 32-bit programs have whatever the DOS extender - * offers and have no need for expanded memory, in fact, the DOS extender will often take up all extended - * & expanded memory for it's use and leave us nothing, which is why 32-bit builds of this library do not - * function. - * - * Testing: - * - * YES* = Yes, if DOS underneath provides it (or if DOS, when configured to load EMM386.EXE). Otherwise, No - * - * System/configuration Works? Limit? - * DOSBox 0.74 YES NO - * DOSBox 0.74 + - * Microsoft Windows 3.0 - * Real mode YES* NO - * Standard mode NO -- EMM functions present, but will always report 0KB free. If more than 16MB of RAM is present, Windows causes a serious fault and DOSBox aborts - * 386 Enhanced mode YES* ? - * Microsoft Windows 3.1 - * Standard mode NO -- EMM functions present, but will always report 0KB free - * 386 Enhanced mode YES* NO - * Microsoft Windows 3.11 - * Standard mode NO -- EMM functions present, but will always report 0KB free - * 386 Enhanced mode YES* NO - * QEMU/VirtualBox - * Microsoft Windows 95 (4.00.950)[1] - * Normal mode YES* 64MB API usually reports 16MB free. The test VM had 96MB of RAM - * Safe mode YES* 64MB - * MS-DOS mode (official) YES* 32MB - * MS-DOS mode (gui=0) YES* 32MB - * Microsoft Windows 98 (4.10.1998)[1] - * Normal mode YES* 64MB API usually reports 16MB free. The test VM had 96MB of RAM - * MS-DOS mode (gui=0) YES* 32MB - * Microsoft Windows ME (4.90.3000)[2] - * Normal mode YES* 64MB The API will never report more than 16MB free, but you can hack - * the PIF editor for the DOS program to allow up to 65534KB of - * EMM memory. The test program seems to have no problem allocating - * 48MB of expanded memory when said hack is applied. I suppose the - * API could handle more, but remember limits are imposed by the - * DOS Box VM and those are apparently represented by unsigned - * 16-bit integers, thus the 64MB (65534KB) limit. - * MS-DOS mode (bootdisk) ? ? I am unable to get Windows ME to make a bootdisk at this time. - * So I attemped to use a Windows ME bootdisk from bootdisk.com, - * and added DEVICE=EMM386.EXE only to find that at boot time - * it locks up the computer! So, I have no way of knowing what - * a pure MS-DOS mode EMM386.EXE from Windows ME does. It probably - * acts just like the Windows 95/98 versions... - * Microsoft Windows 2000 Professional - * Normal mode YES 32MB For whatever reason NTVDM defaults to NOT providing EMM memory. - * Limits to 32MB even if you type in larger values in the PIF editor. - * - * [1] EMM386.EXE for these systems will not be able to automatically find a page frame in QEMU or VirtualBox, probably because for - * unmapped regions the emulator returns 0x00 not 0xFF. To work around that, open CONFIG.SYS in a text editor and edit the - * line referring to EMM386.EXE. Add I=E000-EFFF and save. It should look like: - * - * DEVICE=C:\WINDOWS\EMM386.EXE I=E000-EFFF. - * - * [2] You're probably wondering... if Windows ME ignores AUTOEXEC.BAT and CONFIG.SYS then how the hell do you get EMM386.EXE - * loaded? Well, it's very obscure and undocumented, but you can get it loaded on boot up as follows: - * - * 1. Go to the start menu, select "run" and type "notepad c:\windows\system.ini" - * 2. Locate the [386Enh] section, go to the bottom of the section, and add the following lines of text to the end of [386Enh] - * - * EMMInclude=E000-EFFF - * ReservePageFrame=yes - * - * 3. Reboot, and enjoy - */ -#if !defined(TARGET_OS2) && !defined(TARGET_WINDOWS) - -#include "src/lib/doslib/emm.h" - -byte emm_status = 0xFF; /* initialize to 0xFF as a way of indicating that nobody checked yet */ -byte emm_present = 0; -byte emm_version = 0; -byte emm_phys_pages = 0; -word emm_total_pages = 0; -unsigned int emm_page_frame_segment = 0; -word emm_unallocated_pages = 0; -struct emm_phys_page_map *emm_phys_map = NULL; /* maps physical page number -> segment address */ -static const char *devname = "EMMXXXX0"; -static const char *devname2 = "EMMQXXX0"; /* Microsoft publishes EMM standard then breaks it subtly in non-backwards compatible way... news at 11 */ -#if TARGET_MSDOS == 32 && !defined(TARGET_OS2) -static uint16_t emm_phys_map_sel = 0; - -static void emm_realmode_67_call(struct dpmi_realmode_call *rc) { - __asm { - mov ax,0x0300 - mov bx,0x0067 - xor cx,cx - mov edi,rc ; we trust Watcom has left ES == DS - int 0x31 ; call DPMI - } -} -#endif - -void emm_phys_pages_sort() { - /* TODO */ -} - -#if TARGET_MSDOS == 16 && !defined(TARGET_OS2) -void emm_update_page_count() { - emm_unallocated_pages = 0; - emm_total_pages = 0; - - if (!emm_present) return; - - __asm { - mov ah,0x42 - push es - int 0x67 - pop es - mov emm_unallocated_pages,bx - mov emm_total_pages,dx - } -} - -int probe_emm() { - void far *emmptr; - - emm_present = 0; - emmptr = (void far*)_dos_getvect(0x67); - if (emmptr == (void far*)0) - return 0; - - /* apparently 10 bytes into the segment there is the magic string */ - if ( _fmemcmp((char far*)MK_FP(FP_SEG(emmptr),0x000A),(char far*)devname,8) != 0 && - _fmemcmp((char far*)MK_FP(FP_SEG(emmptr),0x000A),(char far*)devname2,8) != 0) - return 0; - - emm_present = 1; - emm_phys_pages = 1; - emm_page_frame_segment = 0; - - __asm { - mov ah,0x40 - push es - int 0x67 - pop es - mov emm_status,ah - - mov ah,0x41 - push es - int 0x67 - pop es - or ah,ah - jnz pfn_end - mov emm_page_frame_segment,bx - - mov ah,0x46 - push es - int 0x67 - pop es - mov emm_version,al -pfn_end: - } - - if (emm_phys_map != NULL) { - free(emm_phys_map); - emm_phys_map = NULL; - } - - if (emm_phys_map == NULL) { - /* see if the EMM provides a mapping table describing the real-mode segments - * corresponding to each physical page. if not, then assume only one page - * available. the table could be up to 256 entries. the API really doesn't - * have a way to tell us ahead of time, so assume the worst. */ - assert(sizeof(struct emm_phys_page_map) == (size_t)4); - emm_phys_map = malloc(sizeof(struct emm_phys_page_map) * 256); - if (emm_phys_map != NULL) { - const unsigned int s = FP_SEG(emm_phys_map); - const unsigned int o = FP_OFF(emm_phys_map); - unsigned int c = 0; - __asm { - push es - mov ax,0x5800 - mov di,s - mov es,di - mov di,o - int 0x67 - or ah,ah - jnz fail - mov c,cx -fail: pop es - } - - if (c == 0) { - free(emm_phys_map); - emm_phys_map = NULL; - } - else { - emm_phys_pages = c; - if (c < 256) { - void *x = realloc(emm_phys_map,sizeof(struct emm_phys_page_map) * c); - if (x != NULL) { /* NTS: if we cannot realloc, well, too bad */ - emm_phys_map = x; - } - } - - /* WARNING: we are assuming several things about the table. - * - That the table is sorted by real-mode segment (as described in the standard) - * - There are no duplicate page numbers - * - The table has as many entries as physical pages */ - - /* do ourself a favor and sort by page number the table */ - emm_phys_pages_sort(); - } - } - } - - return 1; -} - -int emm_alloc_pages(unsigned int pages) { - int handle = -1; - - if (emm_present) { - __asm { - mov ah,0x43 - mov bx,pages - push es - int 0x67 - pop es - or ah,ah - jnz fail - mov handle,dx -fail: - } - } - - return handle; -} - -int emm_free_pages(unsigned int handle) { - int retv = 0; - - if (emm_present) { - __asm { - mov ah,0x45 - mov dx,handle - push es - int 0x67 - pop es - or ah,ah - jnz fail - mov retv,1 -fail: - } - } - - return retv; -} - -int emm_map_page(unsigned int handle,unsigned int phys_page,unsigned int log_page) { - int retv = 0; - - if (phys_page >= (unsigned int)emm_phys_pages) - return 0; - - if (emm_present) { - __asm { - mov ah,0x44 - mov al,byte ptr phys_page - mov bx,log_page - mov dx,handle - push es - int 0x67 - pop es - or ah,ah - jnz fail - mov retv,1 -fail: - } - } - - return retv; -} - -/* given physical page number, return real-mode segment value */ -word emm_last_phys_page_segment(unsigned int phys_page) { - unsigned int i; - - if (phys_page >= (unsigned int)emm_phys_pages) - return 0; - - /* if we don't have a copy of the EMM's mapping table, then assume that there is - * only physical page 0 at the page frame address */ - if (phys_page == 0 && emm_phys_map == NULL) - return emm_page_frame_segment; - - for (i=0;i < emm_phys_pages && emm_phys_map != NULL;i++) { - struct emm_phys_page_map *me = emm_phys_map + i; - if (phys_page == me->number) - return me->segment; - } - - return 0; -} -#else -void emm_update_page_count() { - emm_unallocated_pages = 0; - emm_total_pages = 0; - - if (!emm_present) return; - - __asm { - mov ah,0x42 - push es - int 0x67 - pop es - mov emm_unallocated_pages,bx - mov emm_total_pages,dx - } -} - -/*int probe_emm() {//32-bit - unsigned int emm_seg; - - sanity(); - emm_present = 0; - // Tricky. The DOS extender would likely translate the vector, when what we - really want is the segment value of int 67h - emm_seg = *((uint16_t*)((0x67 << 2) + 2)); - sanity(); - - // apparently 10 bytes into the segment there is the magic string - if ( memcmp((void*)(((unsigned long)emm_seg << 4UL) + 0x000A),devname,8) != 0 && - memcmp((void*)(((unsigned long)emm_seg << 4UL) + 0x000A),devname2,8) != 0) - return 0; - - sanity(); - emm_present = 1; - emm_phys_pages = 1; - emm_page_frame_segment = 0; - - __asm { - mov ah,0x40 - push es - int 0x67 - pop es - mov emm_status,ah - - mov ah,0x41 - push es - int 0x67 - pop es - or ah,ah - jnz pfn_end - mov word ptr emm_page_frame_segment,bx - - mov ah,0x46 - push es - int 0x67 - pop es - mov emm_version,al -pfn_end: - } - sanity(); - - if (emm_phys_map != NULL) { - dpmi_free_dos(emm_phys_map_sel); - emm_phys_map_sel = 0; - emm_phys_map = NULL; - } - - if (emm_phys_map == NULL) { - // see if the EMM provides a mapping table describing the real-mode segments - // * corresponding to each physical page. if not, then assume only one page - // * available. the table could be up to 256 entries. the API really doesn't - // * have a way to tell us ahead of time, so assume the worst. - assert(sizeof(struct emm_phys_page_map) == (size_t)4); - emm_phys_map = dpmi_alloc_dos(sizeof(struct emm_phys_page_map) * 256,&emm_phys_map_sel); - if (emm_phys_map != NULL) { - const unsigned int s = ((uint32_t)emm_phys_map) >> 4; - const unsigned int o = ((uint32_t)emm_phys_map) & 0xF; - struct dpmi_realmode_call rc={0}; - unsigned int c = 0; - - rc.eax = 0x5800; - rc.edi = o; - rc.es = s; - rc.ds = s; - emm_realmode_67_call(&rc); - if ((rc.eax&0xFF) == 0) c = rc.ecx & 0xFFFF; - - if (c == 0) { - dpmi_free_dos(emm_phys_map_sel); - emm_phys_map_sel = 0; - emm_phys_map = NULL; - } - else { - emm_phys_pages = c; - - // * WARNING: we are assuming several things about the table. - // * - That the table is sorted by real-mode segment (as described in the standard) - // * - There are no duplicate page numbers - // * - The table has as many entries as physical pages - - // do ourself a favor and sort by page number the table - emm_phys_pages_sort(); - } - } - } - - return 1; -}*/ - -int emm_alloc_pages(unsigned int pages) { - int handle = -1; - - if (emm_present) { - __asm { - mov ah,0x43 - mov bx,pages - push es - int 0x67 - pop es - or ah,ah - jnz fail - and dx,0xFFFF - mov handle,dx -fail: - } - } - - return handle; -} - -int emm_free_pages(unsigned int handle) { - int retv = 0; - - if (emm_present) { - __asm { - mov ah,0x45 - mov dx,handle - push es - int 0x67 - pop es - or ah,ah - jnz fail - mov retv,1 -fail: - } - } - - return retv; -} - -int emm_map_page(unsigned int handle,unsigned int phys_page,unsigned int log_page) { - int retv = 0; - - if (phys_page >= (unsigned int)emm_phys_pages) - return 0; - - if (emm_present) { - __asm { - mov ah,0x44 - mov al,byte ptr phys_page - mov bx,log_page - mov dx,handle - push es - int 0x67 - pop es - or ah,ah - jnz fail - mov retv,1 -fail: - } - } - - return retv; -} - -word emm_last_phys_page_segment(unsigned int phys_page) { - unsigned int i; - - if (phys_page >= (unsigned int)emm_phys_pages) - return 0; - - /* if we don't have a copy of the EMM's mapping table, then assume that there is - * only physical page 0 at the page frame address */ - if (phys_page == 0 && emm_phys_map == NULL) - return emm_page_frame_segment; - - for (i=0;i < emm_phys_pages && emm_phys_map != NULL;i++) { - struct emm_phys_page_map *me = emm_phys_map + i; - if (phys_page == me->number) - return me->segment; - } - - return 0; -} -#endif - -#endif /* !defined(TARGET_OS2) && !defined(TARGET_WINDOWS) */ - diff --git a/src/lib/dl/emm.h b/src/lib/dl/emm.h deleted file mode 100755 index 0ea6923a..00000000 --- a/src/lib/dl/emm.h +++ /dev/null @@ -1,82 +0,0 @@ -/* emm.h - * - * Expanded Memory Manager library. - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * - */ - -#ifndef __HW_DOS_EMM_H -#define __HW_DOS_EMM_H - -#if !defined(TARGET_OS2) && !defined(TARGET_WINDOWS) - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -//#include "src/lib/doslib/cpu.h" -#include "src/lib/doslib/dos.h" - -extern byte emm_status; -extern byte emm_present; -extern byte emm_version; -extern byte emm_phys_pages; -extern word emm_total_pages; -extern unsigned int emm_page_frame_segment; -extern word emm_unallocated_pages; -extern struct emm_phys_page_map *emm_phys_map; - -/* FIXME: 32-bit protected mode: Who the fuck keeps changing the - value of ES?!? Watcom and our code rely on ES == DS! */ -#if TARGET_MSDOS == 32 -# define sanity() _sanity(__LINE__,__FILE__) -static inline void _sanity(unsigned int line,const char *f) { - uint16_t d=0,e=0; - - __asm { - mov ax,ds - mov d,ax - mov ax,es - mov e,ax - } - - if (d != e) { - fprintf(stderr,"%s(%u) DS(%X) != ES(%X)\n",f,line,d,e); - abort(); - } -} -#else -# define sanity() -#endif - -#pragma pack(push,1) -struct emm_phys_page_map { - uint16_t segment; - uint16_t number; -}; -#pragma pack(pop) - -int probe_emm(); -void emm_phys_pages_sort(); -void emm_update_page_count(); -int emm_alloc_pages(unsigned int pages); -int emm_free_pages(unsigned int handle); -word emm_last_phys_page_segment(unsigned int phys_page); -int emm_map_page(unsigned int handle,unsigned int phys_page,unsigned int log_page); - -#define emm_was_probed() (emm_status != 0xFF) - -#endif /* !defined(TARGET_OS2) && !defined(TARGET_WINDOWS) */ - -#endif /* __HW_DOS_EMM_H */ - diff --git a/src/lib/dl/ext/buildall.bat b/src/lib/dl/ext/buildall.bat deleted file mode 100755 index 62acd16a..00000000 --- a/src/lib/dl/ext/buildall.bat +++ /dev/null @@ -1,61 +0,0 @@ -@echo off - -set WHAT=make -if "%1" == "clean" set WHAT=clean - -echo Building: bzip2 -cd bzip2 -call make.bat %WHAT% -cd .. - -echo Building: faad -cd faad -call make.bat %WHAT% -cd .. - -echo Building: flac -cd flac -call make.bat %WHAT% -cd .. - -echo Building: jpeg -cd jpeg -call make.bat %WHAT% -cd .. - -echo Building: lame -cd lame -call make.bat %WHAT% -cd .. - -echo Building: libmad -cd libmad -call make.bat %WHAT% -cd .. - -echo Building: libogg -cd libogg -call make.bat %WHAT% -cd .. - -echo Building: speex -cd speex -call make.bat %WHAT% -cd .. - -echo Building: vorbis -cd vorbis -call make.bat %WHAT% -cd .. - -echo Building: vorbtool -cd vorbtool -call make.bat %WHAT% -cd .. - -echo Building: zlib -cd zlib -call make.bat %WHAT% -cd .. - -echo All done diff --git a/src/lib/dl/ext/bzip2/CLEAN.BAT b/src/lib/dl/ext/bzip2/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/bzip2/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/bzip2/MAKE.BAT b/src/lib/dl/ext/bzip2/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/bzip2/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/bzip2/blocksrt.c b/src/lib/dl/ext/bzip2/blocksrt.c deleted file mode 100755 index 2b918238..00000000 --- a/src/lib/dl/ext/bzip2/blocksrt.c +++ /dev/null @@ -1,1094 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Block sorting machinery ---*/ -/*--- blocksort.c ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#include "bzlibprv.h" - -/*---------------------------------------------*/ -/*--- Fallback O(N log(N)^2) sorting ---*/ -/*--- algorithm, for repetitive blocks ---*/ -/*---------------------------------------------*/ - -/*---------------------------------------------*/ -static -__inline__ -void fallbackSimpleSort ( UInt32* fmap, - UInt32* eclass, - Int32 lo, - Int32 hi ) -{ - Int32 i, j, tmp; - UInt32 ec_tmp; - - if (lo == hi) return; - - if (hi - lo > 3) { - for ( i = hi-4; i >= lo; i-- ) { - tmp = fmap[i]; - ec_tmp = eclass[tmp]; - for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 ) - fmap[j-4] = fmap[j]; - fmap[j-4] = tmp; - } - } - - for ( i = hi-1; i >= lo; i-- ) { - tmp = fmap[i]; - ec_tmp = eclass[tmp]; - for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ ) - fmap[j-1] = fmap[j]; - fmap[j-1] = tmp; - } -} - - -/*---------------------------------------------*/ -#define fswap(zz1, zz2) \ - { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } - -#define fvswap(zzp1, zzp2, zzn) \ -{ \ - Int32 yyp1 = (zzp1); \ - Int32 yyp2 = (zzp2); \ - Int32 yyn = (zzn); \ - while (yyn > 0) { \ - fswap(fmap[yyp1], fmap[yyp2]); \ - yyp1++; yyp2++; yyn--; \ - } \ -} - - -#define fmin(a,b) ((a) < (b)) ? (a) : (b) - -#define fpush(lz,hz) { stackLo[sp] = lz; \ - stackHi[sp] = hz; \ - sp++; } - -#define fpop(lz,hz) { sp--; \ - lz = stackLo[sp]; \ - hz = stackHi[sp]; } - -#define FALLBACK_QSORT_SMALL_THRESH 10 -#define FALLBACK_QSORT_STACK_SIZE 100 - - -static -void fallbackQSort3 ( UInt32* fmap, - UInt32* eclass, - Int32 loSt, - Int32 hiSt ) -{ - Int32 unLo, unHi, ltLo, gtHi, n, m; - Int32 sp, lo, hi; - UInt32 med, r, r3; - Int32 stackLo[FALLBACK_QSORT_STACK_SIZE]; - Int32 stackHi[FALLBACK_QSORT_STACK_SIZE]; - - r = 0; - - sp = 0; - fpush ( loSt, hiSt ); - - while (sp > 0) { - - AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 ); - - fpop ( lo, hi ); - if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { - fallbackSimpleSort ( fmap, eclass, lo, hi ); - continue; - } - - /* Random partitioning. Median of 3 sometimes fails to - avoid bad cases. Median of 9 seems to help but - looks rather expensive. This too seems to work but - is cheaper. Guidance for the magic constants - 7621 and 32768 is taken from Sedgewick's algorithms - book, chapter 35. - */ - r = ((r * 7621) + 1) % 32768; - r3 = r % 3; - if (r3 == 0) med = eclass[fmap[lo]]; else - if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else - med = eclass[fmap[hi]]; - - unLo = ltLo = lo; - unHi = gtHi = hi; - - while (1) { - while (1) { - if (unLo > unHi) break; - n = (Int32)eclass[fmap[unLo]] - (Int32)med; - if (n == 0) { - fswap(fmap[unLo], fmap[ltLo]); - ltLo++; unLo++; - continue; - }; - if (n > 0) break; - unLo++; - } - while (1) { - if (unLo > unHi) break; - n = (Int32)eclass[fmap[unHi]] - (Int32)med; - if (n == 0) { - fswap(fmap[unHi], fmap[gtHi]); - gtHi--; unHi--; - continue; - }; - if (n < 0) break; - unHi--; - } - if (unLo > unHi) break; - fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--; - } - - AssertD ( unHi == unLo-1, "fallbackQSort3(2)" ); - - if (gtHi < ltLo) continue; - - n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n); - m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m); - - n = lo + unLo - ltLo - 1; - m = hi - (gtHi - unHi) + 1; - - if (n - lo > hi - m) { - fpush ( lo, n ); - fpush ( m, hi ); - } else { - fpush ( m, hi ); - fpush ( lo, n ); - } - } -} - -#undef fmin -#undef fpush -#undef fpop -#undef fswap -#undef fvswap -#undef FALLBACK_QSORT_SMALL_THRESH -#undef FALLBACK_QSORT_STACK_SIZE - - -/*---------------------------------------------*/ -/* Pre: - nblock > 0 - eclass exists for [0 .. nblock-1] - ((UChar*)eclass) [0 .. nblock-1] holds block - ptr exists for [0 .. nblock-1] - - Post: - ((UChar*)eclass) [0 .. nblock-1] holds block - All other areas of eclass destroyed - fmap [0 .. nblock-1] holds sorted order - bhtab [ 0 .. 2+(nblock/32) ] destroyed -*/ - -#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31)) -#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) -#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31))) -#define WORD_BH(zz) bhtab[(zz) >> 5] -#define UNALIGNED_BH(zz) ((zz) & 0x01f) - -static -void fallbackSort ( UInt32* fmap, - UInt32* eclass, - UInt32* bhtab, - Int32 nblock, - Int32 verb ) -{ - Int32 ftab[257]; - Int32 ftabCopy[256]; - Int32 H, i, j, k, l, r, cc, cc1; - Int32 nNotDone; - Int32 nBhtab; - UChar* eclass8 = (UChar*)eclass; - - /*-- - Initial 1-char radix sort to generate - initial fmap and initial BH bits. - --*/ - if (verb >= 4) - VPrintf0 ( " bucket sorting ...\n" ); - for (i = 0; i < 257; i++) ftab[i] = 0; - for (i = 0; i < nblock; i++) ftab[eclass8[i]]++; - for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i]; - for (i = 1; i < 257; i++) ftab[i] += ftab[i-1]; - - for (i = 0; i < nblock; i++) { - j = eclass8[i]; - k = ftab[j] - 1; - ftab[j] = k; - fmap[k] = i; - } - - nBhtab = 2 + (nblock / 32); - for (i = 0; i < nBhtab; i++) bhtab[i] = 0; - for (i = 0; i < 256; i++) SET_BH(ftab[i]); - - /*-- - Inductively refine the buckets. Kind-of an - "exponential radix sort" (!), inspired by the - Manber-Myers suffix array construction algorithm. - --*/ - - /*-- set sentinel bits for block-end detection --*/ - for (i = 0; i < 32; i++) { - SET_BH(nblock + 2*i); - CLEAR_BH(nblock + 2*i + 1); - } - - /*-- the log(N) loop --*/ - H = 1; - while (1) { - - if (verb >= 4) - VPrintf1 ( " depth %6d has ", H ); - - j = 0; - for (i = 0; i < nblock; i++) { - if (ISSET_BH(i)) j = i; - k = fmap[i] - H; if (k < 0) k += nblock; - eclass[k] = j; - } - - nNotDone = 0; - r = -1; - while (1) { - - /*-- find the next non-singleton bucket --*/ - k = r + 1; - while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; - if (ISSET_BH(k)) { - while (WORD_BH(k) == 0xffffffff) k += 32; - while (ISSET_BH(k)) k++; - } - l = k - 1; - if (l >= nblock) break; - while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++; - if (!ISSET_BH(k)) { - while (WORD_BH(k) == 0x00000000) k += 32; - while (!ISSET_BH(k)) k++; - } - r = k - 1; - if (r >= nblock) break; - - /*-- now [l, r] bracket current bucket --*/ - if (r > l) { - nNotDone += (r - l + 1); - fallbackQSort3 ( fmap, eclass, l, r ); - - /*-- scan bucket and generate header bits-- */ - cc = -1; - for (i = l; i <= r; i++) { - cc1 = eclass[fmap[i]]; - if (cc != cc1) { SET_BH(i); cc = cc1; }; - } - } - } - - if (verb >= 4) - VPrintf1 ( "%6d unresolved strings\n", nNotDone ); - - H *= 2; - if (H > nblock || nNotDone == 0) break; - } - - /*-- - Reconstruct the original block in - eclass8 [0 .. nblock-1], since the - previous phase destroyed it. - --*/ - if (verb >= 4) - VPrintf0 ( " reconstructing block ...\n" ); - j = 0; - for (i = 0; i < nblock; i++) { - while (ftabCopy[j] == 0) j++; - ftabCopy[j]--; - eclass8[fmap[i]] = (UChar)j; - } - AssertH ( j < 256, 1005 ); -} - -#undef SET_BH -#undef CLEAR_BH -#undef ISSET_BH -#undef WORD_BH -#undef UNALIGNED_BH - - -/*---------------------------------------------*/ -/*--- The main, O(N^2 log(N)) sorting ---*/ -/*--- algorithm. Faster for "normal" ---*/ -/*--- non-repetitive blocks. ---*/ -/*---------------------------------------------*/ - -/*---------------------------------------------*/ -static -__inline__ -Bool mainGtU ( UInt32 i1, - UInt32 i2, - UChar* block, - UInt16* quadrant, - UInt32 nblock, - Int32* budget ) -{ - Int32 k; - UChar c1, c2; - UInt16 s1, s2; - - AssertD ( i1 != i2, "mainGtU" ); - /* 1 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 2 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 3 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 4 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 5 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 6 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 7 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 8 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 9 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 10 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 11 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - /* 12 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - i1++; i2++; - - k = nblock + 8; - - do { - /* 1 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 2 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 3 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 4 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 5 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 6 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 7 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - /* 8 */ - c1 = block[i1]; c2 = block[i2]; - if (c1 != c2) return (c1 > c2); - s1 = quadrant[i1]; s2 = quadrant[i2]; - if (s1 != s2) return (s1 > s2); - i1++; i2++; - - if (i1 >= nblock) i1 -= nblock; - if (i2 >= nblock) i2 -= nblock; - - k -= 8; - (*budget)--; - } - while (k >= 0); - - return False; -} - - -/*---------------------------------------------*/ -/*-- - Knuth's increments seem to work better - than Incerpi-Sedgewick here. Possibly - because the number of elems to sort is - usually small, typically <= 20. ---*/ -static -Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, - 9841, 29524, 88573, 265720, - 797161, 2391484 }; - -static -void mainSimpleSort ( UInt32* ptr, - UChar* block, - UInt16* quadrant, - Int32 nblock, - Int32 lo, - Int32 hi, - Int32 d, - Int32* budget ) -{ - Int32 i, j, h, bigN, hp; - UInt32 v; - - bigN = hi - lo + 1; - if (bigN < 2) return; - - hp = 0; - while (incs[hp] < bigN) hp++; - hp--; - - for (; hp >= 0; hp--) { - h = incs[hp]; - - i = lo + h; - while (True) { - - /*-- copy 1 --*/ - if (i > hi) break; - v = ptr[i]; - j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget - ) ) { - ptr[j] = ptr[j-h]; - j = j - h; - if (j <= (lo + h - 1)) break; - } - ptr[j] = v; - i++; - - /*-- copy 2 --*/ - if (i > hi) break; - v = ptr[i]; - j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget - ) ) { - ptr[j] = ptr[j-h]; - j = j - h; - if (j <= (lo + h - 1)) break; - } - ptr[j] = v; - i++; - - /*-- copy 3 --*/ - if (i > hi) break; - v = ptr[i]; - j = i; - while ( mainGtU ( - ptr[j-h]+d, v+d, block, quadrant, nblock, budget - ) ) { - ptr[j] = ptr[j-h]; - j = j - h; - if (j <= (lo + h - 1)) break; - } - ptr[j] = v; - i++; - - if (*budget < 0) return; - } - } -} - - -/*---------------------------------------------*/ -/*-- - The following is an implementation of - an elegant 3-way quicksort for strings, - described in a paper "Fast Algorithms for - Sorting and Searching Strings", by Robert - Sedgewick and Jon L. Bentley. ---*/ - -#define mswap(zz1, zz2) \ - { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } - -#define mvswap(zzp1, zzp2, zzn) \ -{ \ - Int32 yyp1 = (zzp1); \ - Int32 yyp2 = (zzp2); \ - Int32 yyn = (zzn); \ - while (yyn > 0) { \ - mswap(ptr[yyp1], ptr[yyp2]); \ - yyp1++; yyp2++; yyn--; \ - } \ -} - -static -__inline__ -UChar mmed3 ( UChar a, UChar b, UChar c ) -{ - UChar t; - if (a > b) { t = a; a = b; b = t; }; - if (b > c) { - b = c; - if (a > b) b = a; - } - return b; -} - -#define mmin(a,b) ((a) < (b)) ? (a) : (b) - -#define mpush(lz,hz,dz) { stackLo[sp] = lz; \ - stackHi[sp] = hz; \ - stackD [sp] = dz; \ - sp++; } - -#define mpop(lz,hz,dz) { sp--; \ - lz = stackLo[sp]; \ - hz = stackHi[sp]; \ - dz = stackD [sp]; } - - -#define mnextsize(az) (nextHi[az]-nextLo[az]) - -#define mnextswap(az,bz) \ - { Int32 tz; \ - tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \ - tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \ - tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; } - - -#define MAIN_QSORT_SMALL_THRESH 20 -#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT) -#define MAIN_QSORT_STACK_SIZE 100 - -static -void mainQSort3 ( UInt32* ptr, - UChar* block, - UInt16* quadrant, - Int32 nblock, - Int32 loSt, - Int32 hiSt, - Int32 dSt, - Int32* budget ) -{ - Int32 unLo, unHi, ltLo, gtHi, n, m, med; - Int32 sp, lo, hi, d; - - Int32 stackLo[MAIN_QSORT_STACK_SIZE]; - Int32 stackHi[MAIN_QSORT_STACK_SIZE]; - Int32 stackD [MAIN_QSORT_STACK_SIZE]; - - Int32 nextLo[3]; - Int32 nextHi[3]; - Int32 nextD [3]; - - sp = 0; - mpush ( loSt, hiSt, dSt ); - - while (sp > 0) { - - AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 ); - - mpop ( lo, hi, d ); - if (hi - lo < MAIN_QSORT_SMALL_THRESH || - d > MAIN_QSORT_DEPTH_THRESH) { - mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); - if (*budget < 0) return; - continue; - } - - med = (Int32) - mmed3 ( block[ptr[ lo ]+d], - block[ptr[ hi ]+d], - block[ptr[ (lo+hi)>>1 ]+d] ); - - unLo = ltLo = lo; - unHi = gtHi = hi; - - while (True) { - while (True) { - if (unLo > unHi) break; - n = ((Int32)block[ptr[unLo]+d]) - med; - if (n == 0) { - mswap(ptr[unLo], ptr[ltLo]); - ltLo++; unLo++; continue; - }; - if (n > 0) break; - unLo++; - } - while (True) { - if (unLo > unHi) break; - n = ((Int32)block[ptr[unHi]+d]) - med; - if (n == 0) { - mswap(ptr[unHi], ptr[gtHi]); - gtHi--; unHi--; continue; - }; - if (n < 0) break; - unHi--; - } - if (unLo > unHi) break; - mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--; - } - - AssertD ( unHi == unLo-1, "mainQSort3(2)" ); - - if (gtHi < ltLo) { - mpush(lo, hi, d+1 ); - continue; - } - - n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n); - m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m); - - n = lo + unLo - ltLo - 1; - m = hi - (gtHi - unHi) + 1; - - nextLo[0] = lo; nextHi[0] = n; nextD[0] = d; - nextLo[1] = m; nextHi[1] = hi; nextD[1] = d; - nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1; - - if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); - if (mnextsize(1) < mnextsize(2)) mnextswap(1,2); - if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); - - AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" ); - AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" ); - - mpush (nextLo[0], nextHi[0], nextD[0]); - mpush (nextLo[1], nextHi[1], nextD[1]); - mpush (nextLo[2], nextHi[2], nextD[2]); - } -} - -#undef mswap -#undef mvswap -#undef mpush -#undef mpop -#undef mmin -#undef mnextsize -#undef mnextswap -#undef MAIN_QSORT_SMALL_THRESH -#undef MAIN_QSORT_DEPTH_THRESH -#undef MAIN_QSORT_STACK_SIZE - - -/*---------------------------------------------*/ -/* Pre: - nblock > N_OVERSHOOT - block32 exists for [0 .. nblock-1 +N_OVERSHOOT] - ((UChar*)block32) [0 .. nblock-1] holds block - ptr exists for [0 .. nblock-1] - - Post: - ((UChar*)block32) [0 .. nblock-1] holds block - All other areas of block32 destroyed - ftab [0 .. 65536 ] destroyed - ptr [0 .. nblock-1] holds sorted order - if (*budget < 0), sorting was abandoned -*/ - -#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8]) -#define SETMASK (1 << 21) -#define CLEARMASK (~(SETMASK)) - -static -void mainSort ( UInt32* ptr, - UChar* block, - UInt16* quadrant, - UInt32* ftab, - Int32 nblock, - Int32 verb, - Int32* budget ) -{ - Int32 i, j, k, ss, sb; - Int32 runningOrder[256]; - Bool bigDone[256]; - Int32 copyStart[256]; - Int32 copyEnd [256]; - UChar c1; - Int32 numQSorted; - UInt16 s; - if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" ); - - /*-- set up the 2-byte frequency table --*/ - for (i = 65536; i >= 0; i--) ftab[i] = 0; - - j = block[0] << 8; - i = nblock-1; - for (; i >= 3; i -= 4) { - quadrant[i] = 0; - j = (j >> 8) | ( ((UInt16)block[i]) << 8); - ftab[j]++; - quadrant[i-1] = 0; - j = (j >> 8) | ( ((UInt16)block[i-1]) << 8); - ftab[j]++; - quadrant[i-2] = 0; - j = (j >> 8) | ( ((UInt16)block[i-2]) << 8); - ftab[j]++; - quadrant[i-3] = 0; - j = (j >> 8) | ( ((UInt16)block[i-3]) << 8); - ftab[j]++; - } - for (; i >= 0; i--) { - quadrant[i] = 0; - j = (j >> 8) | ( ((UInt16)block[i]) << 8); - ftab[j]++; - } - - /*-- (emphasises close relationship of block & quadrant) --*/ - for (i = 0; i < BZ_N_OVERSHOOT; i++) { - block [nblock+i] = block[i]; - quadrant[nblock+i] = 0; - } - - if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); - - /*-- Complete the initial radix sort --*/ - for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1]; - - s = block[0] << 8; - i = nblock-1; - for (; i >= 3; i -= 4) { - s = (s >> 8) | (block[i] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i; - s = (s >> 8) | (block[i-1] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i-1; - s = (s >> 8) | (block[i-2] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i-2; - s = (s >> 8) | (block[i-3] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i-3; - } - for (; i >= 0; i--) { - s = (s >> 8) | (block[i] << 8); - j = ftab[s] -1; - ftab[s] = j; - ptr[j] = i; - } - - /*-- - Now ftab contains the first loc of every small bucket. - Calculate the running order, from smallest to largest - big bucket. - --*/ - for (i = 0; i <= 255; i++) { - bigDone [i] = False; - runningOrder[i] = i; - } - - { - Int32 vv; - Int32 h = 1; - do h = 3 * h + 1; while (h <= 256); - do { - h = h / 3; - for (i = h; i <= 255; i++) { - vv = runningOrder[i]; - j = i; - while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) { - runningOrder[j] = runningOrder[j-h]; - j = j - h; - if (j <= (h - 1)) goto zero; - } - zero: - runningOrder[j] = vv; - } - } while (h != 1); - } - - /*-- - The main sorting loop. - --*/ - - numQSorted = 0; - - for (i = 0; i <= 255; i++) { - - /*-- - Process big buckets, starting with the least full. - Basically this is a 3-step process in which we call - mainQSort3 to sort the small buckets [ss, j], but - also make a big effort to avoid the calls if we can. - --*/ - ss = runningOrder[i]; - - /*-- - Step 1: - Complete the big bucket [ss] by quicksorting - any unsorted small buckets [ss, j], for j != ss. - Hopefully previous pointer-scanning phases have already - completed many of the small buckets [ss, j], so - we don't have to sort them at all. - --*/ - for (j = 0; j <= 255; j++) { - if (j != ss) { - sb = (ss << 8) + j; - if ( ! (ftab[sb] & SETMASK) ) { - Int32 lo = ftab[sb] & CLEARMASK; - Int32 hi = (ftab[sb+1] & CLEARMASK) - 1; - if (hi > lo) { - if (verb >= 4) - VPrintf4 ( " qsort [0x%x, 0x%x] " - "done %d this %d\n", - ss, j, numQSorted, hi - lo + 1 ); - mainQSort3 ( - ptr, block, quadrant, nblock, - lo, hi, BZ_N_RADIX, budget - ); - numQSorted += (hi - lo + 1); - if (*budget < 0) return; - } - } - ftab[sb] |= SETMASK; - } - } - - AssertH ( !bigDone[ss], 1006 ); - - /*-- - Step 2: - Now scan this big bucket [ss] so as to synthesise the - sorted order for small buckets [t, ss] for all t, - including, magically, the bucket [ss,ss] too. - This will avoid doing Real Work in subsequent Step 1's. - --*/ - { - for (j = 0; j <= 255; j++) { - copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK; - copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1; - } - for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) { - k = ptr[j]-1; if (k < 0) k += nblock; - c1 = block[k]; - if (!bigDone[c1]) - ptr[ copyStart[c1]++ ] = k; - } - for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { - k = ptr[j]-1; if (k < 0) k += nblock; - c1 = block[k]; - if (!bigDone[c1]) - ptr[ copyEnd[c1]-- ] = k; - } - } - - AssertH ( (copyStart[ss]-1 == copyEnd[ss]) - || - /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1. - Necessity for this case is demonstrated by compressing - a sequence of approximately 48.5 million of character - 251; 1.0.0/1.0.1 will then die here. */ - (copyStart[ss] == 0 && copyEnd[ss] == nblock-1), - 1007 ) - - for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK; - - /*-- - Step 3: - The [ss] big bucket is now done. Record this fact, - and update the quadrant descriptors. Remember to - update quadrants in the overshoot area too, if - necessary. The "if (i < 255)" test merely skips - this updating for the last bucket processed, since - updating for the last bucket is pointless. - - The quadrant array provides a way to incrementally - cache sort orderings, as they appear, so as to - make subsequent comparisons in fullGtU() complete - faster. For repetitive blocks this makes a big - difference (but not big enough to be able to avoid - the fallback sorting mechanism, exponential radix sort). - - The precise meaning is: at all times: - - for 0 <= i < nblock and 0 <= j <= nblock - - if block[i] != block[j], - - then the relative values of quadrant[i] and - quadrant[j] are meaningless. - - else { - if quadrant[i] < quadrant[j] - then the string starting at i lexicographically - precedes the string starting at j - - else if quadrant[i] > quadrant[j] - then the string starting at j lexicographically - precedes the string starting at i - - else - the relative ordering of the strings starting - at i and j has not yet been determined. - } - --*/ - bigDone[ss] = True; - - if (i < 255) { - Int32 bbStart = ftab[ss << 8] & CLEARMASK; - Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart; - Int32 shifts = 0; - - while ((bbSize >> shifts) > 65534) shifts++; - - for (j = bbSize-1; j >= 0; j--) { - Int32 a2update = ptr[bbStart + j]; - UInt16 qVal = (UInt16)(j >> shifts); - quadrant[a2update] = qVal; - if (a2update < BZ_N_OVERSHOOT) - quadrant[a2update + nblock] = qVal; - } - AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 ); - } - - } - - if (verb >= 4) - VPrintf3 ( " %d pointers, %d sorted, %d scanned\n", - nblock, numQSorted, nblock - numQSorted ); -} - -#undef BIGFREQ -#undef SETMASK -#undef CLEARMASK - - -/*---------------------------------------------*/ -/* Pre: - nblock > 0 - arr2 exists for [0 .. nblock-1 +N_OVERSHOOT] - ((UChar*)arr2) [0 .. nblock-1] holds block - arr1 exists for [0 .. nblock-1] - - Post: - ((UChar*)arr2) [0 .. nblock-1] holds block - All other areas of block destroyed - ftab [ 0 .. 65536 ] destroyed - arr1 [0 .. nblock-1] holds sorted order -*/ -void BZ2_blockSort ( EState* s ) -{ - UInt32* ptr = s->ptr; - UChar* block = s->block; - UInt32* ftab = s->ftab; - Int32 nblock = s->nblock; - Int32 verb = s->verbosity; - Int32 wfact = s->workFactor; - UInt16* quadrant; - Int32 budget; - Int32 budgetInit; - Int32 i; - - if (nblock < 10000) { - fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); - } else { - /* Calculate the location for quadrant, remembering to get - the alignment right. Assumes that &(block[0]) is at least - 2-byte aligned -- this should be ok since block is really - the first section of arr2. - */ - i = nblock+BZ_N_OVERSHOOT; - if (i & 1) i++; - quadrant = (UInt16*)(&(block[i])); - - /* (wfact-1) / 3 puts the default-factor-30 - transition point at very roughly the same place as - with v0.1 and v0.9.0. - Not that it particularly matters any more, since the - resulting compressed stream is now the same regardless - of whether or not we use the main sort or fallback sort. - */ - if (wfact < 1 ) wfact = 1; - if (wfact > 100) wfact = 100; - budgetInit = nblock * ((wfact-1) / 3); - budget = budgetInit; - - mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); - if (verb >= 3) - VPrintf3 ( " %d work, %d block, ratio %5.2f\n", - budgetInit - budget, - nblock, - (float)(budgetInit - budget) / - (float)(nblock==0 ? 1 : nblock) ); - if (budget < 0) { - if (verb >= 2) - VPrintf0 ( " too repetitive; using fallback" - " sorting algorithm\n" ); - fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); - } - } - - s->origPtr = -1; - for (i = 0; i < s->nblock; i++) - if (ptr[i] == 0) - { s->origPtr = i; break; }; - - AssertH( s->origPtr != -1, 1003 ); -} - - -/*-------------------------------------------------------------*/ -/*--- end blocksort.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/bzip2.c b/src/lib/dl/ext/bzip2/bzip2.c deleted file mode 100755 index 9ae5b2da..00000000 --- a/src/lib/dl/ext/bzip2/bzip2.c +++ /dev/null @@ -1,2014 +0,0 @@ - -/*-----------------------------------------------------------*/ -/*--- A block-sorting, lossless compressor bzip2.c ---*/ -/*-----------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -/* Place a 1 beside your platform, and 0 elsewhere. - Generic 32-bit Unix. - Also works on 64-bit Unix boxes. - This is the default. -*/ -#define BZ_UNIX 1 - -/*-- - Win32, as seen by Jacob Navia's excellent - port of (Chris Fraser & David Hanson)'s excellent - lcc compiler. Or with MS Visual C. - This is selected automatically if compiled by a compiler which - defines _WIN32, not including the Cygwin GCC. ---*/ -#define BZ_LCCWIN32 0 - -#if defined(_WIN32) && !defined(__CYGWIN__) -#undef BZ_LCCWIN32 -#define BZ_LCCWIN32 1 -#undef BZ_UNIX -#define BZ_UNIX 0 -#endif - - -/*---------------------------------------------*/ -/*-- - Some stuff for all platforms. ---*/ - -#include -#include -#include -#include -#include -#include -#include -#include "bzlib.h" - -#define ERROR_IF_EOF(i) { if ((i) == EOF) ioError(); } -#define ERROR_IF_NOT_ZERO(i) { if ((i) != 0) ioError(); } -#define ERROR_IF_MINUS_ONE(i) { if ((i) == (-1)) ioError(); } - - -/*---------------------------------------------*/ -/*-- - Platform-specific stuff. ---*/ - -#if BZ_UNIX -# include -# include -# include -# include -# include - -# define PATH_SEP '\\' -# define MY_LSTAT lstat -# define MY_STAT stat -# define MY_S_ISREG S_ISREG -# define MY_S_ISDIR S_ISDIR - -# define APPEND_FILESPEC(root, name) \ - root=snocString((root), (name)) - -# define APPEND_FLAG(root, name) \ - root=snocString((root), (name)) - -# define SET_BINARY_MODE(fd) /**/ - -# ifdef __GNUC__ -# define NORETURN __attribute__ ((noreturn)) -# else -# define NORETURN /**/ -# endif - -# if defined(__DJGPP__) || defined(TARGET_MSDOS) -# include -# include -# undef MY_LSTAT -# undef MY_STAT -# define MY_LSTAT stat -# define MY_STAT stat -# undef SET_BINARY_MODE -# define SET_BINARY_MODE(fd) \ - do { \ - int retVal = setmode ( fileno ( fd ), \ - O_BINARY ); \ - ERROR_IF_MINUS_ONE ( retVal ); \ - } while ( 0 ) -# endif - -# ifdef __CYGWIN__ -# include -# include -# undef SET_BINARY_MODE -# define SET_BINARY_MODE(fd) \ - do { \ - int retVal = setmode ( fileno ( fd ), \ - O_BINARY ); \ - ERROR_IF_MINUS_ONE ( retVal ); \ - } while ( 0 ) -# endif -#endif /* BZ_UNIX */ - - - -#if BZ_LCCWIN32 -# include -# include -# include - -# define NORETURN /**/ -# define PATH_SEP '\\' -# define MY_LSTAT _stat -# define MY_STAT _stat -# define MY_S_ISREG(x) ((x) & _S_IFREG) -# define MY_S_ISDIR(x) ((x) & _S_IFDIR) - -# define APPEND_FLAG(root, name) \ - root=snocString((root), (name)) - -# define APPEND_FILESPEC(root, name) \ - root = snocString ((root), (name)) - -# define SET_BINARY_MODE(fd) \ - do { \ - int retVal = setmode ( fileno ( fd ), \ - O_BINARY ); \ - ERROR_IF_MINUS_ONE ( retVal ); \ - } while ( 0 ) - -#endif /* BZ_LCCWIN32 */ - - -/*---------------------------------------------*/ -/*-- - Some more stuff for all platforms :-) ---*/ - -typedef char Char; -typedef unsigned char Bool; -typedef unsigned char UChar; -typedef int Int32; -typedef unsigned int UInt32; -typedef short Int16; -typedef unsigned short UInt16; - -#define True ((Bool)1) -#define False ((Bool)0) - -/*-- - IntNative is your platform's `native' int size. - Only here to avoid probs with 64-bit platforms. ---*/ -typedef int IntNative; - - -/*---------------------------------------------------*/ -/*--- Misc (file handling) data decls ---*/ -/*---------------------------------------------------*/ - -Int32 verbosity; -Bool keepInputFiles, smallMode, deleteOutputOnInterrupt; -Bool forceOverwrite, testFailsExist, unzFailsExist, noisy; -Int32 numFileNames, numFilesProcessed, blockSize100k; -Int32 exitValue; - -/*-- source modes; F==file, I==stdin, O==stdout --*/ -#define SM_I2O 1 -#define SM_F2O 2 -#define SM_F2F 3 - -/*-- operation modes --*/ -#define OM_Z 1 -#define OM_UNZ 2 -#define OM_TEST 3 - -Int32 opMode; -Int32 srcMode; - -#define FILE_NAME_LEN 1034 - -Int32 longestFileName; -Char inName [FILE_NAME_LEN]; -Char outName[FILE_NAME_LEN]; -Char tmpName[FILE_NAME_LEN]; -Char *progName; -Char progNameReally[FILE_NAME_LEN]; -FILE *outputHandleJustInCase; -Int32 workFactor; - -static void panic ( const Char* ) NORETURN; -static void ioError ( void ) NORETURN; -static void outOfMemory ( void ) NORETURN; -static void configError ( void ) NORETURN; -static void crcError ( void ) NORETURN; -static void cleanUpAndFail ( Int32 ) NORETURN; -static void compressedStreamEOF ( void ) NORETURN; - -static void copyFileName ( Char*, Char* ); -static void* myMalloc ( Int32 ); -static void applySavedFileAttrToOutputFile ( IntNative fd ); - - - -/*---------------------------------------------------*/ -/*--- An implementation of 64-bit ints. Sigh. ---*/ -/*--- Roll on widespread deployment of ANSI C9X ! ---*/ -/*---------------------------------------------------*/ - -typedef - struct { UChar b[8]; } - UInt64; - - -static -void uInt64_from_UInt32s ( UInt64* n, UInt32 lo32, UInt32 hi32 ) -{ - n->b[7] = (UChar)((hi32 >> 24) & 0xFF); - n->b[6] = (UChar)((hi32 >> 16) & 0xFF); - n->b[5] = (UChar)((hi32 >> 8) & 0xFF); - n->b[4] = (UChar) (hi32 & 0xFF); - n->b[3] = (UChar)((lo32 >> 24) & 0xFF); - n->b[2] = (UChar)((lo32 >> 16) & 0xFF); - n->b[1] = (UChar)((lo32 >> 8) & 0xFF); - n->b[0] = (UChar) (lo32 & 0xFF); -} - - -static -double uInt64_to_double ( UInt64* n ) -{ - Int32 i; - double base = 1.0; - double sum = 0.0; - for (i = 0; i < 8; i++) { - sum += base * (double)(n->b[i]); - base *= 256.0; - } - return sum; -} - - -static -Bool uInt64_isZero ( UInt64* n ) -{ - Int32 i; - for (i = 0; i < 8; i++) - if (n->b[i] != 0) return 0; - return 1; -} - - -/* Divide *n by 10, and return the remainder. */ -static -Int32 uInt64_qrm10 ( UInt64* n ) -{ - UInt32 rem, tmp; - Int32 i; - rem = 0; - for (i = 7; i >= 0; i--) { - tmp = rem * 256 + n->b[i]; - n->b[i] = tmp / 10; - rem = tmp % 10; - } - return rem; -} - - -/* ... and the Whole Entire Point of all this UInt64 stuff is - so that we can supply the following function. -*/ -static -void uInt64_toAscii ( char* outbuf, UInt64* n ) -{ - Int32 i, q; - UChar buf[32]; - Int32 nBuf = 0; - UInt64 n_copy = *n; - do { - q = uInt64_qrm10 ( &n_copy ); - buf[nBuf] = q + '0'; - nBuf++; - } while (!uInt64_isZero(&n_copy)); - outbuf[nBuf] = 0; - for (i = 0; i < nBuf; i++) - outbuf[i] = buf[nBuf-i-1]; -} - - -/*---------------------------------------------------*/ -/*--- Processing of complete files and streams ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------*/ -static -Bool myfeof ( FILE* f ) -{ - Int32 c = fgetc ( f ); - if (c == EOF) return True; - ungetc ( c, f ); - return False; -} - - -/*---------------------------------------------*/ -static -void compressStream ( FILE *stream, FILE *zStream ) -{ - BZFILE* bzf = NULL; - UChar ibuf[5000]; - Int32 nIbuf; - UInt32 nbytes_in_lo32, nbytes_in_hi32; - UInt32 nbytes_out_lo32, nbytes_out_hi32; - Int32 bzerr, bzerr_dummy, ret; - - SET_BINARY_MODE(stream); - SET_BINARY_MODE(zStream); - - if (ferror(stream)) goto errhandler_io; - if (ferror(zStream)) goto errhandler_io; - - bzf = BZ2_bzWriteOpen ( &bzerr, zStream, - blockSize100k, verbosity, workFactor ); - if (bzerr != BZ_OK) goto errhandler; - - if (verbosity >= 2) fprintf ( stderr, "\n" ); - - while (True) { - - if (myfeof(stream)) break; - nIbuf = fread ( ibuf, sizeof(UChar), 5000, stream ); - if (ferror(stream)) goto errhandler_io; - if (nIbuf > 0) BZ2_bzWrite ( &bzerr, bzf, (void*)ibuf, nIbuf ); - if (bzerr != BZ_OK) goto errhandler; - - } - - BZ2_bzWriteClose64 ( &bzerr, bzf, 0, - &nbytes_in_lo32, &nbytes_in_hi32, - &nbytes_out_lo32, &nbytes_out_hi32 ); - if (bzerr != BZ_OK) goto errhandler; - - if (ferror(zStream)) goto errhandler_io; - ret = fflush ( zStream ); - if (ret == EOF) goto errhandler_io; - if (zStream != stdout) { - Int32 fd = fileno ( zStream ); - if (fd < 0) goto errhandler_io; - applySavedFileAttrToOutputFile ( fd ); - ret = fclose ( zStream ); - outputHandleJustInCase = NULL; - if (ret == EOF) goto errhandler_io; - } - outputHandleJustInCase = NULL; - if (ferror(stream)) goto errhandler_io; - ret = fclose ( stream ); - if (ret == EOF) goto errhandler_io; - - if (verbosity >= 1) { - if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) { - fprintf ( stderr, " no data compressed.\n"); - } else { - Char buf_nin[32], buf_nout[32]; - UInt64 nbytes_in, nbytes_out; - double nbytes_in_d, nbytes_out_d; - uInt64_from_UInt32s ( &nbytes_in, - nbytes_in_lo32, nbytes_in_hi32 ); - uInt64_from_UInt32s ( &nbytes_out, - nbytes_out_lo32, nbytes_out_hi32 ); - nbytes_in_d = uInt64_to_double ( &nbytes_in ); - nbytes_out_d = uInt64_to_double ( &nbytes_out ); - uInt64_toAscii ( buf_nin, &nbytes_in ); - uInt64_toAscii ( buf_nout, &nbytes_out ); - fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, " - "%5.2f%% saved, %s in, %s out.\n", - nbytes_in_d / nbytes_out_d, - (8.0 * nbytes_out_d) / nbytes_in_d, - 100.0 * (1.0 - nbytes_out_d / nbytes_in_d), - buf_nin, - buf_nout - ); - } - } - - return; - - errhandler: - BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1, - &nbytes_in_lo32, &nbytes_in_hi32, - &nbytes_out_lo32, &nbytes_out_hi32 ); - switch (bzerr) { - case BZ_CONFIG_ERROR: - configError(); break; - case BZ_MEM_ERROR: - outOfMemory (); break; - case BZ_IO_ERROR: - errhandler_io: - ioError(); break; - default: - panic ( "compress:unexpected error" ); - } - - panic ( "compress:end" ); - /*notreached*/ -} - - - -/*---------------------------------------------*/ -static -Bool uncompressStream ( FILE *zStream, FILE *stream ) -{ - BZFILE* bzf = NULL; - Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; - UChar obuf[5000]; - UChar unused[BZ_MAX_UNUSED]; - Int32 nUnused; - void* unusedTmpV; - UChar* unusedTmp; - - nUnused = 0; - streamNo = 0; - - SET_BINARY_MODE(stream); - SET_BINARY_MODE(zStream); - - if (ferror(stream)) goto errhandler_io; - if (ferror(zStream)) goto errhandler_io; - - while (True) { - - bzf = BZ2_bzReadOpen ( - &bzerr, zStream, verbosity, - (int)smallMode, unused, nUnused - ); - if (bzf == NULL || bzerr != BZ_OK) goto errhandler; - streamNo++; - - while (bzerr == BZ_OK) { - nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); - if (bzerr == BZ_DATA_ERROR_MAGIC) goto trycat; - if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0) - fwrite ( obuf, sizeof(UChar), nread, stream ); - if (ferror(stream)) goto errhandler_io; - } - if (bzerr != BZ_STREAM_END) goto errhandler; - - BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused ); - if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" ); - - unusedTmp = (UChar*)unusedTmpV; - for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i]; - - BZ2_bzReadClose ( &bzerr, bzf ); - if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" ); - - if (nUnused == 0 && myfeof(zStream)) break; - } - - closeok: - if (ferror(zStream)) goto errhandler_io; - if (stream != stdout) { - Int32 fd = fileno ( stream ); - if (fd < 0) goto errhandler_io; - applySavedFileAttrToOutputFile ( fd ); - } - ret = fclose ( zStream ); - if (ret == EOF) goto errhandler_io; - - if (ferror(stream)) goto errhandler_io; - ret = fflush ( stream ); - if (ret != 0) goto errhandler_io; - if (stream != stdout) { - ret = fclose ( stream ); - outputHandleJustInCase = NULL; - if (ret == EOF) goto errhandler_io; - } - outputHandleJustInCase = NULL; - if (verbosity >= 2) fprintf ( stderr, "\n " ); - return True; - - trycat: - if (forceOverwrite) { - rewind(zStream); - while (True) { - if (myfeof(zStream)) break; - nread = fread ( obuf, sizeof(UChar), 5000, zStream ); - if (ferror(zStream)) goto errhandler_io; - if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream ); - if (ferror(stream)) goto errhandler_io; - } - goto closeok; - } - - errhandler: - BZ2_bzReadClose ( &bzerr_dummy, bzf ); - switch (bzerr) { - case BZ_CONFIG_ERROR: - configError(); break; - case BZ_IO_ERROR: - errhandler_io: - ioError(); break; - case BZ_DATA_ERROR: - crcError(); - case BZ_MEM_ERROR: - outOfMemory(); - case BZ_UNEXPECTED_EOF: - compressedStreamEOF(); - case BZ_DATA_ERROR_MAGIC: - if (zStream != stdin) fclose(zStream); - if (stream != stdout) fclose(stream); - if (streamNo == 1) { - return False; - } else { - if (noisy) - fprintf ( stderr, - "\n%s: %s: trailing garbage after EOF ignored\n", - progName, inName ); - return True; - } - default: - panic ( "decompress:unexpected error" ); - } - - panic ( "decompress:end" ); - return True; /*notreached*/ -} - - -/*---------------------------------------------*/ -static -Bool testStream ( FILE *zStream ) -{ - BZFILE* bzf = NULL; - Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; - UChar obuf[5000]; - UChar unused[BZ_MAX_UNUSED]; - Int32 nUnused; - void* unusedTmpV; - UChar* unusedTmp; - - nUnused = 0; - streamNo = 0; - - SET_BINARY_MODE(zStream); - if (ferror(zStream)) goto errhandler_io; - - while (True) { - - bzf = BZ2_bzReadOpen ( - &bzerr, zStream, verbosity, - (int)smallMode, unused, nUnused - ); - if (bzf == NULL || bzerr != BZ_OK) goto errhandler; - streamNo++; - - while (bzerr == BZ_OK) { - nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); - if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler; - } - if (bzerr != BZ_STREAM_END) goto errhandler; - - BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused ); - if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" ); - - unusedTmp = (UChar*)unusedTmpV; - for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i]; - - BZ2_bzReadClose ( &bzerr, bzf ); - if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" ); - if (nUnused == 0 && myfeof(zStream)) break; - - } - - if (ferror(zStream)) goto errhandler_io; - ret = fclose ( zStream ); - if (ret == EOF) goto errhandler_io; - - if (verbosity >= 2) fprintf ( stderr, "\n " ); - return True; - - errhandler: - BZ2_bzReadClose ( &bzerr_dummy, bzf ); - if (verbosity == 0) - fprintf ( stderr, "%s: %s: ", progName, inName ); - switch (bzerr) { - case BZ_CONFIG_ERROR: - configError(); break; - case BZ_IO_ERROR: - errhandler_io: - ioError(); break; - case BZ_DATA_ERROR: - fprintf ( stderr, - "data integrity (CRC) error in data\n" ); - return False; - case BZ_MEM_ERROR: - outOfMemory(); - case BZ_UNEXPECTED_EOF: - fprintf ( stderr, - "file ends unexpectedly\n" ); - return False; - case BZ_DATA_ERROR_MAGIC: - if (zStream != stdin) fclose(zStream); - if (streamNo == 1) { - fprintf ( stderr, - "bad magic number (file not created by bzip2)\n" ); - return False; - } else { - if (noisy) - fprintf ( stderr, - "trailing garbage after EOF ignored\n" ); - return True; - } - default: - panic ( "test:unexpected error" ); - } - - panic ( "test:end" ); - return True; /*notreached*/ -} - - -/*---------------------------------------------------*/ -/*--- Error [non-] handling grunge ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------*/ -static -void setExit ( Int32 v ) -{ - if (v > exitValue) exitValue = v; -} - - -/*---------------------------------------------*/ -static -void cadvise ( void ) -{ - if (noisy) - fprintf ( - stderr, - "\nIt is possible that the compressed file(s) have become corrupted.\n" - "You can use the -tvv option to test integrity of such files.\n\n" - "You can use the `bzip2recover' program to attempt to recover\n" - "data from undamaged sections of corrupted files.\n\n" - ); -} - - -/*---------------------------------------------*/ -static -void showFileNames ( void ) -{ - if (noisy) - fprintf ( - stderr, - "\tInput file = %s, output file = %s\n", - inName, outName - ); -} - - -/*---------------------------------------------*/ -static -void cleanUpAndFail ( Int32 ec ) -{ - IntNative retVal; - struct MY_STAT statBuf; - - if ( srcMode == SM_F2F - && opMode != OM_TEST - && deleteOutputOnInterrupt ) { - - /* Check whether input file still exists. Delete output file - only if input exists to avoid loss of data. Joerg Prante, 5 - January 2002. (JRS 06-Jan-2002: other changes in 1.0.2 mean - this is less likely to happen. But to be ultra-paranoid, we - do the check anyway.) */ - retVal = MY_STAT ( inName, &statBuf ); - if (retVal == 0) { - if (noisy) - fprintf ( stderr, - "%s: Deleting output file %s, if it exists.\n", - progName, outName ); - if (outputHandleJustInCase != NULL) - fclose ( outputHandleJustInCase ); - retVal = remove ( outName ); - if (retVal != 0) - fprintf ( stderr, - "%s: WARNING: deletion of output file " - "(apparently) failed.\n", - progName ); - } else { - fprintf ( stderr, - "%s: WARNING: deletion of output file suppressed\n", - progName ); - fprintf ( stderr, - "%s: since input file no longer exists. Output file\n", - progName ); - fprintf ( stderr, - "%s: `%s' may be incomplete.\n", - progName, outName ); - fprintf ( stderr, - "%s: I suggest doing an integrity test (bzip2 -tv)" - " of it.\n", - progName ); - } - } - - if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) { - fprintf ( stderr, - "%s: WARNING: some files have not been processed:\n" - "%s: %d specified on command line, %d not processed yet.\n\n", - progName, progName, - numFileNames, numFileNames - numFilesProcessed ); - } - setExit(ec); - exit(exitValue); -} - - -/*---------------------------------------------*/ -static -void panic ( const Char* s ) -{ - fprintf ( stderr, - "\n%s: PANIC -- internal consistency error:\n" - "\t%s\n" - "\tThis is a BUG. Please report it to me at:\n" - "\tjseward@bzip.org\n", - progName, s ); - showFileNames(); - cleanUpAndFail( 3 ); -} - - -/*---------------------------------------------*/ -static -void crcError ( void ) -{ - fprintf ( stderr, - "\n%s: Data integrity error when decompressing.\n", - progName ); - showFileNames(); - cadvise(); - cleanUpAndFail( 2 ); -} - - -/*---------------------------------------------*/ -static -void compressedStreamEOF ( void ) -{ - if (noisy) { - fprintf ( stderr, - "\n%s: Compressed file ends unexpectedly;\n\t" - "perhaps it is corrupted? *Possible* reason follows.\n", - progName ); - perror ( progName ); - showFileNames(); - cadvise(); - } - cleanUpAndFail( 2 ); -} - - -/*---------------------------------------------*/ -static -void ioError ( void ) -{ - fprintf ( stderr, - "\n%s: I/O or other error, bailing out. " - "Possible reason follows.\n", - progName ); - perror ( progName ); - showFileNames(); - cleanUpAndFail( 1 ); -} - - -/*---------------------------------------------*/ -static -void mySignalCatcher ( IntNative n ) -{ - fprintf ( stderr, - "\n%s: Control-C or similar caught, quitting.\n", - progName ); - cleanUpAndFail(1); -} - - -/*---------------------------------------------*/ -static -void mySIGSEGVorSIGBUScatcher ( IntNative n ) -{ - if (opMode == OM_Z) - fprintf ( - stderr, - "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n" - "\n" - " Possible causes are (most likely first):\n" - " (1) This computer has unreliable memory or cache hardware\n" - " (a surprisingly common problem; try a different machine.)\n" - " (2) A bug in the compiler used to create this executable\n" - " (unlikely, if you didn't compile bzip2 yourself.)\n" - " (3) A real bug in bzip2 -- I hope this should never be the case.\n" - " The user's manual, Section 4.3, has more info on (1) and (2).\n" - " \n" - " If you suspect this is a bug in bzip2, or are unsure about (1)\n" - " or (2), feel free to report it to me at: jseward@bzip.org.\n" - " Section 4.3 of the user's manual describes the info a useful\n" - " bug report should have. If the manual is available on your\n" - " system, please try and read it before mailing me. If you don't\n" - " have the manual or can't be bothered to read it, mail me anyway.\n" - "\n", - progName ); - else - fprintf ( - stderr, - "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n" - "\n" - " Possible causes are (most likely first):\n" - " (1) The compressed data is corrupted, and bzip2's usual checks\n" - " failed to detect this. Try bzip2 -tvv my_file.bz2.\n" - " (2) This computer has unreliable memory or cache hardware\n" - " (a surprisingly common problem; try a different machine.)\n" - " (3) A bug in the compiler used to create this executable\n" - " (unlikely, if you didn't compile bzip2 yourself.)\n" - " (4) A real bug in bzip2 -- I hope this should never be the case.\n" - " The user's manual, Section 4.3, has more info on (2) and (3).\n" - " \n" - " If you suspect this is a bug in bzip2, or are unsure about (2)\n" - " or (3), feel free to report it to me at: jseward@bzip.org.\n" - " Section 4.3 of the user's manual describes the info a useful\n" - " bug report should have. If the manual is available on your\n" - " system, please try and read it before mailing me. If you don't\n" - " have the manual or can't be bothered to read it, mail me anyway.\n" - "\n", - progName ); - - showFileNames(); - if (opMode == OM_Z) - cleanUpAndFail( 3 ); else - { cadvise(); cleanUpAndFail( 2 ); } -} - - -/*---------------------------------------------*/ -static -void outOfMemory ( void ) -{ - fprintf ( stderr, - "\n%s: couldn't allocate enough memory\n", - progName ); - showFileNames(); - cleanUpAndFail(1); -} - - -/*---------------------------------------------*/ -static -void configError ( void ) -{ - fprintf ( stderr, - "bzip2: I'm not configured correctly for this platform!\n" - "\tI require Int32, Int16 and Char to have sizes\n" - "\tof 4, 2 and 1 bytes to run properly, and they don't.\n" - "\tProbably you can fix this by defining them correctly,\n" - "\tand recompiling. Bye!\n" ); - setExit(3); - exit(exitValue); -} - - -/*---------------------------------------------------*/ -/*--- The main driver machinery ---*/ -/*---------------------------------------------------*/ - -/* All rather crufty. The main problem is that input files - are stat()d multiple times before use. This should be - cleaned up. -*/ - -/*---------------------------------------------*/ -static -void pad ( Char *s ) -{ - Int32 i; - if ( (Int32)strlen(s) >= longestFileName ) return; - for (i = 1; i <= longestFileName - (Int32)strlen(s); i++) - fprintf ( stderr, " " ); -} - - -/*---------------------------------------------*/ -static -void copyFileName ( Char* to, Char* from ) -{ - if ( strlen(from) > FILE_NAME_LEN-10 ) { - fprintf ( - stderr, - "bzip2: file name\n`%s'\n" - "is suspiciously (more than %d chars) long.\n" - "Try using a reasonable file name instead. Sorry! :-)\n", - from, FILE_NAME_LEN-10 - ); - setExit(1); - exit(exitValue); - } - - strncpy(to,from,FILE_NAME_LEN-10); - to[FILE_NAME_LEN-10]='\0'; -} - - -/*---------------------------------------------*/ -static -Bool fileExists ( Char* name ) -{ - FILE *tmp = fopen ( name, "rb" ); - Bool exists = (tmp != NULL); - if (tmp != NULL) fclose ( tmp ); - return exists; -} - - -/*---------------------------------------------*/ -/* Open an output file safely with O_EXCL and good permissions. - This avoids a race condition in versions < 1.0.2, in which - the file was first opened and then had its interim permissions - set safely. We instead use open() to create the file with - the interim permissions required. (--- --- rw-). - - For non-Unix platforms, if we are not worrying about - security issues, simple this simply behaves like fopen. -*/ -static -FILE* fopen_output_safely ( Char* name, const char* mode ) -{ -# if BZ_UNIX - FILE* fp; - IntNative fh; - fh = open(name, O_WRONLY|O_CREAT|O_EXCL, S_IWUSR|S_IRUSR); - if (fh == -1) return NULL; - fp = fdopen(fh, mode); - if (fp == NULL) close(fh); - return fp; -# else - return fopen(name, mode); -# endif -} - - -/*---------------------------------------------*/ -/*-- - if in doubt, return True ---*/ -static -Bool notAStandardFile ( Char* name ) -{ - IntNative i; - struct MY_STAT statBuf; - - i = MY_LSTAT ( name, &statBuf ); - if (i != 0) return True; - if (MY_S_ISREG(statBuf.st_mode)) return False; - return True; -} - - -/*---------------------------------------------*/ -/*-- - rac 11/21/98 see if file has hard links to it ---*/ -static -Int32 countHardLinks ( Char* name ) -{ - IntNative i; - struct MY_STAT statBuf; - - i = MY_LSTAT ( name, &statBuf ); - if (i != 0) return 0; - return (statBuf.st_nlink - 1); -} - - -/*---------------------------------------------*/ -/* Copy modification date, access date, permissions and owner from the - source to destination file. We have to copy this meta-info off - into fileMetaInfo before starting to compress / decompress it, - because doing it afterwards means we get the wrong access time. - - To complicate matters, in compress() and decompress() below, the - sequence of tests preceding the call to saveInputFileMetaInfo() - involves calling fileExists(), which in turn establishes its result - by attempting to fopen() the file, and if successful, immediately - fclose()ing it again. So we have to assume that the fopen() call - does not cause the access time field to be updated. - - Reading of the man page for stat() (man 2 stat) on RedHat 7.2 seems - to imply that merely doing open() will not affect the access time. - Therefore we merely need to hope that the C library only does - open() as a result of fopen(), and not any kind of read()-ahead - cleverness. - - It sounds pretty fragile to me. Whether this carries across - robustly to arbitrary Unix-like platforms (or even works robustly - on this one, RedHat 7.2) is unknown to me. Nevertheless ... -*/ -#if BZ_UNIX -static -struct MY_STAT fileMetaInfo; -#endif - -static -void saveInputFileMetaInfo ( Char *srcName ) -{ -# if BZ_UNIX - IntNative retVal; - /* Note use of stat here, not lstat. */ - retVal = MY_STAT( srcName, &fileMetaInfo ); - ERROR_IF_NOT_ZERO ( retVal ); -# endif -} - - -static -void applySavedTimeInfoToOutputFile ( Char *dstName ) -{ -# if BZ_UNIX - IntNative retVal; - struct utimbuf uTimBuf; - - uTimBuf.actime = fileMetaInfo.st_atime; - uTimBuf.modtime = fileMetaInfo.st_mtime; - - retVal = utime ( dstName, &uTimBuf ); - ERROR_IF_NOT_ZERO ( retVal ); -# endif -} - -static -void applySavedFileAttrToOutputFile ( IntNative fd ) -{ -} - - -/*---------------------------------------------*/ -static -Bool containsDubiousChars ( Char* name ) -{ -# if BZ_UNIX - /* On unix, files can contain any characters and the file expansion - * is performed by the shell. - */ - return False; -# else /* ! BZ_UNIX */ - /* On non-unix (Win* platforms), wildcard characters are not allowed in - * filenames. - */ - for (; *name != '\0'; name++) - if (*name == '?' || *name == '*') return True; - return False; -# endif /* BZ_UNIX */ -} - - -/*---------------------------------------------*/ -#define BZ_N_SUFFIX_PAIRS 4 - -const Char* zSuffix[BZ_N_SUFFIX_PAIRS] - = { ".bz2", ".bz", ".tbz2", ".tbz" }; -const Char* unzSuffix[BZ_N_SUFFIX_PAIRS] - = { "", "", ".tar", ".tar" }; - -static -Bool hasSuffix ( Char* s, const Char* suffix ) -{ - Int32 ns = strlen(s); - Int32 nx = strlen(suffix); - if (ns < nx) return False; - if (strcmp(s + ns - nx, suffix) == 0) return True; - return False; -} - -static -Bool mapSuffix ( Char* name, - const Char* oldSuffix, - const Char* newSuffix ) -{ - if (!hasSuffix(name,oldSuffix)) return False; - name[strlen(name)-strlen(oldSuffix)] = 0; - strcat ( name, newSuffix ); - return True; -} - - -/*---------------------------------------------*/ -static -void compress ( Char *name ) -{ - FILE *inStr; - FILE *outStr; - Int32 n, i; - struct MY_STAT statBuf; - - deleteOutputOnInterrupt = False; - - if (name == NULL && srcMode != SM_I2O) - panic ( "compress: bad modes\n" ); - - switch (srcMode) { - case SM_I2O: - copyFileName ( inName, (Char*)"(stdin)" ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - case SM_F2F: - copyFileName ( inName, name ); - copyFileName ( outName, name ); - strcat ( outName, ".bz2" ); - break; - case SM_F2O: - copyFileName ( inName, name ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - } - - if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { - if (noisy) - fprintf ( stderr, "%s: There are no files matching `%s'.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode != SM_I2O && !fileExists ( inName ) ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - } - for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) { - if (hasSuffix(inName, zSuffix[i])) { - if (noisy) - fprintf ( stderr, - "%s: Input file %s already has %s suffix.\n", - progName, inName, zSuffix[i] ); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F || srcMode == SM_F2O ) { - MY_STAT(inName, &statBuf); - if ( MY_S_ISDIR(statBuf.st_mode) ) { - fprintf( stderr, - "%s: Input file %s is a directory.\n", - progName,inName); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) { - if (noisy) - fprintf ( stderr, "%s: Input file %s is not a normal file.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode == SM_F2F && fileExists ( outName ) ) { - if (forceOverwrite) { - remove(outName); - } else { - fprintf ( stderr, "%s: Output file %s already exists.\n", - progName, outName ); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && - (n=countHardLinks ( inName )) > 0) { - fprintf ( stderr, "%s: Input file %s has %d other link%s.\n", - progName, inName, n, n > 1 ? "s" : "" ); - setExit(1); - return; - } - - if ( srcMode == SM_F2F ) { - /* Save the file's meta-info before we open it. Doing it later - means we mess up the access times. */ - saveInputFileMetaInfo ( inName ); - } - - switch ( srcMode ) { - - case SM_I2O: - inStr = stdin; - outStr = stdout; - if ( isatty ( fileno ( stdout ) ) ) { - fprintf ( stderr, - "%s: I won't write compressed data to a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - setExit(1); - return; - }; - break; - - case SM_F2O: - inStr = fopen ( inName, "rb" ); - outStr = stdout; - if ( isatty ( fileno ( stdout ) ) ) { - fprintf ( stderr, - "%s: I won't write compressed data to a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - }; - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - }; - break; - - case SM_F2F: - inStr = fopen ( inName, "rb" ); - outStr = fopen_output_safely ( outName, "wb" ); - if ( outStr == NULL) { - fprintf ( stderr, "%s: Can't create output file %s: %s.\n", - progName, outName, strerror(errno) ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - } - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - if ( outStr != NULL ) fclose ( outStr ); - setExit(1); - return; - }; - break; - - default: - panic ( "compress: bad srcMode" ); - break; - } - - if (verbosity >= 1) { - fprintf ( stderr, " %s: ", inName ); - pad ( inName ); - fflush ( stderr ); - } - - /*--- Now the input and output handles are sane. Do the Biz. ---*/ - outputHandleJustInCase = outStr; - deleteOutputOnInterrupt = True; - compressStream ( inStr, outStr ); - outputHandleJustInCase = NULL; - - /*--- If there was an I/O error, we won't get here. ---*/ - if ( srcMode == SM_F2F ) { - applySavedTimeInfoToOutputFile ( outName ); - deleteOutputOnInterrupt = False; - if ( !keepInputFiles ) { - IntNative retVal = remove ( inName ); - ERROR_IF_NOT_ZERO ( retVal ); - } - } - - deleteOutputOnInterrupt = False; -} - - -/*---------------------------------------------*/ -static -void uncompress ( Char *name ) -{ - FILE *inStr; - FILE *outStr; - Int32 n, i; - Bool magicNumberOK; - Bool cantGuess; - struct MY_STAT statBuf; - - deleteOutputOnInterrupt = False; - - if (name == NULL && srcMode != SM_I2O) - panic ( "uncompress: bad modes\n" ); - - cantGuess = False; - switch (srcMode) { - case SM_I2O: - copyFileName ( inName, (Char*)"(stdin)" ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - case SM_F2F: - copyFileName ( inName, name ); - copyFileName ( outName, name ); - for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) - if (mapSuffix(outName,zSuffix[i],unzSuffix[i])) - goto zzz; - cantGuess = True; - strcat ( outName, ".out" ); - break; - case SM_F2O: - copyFileName ( inName, name ); - copyFileName ( outName, (Char*)"(stdout)" ); - break; - } - - zzz: - if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { - if (noisy) - fprintf ( stderr, "%s: There are no files matching `%s'.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode != SM_I2O && !fileExists ( inName ) ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - } - if ( srcMode == SM_F2F || srcMode == SM_F2O ) { - MY_STAT(inName, &statBuf); - if ( MY_S_ISDIR(statBuf.st_mode) ) { - fprintf( stderr, - "%s: Input file %s is a directory.\n", - progName,inName); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) { - if (noisy) - fprintf ( stderr, "%s: Input file %s is not a normal file.\n", - progName, inName ); - setExit(1); - return; - } - if ( /* srcMode == SM_F2F implied && */ cantGuess ) { - if (noisy) - fprintf ( stderr, - "%s: Can't guess original name for %s -- using %s\n", - progName, inName, outName ); - /* just a warning, no return */ - } - if ( srcMode == SM_F2F && fileExists ( outName ) ) { - if (forceOverwrite) { - remove(outName); - } else { - fprintf ( stderr, "%s: Output file %s already exists.\n", - progName, outName ); - setExit(1); - return; - } - } - if ( srcMode == SM_F2F && !forceOverwrite && - (n=countHardLinks ( inName ) ) > 0) { - fprintf ( stderr, "%s: Input file %s has %d other link%s.\n", - progName, inName, n, n > 1 ? "s" : "" ); - setExit(1); - return; - } - - if ( srcMode == SM_F2F ) { - /* Save the file's meta-info before we open it. Doing it later - means we mess up the access times. */ - saveInputFileMetaInfo ( inName ); - } - - switch ( srcMode ) { - - case SM_I2O: - inStr = stdin; - outStr = stdout; - if ( isatty ( fileno ( stdin ) ) ) { - fprintf ( stderr, - "%s: I won't read compressed data from a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - setExit(1); - return; - }; - break; - - case SM_F2O: - inStr = fopen ( inName, "rb" ); - outStr = stdout; - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s:%s.\n", - progName, inName, strerror(errno) ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - }; - break; - - case SM_F2F: - inStr = fopen ( inName, "rb" ); - outStr = fopen_output_safely ( outName, "wb" ); - if ( outStr == NULL) { - fprintf ( stderr, "%s: Can't create output file %s: %s.\n", - progName, outName, strerror(errno) ); - if ( inStr != NULL ) fclose ( inStr ); - setExit(1); - return; - } - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s: %s.\n", - progName, inName, strerror(errno) ); - if ( outStr != NULL ) fclose ( outStr ); - setExit(1); - return; - }; - break; - - default: - panic ( "uncompress: bad srcMode" ); - break; - } - - if (verbosity >= 1) { - fprintf ( stderr, " %s: ", inName ); - pad ( inName ); - fflush ( stderr ); - } - - /*--- Now the input and output handles are sane. Do the Biz. ---*/ - outputHandleJustInCase = outStr; - deleteOutputOnInterrupt = True; - magicNumberOK = uncompressStream ( inStr, outStr ); - outputHandleJustInCase = NULL; - - /*--- If there was an I/O error, we won't get here. ---*/ - if ( magicNumberOK ) { - if ( srcMode == SM_F2F ) { - applySavedTimeInfoToOutputFile ( outName ); - deleteOutputOnInterrupt = False; - if ( !keepInputFiles ) { - IntNative retVal = remove ( inName ); - ERROR_IF_NOT_ZERO ( retVal ); - } - } - } else { - unzFailsExist = True; - deleteOutputOnInterrupt = False; - if ( srcMode == SM_F2F ) { - IntNative retVal = remove ( outName ); - ERROR_IF_NOT_ZERO ( retVal ); - } - } - deleteOutputOnInterrupt = False; - - if ( magicNumberOK ) { - if (verbosity >= 1) - fprintf ( stderr, "done\n" ); - } else { - setExit(2); - if (verbosity >= 1) - fprintf ( stderr, "not a bzip2 file.\n" ); else - fprintf ( stderr, - "%s: %s is not a bzip2 file.\n", - progName, inName ); - } - -} - - -/*---------------------------------------------*/ -static -void testf ( Char *name ) -{ - FILE *inStr; - Bool allOK; - struct MY_STAT statBuf; - - deleteOutputOnInterrupt = False; - - if (name == NULL && srcMode != SM_I2O) - panic ( "testf: bad modes\n" ); - - copyFileName ( outName, (Char*)"(none)" ); - switch (srcMode) { - case SM_I2O: copyFileName ( inName, (Char*)"(stdin)" ); break; - case SM_F2F: copyFileName ( inName, name ); break; - case SM_F2O: copyFileName ( inName, name ); break; - } - - if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { - if (noisy) - fprintf ( stderr, "%s: There are no files matching `%s'.\n", - progName, inName ); - setExit(1); - return; - } - if ( srcMode != SM_I2O && !fileExists ( inName ) ) { - fprintf ( stderr, "%s: Can't open input %s: %s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - } - if ( srcMode != SM_I2O ) { - MY_STAT(inName, &statBuf); - if ( MY_S_ISDIR(statBuf.st_mode) ) { - fprintf( stderr, - "%s: Input file %s is a directory.\n", - progName,inName); - setExit(1); - return; - } - } - - switch ( srcMode ) { - - case SM_I2O: - if ( isatty ( fileno ( stdin ) ) ) { - fprintf ( stderr, - "%s: I won't read compressed data from a terminal.\n", - progName ); - fprintf ( stderr, "%s: For help, type: `%s --help'.\n", - progName, progName ); - setExit(1); - return; - }; - inStr = stdin; - break; - - case SM_F2O: case SM_F2F: - inStr = fopen ( inName, "rb" ); - if ( inStr == NULL ) { - fprintf ( stderr, "%s: Can't open input file %s:%s.\n", - progName, inName, strerror(errno) ); - setExit(1); - return; - }; - break; - - default: - panic ( "testf: bad srcMode" ); - break; - } - - if (verbosity >= 1) { - fprintf ( stderr, " %s: ", inName ); - pad ( inName ); - fflush ( stderr ); - } - - /*--- Now the input handle is sane. Do the Biz. ---*/ - outputHandleJustInCase = NULL; - allOK = testStream ( inStr ); - - if (allOK && verbosity >= 1) fprintf ( stderr, "ok\n" ); - if (!allOK) testFailsExist = True; -} - - -/*---------------------------------------------*/ -static -void license ( void ) -{ - fprintf ( stderr, - - "bzip2, a block-sorting file compressor. " - "Version %s.\n" - " \n" - " Copyright (C) 1996-2010 by Julian Seward.\n" - " \n" - " This program is free software; you can redistribute it and/or modify\n" - " it under the terms set out in the LICENSE file, which is included\n" - " in the bzip2-1.0.6 source distribution.\n" - " \n" - " This program is distributed in the hope that it will be useful,\n" - " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - " LICENSE file for more details.\n" - " \n", - BZ2_bzlibVersion() - ); -} - - -/*---------------------------------------------*/ -static -void usage ( Char *fullProgName ) -{ - fprintf ( - stderr, - "bzip2, a block-sorting file compressor. " - "Version %s.\n" - "\n usage: %s [flags and input files in any order]\n" - "\n" - " -h --help print this message\n" - " -d --decompress force decompression\n" - " -z --compress force compression\n" - " -k --keep keep (don't delete) input files\n" - " -f --force overwrite existing output files\n" - " -t --test test compressed file integrity\n" - " -c --stdout output to standard out\n" - " -q --quiet suppress noncritical error messages\n" - " -v --verbose be verbose (a 2nd -v gives more)\n" - " -L --license display software version & license\n" - " -V --version display software version & license\n" - " -s --small use less memory (at most 2500k)\n" - " -1 .. -9 set block size to 100k .. 900k\n" - " --fast alias for -1\n" - " --best alias for -9\n" - "\n" - " If invoked as `bzip2', default action is to compress.\n" - " as `bunzip2', default action is to decompress.\n" - " as `bzcat', default action is to decompress to stdout.\n" - "\n" - " If no file names are given, bzip2 compresses or decompresses\n" - " from standard input to standard output. You can combine\n" - " short flags, so `-v -4' means the same as -v4 or -4v, &c.\n" -# if BZ_UNIX - "\n" -# endif - , - - BZ2_bzlibVersion(), - fullProgName - ); -} - - -/*---------------------------------------------*/ -static -void redundant ( Char* flag ) -{ - fprintf ( - stderr, - "%s: %s is redundant in versions 0.9.5 and above\n", - progName, flag ); -} - - -/*---------------------------------------------*/ -/*-- - All the garbage from here to main() is purely to - implement a linked list of command-line arguments, - into which main() copies argv[1 .. argc-1]. - - The purpose of this exercise is to facilitate - the expansion of wildcard characters * and ? in - filenames for OSs which don't know how to do it - themselves, like MSDOS, Windows 95 and NT. - - The actual Dirty Work is done by the platform- - specific macro APPEND_FILESPEC. ---*/ - -typedef - struct zzzz { - Char *name; - struct zzzz *link; - } - Cell; - - -/*---------------------------------------------*/ -static -void *myMalloc ( Int32 n ) -{ - void* p; - - p = malloc ( (size_t)n ); - if (p == NULL) outOfMemory (); - return p; -} - - -/*---------------------------------------------*/ -static -Cell *mkCell ( void ) -{ - Cell *c; - - c = (Cell*) myMalloc ( sizeof ( Cell ) ); - c->name = NULL; - c->link = NULL; - return c; -} - - -/*---------------------------------------------*/ -static -Cell *snocString ( Cell *root, Char *name ) -{ - if (root == NULL) { - Cell *tmp = mkCell(); - tmp->name = (Char*) myMalloc ( 5 + strlen(name) ); - strcpy ( tmp->name, name ); - return tmp; - } else { - Cell *tmp = root; - while (tmp->link != NULL) tmp = tmp->link; - tmp->link = snocString ( tmp->link, name ); - return root; - } -} - - -/*---------------------------------------------*/ -static -void addFlagsFromEnvVar ( Cell** argList, Char* varName ) -{ - Int32 i, j, k; - Char *envbase, *p; - - envbase = getenv(varName); - if (envbase != NULL) { - p = envbase; - i = 0; - while (True) { - if (p[i] == 0) break; - p += i; - i = 0; - while (isspace((Int32)(p[0]))) p++; - while (p[i] != 0 && !isspace((Int32)(p[i]))) i++; - if (i > 0) { - k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10; - for (j = 0; j < k; j++) tmpName[j] = p[j]; - tmpName[k] = 0; - APPEND_FLAG(*argList, tmpName); - } - } - } -} - - -/*---------------------------------------------*/ -#define ISFLAG(s) (strcmp(aa->name, (s))==0) - -IntNative main ( IntNative argc, Char *argv[] ) -{ - Int32 i, j; - Char *tmp; - Cell *argList; - Cell *aa; - Bool decode; - - /*-- Be really really really paranoid :-) --*/ - if (sizeof(Int32) != 4 || sizeof(UInt32) != 4 || - sizeof(Int16) != 2 || sizeof(UInt16) != 2 || - sizeof(Char) != 1 || sizeof(UChar) != 1) - configError(); - - /*-- Initialise --*/ - outputHandleJustInCase = NULL; - smallMode = False; - keepInputFiles = False; - forceOverwrite = False; - noisy = True; - verbosity = 0; - blockSize100k = 9; - testFailsExist = False; - unzFailsExist = False; - numFileNames = 0; - numFilesProcessed = 0; - workFactor = 30; - deleteOutputOnInterrupt = False; - exitValue = 0; - i = j = 0; /* avoid bogus warning from egcs-1.1.X */ - - /*-- Set up signal handlers for mem access errors --*/ - signal (SIGSEGV, mySIGSEGVorSIGBUScatcher); - - copyFileName ( inName, (Char*)"(none)" ); - copyFileName ( outName, (Char*)"(none)" ); - - copyFileName ( progNameReally, argv[0] ); - progName = &progNameReally[0]; - for (tmp = &progNameReally[0]; *tmp != '\0'; tmp++) - if (*tmp == PATH_SEP) progName = tmp + 1; - - - /*-- Copy flags from env var BZIP2, and - expand filename wildcards in arg list. - --*/ - argList = NULL; - addFlagsFromEnvVar ( &argList, (Char*)"BZIP2" ); - addFlagsFromEnvVar ( &argList, (Char*)"BZIP" ); - for (i = 1; i <= argc-1; i++) - APPEND_FILESPEC(argList, argv[i]); - - - /*-- Find the length of the longest filename --*/ - longestFileName = 7; - numFileNames = 0; - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFileNames++; - if (longestFileName < (Int32)strlen(aa->name) ) - longestFileName = (Int32)strlen(aa->name); - } - - - /*-- Determine source modes; flag handling may change this too. --*/ - if (numFileNames == 0) - srcMode = SM_I2O; else srcMode = SM_F2F; - - - /*-- Determine what to do (compress/uncompress/test/cat). --*/ - /*-- Note that subsequent flag handling may change this. --*/ - opMode = OM_Z; - - if ( (strstr ( progName, "unzip" ) != 0) || - (strstr ( progName, "UNZIP" ) != 0) ) - opMode = OM_UNZ; - - if ( (strstr ( progName, "z2cat" ) != 0) || - (strstr ( progName, "Z2CAT" ) != 0) || - (strstr ( progName, "zcat" ) != 0) || - (strstr ( progName, "ZCAT" ) != 0) ) { - opMode = OM_UNZ; - srcMode = (numFileNames == 0) ? SM_I2O : SM_F2O; - } - - - /*-- Look at the flags. --*/ - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) break; - if (aa->name[0] == '-' && aa->name[1] != '-') { - for (j = 1; aa->name[j] != '\0'; j++) { - switch (aa->name[j]) { - case 'c': srcMode = SM_F2O; break; - case 'd': opMode = OM_UNZ; break; - case 'z': opMode = OM_Z; break; - case 'f': forceOverwrite = True; break; - case 't': opMode = OM_TEST; break; - case 'k': keepInputFiles = True; break; - case 's': smallMode = True; break; - case 'q': noisy = False; break; - case '1': blockSize100k = 1; break; - case '2': blockSize100k = 2; break; - case '3': blockSize100k = 3; break; - case '4': blockSize100k = 4; break; - case '5': blockSize100k = 5; break; - case '6': blockSize100k = 6; break; - case '7': blockSize100k = 7; break; - case '8': blockSize100k = 8; break; - case '9': blockSize100k = 9; break; - case 'V': - case 'L': license(); break; - case 'v': verbosity++; break; - case 'h': usage ( progName ); - exit ( 0 ); - break; - default: fprintf ( stderr, "%s: Bad flag `%s'\n", - progName, aa->name ); - usage ( progName ); - exit ( 1 ); - break; - } - } - } - } - - /*-- And again ... --*/ - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) break; - if (ISFLAG("--stdout")) srcMode = SM_F2O; else - if (ISFLAG("--decompress")) opMode = OM_UNZ; else - if (ISFLAG("--compress")) opMode = OM_Z; else - if (ISFLAG("--force")) forceOverwrite = True; else - if (ISFLAG("--test")) opMode = OM_TEST; else - if (ISFLAG("--keep")) keepInputFiles = True; else - if (ISFLAG("--small")) smallMode = True; else - if (ISFLAG("--quiet")) noisy = False; else - if (ISFLAG("--version")) license(); else - if (ISFLAG("--license")) license(); else - if (ISFLAG("--exponential")) workFactor = 1; else - if (ISFLAG("--repetitive-best")) redundant(aa->name); else - if (ISFLAG("--repetitive-fast")) redundant(aa->name); else - if (ISFLAG("--fast")) blockSize100k = 1; else - if (ISFLAG("--best")) blockSize100k = 9; else - if (ISFLAG("--verbose")) verbosity++; else - if (ISFLAG("--help")) { usage ( progName ); exit ( 0 ); } - else - if (strncmp ( aa->name, "--", 2) == 0) { - fprintf ( stderr, "%s: Bad flag `%s'\n", progName, aa->name ); - usage ( progName ); - exit ( 1 ); - } - } - - if (verbosity > 4) verbosity = 4; - if (opMode == OM_Z && smallMode && blockSize100k > 2) - blockSize100k = 2; - - if (opMode == OM_TEST && srcMode == SM_F2O) { - fprintf ( stderr, "%s: -c and -t cannot be used together.\n", - progName ); - exit ( 1 ); - } - - if (srcMode == SM_F2O && numFileNames == 0) - srcMode = SM_I2O; - - if (opMode != OM_Z) blockSize100k = 0; - - if (srcMode == SM_F2F) { - signal (SIGINT, mySignalCatcher); - signal (SIGTERM, mySignalCatcher); - } - - if (opMode == OM_Z) { - if (srcMode == SM_I2O) { - compress ( NULL ); - } else { - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFilesProcessed++; - compress ( aa->name ); - } - } - } - else - - if (opMode == OM_UNZ) { - unzFailsExist = False; - if (srcMode == SM_I2O) { - uncompress ( NULL ); - } else { - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFilesProcessed++; - uncompress ( aa->name ); - } - } - if (unzFailsExist) { - setExit(2); - exit(exitValue); - } - } - - else { - testFailsExist = False; - if (srcMode == SM_I2O) { - testf ( NULL ); - } else { - decode = True; - for (aa = argList; aa != NULL; aa = aa->link) { - if (ISFLAG("--")) { decode = False; continue; } - if (aa->name[0] == '-' && decode) continue; - numFilesProcessed++; - testf ( aa->name ); - } - } - if (testFailsExist && noisy) { - fprintf ( stderr, - "\n" - "You can use the `bzip2recover' program to attempt to recover\n" - "data from undamaged sections of corrupted files.\n\n" - ); - setExit(2); - exit(exitValue); - } - } - - /* Free the argument list memory to mollify leak detectors - (eg) Purify, Checker. Serves no other useful purpose. - */ - aa = argList; - while (aa != NULL) { - Cell* aa2 = aa->link; - if (aa->name != NULL) free(aa->name); - free(aa); - aa = aa2; - } - - return exitValue; -} - - -/*-----------------------------------------------------------*/ -/*--- end bzip2.c ---*/ -/*-----------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/bzip2rec.c b/src/lib/dl/ext/bzip2/bzip2rec.c deleted file mode 100755 index f9de0496..00000000 --- a/src/lib/dl/ext/bzip2/bzip2rec.c +++ /dev/null @@ -1,514 +0,0 @@ -/*-----------------------------------------------------------*/ -/*--- Block recoverer program for bzip2 ---*/ -/*--- bzip2recover.c ---*/ -/*-----------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - -/* This program is a complete hack and should be rewritten properly. - It isn't very complicated. */ - -#include -#include -#include -#include - - -/* This program records bit locations in the file to be recovered. - That means that if 64-bit ints are not supported, we will not - be able to recover .bz2 files over 512MB (2^32 bits) long. - On GNU supported platforms, we take advantage of the 64-bit - int support to circumvent this problem. Ditto MSVC. - - This change occurred in version 1.0.2; all prior versions have - the 512MB limitation. -*/ -#ifdef __GNUC__ - typedef unsigned long long int MaybeUInt64; -# define MaybeUInt64_FMT "%Lu" -#else -#ifdef _MSC_VER - typedef unsigned __int64 MaybeUInt64; -# define MaybeUInt64_FMT "%I64u" -#else - typedef unsigned int MaybeUInt64; -# define MaybeUInt64_FMT "%u" -#endif -#endif - -typedef unsigned int UInt32; -typedef int Int32; -typedef unsigned char UChar; -typedef char Char; -typedef unsigned char Bool; -#define True ((Bool)1) -#define False ((Bool)0) - - -#define BZ_MAX_FILENAME 2000 - -Char inFileName[BZ_MAX_FILENAME]; -Char outFileName[BZ_MAX_FILENAME]; -Char progName[BZ_MAX_FILENAME]; - -MaybeUInt64 bytesOut = 0; -MaybeUInt64 bytesIn = 0; - - -/*---------------------------------------------------*/ -/*--- Header bytes ---*/ -/*---------------------------------------------------*/ - -#define BZ_HDR_B 0x42 /* 'B' */ -#define BZ_HDR_Z 0x5a /* 'Z' */ -#define BZ_HDR_h 0x68 /* 'h' */ -#define BZ_HDR_0 0x30 /* '0' */ - - -/*---------------------------------------------------*/ -/*--- I/O errors ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------*/ -static void readError ( void ) -{ - fprintf ( stderr, - "%s: I/O error reading `%s', possible reason follows.\n", - progName, inFileName ); - perror ( progName ); - fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", - progName ); - exit ( 1 ); -} - - -/*---------------------------------------------*/ -static void writeError ( void ) -{ - fprintf ( stderr, - "%s: I/O error reading `%s', possible reason follows.\n", - progName, inFileName ); - perror ( progName ); - fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", - progName ); - exit ( 1 ); -} - - -/*---------------------------------------------*/ -static void mallocFail ( Int32 n ) -{ - fprintf ( stderr, - "%s: malloc failed on request for %d bytes.\n", - progName, n ); - fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", - progName ); - exit ( 1 ); -} - - -/*---------------------------------------------*/ -static void tooManyBlocks ( Int32 max_handled_blocks ) -{ - fprintf ( stderr, - "%s: `%s' appears to contain more than %d blocks\n", - progName, inFileName, max_handled_blocks ); - fprintf ( stderr, - "%s: and cannot be handled. To fix, increase\n", - progName ); - fprintf ( stderr, - "%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n", - progName ); - exit ( 1 ); -} - - - -/*---------------------------------------------------*/ -/*--- Bit stream I/O ---*/ -/*---------------------------------------------------*/ - -typedef - struct { - FILE* handle; - Int32 buffer; - Int32 buffLive; - Char mode; - } - BitStream; - - -/*---------------------------------------------*/ -static BitStream* bsOpenReadStream ( FILE* stream ) -{ - BitStream *bs = malloc ( sizeof(BitStream) ); - if (bs == NULL) mallocFail ( sizeof(BitStream) ); - bs->handle = stream; - bs->buffer = 0; - bs->buffLive = 0; - bs->mode = 'r'; - return bs; -} - - -/*---------------------------------------------*/ -static BitStream* bsOpenWriteStream ( FILE* stream ) -{ - BitStream *bs = malloc ( sizeof(BitStream) ); - if (bs == NULL) mallocFail ( sizeof(BitStream) ); - bs->handle = stream; - bs->buffer = 0; - bs->buffLive = 0; - bs->mode = 'w'; - return bs; -} - - -/*---------------------------------------------*/ -static void bsPutBit ( BitStream* bs, Int32 bit ) -{ - if (bs->buffLive == 8) { - Int32 retVal = putc ( (UChar) bs->buffer, bs->handle ); - if (retVal == EOF) writeError(); - bytesOut++; - bs->buffLive = 1; - bs->buffer = bit & 0x1; - } else { - bs->buffer = ( (bs->buffer << 1) | (bit & 0x1) ); - bs->buffLive++; - }; -} - - -/*---------------------------------------------*/ -/*-- - Returns 0 or 1, or 2 to indicate EOF. ---*/ -static Int32 bsGetBit ( BitStream* bs ) -{ - if (bs->buffLive > 0) { - bs->buffLive --; - return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 ); - } else { - Int32 retVal = getc ( bs->handle ); - if ( retVal == EOF ) { - if (errno != 0) readError(); - return 2; - } - bs->buffLive = 7; - bs->buffer = retVal; - return ( ((bs->buffer) >> 7) & 0x1 ); - } -} - - -/*---------------------------------------------*/ -static void bsClose ( BitStream* bs ) -{ - Int32 retVal; - - if ( bs->mode == 'w' ) { - while ( bs->buffLive < 8 ) { - bs->buffLive++; - bs->buffer <<= 1; - }; - retVal = putc ( (UChar) (bs->buffer), bs->handle ); - if (retVal == EOF) writeError(); - bytesOut++; - retVal = fflush ( bs->handle ); - if (retVal == EOF) writeError(); - } - retVal = fclose ( bs->handle ); - if (retVal == EOF) { - if (bs->mode == 'w') writeError(); else readError(); - } - free ( bs ); -} - - -/*---------------------------------------------*/ -static void bsPutUChar ( BitStream* bs, UChar c ) -{ - Int32 i; - for (i = 7; i >= 0; i--) - bsPutBit ( bs, (((UInt32) c) >> i) & 0x1 ); -} - - -/*---------------------------------------------*/ -static void bsPutUInt32 ( BitStream* bs, UInt32 c ) -{ - Int32 i; - - for (i = 31; i >= 0; i--) - bsPutBit ( bs, (c >> i) & 0x1 ); -} - - -/*---------------------------------------------*/ -static Bool endsInBz2 ( Char* name ) -{ - Int32 n = strlen ( name ); - if (n <= 4) return False; - return - (name[n-4] == '.' && - name[n-3] == 'b' && - name[n-2] == 'z' && - name[n-1] == '2'); -} - - -/*---------------------------------------------------*/ -/*--- ---*/ -/*---------------------------------------------------*/ - -/* This logic isn't really right when it comes to Cygwin. */ -#ifdef _WIN32 -# define BZ_SPLIT_SYM '\\' /* path splitter on Windows platform */ -#else -# define BZ_SPLIT_SYM '/' /* path splitter on Unix platform */ -#endif - -#define BLOCK_HEADER_HI 0x00003141UL -#define BLOCK_HEADER_LO 0x59265359UL - -#define BLOCK_ENDMARK_HI 0x00001772UL -#define BLOCK_ENDMARK_LO 0x45385090UL - -/* Increase if necessary. However, a .bz2 file with > 50000 blocks - would have an uncompressed size of at least 40GB, so the chances - are low you'll need to up this. -*/ -#define BZ_MAX_HANDLED_BLOCKS 50000 - -MaybeUInt64 bStart [BZ_MAX_HANDLED_BLOCKS]; -MaybeUInt64 bEnd [BZ_MAX_HANDLED_BLOCKS]; -MaybeUInt64 rbStart[BZ_MAX_HANDLED_BLOCKS]; -MaybeUInt64 rbEnd [BZ_MAX_HANDLED_BLOCKS]; - -Int32 main ( Int32 argc, Char** argv ) -{ - FILE* inFile; - FILE* outFile; - BitStream* bsIn, *bsWr; - Int32 b, wrBlock, currBlock, rbCtr; - MaybeUInt64 bitsRead; - - UInt32 buffHi, buffLo, blockCRC; - Char* p; - - strcpy ( progName, argv[0] ); - inFileName[0] = outFileName[0] = 0; - - fprintf ( stderr, - "bzip2recover 1.0.6: extracts blocks from damaged .bz2 files.\n" ); - - if (argc != 2) { - fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", - progName, progName ); - switch (sizeof(MaybeUInt64)) { - case 8: - fprintf(stderr, - "\trestrictions on size of recovered file: None\n"); - break; - case 4: - fprintf(stderr, - "\trestrictions on size of recovered file: 512 MB\n"); - fprintf(stderr, - "\tto circumvent, recompile with MaybeUInt64 as an\n" - "\tunsigned 64-bit int.\n"); - break; - default: - fprintf(stderr, - "\tsizeof(MaybeUInt64) is not 4 or 8 -- " - "configuration error.\n"); - break; - } - exit(1); - } - - if (strlen(argv[1]) >= BZ_MAX_FILENAME-20) { - fprintf ( stderr, - "%s: supplied filename is suspiciously (>= %d chars) long. Bye!\n", - progName, (int)strlen(argv[1]) ); - exit(1); - } - - strcpy ( inFileName, argv[1] ); - - inFile = fopen ( inFileName, "rb" ); - if (inFile == NULL) { - fprintf ( stderr, "%s: can't read `%s'\n", progName, inFileName ); - exit(1); - } - - bsIn = bsOpenReadStream ( inFile ); - fprintf ( stderr, "%s: searching for block boundaries ...\n", progName ); - - bitsRead = 0; - buffHi = buffLo = 0; - currBlock = 0; - bStart[currBlock] = 0; - - rbCtr = 0; - - while (True) { - b = bsGetBit ( bsIn ); - bitsRead++; - if (b == 2) { - if (bitsRead >= bStart[currBlock] && - (bitsRead - bStart[currBlock]) >= 40) { - bEnd[currBlock] = bitsRead-1; - if (currBlock > 0) - fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT - " to " MaybeUInt64_FMT " (incomplete)\n", - currBlock, bStart[currBlock], bEnd[currBlock] ); - } else - currBlock--; - break; - } - buffHi = (buffHi << 1) | (buffLo >> 31); - buffLo = (buffLo << 1) | (b & 1); - if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI - && buffLo == BLOCK_HEADER_LO) - || - ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI - && buffLo == BLOCK_ENDMARK_LO) - ) { - if (bitsRead > 49) { - bEnd[currBlock] = bitsRead-49; - } else { - bEnd[currBlock] = 0; - } - if (currBlock > 0 && - (bEnd[currBlock] - bStart[currBlock]) >= 130) { - fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT - " to " MaybeUInt64_FMT "\n", - rbCtr+1, bStart[currBlock], bEnd[currBlock] ); - rbStart[rbCtr] = bStart[currBlock]; - rbEnd[rbCtr] = bEnd[currBlock]; - rbCtr++; - } - if (currBlock >= BZ_MAX_HANDLED_BLOCKS) - tooManyBlocks(BZ_MAX_HANDLED_BLOCKS); - currBlock++; - - bStart[currBlock] = bitsRead; - } - } - - bsClose ( bsIn ); - - /*-- identified blocks run from 1 to rbCtr inclusive. --*/ - - if (rbCtr < 1) { - fprintf ( stderr, - "%s: sorry, I couldn't find any block boundaries.\n", - progName ); - exit(1); - }; - - fprintf ( stderr, "%s: splitting into blocks\n", progName ); - - inFile = fopen ( inFileName, "rb" ); - if (inFile == NULL) { - fprintf ( stderr, "%s: can't open `%s'\n", progName, inFileName ); - exit(1); - } - bsIn = bsOpenReadStream ( inFile ); - - /*-- placate gcc's dataflow analyser --*/ - blockCRC = 0; bsWr = 0; - - bitsRead = 0; - outFile = NULL; - wrBlock = 0; - while (True) { - b = bsGetBit(bsIn); - if (b == 2) break; - buffHi = (buffHi << 1) | (buffLo >> 31); - buffLo = (buffLo << 1) | (b & 1); - if (bitsRead == 47+rbStart[wrBlock]) - blockCRC = (buffHi << 16) | (buffLo >> 16); - - if (outFile != NULL && bitsRead >= rbStart[wrBlock] - && bitsRead <= rbEnd[wrBlock]) { - bsPutBit ( bsWr, b ); - } - - bitsRead++; - - if (bitsRead == rbEnd[wrBlock]+1) { - if (outFile != NULL) { - bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 ); - bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 ); - bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); - bsPutUInt32 ( bsWr, blockCRC ); - bsClose ( bsWr ); - } - if (wrBlock >= rbCtr) break; - wrBlock++; - } else - if (bitsRead == rbStart[wrBlock]) { - /* Create the output file name, correctly handling leading paths. - (31.10.2001 by Sergey E. Kusikov) */ - Char* split; - Int32 ofs, k; - for (k = 0; k < BZ_MAX_FILENAME; k++) - outFileName[k] = 0; - strcpy (outFileName, inFileName); - split = strrchr (outFileName, BZ_SPLIT_SYM); - if (split == NULL) { - split = outFileName; - } else { - ++split; - } - /* Now split points to the start of the basename. */ - ofs = split - outFileName; - sprintf (split, "rec%5d", wrBlock+1); - for (p = split; *p != 0; p++) if (*p == ' ') *p = '0'; - strcat (outFileName, inFileName + ofs); - - if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" ); - - fprintf ( stderr, " writing block %d to `%s' ...\n", - wrBlock+1, outFileName ); - - outFile = fopen ( outFileName, "wb" ); - if (outFile == NULL) { - fprintf ( stderr, "%s: can't write `%s'\n", - progName, outFileName ); - exit(1); - } - bsWr = bsOpenWriteStream ( outFile ); - bsPutUChar ( bsWr, BZ_HDR_B ); - bsPutUChar ( bsWr, BZ_HDR_Z ); - bsPutUChar ( bsWr, BZ_HDR_h ); - bsPutUChar ( bsWr, BZ_HDR_0 + 9 ); - bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 ); - bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 ); - bsPutUChar ( bsWr, 0x53 ); bsPutUChar ( bsWr, 0x59 ); - } - } - - fprintf ( stderr, "%s: finished\n", progName ); - return 0; -} - - - -/*-----------------------------------------------------------*/ -/*--- end bzip2recover.c ---*/ -/*-----------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/bzlib.c b/src/lib/dl/ext/bzip2/bzlib.c deleted file mode 100755 index ef6dcd20..00000000 --- a/src/lib/dl/ext/bzip2/bzlib.c +++ /dev/null @@ -1,1572 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Library top-level functions. ---*/ -/*--- bzlib.c ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - -/* CHANGES - 0.9.0 -- original version. - 0.9.0a/b -- no changes in this file. - 0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress(). - fixed bzWrite/bzRead to ignore zero-length requests. - fixed bzread to correctly handle read requests after EOF. - wrong parameter order in call to bzDecompressInit in - bzBuffToBuffDecompress. Fixed. -*/ - -#include "bzlibprv.h" - - -/*---------------------------------------------------*/ -/*--- Compression stuff ---*/ -/*---------------------------------------------------*/ - - -/*---------------------------------------------------*/ -#ifndef BZ_NO_STDIO -void BZ2_bz__AssertH__fail ( int errcode ) -{ - fprintf(stderr, - "\n\nbzip2/libbzip2: internal error number %d.\n" - "This is a bug in bzip2/libbzip2, %s.\n" - "Please report it to me at: jseward@bzip.org. If this happened\n" - "when you were using some program which uses libbzip2 as a\n" - "component, you should also report this bug to the author(s)\n" - "of that program. Please make an effort to report this bug;\n" - "timely and accurate bug reports eventually lead to higher\n" - "quality software. Thanks. Julian Seward, 10 December 2007.\n\n", - errcode, - BZ2_bzlibVersion() - ); - - if (errcode == 1007) { - fprintf(stderr, - "\n*** A special note about internal error number 1007 ***\n" - "\n" - "Experience suggests that a common cause of i.e. 1007\n" - "is unreliable memory or other hardware. The 1007 assertion\n" - "just happens to cross-check the results of huge numbers of\n" - "memory reads/writes, and so acts (unintendedly) as a stress\n" - "test of your memory system.\n" - "\n" - "I suggest the following: try compressing the file again,\n" - "possibly monitoring progress in detail with the -vv flag.\n" - "\n" - "* If the error cannot be reproduced, and/or happens at different\n" - " points in compression, you may have a flaky memory system.\n" - " Try a memory-test program. I have used Memtest86\n" - " (www.memtest86.com). At the time of writing it is free (GPLd).\n" - " Memtest86 tests memory much more thorougly than your BIOSs\n" - " power-on test, and may find failures that the BIOS doesn't.\n" - "\n" - "* If the error can be repeatably reproduced, this is a bug in\n" - " bzip2, and I would very much like to hear about it. Please\n" - " let me know, and, ideally, save a copy of the file causing the\n" - " problem -- without which I will be unable to investigate it.\n" - "\n" - ); - } - - exit(3); -} -#endif - - -/*---------------------------------------------------*/ -static -int bz_config_ok ( void ) -{ - if (sizeof(int) != 4) return 0; - if (sizeof(short) != 2) return 0; - if (sizeof(char) != 1) return 0; - return 1; -} - - -/*---------------------------------------------------*/ -static -void* default_bzalloc ( void* opaque, Int32 items, Int32 size ) -{ - void* v = malloc ( items * size ); - return v; -} - -static -void default_bzfree ( void* opaque, void* addr ) -{ - if (addr != NULL) free ( addr ); -} - - -/*---------------------------------------------------*/ -static -void prepare_new_block ( EState* s ) -{ - Int32 i; - s->nblock = 0; - s->numZ = 0; - s->state_out_pos = 0; - BZ_INITIALISE_CRC ( s->blockCRC ); - for (i = 0; i < 256; i++) s->inUse[i] = False; - s->blockNo++; -} - - -/*---------------------------------------------------*/ -static -void init_RL ( EState* s ) -{ - s->state_in_ch = 256; - s->state_in_len = 0; -} - - -static -Bool isempty_RL ( EState* s ) -{ - if (s->state_in_ch < 256 && s->state_in_len > 0) - return False; else - return True; -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompressInit) - ( bz_stream* strm, - int blockSize100k, - int verbosity, - int workFactor ) -{ - Int32 n; - EState* s; - - if (!bz_config_ok()) return BZ_CONFIG_ERROR; - - if (strm == NULL || - blockSize100k < 1 || blockSize100k > 9 || - workFactor < 0 || workFactor > 250) - return BZ_PARAM_ERROR; - - if (workFactor == 0) workFactor = 30; - if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; - if (strm->bzfree == NULL) strm->bzfree = default_bzfree; - - s = BZALLOC( sizeof(EState) ); - if (s == NULL) return BZ_MEM_ERROR; - s->strm = strm; - - s->arr1 = NULL; - s->arr2 = NULL; - s->ftab = NULL; - - n = 100000 * blockSize100k; - s->arr1 = BZALLOC( n * sizeof(UInt32) ); - s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) ); - s->ftab = BZALLOC( 65537 * sizeof(UInt32) ); - - if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) { - if (s->arr1 != NULL) BZFREE(s->arr1); - if (s->arr2 != NULL) BZFREE(s->arr2); - if (s->ftab != NULL) BZFREE(s->ftab); - if (s != NULL) BZFREE(s); - return BZ_MEM_ERROR; - } - - s->blockNo = 0; - s->state = BZ_S_INPUT; - s->mode = BZ_M_RUNNING; - s->combinedCRC = 0; - s->blockSize100k = blockSize100k; - s->nblockMAX = 100000 * blockSize100k - 19; - s->verbosity = verbosity; - s->workFactor = workFactor; - - s->block = (UChar*)s->arr2; - s->mtfv = (UInt16*)s->arr1; - s->zbits = NULL; - s->ptr = (UInt32*)s->arr1; - - strm->state = s; - strm->total_in_lo32 = 0; - strm->total_in_hi32 = 0; - strm->total_out_lo32 = 0; - strm->total_out_hi32 = 0; - init_RL ( s ); - prepare_new_block ( s ); - return BZ_OK; -} - - -/*---------------------------------------------------*/ -static -void add_pair_to_block ( EState* s ) -{ - Int32 i; - UChar ch = (UChar)(s->state_in_ch); - for (i = 0; i < s->state_in_len; i++) { - BZ_UPDATE_CRC( s->blockCRC, ch ); - } - s->inUse[s->state_in_ch] = True; - switch (s->state_in_len) { - case 1: - s->block[s->nblock] = (UChar)ch; s->nblock++; - break; - case 2: - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - break; - case 3: - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - break; - default: - s->inUse[s->state_in_len-4] = True; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = (UChar)ch; s->nblock++; - s->block[s->nblock] = ((UChar)(s->state_in_len-4)); - s->nblock++; - break; - } -} - - -/*---------------------------------------------------*/ -static -void flush_RL ( EState* s ) -{ - if (s->state_in_ch < 256) add_pair_to_block ( s ); - init_RL ( s ); -} - - -/*---------------------------------------------------*/ -#define ADD_CHAR_TO_BLOCK(zs,zchh0) \ -{ \ - UInt32 zchh = (UInt32)(zchh0); \ - /*-- fast track the common case --*/ \ - if (zchh != zs->state_in_ch && \ - zs->state_in_len == 1) { \ - UChar ch = (UChar)(zs->state_in_ch); \ - BZ_UPDATE_CRC( zs->blockCRC, ch ); \ - zs->inUse[zs->state_in_ch] = True; \ - zs->block[zs->nblock] = (UChar)ch; \ - zs->nblock++; \ - zs->state_in_ch = zchh; \ - } \ - else \ - /*-- general, uncommon cases --*/ \ - if (zchh != zs->state_in_ch || \ - zs->state_in_len == 255) { \ - if (zs->state_in_ch < 256) \ - add_pair_to_block ( zs ); \ - zs->state_in_ch = zchh; \ - zs->state_in_len = 1; \ - } else { \ - zs->state_in_len++; \ - } \ -} - - -/*---------------------------------------------------*/ -static -Bool copy_input_until_stop ( EState* s ) -{ - Bool progress_in = False; - - if (s->mode == BZ_M_RUNNING) { - - /*-- fast track the common case --*/ - while (True) { - /*-- block full? --*/ - if (s->nblock >= s->nblockMAX) break; - /*-- no input? --*/ - if (s->strm->avail_in == 0) break; - progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); - s->strm->next_in++; - s->strm->avail_in--; - s->strm->total_in_lo32++; - if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; - } - - } else { - - /*-- general, uncommon case --*/ - while (True) { - /*-- block full? --*/ - if (s->nblock >= s->nblockMAX) break; - /*-- no input? --*/ - if (s->strm->avail_in == 0) break; - /*-- flush/finish end? --*/ - if (s->avail_in_expect == 0) break; - progress_in = True; - ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); - s->strm->next_in++; - s->strm->avail_in--; - s->strm->total_in_lo32++; - if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; - s->avail_in_expect--; - } - } - return progress_in; -} - - -/*---------------------------------------------------*/ -static -Bool copy_output_until_stop ( EState* s ) -{ - Bool progress_out = False; - - while (True) { - - /*-- no output space? --*/ - if (s->strm->avail_out == 0) break; - - /*-- block done? --*/ - if (s->state_out_pos >= s->numZ) break; - - progress_out = True; - *(s->strm->next_out) = s->zbits[s->state_out_pos]; - s->state_out_pos++; - s->strm->avail_out--; - s->strm->next_out++; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - return progress_out; -} - - -/*---------------------------------------------------*/ -static -Bool handle_compress ( bz_stream* strm ) -{ - Bool progress_in = False; - Bool progress_out = False; - EState* s = strm->state; - - while (True) { - - if (s->state == BZ_S_OUTPUT) { - progress_out |= copy_output_until_stop ( s ); - if (s->state_out_pos < s->numZ) break; - if (s->mode == BZ_M_FINISHING && - s->avail_in_expect == 0 && - isempty_RL(s)) break; - prepare_new_block ( s ); - s->state = BZ_S_INPUT; - if (s->mode == BZ_M_FLUSHING && - s->avail_in_expect == 0 && - isempty_RL(s)) break; - } - - if (s->state == BZ_S_INPUT) { - progress_in |= copy_input_until_stop ( s ); - if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) { - flush_RL ( s ); - BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) ); - s->state = BZ_S_OUTPUT; - } - else - if (s->nblock >= s->nblockMAX) { - BZ2_compressBlock ( s, False ); - s->state = BZ_S_OUTPUT; - } - else - if (s->strm->avail_in == 0) { - break; - } - } - - } - - return progress_in || progress_out; -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) -{ - Bool progress; - EState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - preswitch: - switch (s->mode) { - - case BZ_M_IDLE: - return BZ_SEQUENCE_ERROR; - - case BZ_M_RUNNING: - if (action == BZ_RUN) { - progress = handle_compress ( strm ); - return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; - } - else - if (action == BZ_FLUSH) { - s->avail_in_expect = strm->avail_in; - s->mode = BZ_M_FLUSHING; - goto preswitch; - } - else - if (action == BZ_FINISH) { - s->avail_in_expect = strm->avail_in; - s->mode = BZ_M_FINISHING; - goto preswitch; - } - else - return BZ_PARAM_ERROR; - - case BZ_M_FLUSHING: - if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) - return BZ_SEQUENCE_ERROR; - progress = handle_compress ( strm ); - if (s->avail_in_expect > 0 || !isempty_RL(s) || - s->state_out_pos < s->numZ) return BZ_FLUSH_OK; - s->mode = BZ_M_RUNNING; - return BZ_RUN_OK; - - case BZ_M_FINISHING: - if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect != s->strm->avail_in) - return BZ_SEQUENCE_ERROR; - progress = handle_compress ( strm ); - if (!progress) return BZ_SEQUENCE_ERROR; - if (s->avail_in_expect > 0 || !isempty_RL(s) || - s->state_out_pos < s->numZ) return BZ_FINISH_OK; - s->mode = BZ_M_IDLE; - return BZ_STREAM_END; - } - return BZ_OK; /*--not reached--*/ -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) -{ - EState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - if (s->arr1 != NULL) BZFREE(s->arr1); - if (s->arr2 != NULL) BZFREE(s->arr2); - if (s->ftab != NULL) BZFREE(s->ftab); - BZFREE(strm->state); - - strm->state = NULL; - - return BZ_OK; -} - - -/*---------------------------------------------------*/ -/*--- Decompression stuff ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompressInit) - ( bz_stream* strm, - int verbosity, - int small ) -{ - DState* s; - - if (!bz_config_ok()) return BZ_CONFIG_ERROR; - - if (strm == NULL) return BZ_PARAM_ERROR; - if (small != 0 && small != 1) return BZ_PARAM_ERROR; - if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; - - if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; - if (strm->bzfree == NULL) strm->bzfree = default_bzfree; - - s = BZALLOC( sizeof(DState) ); - if (s == NULL) return BZ_MEM_ERROR; - s->strm = strm; - strm->state = s; - s->state = BZ_X_MAGIC_1; - s->bsLive = 0; - s->bsBuff = 0; - s->calculatedCombinedCRC = 0; - strm->total_in_lo32 = 0; - strm->total_in_hi32 = 0; - strm->total_out_lo32 = 0; - strm->total_out_hi32 = 0; - s->smallDecompress = (Bool)small; - s->ll4 = NULL; - s->ll16 = NULL; - s->tt = NULL; - s->currBlockNo = 0; - s->verbosity = verbosity; - - return BZ_OK; -} - - -/*---------------------------------------------------*/ -/* Return True iff data corruption is discovered. - Returns False if there is no problem. -*/ -static -Bool unRLE_obuf_to_output_FAST ( DState* s ) -{ - UChar k1; - - if (s->blockRandomised) { - - while (True) { - /* try to finish existing run */ - while (True) { - if (s->strm->avail_out == 0) return False; - if (s->state_out_len == 0) break; - *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; - BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); - s->state_out_len--; - s->strm->next_out++; - s->strm->avail_out--; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return False; - - /* Only caused by corrupt data stream? */ - if (s->nblock_used > s->save_nblock+1) - return True; - - s->state_out_len = 1; - s->state_out_ch = s->k0; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 2; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 3; - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - s->state_out_len = ((Int32)k1) + 4; - BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; - s->k0 ^= BZ_RAND_MASK; s->nblock_used++; - } - - } else { - - /* restore */ - UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC; - UChar c_state_out_ch = s->state_out_ch; - Int32 c_state_out_len = s->state_out_len; - Int32 c_nblock_used = s->nblock_used; - Int32 c_k0 = s->k0; - UInt32* c_tt = s->tt; - UInt32 c_tPos = s->tPos; - char* cs_next_out = s->strm->next_out; - unsigned int cs_avail_out = s->strm->avail_out; - Int32 ro_blockSize100k = s->blockSize100k; - /* end restore */ - - UInt32 avail_out_INIT = cs_avail_out; - Int32 s_save_nblockPP = s->save_nblock+1; - unsigned int total_out_lo32_old; - - while (True) { - - /* try to finish existing run */ - if (c_state_out_len > 0) { - while (True) { - if (cs_avail_out == 0) goto return_notr; - if (c_state_out_len == 1) break; - *( (UChar*)(cs_next_out) ) = c_state_out_ch; - BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); - c_state_out_len--; - cs_next_out++; - cs_avail_out--; - } - s_state_out_len_eq_one: - { - if (cs_avail_out == 0) { - c_state_out_len = 1; goto return_notr; - }; - *( (UChar*)(cs_next_out) ) = c_state_out_ch; - BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); - cs_next_out++; - cs_avail_out--; - } - } - /* Only caused by corrupt data stream? */ - if (c_nblock_used > s_save_nblockPP) - return True; - - /* can a new run be started? */ - if (c_nblock_used == s_save_nblockPP) { - c_state_out_len = 0; goto return_notr; - }; - c_state_out_ch = c_k0; - BZ_GET_FAST_C(k1); c_nblock_used++; - if (k1 != c_k0) { - c_k0 = k1; goto s_state_out_len_eq_one; - }; - if (c_nblock_used == s_save_nblockPP) - goto s_state_out_len_eq_one; - - c_state_out_len = 2; - BZ_GET_FAST_C(k1); c_nblock_used++; - if (c_nblock_used == s_save_nblockPP) continue; - if (k1 != c_k0) { c_k0 = k1; continue; }; - - c_state_out_len = 3; - BZ_GET_FAST_C(k1); c_nblock_used++; - if (c_nblock_used == s_save_nblockPP) continue; - if (k1 != c_k0) { c_k0 = k1; continue; }; - - BZ_GET_FAST_C(k1); c_nblock_used++; - c_state_out_len = ((Int32)k1) + 4; - BZ_GET_FAST_C(c_k0); c_nblock_used++; - } - - return_notr: - total_out_lo32_old = s->strm->total_out_lo32; - s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out); - if (s->strm->total_out_lo32 < total_out_lo32_old) - s->strm->total_out_hi32++; - - /* save */ - s->calculatedBlockCRC = c_calculatedBlockCRC; - s->state_out_ch = c_state_out_ch; - s->state_out_len = c_state_out_len; - s->nblock_used = c_nblock_used; - s->k0 = c_k0; - s->tt = c_tt; - s->tPos = c_tPos; - s->strm->next_out = cs_next_out; - s->strm->avail_out = cs_avail_out; - /* end save */ - } - return False; -} - - - -/*---------------------------------------------------*/ -__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab ) -{ - Int32 nb, na, mid; - nb = 0; - na = 256; - do { - mid = (nb + na) >> 1; - if (indx >= cftab[mid]) nb = mid; else na = mid; - } - while (na - nb != 1); - return nb; -} - - -/*---------------------------------------------------*/ -/* Return True iff data corruption is discovered. - Returns False if there is no problem. -*/ -static -Bool unRLE_obuf_to_output_SMALL ( DState* s ) -{ - UChar k1; - - if (s->blockRandomised) { - - while (True) { - /* try to finish existing run */ - while (True) { - if (s->strm->avail_out == 0) return False; - if (s->state_out_len == 0) break; - *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; - BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); - s->state_out_len--; - s->strm->next_out++; - s->strm->avail_out--; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return False; - - /* Only caused by corrupt data stream? */ - if (s->nblock_used > s->save_nblock+1) - return True; - - s->state_out_len = 1; - s->state_out_ch = s->k0; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 2; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 3; - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; - k1 ^= BZ_RAND_MASK; s->nblock_used++; - s->state_out_len = ((Int32)k1) + 4; - BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; - s->k0 ^= BZ_RAND_MASK; s->nblock_used++; - } - - } else { - - while (True) { - /* try to finish existing run */ - while (True) { - if (s->strm->avail_out == 0) return False; - if (s->state_out_len == 0) break; - *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; - BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); - s->state_out_len--; - s->strm->next_out++; - s->strm->avail_out--; - s->strm->total_out_lo32++; - if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; - } - - /* can a new run be started? */ - if (s->nblock_used == s->save_nblock+1) return False; - - /* Only caused by corrupt data stream? */ - if (s->nblock_used > s->save_nblock+1) - return True; - - s->state_out_len = 1; - s->state_out_ch = s->k0; - BZ_GET_SMALL(k1); s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 2; - BZ_GET_SMALL(k1); s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - s->state_out_len = 3; - BZ_GET_SMALL(k1); s->nblock_used++; - if (s->nblock_used == s->save_nblock+1) continue; - if (k1 != s->k0) { s->k0 = k1; continue; }; - - BZ_GET_SMALL(k1); s->nblock_used++; - s->state_out_len = ((Int32)k1) + 4; - BZ_GET_SMALL(s->k0); s->nblock_used++; - } - - } -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) -{ - Bool corrupt; - DState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - while (True) { - if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; - if (s->state == BZ_X_OUTPUT) { - if (s->smallDecompress) - corrupt = unRLE_obuf_to_output_SMALL ( s ); else - corrupt = unRLE_obuf_to_output_FAST ( s ); - if (corrupt) return BZ_DATA_ERROR; - if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { - BZ_FINALISE_CRC ( s->calculatedBlockCRC ); - if (s->verbosity >= 3) - VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, - s->calculatedBlockCRC ); - if (s->verbosity >= 2) VPrintf0 ( "]" ); - if (s->calculatedBlockCRC != s->storedBlockCRC) - return BZ_DATA_ERROR; - s->calculatedCombinedCRC - = (s->calculatedCombinedCRC << 1) | - (s->calculatedCombinedCRC >> 31); - s->calculatedCombinedCRC ^= s->calculatedBlockCRC; - s->state = BZ_X_BLKHDR_1; - } else { - return BZ_OK; - } - } - if (s->state >= BZ_X_MAGIC_1) { - Int32 r = BZ2_decompress ( s ); - if (r == BZ_STREAM_END) { - if (s->verbosity >= 3) - VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", - s->storedCombinedCRC, s->calculatedCombinedCRC ); - if (s->calculatedCombinedCRC != s->storedCombinedCRC) - return BZ_DATA_ERROR; - return r; - } - if (s->state != BZ_X_OUTPUT) return r; - } - } - - AssertH ( 0, 6001 ); - - return 0; /*NOTREACHED*/ -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) -{ - DState* s; - if (strm == NULL) return BZ_PARAM_ERROR; - s = strm->state; - if (s == NULL) return BZ_PARAM_ERROR; - if (s->strm != strm) return BZ_PARAM_ERROR; - - if (s->tt != NULL) BZFREE(s->tt); - if (s->ll16 != NULL) BZFREE(s->ll16); - if (s->ll4 != NULL) BZFREE(s->ll4); - - BZFREE(strm->state); - strm->state = NULL; - - return BZ_OK; -} - - -#ifndef BZ_NO_STDIO -/*---------------------------------------------------*/ -/*--- File I/O stuff ---*/ -/*---------------------------------------------------*/ - -#define BZ_SETERR(eee) \ -{ \ - if (bzerror != NULL) *bzerror = eee; \ - if (bzf != NULL) bzf->lastErr = eee; \ -} - -typedef - struct { - FILE* handle; - Char buf[BZ_MAX_UNUSED]; - Int32 bufN; - Bool writing; - bz_stream strm; - Int32 lastErr; - Bool initialisedOk; - } - bzFile; - - -/*---------------------------------------------*/ -static Bool myfeof ( FILE* f ) -{ - Int32 c = fgetc ( f ); - if (c == EOF) return True; - ungetc ( c, f ); - return False; -} - - -/*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzWriteOpen) - ( int* bzerror, - FILE* f, - int blockSize100k, - int verbosity, - int workFactor ) -{ - Int32 ret; - bzFile* bzf = NULL; - - BZ_SETERR(BZ_OK); - - if (f == NULL || - (blockSize100k < 1 || blockSize100k > 9) || - (workFactor < 0 || workFactor > 250) || - (verbosity < 0 || verbosity > 4)) - { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; - - if (ferror(f)) - { BZ_SETERR(BZ_IO_ERROR); return NULL; }; - - bzf = malloc ( sizeof(bzFile) ); - if (bzf == NULL) - { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; - - BZ_SETERR(BZ_OK); - bzf->initialisedOk = False; - bzf->bufN = 0; - bzf->handle = f; - bzf->writing = True; - bzf->strm.bzalloc = NULL; - bzf->strm.bzfree = NULL; - bzf->strm.opaque = NULL; - - if (workFactor == 0) workFactor = 30; - ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, - verbosity, workFactor ); - if (ret != BZ_OK) - { BZ_SETERR(ret); free(bzf); return NULL; }; - - bzf->strm.avail_in = 0; - bzf->initialisedOk = True; - return bzf; -} - - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzWrite) - ( int* bzerror, - BZFILE* b, - void* buf, - int len ) -{ - Int32 n, n2, ret; - bzFile* bzf = (bzFile*)b; - - BZ_SETERR(BZ_OK); - if (bzf == NULL || buf == NULL || len < 0) - { BZ_SETERR(BZ_PARAM_ERROR); return; }; - if (!(bzf->writing)) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - - if (len == 0) - { BZ_SETERR(BZ_OK); return; }; - - bzf->strm.avail_in = len; - bzf->strm.next_in = buf; - - while (True) { - bzf->strm.avail_out = BZ_MAX_UNUSED; - bzf->strm.next_out = bzf->buf; - ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN ); - if (ret != BZ_RUN_OK) - { BZ_SETERR(ret); return; }; - - if (bzf->strm.avail_out < BZ_MAX_UNUSED) { - n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), - n, bzf->handle ); - if (n != n2 || ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - } - - if (bzf->strm.avail_in == 0) - { BZ_SETERR(BZ_OK); return; }; - } -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzWriteClose) - ( int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in, - unsigned int* nbytes_out ) -{ - BZ2_bzWriteClose64 ( bzerror, b, abandon, - nbytes_in, NULL, nbytes_out, NULL ); -} - - -void BZ_API(BZ2_bzWriteClose64) - ( int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in_lo32, - unsigned int* nbytes_in_hi32, - unsigned int* nbytes_out_lo32, - unsigned int* nbytes_out_hi32 ) -{ - Int32 n, n2, ret; - bzFile* bzf = (bzFile*)b; - - if (bzf == NULL) - { BZ_SETERR(BZ_OK); return; }; - if (!(bzf->writing)) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - - if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0; - if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0; - if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0; - if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0; - - if ((!abandon) && bzf->lastErr == BZ_OK) { - while (True) { - bzf->strm.avail_out = BZ_MAX_UNUSED; - bzf->strm.next_out = bzf->buf; - ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH ); - if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END) - { BZ_SETERR(ret); return; }; - - if (bzf->strm.avail_out < BZ_MAX_UNUSED) { - n = BZ_MAX_UNUSED - bzf->strm.avail_out; - n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), - n, bzf->handle ); - if (n != n2 || ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - } - - if (ret == BZ_STREAM_END) break; - } - } - - if ( !abandon && !ferror ( bzf->handle ) ) { - fflush ( bzf->handle ); - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return; }; - } - - if (nbytes_in_lo32 != NULL) - *nbytes_in_lo32 = bzf->strm.total_in_lo32; - if (nbytes_in_hi32 != NULL) - *nbytes_in_hi32 = bzf->strm.total_in_hi32; - if (nbytes_out_lo32 != NULL) - *nbytes_out_lo32 = bzf->strm.total_out_lo32; - if (nbytes_out_hi32 != NULL) - *nbytes_out_hi32 = bzf->strm.total_out_hi32; - - BZ_SETERR(BZ_OK); - BZ2_bzCompressEnd ( &(bzf->strm) ); - free ( bzf ); -} - - -/*---------------------------------------------------*/ -BZFILE* BZ_API(BZ2_bzReadOpen) - ( int* bzerror, - FILE* f, - int verbosity, - int small, - void* unused, - int nUnused ) -{ - bzFile* bzf = NULL; - int ret; - - BZ_SETERR(BZ_OK); - - if (f == NULL || - (small != 0 && small != 1) || - (verbosity < 0 || verbosity > 4) || - (unused == NULL && nUnused != 0) || - (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED))) - { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; - - if (ferror(f)) - { BZ_SETERR(BZ_IO_ERROR); return NULL; }; - - bzf = malloc ( sizeof(bzFile) ); - if (bzf == NULL) - { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; - - BZ_SETERR(BZ_OK); - - bzf->initialisedOk = False; - bzf->handle = f; - bzf->bufN = 0; - bzf->writing = False; - bzf->strm.bzalloc = NULL; - bzf->strm.bzfree = NULL; - bzf->strm.opaque = NULL; - - while (nUnused > 0) { - bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; - unused = ((void*)( 1 + ((UChar*)(unused)) )); - nUnused--; - } - - ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small ); - if (ret != BZ_OK) - { BZ_SETERR(ret); free(bzf); return NULL; }; - - bzf->strm.avail_in = bzf->bufN; - bzf->strm.next_in = bzf->buf; - - bzf->initialisedOk = True; - return bzf; -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) -{ - bzFile* bzf = (bzFile*)b; - - BZ_SETERR(BZ_OK); - if (bzf == NULL) - { BZ_SETERR(BZ_OK); return; }; - - if (bzf->writing) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - - if (bzf->initialisedOk) - (void)BZ2_bzDecompressEnd ( &(bzf->strm) ); - free ( bzf ); -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzRead) - ( int* bzerror, - BZFILE* b, - void* buf, - int len ) -{ - Int32 n, ret; - bzFile* bzf = (bzFile*)b; - - BZ_SETERR(BZ_OK); - - if (bzf == NULL || buf == NULL || len < 0) - { BZ_SETERR(BZ_PARAM_ERROR); return 0; }; - - if (bzf->writing) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; }; - - if (len == 0) - { BZ_SETERR(BZ_OK); return 0; }; - - bzf->strm.avail_out = len; - bzf->strm.next_out = buf; - - while (True) { - - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return 0; }; - - if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { - n = fread ( bzf->buf, sizeof(UChar), - BZ_MAX_UNUSED, bzf->handle ); - if (ferror(bzf->handle)) - { BZ_SETERR(BZ_IO_ERROR); return 0; }; - bzf->bufN = n; - bzf->strm.avail_in = bzf->bufN; - bzf->strm.next_in = bzf->buf; - } - - ret = BZ2_bzDecompress ( &(bzf->strm) ); - - if (ret != BZ_OK && ret != BZ_STREAM_END) - { BZ_SETERR(ret); return 0; }; - - if (ret == BZ_OK && myfeof(bzf->handle) && - bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) - { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; - - if (ret == BZ_STREAM_END) - { BZ_SETERR(BZ_STREAM_END); - return len - bzf->strm.avail_out; }; - if (bzf->strm.avail_out == 0) - { BZ_SETERR(BZ_OK); return len; }; - - } - - return 0; /*not reached*/ -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzReadGetUnused) - ( int* bzerror, - BZFILE* b, - void** unused, - int* nUnused ) -{ - bzFile* bzf = (bzFile*)b; - if (bzf == NULL) - { BZ_SETERR(BZ_PARAM_ERROR); return; }; - if (bzf->lastErr != BZ_STREAM_END) - { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; - if (unused == NULL || nUnused == NULL) - { BZ_SETERR(BZ_PARAM_ERROR); return; }; - - BZ_SETERR(BZ_OK); - *nUnused = bzf->strm.avail_in; - *unused = bzf->strm.next_in; -} -#endif - - -/*---------------------------------------------------*/ -/*--- Misc convenience stuff ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffCompress) - ( char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int blockSize100k, - int verbosity, - int workFactor ) -{ - bz_stream strm; - int ret; - - if (dest == NULL || destLen == NULL || - source == NULL || - blockSize100k < 1 || blockSize100k > 9 || - verbosity < 0 || verbosity > 4 || - workFactor < 0 || workFactor > 250) - return BZ_PARAM_ERROR; - - if (workFactor == 0) workFactor = 30; - strm.bzalloc = NULL; - strm.bzfree = NULL; - strm.opaque = NULL; - ret = BZ2_bzCompressInit ( &strm, blockSize100k, - verbosity, workFactor ); - if (ret != BZ_OK) return ret; - - strm.next_in = source; - strm.next_out = dest; - strm.avail_in = sourceLen; - strm.avail_out = *destLen; - - ret = BZ2_bzCompress ( &strm, BZ_FINISH ); - if (ret == BZ_FINISH_OK) goto output_overflow; - if (ret != BZ_STREAM_END) goto errhandler; - - /* normal termination */ - *destLen -= strm.avail_out; - BZ2_bzCompressEnd ( &strm ); - return BZ_OK; - - output_overflow: - BZ2_bzCompressEnd ( &strm ); - return BZ_OUTBUFF_FULL; - - errhandler: - BZ2_bzCompressEnd ( &strm ); - return ret; -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzBuffToBuffDecompress) - ( char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int small, - int verbosity ) -{ - bz_stream strm; - int ret; - - if (dest == NULL || destLen == NULL || - source == NULL || - (small != 0 && small != 1) || - verbosity < 0 || verbosity > 4) - return BZ_PARAM_ERROR; - - strm.bzalloc = NULL; - strm.bzfree = NULL; - strm.opaque = NULL; - ret = BZ2_bzDecompressInit ( &strm, verbosity, small ); - if (ret != BZ_OK) return ret; - - strm.next_in = source; - strm.next_out = dest; - strm.avail_in = sourceLen; - strm.avail_out = *destLen; - - ret = BZ2_bzDecompress ( &strm ); - if (ret == BZ_OK) goto output_overflow_or_eof; - if (ret != BZ_STREAM_END) goto errhandler; - - /* normal termination */ - *destLen -= strm.avail_out; - BZ2_bzDecompressEnd ( &strm ); - return BZ_OK; - - output_overflow_or_eof: - if (strm.avail_out > 0) { - BZ2_bzDecompressEnd ( &strm ); - return BZ_UNEXPECTED_EOF; - } else { - BZ2_bzDecompressEnd ( &strm ); - return BZ_OUTBUFF_FULL; - }; - - errhandler: - BZ2_bzDecompressEnd ( &strm ); - return ret; -} - - -/*---------------------------------------------------*/ -/*-- - Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) - to support better zlib compatibility. - This code is not _officially_ part of libbzip2 (yet); - I haven't tested it, documented it, or considered the - threading-safeness of it. - If this code breaks, please contact both Yoshioka and me. ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -/*-- - return version like "0.9.5d, 4-Sept-1999". ---*/ -const char * BZ_API(BZ2_bzlibVersion)(void) -{ - return BZ_VERSION; -} - - -#ifndef BZ_NO_STDIO -/*---------------------------------------------------*/ - -#if defined(_WIN32) || defined(OS2) || defined(MSDOS) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif -static -BZFILE * bzopen_or_bzdopen - ( const char *path, /* no use when bzdopen */ - int fd, /* no use when bzdopen */ - const char *mode, - int open_mode) /* bzopen: 0, bzdopen:1 */ -{ - int bzerr; - char unused[BZ_MAX_UNUSED]; - int blockSize100k = 9; - int writing = 0; - char mode2[10] = ""; - FILE *fp = NULL; - BZFILE *bzfp = NULL; - int verbosity = 0; - int workFactor = 30; - int smallMode = 0; - int nUnused = 0; - - if (mode == NULL) return NULL; - while (*mode) { - switch (*mode) { - case 'r': - writing = 0; break; - case 'w': - writing = 1; break; - case 's': - smallMode = 1; break; - default: - if (isdigit((int)(*mode))) { - blockSize100k = *mode-BZ_HDR_0; - } - } - mode++; - } - strcat(mode2, writing ? "w" : "r" ); - strcat(mode2,"b"); /* binary mode */ - - if (open_mode==0) { - if (path==NULL || strcmp(path,"")==0) { - fp = (writing ? stdout : stdin); - SET_BINARY_MODE(fp); - } else { - fp = fopen(path,mode2); - } - } else { -#ifdef BZ_STRICT_ANSI - fp = NULL; -#else - fp = fdopen(fd,mode2); -#endif - } - if (fp == NULL) return NULL; - - if (writing) { - /* Guard against total chaos and anarchy -- JRS */ - if (blockSize100k < 1) blockSize100k = 1; - if (blockSize100k > 9) blockSize100k = 9; - bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, - verbosity,workFactor); - } else { - bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode, - unused,nUnused); - } - if (bzfp == NULL) { - if (fp != stdin && fp != stdout) fclose(fp); - return NULL; - } - return bzfp; -} - - -/*---------------------------------------------------*/ -/*-- - open file for read or write. - ex) bzopen("file","w9") - case path="" or NULL => use stdin or stdout. ---*/ -BZFILE * BZ_API(BZ2_bzopen) - ( const char *path, - const char *mode ) -{ - return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0); -} - - -/*---------------------------------------------------*/ -BZFILE * BZ_API(BZ2_bzdopen) - ( int fd, - const char *mode ) -{ - return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1); -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len ) -{ - int bzerr, nread; - if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0; - nread = BZ2_bzRead(&bzerr,b,buf,len); - if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) { - return nread; - } else { - return -1; - } -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len ) -{ - int bzerr; - - BZ2_bzWrite(&bzerr,b,buf,len); - if(bzerr == BZ_OK){ - return len; - }else{ - return -1; - } -} - - -/*---------------------------------------------------*/ -int BZ_API(BZ2_bzflush) (BZFILE *b) -{ - /* do nothing now... */ - return 0; -} - - -/*---------------------------------------------------*/ -void BZ_API(BZ2_bzclose) (BZFILE* b) -{ - int bzerr; - FILE *fp; - - if (b==NULL) {return;} - fp = ((bzFile *)b)->handle; - if(((bzFile*)b)->writing){ - BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); - if(bzerr != BZ_OK){ - BZ2_bzWriteClose(NULL,b,1,NULL,NULL); - } - }else{ - BZ2_bzReadClose(&bzerr,b); - } - if(fp!=stdin && fp!=stdout){ - fclose(fp); - } -} - - -/*---------------------------------------------------*/ -/*-- - return last error code ---*/ -static const char *bzerrorstrings[] = { - "OK" - ,"SEQUENCE_ERROR" - ,"PARAM_ERROR" - ,"MEM_ERROR" - ,"DATA_ERROR" - ,"DATA_ERROR_MAGIC" - ,"IO_ERROR" - ,"UNEXPECTED_EOF" - ,"OUTBUFF_FULL" - ,"CONFIG_ERROR" - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ - ,"???" /* for future */ -}; - - -const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum) -{ - int err = ((bzFile *)b)->lastErr; - - if(err>0) err = 0; - *errnum = err; - return bzerrorstrings[err*-1]; -} -#endif - - -/*-------------------------------------------------------------*/ -/*--- end bzlib.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/bzlib.h b/src/lib/dl/ext/bzip2/bzlib.h deleted file mode 100755 index 8277123d..00000000 --- a/src/lib/dl/ext/bzip2/bzlib.h +++ /dev/null @@ -1,282 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Public header file for the library. ---*/ -/*--- bzlib.h ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#ifndef _BZLIB_H -#define _BZLIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define BZ_RUN 0 -#define BZ_FLUSH 1 -#define BZ_FINISH 2 - -#define BZ_OK 0 -#define BZ_RUN_OK 1 -#define BZ_FLUSH_OK 2 -#define BZ_FINISH_OK 3 -#define BZ_STREAM_END 4 -#define BZ_SEQUENCE_ERROR (-1) -#define BZ_PARAM_ERROR (-2) -#define BZ_MEM_ERROR (-3) -#define BZ_DATA_ERROR (-4) -#define BZ_DATA_ERROR_MAGIC (-5) -#define BZ_IO_ERROR (-6) -#define BZ_UNEXPECTED_EOF (-7) -#define BZ_OUTBUFF_FULL (-8) -#define BZ_CONFIG_ERROR (-9) - -typedef - struct { - char *next_in; - unsigned int avail_in; - unsigned int total_in_lo32; - unsigned int total_in_hi32; - - char *next_out; - unsigned int avail_out; - unsigned int total_out_lo32; - unsigned int total_out_hi32; - - void *state; - - void *(*bzalloc)(void *,int,int); - void (*bzfree)(void *,void *); - void *opaque; - } - bz_stream; - - -#ifndef BZ_IMPORT -#define BZ_EXPORT -#endif - -#ifndef BZ_NO_STDIO -/* Need a definitition for FILE */ -#include -#endif - -#ifdef _WIN32 -# include -# ifdef small - /* windows.h define small to char */ -# undef small -# endif -# ifdef BZ_EXPORT -# define BZ_API(func) WINAPI func -# define BZ_EXTERN extern -# else - /* import windows dll dynamically */ -# define BZ_API(func) (WINAPI * func) -# define BZ_EXTERN -# endif -#else -# define BZ_API(func) func -# define BZ_EXTERN extern -#endif - - -/*-- Core (low-level) library functions --*/ - -BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( - bz_stream* strm, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN int BZ_API(BZ2_bzCompress) ( - bz_stream* strm, - int action - ); - -BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( - bz_stream* strm - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( - bz_stream *strm, - int verbosity, - int small - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( - bz_stream* strm - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( - bz_stream *strm - ); - - - -/*-- High(er) level library functions --*/ - -#ifndef BZ_NO_STDIO -#define BZ_MAX_UNUSED 5000 - -typedef void BZFILE; - -BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( - int* bzerror, - FILE* f, - int verbosity, - int small, - void* unused, - int nUnused - ); - -BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( - int* bzerror, - BZFILE* b - ); - -BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( - int* bzerror, - BZFILE* b, - void** unused, - int* nUnused - ); - -BZ_EXTERN int BZ_API(BZ2_bzRead) ( - int* bzerror, - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( - int* bzerror, - FILE* f, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN void BZ_API(BZ2_bzWrite) ( - int* bzerror, - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in, - unsigned int* nbytes_out - ); - -BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in_lo32, - unsigned int* nbytes_in_hi32, - unsigned int* nbytes_out_lo32, - unsigned int* nbytes_out_hi32 - ); -#endif - - -/*-- Utility functions --*/ - -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( - char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( - char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int small, - int verbosity - ); - - -/*-- - Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) - to support better zlib compatibility. - This code is not _officially_ part of libbzip2 (yet); - I haven't tested it, documented it, or considered the - threading-safeness of it. - If this code breaks, please contact both Yoshioka and me. ---*/ - -BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( - void - ); - -#ifndef BZ_NO_STDIO -BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( - const char *path, - const char *mode - ); - -BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( - int fd, - const char *mode - ); - -BZ_EXTERN int BZ_API(BZ2_bzread) ( - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN int BZ_API(BZ2_bzwrite) ( - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN int BZ_API(BZ2_bzflush) ( - BZFILE* b - ); - -BZ_EXTERN void BZ_API(BZ2_bzclose) ( - BZFILE* b - ); - -BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( - BZFILE *b, - int *errnum - ); -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -/*-------------------------------------------------------------*/ -/*--- end bzlib.h ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/bzlibprv.h b/src/lib/dl/ext/bzip2/bzlibprv.h deleted file mode 100755 index 5d0217f4..00000000 --- a/src/lib/dl/ext/bzip2/bzlibprv.h +++ /dev/null @@ -1,509 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Private header file for the library. ---*/ -/*--- bzlib_private.h ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#ifndef _BZLIB_PRIVATE_H -#define _BZLIB_PRIVATE_H - -#include - -#ifndef BZ_NO_STDIO -#include -#include -#include -#endif - -#include "bzlib.h" - - - -/*-- General stuff. --*/ - -#define BZ_VERSION "1.0.6, 6-Sept-2010" - -typedef char Char; -typedef unsigned char Bool; -typedef unsigned char UChar; -typedef int Int32; -typedef unsigned int UInt32; -typedef short Int16; -typedef unsigned short UInt16; - -#define True ((Bool)1) -#define False ((Bool)0) - -#ifndef __GNUC__ -#define __inline__ /* */ -#endif - -#ifndef BZ_NO_STDIO - -extern void BZ2_bz__AssertH__fail ( int errcode ); -#define AssertH(cond,errcode) \ - { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } - -#if BZ_DEBUG -#define AssertD(cond,msg) \ - { if (!(cond)) { \ - fprintf ( stderr, \ - "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\ - exit(1); \ - }} -#else -#define AssertD(cond,msg) /* */ -#endif - -#define VPrintf0(zf) \ - fprintf(stderr,zf) -#define VPrintf1(zf,za1) \ - fprintf(stderr,zf,za1) -#define VPrintf2(zf,za1,za2) \ - fprintf(stderr,zf,za1,za2) -#define VPrintf3(zf,za1,za2,za3) \ - fprintf(stderr,zf,za1,za2,za3) -#define VPrintf4(zf,za1,za2,za3,za4) \ - fprintf(stderr,zf,za1,za2,za3,za4) -#define VPrintf5(zf,za1,za2,za3,za4,za5) \ - fprintf(stderr,zf,za1,za2,za3,za4,za5) - -#else - -extern void bz_internal_error ( int errcode ); -#define AssertH(cond,errcode) \ - { if (!(cond)) bz_internal_error ( errcode ); } -#define AssertD(cond,msg) do { } while (0) -#define VPrintf0(zf) do { } while (0) -#define VPrintf1(zf,za1) do { } while (0) -#define VPrintf2(zf,za1,za2) do { } while (0) -#define VPrintf3(zf,za1,za2,za3) do { } while (0) -#define VPrintf4(zf,za1,za2,za3,za4) do { } while (0) -#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0) - -#endif - - -#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1) -#define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp)) - - -/*-- Header bytes. --*/ - -#define BZ_HDR_B 0x42 /* 'B' */ -#define BZ_HDR_Z 0x5a /* 'Z' */ -#define BZ_HDR_h 0x68 /* 'h' */ -#define BZ_HDR_0 0x30 /* '0' */ - -/*-- Constants for the back end. --*/ - -#define BZ_MAX_ALPHA_SIZE 258 -#define BZ_MAX_CODE_LEN 23 - -#define BZ_RUNA 0 -#define BZ_RUNB 1 - -#define BZ_N_GROUPS 6 -#define BZ_G_SIZE 50 -#define BZ_N_ITERS 4 - -#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE)) - - - -/*-- Stuff for randomising repetitive blocks. --*/ - -extern Int32 BZ2_rNums[512]; - -#define BZ_RAND_DECLS \ - Int32 rNToGo; \ - Int32 rTPos \ - -#define BZ_RAND_INIT_MASK \ - s->rNToGo = 0; \ - s->rTPos = 0 \ - -#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0) - -#define BZ_RAND_UPD_MASK \ - if (s->rNToGo == 0) { \ - s->rNToGo = BZ2_rNums[s->rTPos]; \ - s->rTPos++; \ - if (s->rTPos == 512) s->rTPos = 0; \ - } \ - s->rNToGo--; - - - -/*-- Stuff for doing CRCs. --*/ - -extern UInt32 BZ2_crc32Table[256]; - -#define BZ_INITIALISE_CRC(crcVar) \ -{ \ - crcVar = 0xffffffffL; \ -} - -#define BZ_FINALISE_CRC(crcVar) \ -{ \ - crcVar = ~(crcVar); \ -} - -#define BZ_UPDATE_CRC(crcVar,cha) \ -{ \ - crcVar = (crcVar << 8) ^ \ - BZ2_crc32Table[(crcVar >> 24) ^ \ - ((UChar)cha)]; \ -} - - - -/*-- States and modes for compression. --*/ - -#define BZ_M_IDLE 1 -#define BZ_M_RUNNING 2 -#define BZ_M_FLUSHING 3 -#define BZ_M_FINISHING 4 - -#define BZ_S_OUTPUT 1 -#define BZ_S_INPUT 2 - -#define BZ_N_RADIX 2 -#define BZ_N_QSORT 12 -#define BZ_N_SHELL 18 -#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2) - - - - -/*-- Structure holding all the compression-side stuff. --*/ - -typedef - struct { - /* pointer back to the struct bz_stream */ - bz_stream* strm; - - /* mode this stream is in, and whether inputting */ - /* or outputting data */ - Int32 mode; - Int32 state; - - /* remembers avail_in when flush/finish requested */ - UInt32 avail_in_expect; - - /* for doing the block sorting */ - UInt32* arr1; - UInt32* arr2; - UInt32* ftab; - Int32 origPtr; - - /* aliases for arr1 and arr2 */ - UInt32* ptr; - UChar* block; - UInt16* mtfv; - UChar* zbits; - - /* for deciding when to use the fallback sorting algorithm */ - Int32 workFactor; - - /* run-length-encoding of the input */ - UInt32 state_in_ch; - Int32 state_in_len; - BZ_RAND_DECLS; - - /* input and output limits and current posns */ - Int32 nblock; - Int32 nblockMAX; - Int32 numZ; - Int32 state_out_pos; - - /* map of bytes used in block */ - Int32 nInUse; - Bool inUse[256]; - UChar unseqToSeq[256]; - - /* the buffer for bit stream creation */ - UInt32 bsBuff; - Int32 bsLive; - - /* block and combined CRCs */ - UInt32 blockCRC; - UInt32 combinedCRC; - - /* misc administratium */ - Int32 verbosity; - Int32 blockNo; - Int32 blockSize100k; - - /* stuff for coding the MTF values */ - Int32 nMTF; - Int32 mtfFreq [BZ_MAX_ALPHA_SIZE]; - UChar selector [BZ_MAX_SELECTORS]; - UChar selectorMtf[BZ_MAX_SELECTORS]; - - UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - /* second dimension: only 3 needed; 4 makes index calculations faster */ - UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4]; - - } - EState; - - - -/*-- externs for compression. --*/ - -extern void -BZ2_blockSort ( EState* ); - -extern void -BZ2_compressBlock ( EState*, Bool ); - -extern void -BZ2_bsInitWrite ( EState* ); - -extern void -BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); - -extern void -BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); - - - -/*-- states for decompression. --*/ - -#define BZ_X_IDLE 1 -#define BZ_X_OUTPUT 2 - -#define BZ_X_MAGIC_1 10 -#define BZ_X_MAGIC_2 11 -#define BZ_X_MAGIC_3 12 -#define BZ_X_MAGIC_4 13 -#define BZ_X_BLKHDR_1 14 -#define BZ_X_BLKHDR_2 15 -#define BZ_X_BLKHDR_3 16 -#define BZ_X_BLKHDR_4 17 -#define BZ_X_BLKHDR_5 18 -#define BZ_X_BLKHDR_6 19 -#define BZ_X_BCRC_1 20 -#define BZ_X_BCRC_2 21 -#define BZ_X_BCRC_3 22 -#define BZ_X_BCRC_4 23 -#define BZ_X_RANDBIT 24 -#define BZ_X_ORIGPTR_1 25 -#define BZ_X_ORIGPTR_2 26 -#define BZ_X_ORIGPTR_3 27 -#define BZ_X_MAPPING_1 28 -#define BZ_X_MAPPING_2 29 -#define BZ_X_SELECTOR_1 30 -#define BZ_X_SELECTOR_2 31 -#define BZ_X_SELECTOR_3 32 -#define BZ_X_CODING_1 33 -#define BZ_X_CODING_2 34 -#define BZ_X_CODING_3 35 -#define BZ_X_MTF_1 36 -#define BZ_X_MTF_2 37 -#define BZ_X_MTF_3 38 -#define BZ_X_MTF_4 39 -#define BZ_X_MTF_5 40 -#define BZ_X_MTF_6 41 -#define BZ_X_ENDHDR_2 42 -#define BZ_X_ENDHDR_3 43 -#define BZ_X_ENDHDR_4 44 -#define BZ_X_ENDHDR_5 45 -#define BZ_X_ENDHDR_6 46 -#define BZ_X_CCRC_1 47 -#define BZ_X_CCRC_2 48 -#define BZ_X_CCRC_3 49 -#define BZ_X_CCRC_4 50 - - - -/*-- Constants for the fast MTF decoder. --*/ - -#define MTFA_SIZE 4096 -#define MTFL_SIZE 16 - - - -/*-- Structure holding all the decompression-side stuff. --*/ - -typedef - struct { - /* pointer back to the struct bz_stream */ - bz_stream* strm; - - /* state indicator for this stream */ - Int32 state; - - /* for doing the final run-length decoding */ - UChar state_out_ch; - Int32 state_out_len; - Bool blockRandomised; - BZ_RAND_DECLS; - - /* the buffer for bit stream reading */ - UInt32 bsBuff; - Int32 bsLive; - - /* misc administratium */ - Int32 blockSize100k; - Bool smallDecompress; - Int32 currBlockNo; - Int32 verbosity; - - /* for undoing the Burrows-Wheeler transform */ - Int32 origPtr; - UInt32 tPos; - Int32 k0; - Int32 unzftab[256]; - Int32 nblock_used; - Int32 cftab[257]; - Int32 cftabCopy[257]; - - /* for undoing the Burrows-Wheeler transform (FAST) */ - UInt32 *tt; - - /* for undoing the Burrows-Wheeler transform (SMALL) */ - UInt16 *ll16; - UChar *ll4; - - /* stored and calculated CRCs */ - UInt32 storedBlockCRC; - UInt32 storedCombinedCRC; - UInt32 calculatedBlockCRC; - UInt32 calculatedCombinedCRC; - - /* map of bytes used in block */ - Int32 nInUse; - Bool inUse[256]; - Bool inUse16[16]; - UChar seqToUnseq[256]; - - /* for decoding the MTF values */ - UChar mtfa [MTFA_SIZE]; - Int32 mtfbase[256 / MTFL_SIZE]; - UChar selector [BZ_MAX_SELECTORS]; - UChar selectorMtf[BZ_MAX_SELECTORS]; - UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - - Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 minLens[BZ_N_GROUPS]; - - /* save area for scalars in the main decompress code */ - Int32 save_i; - Int32 save_j; - Int32 save_t; - Int32 save_alphaSize; - Int32 save_nGroups; - Int32 save_nSelectors; - Int32 save_EOB; - Int32 save_groupNo; - Int32 save_groupPos; - Int32 save_nextSym; - Int32 save_nblockMAX; - Int32 save_nblock; - Int32 save_es; - Int32 save_N; - Int32 save_curr; - Int32 save_zt; - Int32 save_zn; - Int32 save_zvec; - Int32 save_zj; - Int32 save_gSel; - Int32 save_gMinlen; - Int32* save_gLimit; - Int32* save_gBase; - Int32* save_gPerm; - - } - DState; - - - -/*-- Macros for decompression. --*/ - -#define BZ_GET_FAST(cccc) \ - /* c_tPos is unsigned, hence test < 0 is pointless. */ \ - if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ - s->tPos = s->tt[s->tPos]; \ - cccc = (UChar)(s->tPos & 0xff); \ - s->tPos >>= 8; - -#define BZ_GET_FAST_C(cccc) \ - /* c_tPos is unsigned, hence test < 0 is pointless. */ \ - if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \ - c_tPos = c_tt[c_tPos]; \ - cccc = (UChar)(c_tPos & 0xff); \ - c_tPos >>= 8; - -#define SET_LL4(i,n) \ - { if (((i) & 0x1) == 0) \ - s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \ - s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \ - } - -#define GET_LL4(i) \ - ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF) - -#define SET_LL(i,n) \ - { s->ll16[i] = (UInt16)(n & 0x0000ffff); \ - SET_LL4(i, n >> 16); \ - } - -#define GET_LL(i) \ - (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) - -#define BZ_GET_SMALL(cccc) \ - /* c_tPos is unsigned, hence test < 0 is pointless. */ \ - if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ - cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ - s->tPos = GET_LL(s->tPos); - - -/*-- externs for decompression. --*/ - -extern Int32 -BZ2_indexIntoF ( Int32, Int32* ); - -extern Int32 -BZ2_decompress ( DState* ); - -extern void -BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, - Int32, Int32, Int32 ); - - -#endif - - -/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ - -#ifdef BZ_NO_STDIO -#ifndef NULL -#define NULL 0 -#endif -#endif - - -/*-------------------------------------------------------------*/ -/*--- end bzlib_private.h ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/common.mak b/src/lib/dl/ext/bzip2/common.mak deleted file mode 100755 index 25049cd1..00000000 --- a/src/lib/dl/ext/bzip2/common.mak +++ /dev/null @@ -1,41 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_BZIP2_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)blocksrt.obj $(SUBDIR)$(HPS)bzlib.obj $(SUBDIR)$(HPS)compress.obj $(SUBDIR)$(HPS)crctable.obj $(SUBDIR)$(HPS)decomprs.obj $(SUBDIR)$(HPS)huffman.obj $(SUBDIR)$(HPS)randtabl.obj - -!ifndef EXT_BZIP2_LIB_NO_EXE -$(EXT_BZIP2_LIB_BZIP2_EXE): $(EXT_BZIP2_LIB) $(SUBDIR)$(HPS)bzip2.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)bzip2.obj library $(EXT_BZIP2_LIB) name $(EXT_BZIP2_LIB_BZIP2_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe - -$(EXT_BZIP2_LIB_BZIP2REC_EXE): $(EXT_BZIP2_LIB) $(SUBDIR)$(HPS)bzip2rec.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)bzip2rec.obj library $(EXT_BZIP2_LIB) name $(EXT_BZIP2_LIB_BZIP2REC_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifndef EXT_BZIP2_LIB_NO_LIB -$(EXT_BZIP2_LIB): $(OBJS) - wlib -q -b -c $(EXT_BZIP2_LIB) -+$(SUBDIR)$(HPS)blocksrt.obj -+$(SUBDIR)$(HPS)bzlib.obj -+$(SUBDIR)$(HPS)compress.obj -+$(SUBDIR)$(HPS)crctable.obj -+$(SUBDIR)$(HPS)decomprs.obj -+$(SUBDIR)$(HPS)huffman.obj -+$(SUBDIR)$(HPS)randtabl.obj -!endif - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_BZIP2_LIB) .symbolic - -exe: $(EXT_BZIP2_LIB_BZIP2_EXE) $(EXT_BZIP2_LIB_BZIP2REC_EXE) .symbolic - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/bzip2/compress.c b/src/lib/dl/ext/bzip2/compress.c deleted file mode 100755 index 97134c8b..00000000 --- a/src/lib/dl/ext/bzip2/compress.c +++ /dev/null @@ -1,672 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Compression machinery (not incl block sorting) ---*/ -/*--- compress.c ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -/* CHANGES - 0.9.0 -- original version. - 0.9.0a/b -- no changes in this file. - 0.9.0c -- changed setting of nGroups in sendMTFValues() - so as to do a bit better on small files -*/ - -#include "bzlibprv.h" - - -/*---------------------------------------------------*/ -/*--- Bit stream I/O ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -void BZ2_bsInitWrite ( EState* s ) -{ - s->bsLive = 0; - s->bsBuff = 0; -} - - -/*---------------------------------------------------*/ -static -void bsFinishWrite ( EState* s ) -{ - while (s->bsLive > 0) { - s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24); - s->numZ++; - s->bsBuff <<= 8; - s->bsLive -= 8; - } -} - - -/*---------------------------------------------------*/ -#define bsNEEDW(nz) \ -{ \ - while (s->bsLive >= 8) { \ - s->zbits[s->numZ] \ - = (UChar)(s->bsBuff >> 24); \ - s->numZ++; \ - s->bsBuff <<= 8; \ - s->bsLive -= 8; \ - } \ -} - - -/*---------------------------------------------------*/ -static -__inline__ -void bsW ( EState* s, Int32 n, UInt32 v ) -{ - bsNEEDW ( n ); - s->bsBuff |= (v << (32 - s->bsLive - n)); - s->bsLive += n; -} - - -/*---------------------------------------------------*/ -static -void bsPutUInt32 ( EState* s, UInt32 u ) -{ - bsW ( s, 8, (u >> 24) & 0xffL ); - bsW ( s, 8, (u >> 16) & 0xffL ); - bsW ( s, 8, (u >> 8) & 0xffL ); - bsW ( s, 8, u & 0xffL ); -} - - -/*---------------------------------------------------*/ -static -void bsPutUChar ( EState* s, UChar c ) -{ - bsW( s, 8, (UInt32)c ); -} - - -/*---------------------------------------------------*/ -/*--- The back end proper ---*/ -/*---------------------------------------------------*/ - -/*---------------------------------------------------*/ -static -void makeMaps_e ( EState* s ) -{ - Int32 i; - s->nInUse = 0; - for (i = 0; i < 256; i++) - if (s->inUse[i]) { - s->unseqToSeq[i] = s->nInUse; - s->nInUse++; - } -} - - -/*---------------------------------------------------*/ -static -void generateMTFValues ( EState* s ) -{ - UChar yy[256]; - Int32 i, j; - Int32 zPend; - Int32 wr; - Int32 EOB; - - /* - After sorting (eg, here), - s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, - and - ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] - holds the original block data. - - The first thing to do is generate the MTF values, - and put them in - ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ]. - Because there are strictly fewer or equal MTF values - than block values, ptr values in this area are overwritten - with MTF values only when they are no longer needed. - - The final compressed bitstream is generated into the - area starting at - (UChar*) (&((UChar*)s->arr2)[s->nblock]) - - These storage aliases are set up in bzCompressInit(), - except for the last one, which is arranged in - compressBlock(). - */ - UInt32* ptr = s->ptr; - UChar* block = s->block; - UInt16* mtfv = s->mtfv; - - makeMaps_e ( s ); - EOB = s->nInUse+1; - - for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0; - - wr = 0; - zPend = 0; - for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i; - - for (i = 0; i < s->nblock; i++) { - UChar ll_i; - AssertD ( wr <= i, "generateMTFValues(1)" ); - j = ptr[i]-1; if (j < 0) j += s->nblock; - ll_i = s->unseqToSeq[block[j]]; - AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); - - if (yy[0] == ll_i) { - zPend++; - } else { - - if (zPend > 0) { - zPend--; - while (True) { - if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; - } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; - } - if (zPend < 2) break; - zPend = (zPend - 2) / 2; - }; - zPend = 0; - } - { - register UChar rtmp; - register UChar* ryy_j; - register UChar rll_i; - rtmp = yy[1]; - yy[1] = yy[0]; - ryy_j = &(yy[1]); - rll_i = ll_i; - while ( rll_i != rtmp ) { - register UChar rtmp2; - ryy_j++; - rtmp2 = rtmp; - rtmp = *ryy_j; - *ryy_j = rtmp2; - }; - yy[0] = rtmp; - j = ryy_j - &(yy[0]); - mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++; - } - - } - } - - if (zPend > 0) { - zPend--; - while (True) { - if (zPend & 1) { - mtfv[wr] = BZ_RUNB; wr++; - s->mtfFreq[BZ_RUNB]++; - } else { - mtfv[wr] = BZ_RUNA; wr++; - s->mtfFreq[BZ_RUNA]++; - } - if (zPend < 2) break; - zPend = (zPend - 2) / 2; - }; - zPend = 0; - } - - mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++; - - s->nMTF = wr; -} - - -/*---------------------------------------------------*/ -#define BZ_LESSER_ICOST 0 -#define BZ_GREATER_ICOST 15 - -static -void sendMTFValues ( EState* s ) -{ - Int32 v, t, i, j, gs, ge, totc, bt, bc, iter; - Int32 nSelectors, alphaSize, minLen, maxLen, selCtr; - Int32 nGroups, nBytes; - - /*-- - UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - is a global since the decoder also needs it. - - Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - are also globals only used in this proc. - Made global to keep stack frame size small. - --*/ - - - UInt16 cost[BZ_N_GROUPS]; - Int32 fave[BZ_N_GROUPS]; - - UInt16* mtfv = s->mtfv; - - if (s->verbosity >= 3) - VPrintf3( " %d in block, %d after MTF & 1-2 coding, " - "%d+2 syms in use\n", - s->nblock, s->nMTF, s->nInUse ); - - alphaSize = s->nInUse+2; - for (t = 0; t < BZ_N_GROUPS; t++) - for (v = 0; v < alphaSize; v++) - s->len[t][v] = BZ_GREATER_ICOST; - - /*--- Decide how many coding tables to use ---*/ - AssertH ( s->nMTF > 0, 3001 ); - if (s->nMTF < 200) nGroups = 2; else - if (s->nMTF < 600) nGroups = 3; else - if (s->nMTF < 1200) nGroups = 4; else - if (s->nMTF < 2400) nGroups = 5; else - nGroups = 6; - - /*--- Generate an initial set of coding tables ---*/ - { - Int32 nPart, remF, tFreq, aFreq; - - nPart = nGroups; - remF = s->nMTF; - gs = 0; - while (nPart > 0) { - tFreq = remF / nPart; - ge = gs-1; - aFreq = 0; - while (aFreq < tFreq && ge < alphaSize-1) { - ge++; - aFreq += s->mtfFreq[ge]; - } - - if (ge > gs - && nPart != nGroups && nPart != 1 - && ((nGroups-nPart) % 2 == 1)) { - aFreq -= s->mtfFreq[ge]; - ge--; - } - - if (s->verbosity >= 3) - VPrintf5( " initial group %d, [%d .. %d], " - "has %d syms (%4.1f%%)\n", - nPart, gs, ge, aFreq, - (100.0 * (float)aFreq) / (float)(s->nMTF) ); - - for (v = 0; v < alphaSize; v++) - if (v >= gs && v <= ge) - s->len[nPart-1][v] = BZ_LESSER_ICOST; else - s->len[nPart-1][v] = BZ_GREATER_ICOST; - - nPart--; - gs = ge+1; - remF -= aFreq; - } - } - - /*--- - Iterate up to BZ_N_ITERS times to improve the tables. - ---*/ - for (iter = 0; iter < BZ_N_ITERS; iter++) { - - for (t = 0; t < nGroups; t++) fave[t] = 0; - - for (t = 0; t < nGroups; t++) - for (v = 0; v < alphaSize; v++) - s->rfreq[t][v] = 0; - - /*--- - Set up an auxiliary length table which is used to fast-track - the common case (nGroups == 6). - ---*/ - if (nGroups == 6) { - for (v = 0; v < alphaSize; v++) { - s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; - s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; - s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; - } - } - - nSelectors = 0; - totc = 0; - gs = 0; - while (True) { - - /*--- Set group start & end marks. --*/ - if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; - if (ge >= s->nMTF) ge = s->nMTF-1; - - /*-- - Calculate the cost of this group as coded - by each of the coding tables. - --*/ - for (t = 0; t < nGroups; t++) cost[t] = 0; - - if (nGroups == 6 && 50 == ge-gs+1) { - /*--- fast track the common case ---*/ - register UInt32 cost01, cost23, cost45; - register UInt16 icv; - cost01 = cost23 = cost45 = 0; - -# define BZ_ITER(nn) \ - icv = mtfv[gs+(nn)]; \ - cost01 += s->len_pack[icv][0]; \ - cost23 += s->len_pack[icv][1]; \ - cost45 += s->len_pack[icv][2]; \ - - BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4); - BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9); - BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14); - BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19); - BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24); - BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29); - BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34); - BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39); - BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44); - BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49); - -# undef BZ_ITER - - cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; - cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; - cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; - - } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) { - UInt16 icv = mtfv[i]; - for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; - } - } - - /*-- - Find the coding table which is best for this group, - and record its identity in the selector table. - --*/ - bc = 999999999; bt = -1; - for (t = 0; t < nGroups; t++) - if (cost[t] < bc) { bc = cost[t]; bt = t; }; - totc += bc; - fave[bt]++; - s->selector[nSelectors] = bt; - nSelectors++; - - /*-- - Increment the symbol frequencies for the selected table. - --*/ - if (nGroups == 6 && 50 == ge-gs+1) { - /*--- fast track the common case ---*/ - -# define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++ - - BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4); - BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9); - BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14); - BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19); - BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24); - BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29); - BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34); - BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39); - BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44); - BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49); - -# undef BZ_ITUR - - } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) - s->rfreq[bt][ mtfv[i] ]++; - } - - gs = ge+1; - } - if (s->verbosity >= 3) { - VPrintf2 ( " pass %d: size is %d, grp uses are ", - iter+1, totc/8 ); - for (t = 0; t < nGroups; t++) - VPrintf1 ( "%d ", fave[t] ); - VPrintf0 ( "\n" ); - } - - /*-- - Recompute the tables based on the accumulated frequencies. - --*/ - /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See - comment in huffman.c for details. */ - for (t = 0; t < nGroups; t++) - BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), - alphaSize, 17 /*20*/ ); - } - - - AssertH( nGroups < 8, 3002 ); - AssertH( nSelectors < 32768 && - nSelectors <= (2 + (900000 / BZ_G_SIZE)), - 3003 ); - - - /*--- Compute MTF values for the selectors. ---*/ - { - UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp; - for (i = 0; i < nGroups; i++) pos[i] = i; - for (i = 0; i < nSelectors; i++) { - ll_i = s->selector[i]; - j = 0; - tmp = pos[j]; - while ( ll_i != tmp ) { - j++; - tmp2 = tmp; - tmp = pos[j]; - pos[j] = tmp2; - }; - pos[0] = tmp; - s->selectorMtf[i] = j; - } - }; - - /*--- Assign actual codes for the tables. --*/ - for (t = 0; t < nGroups; t++) { - minLen = 32; - maxLen = 0; - for (i = 0; i < alphaSize; i++) { - if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; - if (s->len[t][i] < minLen) minLen = s->len[t][i]; - } - AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); - AssertH ( !(minLen < 1), 3005 ); - BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), - minLen, maxLen, alphaSize ); - } - - /*--- Transmit the mapping table. ---*/ - { - Bool inUse16[16]; - for (i = 0; i < 16; i++) { - inUse16[i] = False; - for (j = 0; j < 16; j++) - if (s->inUse[i * 16 + j]) inUse16[i] = True; - } - - nBytes = s->numZ; - for (i = 0; i < 16; i++) - if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); - - for (i = 0; i < 16; i++) - if (inUse16[i]) - for (j = 0; j < 16; j++) { - if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); - } - - if (s->verbosity >= 3) - VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); - } - - /*--- Now the selectors. ---*/ - nBytes = s->numZ; - bsW ( s, 3, nGroups ); - bsW ( s, 15, nSelectors ); - for (i = 0; i < nSelectors; i++) { - for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); - bsW(s,1,0); - } - if (s->verbosity >= 3) - VPrintf1( "selectors %d, ", s->numZ-nBytes ); - - /*--- Now the coding tables. ---*/ - nBytes = s->numZ; - - for (t = 0; t < nGroups; t++) { - Int32 curr = s->len[t][0]; - bsW ( s, 5, curr ); - for (i = 0; i < alphaSize; i++) { - while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ }; - while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ }; - bsW ( s, 1, 0 ); - } - } - - if (s->verbosity >= 3) - VPrintf1 ( "code lengths %d, ", s->numZ-nBytes ); - - /*--- And finally, the block data proper ---*/ - nBytes = s->numZ; - selCtr = 0; - gs = 0; - while (True) { - if (gs >= s->nMTF) break; - ge = gs + BZ_G_SIZE - 1; - if (ge >= s->nMTF) ge = s->nMTF-1; - AssertH ( s->selector[selCtr] < nGroups, 3006 ); - - if (nGroups == 6 && 50 == ge-gs+1) { - /*--- fast track the common case ---*/ - UInt16 mtfv_i; - UChar* s_len_sel_selCtr - = &(s->len[s->selector[selCtr]][0]); - Int32* s_code_sel_selCtr - = &(s->code[s->selector[selCtr]][0]); - -# define BZ_ITAH(nn) \ - mtfv_i = mtfv[gs+(nn)]; \ - bsW ( s, \ - s_len_sel_selCtr[mtfv_i], \ - s_code_sel_selCtr[mtfv_i] ) - - BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4); - BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9); - BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14); - BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19); - BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24); - BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29); - BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34); - BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39); - BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44); - BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49); - -# undef BZ_ITAH - - } else { - /*--- slow version which correctly handles all situations ---*/ - for (i = gs; i <= ge; i++) { - bsW ( s, - s->len [s->selector[selCtr]] [mtfv[i]], - s->code [s->selector[selCtr]] [mtfv[i]] ); - } - } - - - gs = ge+1; - selCtr++; - } - AssertH( selCtr == nSelectors, 3007 ); - - if (s->verbosity >= 3) - VPrintf1( "codes %d\n", s->numZ-nBytes ); -} - - -/*---------------------------------------------------*/ -void BZ2_compressBlock ( EState* s, Bool is_last_block ) -{ - if (s->nblock > 0) { - - BZ_FINALISE_CRC ( s->blockCRC ); - s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31); - s->combinedCRC ^= s->blockCRC; - if (s->blockNo > 1) s->numZ = 0; - - if (s->verbosity >= 2) - VPrintf4( " block %d: crc = 0x%08x, " - "combined CRC = 0x%08x, size = %d\n", - s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); - - BZ2_blockSort ( s ); - } - - s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]); - - /*-- If this is the first block, create the stream header. --*/ - if (s->blockNo == 1) { - BZ2_bsInitWrite ( s ); - bsPutUChar ( s, BZ_HDR_B ); - bsPutUChar ( s, BZ_HDR_Z ); - bsPutUChar ( s, BZ_HDR_h ); - bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) ); - } - - if (s->nblock > 0) { - - bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 ); - bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 ); - bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 ); - - /*-- Now the block's CRC, so it is in a known place. --*/ - bsPutUInt32 ( s, s->blockCRC ); - - /*-- - Now a single bit indicating (non-)randomisation. - As of version 0.9.5, we use a better sorting algorithm - which makes randomisation unnecessary. So always set - the randomised bit to 'no'. Of course, the decoder - still needs to be able to handle randomised blocks - so as to maintain backwards compatibility with - older versions of bzip2. - --*/ - bsW(s,1,0); - - bsW ( s, 24, s->origPtr ); - generateMTFValues ( s ); - sendMTFValues ( s ); - } - - - /*-- If this is the last block, add the stream trailer. --*/ - if (is_last_block) { - - bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 ); - bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 ); - bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); - bsPutUInt32 ( s, s->combinedCRC ); - if (s->verbosity >= 2) - VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC ); - bsFinishWrite ( s ); - } -} - - -/*-------------------------------------------------------------*/ -/*--- end compress.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/crctable.c b/src/lib/dl/ext/bzip2/crctable.c deleted file mode 100755 index 90268c16..00000000 --- a/src/lib/dl/ext/bzip2/crctable.c +++ /dev/null @@ -1,104 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Table for doing CRCs ---*/ -/*--- crctable.c ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#include "bzlibprv.h" - -/*-- - I think this is an implementation of the AUTODIN-II, - Ethernet & FDDI 32-bit CRC standard. Vaguely derived - from code by Rob Warnock, in Section 51 of the - comp.compression FAQ. ---*/ - -UInt32 BZ2_crc32Table[256] = { - - /*-- Ugly, innit? --*/ - - 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L, - 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L, - 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L, - 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL, - 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L, - 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L, - 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L, - 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL, - 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L, - 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L, - 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L, - 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL, - 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L, - 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L, - 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L, - 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL, - 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL, - 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L, - 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L, - 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL, - 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL, - 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L, - 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L, - 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL, - 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL, - 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L, - 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L, - 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL, - 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL, - 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L, - 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L, - 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL, - 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L, - 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL, - 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL, - 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L, - 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L, - 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL, - 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL, - 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L, - 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L, - 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL, - 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL, - 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L, - 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L, - 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL, - 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL, - 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L, - 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L, - 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL, - 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L, - 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L, - 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L, - 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL, - 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L, - 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L, - 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L, - 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL, - 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L, - 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L, - 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L, - 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL, - 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L, - 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L -}; - - -/*-------------------------------------------------------------*/ -/*--- end crctable.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/decomprs.c b/src/lib/dl/ext/bzip2/decomprs.c deleted file mode 100755 index 91092fed..00000000 --- a/src/lib/dl/ext/bzip2/decomprs.c +++ /dev/null @@ -1,646 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Decompression machinery ---*/ -/*--- decompress.c ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#include "bzlibprv.h" - - -/*---------------------------------------------------*/ -static -void makeMaps_d ( DState* s ) -{ - Int32 i; - s->nInUse = 0; - for (i = 0; i < 256; i++) - if (s->inUse[i]) { - s->seqToUnseq[s->nInUse] = i; - s->nInUse++; - } -} - - -/*---------------------------------------------------*/ -#define RETURN(rrr) \ - { retVal = rrr; goto save_state_and_return; }; - -#define GET_BITS(lll,vvv,nnn) \ - case lll: s->state = lll; \ - while (True) { \ - if (s->bsLive >= nnn) { \ - UInt32 v; \ - v = (s->bsBuff >> \ - (s->bsLive-nnn)) & ((1 << nnn)-1); \ - s->bsLive -= nnn; \ - vvv = v; \ - break; \ - } \ - if (s->strm->avail_in == 0) RETURN(BZ_OK); \ - s->bsBuff \ - = (s->bsBuff << 8) | \ - ((UInt32) \ - (*((UChar*)(s->strm->next_in)))); \ - s->bsLive += 8; \ - s->strm->next_in++; \ - s->strm->avail_in--; \ - s->strm->total_in_lo32++; \ - if (s->strm->total_in_lo32 == 0) \ - s->strm->total_in_hi32++; \ - } - -#define GET_UCHAR(lll,uuu) \ - GET_BITS(lll,uuu,8) - -#define GET_BIT(lll,uuu) \ - GET_BITS(lll,uuu,1) - -/*---------------------------------------------------*/ -#define GET_MTF_VAL(label1,label2,lval) \ -{ \ - if (groupPos == 0) { \ - groupNo++; \ - if (groupNo >= nSelectors) \ - RETURN(BZ_DATA_ERROR); \ - groupPos = BZ_G_SIZE; \ - gSel = s->selector[groupNo]; \ - gMinlen = s->minLens[gSel]; \ - gLimit = &(s->limit[gSel][0]); \ - gPerm = &(s->perm[gSel][0]); \ - gBase = &(s->base[gSel][0]); \ - } \ - groupPos--; \ - zn = gMinlen; \ - GET_BITS(label1, zvec, zn); \ - while (1) { \ - if (zn > 20 /* the longest code */) \ - RETURN(BZ_DATA_ERROR); \ - if (zvec <= gLimit[zn]) break; \ - zn++; \ - GET_BIT(label2, zj); \ - zvec = (zvec << 1) | zj; \ - }; \ - if (zvec - gBase[zn] < 0 \ - || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \ - RETURN(BZ_DATA_ERROR); \ - lval = gPerm[zvec - gBase[zn]]; \ -} - - -/*---------------------------------------------------*/ -Int32 BZ2_decompress ( DState* s ) -{ - UChar uc; - Int32 retVal; - Int32 minLen, maxLen; - bz_stream* strm = s->strm; - - /* stuff that needs to be saved/restored */ - Int32 i; - Int32 j; - Int32 t; - Int32 alphaSize; - Int32 nGroups; - Int32 nSelectors; - Int32 EOB; - Int32 groupNo; - Int32 groupPos; - Int32 nextSym; - Int32 nblockMAX; - Int32 nblock; - Int32 es; - Int32 N; - Int32 curr; - Int32 zt; - Int32 zn; - Int32 zvec; - Int32 zj; - Int32 gSel; - Int32 gMinlen; - Int32* gLimit; - Int32* gBase; - Int32* gPerm; - - if (s->state == BZ_X_MAGIC_1) { - /*initialise the save area*/ - s->save_i = 0; - s->save_j = 0; - s->save_t = 0; - s->save_alphaSize = 0; - s->save_nGroups = 0; - s->save_nSelectors = 0; - s->save_EOB = 0; - s->save_groupNo = 0; - s->save_groupPos = 0; - s->save_nextSym = 0; - s->save_nblockMAX = 0; - s->save_nblock = 0; - s->save_es = 0; - s->save_N = 0; - s->save_curr = 0; - s->save_zt = 0; - s->save_zn = 0; - s->save_zvec = 0; - s->save_zj = 0; - s->save_gSel = 0; - s->save_gMinlen = 0; - s->save_gLimit = NULL; - s->save_gBase = NULL; - s->save_gPerm = NULL; - } - - /*restore from the save area*/ - i = s->save_i; - j = s->save_j; - t = s->save_t; - alphaSize = s->save_alphaSize; - nGroups = s->save_nGroups; - nSelectors = s->save_nSelectors; - EOB = s->save_EOB; - groupNo = s->save_groupNo; - groupPos = s->save_groupPos; - nextSym = s->save_nextSym; - nblockMAX = s->save_nblockMAX; - nblock = s->save_nblock; - es = s->save_es; - N = s->save_N; - curr = s->save_curr; - zt = s->save_zt; - zn = s->save_zn; - zvec = s->save_zvec; - zj = s->save_zj; - gSel = s->save_gSel; - gMinlen = s->save_gMinlen; - gLimit = s->save_gLimit; - gBase = s->save_gBase; - gPerm = s->save_gPerm; - - retVal = BZ_OK; - - switch (s->state) { - - GET_UCHAR(BZ_X_MAGIC_1, uc); - if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC); - - GET_UCHAR(BZ_X_MAGIC_2, uc); - if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC); - - GET_UCHAR(BZ_X_MAGIC_3, uc) - if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); - - GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) - if (s->blockSize100k < (BZ_HDR_0 + 1) || - s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); - s->blockSize100k -= BZ_HDR_0; - - if (s->smallDecompress) { - s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); - s->ll4 = BZALLOC( - ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) - ); - if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); - } else { - s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) ); - if (s->tt == NULL) RETURN(BZ_MEM_ERROR); - } - - GET_UCHAR(BZ_X_BLKHDR_1, uc); - - if (uc == 0x17) goto endhdr_2; - if (uc != 0x31) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_2, uc); - if (uc != 0x41) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_3, uc); - if (uc != 0x59) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_4, uc); - if (uc != 0x26) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_5, uc); - if (uc != 0x53) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_BLKHDR_6, uc); - if (uc != 0x59) RETURN(BZ_DATA_ERROR); - - s->currBlockNo++; - if (s->verbosity >= 2) - VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); - - s->storedBlockCRC = 0; - GET_UCHAR(BZ_X_BCRC_1, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_BCRC_2, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_BCRC_3, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_BCRC_4, uc); - s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); - - GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); - - s->origPtr = 0; - GET_UCHAR(BZ_X_ORIGPTR_1, uc); - s->origPtr = (s->origPtr << 8) | ((Int32)uc); - GET_UCHAR(BZ_X_ORIGPTR_2, uc); - s->origPtr = (s->origPtr << 8) | ((Int32)uc); - GET_UCHAR(BZ_X_ORIGPTR_3, uc); - s->origPtr = (s->origPtr << 8) | ((Int32)uc); - - if (s->origPtr < 0) - RETURN(BZ_DATA_ERROR); - if (s->origPtr > 10 + 100000*s->blockSize100k) - RETURN(BZ_DATA_ERROR); - - /*--- Receive the mapping table ---*/ - for (i = 0; i < 16; i++) { - GET_BIT(BZ_X_MAPPING_1, uc); - if (uc == 1) - s->inUse16[i] = True; else - s->inUse16[i] = False; - } - - for (i = 0; i < 256; i++) s->inUse[i] = False; - - for (i = 0; i < 16; i++) - if (s->inUse16[i]) - for (j = 0; j < 16; j++) { - GET_BIT(BZ_X_MAPPING_2, uc); - if (uc == 1) s->inUse[i * 16 + j] = True; - } - makeMaps_d ( s ); - if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); - alphaSize = s->nInUse+2; - - /*--- Now the selectors ---*/ - GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); - if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); - GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); - if (nSelectors < 1) RETURN(BZ_DATA_ERROR); - for (i = 0; i < nSelectors; i++) { - j = 0; - while (True) { - GET_BIT(BZ_X_SELECTOR_3, uc); - if (uc == 0) break; - j++; - if (j >= nGroups) RETURN(BZ_DATA_ERROR); - } - s->selectorMtf[i] = j; - } - - /*--- Undo the MTF values for the selectors. ---*/ - { - UChar pos[BZ_N_GROUPS], tmp, v; - for (v = 0; v < nGroups; v++) pos[v] = v; - - for (i = 0; i < nSelectors; i++) { - v = s->selectorMtf[i]; - tmp = pos[v]; - while (v > 0) { pos[v] = pos[v-1]; v--; } - pos[0] = tmp; - s->selector[i] = tmp; - } - } - - /*--- Now the coding tables ---*/ - for (t = 0; t < nGroups; t++) { - GET_BITS(BZ_X_CODING_1, curr, 5); - for (i = 0; i < alphaSize; i++) { - while (True) { - if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); - GET_BIT(BZ_X_CODING_2, uc); - if (uc == 0) break; - GET_BIT(BZ_X_CODING_3, uc); - if (uc == 0) curr++; else curr--; - } - s->len[t][i] = curr; - } - } - - /*--- Create the Huffman decoding tables ---*/ - for (t = 0; t < nGroups; t++) { - minLen = 32; - maxLen = 0; - for (i = 0; i < alphaSize; i++) { - if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; - if (s->len[t][i] < minLen) minLen = s->len[t][i]; - } - BZ2_hbCreateDecodeTables ( - &(s->limit[t][0]), - &(s->base[t][0]), - &(s->perm[t][0]), - &(s->len[t][0]), - minLen, maxLen, alphaSize - ); - s->minLens[t] = minLen; - } - - /*--- Now the MTF values ---*/ - - EOB = s->nInUse+1; - nblockMAX = 100000 * s->blockSize100k; - groupNo = -1; - groupPos = 0; - - for (i = 0; i <= 255; i++) s->unzftab[i] = 0; - - /*-- MTF init --*/ - { - Int32 ii, jj, kk; - kk = MTFA_SIZE-1; - for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { - for (jj = MTFL_SIZE-1; jj >= 0; jj--) { - s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj); - kk--; - } - s->mtfbase[ii] = kk + 1; - } - } - /*-- end MTF init --*/ - - nblock = 0; - GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); - - while (True) { - - if (nextSym == EOB) break; - - if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { - - es = -1; - N = 1; - do { - /* Check that N doesn't get too big, so that es doesn't - go negative. The maximum value that can be - RUNA/RUNB encoded is equal to the block size (post - the initial RLE), viz, 900k, so bounding N at 2 - million should guard against overflow without - rejecting any legitimate inputs. */ - if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); - if (nextSym == BZ_RUNA) es = es + (0+1) * N; else - if (nextSym == BZ_RUNB) es = es + (1+1) * N; - N = N * 2; - GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); - } - while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); - - es++; - uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ]; - s->unzftab[uc] += es; - - if (s->smallDecompress) - while (es > 0) { - if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); - s->ll16[nblock] = (UInt16)uc; - nblock++; - es--; - } - else - while (es > 0) { - if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); - s->tt[nblock] = (UInt32)uc; - nblock++; - es--; - }; - - continue; - - } else { - - if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); - - /*-- uc = MTF ( nextSym-1 ) --*/ - { - Int32 ii, jj, kk, pp, lno, off; - UInt32 nn; - nn = (UInt32)(nextSym - 1); - - if (nn < MTFL_SIZE) { - /* avoid general-case expense */ - pp = s->mtfbase[0]; - uc = s->mtfa[pp+nn]; - while (nn > 3) { - Int32 z = pp+nn; - s->mtfa[(z) ] = s->mtfa[(z)-1]; - s->mtfa[(z)-1] = s->mtfa[(z)-2]; - s->mtfa[(z)-2] = s->mtfa[(z)-3]; - s->mtfa[(z)-3] = s->mtfa[(z)-4]; - nn -= 4; - } - while (nn > 0) { - s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; - }; - s->mtfa[pp] = uc; - } else { - /* general case */ - lno = nn / MTFL_SIZE; - off = nn % MTFL_SIZE; - pp = s->mtfbase[lno] + off; - uc = s->mtfa[pp]; - while (pp > s->mtfbase[lno]) { - s->mtfa[pp] = s->mtfa[pp-1]; pp--; - }; - s->mtfbase[lno]++; - while (lno > 0) { - s->mtfbase[lno]--; - s->mtfa[s->mtfbase[lno]] - = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; - lno--; - } - s->mtfbase[0]--; - s->mtfa[s->mtfbase[0]] = uc; - if (s->mtfbase[0] == 0) { - kk = MTFA_SIZE-1; - for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { - for (jj = MTFL_SIZE-1; jj >= 0; jj--) { - s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; - kk--; - } - s->mtfbase[ii] = kk + 1; - } - } - } - } - /*-- end uc = MTF ( nextSym-1 ) --*/ - - s->unzftab[s->seqToUnseq[uc]]++; - if (s->smallDecompress) - s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else - s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]); - nblock++; - - GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); - continue; - } - } - - /* Now we know what nblock is, we can do a better sanity - check on s->origPtr. - */ - if (s->origPtr < 0 || s->origPtr >= nblock) - RETURN(BZ_DATA_ERROR); - - /*-- Set up cftab to facilitate generation of T^(-1) --*/ - /* Check: unzftab entries in range. */ - for (i = 0; i <= 255; i++) { - if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) - RETURN(BZ_DATA_ERROR); - } - /* Actually generate cftab. */ - s->cftab[0] = 0; - for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; - for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; - /* Check: cftab entries in range. */ - for (i = 0; i <= 256; i++) { - if (s->cftab[i] < 0 || s->cftab[i] > nblock) { - /* s->cftab[i] can legitimately be == nblock */ - RETURN(BZ_DATA_ERROR); - } - } - /* Check: cftab entries non-descending. */ - for (i = 1; i <= 256; i++) { - if (s->cftab[i-1] > s->cftab[i]) { - RETURN(BZ_DATA_ERROR); - } - } - - s->state_out_len = 0; - s->state_out_ch = 0; - BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); - s->state = BZ_X_OUTPUT; - if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); - - if (s->smallDecompress) { - - /*-- Make a copy of cftab, used in generation of T --*/ - for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; - - /*-- compute the T vector --*/ - for (i = 0; i < nblock; i++) { - uc = (UChar)(s->ll16[i]); - SET_LL(i, s->cftabCopy[uc]); - s->cftabCopy[uc]++; - } - - /*-- Compute T^(-1) by pointer reversal on T --*/ - i = s->origPtr; - j = GET_LL(i); - do { - Int32 tmp = GET_LL(j); - SET_LL(j, i); - i = j; - j = tmp; - } - while (i != s->origPtr); - - s->tPos = s->origPtr; - s->nblock_used = 0; - if (s->blockRandomised) { - BZ_RAND_INIT_MASK; - BZ_GET_SMALL(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; - } else { - BZ_GET_SMALL(s->k0); s->nblock_used++; - } - - } else { - - /*-- compute the T^(-1) vector --*/ - for (i = 0; i < nblock; i++) { - uc = (UChar)(s->tt[i] & 0xff); - s->tt[s->cftab[uc]] |= (i << 8); - s->cftab[uc]++; - } - - s->tPos = s->tt[s->origPtr] >> 8; - s->nblock_used = 0; - if (s->blockRandomised) { - BZ_RAND_INIT_MASK; - BZ_GET_FAST(s->k0); s->nblock_used++; - BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; - } else { - BZ_GET_FAST(s->k0); s->nblock_used++; - } - - } - - RETURN(BZ_OK); - - - - endhdr_2: - - GET_UCHAR(BZ_X_ENDHDR_2, uc); - if (uc != 0x72) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_3, uc); - if (uc != 0x45) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_4, uc); - if (uc != 0x38) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_5, uc); - if (uc != 0x50) RETURN(BZ_DATA_ERROR); - GET_UCHAR(BZ_X_ENDHDR_6, uc); - if (uc != 0x90) RETURN(BZ_DATA_ERROR); - - s->storedCombinedCRC = 0; - GET_UCHAR(BZ_X_CCRC_1, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_CCRC_2, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_CCRC_3, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - GET_UCHAR(BZ_X_CCRC_4, uc); - s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); - - s->state = BZ_X_IDLE; - RETURN(BZ_STREAM_END); - - default: AssertH ( False, 4001 ); - } - - AssertH ( False, 4002 ); - - save_state_and_return: - - s->save_i = i; - s->save_j = j; - s->save_t = t; - s->save_alphaSize = alphaSize; - s->save_nGroups = nGroups; - s->save_nSelectors = nSelectors; - s->save_EOB = EOB; - s->save_groupNo = groupNo; - s->save_groupPos = groupPos; - s->save_nextSym = nextSym; - s->save_nblockMAX = nblockMAX; - s->save_nblock = nblock; - s->save_es = es; - s->save_N = N; - s->save_curr = curr; - s->save_zt = zt; - s->save_zn = zn; - s->save_zvec = zvec; - s->save_zj = zj; - s->save_gSel = gSel; - s->save_gMinlen = gMinlen; - s->save_gLimit = gLimit; - s->save_gBase = gBase; - s->save_gPerm = gPerm; - - return retVal; -} - - -/*-------------------------------------------------------------*/ -/*--- end decompress.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/huffman.c b/src/lib/dl/ext/bzip2/huffman.c deleted file mode 100755 index 3696b457..00000000 --- a/src/lib/dl/ext/bzip2/huffman.c +++ /dev/null @@ -1,205 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Huffman coding low-level stuff ---*/ -/*--- huffman.c ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#include "bzlibprv.h" - -/*---------------------------------------------------*/ -#define WEIGHTOF(zz0) ((zz0) & 0xffffff00) -#define DEPTHOF(zz1) ((zz1) & 0x000000ff) -#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3)) - -#define ADDWEIGHTS(zw1,zw2) \ - (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \ - (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2))) - -#define UPHEAP(z) \ -{ \ - Int32 zz, tmp; \ - zz = z; tmp = heap[zz]; \ - while (weight[tmp] < weight[heap[zz >> 1]]) { \ - heap[zz] = heap[zz >> 1]; \ - zz >>= 1; \ - } \ - heap[zz] = tmp; \ -} - -#define DOWNHEAP(z) \ -{ \ - Int32 zz, yy, tmp; \ - zz = z; tmp = heap[zz]; \ - while (True) { \ - yy = zz << 1; \ - if (yy > nHeap) break; \ - if (yy < nHeap && \ - weight[heap[yy+1]] < weight[heap[yy]]) \ - yy++; \ - if (weight[tmp] < weight[heap[yy]]) break; \ - heap[zz] = heap[yy]; \ - zz = yy; \ - } \ - heap[zz] = tmp; \ -} - - -/*---------------------------------------------------*/ -void BZ2_hbMakeCodeLengths ( UChar *len, - Int32 *freq, - Int32 alphaSize, - Int32 maxLen ) -{ - /*-- - Nodes and heap entries run from 1. Entry 0 - for both the heap and nodes is a sentinel. - --*/ - Int32 nNodes, nHeap, n1, n2, i, j, k; - Bool tooLong; - - Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; - Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; - Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; - - for (i = 0; i < alphaSize; i++) - weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; - - while (True) { - - nNodes = alphaSize; - nHeap = 0; - - heap[0] = 0; - weight[0] = 0; - parent[0] = -2; - - for (i = 1; i <= alphaSize; i++) { - parent[i] = -1; - nHeap++; - heap[nHeap] = i; - UPHEAP(nHeap); - } - - AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); - - while (nHeap > 1) { - n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); - n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); - nNodes++; - parent[n1] = parent[n2] = nNodes; - weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]); - parent[nNodes] = -1; - nHeap++; - heap[nHeap] = nNodes; - UPHEAP(nHeap); - } - - AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 ); - - tooLong = False; - for (i = 1; i <= alphaSize; i++) { - j = 0; - k = i; - while (parent[k] >= 0) { k = parent[k]; j++; } - len[i-1] = j; - if (j > maxLen) tooLong = True; - } - - if (! tooLong) break; - - /* 17 Oct 04: keep-going condition for the following loop used - to be 'i < alphaSize', which missed the last element, - theoretically leading to the possibility of the compressor - looping. However, this count-scaling step is only needed if - one of the generated Huffman code words is longer than - maxLen, which up to and including version 1.0.2 was 20 bits, - which is extremely unlikely. In version 1.0.3 maxLen was - changed to 17 bits, which has minimal effect on compression - ratio, but does mean this scaling step is used from time to - time, enough to verify that it works. - - This means that bzip2-1.0.3 and later will only produce - Huffman codes with a maximum length of 17 bits. However, in - order to preserve backwards compatibility with bitstreams - produced by versions pre-1.0.3, the decompressor must still - handle lengths of up to 20. */ - - for (i = 1; i <= alphaSize; i++) { - j = weight[i] >> 8; - j = 1 + (j / 2); - weight[i] = j << 8; - } - } -} - - -/*---------------------------------------------------*/ -void BZ2_hbAssignCodes ( Int32 *code, - UChar *length, - Int32 minLen, - Int32 maxLen, - Int32 alphaSize ) -{ - Int32 n, vec, i; - - vec = 0; - for (n = minLen; n <= maxLen; n++) { - for (i = 0; i < alphaSize; i++) - if (length[i] == n) { code[i] = vec; vec++; }; - vec <<= 1; - } -} - - -/*---------------------------------------------------*/ -void BZ2_hbCreateDecodeTables ( Int32 *limit, - Int32 *base, - Int32 *perm, - UChar *length, - Int32 minLen, - Int32 maxLen, - Int32 alphaSize ) -{ - Int32 pp, i, j, vec; - - pp = 0; - for (i = minLen; i <= maxLen; i++) - for (j = 0; j < alphaSize; j++) - if (length[j] == i) { perm[pp] = j; pp++; }; - - for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0; - for (i = 0; i < alphaSize; i++) base[length[i]+1]++; - - for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1]; - - for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0; - vec = 0; - - for (i = minLen; i <= maxLen; i++) { - vec += (base[i+1] - base[i]); - limit[i] = vec-1; - vec <<= 1; - } - for (i = minLen + 1; i <= maxLen; i++) - base[i] = ((limit[i-1] + 1) << 1) - base[i]; -} - - -/*-------------------------------------------------------------*/ -/*--- end huffman.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/bzip2/randtabl.c b/src/lib/dl/ext/bzip2/randtabl.c deleted file mode 100755 index 71a82b34..00000000 --- a/src/lib/dl/ext/bzip2/randtabl.c +++ /dev/null @@ -1,84 +0,0 @@ - -/*-------------------------------------------------------------*/ -/*--- Table for randomising repetitive blocks ---*/ -/*--- randtable.c ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#include "bzlibprv.h" - - -/*---------------------------------------------*/ -Int32 BZ2_rNums[512] = { - 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, - 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, - 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, - 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, - 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, - 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, - 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, - 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, - 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, - 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, - 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, - 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, - 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, - 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, - 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, - 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, - 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, - 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, - 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, - 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, - 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, - 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, - 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, - 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, - 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, - 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, - 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, - 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, - 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, - 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, - 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, - 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, - 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, - 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, - 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, - 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, - 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, - 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, - 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, - 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, - 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, - 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, - 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, - 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, - 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, - 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, - 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, - 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, - 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, - 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, - 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, - 936, 638 -}; - - -/*-------------------------------------------------------------*/ -/*--- end randtable.c ---*/ -/*-------------------------------------------------------------*/ diff --git a/src/lib/dl/ext/clean.bat b/src/lib/dl/ext/clean.bat deleted file mode 100755 index da826805..00000000 --- a/src/lib/dl/ext/clean.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -if exist *.map del *.map -if exist *.obj del *.obj -if exist *.sym del *.sym -if exist *.exe del *.exe diff --git a/src/lib/dl/ext/flac/CLEAN.BAT b/src/lib/dl/ext/flac/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/flac/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/flac/MAKE.BAT b/src/lib/dl/ext/flac/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/flac/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/flac/all.h b/src/lib/dl/ext/flac/all.h deleted file mode 100755 index c542c0d5..00000000 --- a/src/lib/dl/ext/flac/all.h +++ /dev/null @@ -1,370 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 "format.h" -#include "metadata.h" -#include "ordinals.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 (for example /usr/include/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. - * - * libFLAC also supports encoding to and decoding from Ogg FLAC. - * However the metadata editing interfaces currently have limited - * read-only support for Ogg FLAC files. - * - * \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 (for - * example /usr/include/FLAC++/...). - * - * libFLAC++ is 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. - * - * If you prefer a more hands-on approach, you can jump right to some - * example code. - * - * \section porting_guide Porting Guide - * - * Starting with FLAC 1.1.3 a \link porting Porting Guide \endlink - * has been introduced which gives detailed instructions on how to - * port your code to newer versions of FLAC. - * - * \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 depend on the bitbuffer. - * - The decoder is independent of the encoder. The encoder uses the - * decoder because of the verify feature, but this can be removed if - * not needed. - * - Parts of the metadata interface require the stream decoder (but not - * the encoder). - * - Ogg support is selectable through the compile time macro - * \c FLAC__HAS_OGG. - * - * For example, if your application only requires the stream decoder, no - * encoder, and no metadata interface, you can remove the stream encoder - * and the metadata interface, which will greatly reduce the size of the - * library. - * - * Also, there are several places in the libFLAC code with comments marked - * with "OPT:" where a #define can be changed to enable code that might be - * faster on a specific platform. Experimenting with these can yield faster - * binaries. - */ - -/** \defgroup porting Porting Guide for New Versions - * - * This module describes differences in the library interfaces from - * version to version. It assists in the porting of code that uses - * the libraries to newer versions of FLAC. - * - * One simple facility for making porting easier that has been added - * in FLAC 1.1.3 is a set of \c #defines in \c export.h of each - * library's includes (e.g. \c include/FLAC/export.h). The - * \c #defines mirror the libraries' - * libtool version numbers, - * e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT, - * \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE. - * These can be used to support multiple versions of an API during the - * transition phase, e.g. - * - * \code - * #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7 - * legacy code - * #else - * new code - * #endif - * \endcode - * - * The the source will work for multiple versions and the legacy code can - * easily be removed when the transition is complete. - * - * Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in - * include/FLAC/export.h), which can be used to determine whether or not - * the library has been compiled with support for Ogg FLAC. This is - * simpler than trying to call an Ogg init function and catching the - * error. - */ - -/** \defgroup porting_1_1_2_to_1_1_3 Porting from FLAC 1.1.2 to 1.1.3 - * \ingroup porting - * - * \brief - * This module describes porting from FLAC 1.1.2 to FLAC 1.1.3. - * - * The main change between the APIs in 1.1.2 and 1.1.3 is that they have - * been simplified. First, libOggFLAC has been merged into libFLAC and - * libOggFLAC++ has been merged into libFLAC++. Second, both the three - * decoding layers and three encoding layers have been merged into a - * single stream decoder and stream encoder. That is, the functionality - * of FLAC__SeekableStreamDecoder and FLAC__FileDecoder has been merged - * into FLAC__StreamDecoder, and FLAC__SeekableStreamEncoder and - * FLAC__FileEncoder into FLAC__StreamEncoder. Only the - * FLAC__StreamDecoder and FLAC__StreamEncoder remain. What this means - * is there is now a single API that can be used to encode or decode - * streams to/from native FLAC or Ogg FLAC and the single API can work - * on both seekable and non-seekable streams. - * - * Instead of creating an encoder or decoder of a certain layer, now the - * client will always create a FLAC__StreamEncoder or - * FLAC__StreamDecoder. The old layers are now differentiated by the - * initialization function. For example, for the decoder, - * FLAC__stream_decoder_init() has been replaced by - * FLAC__stream_decoder_init_stream(). This init function takes - * callbacks for the I/O, and the seeking callbacks are optional. This - * allows the client to use the same object for seekable and - * non-seekable streams. For decoding a FLAC file directly, the client - * can use FLAC__stream_decoder_init_file() and pass just a filename - * and fewer callbacks; most of the other callbacks are supplied - * internally. For situations where fopen()ing by filename is not - * possible (e.g. Unicode filenames on Windows) the client can instead - * open the file itself and supply the FILE* to - * FLAC__stream_decoder_init_FILE(). The init functions now returns a - * FLAC__StreamDecoderInitStatus instead of FLAC__StreamDecoderState. - * Since the callbacks and client data are now passed to the init - * function, the FLAC__stream_decoder_set_*_callback() functions and - * FLAC__stream_decoder_set_client_data() are no longer needed. The - * rest of the calls to the decoder are the same as before. - * - * There are counterpart init functions for Ogg FLAC, e.g. - * FLAC__stream_decoder_init_ogg_stream(). All the rest of the calls - * and callbacks are the same as for native FLAC. - * - * As an example, in FLAC 1.1.2 a seekable stream decoder would have - * been set up like so: - * - * \code - * FLAC__SeekableStreamDecoder *decoder = FLAC__seekable_stream_decoder_new(); - * if(decoder == NULL) do_something; - * FLAC__seekable_stream_decoder_set_md5_checking(decoder, true); - * [... other settings ...] - * FLAC__seekable_stream_decoder_set_read_callback(decoder, my_read_callback); - * FLAC__seekable_stream_decoder_set_seek_callback(decoder, my_seek_callback); - * FLAC__seekable_stream_decoder_set_tell_callback(decoder, my_tell_callback); - * FLAC__seekable_stream_decoder_set_length_callback(decoder, my_length_callback); - * FLAC__seekable_stream_decoder_set_eof_callback(decoder, my_eof_callback); - * FLAC__seekable_stream_decoder_set_write_callback(decoder, my_write_callback); - * FLAC__seekable_stream_decoder_set_metadata_callback(decoder, my_metadata_callback); - * FLAC__seekable_stream_decoder_set_error_callback(decoder, my_error_callback); - * FLAC__seekable_stream_decoder_set_client_data(decoder, my_client_data); - * if(FLAC__seekable_stream_decoder_init(decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) do_something; - * \endcode - * - * In FLAC 1.1.3 it is like this: - * - * \code - * FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new(); - * if(decoder == NULL) do_something; - * FLAC__stream_decoder_set_md5_checking(decoder, true); - * [... other settings ...] - * if(FLAC__stream_decoder_init_stream( - * decoder, - * my_read_callback, - * my_seek_callback, // or NULL - * my_tell_callback, // or NULL - * my_length_callback, // or NULL - * my_eof_callback, // or NULL - * my_write_callback, - * my_metadata_callback, // or NULL - * my_error_callback, - * my_client_data - * ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something; - * \endcode - * - * or you could do; - * - * \code - * [...] - * FILE *file = fopen("somefile.flac","rb"); - * if(file == NULL) do_somthing; - * if(FLAC__stream_decoder_init_FILE( - * decoder, - * file, - * my_write_callback, - * my_metadata_callback, // or NULL - * my_error_callback, - * my_client_data - * ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something; - * \endcode - * - * or just: - * - * \code - * [...] - * if(FLAC__stream_decoder_init_file( - * decoder, - * "somefile.flac", - * my_write_callback, - * my_metadata_callback, // or NULL - * my_error_callback, - * my_client_data - * ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something; - * \endcode - * - * Another small change to the decoder is in how it handles unparseable - * streams. Before, when the decoder found an unparseable stream - * (reserved for when the decoder encounters a stream from a future - * encoder that it can't parse), it changed the state to - * \c FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. Now the decoder instead - * drops sync and calls the error callback with a new error code - * \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM. This is - * more robust. If your error callback does not discriminate on the the - * error state, your code does not need to be changed. - * - * The encoder now has a new setting: - * FLAC__stream_encoder_set_apodization(). This is for setting the - * method used to window the data before LPC analysis. You only need to - * add a call to this function if the default is not suitable. There - * are also two new convenience functions that may be useful: - * FLAC__metadata_object_cuesheet_calculate_cddb_id() and - * FLAC__metadata_get_cuesheet(). - * - * The \a bytes parameter to FLAC__StreamDecoderReadCallback, - * FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback - * is now \c size_t instead of \c unsigned. - */ - -/** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4 - * \ingroup porting - * - * \brief - * This module describes porting from FLAC 1.1.3 to FLAC 1.1.4. - * - * There were no changes to any of the interfaces from 1.1.3 to 1.1.4. - * There was a slight change in the implementation of - * FLAC__stream_encoder_set_metadata(); the function now makes a copy - * of the \a metadata array of pointers so the client no longer needs - * to maintain it after the call. The objects themselves that are - * pointed to by the array are still not copied though and must be - * maintained until the call to FLAC__stream_encoder_finish(). - */ - -/** \defgroup porting_1_1_4_to_1_2_0 Porting from FLAC 1.1.4 to 1.2.0 - * \ingroup porting - * - * \brief - * This module describes porting from FLAC 1.1.4 to FLAC 1.2.0. - * - * There were only very minor changes to the interfaces from 1.1.4 to 1.2.0. - * In libFLAC, \c FLAC__format_sample_rate_is_subset() was added. - * In libFLAC++, \c FLAC::Decoder::Stream::get_decode_position() was added. - * - * Finally, value of the constant \c FLAC__FRAME_HEADER_RESERVED_LEN - * has changed to reflect the conversion of one of the reserved bits - * into active use. It used to be \c 2 and now is \c 1. However the - * FLAC frame header length has not changed, so to skip the proper - * number of bits, use \c FLAC__FRAME_HEADER_RESERVED_LEN + - * \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN - */ - -/** \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/src/lib/dl/ext/flac/analyze.c b/src/lib/dl/ext/flac/analyze.c deleted file mode 100755 index 6640e5e1..00000000 --- a/src/lib/dl/ext/flac/analyze.c +++ /dev/null @@ -1,247 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include "flac/all.h" -#include "analyze.h" - -typedef struct { - FLAC__int32 residual; - unsigned count; -} pair_t; - -typedef struct { - pair_t buckets[FLAC__MAX_BLOCK_SIZE]; - int peak_index; - unsigned nbuckets; - unsigned nsamples; - double sum, sos; - double variance; - double mean; - double stddev; -} subframe_stats_t; - -static subframe_stats_t all_; - -static void init_stats(subframe_stats_t *stats); -static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr); -static void compute_stats(subframe_stats_t *stats); -static FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename); - -void flac__analyze_init(analysis_options aopts) -{ - if(aopts.do_residual_gnuplot) { - init_stats(&all_); - } -} - -void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout) -{ - const unsigned channels = frame->header.channels; - char outfilename[1024]; - subframe_stats_t stats; - unsigned i, channel, partitions; - - /* do the human-readable part first */ -#ifdef _MSC_VER - fprintf(fout, "frame=%u\toffset=%I64u\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]); -#else - fprintf(fout, "frame=%u\toffset=%llu\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, (unsigned long long)frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]); -#endif - for(channel = 0; channel < channels; channel++) { - const FLAC__Subframe *subframe = frame->subframes+channel; - const FLAC__bool is_rice2 = subframe->data.fixed.entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2; - const unsigned pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; - fprintf(fout, "\tsubframe=%u\twasted_bits=%u\ttype=%s", channel, subframe->wasted_bits, FLAC__SubframeTypeString[subframe->type]); - switch(subframe->type) { - case FLAC__SUBFRAME_TYPE_CONSTANT: - fprintf(fout, "\tvalue=%d\n", subframe->data.constant.value); - break; - case FLAC__SUBFRAME_TYPE_FIXED: - FLAC__ASSERT(subframe->data.fixed.entropy_coding_method.type <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2); - fprintf(fout, "\torder=%u\tresidual_type=%s\tpartition_order=%u\n", subframe->data.fixed.order, is_rice2? "RICE2":"RICE", subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order); - for(i = 0; i < subframe->data.fixed.order; i++) - fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.fixed.warmup[i]); - partitions = (1u << subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order); - for(i = 0; i < partitions; i++) { - unsigned parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i]; - if(parameter == pesc) - fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]); - else - fprintf(fout, "\t\tparameter[%u]=%u\n", i, parameter); - } - if(aopts.do_residual_text) { - for(i = 0; i < frame->header.blocksize-subframe->data.fixed.order; i++) - fprintf(fout, "\t\tresidual[%u]=%d\n", i, subframe->data.fixed.residual[i]); - } - break; - case FLAC__SUBFRAME_TYPE_LPC: - FLAC__ASSERT(subframe->data.lpc.entropy_coding_method.type <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2); - fprintf(fout, "\torder=%u\tqlp_coeff_precision=%u\tquantization_level=%d\tresidual_type=%s\tpartition_order=%u\n", subframe->data.lpc.order, subframe->data.lpc.qlp_coeff_precision, subframe->data.lpc.quantization_level, is_rice2? "RICE2":"RICE", subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order); - for(i = 0; i < subframe->data.lpc.order; i++) - fprintf(fout, "\t\tqlp_coeff[%u]=%d\n", i, subframe->data.lpc.qlp_coeff[i]); - for(i = 0; i < subframe->data.lpc.order; i++) - fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.lpc.warmup[i]); - partitions = (1u << subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order); - for(i = 0; i < partitions; i++) { - unsigned parameter = subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->parameters[i]; - if(parameter == pesc) - fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]); - else - fprintf(fout, "\t\tparameter[%u]=%u\n", i, parameter); - } - if(aopts.do_residual_text) { - for(i = 0; i < frame->header.blocksize-subframe->data.lpc.order; i++) - fprintf(fout, "\t\tresidual[%u]=%d\n", i, subframe->data.lpc.residual[i]); - } - break; - case FLAC__SUBFRAME_TYPE_VERBATIM: - fprintf(fout, "\n"); - break; - } - } - - /* now do the residual distributions if requested */ - if(aopts.do_residual_gnuplot) { - for(channel = 0; channel < channels; channel++) { - const FLAC__Subframe *subframe = frame->subframes+channel; - unsigned residual_samples; - - init_stats(&stats); - - switch(subframe->type) { - case FLAC__SUBFRAME_TYPE_FIXED: - residual_samples = frame->header.blocksize - subframe->data.fixed.order; - for(i = 0; i < residual_samples; i++) - update_stats(&stats, subframe->data.fixed.residual[i], 1); - break; - case FLAC__SUBFRAME_TYPE_LPC: - residual_samples = frame->header.blocksize - subframe->data.lpc.order; - for(i = 0; i < residual_samples; i++) - update_stats(&stats, subframe->data.lpc.residual[i], 1); - break; - default: - break; - } - - /* update all_ */ - for(i = 0; i < stats.nbuckets; i++) { - update_stats(&all_, stats.buckets[i].residual, stats.buckets[i].count); - } - - /* write the subframe */ - sprintf(outfilename, "f%06u.s%u.gp", frame_number, channel); - compute_stats(&stats); - - (void)dump_stats(&stats, outfilename); - } - } -} - -void flac__analyze_finish(analysis_options aopts) -{ - if(aopts.do_residual_gnuplot) { - compute_stats(&all_); - (void)dump_stats(&all_, "all"); - } -} - -void init_stats(subframe_stats_t *stats) -{ - stats->peak_index = -1; - stats->nbuckets = 0; - stats->nsamples = 0; - stats->sum = 0.0; - stats->sos = 0.0; -} - -void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr) -{ - unsigned i; - const double r = (double)residual, a = r*incr; - - stats->nsamples += incr; - stats->sum += a; - stats->sos += (a*r); - - for(i = 0; i < stats->nbuckets; i++) { - if(stats->buckets[i].residual == residual) { - stats->buckets[i].count += incr; - goto find_peak; - } - } - /* not found, make a new bucket */ - i = stats->nbuckets; - stats->buckets[i].residual = residual; - stats->buckets[i].count = incr; - stats->nbuckets++; -find_peak: - if(stats->peak_index < 0 || stats->buckets[i].count > stats->buckets[stats->peak_index].count) - stats->peak_index = i; -} - -void compute_stats(subframe_stats_t *stats) -{ - stats->mean = stats->sum / (double)stats->nsamples; - stats->variance = (stats->sos - (stats->sum * stats->sum / stats->nsamples)) / stats->nsamples; - stats->stddev = sqrt(stats->variance); -} - -FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename) -{ - FILE *outfile; - unsigned i; - const double m = stats->mean; - const double s1 = stats->stddev, s2 = s1*2, s3 = s1*3, s4 = s1*4, s5 = s1*5, s6 = s1*6; - const double p = stats->buckets[stats->peak_index].count; - - outfile = fopen(filename, "w"); - - if(0 == outfile) { - fprintf(stderr, "ERROR opening %s: %s\n", filename, strerror(errno)); - return false; - } - - fprintf(outfile, "plot '-' title 'PDF', '-' title 'mean' with impulses, '-' title '1-stddev' with histeps, '-' title '2-stddev' with histeps, '-' title '3-stddev' with histeps, '-' title '4-stddev' with histeps, '-' title '5-stddev' with histeps, '-' title '6-stddev' with histeps\n"); - - for(i = 0; i < stats->nbuckets; i++) { - fprintf(outfile, "%d %u\n", stats->buckets[i].residual, stats->buckets[i].count); - } - fprintf(outfile, "e\n"); - - fprintf(outfile, "%f %f\ne\n", stats->mean, p); - fprintf(outfile, "%f %f\n%f %f\ne\n", m-s1, p*0.8, m+s1, p*0.8); - fprintf(outfile, "%f %f\n%f %f\ne\n", m-s2, p*0.7, m+s2, p*0.7); - fprintf(outfile, "%f %f\n%f %f\ne\n", m-s3, p*0.6, m+s3, p*0.6); - fprintf(outfile, "%f %f\n%f %f\ne\n", m-s4, p*0.5, m+s4, p*0.5); - fprintf(outfile, "%f %f\n%f %f\ne\n", m-s5, p*0.4, m+s5, p*0.4); - fprintf(outfile, "%f %f\n%f %f\ne\n", m-s6, p*0.3, m+s6, p*0.3); - - fprintf(outfile, "pause -1 'waiting...'\n"); - - fclose(outfile); - return true; -} diff --git a/src/lib/dl/ext/flac/analyze.h b/src/lib/dl/ext/flac/analyze.h deleted file mode 100755 index b58b6b87..00000000 --- a/src/lib/dl/ext/flac/analyze.h +++ /dev/null @@ -1,31 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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__analyze_h -#define flac__analyze_h - -typedef struct { - FLAC__bool do_residual_text; - FLAC__bool do_residual_gnuplot; -} analysis_options; - -void flac__analyze_init(analysis_options aopts); -void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout); -void flac__analyze_finish(analysis_options aopts); - -#endif diff --git a/src/lib/dl/ext/flac/assert.h b/src/lib/dl/ext/flac/assert.h deleted file mode 100755 index 3fc03f31..00000000 --- a/src/lib/dl/ext/flac/assert.h +++ /dev/null @@ -1,45 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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/src/lib/dl/ext/flac/bitmath.c b/src/lib/dl/ext/flac/bitmath.c deleted file mode 100755 index 3f6e5cec..00000000 --- a/src/lib/dl/ext/flac/bitmath.c +++ /dev/null @@ -1,149 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#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/src/lib/dl/ext/flac/bitreader.c b/src/lib/dl/ext/flac/bitreader.c deleted file mode 100755 index 1bef3014..00000000 --- a/src/lib/dl/ext/flac/bitreader.c +++ /dev/null @@ -1,1382 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include /* for malloc() */ -#include /* for memcpy(), memset() */ -#ifdef _MSC_VER -#include /* for ntohl() */ -#elif defined FLAC__SYS_DARWIN -#include /* for ntohl() */ -#elif defined __MINGW32__ -#include /* for ntohl() */ -#else -//#include /* for ntohl() */ -#endif -#include "private/bitmath.h" -#include "private/bitreader.h" -#include "private/crc.h" -#include "flac/assert.h" - -static unsigned long ntohl(unsigned long x) { - x = (x >> 16UL) | (x << 16UL); - x = ((x & 0x00FF00FFUL) << 8UL) | ((x & 0xFF00FF00UL) >> 8UL); - return x; -} - -/* Things should be fastest when this matches the machine word size */ -/* WATCHOUT: if you change this you must also change the following #defines down to COUNT_ZERO_MSBS below to match */ -/* WATCHOUT: there are a few places where the code will not work unless brword is >= 32 bits wide */ -/* also, some sections currently only have fast versions for 4 or 8 bytes per word */ -typedef FLAC__uint32 brword; -#define FLAC__BYTES_PER_WORD 4 -#define FLAC__BITS_PER_WORD 32 -#define FLAC__WORD_ALL_ONES ((FLAC__uint32)0xffffffff) -/* SWAP_BE_WORD_TO_HOST swaps bytes in a brword (which is always big-endian) if necessary to match host byte order */ -#if WORDS_BIGENDIAN -#define SWAP_BE_WORD_TO_HOST(x) (x) -#else -#ifdef _MSC_VER -#define SWAP_BE_WORD_TO_HOST(x) local_swap32_(x) -#else -#define SWAP_BE_WORD_TO_HOST(x) ntohl(x) -#endif -#endif -/* counts the # of zero MSBs in a word */ -#define COUNT_ZERO_MSBS(word) ( \ - (word) <= 0xffff ? \ - ( (word) <= 0xff? byte_to_unary_table[word] + 24 : byte_to_unary_table[(word) >> 8] + 16 ) : \ - ( (word) <= 0xffffff? byte_to_unary_table[word >> 16] + 8 : byte_to_unary_table[(word) >> 24] ) \ -) -/* this alternate might be slightly faster on some systems/compilers: */ -#define COUNT_ZERO_MSBS2(word) ( (word) <= 0xff ? byte_to_unary_table[word] + 24 : ((word) <= 0xffff ? byte_to_unary_table[(word) >> 8] + 16 : ((word) <= 0xffffff ? byte_to_unary_table[(word) >> 16] + 8 : byte_to_unary_table[(word) >> 24])) ) - - -/* - * This should be at least twice as large as the largest number of words - * 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). - * But to be practical it should be at least 1K bytes. - * - * 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. The optimal size - * also depends on the CPU cache size and other factors; some twiddling - * may be necessary to squeeze out the best performance. - */ -static const unsigned FLAC__BITREADER_DEFAULT_CAPACITY = 65536u / FLAC__BITS_PER_WORD; /* in words */ - -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 -}; - -#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 - -/* WATCHOUT: assembly routines rely on the order in which these fields are declared */ -struct FLAC__BitReader { - /* any partially-consumed word at the head will stay right-justified as bits are consumed from the left */ - /* any incomplete word at the tail will be left-justified, and bytes from the read callback are added on the right */ - brword *buffer; - unsigned capacity; /* in words */ - unsigned words; /* # of completed words in buffer */ - unsigned bytes; /* # of bytes in incomplete word at buffer[words] */ - unsigned consumed_words; /* #words ... */ - unsigned consumed_bits; /* ... + (#bits of head word) already consumed from the front of buffer */ - unsigned read_crc16; /* the running frame CRC */ - unsigned crc16_align; /* the number of bits in the current consumed word that should not be CRC'd */ - FLAC__BitReaderReadCallback read_callback; - void *client_data; - FLAC__CPUInfo cpu_info; -}; - -#ifdef _MSC_VER -/* OPT: an MSVC built-in would be better */ -static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x) -{ - x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); - return (x>>16) | (x<<16); -} -static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len) -{ - __asm { - mov edx, start - mov ecx, len - test ecx, ecx -loop1: - jz done1 - mov eax, [edx] - bswap eax - mov [edx], eax - add edx, 4 - dec ecx - jmp short loop1 -done1: - } -} -#endif - -static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br, brword word) -{ - register unsigned crc = br->read_crc16; -#if FLAC__BYTES_PER_WORD == 4 - switch(br->crc16_align) { - case 0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 24), crc); - case 8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc); - case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc); - case 24: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc); - } -#elif FLAC__BYTES_PER_WORD == 8 - switch(br->crc16_align) { - case 0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 56), crc); - case 8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 48) & 0xff), crc); - case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 40) & 0xff), crc); - case 24: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 32) & 0xff), crc); - case 32: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 24) & 0xff), crc); - case 40: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc); - case 48: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc); - case 56: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc); - } -#else - for( ; br->crc16_align < FLAC__BITS_PER_WORD; br->crc16_align += 8) - crc = FLAC__CRC16_UPDATE((unsigned)((word >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), crc); - br->read_crc16 = crc; -#endif - br->crc16_align = 0; -} - -/* would be static except it needs to be called by asm routines */ -FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) -{ - unsigned start, end; - size_t bytes; - FLAC__byte *target; - - /* first shift the unconsumed buffer data toward the front as much as possible */ - if(br->consumed_words > 0) { - start = br->consumed_words; - end = br->words + (br->bytes? 1:0); - memmove(br->buffer, br->buffer+start, FLAC__BYTES_PER_WORD * (end - start)); - - br->words -= start; - br->consumed_words = 0; - } - - /* - * set the target for reading, taking into account word alignment and endianness - */ - bytes = (br->capacity - br->words) * FLAC__BYTES_PER_WORD - br->bytes; - if(bytes == 0) - return false; /* no space left, buffer is too small; see note for FLAC__BITREADER_DEFAULT_CAPACITY */ - target = ((FLAC__byte*)(br->buffer+br->words)) + br->bytes; - - /* before reading, if the existing reader looks like this (say brword is 32 bits wide) - * bitstream : 11 22 33 44 55 br->words=1 br->bytes=1 (partial tail word is left-justified) - * buffer[BE]: 11 22 33 44 55 ?? ?? ?? (shown layed out as bytes sequentially in memory) - * buffer[LE]: 44 33 22 11 ?? ?? ?? 55 (?? being don't-care) - * ^^-------target, bytes=3 - * on LE machines, have to byteswap the odd tail word so nothing is - * overwritten: - */ -#if WORDS_BIGENDIAN -#else - if(br->bytes) - br->buffer[br->words] = SWAP_BE_WORD_TO_HOST(br->buffer[br->words]); -#endif - - /* now it looks like: - * bitstream : 11 22 33 44 55 br->words=1 br->bytes=1 - * buffer[BE]: 11 22 33 44 55 ?? ?? ?? - * buffer[LE]: 44 33 22 11 55 ?? ?? ?? - * ^^-------target, bytes=3 - */ - - /* read in the data; note that the callback may return a smaller number of bytes */ - if(!br->read_callback(target, &bytes, br->client_data)) - return false; - - /* after reading bytes 66 77 88 99 AA BB CC DD EE FF from the client: - * bitstream : 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF - * buffer[BE]: 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ?? - * buffer[LE]: 44 33 22 11 55 66 77 88 99 AA BB CC DD EE FF ?? - * now have to byteswap on LE machines: - */ -#if WORDS_BIGENDIAN -#else - end = (br->words*FLAC__BYTES_PER_WORD + br->bytes + bytes + (FLAC__BYTES_PER_WORD-1)) / FLAC__BYTES_PER_WORD; -# if defined(_MSC_VER) && (FLAC__BYTES_PER_WORD == 4) - if(br->cpu_info.type == FLAC__CPUINFO_TYPE_IA32 && br->cpu_info.data.ia32.bswap) { - start = br->words; - local_swap32_block_(br->buffer + start, end - start); - } - else -# endif - for(start = br->words; start < end; start++) - br->buffer[start] = SWAP_BE_WORD_TO_HOST(br->buffer[start]); -#endif - - /* now it looks like: - * bitstream : 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF - * buffer[BE]: 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF ?? - * buffer[LE]: 44 33 22 11 88 77 66 55 CC BB AA 99 ?? FF EE DD - * finally we'll update the reader values: - */ - end = br->words*FLAC__BYTES_PER_WORD + br->bytes + bytes; - br->words = end / FLAC__BYTES_PER_WORD; - br->bytes = end % FLAC__BYTES_PER_WORD; - - return true; -} - -/*********************************************************************** - * - * Class constructor/destructor - * - ***********************************************************************/ - -FLAC__BitReader *FLAC__bitreader_new(void) -{ - FLAC__BitReader *br = (FLAC__BitReader*)calloc(1, sizeof(FLAC__BitReader)); - - /* calloc() implies: - memset(br, 0, sizeof(FLAC__BitReader)); - br->buffer = 0; - br->capacity = 0; - br->words = br->bytes = 0; - br->consumed_words = br->consumed_bits = 0; - br->read_callback = 0; - br->client_data = 0; - */ - return br; -} - -void FLAC__bitreader_delete(FLAC__BitReader *br) -{ - FLAC__ASSERT(0 != br); - - FLAC__bitreader_free(br); - free(br); -} - -/*********************************************************************** - * - * Public class methods - * - ***********************************************************************/ - -FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__BitReaderReadCallback rcb, void *cd) -{ - FLAC__ASSERT(0 != br); - - br->words = br->bytes = 0; - br->consumed_words = br->consumed_bits = 0; - br->capacity = FLAC__BITREADER_DEFAULT_CAPACITY; - br->buffer = (brword*)malloc(sizeof(brword) * br->capacity); - if(br->buffer == 0) - return false; - br->read_callback = rcb; - br->client_data = cd; - br->cpu_info = cpu; - - return true; -} - -void FLAC__bitreader_free(FLAC__BitReader *br) -{ - FLAC__ASSERT(0 != br); - - if(0 != br->buffer) - free(br->buffer); - br->buffer = 0; - br->capacity = 0; - br->words = br->bytes = 0; - br->consumed_words = br->consumed_bits = 0; - br->read_callback = 0; - br->client_data = 0; -} - -FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br) -{ - br->words = br->bytes = 0; - br->consumed_words = br->consumed_bits = 0; - return true; -} - -void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out) -{ - unsigned i, j; - if(br == 0) { - fprintf(out, "bitreader is NULL\n"); - } - else { - fprintf(out, "bitreader: capacity=%u words=%u bytes=%u consumed: words=%u, bits=%u\n", br->capacity, br->words, br->bytes, br->consumed_words, br->consumed_bits); - - for(i = 0; i < br->words; i++) { - fprintf(out, "%08X: ", i); - for(j = 0; j < FLAC__BITS_PER_WORD; j++) - if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) - fprintf(out, "."); - else - fprintf(out, "%01u", br->buffer[i] & (1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); - fprintf(out, "\n"); - } - if(br->bytes > 0) { - fprintf(out, "%08X: ", i); - for(j = 0; j < br->bytes*8; j++) - if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) - fprintf(out, "."); - else - fprintf(out, "%01u", br->buffer[i] & (1 << (br->bytes*8-j-1)) ? 1:0); - fprintf(out, "\n"); - } - } -} - -void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed) -{ - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - FLAC__ASSERT((br->consumed_bits & 7) == 0); - - br->read_crc16 = (unsigned)seed; - br->crc16_align = br->consumed_bits; -} - -FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br) -{ - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - FLAC__ASSERT((br->consumed_bits & 7) == 0); - FLAC__ASSERT(br->crc16_align <= br->consumed_bits); - - /* CRC any tail bytes in a partially-consumed word */ - if(br->consumed_bits) { - const brword tail = br->buffer[br->consumed_words]; - for( ; br->crc16_align < br->consumed_bits; br->crc16_align += 8) - br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)((tail >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), br->read_crc16); - } - return br->read_crc16; -} - -FLaC__INLINE FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br) -{ - return ((br->consumed_bits & 7) == 0); -} - -FLaC__INLINE unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br) -{ - return 8 - (br->consumed_bits & 7); -} - -FLaC__INLINE unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br) -{ - return (br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits; -} - -FLaC__INLINE FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits) -{ - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - - FLAC__ASSERT(bits <= 32); - FLAC__ASSERT((br->capacity*FLAC__BITS_PER_WORD) * 2 >= bits); - FLAC__ASSERT(br->consumed_words <= br->words); - - /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ - FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - - if(bits == 0) { /* OPT: investigate if this can ever happen, maybe change to assertion */ - *val = 0; - return true; - } - - while((br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits < bits) { - if(!bitreader_read_from_client_(br)) - return false; - } - if(br->consumed_words < br->words) { /* if we've not consumed up to a partial tail word... */ - /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */ - if(br->consumed_bits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - const unsigned n = FLAC__BITS_PER_WORD - br->consumed_bits; - const brword word = br->buffer[br->consumed_words]; - if(bits < n) { - *val = (word & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (n-bits); - br->consumed_bits += bits; - return true; - } - *val = word & (FLAC__WORD_ALL_ONES >> br->consumed_bits); - bits -= n; - crc16_update_word_(br, word); - br->consumed_words++; - br->consumed_bits = 0; - if(bits) { /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */ - *val <<= bits; - *val |= (br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD-bits)); - br->consumed_bits = bits; - } - return true; - } - else { - const brword word = br->buffer[br->consumed_words]; - if(bits < FLAC__BITS_PER_WORD) { - *val = word >> (FLAC__BITS_PER_WORD-bits); - br->consumed_bits = bits; - return true; - } - /* at this point 'bits' must be == FLAC__BITS_PER_WORD; because of previous assertions, it can't be larger */ - *val = word; - crc16_update_word_(br, word); - br->consumed_words++; - return true; - } - } - else { - /* in this case we're starting our read at a partial tail word; - * the reader has guaranteed that we have at least 'bits' bits - * available to read, which makes this case simpler. - */ - /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */ - if(br->consumed_bits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - FLAC__ASSERT(br->consumed_bits + bits <= br->bytes*8); - *val = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (FLAC__BITS_PER_WORD-br->consumed_bits-bits); - br->consumed_bits += bits; - return true; - } - else { - *val = br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD-bits); - br->consumed_bits += bits; - return true; - } - } -} - -FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits) -{ - /* OPT: inline raw uint32 code here, or make into a macro if possible in the .h file */ - if(!FLAC__bitreader_read_raw_uint32(br, (FLAC__uint32*)val, bits)) - return false; - /* sign-extend: */ - *val <<= (32-bits); - *val >>= (32-bits); - return true; -} - -FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits) -{ - FLAC__uint32 hi, lo; - - if(bits > 32) { - if(!FLAC__bitreader_read_raw_uint32(br, &hi, bits-32)) - return false; - if(!FLAC__bitreader_read_raw_uint32(br, &lo, 32)) - return false; - *val = hi; - *val <<= 32; - *val |= lo; - } - else { - if(!FLAC__bitreader_read_raw_uint32(br, &lo, bits)) - return false; - *val = lo; - } - return true; -} - -FLaC__INLINE FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val) -{ - FLAC__uint32 x8, x32 = 0; - - /* this doesn't need to be that fast as currently it is only used for vorbis comments */ - - if(!FLAC__bitreader_read_raw_uint32(br, &x32, 8)) - return false; - - if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8)) - return false; - x32 |= (x8 << 8); - - if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8)) - return false; - x32 |= (x8 << 16); - - if(!FLAC__bitreader_read_raw_uint32(br, &x8, 8)) - return false; - x32 |= (x8 << 24); - - *val = x32; - return true; -} - -FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits) -{ - /* - * OPT: a 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 != br); - FLAC__ASSERT(0 != br->buffer); - - if(bits > 0) { - const unsigned n = br->consumed_bits & 7; - unsigned m; - FLAC__uint32 x; - - if(n != 0) { - m = min(8-n, bits); - if(!FLAC__bitreader_read_raw_uint32(br, &x, m)) - return false; - bits -= m; - } - m = bits / 8; - if(m > 0) { - if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(br, m)) - return false; - bits %= 8; - } - if(bits > 0) { - if(!FLAC__bitreader_read_raw_uint32(br, &x, bits)) - return false; - } - } - - return true; -} - -FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals) -{ - FLAC__uint32 x; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br)); - - /* step 1: skip over partial head word to get word aligned */ - while(nvals && br->consumed_bits) { /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */ - if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) - return false; - nvals--; - } - if(0 == nvals) - return true; - /* step 2: skip whole words in chunks */ - while(nvals >= FLAC__BYTES_PER_WORD) { - if(br->consumed_words < br->words) { - br->consumed_words++; - nvals -= FLAC__BYTES_PER_WORD; - } - else if(!bitreader_read_from_client_(br)) - return false; - } - /* step 3: skip any remainder from partial tail bytes */ - while(nvals) { - if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) - return false; - nvals--; - } - - return true; -} - -FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals) -{ - FLAC__uint32 x; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br)); - - /* step 1: read from partial head word to get word aligned */ - while(nvals && br->consumed_bits) { /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */ - if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) - return false; - *val++ = (FLAC__byte)x; - nvals--; - } - if(0 == nvals) - return true; - /* step 2: read whole words in chunks */ - while(nvals >= FLAC__BYTES_PER_WORD) { - if(br->consumed_words < br->words) { - const brword word = br->buffer[br->consumed_words++]; -#if FLAC__BYTES_PER_WORD == 4 - val[0] = (FLAC__byte)(word >> 24); - val[1] = (FLAC__byte)(word >> 16); - val[2] = (FLAC__byte)(word >> 8); - val[3] = (FLAC__byte)word; -#elif FLAC__BYTES_PER_WORD == 8 - val[0] = (FLAC__byte)(word >> 56); - val[1] = (FLAC__byte)(word >> 48); - val[2] = (FLAC__byte)(word >> 40); - val[3] = (FLAC__byte)(word >> 32); - val[4] = (FLAC__byte)(word >> 24); - val[5] = (FLAC__byte)(word >> 16); - val[6] = (FLAC__byte)(word >> 8); - val[7] = (FLAC__byte)word; -#else - for(x = 0; x < FLAC__BYTES_PER_WORD; x++) - val[x] = (FLAC__byte)(word >> (8*(FLAC__BYTES_PER_WORD-x-1))); -#endif - val += FLAC__BYTES_PER_WORD; - nvals -= FLAC__BYTES_PER_WORD; - } - else if(!bitreader_read_from_client_(br)) - return false; - } - /* step 3: read any remainder from partial tail bytes */ - while(nvals) { - if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) - return false; - *val++ = (FLAC__byte)x; - nvals--; - } - - return true; -} - -FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val) -#if 0 /* slow but readable version */ -{ - unsigned bit; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - - *val = 0; - while(1) { - if(!FLAC__bitreader_read_bit(br, &bit)) - return false; - if(bit) - break; - else - *val++; - } - return true; -} -#else -{ - unsigned i; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - - *val = 0; - while(1) { - while(br->consumed_words < br->words) { /* if we've not consumed up to a partial tail word... */ - brword b = br->buffer[br->consumed_words] << br->consumed_bits; - if(b) { - i = COUNT_ZERO_MSBS(b); - *val += i; - i++; - br->consumed_bits += i; - if(br->consumed_bits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(br->consumed_bits == FLAC__BITS_PER_WORD) */ - crc16_update_word_(br, br->buffer[br->consumed_words]); - br->consumed_words++; - br->consumed_bits = 0; - } - return true; - } - else { - *val += FLAC__BITS_PER_WORD - br->consumed_bits; - crc16_update_word_(br, br->buffer[br->consumed_words]); - br->consumed_words++; - br->consumed_bits = 0; - /* didn't find stop bit yet, have to keep going... */ - } - } - /* at this point we've eaten up all the whole words; have to try - * reading through any tail bytes before calling the read callback. - * this is a repeat of the above logic adjusted for the fact we - * don't have a whole word. note though if the client is feeding - * us data a byte at a time (unlikely), br->consumed_bits may not - * be zero. - */ - if(br->bytes) { - const unsigned end = br->bytes * 8; - brword b = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD-end))) << br->consumed_bits; - if(b) { - i = COUNT_ZERO_MSBS(b); - *val += i; - i++; - br->consumed_bits += i; - FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD); - return true; - } - else { - *val += end - br->consumed_bits; - br->consumed_bits += end; - FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD); - /* didn't find stop bit yet, have to keep going... */ - } - } - if(!bitreader_read_from_client_(br)) - return false; - } -} -#endif - -FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter) -{ - FLAC__uint32 lsbs = 0, msbs = 0; - unsigned uval; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - FLAC__ASSERT(parameter <= 31); - - /* read the unary MSBs and end bit */ - if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) - return false; - - /* read the binary LSBs */ - if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter)) - return false; - - /* compose the value */ - uval = (msbs << parameter) | lsbs; - if(uval & 1) - *val = -((int)(uval >> 1)) - 1; - else - *val = (int)(uval >> 1); - - return true; -} - -/* this is by far the most heavily used reader call. it ain't pretty but it's fast */ -/* a lot of the logic is copied, then adapted, from FLAC__bitreader_read_unary_unsigned() and FLAC__bitreader_read_raw_uint32() */ -FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter) -/* OPT: possibly faster version for use with MSVC */ -#ifdef _MSC_VER -{ - unsigned i; - unsigned uval = 0; - unsigned bits; /* the # of binary LSBs left to read to finish a rice codeword */ - - /* try and get br->consumed_words and br->consumed_bits into register; - * must remember to flush them back to *br before calling other - * bitwriter functions that use them, and before returning */ - register unsigned cwords; - register unsigned cbits; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ - FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - FLAC__ASSERT(parameter < 32); - /* the above two asserts also guarantee that the binary part never straddles more that 2 words, so we don't have to loop to read it */ - - if(nvals == 0) - return true; - - cbits = br->consumed_bits; - cwords = br->consumed_words; - - while(1) { - - /* read unary part */ - while(1) { - while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - brword b = br->buffer[cwords] << cbits; - if(b) { -#if 0 /* slower, probably due to bad register allocation... */ && defined FLAC__CPU_IA32 && !defined FLAC__NO_ASM && FLAC__BITS_PER_WORD == 32 - __asm { - bsr eax, b - not eax - and eax, 31 - mov i, eax - } -#else - i = COUNT_ZERO_MSBS(b); -#endif - uval += i; - bits = parameter; - i++; - cbits += i; - if(cbits == FLAC__BITS_PER_WORD) { - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - } - goto break1; - } - else { - uval += FLAC__BITS_PER_WORD - cbits; - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - /* didn't find stop bit yet, have to keep going... */ - } - } - /* at this point we've eaten up all the whole words; have to try - * reading through any tail bytes before calling the read callback. - * this is a repeat of the above logic adjusted for the fact we - * don't have a whole word. note though if the client is feeding - * us data a byte at a time (unlikely), br->consumed_bits may not - * be zero. - */ - if(br->bytes) { - const unsigned end = br->bytes * 8; - brword b = (br->buffer[cwords] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD-end))) << cbits; - if(b) { - i = COUNT_ZERO_MSBS(b); - uval += i; - bits = parameter; - i++; - cbits += i; - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - goto break1; - } - else { - uval += end - cbits; - cbits += end; - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - /* didn't find stop bit yet, have to keep going... */ - } - } - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - } -break1: - /* read binary part */ - FLAC__ASSERT(cwords <= br->words); - - if(bits) { - while((br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits < bits) { - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - } - if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - if(cbits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - const unsigned n = FLAC__BITS_PER_WORD - cbits; - const brword word = br->buffer[cwords]; - if(bits < n) { - uval <<= bits; - uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-bits); - cbits += bits; - goto break2; - } - uval <<= n; - uval |= word & (FLAC__WORD_ALL_ONES >> cbits); - bits -= n; - crc16_update_word_(br, word); - cwords++; - cbits = 0; - if(bits) { /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */ - uval <<= bits; - uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits)); - cbits = bits; - } - goto break2; - } - else { - FLAC__ASSERT(bits < FLAC__BITS_PER_WORD); - uval <<= bits; - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits); - cbits = bits; - goto break2; - } - } - else { - /* in this case we're starting our read at a partial tail word; - * the reader has guaranteed that we have at least 'bits' bits - * available to read, which makes this case simpler. - */ - uval <<= bits; - if(cbits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - FLAC__ASSERT(cbits + bits <= br->bytes*8); - uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-bits); - cbits += bits; - goto break2; - } - else { - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits); - cbits += bits; - goto break2; - } - } - } -break2: - /* compose the value */ - *vals = (int)(uval >> 1 ^ -(int)(uval & 1)); - - /* are we done? */ - --nvals; - if(nvals == 0) { - br->consumed_bits = cbits; - br->consumed_words = cwords; - return true; - } - - uval = 0; - ++vals; - - } -} -#else -{ - unsigned i; - unsigned uval = 0; - - /* try and get br->consumed_words and br->consumed_bits into register; - * must remember to flush them back to *br before calling other - * bitwriter functions that use them, and before returning */ - register unsigned cwords; - register unsigned cbits; - unsigned ucbits; /* keep track of the number of unconsumed bits in the buffer */ - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ - FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - FLAC__ASSERT(parameter < 32); - /* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */ - - if(nvals == 0) - return true; - - cbits = br->consumed_bits; - cwords = br->consumed_words; - ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; - - while(1) { - - /* read unary part */ - while(1) { - while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - brword b = br->buffer[cwords] << cbits; - if(b) { -#if 0 /* is not discernably faster... */ && defined FLAC__CPU_IA32 && !defined FLAC__NO_ASM && FLAC__BITS_PER_WORD == 32 && defined __GNUC__ - asm volatile ( - "bsrl %1, %0;" - "notl %0;" - "andl $31, %0;" - : "=r"(i) - : "r"(b) - ); -#else - i = COUNT_ZERO_MSBS(b); -#endif - uval += i; - cbits += i; - cbits++; /* skip over stop bit */ - if(cbits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(cbits == FLAC__BITS_PER_WORD) */ - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - } - goto break1; - } - else { - uval += FLAC__BITS_PER_WORD - cbits; - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - /* didn't find stop bit yet, have to keep going... */ - } - } - /* at this point we've eaten up all the whole words; have to try - * reading through any tail bytes before calling the read callback. - * this is a repeat of the above logic adjusted for the fact we - * don't have a whole word. note though if the client is feeding - * us data a byte at a time (unlikely), br->consumed_bits may not - * be zero. - */ - if(br->bytes) { - const unsigned end = br->bytes * 8; - brword b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end)) << cbits; - if(b) { - i = COUNT_ZERO_MSBS(b); - uval += i; - cbits += i; - cbits++; /* skip over stop bit */ - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - goto break1; - } - else { - uval += end - cbits; - cbits += end; - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - /* didn't find stop bit yet, have to keep going... */ - } - } - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits + uval; - /* + uval to offset our count by the # of unary bits already - * consumed before the read, because we will add these back - * in all at once at break1 - */ - } -break1: - ucbits -= uval; - ucbits--; /* account for stop bit */ - - /* read binary part */ - FLAC__ASSERT(cwords <= br->words); - - if(parameter) { - while(ucbits < parameter) { - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; - } - if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - if(cbits) { - /* this also works when consumed_bits==0, it's just slower than necessary for that case */ - const unsigned n = FLAC__BITS_PER_WORD - cbits; - const brword word = br->buffer[cwords]; - if(parameter < n) { - uval <<= parameter; - uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-parameter); - cbits += parameter; - } - else { - uval <<= n; - uval |= word & (FLAC__WORD_ALL_ONES >> cbits); - crc16_update_word_(br, word); - cwords++; - cbits = parameter - n; - if(cbits) { /* parameter > n, i.e. if there are still bits left to read, there have to be less than 32 so they will all be in the next word */ - uval <<= cbits; - uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits)); - } - } - } - else { - cbits = parameter; - uval <<= parameter; - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits); - } - } - else { - /* in this case we're starting our read at a partial tail word; - * the reader has guaranteed that we have at least 'parameter' - * bits available to read, which makes this case simpler. - */ - uval <<= parameter; - if(cbits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - FLAC__ASSERT(cbits + parameter <= br->bytes*8); - uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-parameter); - cbits += parameter; - } - else { - cbits = parameter; - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits); - } - } - } - - ucbits -= parameter; - - /* compose the value */ - *vals = (int)(uval >> 1 ^ -(int)(uval & 1)); - - /* are we done? */ - --nvals; - if(nvals == 0) { - br->consumed_bits = cbits; - br->consumed_words = cwords; - return true; - } - - uval = 0; - ++vals; - - } -} -#endif - -#if 0 /* UNUSED */ -FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter) -{ - FLAC__uint32 lsbs = 0, msbs = 0; - unsigned bit, uval, k; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - - k = FLAC__bitmath_ilog2(parameter); - - /* read the unary MSBs and end bit */ - if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) - return false; - - /* read the binary LSBs */ - if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, k)) - return false; - - if(parameter == 1u<= d) { - if(!FLAC__bitreader_read_bit(br, &bit)) - 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__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter) -{ - FLAC__uint32 lsbs, msbs = 0; - unsigned bit, k; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - - k = FLAC__bitmath_ilog2(parameter); - - /* read the unary MSBs and end bit */ - if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) - return false; - - /* read the binary LSBs */ - if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, k)) - return false; - - if(parameter == 1u<= d) { - if(!FLAC__bitreader_read_bit(br, &bit)) - 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__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen) -{ - FLAC__uint32 v = 0; - FLAC__uint32 x; - unsigned i; - - if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) - 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__bitreader_read_raw_uint32(br, &x, 8)) - 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__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen) -{ - FLAC__uint64 v = 0; - FLAC__uint32 x; - unsigned i; - - if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) - 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__bitreader_read_raw_uint32(br, &x, 8)) - 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; -} diff --git a/src/lib/dl/ext/flac/bitwriter.c b/src/lib/dl/ext/flac/bitwriter.c deleted file mode 100755 index d3a17d28..00000000 --- a/src/lib/dl/ext/flac/bitwriter.c +++ /dev/null @@ -1,895 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include /* for malloc() */ -#include /* for memcpy(), memset() */ -#ifdef _MSC_VER -#include /* for ntohl() */ -#elif defined FLAC__SYS_DARWIN -#include /* for ntohl() */ -#elif defined __MINGW32__ -#include /* for ntohl() */ -#else -//#include /* for ntohl() */ -#endif -#if 0 /* UNUSED */ -#include "private/bitmath.h" -#endif -#include "private/bitwriter.h" -#include "private/crc.h" -#include "flac/assert.h" -#include "share/alloc.h" - -static unsigned long ntohl(unsigned long x) { - x = (x >> 16UL) | (x << 16UL); - x = ((x & 0x00FF00FFUL) << 8UL) | ((x & 0xFF00FF00UL) >> 8UL); - return x; -} - -/* Things should be fastest when this matches the machine word size */ -/* WATCHOUT: if you change this you must also change the following #defines down to SWAP_BE_WORD_TO_HOST below to match */ -/* WATCHOUT: there are a few places where the code will not work unless bwword is >= 32 bits wide */ -typedef FLAC__uint32 bwword; -#define FLAC__BYTES_PER_WORD 4 -#define FLAC__BITS_PER_WORD 32 -#define FLAC__WORD_ALL_ONES ((FLAC__uint32)0xffffffff) -/* SWAP_BE_WORD_TO_HOST swaps bytes in a bwword (which is always big-endian) if necessary to match host byte order */ -#if WORDS_BIGENDIAN -#define SWAP_BE_WORD_TO_HOST(x) (x) -#else -#ifdef _MSC_VER -#define SWAP_BE_WORD_TO_HOST(x) local_swap32_(x) -#else -#define SWAP_BE_WORD_TO_HOST(x) ntohl(x) -#endif -#endif - -/* - * The default capacity here doesn't matter too much. The buffer always grows - * to hold whatever is written to it. Usually the encoder will stop adding at - * a frame or metadata block, then write that out and clear the buffer for the - * next one. - */ -static const unsigned FLAC__BITWRITER_DEFAULT_CAPACITY = 32768u / sizeof(bwword); /* size in words */ -/* When growing, increment 4K at a time */ -static const unsigned FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword); /* size in words */ - -#define FLAC__WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD) -#define FLAC__TOTAL_BITS(bw) (FLAC__WORDS_TO_BITS((bw)->words) + (bw)->bits) - -#ifdef min -#undef min -#endif -#define min(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__BitWriter { - bwword *buffer; - bwword accum; /* accumulator; bits are right-justified; when full, accum is appended to buffer */ - unsigned capacity; /* capacity of buffer in words */ - unsigned words; /* # of complete words in buffer */ - unsigned bits; /* # of used bits in accum */ -}; - -#ifdef _MSC_VER -/* OPT: an MSVC built-in would be better */ -static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x) -{ - x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); - return (x>>16) | (x<<16); -} -#endif - -/* * WATCHOUT: The current implementation only grows the buffer. */ -static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add) -{ - unsigned new_capacity; - bwword *new_buffer; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - - /* calculate total words needed to store 'bits_to_add' additional bits */ - new_capacity = bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD); - - /* it's possible (due to pessimism in the growth estimation that - * leads to this call) that we don't actually need to grow - */ - if(bw->capacity >= new_capacity) - return true; - - /* round up capacity increase to the nearest FLAC__BITWRITER_DEFAULT_INCREMENT */ - if((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT) - new_capacity += FLAC__BITWRITER_DEFAULT_INCREMENT - ((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT); - /* make sure we got everything right */ - FLAC__ASSERT(0 == (new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT); - FLAC__ASSERT(new_capacity > bw->capacity); - FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD)); - - new_buffer = (bwword*)safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity); - if(new_buffer == 0) - return false; - bw->buffer = new_buffer; - bw->capacity = new_capacity; - return true; -} - - -/*********************************************************************** - * - * Class constructor/destructor - * - ***********************************************************************/ - -FLAC__BitWriter *FLAC__bitwriter_new(void) -{ - FLAC__BitWriter *bw = (FLAC__BitWriter*)calloc(1, sizeof(FLAC__BitWriter)); - /* note that calloc() sets all members to 0 for us */ - return bw; -} - -void FLAC__bitwriter_delete(FLAC__BitWriter *bw) -{ - FLAC__ASSERT(0 != bw); - - FLAC__bitwriter_free(bw); - free(bw); -} - -/*********************************************************************** - * - * Public class methods - * - ***********************************************************************/ - -FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw) -{ - FLAC__ASSERT(0 != bw); - - bw->words = bw->bits = 0; - bw->capacity = FLAC__BITWRITER_DEFAULT_CAPACITY; - bw->buffer = (bwword*)malloc(sizeof(bwword) * bw->capacity); - if(bw->buffer == 0) - return false; - - return true; -} - -void FLAC__bitwriter_free(FLAC__BitWriter *bw) -{ - FLAC__ASSERT(0 != bw); - - if(0 != bw->buffer) - free(bw->buffer); - bw->buffer = 0; - bw->capacity = 0; - bw->words = bw->bits = 0; -} - -void FLAC__bitwriter_clear(FLAC__BitWriter *bw) -{ - bw->words = bw->bits = 0; -} - -void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out) -{ - unsigned i, j; - if(bw == 0) { - fprintf(out, "bitwriter is NULL\n"); - } - else { - fprintf(out, "bitwriter: capacity=%u words=%u bits=%u total_bits=%u\n", bw->capacity, bw->words, bw->bits, FLAC__TOTAL_BITS(bw)); - - for(i = 0; i < bw->words; i++) { - fprintf(out, "%08X: ", i); - for(j = 0; j < FLAC__BITS_PER_WORD; j++) - fprintf(out, "%01u", bw->buffer[i] & (1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); - fprintf(out, "\n"); - } - if(bw->bits > 0) { - fprintf(out, "%08X: ", i); - for(j = 0; j < bw->bits; j++) - fprintf(out, "%01u", bw->accum & (1 << (bw->bits-j-1)) ? 1:0); - fprintf(out, "\n"); - } - } -} - -FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc) -{ - const FLAC__byte *buffer; - size_t bytes; - - FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */ - - if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes)) - return false; - - *crc = (FLAC__uint16)FLAC__crc16(buffer, bytes); - FLAC__bitwriter_release_buffer(bw); - return true; -} - -FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc) -{ - const FLAC__byte *buffer; - size_t bytes; - - FLAC__ASSERT((bw->bits & 7) == 0); /* assert that we're byte-aligned */ - - if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes)) - return false; - - *crc = FLAC__crc8(buffer, bytes); - FLAC__bitwriter_release_buffer(bw); - return true; -} - -FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw) -{ - return ((bw->bits & 7) == 0); -} - -unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw) -{ - return FLAC__TOTAL_BITS(bw); -} - -FLAC__bool FLAC__bitwriter_get_buffer(FLAC__BitWriter *bw, const FLAC__byte **buffer, size_t *bytes) -{ - FLAC__ASSERT((bw->bits & 7) == 0); - /* double protection */ - if(bw->bits & 7) - return false; - /* if we have bits in the accumulator we have to flush those to the buffer first */ - if(bw->bits) { - FLAC__ASSERT(bw->words <= bw->capacity); - if(bw->words == bw->capacity && !bitwriter_grow_(bw, FLAC__BITS_PER_WORD)) - return false; - /* append bits as complete word to buffer, but don't change bw->accum or bw->bits */ - bw->buffer[bw->words] = SWAP_BE_WORD_TO_HOST(bw->accum << (FLAC__BITS_PER_WORD-bw->bits)); - } - /* now we can just return what we have */ - *buffer = (FLAC__byte*)bw->buffer; - *bytes = (FLAC__BYTES_PER_WORD * bw->words) + (bw->bits >> 3); - return true; -} - -void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw) -{ - /* nothing to do. in the future, strict checking of a 'writer-is-in- - * get-mode' flag could be added everywhere and then cleared here - */ - (void)bw; -} - -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits) -{ - unsigned n; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - - if(bits == 0) - return true; - /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */ - if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits)) - return false; - /* first part gets to word alignment */ - if(bw->bits) { - n = min(FLAC__BITS_PER_WORD - bw->bits, bits); - bw->accum <<= n; - bits -= n; - bw->bits += n; - if(bw->bits == FLAC__BITS_PER_WORD) { - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->bits = 0; - } - else - return true; - } - /* do whole words */ - while(bits >= FLAC__BITS_PER_WORD) { - bw->buffer[bw->words++] = 0; - bits -= FLAC__BITS_PER_WORD; - } - /* do any leftovers */ - if(bits > 0) { - bw->accum = 0; - bw->bits = bits; - } - return true; -} - -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits) -{ - register unsigned left; - - /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ - FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - - FLAC__ASSERT(bits <= 32); - if(bits == 0) - return true; - - /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */ - if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits)) - return false; - - left = FLAC__BITS_PER_WORD - bw->bits; - if(bits < left) { - bw->accum <<= bits; - bw->accum |= val; - bw->bits += bits; - } - else if(bw->bits) { /* WATCHOUT: if bw->bits == 0, left==FLAC__BITS_PER_WORD and bw->accum<<=left is a NOP instead of setting to 0 */ - bw->accum <<= left; - bw->accum |= val >> (bw->bits = bits - left); - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->accum = val; - } - else { - bw->accum = val; - bw->bits = 0; - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(val); - } - - return true; -} - -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits) -{ - /* zero-out unused bits */ - if(bits < 32) - val &= (~(0xffffffff << bits)); - - return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits); -} - -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits) -{ - /* this could be a little faster but it's not used for much */ - if(bits > 32) { - return - FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(val>>32), bits-32) && - FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 32); - } - else - return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits); -} - -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val) -{ - /* this doesn't need to be that fast as currently it is only used for vorbis comments */ - - if(!FLAC__bitwriter_write_raw_uint32(bw, val & 0xff, 8)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>8) & 0xff, 8)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>16) & 0xff, 8)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, val>>24, 8)) - return false; - - return true; -} - -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals) -{ - unsigned i; - - /* this could be faster but currently we don't need it to be since it's only used for writing metadata */ - for(i = 0; i < nvals; i++) { - if(!FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(vals[i]), 8)) - return false; - } - - return true; -} - -FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val) -{ - if(val < 32) - return FLAC__bitwriter_write_raw_uint32(bw, 1, ++val); - else - return - FLAC__bitwriter_write_zeroes(bw, val) && - FLAC__bitwriter_write_raw_uint32(bw, 1, 1); -} - -unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter) -{ - FLAC__uint32 uval; - - FLAC__ASSERT(parameter < sizeof(unsigned)*8); - - /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */ - uval = (val<<1) ^ (val>>31); - - return 1 + parameter + (uval >> parameter); -} - -#if 0 /* UNUSED */ -unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter) -{ - unsigned bits, msbs, uval; - unsigned k; - - FLAC__ASSERT(parameter > 0); - - /* fold signed to unsigned */ - if(val < 0) - 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__bitwriter_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 */ - -FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter) -{ - unsigned total_bits, interesting_bits, msbs; - FLAC__uint32 uval, pattern; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - FLAC__ASSERT(parameter < 8*sizeof(uval)); - - /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */ - uval = (val<<1) ^ (val>>31); - - msbs = uval >> parameter; - interesting_bits = 1 + parameter; - total_bits = interesting_bits + msbs; - pattern = 1 << parameter; /* the unary end bit */ - pattern |= (uval & ((1<> (31-parameter); /* ...then mask off the bits above the stop bit with val&=mask2*/ - FLAC__uint32 uval; - unsigned left; - const unsigned lsbits = 1 + parameter; - unsigned msbits; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - FLAC__ASSERT(parameter < 8*sizeof(bwword)-1); - /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ - FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - - while(nvals) { - /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */ - uval = (*vals<<1) ^ (*vals>>31); - - msbits = uval >> parameter; - -#if 0 /* OPT: can remove this special case if it doesn't make up for the extra compare (doesn't make a statistically significant difference with msvc or gcc/x86) */ - if(bw->bits && bw->bits + msbits + lsbits <= FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */ - /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */ - bw->bits = bw->bits + msbits + lsbits; - uval |= mask1; /* set stop bit */ - uval &= mask2; /* mask off unused top bits */ - /* NOT: bw->accum <<= msbits + lsbits because msbits+lsbits could be 32, then the shift would be a NOP */ - bw->accum <<= msbits; - bw->accum <<= lsbits; - bw->accum |= uval; - if(bw->bits == FLAC__BITS_PER_WORD) { - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->bits = 0; - /* burying the capacity check down here means we have to grow the buffer a little if there are more vals to do */ - if(bw->capacity <= bw->words && nvals > 1 && !bitwriter_grow_(bw, 1)) { - FLAC__ASSERT(bw->capacity == bw->words); - return false; - } - } - } - else { -#elif 1 /*@@@@@@ OPT: try this version with MSVC6 to see if better, not much difference for gcc-4 */ - if(bw->bits && bw->bits + msbits + lsbits < FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */ - /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */ - bw->bits = bw->bits + msbits + lsbits; - uval |= mask1; /* set stop bit */ - uval &= mask2; /* mask off unused top bits */ - bw->accum <<= msbits + lsbits; - bw->accum |= uval; - } - else { -#endif - /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+msbits+lsbits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */ - /* OPT: pessimism may cause flurry of false calls to grow_ which eat up all savings before it */ - if(bw->capacity <= bw->words + bw->bits + msbits + 1/*lsbits always fit in 1 bwword*/ && !bitwriter_grow_(bw, msbits+lsbits)) - return false; - - if(msbits) { - /* first part gets to word alignment */ - if(bw->bits) { - left = FLAC__BITS_PER_WORD - bw->bits; - if(msbits < left) { - bw->accum <<= msbits; - bw->bits += msbits; - goto break1; - } - else { - bw->accum <<= left; - msbits -= left; - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->bits = 0; - } - } - /* do whole words */ - while(msbits >= FLAC__BITS_PER_WORD) { - bw->buffer[bw->words++] = 0; - msbits -= FLAC__BITS_PER_WORD; - } - /* do any leftovers */ - if(msbits > 0) { - bw->accum = 0; - bw->bits = msbits; - } - } -break1: - uval |= mask1; /* set stop bit */ - uval &= mask2; /* mask off unused top bits */ - - left = FLAC__BITS_PER_WORD - bw->bits; - if(lsbits < left) { - bw->accum <<= lsbits; - bw->accum |= uval; - bw->bits += lsbits; - } - else { - /* if bw->bits == 0, left==FLAC__BITS_PER_WORD which will always - * be > lsbits (because of previous assertions) so it would have - * triggered the (lsbitsbits); - FLAC__ASSERT(left < FLAC__BITS_PER_WORD); - bw->accum <<= left; - bw->accum |= uval >> (bw->bits = lsbits - left); - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->accum = uval; - } -#if 1 - } -#endif - vals++; - nvals--; - } - return true; -} - -#if 0 /* UNUSED */ -FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter) -{ - unsigned total_bits, msbs, uval; - unsigned k; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - FLAC__ASSERT(parameter > 0); - - /* fold signed to unsigned */ - if(val < 0) - 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__bitwriter_write_raw_uint32(bw, r+d, k+1)) - return false; - } - else { - if(!FLAC__bitwriter_write_raw_uint32(bw, r, k)) - return false; - } - } - return true; -} - -FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned uval, unsigned parameter) -{ - unsigned total_bits, msbs; - unsigned k; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->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__bitwriter_write_raw_uint32(bw, r+d, k+1)) - return false; - } - else { - if(!FLAC__bitwriter_write_raw_uint32(bw, r, k)) - return false; - } - } - return true; -} -#endif /* UNUSED */ - -FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val) -{ - FLAC__bool ok = 1; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - - FLAC__ASSERT(!(val & 0x80000000)); /* this version only handles 31 bits */ - - if(val < 0x80) { - return FLAC__bitwriter_write_raw_uint32(bw, val, 8); - } - else if(val < 0x800) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (val>>6), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); - } - else if(val < 0x10000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (val>>12), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); - } - else if(val < 0x200000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (val>>18), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); - } - else if(val < 0x4000000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (val>>24), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); - } - else { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (val>>30), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>24)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); - } - - return ok; -} - -FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val) -{ - FLAC__bool ok = 1; - - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); - - FLAC__ASSERT(!(val & FLAC__U64L(0xFFFFFFF000000000))); /* this version only handles 36 bits */ - - if(val < 0x80) { - return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 8); - } - else if(val < 0x800) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (FLAC__uint32)(val>>6), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); - } - else if(val < 0x10000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (FLAC__uint32)(val>>12), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); - } - else if(val < 0x200000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (FLAC__uint32)(val>>18), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); - } - else if(val < 0x4000000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (FLAC__uint32)(val>>24), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); - } - else if(val < 0x80000000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (FLAC__uint32)(val>>30), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); - } - else { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFE, 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>30)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); - } - - return ok; -} - -FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw) -{ - /* 0-pad to byte boundary */ - if(bw->bits & 7u) - return FLAC__bitwriter_write_zeroes(bw, 8 - (bw->bits & 7u)); - else - return true; -} diff --git a/src/lib/dl/ext/flac/callback.h b/src/lib/dl/ext/flac/callback.h deleted file mode 100755 index c9541210..00000000 --- a/src/lib/dl/ext/flac/callback.h +++ /dev/null @@ -1,184 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2004,2005,2006,2007 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 CANNOT 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 - -/** This is the opaque handle type used by the callbacks. Typically - * this is a \c FILE* or address of a file descriptor. - */ -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/src/lib/dl/ext/flac/common.mak b/src/lib/dl/ext/flac/common.mak deleted file mode 100755 index 29a8c4d7..00000000 --- a/src/lib/dl/ext/flac/common.mak +++ /dev/null @@ -1,36 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_FLAC_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)bitmath.obj $(SUBDIR)$(HPS)bitreader.obj $(SUBDIR)$(HPS)bitwriter.obj $(SUBDIR)$(HPS)cpu.obj $(SUBDIR)$(HPS)crc.obj $(SUBDIR)$(HPS)fixed.obj $(SUBDIR)$(HPS)float.obj $(SUBDIR)$(HPS)format.obj $(SUBDIR)$(HPS)lpc.obj $(SUBDIR)$(HPS)md5.obj $(SUBDIR)$(HPS)memory.obj $(SUBDIR)$(HPS)metadata_iterators.obj $(SUBDIR)$(HPS)metadata_object.obj $(SUBDIR)$(HPS)ogg_decoder_aspect.obj $(SUBDIR)$(HPS)ogg_encoder_aspect.obj $(SUBDIR)$(HPS)ogg_helper.obj $(SUBDIR)$(HPS)ogg_mapping.obj $(SUBDIR)$(HPS)stream_decoder.obj $(SUBDIR)$(HPS)stream_encoder.obj $(SUBDIR)$(HPS)stream_encoder_framing.obj $(SUBDIR)$(HPS)window.obj - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_FLAC_LIB) .symbolic - -exe: $(EXT_FLAC_EXE) .symbolic - -!ifdef EXT_FLAC_LIB -$(EXT_FLAC_LIB): $(OBJS) - wlib -q -b -c $(EXT_FLAC_LIB) -+$(SUBDIR)$(HPS)bitmath.obj -+$(SUBDIR)$(HPS)bitreader.obj -+$(SUBDIR)$(HPS)bitwriter.obj -+$(SUBDIR)$(HPS)cpu.obj -+$(SUBDIR)$(HPS)crc.obj -+$(SUBDIR)$(HPS)fixed.obj -+$(SUBDIR)$(HPS)float.obj -+$(SUBDIR)$(HPS)format.obj -+$(SUBDIR)$(HPS)lpc.obj -+$(SUBDIR)$(HPS)md5.obj -+$(SUBDIR)$(HPS)memory.obj -+$(SUBDIR)$(HPS)metadata_iterators.obj -+$(SUBDIR)$(HPS)metadata_object.obj -+$(SUBDIR)$(HPS)ogg_decoder_aspect.obj -+$(SUBDIR)$(HPS)ogg_encoder_aspect.obj -+$(SUBDIR)$(HPS)ogg_helper.obj -+$(SUBDIR)$(HPS)ogg_mapping.obj -+$(SUBDIR)$(HPS)stream_decoder.obj -+$(SUBDIR)$(HPS)stream_encoder.obj -+$(SUBDIR)$(HPS)stream_encoder_framing.obj -+$(SUBDIR)$(HPS)window.obj -!endif - -!ifdef EXT_FLAC_EXE -$(EXT_FLAC_EXE): $(EXT_LIBOGG_LIB) $(EXT_FLAC_LIB) $(SUBDIR)$(HPS)main.obj $(SUBDIR)$(HPS)analyze.obj $(SUBDIR)$(HPS)decode.obj $(SUBDIR)$(HPS)encode.obj $(SUBDIR)$(HPS)iffscan.obj $(SUBDIR)$(HPS)utils.obj $(SUBDIR)$(HPS)vorbiscomment.obj $(SUBDIR)$(HPS)foreign_metadata.obj $(SUBDIR)$(HPS)getopt.obj $(SUBDIR)$(HPS)getopt1.obj $(SUBDIR)$(HPS)local_string_utils.obj $(SUBDIR)$(HPS)cuesheet.obj $(SUBDIR)$(HPS)file.obj $(SUBDIR)$(HPS)picture.obj $(SUBDIR)$(HPS)replaygain.obj $(SUBDIR)$(HPS)seektable.obj $(SUBDIR)$(HPS)replaygain_synthesis.obj $(SUBDIR)$(HPS)replaygain_analysis.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) $(EXT_LIBOGG_LIB_WLINK_LIBRARIES) $(EXT_FLAC_LIB_WLINK_LIBRARIES) file $(SUBDIR)$(HPS)main.obj file $(SUBDIR)$(HPS)analyze.obj file $(SUBDIR)$(HPS)decode.obj file $(SUBDIR)$(HPS)encode.obj file $(SUBDIR)$(HPS)iffscan.obj file $(SUBDIR)$(HPS)utils.obj file $(SUBDIR)$(HPS)vorbiscomment.obj file $(SUBDIR)$(HPS)foreign_metadata.obj file $(SUBDIR)$(HPS)getopt.obj file $(SUBDIR)$(HPS)getopt1.obj file $(SUBDIR)$(HPS)local_string_utils.obj file $(SUBDIR)$(HPS)cuesheet.obj file $(SUBDIR)$(HPS)file.obj file $(SUBDIR)$(HPS)picture.obj file $(SUBDIR)$(HPS)replaygain.obj file $(SUBDIR)$(HPS)seektable.obj file $(SUBDIR)$(HPS)replaygain_synthesis.obj file $(SUBDIR)$(HPS)replaygain_analysis.obj name $(EXT_FLAC_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/flac/config.h b/src/lib/dl/ext/flac/config.h deleted file mode 100755 index 3db9ca39..00000000 --- a/src/lib/dl/ext/flac/config.h +++ /dev/null @@ -1,135 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* define to align allocated memory on 32-byte boundaries */ -#define FLAC__ALIGN_MALLOC_DATA 1 - -/* define if building for ia32/i386 */ -/* #define FLAC__CPU_IA32 1 */ - -/* define if building for PowerPC */ -/* #undef FLAC__CPU_PPC */ - -/* define if building for SPARC */ -/* #undef FLAC__CPU_SPARC */ - -/* define if you are compiling for PowerPC and have the 'as' assembler */ -/* #undef FLAC__HAS_AS */ - -/* define if you have docbook-to-man or docbook2man */ -/* #define FLAC__HAS_DOCBOOK_TO_MAN 1 */ - -/* define if you are compiling for PowerPC and have the 'gas' assembler */ -/* #define FLAC__HAS_GAS 1 */ - -/* define if you are compiling for x86 and have the NASM assembler */ -/* #define FLAC__HAS_NASM 1 */ - -/* define if you have the ogg library */ -#define FLAC__HAS_OGG 1 - -/* define to disable use of assembly code */ -/* #undef FLAC__NO_ASM */ - -/* define if your operating system supports SSE instructions */ -/* #undef FLAC__SSE_OS */ - -/* define if building for Darwin / MacOS X */ -/* #undef FLAC__SYS_DARWIN */ - -/* define if building for Linux */ -/* #define FLAC__SYS_LINUX 1 */ - -/* define to enable use of 3Dnow! instructions */ -/* #define FLAC__USE_3DNOW 1 */ - -/* define to enable use of Altivec instructions */ -/* #define FLAC__USE_ALTIVEC 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_DLFCN_H 1 */ - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -/* #define HAVE_FSEEKO 1 */ - -/* Define to 1 if you have the `getopt_long' function. */ -#define HAVE_GETOPT_LONG 1 - -/* Define if you have the iconv() function. */ -/* #define HAVE_ICONV 1 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define if you have and nl_langinfo(CODESET). */ -#define HAVE_LANGINFO_CODESET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if the system has the type `socklen_t'. */ -#define HAVE_SOCKLEN_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 the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define as const if the declaration of iconv() needs const. */ -/* #define ICONV_CONST */ - -/* Name of package */ -#define PACKAGE "flac" - -/* 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 `void*', as computed by sizeof. */ -#define SIZEOF_VOIDP 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.2.1" - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #define _FILE_OFFSET_BITS 64 */ - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -/* #undef _LARGEFILE_SOURCE */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ diff --git a/src/lib/dl/ext/flac/cpu.c b/src/lib/dl/ext/flac/cpu.c deleted file mode 100755 index 12842951..00000000 --- a/src/lib/dl/ext/flac/cpu.c +++ /dev/null @@ -1,418 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include "private/cpu.h" -#include -#include - -#if defined FLAC__CPU_IA32 -# include -#elif 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 */ - -#if defined (__NetBSD__) || defined(__OpenBSD__) -#include -#include -#include -#endif - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#include -#include -#endif - -#if defined(__APPLE__) -/* how to get sysctlbyname()? */ -#endif - -/* these are flags in EDX of CPUID AX=00000001 */ -static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR = 0x01000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000; -/* these are flags in ECX of CPUID AX=00000001 */ -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001; -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200; -/* these are flags in EDX of CPUID AX=80000001 */ -static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW = 0x80000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW = 0x40000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000; - - -/* - * Extra stuff needed for detection of OS support for SSE on IA-32 - */ -#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM && !defined FLAC__NO_SSE_OS && !defined FLAC__SSE_OS -# if defined(__linux__) -/* - * If the OS doesn't support SSE, we will get here with a SIGILL. We - * modify the return address to jump over the offending SSE instruction - * and also the operation following it that indicates the instruction - * executed successfully. In this way we use no global variables and - * stay thread-safe. - * - * 3 + 3 + 6: - * 3 bytes for "xorps xmm0,xmm0" - * 3 bytes for estimate of how long the follwing "inc var" instruction is - * 6 bytes extra in case our estimate is wrong - * 12 bytes puts us in the NOP "landing zone" - */ -# undef USE_OBSOLETE_SIGCONTEXT_FLAVOR /* #define this to use the older signal handler method */ -# ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR - static void sigill_handler_sse_os(int signal, struct sigcontext sc) - { - (void)signal; - sc.eip += 3 + 3 + 6; - } -# else -# include - static void sigill_handler_sse_os(int signal, siginfo_t *si, void *uc) - { - (void)signal, (void)si; - ((ucontext_t*)uc)->uc_mcontext.gregs[14/*REG_EIP*/] += 3 + 3 + 6; - } -# endif -# elif defined(_MSC_VER) -# include -# undef USE_TRY_CATCH_FLAVOR /* #define this to use the try/catch method for catching illegal opcode exception */ -# ifdef USE_TRY_CATCH_FLAVOR -# else - LONG CALLBACK sigill_handler_sse_os(EXCEPTION_POINTERS *ep) - { - if(ep->ExceptionRecord->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION) { - ep->ContextRecord->Eip += 3 + 3 + 6; - return EXCEPTION_CONTINUE_EXECUTION; - } - return EXCEPTION_CONTINUE_SEARCH; - } -# endif -# endif -#endif - - -void FLAC__cpu_info(FLAC__CPUInfo *info) -{ -/* - * IA32-specific - */ -#ifdef FLAC__CPU_IA32 - info->type = FLAC__CPUINFO_TYPE_IA32; -#if !defined FLAC__NO_ASM && defined FLAC__HAS_NASM - info->use_asm = true; /* we assume a minimum of 80386 with FLAC__CPU_IA32 */ - info->data.ia32.cpuid = FLAC__cpu_have_cpuid_asm_ia32()? true : false; - info->data.ia32.bswap = info->data.ia32.cpuid; /* CPUID => BSWAP since it came after */ - info->data.ia32.cmov = false; - info->data.ia32.mmx = false; - info->data.ia32.fxsr = false; - info->data.ia32.sse = false; - info->data.ia32.sse2 = false; - info->data.ia32.sse3 = false; - info->data.ia32.ssse3 = false; - info->data.ia32._3dnow = false; - info->data.ia32.ext3dnow = false; - info->data.ia32.extmmx = false; - if(info->data.ia32.cpuid) { - /* http://www.sandpile.org/ia32/cpuid.htm */ - FLAC__uint32 flags_edx, flags_ecx; - FLAC__cpu_info_asm_ia32(&flags_edx, &flags_ecx); - info->data.ia32.cmov = (flags_edx & FLAC__CPUINFO_IA32_CPUID_CMOV )? true : false; - info->data.ia32.mmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_MMX )? true : false; - info->data.ia32.fxsr = (flags_edx & FLAC__CPUINFO_IA32_CPUID_FXSR )? true : false; - info->data.ia32.sse = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE )? true : false; - info->data.ia32.sse2 = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE2 )? true : false; - info->data.ia32.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 )? true : false; - info->data.ia32.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3)? true : false; - -#ifdef FLAC__USE_3DNOW - flags_edx = FLAC__cpu_info_extended_amd_asm_ia32(); - info->data.ia32._3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW )? true : false; - info->data.ia32.ext3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW)? true : false; - info->data.ia32.extmmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX )? true : false; -#else - info->data.ia32._3dnow = info->data.ia32.ext3dnow = info->data.ia32.extmmx = false; -#endif - -#ifdef DEBUG - fprintf(stderr, "CPU info (IA-32):\n"); - fprintf(stderr, " CPUID ...... %c\n", info->data.ia32.cpuid ? 'Y' : 'n'); - fprintf(stderr, " BSWAP ...... %c\n", info->data.ia32.bswap ? 'Y' : 'n'); - fprintf(stderr, " CMOV ....... %c\n", info->data.ia32.cmov ? 'Y' : 'n'); - fprintf(stderr, " MMX ........ %c\n", info->data.ia32.mmx ? 'Y' : 'n'); - fprintf(stderr, " FXSR ....... %c\n", info->data.ia32.fxsr ? 'Y' : 'n'); - fprintf(stderr, " SSE ........ %c\n", info->data.ia32.sse ? 'Y' : 'n'); - fprintf(stderr, " SSE2 ....... %c\n", info->data.ia32.sse2 ? 'Y' : 'n'); - fprintf(stderr, " SSE3 ....... %c\n", info->data.ia32.sse3 ? 'Y' : 'n'); - fprintf(stderr, " SSSE3 ...... %c\n", info->data.ia32.ssse3 ? 'Y' : 'n'); - fprintf(stderr, " 3DNow! ..... %c\n", info->data.ia32._3dnow ? 'Y' : 'n'); - fprintf(stderr, " 3DNow!-ext . %c\n", info->data.ia32.ext3dnow? 'Y' : 'n'); - fprintf(stderr, " 3DNow!-MMX . %c\n", info->data.ia32.extmmx ? 'Y' : 'n'); -#endif - - /* - * now have to check for OS support of SSE/SSE2 - */ - if(info->data.ia32.fxsr || info->data.ia32.sse || info->data.ia32.sse2) { -#if defined FLAC__NO_SSE_OS - /* assume user knows better than us; turn it off */ - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#elif defined FLAC__SSE_OS - /* assume user knows better than us; leave as detected above */ -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__) - int sse = 0; - size_t len; - /* at least one of these must work: */ - len = sizeof(sse); sse = sse || (sysctlbyname("hw.instruction_sse", &sse, &len, NULL, 0) == 0 && sse); - len = sizeof(sse); sse = sse || (sysctlbyname("hw.optional.sse" , &sse, &len, NULL, 0) == 0 && sse); /* __APPLE__ ? */ - if(!sse) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#elif defined(__NetBSD__) || defined (__OpenBSD__) -# if __NetBSD_Version__ >= 105250000 || (defined __OpenBSD__) - int val = 0, mib[2] = { CTL_MACHDEP, CPU_SSE }; - size_t len = sizeof(val); - if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; - else { /* double-check SSE2 */ - mib[1] = CPU_SSE2; - len = sizeof(val); - if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val) - info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; - } -# else - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -# endif -#elif defined(__linux__) - int sse = 0; - struct sigaction sigill_save; -#ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR - if(0 == sigaction(SIGILL, NULL, &sigill_save) && signal(SIGILL, (void (*)(int))sigill_handler_sse_os) != SIG_ERR) -#else - struct sigaction sigill_sse; - sigill_sse.sa_sigaction = sigill_handler_sse_os; - __sigemptyset(&sigill_sse.sa_mask); - sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */ - if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save)) -#endif - { - /* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */ - /* see sigill_handler_sse_os() for an explanation of the following: */ - asm volatile ( - "xorl %0,%0\n\t" /* for some reason, still need to do this to clear 'sse' var */ - "xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */ - "incl %0\n\t" /* SIGILL handler will jump over this */ - /* landing zone */ - "nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */ - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */ - "nop\n\t" - "nop" /* SIGILL jump lands here if "inc" is 1 byte */ - : "=r"(sse) - : "r"(sse) - ); - - sigaction(SIGILL, &sigill_save, NULL); - } - - if(!sse) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#elif defined(_MSC_VER) -# ifdef USE_TRY_CATCH_FLAVOR - _try { - __asm { -# if _MSC_VER <= 1200 - /* VC6 assembler doesn't know SSE, have to emit bytecode instead */ - _emit 0x0F - _emit 0x57 - _emit 0xC0 -# else - xorps xmm0,xmm0 -# endif - } - } - _except(EXCEPTION_EXECUTE_HANDLER) { - if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; - } -# else - int sse = 0; - LPTOP_LEVEL_EXCEPTION_FILTER save = SetUnhandledExceptionFilter(sigill_handler_sse_os); - /* see GCC version above for explanation */ - /* http://msdn2.microsoft.com/en-us/library/4ks26t93.aspx */ - /* http://www.codeproject.com/cpp/gccasm.asp */ - /* http://www.hick.org/~mmiller/msvc_inline_asm.html */ - __asm { -# if _MSC_VER <= 1200 - /* VC6 assembler doesn't know SSE, have to emit bytecode instead */ - _emit 0x0F - _emit 0x57 - _emit 0xC0 -# else - xorps xmm0,xmm0 -# endif - inc sse - nop - nop - nop - nop - nop - nop - nop - nop - nop - } - SetUnhandledExceptionFilter(save); - if(!sse) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -# endif -#else - /* no way to test, disable to be safe */ - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#endif -#ifdef DEBUG - fprintf(stderr, " SSE OS sup . %c\n", info->data.ia32.sse ? 'Y' : 'n'); -#endif - - } - } -#else - info->use_asm = false; -#endif - -/* - * PPC-specific - */ -#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 val = 0, mib[2] = { CTL_HW, HW_VECTORUNIT }; - size_t len = sizeof(val); - info->data.ppc.altivec = !(sysctl(mib, 2, &val, &len, NULL, 0) || !val); - } - { - 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__USE_ALTIVEC && !FLAC__SYS_DARWIN */ - { - /* no Darwin, do it the brute-force way */ - /* @@@@@@ this is not thread-safe; replace with SSE OS method above or remove */ - info->data.ppc.altivec = 0; - info->data.ppc.ppc64 = 0; - - signal (SIGILL, sigill_handler); - canjump = 0; - 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); /*@@@@@@ should save and restore old signal */ - } -# endif -# else /* !FLAC__USE_ALTIVEC */ - info->data.ppc.altivec = 0; - info->data.ppc.ppc64 = 0; -# endif -# else - info->use_asm = false; -# endif - -/* - * unknown CPI - */ -#else - info->type = FLAC__CPUINFO_TYPE_UNKNOWN; - info->use_asm = false; -#endif -} diff --git a/src/lib/dl/ext/flac/crc.c b/src/lib/dl/ext/flac/crc.c deleted file mode 100755 index d5a699f9..00000000 --- a/src/lib/dl/ext/flac/crc.c +++ /dev/null @@ -1,142 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#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 */ - -unsigned 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; -} - -unsigned FLAC__crc16(const FLAC__byte *data, unsigned len) -{ - unsigned crc = 0; - - while(len--) - crc = ((crc<<8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]) & 0xffff; - - return crc; -} diff --git a/src/lib/dl/ext/flac/cuesheet.c b/src/lib/dl/ext/flac/cuesheet.c deleted file mode 100755 index b41979f4..00000000 --- a/src/lib/dl/ext/flac/cuesheet.c +++ /dev/null @@ -1,611 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#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__ || defined __EMX__ -#define FLAC__STRCASECMP stricmp -#else -#define FLAC__STRCASECMP strcasecmp -#endif - char buffer[4096], *line, *field; - unsigned 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; - - { - size_t linelen = strlen(line); - if((linelen == sizeof(buffer)-1) && 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) { - if(in_track_num > 99) { - *error_message = "CD-DA TRACK number must be between 1 and 99, inclusive"; - return false; - } - } - else { - if(in_track_num == 255) { - *error_message = "TRACK number 255 is reserved for the lead-out"; - return false; - } - else if(in_track_num > 255) { - *error_message = "TRACK number must be between 1 and 254, 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 : 255; - 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", (unsigned long long)(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", (unsigned long long)cs->lead_in); - fprintf(file, "REM FLAC__lead-out %u %llu\n", (unsigned)cs->tracks[track_num].number, (unsigned long long)cs->tracks[track_num].offset); -#endif -} diff --git a/src/lib/dl/ext/flac/decode.c b/src/lib/dl/ext/flac/decode.c deleted file mode 100755 index 2bcf600a..00000000 --- a/src/lib/dl/ext/flac/decode.c +++ /dev/null @@ -1,1385 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#if defined _WIN32 && !defined __CYGWIN__ -/* where MSVC puts unlink() */ -# include -#else -# include -#endif -#if defined _MSC_VER || defined __MINGW32__ -#include /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif -#include -#include /* for floor() */ -#include /* for FILE etc. */ -#include /* for strcmp(), strerror() */ -#include "flac/all.h" -#include "share/grabbag.h" -#include "share/replaygain_synthesis.h" -#include "decode.h" - -#ifdef TARGET_MSDOS /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif - -typedef struct { -#if FLAC__HAS_OGG - FLAC__bool is_ogg; - FLAC__bool use_first_serial_number; - long serial_number; -#endif - - FLAC__bool is_aiff_out; - FLAC__bool is_wave_out; - FLAC__bool treat_warnings_as_errors; - FLAC__bool continue_through_decode_errors; - FLAC__bool channel_map_none; - - struct { - replaygain_synthesis_spec_t spec; - FLAC__bool apply; /* 'spec.apply' is just a request; this 'apply' means we actually parsed the RG tags and are ready to go */ - double scale; - DitherContext dither_context; - } replaygain; - - FLAC__bool test_only; - FLAC__bool analysis_mode; - analysis_options aopts; - utils__SkipUntilSpecification *skip_specification; - utils__SkipUntilSpecification *until_specification; /* a canonicalized value of 0 mean end-of-stream (i.e. --until=-0) */ - utils__CueSpecification *cue_specification; - - const char *inbasefilename; - const char *infilename; - const char *outfilename; - - FLAC__uint64 samples_processed; - unsigned frame_counter; - FLAC__bool abort_flag; - FLAC__bool aborting_due_to_until; /* true if we intentionally abort decoding prematurely because we hit the --until point */ - FLAC__bool aborting_due_to_unparseable; /* true if we abort decoding because we hit an unparseable frame */ - - FLAC__bool iff_headers_need_fixup; - - FLAC__bool is_big_endian; - FLAC__bool is_unsigned_samples; - FLAC__bool got_stream_info; - FLAC__bool has_md5sum; - FLAC__uint64 total_samples; - unsigned bps; - unsigned channels; - unsigned sample_rate; - FLAC__uint32 channel_mask; - - /* these are used only in analyze mode */ - FLAC__uint64 decode_position; - - FLAC__StreamDecoder *decoder; - - FILE *fout; - - foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ - off_t fm_offset1, fm_offset2, fm_offset3; -} DecoderSession; - - -static FLAC__bool is_big_endian_host_; - - -/* - * local routines - */ -static FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool use_first_serial_number, long serial_number, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, foreign_metadata_t *foreign_metadata, const char *infilename, const char *outfilename); -static void DecoderSession_destroy(DecoderSession *d, FLAC__bool error_occurred); -static FLAC__bool DecoderSession_init_decoder(DecoderSession *d, const char *infilename); -static FLAC__bool DecoderSession_process(DecoderSession *d); -static int DecoderSession_finish_ok(DecoderSession *d); -static int DecoderSession_finish_error(DecoderSession *d); -static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input); -static FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uint64 samples); -static FLAC__bool write_riff_wave_fmt_chunk(FILE *f, FLAC__bool is_waveformatextensible, unsigned bps, unsigned channels, unsigned sample_rate, FLAC__uint32 channel_mask); -static FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, unsigned bps, unsigned channels, unsigned sample_rate); -static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 val); -static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 val); -static FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 val); -static FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 val); -static FLAC__bool write_sane_extended(FILE *f, unsigned val); -static FLAC__bool fixup_iff_headers(DecoderSession *d); -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 void print_error_with_init_status(const DecoderSession *d, const char *message, FLAC__StreamDecoderInitStatus init_status); -static void print_error_with_state(const DecoderSession *d, const char *message); -static void print_stats(const DecoderSession *decoder_session); - - -/* - * public routines - */ -int flac__decode_aiff(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options) -{ - DecoderSession decoder_session; - - if(! - DecoderSession_construct( - &decoder_session, -#if FLAC__HAS_OGG - options.common.is_ogg, - options.common.use_first_serial_number, - options.common.serial_number, -#else - /*is_ogg=*/false, - /*use_first_serial_number=*/false, - /*serial_number=*/0, -#endif - /*is_aiff_out=*/true, - /*is_wave_out=*/false, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - options.common.channel_map_none, - options.common.replaygain_synthesis_spec, - analysis_mode, - aopts, - &options.common.skip_specification, - &options.common.until_specification, - options.common.has_cue_specification? &options.common.cue_specification : 0, - options.foreign_metadata, - infilename, - outfilename - ) - ) - return 1; - - if(!DecoderSession_init_decoder(&decoder_session, infilename)) - return DecoderSession_finish_error(&decoder_session); - - if(!DecoderSession_process(&decoder_session)) - return DecoderSession_finish_error(&decoder_session); - - return DecoderSession_finish_ok(&decoder_session); -} - -int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options) -{ - DecoderSession decoder_session; - - if(! - DecoderSession_construct( - &decoder_session, -#if FLAC__HAS_OGG - options.common.is_ogg, - options.common.use_first_serial_number, - options.common.serial_number, -#else - /*is_ogg=*/false, - /*use_first_serial_number=*/false, - /*serial_number=*/0, -#endif - /*is_aiff_out=*/false, - /*is_wave_out=*/true, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - options.common.channel_map_none, - options.common.replaygain_synthesis_spec, - analysis_mode, - aopts, - &options.common.skip_specification, - &options.common.until_specification, - options.common.has_cue_specification? &options.common.cue_specification : 0, - options.foreign_metadata, - infilename, - outfilename - ) - ) - return 1; - - if(!DecoderSession_init_decoder(&decoder_session, infilename)) - return DecoderSession_finish_error(&decoder_session); - - if(!DecoderSession_process(&decoder_session)) - return DecoderSession_finish_error(&decoder_session); - - return DecoderSession_finish_ok(&decoder_session); -} - -int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, raw_decode_options_t options) -{ - DecoderSession decoder_session; - - decoder_session.is_big_endian = options.is_big_endian; - decoder_session.is_unsigned_samples = options.is_unsigned_samples; - - if(! - DecoderSession_construct( - &decoder_session, -#if FLAC__HAS_OGG - options.common.is_ogg, - options.common.use_first_serial_number, - options.common.serial_number, -#else - /*is_ogg=*/false, - /*use_first_serial_number=*/false, - /*serial_number=*/0, -#endif - /*is_aiff_out=*/false, - /*is_wave_out=*/false, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - options.common.channel_map_none, - options.common.replaygain_synthesis_spec, - analysis_mode, - aopts, - &options.common.skip_specification, - &options.common.until_specification, - options.common.has_cue_specification? &options.common.cue_specification : 0, - /*foreign_metadata=*/NULL, - infilename, - outfilename - ) - ) - return 1; - - if(!DecoderSession_init_decoder(&decoder_session, infilename)) - return DecoderSession_finish_error(&decoder_session); - - if(!DecoderSession_process(&decoder_session)) - return DecoderSession_finish_error(&decoder_session); - - return DecoderSession_finish_ok(&decoder_session); -} - -FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool use_first_serial_number, long serial_number, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, foreign_metadata_t *foreign_metadata, const char *infilename, const char *outfilename) -{ -#if FLAC__HAS_OGG - d->is_ogg = is_ogg; - d->use_first_serial_number = use_first_serial_number; - d->serial_number = serial_number; -#else - (void)is_ogg; - (void)use_first_serial_number; - (void)serial_number; -#endif - - d->is_aiff_out = is_aiff_out; - d->is_wave_out = is_wave_out; - d->treat_warnings_as_errors = treat_warnings_as_errors; - d->continue_through_decode_errors = continue_through_decode_errors; - d->channel_map_none = channel_map_none; - d->replaygain.spec = replaygain_synthesis_spec; - d->replaygain.apply = false; - d->replaygain.scale = 0.0; - /* d->replaygain.dither_context gets initialized later once we know the sample resolution */ - d->test_only = (0 == outfilename); - d->analysis_mode = analysis_mode; - d->aopts = aopts; - d->skip_specification = skip_specification; - d->until_specification = until_specification; - d->cue_specification = cue_specification; - - d->inbasefilename = grabbag__file_get_basename(infilename); - d->infilename = infilename; - d->outfilename = outfilename; - - d->samples_processed = 0; - d->frame_counter = 0; - d->abort_flag = false; - d->aborting_due_to_until = false; - d->aborting_due_to_unparseable = false; - - d->iff_headers_need_fixup = false; - - d->total_samples = 0; - d->got_stream_info = false; - d->has_md5sum = false; - d->bps = 0; - d->channels = 0; - d->sample_rate = 0; - d->channel_mask = 0; - - d->decode_position = 0; - - d->decoder = 0; - - d->fout = 0; /* initialized with an open file later if necessary */ - - d->foreign_metadata = foreign_metadata; - - FLAC__ASSERT(!(d->test_only && d->analysis_mode)); - - if(!d->test_only) { - if(0 == strcmp(outfilename, "-")) { - d->fout = grabbag__file_get_binary_stdout(); - } - else { - if(0 == (d->fout = fopen(outfilename, "wb"))) { - flac__utils_printf(stderr, 1, "%s: ERROR: can't open output file %s: %s\n", d->inbasefilename, outfilename, strerror(errno)); - DecoderSession_destroy(d, /*error_occurred=*/true); - return false; - } - } - } - - if(analysis_mode) - flac__analyze_init(aopts); - - return true; -} - -void DecoderSession_destroy(DecoderSession *d, FLAC__bool error_occurred) -{ - if(0 != d->fout && d->fout != stdout) { - fclose(d->fout); - if(error_occurred) - unlink(d->outfilename); - } -} - -FLAC__bool DecoderSession_init_decoder(DecoderSession *decoder_session, const char *infilename) -{ - FLAC__StreamDecoderInitStatus init_status; - FLAC__uint32 test = 1; - - is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; - - if(!decoder_session->analysis_mode && !decoder_session->test_only && (decoder_session->is_wave_out || decoder_session->is_aiff_out)) { - if(decoder_session->foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_read_from_flac(decoder_session->foreign_metadata, infilename, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", decoder_session->inbasefilename, error); - return false; - } - } - } - - decoder_session->decoder = FLAC__stream_decoder_new(); - - if(0 == decoder_session->decoder) { - flac__utils_printf(stderr, 1, "%s: ERROR creating the decoder instance\n", decoder_session->inbasefilename); - return false; - } - - FLAC__stream_decoder_set_md5_checking(decoder_session->decoder, true); - if (0 != decoder_session->cue_specification) - FLAC__stream_decoder_set_metadata_respond(decoder_session->decoder, FLAC__METADATA_TYPE_CUESHEET); - if (decoder_session->replaygain.spec.apply) - FLAC__stream_decoder_set_metadata_respond(decoder_session->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); - -#if FLAC__HAS_OGG - if(decoder_session->is_ogg) { - if(!decoder_session->use_first_serial_number) - FLAC__stream_decoder_set_ogg_serial_number(decoder_session->decoder, decoder_session->serial_number); - init_status = FLAC__stream_decoder_init_ogg_file(decoder_session->decoder, strcmp(infilename, "-")? infilename : 0, write_callback, metadata_callback, error_callback, /*client_data=*/decoder_session); - } - else -#endif - { - init_status = FLAC__stream_decoder_init_file(decoder_session->decoder, strcmp(infilename, "-")? infilename : 0, write_callback, metadata_callback, error_callback, /*client_data=*/decoder_session); - } - - if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - print_error_with_init_status(decoder_session, "ERROR initializing decoder", init_status); - return false; - } - - return true; -} - -FLAC__bool DecoderSession_process(DecoderSession *d) -{ - if(!FLAC__stream_decoder_process_until_end_of_metadata(d->decoder)) { - flac__utils_printf(stderr, 2, "\n"); - print_error_with_state(d, "ERROR while decoding metadata"); - return false; - } - if(FLAC__stream_decoder_get_state(d->decoder) > FLAC__STREAM_DECODER_END_OF_STREAM) { - flac__utils_printf(stderr, 2, "\n"); - print_error_with_state(d, "ERROR during metadata decoding"); - if(!d->continue_through_decode_errors) - return false; - } - - if(d->abort_flag) - return false; - - /* set channel mapping */ - if(!d->channel_map_none) { - /* currently FLAC order matches SMPTE/WAVEFORMATEXTENSIBLE order, so no reordering is necessary; see encode.c */ - /* only the channel mask must be set if it was not already picked up from the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag */ - if(d->channels == 1) { - if(d->channel_mask == 0) - d->channel_mask = 0x0001; - } - else if(d->channels == 2) { - if(d->channel_mask == 0) - d->channel_mask = 0x0003; - } - else if(d->channels == 3) { - if(d->channel_mask == 0) - d->channel_mask = 0x0007; - } - else if(d->channels == 4) { - if(d->channel_mask == 0) - d->channel_mask = 0x0033; - } - else if(d->channels == 5) { - if(d->channel_mask == 0) - d->channel_mask = 0x0607; - } - else if(d->channels == 6) { - if(d->channel_mask == 0) - d->channel_mask = 0x060f; - } - } - - /* write the WAVE/AIFF headers if necessary */ - if(!d->analysis_mode && !d->test_only && (d->is_wave_out || d->is_aiff_out)) { - if(!write_iff_headers(d->fout, d, d->total_samples)) { - d->abort_flag = true; - return false; - } - } - - if(d->skip_specification->value.samples > 0) { - const FLAC__uint64 skip = (FLAC__uint64)d->skip_specification->value.samples; - - if(!FLAC__stream_decoder_seek_absolute(d->decoder, skip)) { - print_error_with_state(d, "ERROR seeking while skipping bytes"); - return false; - } - } - if(!FLAC__stream_decoder_process_until_end_of_stream(d->decoder) && !d->aborting_due_to_until) { - flac__utils_printf(stderr, 2, "\n"); - print_error_with_state(d, "ERROR while decoding data"); - if(!d->continue_through_decode_errors) - return false; - } - if( - (d->abort_flag && !(d->aborting_due_to_until || d->continue_through_decode_errors)) || - (FLAC__stream_decoder_get_state(d->decoder) > FLAC__STREAM_DECODER_END_OF_STREAM && !d->aborting_due_to_until) - ) { - flac__utils_printf(stderr, 2, "\n"); - print_error_with_state(d, "ERROR during decoding"); - return false; - } - - if(!d->analysis_mode && !d->test_only && (d->is_wave_out || d->is_aiff_out) && ((d->total_samples * d->channels * ((d->bps+7)/8)) & 1)) { - if(flac__utils_fwrite("\000", 1, 1, d->fout) != 1) { - print_error_with_state(d, d->is_wave_out? - "ERROR writing pad byte to WAVE data chunk" : - "ERROR writing pad byte to AIFF SSND chunk" - ); - return false; - } - } - - return true; -} - -int DecoderSession_finish_ok(DecoderSession *d) -{ - FLAC__bool ok = true, md5_failure = false; - - if(d->decoder) { - md5_failure = !FLAC__stream_decoder_finish(d->decoder) && !d->aborting_due_to_until; - print_stats(d); - FLAC__stream_decoder_delete(d->decoder); - } - if(d->analysis_mode) - flac__analyze_finish(d->aopts); - if(md5_failure) { - flac__utils_printf(stderr, 1, "\r%s: ERROR, MD5 signature mismatch\n", d->inbasefilename); - ok = d->continue_through_decode_errors; - } - else { - if(!d->got_stream_info) { - flac__utils_printf(stderr, 1, "\r%s: WARNING, cannot check MD5 signature since there was no STREAMINFO\n", d->inbasefilename); - ok = !d->treat_warnings_as_errors; - } - else if(!d->has_md5sum) { - flac__utils_printf(stderr, 1, "\r%s: WARNING, cannot check MD5 signature since it was unset in the STREAMINFO\n", d->inbasefilename); - ok = !d->treat_warnings_as_errors; - } - flac__utils_printf(stderr, 2, "\r%s: %s \n", d->inbasefilename, d->test_only? "ok ":d->analysis_mode?"done ":"done"); - } - DecoderSession_destroy(d, /*error_occurred=*/!ok); - if(!d->analysis_mode && !d->test_only && (d->is_wave_out || d->is_aiff_out)) { - if(d->iff_headers_need_fixup || (!d->got_stream_info && strcmp(d->outfilename, "-"))) { - if(!fixup_iff_headers(d)) - return 1; - } - if(d->foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_write_to_iff(d->foreign_metadata, d->infilename, d->outfilename, d->fm_offset1, d->fm_offset2, d->fm_offset3, &error)) { - flac__utils_printf(stderr, 1, "ERROR updating foreign metadata from %s to %s: %s\n", d->infilename, d->outfilename, error); - return 1; - } - } - } - return ok? 0 : 1; -} - -int DecoderSession_finish_error(DecoderSession *d) -{ - if(d->decoder) { - (void)FLAC__stream_decoder_finish(d->decoder); - FLAC__stream_decoder_delete(d->decoder); - } - if(d->analysis_mode) - flac__analyze_finish(d->aopts); - DecoderSession_destroy(d, /*error_occurred=*/true); - return 1; -} - -FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input) -{ - /* convert from mm:ss.sss to sample number if necessary */ - flac__utils_canonicalize_skip_until_specification(spec, sample_rate); - - /* special case: if "--until=-0", use the special value '0' to mean "end-of-stream" */ - if(spec->is_relative && spec->value.samples == 0) { - spec->is_relative = false; - return true; - } - - /* in any other case the total samples in the input must be known */ - if(total_samples_in_input == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR, cannot use --until when FLAC metadata has total sample count of 0\n", inbasefilename); - return false; - } - - FLAC__ASSERT(spec->value_is_samples); - - /* convert relative specifications to absolute */ - if(spec->is_relative) { - if(spec->value.samples <= 0) - spec->value.samples += (FLAC__int64)total_samples_in_input; - else - spec->value.samples += skip; - spec->is_relative = false; - } - - /* error check */ - if(spec->value.samples < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR, --until value is before beginning of input\n", inbasefilename); - return false; - } - if((FLAC__uint64)spec->value.samples <= skip) { - flac__utils_printf(stderr, 1, "%s: ERROR, --until value is before --skip point\n", inbasefilename); - return false; - } - if((FLAC__uint64)spec->value.samples > total_samples_in_input) { - flac__utils_printf(stderr, 1, "%s: ERROR, --until value is after end of input\n", inbasefilename); - return false; - } - - return true; -} - -FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uint64 samples) -{ - const char *fmt_desc = decoder_session->is_wave_out? "WAVE" : "AIFF"; - const FLAC__bool is_waveformatextensible = decoder_session->is_wave_out && (decoder_session->channel_mask == 2 || decoder_session->channel_mask > 3 || decoder_session->bps%8 || decoder_session->channels > 2); - FLAC__uint64 data_size = samples * decoder_session->channels * ((decoder_session->bps+7)/8); - const FLAC__uint32 aligned_data_size = (FLAC__uint32)((data_size+1) & (~1U)); /* we'll check for overflow later */ - - unsigned foreign_metadata_size = 0; /* size of all non-audio non-fmt/COMM foreign metadata chunks */ - foreign_metadata_t *fm = decoder_session->foreign_metadata; - size_t i; - - if(samples == 0) { - if(f == stdout) { - flac__utils_printf(stderr, 1, "%s: WARNING, don't have accurate sample count available for %s header.\n", decoder_session->inbasefilename, fmt_desc); - flac__utils_printf(stderr, 1, " Generated %s file will have a data chunk size of 0. Try\n", fmt_desc); - flac__utils_printf(stderr, 1, " decoding directly to a file instead.\n"); - if(decoder_session->treat_warnings_as_errors) - return false; - } - else { - decoder_session->iff_headers_need_fixup = true; - } - } - - if(fm) { - FLAC__ASSERT(fm->format_block); - FLAC__ASSERT(fm->audio_block); - FLAC__ASSERT(fm->format_block < fm->audio_block); - /* calc foreign metadata size; for RIFF/AIFF we always skip the first chunk, format chunk, and sound chunk since we write our own */ - for(i = 1; i < fm->num_blocks; i++) { - if(i != fm->format_block && i != fm->audio_block) - foreign_metadata_size += fm->blocks[i].size; - } - } - - if(data_size + foreign_metadata_size + 60/*worst-case*/ >= 0xFFFFFFF4) { - flac__utils_printf(stderr, 1, "%s: ERROR: stream is too big to fit in a single %s file\n", decoder_session->inbasefilename, fmt_desc); - return false; - } - - if(decoder_session->is_wave_out) { - if(flac__utils_fwrite("RIFF", 1, 4, f) != 4) - return false; - - if(!write_little_endian_uint32(f, foreign_metadata_size + aligned_data_size + (is_waveformatextensible?60:36))) /* filesize-8 */ - return false; - - if(flac__utils_fwrite("WAVE", 1, 4, f) != 4) - return false; - - decoder_session->fm_offset1 = ftello(f); - - if(fm) { - /* seek forward to {allocate} or {skip over already-written chunks} before "fmt " */ - for(i = 1; i < fm->format_block; i++) { - if(fseeko(f, fm->blocks[i].size, SEEK_CUR) < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: allocating/skipping foreign metadata before \"fmt \"\n", decoder_session->inbasefilename); - return false; - } - } - } - - if(!write_riff_wave_fmt_chunk(f, is_waveformatextensible, decoder_session->bps, decoder_session->channels, decoder_session->sample_rate, decoder_session->channel_mask)) - return false; - - decoder_session->fm_offset2 = ftello(f); - - if(fm) { - /* seek forward to {allocate} or {skip over already-written chunks} after "fmt " but before "data" */ - for(i = fm->format_block+1; i < fm->audio_block; i++) { - if(fseeko(f, fm->blocks[i].size, SEEK_CUR) < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: allocating/skipping foreign metadata after \"fmt \"\n", decoder_session->inbasefilename); - return false; - } - } - } - - if(flac__utils_fwrite("data", 1, 4, f) != 4) - return false; - - if(!write_little_endian_uint32(f, (FLAC__uint32)data_size)) /* data size */ - return false; - - decoder_session->fm_offset3 = ftello(f) + aligned_data_size; - } - else { - FLAC__uint32 ssnd_offset_size = (fm? fm->ssnd_offset_size : 0); - - if(flac__utils_fwrite("FORM", 1, 4, f) != 4) - return false; - - if(!write_big_endian_uint32(f, foreign_metadata_size + aligned_data_size + 46 + ssnd_offset_size)) /* filesize-8 */ - return false; - - if(flac__utils_fwrite("AIFF", 1, 4, f) != 4) - return false; - - decoder_session->fm_offset1 = ftello(f); - - if(fm) { - /* seek forward to {allocate} or {skip over already-written chunks} before "COMM" */ - for(i = 1; i < fm->format_block; i++) { - if(fseeko(f, fm->blocks[i].size, SEEK_CUR) < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: allocating/skipping foreign metadata before \"COMM\"\n", decoder_session->inbasefilename); - return false; - } - } - } - - if(!write_aiff_form_comm_chunk(f, samples, decoder_session->bps, decoder_session->channels, decoder_session->sample_rate)) - return false; - - decoder_session->fm_offset2 = ftello(f); - - if(fm) { - /* seek forward to {allocate} or {skip over already-written chunks} after "COMM" but before "SSND" */ - for(i = fm->format_block+1; i < fm->audio_block; i++) { - if(fseeko(f, fm->blocks[i].size, SEEK_CUR) < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: allocating/skipping foreign metadata after \"COMM\"\n", decoder_session->inbasefilename); - return false; - } - } - } - - if(flac__utils_fwrite("SSND", 1, 4, f) != 4) - return false; - - if(!write_big_endian_uint32(f, (FLAC__uint32)data_size + 8 + ssnd_offset_size)) /* data size */ - return false; - - if(!write_big_endian_uint32(f, ssnd_offset_size)) - return false; - - if(!write_big_endian_uint32(f, 0/*block_size*/)) - return false; - - if(ssnd_offset_size) { - /* seek forward to {allocate} or {skip over already-written} SSND offset */ - if(fseeko(f, ssnd_offset_size, SEEK_CUR) < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: allocating/skipping \"SSND\" offset\n", decoder_session->inbasefilename); - return false; - } - } - - decoder_session->fm_offset3 = ftello(f) + aligned_data_size; - } - - return true; -} - -FLAC__bool write_riff_wave_fmt_chunk(FILE *f, FLAC__bool is_waveformatextensible, unsigned bps, unsigned channels, unsigned sample_rate, FLAC__uint32 channel_mask) -{ - if(flac__utils_fwrite("fmt ", 1, 4, f) != 4) - return false; - - if(!write_little_endian_uint32(f, is_waveformatextensible? 40 : 16)) /* chunk size */ - return false; - - if(!write_little_endian_uint16(f, (FLAC__uint16)(is_waveformatextensible? 65534 : 1))) /* compression code */ - return false; - - if(!write_little_endian_uint16(f, (FLAC__uint16)channels)) - return false; - - if(!write_little_endian_uint32(f, sample_rate)) - return false; - - if(!write_little_endian_uint32(f, sample_rate * channels * ((bps+7) / 8))) - return false; - - if(!write_little_endian_uint16(f, (FLAC__uint16)(channels * ((bps+7) / 8)))) /* block align */ - return false; - - if(!write_little_endian_uint16(f, (FLAC__uint16)(((bps+7)/8)*8))) /* bits per sample */ - return false; - - if(is_waveformatextensible) { - if(!write_little_endian_uint16(f, (FLAC__uint16)22)) /* cbSize */ - return false; - - if(!write_little_endian_uint16(f, (FLAC__uint16)bps)) /* validBitsPerSample */ - return false; - - if(!write_little_endian_uint32(f, channel_mask)) - return false; - - /* GUID = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} */ - if(flac__utils_fwrite("\x01\x00\x00\x00\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71", 1, 16, f) != 16) - return false; - } - - return true; -} - -FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, unsigned bps, unsigned channels, unsigned sample_rate) -{ - FLAC__ASSERT(samples <= 0xffffffff); - - if(flac__utils_fwrite("COMM", 1, 4, f) != 4) - return false; - - if(!write_big_endian_uint32(f, 18)) /* chunk size = 18 */ - return false; - - if(!write_big_endian_uint16(f, (FLAC__uint16)channels)) - return false; - - if(!write_big_endian_uint32(f, (FLAC__uint32)samples)) - return false; - - if(!write_big_endian_uint16(f, (FLAC__uint16)bps)) - return false; - - if(!write_sane_extended(f, sample_rate)) - return false; - - return true; -} - -FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 val) -{ - FLAC__byte *b = (FLAC__byte*)(&val); - if(is_big_endian_host_) { - FLAC__byte tmp; - tmp = b[1]; b[1] = b[0]; b[0] = tmp; - } - return flac__utils_fwrite(b, 1, 2, f) == 2; -} - -FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 val) -{ - FLAC__byte *b = (FLAC__byte*)(&val); - if(is_big_endian_host_) { - FLAC__byte tmp; - tmp = b[3]; b[3] = b[0]; b[0] = tmp; - tmp = b[2]; b[2] = b[1]; b[1] = tmp; - } - return flac__utils_fwrite(b, 1, 4, f) == 4; -} - -FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 val) -{ - FLAC__byte *b = (FLAC__byte*)(&val); - if(!is_big_endian_host_) { - FLAC__byte tmp; - tmp = b[1]; b[1] = b[0]; b[0] = tmp; - } - return flac__utils_fwrite(b, 1, 2, f) == 2; -} - -FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 val) -{ - FLAC__byte *b = (FLAC__byte*)(&val); - if(!is_big_endian_host_) { - FLAC__byte tmp; - tmp = b[3]; b[3] = b[0]; b[0] = tmp; - tmp = b[2]; b[2] = b[1]; b[1] = tmp; - } - return flac__utils_fwrite(b, 1, 4, f) == 4; -} - -FLAC__bool write_sane_extended(FILE *f, unsigned val) - /* Write to 'f' a SANE extended representation of 'val'. Return false if - * the write succeeds; return true otherwise. - * - * SANE extended is an 80-bit IEEE-754 representation with sign bit, 15 bits - * of exponent, and 64 bits of significand (mantissa). Unlike most IEEE-754 - * representations, it does not imply a 1 above the MSB of the significand. - * - * Preconditions: - * val!=0U - */ -{ - unsigned int shift, exponent; - - FLAC__ASSERT(val!=0U); /* handling 0 would require a special case */ - - for(shift= 0U; (val>>(31-shift))==0U; ++shift) - ; - val<<= shift; - exponent= 63U-(shift+32U); /* add 32 for unused second word */ - - if(!write_big_endian_uint16(f, (FLAC__uint16)(exponent+0x3FFF))) - return false; - if(!write_big_endian_uint32(f, val)) - return false; - if(!write_big_endian_uint32(f, 0)) /* unused second word */ - return false; - - return true; -} - -FLAC__bool fixup_iff_headers(DecoderSession *d) -{ - const char *fmt_desc = (d->is_wave_out? "WAVE" : "AIFF"); - FILE *f = fopen(d->outfilename, "r+b"); /* stream is positioned at beginning of file */ - - if(0 == f) { - flac__utils_printf(stderr, 1, "ERROR, couldn't open file %s while fixing up %s chunk size: %s\n", d->outfilename, fmt_desc, strerror(errno)); - return false; - } - - if(!write_iff_headers(f, d, d->samples_processed)) { - fclose(f); - return false; - } - - fclose(f); - return true; -} - -FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - DecoderSession *decoder_session = (DecoderSession*)client_data; - FILE *fout = decoder_session->fout; - const unsigned bps = frame->header.bits_per_sample, channels = frame->header.channels; - const unsigned shift = ((decoder_session->is_wave_out || decoder_session->is_aiff_out) && (bps%8)? 8-(bps%8): 0); - FLAC__bool is_big_endian = (decoder_session->is_aiff_out? true : (decoder_session->is_wave_out? false : decoder_session->is_big_endian)); - FLAC__bool is_unsigned_samples = (decoder_session->is_aiff_out? false : (decoder_session->is_wave_out? bps<=8 : decoder_session->is_unsigned_samples)); - unsigned wide_samples = frame->header.blocksize, wide_sample, sample, channel, byte; - unsigned frame_bytes = 0; - static FLAC__int8 s8buffer[FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int32)]; /* WATCHOUT: can be up to 2 megs */ - FLAC__uint8 *u8buffer = (FLAC__uint8 *)s8buffer; - FLAC__int16 *s16buffer = (FLAC__int16 *)s8buffer; - FLAC__uint16 *u16buffer = (FLAC__uint16 *)s8buffer; - FLAC__int32 *s32buffer = (FLAC__int32 *)s8buffer; - FLAC__uint32 *u32buffer = (FLAC__uint32 *)s8buffer; - size_t bytes_to_write = 0; - - (void)decoder; - - if(decoder_session->abort_flag) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - - /* sanity-check the bits-per-sample */ - if(decoder_session->bps) { - if(bps != decoder_session->bps) { - if(decoder_session->got_stream_info) - flac__utils_printf(stderr, 1, "%s: ERROR, bits-per-sample is %u in frame but %u in STREAMINFO\n", decoder_session->inbasefilename, bps, decoder_session->bps); - else - flac__utils_printf(stderr, 1, "%s: ERROR, bits-per-sample is %u in this frame but %u in previous frames\n", decoder_session->inbasefilename, bps, decoder_session->bps); - if(!decoder_session->continue_through_decode_errors) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - else { - /* must not have gotten STREAMINFO, save the bps from the frame header */ - FLAC__ASSERT(!decoder_session->got_stream_info); - decoder_session->bps = bps; - } - - /* sanity-check the #channels */ - if(decoder_session->channels) { - if(channels != decoder_session->channels) { - if(decoder_session->got_stream_info) - flac__utils_printf(stderr, 1, "%s: ERROR, channels is %u in frame but %u in STREAMINFO\n", decoder_session->inbasefilename, channels, decoder_session->channels); - else - flac__utils_printf(stderr, 1, "%s: ERROR, channels is %u in this frame but %u in previous frames\n", decoder_session->inbasefilename, channels, decoder_session->channels); - if(!decoder_session->continue_through_decode_errors) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - else { - /* must not have gotten STREAMINFO, save the #channels from the frame header */ - FLAC__ASSERT(!decoder_session->got_stream_info); - decoder_session->channels = channels; - } - - /* sanity-check the sample rate */ - if(decoder_session->sample_rate) { - if(frame->header.sample_rate != decoder_session->sample_rate) { - if(decoder_session->got_stream_info) - flac__utils_printf(stderr, 1, "%s: ERROR, sample rate is %u in frame but %u in STREAMINFO\n", decoder_session->inbasefilename, frame->header.sample_rate, decoder_session->sample_rate); - else - flac__utils_printf(stderr, 1, "%s: ERROR, sample rate is %u in this frame but %u in previous frames\n", decoder_session->inbasefilename, frame->header.sample_rate, decoder_session->sample_rate); - if(!decoder_session->continue_through_decode_errors) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - else { - /* must not have gotten STREAMINFO, save the sample rate from the frame header */ - FLAC__ASSERT(!decoder_session->got_stream_info); - decoder_session->sample_rate = frame->header.sample_rate; - } - - /* - * limit the number of samples to accept based on --until - */ - FLAC__ASSERT(!decoder_session->skip_specification->is_relative); - /* if we never got the total_samples from the metadata, the skip and until specs would never have been canonicalized, so protect against that: */ - if(decoder_session->skip_specification->is_relative) { - if(decoder_session->skip_specification->value.samples == 0) /* special case for when no --skip was given */ - decoder_session->skip_specification->is_relative = false; /* convert to our meaning of beginning-of-stream */ - else { - flac__utils_printf(stderr, 1, "%s: ERROR, cannot use --skip because the total sample count was not found in the metadata\n", decoder_session->inbasefilename); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - if(decoder_session->until_specification->is_relative) { - if(decoder_session->until_specification->value.samples == 0) /* special case for when no --until was given */ - decoder_session->until_specification->is_relative = false; /* convert to our meaning of end-of-stream */ - else { - flac__utils_printf(stderr, 1, "%s: ERROR, cannot use --until because the total sample count was not found in the metadata\n", decoder_session->inbasefilename); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - FLAC__ASSERT(decoder_session->skip_specification->value.samples >= 0); - FLAC__ASSERT(decoder_session->until_specification->value.samples >= 0); - if(decoder_session->until_specification->value.samples > 0) { - const FLAC__uint64 skip = (FLAC__uint64)decoder_session->skip_specification->value.samples; - const FLAC__uint64 until = (FLAC__uint64)decoder_session->until_specification->value.samples; - const FLAC__uint64 input_samples_passed = skip + decoder_session->samples_processed; - FLAC__ASSERT(until >= input_samples_passed); - if(input_samples_passed + wide_samples > until) - wide_samples = (unsigned)(until - input_samples_passed); - if (wide_samples == 0) { - decoder_session->abort_flag = true; - decoder_session->aborting_due_to_until = true; - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - - if(decoder_session->analysis_mode) { - FLAC__uint64 dpos; - FLAC__stream_decoder_get_decode_position(decoder_session->decoder, &dpos); - frame_bytes = (unsigned)(dpos-decoder_session->decode_position); - decoder_session->decode_position = dpos; - } - - if(wide_samples > 0) { - decoder_session->samples_processed += wide_samples; - decoder_session->frame_counter++; - - if(!(decoder_session->frame_counter & 0x3f)) - print_stats(decoder_session); - - if(decoder_session->analysis_mode) { - flac__analyze_frame(frame, decoder_session->frame_counter-1, decoder_session->decode_position-frame_bytes, frame_bytes, decoder_session->aopts, fout); - } - else if(!decoder_session->test_only) { - if(shift && !decoder_session->replaygain.apply) { - for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++) - ((FLAC__int32**)buffer)[channel][wide_sample] <<= shift;/*@@@@@@un-const'ing the buffer is hacky but safe*/ - } - if(decoder_session->replaygain.apply) { - bytes_to_write = FLAC__replaygain_synthesis__apply_gain( - u8buffer, - !is_big_endian, - is_unsigned_samples, - buffer, - wide_samples, - channels, - bps, /* source_bps */ - bps+shift, /* target_bps */ - decoder_session->replaygain.scale, - decoder_session->replaygain.spec.limiter == RGSS_LIMIT__HARD, /* hard_limit */ - decoder_session->replaygain.spec.noise_shaping != NOISE_SHAPING_NONE, /* do_dithering */ - &decoder_session->replaygain.dither_context - ); - } - /* first some special code for common cases */ - else if(is_big_endian == is_big_endian_host_ && !is_unsigned_samples && channels == 2 && bps+shift == 16) { - FLAC__int16 *buf1_ = s16buffer + 1; - if(is_big_endian) - memcpy(s16buffer, ((FLAC__byte*)(buffer[0]))+2, sizeof(FLAC__int32) * wide_samples - 2); - else - memcpy(s16buffer, buffer[0], sizeof(FLAC__int32) * wide_samples); - for(sample = 0; sample < wide_samples; sample++, buf1_+=2) - *buf1_ = (FLAC__int16)buffer[1][sample]; - bytes_to_write = 4 * sample; - } - else if(is_big_endian == is_big_endian_host_ && !is_unsigned_samples && channels == 1 && bps+shift == 16) { - FLAC__int16 *buf1_ = s16buffer; - for(sample = 0; sample < wide_samples; sample++) - *buf1_++ = (FLAC__int16)buffer[0][sample]; - bytes_to_write = 2 * sample; - } - /* generic code for the rest */ - else if(bps+shift == 16) { - if(is_unsigned_samples) { - if(channels == 2) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) { - u16buffer[sample++] = (FLAC__uint16)(buffer[0][wide_sample] + 0x8000); - u16buffer[sample++] = (FLAC__uint16)(buffer[1][wide_sample] + 0x8000); - } - } - else if(channels == 1) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - u16buffer[sample++] = (FLAC__uint16)(buffer[0][wide_sample] + 0x8000); - } - else { /* works for any 'channels' but above flavors are faster for 1 and 2 */ - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - u16buffer[sample] = (FLAC__uint16)(buffer[channel][wide_sample] + 0x8000); - } - } - else { - if(channels == 2) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) { - s16buffer[sample++] = (FLAC__int16)(buffer[0][wide_sample]); - s16buffer[sample++] = (FLAC__int16)(buffer[1][wide_sample]); - } - } - else if(channels == 1) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - s16buffer[sample++] = (FLAC__int16)(buffer[0][wide_sample]); - } - else { /* works for any 'channels' but above flavors are faster for 1 and 2 */ - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - s16buffer[sample] = (FLAC__int16)(buffer[channel][wide_sample]); - } - } - if(is_big_endian != is_big_endian_host_) { - unsigned char tmp; - const unsigned bytes = sample * 2; - for(byte = 0; byte < bytes; byte += 2) { - tmp = u8buffer[byte]; - u8buffer[byte] = u8buffer[byte+1]; - u8buffer[byte+1] = tmp; - } - } - bytes_to_write = 2 * sample; - } - else if(bps+shift == 24) { - if(is_unsigned_samples) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - u32buffer[sample] = buffer[channel][wide_sample] + 0x800000; - } - else { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - s32buffer[sample] = buffer[channel][wide_sample]; - } - if(is_big_endian != is_big_endian_host_) { - unsigned char tmp; - const unsigned bytes = sample * 4; - for(byte = 0; byte < bytes; byte += 4) { - tmp = u8buffer[byte]; - u8buffer[byte] = u8buffer[byte+3]; - u8buffer[byte+3] = tmp; - tmp = u8buffer[byte+1]; - u8buffer[byte+1] = u8buffer[byte+2]; - u8buffer[byte+2] = tmp; - } - } - if(is_big_endian) { - unsigned lbyte; - const unsigned bytes = sample * 4; - for(lbyte = byte = 0; byte < bytes; ) { - byte++; - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; - } - } - else { - unsigned lbyte; - const unsigned bytes = sample * 4; - for(lbyte = byte = 0; byte < bytes; ) { - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; - byte++; - } - } - bytes_to_write = 3 * sample; - } - else if(bps+shift == 8) { - if(is_unsigned_samples) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - u8buffer[sample] = (FLAC__uint8)(buffer[channel][wide_sample] + 0x80); - } - else { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - s8buffer[sample] = (FLAC__int8)(buffer[channel][wide_sample]); - } - bytes_to_write = sample; - } - else { - FLAC__ASSERT(0); - /* double protection */ - decoder_session->abort_flag = true; - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - } - if(bytes_to_write > 0) { - if(flac__utils_fwrite(u8buffer, 1, bytes_to_write, fout) != bytes_to_write) { - /* if a pipe closed when writing to stdout, we let it go without an error message */ - if(errno == EPIPE && decoder_session->fout == stdout) - decoder_session->aborting_due_to_until = true; - decoder_session->abort_flag = true; - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - DecoderSession *decoder_session = (DecoderSession*)client_data; - - if(decoder_session->analysis_mode) - FLAC__stream_decoder_get_decode_position(decoder, &decoder_session->decode_position); - - if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - FLAC__uint64 skip, until; - decoder_session->got_stream_info = true; - decoder_session->has_md5sum = memcmp(metadata->data.stream_info.md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16); - decoder_session->bps = metadata->data.stream_info.bits_per_sample; - decoder_session->channels = metadata->data.stream_info.channels; - decoder_session->sample_rate = metadata->data.stream_info.sample_rate; - - flac__utils_canonicalize_skip_until_specification(decoder_session->skip_specification, decoder_session->sample_rate); - FLAC__ASSERT(decoder_session->skip_specification->value.samples >= 0); - skip = (FLAC__uint64)decoder_session->skip_specification->value.samples; - - /* remember, metadata->data.stream_info.total_samples can be 0, meaning 'unknown' */ - if(metadata->data.stream_info.total_samples > 0 && skip >= metadata->data.stream_info.total_samples) { - flac__utils_printf(stderr, 1, "%s: ERROR trying to --skip more samples than in stream\n", decoder_session->inbasefilename); - decoder_session->abort_flag = true; - return; - } - else if(metadata->data.stream_info.total_samples == 0 && skip > 0) { - flac__utils_printf(stderr, 1, "%s: ERROR, can't --skip when FLAC metadata has total sample count of 0\n", decoder_session->inbasefilename); - decoder_session->abort_flag = true; - return; - } - FLAC__ASSERT(skip == 0 || 0 == decoder_session->cue_specification); - decoder_session->total_samples = metadata->data.stream_info.total_samples - skip; - - /* note that we use metadata->data.stream_info.total_samples instead of decoder_session->total_samples */ - if(!canonicalize_until_specification(decoder_session->until_specification, decoder_session->inbasefilename, decoder_session->sample_rate, skip, metadata->data.stream_info.total_samples)) { - decoder_session->abort_flag = true; - return; - } - FLAC__ASSERT(decoder_session->until_specification->value.samples >= 0); - until = (FLAC__uint64)decoder_session->until_specification->value.samples; - - if(until > 0) { - FLAC__ASSERT(decoder_session->total_samples != 0); - FLAC__ASSERT(0 == decoder_session->cue_specification); - decoder_session->total_samples -= (metadata->data.stream_info.total_samples - until); - } - - if(decoder_session->bps < 4 || decoder_session->bps > 24) { - flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 4-24\n", decoder_session->inbasefilename, decoder_session->bps); - decoder_session->abort_flag = true; - return; - } - } - else if(metadata->type == FLAC__METADATA_TYPE_CUESHEET) { - /* remember, at this point, decoder_session->total_samples can be 0, meaning 'unknown' */ - if(decoder_session->total_samples == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR can't use --cue when FLAC metadata has total sample count of 0\n", decoder_session->inbasefilename); - decoder_session->abort_flag = true; - return; - } - - flac__utils_canonicalize_cue_specification(decoder_session->cue_specification, &metadata->data.cue_sheet, decoder_session->total_samples, decoder_session->skip_specification, decoder_session->until_specification); - - FLAC__ASSERT(!decoder_session->skip_specification->is_relative); - FLAC__ASSERT(decoder_session->skip_specification->value_is_samples); - - FLAC__ASSERT(!decoder_session->until_specification->is_relative); - FLAC__ASSERT(decoder_session->until_specification->value_is_samples); - - FLAC__ASSERT(decoder_session->skip_specification->value.samples >= 0); - FLAC__ASSERT(decoder_session->until_specification->value.samples >= 0); - FLAC__ASSERT((FLAC__uint64)decoder_session->until_specification->value.samples <= decoder_session->total_samples); - FLAC__ASSERT(decoder_session->skip_specification->value.samples <= decoder_session->until_specification->value.samples); - - decoder_session->total_samples = decoder_session->until_specification->value.samples - decoder_session->skip_specification->value.samples; - } - else if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - if (decoder_session->replaygain.spec.apply) { - double reference, gain, peak; - if (!(decoder_session->replaygain.apply = grabbag__replaygain_load_from_vorbiscomment(metadata, decoder_session->replaygain.spec.use_album_gain, /*strict=*/false, &reference, &gain, &peak))) { - flac__utils_printf(stderr, 1, "%s: WARNING: can't get %s (or even %s) ReplayGain tags\n", decoder_session->inbasefilename, decoder_session->replaygain.spec.use_album_gain? "album":"track", decoder_session->replaygain.spec.use_album_gain? "track":"album"); - if(decoder_session->treat_warnings_as_errors) { - decoder_session->abort_flag = true; - return; - } - } - else { - const char *ls[] = { "no", "peak", "hard" }; - const char *ns[] = { "no", "low", "medium", "high" }; - decoder_session->replaygain.scale = grabbag__replaygain_compute_scale_factor(peak, gain, decoder_session->replaygain.spec.preamp, decoder_session->replaygain.spec.limiter == RGSS_LIMIT__PEAK); - FLAC__ASSERT(decoder_session->bps > 0 && decoder_session->bps <= 32); - FLAC__replaygain_synthesis__init_dither_context(&decoder_session->replaygain.dither_context, decoder_session->bps, decoder_session->replaygain.spec.noise_shaping); - flac__utils_printf(stderr, 1, "%s: INFO: applying %s ReplayGain (gain=%0.2fdB+preamp=%0.1fdB, %s noise shaping, %s limiting) to output\n", decoder_session->inbasefilename, decoder_session->replaygain.spec.use_album_gain? "album":"track", gain, decoder_session->replaygain.spec.preamp, ns[decoder_session->replaygain.spec.noise_shaping], ls[decoder_session->replaygain.spec.limiter]); - flac__utils_printf(stderr, 1, "%s: WARNING: applying ReplayGain is not lossless\n", decoder_session->inbasefilename); - /* don't check if(decoder_session->treat_warnings_as_errors) because the user explicitly asked for it */ - } - } - (void)flac__utils_get_channel_mask_tag(metadata, &decoder_session->channel_mask); - } -} - -void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - DecoderSession *decoder_session = (DecoderSession*)client_data; - (void)decoder; - flac__utils_printf(stderr, 1, "%s: *** Got error code %d:%s\n", decoder_session->inbasefilename, status, FLAC__StreamDecoderErrorStatusString[status]); - if(!decoder_session->continue_through_decode_errors) { - decoder_session->abort_flag = true; - if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM) - decoder_session->aborting_due_to_unparseable = true; - } -} - -void print_error_with_init_status(const DecoderSession *d, const char *message, FLAC__StreamDecoderInitStatus init_status) -{ - const int ilen = strlen(d->inbasefilename) + 1; - - flac__utils_printf(stderr, 1, "\n%s: %s\n", d->inbasefilename, message); - - flac__utils_printf(stderr, 1, "%*s init status = %s\n", ilen, "", FLAC__StreamDecoderInitStatusString[init_status]); - - /* print out some more info for some errors: */ - if (init_status == FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE) { - flac__utils_printf(stderr, 1, - "\n" - "An error occurred opening the input file; it is likely that it does not exist\n" - "or is not readable.\n" - ); - } -} - -void print_error_with_state(const DecoderSession *d, const char *message) -{ - const int ilen = strlen(d->inbasefilename) + 1; - - flac__utils_printf(stderr, 1, "\n%s: %s\n", d->inbasefilename, message); - flac__utils_printf(stderr, 1, "%*s state = %s\n", ilen, "", FLAC__stream_decoder_get_resolved_state_string(d->decoder)); - - /* print out some more info for some errors: */ - if (d->aborting_due_to_unparseable) { - flac__utils_printf(stderr, 1, - "\n" - "The FLAC stream may have been created by a more advanced encoder. Try\n" - " metaflac --show-vendor-tag %s\n" - "If the version number is greater than %s, this decoder is probably\n" - "not able to decode the file. If the version number is not, the file\n" - "may be corrupted, or you may have found a bug. In this case please\n" - "submit a bug report to\n" - " http://sourceforge.net/bugs/?func=addbug&group_id=13478\n" - "Make sure to use the \"Monitor\" feature to monitor the bug status.\n", - d->inbasefilename, FLAC__VERSION_STRING - ); - } -} - -void print_stats(const DecoderSession *decoder_session) -{ - if(flac__utils_verbosity_ >= 2) { -#if defined _MSC_VER || defined __MINGW32__ - /* with MSVC you have to spoon feed it the casting */ - const double progress = (double)(FLAC__int64)decoder_session->samples_processed / (double)(FLAC__int64)decoder_session->total_samples * 100.0; -#else - const double progress = (double)decoder_session->samples_processed / (double)decoder_session->total_samples * 100.0; -#endif - if(decoder_session->total_samples > 0) { - fprintf(stderr, "\r%s: %s%u%% complete", - decoder_session->inbasefilename, - decoder_session->test_only? "testing, " : decoder_session->analysis_mode? "analyzing, " : "", - (unsigned)floor(progress + 0.5) - ); - } - else { - fprintf(stderr, "\r%s: %s %u samples", - decoder_session->inbasefilename, - decoder_session->test_only? "tested" : decoder_session->analysis_mode? "analyzed" : "wrote", - (unsigned)decoder_session->samples_processed - ); - } - } -} diff --git a/src/lib/dl/ext/flac/decode.h b/src/lib/dl/ext/flac/decode.h deleted file mode 100755 index 8987ea85..00000000 --- a/src/lib/dl/ext/flac/decode.h +++ /dev/null @@ -1,74 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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__decode_h -#define flac__decode_h - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "analyze.h" -#include "foreign_metadata.h" -#include "utils.h" -#include "share/replaygain_synthesis.h" - - -typedef struct { - FLAC__bool apply; - FLAC__bool use_album_gain; /* false => use track gain */ - enum { RGSS_LIMIT__NONE, RGSS_LIMIT__PEAK, RGSS_LIMIT__HARD} limiter; - NoiseShaping noise_shaping; - double preamp; -} replaygain_synthesis_spec_t; - -typedef struct { - FLAC__bool treat_warnings_as_errors; - FLAC__bool continue_through_decode_errors; - replaygain_synthesis_spec_t replaygain_synthesis_spec; -#if FLAC__HAS_OGG - FLAC__bool is_ogg; - FLAC__bool use_first_serial_number; - long serial_number; -#endif - utils__SkipUntilSpecification skip_specification; - utils__SkipUntilSpecification until_specification; - FLAC__bool has_cue_specification; - utils__CueSpecification cue_specification; - FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ -} decode_options_t; - -/* used for AIFF also */ -typedef struct { - decode_options_t common; - foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ -} wav_decode_options_t; - -typedef struct { - decode_options_t common; - - FLAC__bool is_big_endian; - FLAC__bool is_unsigned_samples; -} raw_decode_options_t; - -/* outfile == 0 => test only */ -int flac__decode_aiff(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options); -int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options); -int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, raw_decode_options_t options); - -#endif diff --git a/src/lib/dl/ext/flac/encode.c b/src/lib/dl/ext/flac/encode.c deleted file mode 100755 index a12d6174..00000000 --- a/src/lib/dl/ext/flac/encode.c +++ /dev/null @@ -1,2941 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#if defined _WIN32 && !defined __CYGWIN__ -/* where MSVC puts unlink() */ -# include -#else -# include -#endif -#if defined _MSC_VER || defined __MINGW32__ -#include /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif -#include -#include /* for LONG_MAX */ -#include /* for floor() */ -#include /* for FILE etc. */ -#include /* for malloc */ -#include /* for strcmp(), strerror() */ -#include "flac/all.h" -#include "share/alloc.h" -#include "share/grabbag.h" -#include "encode.h" - -#ifdef TARGET_MSDOS /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#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)) - -/* this MUST be >= 588 so that sector aligning can take place with one read */ -#define CHUNK_OF_SAMPLES 2048 - -typedef struct { -#if FLAC__HAS_OGG - FLAC__bool use_ogg; -#endif - FLAC__bool verify; - FLAC__bool is_stdout; - FLAC__bool outputfile_opened; /* true if we successfully opened the output file and we want it to be deleted if there is an error */ - const char *inbasefilename; - const char *infilename; - const char *outfilename; - - FLAC__uint64 skip; - FLAC__uint64 until; /* a value of 0 mean end-of-stream (i.e. --until=-0) */ - FLAC__bool treat_warnings_as_errors; - FLAC__bool continue_through_decode_errors; - FLAC__bool replay_gain; - unsigned channels; - unsigned bits_per_sample; - unsigned sample_rate; - FLAC__uint64 unencoded_size; - FLAC__uint64 total_samples_to_encode; - FLAC__uint64 bytes_written; - FLAC__uint64 samples_written; - unsigned stats_mask; - - FLAC__StreamEncoder *encoder; - - FILE *fin; - FLAC__StreamMetadata *seek_table_template; -} EncoderSession; - -/* this is data attached to the FLAC decoder when encoding from a FLAC file */ -typedef struct { - EncoderSession *encoder_session; - off_t filesize; - const FLAC__byte *lookahead; - unsigned lookahead_length; - size_t num_metadata_blocks; - FLAC__StreamMetadata *metadata_blocks[1024]; /*@@@ BAD MAGIC number */ - FLAC__uint64 samples_left_to_process; - FLAC__bool fatal_error; -} FLACDecoderData; - -const int FLAC_ENCODE__DEFAULT_PADDING = 8192; - -static FLAC__bool is_big_endian_host_; - -static unsigned char ucbuffer_[CHUNK_OF_SAMPLES*FLAC__MAX_CHANNELS*((FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE+7)/8)]; -static signed char *scbuffer_ = (signed char *)ucbuffer_; -static FLAC__uint16 *usbuffer_ = (FLAC__uint16 *)ucbuffer_; -static FLAC__int16 *ssbuffer_ = (FLAC__int16 *)ucbuffer_; - -static FLAC__int32 in_[FLAC__MAX_CHANNELS][CHUNK_OF_SAMPLES]; -static FLAC__int32 *input_[FLAC__MAX_CHANNELS]; - - -/* - * unpublished debug routines from the FLAC libs - */ -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); -extern FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder, FLAC__bool value); - -/* - * local routines - */ -static FLAC__bool EncoderSession_construct(EncoderSession *e, FLAC__bool use_ogg, FLAC__bool verify, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FILE *infile, const char *infilename, const char *outfilename); -static void EncoderSession_destroy(EncoderSession *e); -static int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_align_zero, foreign_metadata_t *foreign_metadata); -static int EncoderSession_finish_error(EncoderSession *e); -static FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options, FLAC__uint32 channel_mask, unsigned channels, unsigned bps, unsigned sample_rate, const foreign_metadata_t *foreign_metadata, FLACDecoderData *flac_decoder_data); -static FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], unsigned samples); -static FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int num_requested_seek_points, FLAC__StreamMetadata *cuesheet, EncoderSession *e); -static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input); -static FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, unsigned num_metadata); -static FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map); -static void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); -static FLAC__StreamDecoderReadStatus flac_decoder_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); -static FLAC__StreamDecoderSeekStatus flac_decoder_seek_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); -static FLAC__StreamDecoderTellStatus flac_decoder_tell_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); -static FLAC__StreamDecoderLengthStatus flac_decoder_length_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); -static FLAC__bool flac_decoder_eof_callback(const FLAC__StreamDecoder *decoder, void *client_data); -static FLAC__StreamDecoderWriteStatus flac_decoder_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); -static void flac_decoder_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); -static void flac_decoder_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); -static FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors); -static void print_stats(const EncoderSession *encoder_session); -static void print_error_with_init_status(const EncoderSession *e, const char *message, FLAC__StreamEncoderInitStatus init_status); -static void print_error_with_state(const EncoderSession *e, const char *message); -static void print_verify_error(EncoderSession *e); -static FLAC__bool read_little_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_little_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_big_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_big_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset); -static unsigned count_channel_mask_bits(FLAC__uint32 mask); -#if 0 -static FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, unsigned channels); -#endif - -/* - * public routines - */ -int flac__encode_aif(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc) -{ - EncoderSession encoder_session; - FLAC__uint16 x; - FLAC__uint32 xx; - unsigned int channels= 0U, bps= 0U, shift= 0U, sample_rate= 0U, sample_frames= 0U; - size_t channel_map[FLAC__MAX_CHANNELS]; - FLAC__bool got_comm_chunk= false, got_ssnd_chunk= false; - int info_align_carry= -1, info_align_zero= -1; - FLAC__bool is_big_endian_pcm = true; - - (void)infilesize; /* silence compiler warning about unused parameter */ - (void)lookahead; /* silence compiler warning about unused parameter */ - (void)lookahead_length; /* silence compiler warning about unused parameter */ - - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; - - /* initialize default channel map that preserves channel order */ - { - size_t i; - for(i = 0; i < sizeof(channel_map)/sizeof(channel_map[0]); i++) - channel_map[i] = i; - } - - if(options.foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_read_from_aiff(options.foreign_metadata, infilename, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", encoder_session.inbasefilename, error); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* lookahead[] already has "FORMxxxxAIFF", do sub-chunks */ - - while(1) { - size_t c= 0U; - char chunk_id[5] = { '\0', '\0', '\0', '\0', '\0' }; /* one extra byte for terminating NUL so we can also treat it like a C string */ - - /* chunk identifier; really conservative about behavior of fread() and feof() */ - if(feof(infile) || ((c= fread(chunk_id, 1U, 4U, infile)), c==0U && feof(infile))) - break; - else if(c<4U || feof(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR: incomplete chunk identifier\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - if(got_comm_chunk==false && !memcmp(chunk_id, "COMM", 4)) { /* common chunk */ - unsigned long skip; - const FLAC__uint32 minimum_comm_size = (is_aifc? 22 : 18); - - /* COMM chunk size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(xxFLAC__MAX_CHANNELS) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number channels %u\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - else if(x>2U && !options.common.channel_map_none) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number channels %u for AIFF\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && x!=2U) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u channels, must be 2 for --sector-align\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - channels= x; - - /* number of sample frames */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - sample_frames= xx; - - /* bits per sample */ - if(!read_big_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(x<4U || x>24U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported bits-per-sample %u\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && x!=16U) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u bits-per-sample, must be 16 for --sector-align\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - bps= x; - shift= (bps%8)? 8-(bps%8) : 0; /* SSND data is always byte-aligned, left-justified but format_input() will double-check */ - bps+= shift; - - /* sample rate */ - if(!read_sane_extended(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(!FLAC__format_sample_rate_is_valid(xx)) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported sample rate %u\n", encoder_session.inbasefilename, (unsigned int)xx); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && xx!=44100U) { - flac__utils_printf(stderr, 1, "%s: ERROR: file's sample rate is %u, must be 44100 for --sector-align\n", encoder_session.inbasefilename, (unsigned int)xx); - return EncoderSession_finish_error(&encoder_session); - } - sample_rate= xx; - - /* check compression type for AIFF-C */ - if(is_aifc) { - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(xx == 0x736F7774) /* "sowt" */ - is_big_endian_pcm = false; - else if(xx == 0x4E4F4E45) /* "NONE" */ - ; /* nothing to do, we already default to big-endian */ - else { - flac__utils_printf(stderr, 1, "%s: ERROR: can't handle AIFF-C compression type \"%c%c%c%c\"\n", encoder_session.inbasefilename, (char)(xx>>24), (char)((xx>>16)&8), (char)((xx>>8)&8), (char)(xx&8)); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* set channel mapping */ - /* FLAC order follows SMPTE and WAVEFORMATEXTENSIBLE but with fewer channels, which are: */ - /* front left, front right, center, LFE, back left, back right, surround left, surround right */ - /* specs say the channel ordering is: - * 1 2 3 4 5 6 - * ___________________________________________________ - * 2 stereo l r - * 3 l r c - * 4 l c r S - * quad (ambiguous with 4ch) Fl Fr Bl Br - * 5 Fl Fr Fc Sl Sr - * 6 l lc c r rc S - * l:left r:right c:center Fl:front-left Fr:front-right Bl:back-left Br:back-right Lc:left-center Rc:right-center S:surround - * so we only have unambiguous mappings for 2, 3, and 5 channels - */ - if( - options.common.channel_map_none || - channels == 1 || /* 1 channel: (mono) */ - channels == 2 || /* 2 channels: left, right */ - channels == 3 || /* 3 channels: left, right, center */ - channels == 5 /* 5 channels: front left, front right, center, surround left, surround right */ - ) { - /* keep default channel order */ - } - else { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number channels %u for AIFF\n", encoder_session.inbasefilename, channels); - return EncoderSession_finish_error(&encoder_session); - } - - /* skip any extra data in the COMM chunk */ - if(!fskip_ahead(infile, skip)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over extra COMM data\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - /* - * now that we know the sample rate, canonicalize the - * --skip string to a number of samples: - */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.skip == 0); - - got_comm_chunk= true; - } - else if(got_ssnd_chunk==false && !memcmp(chunk_id, "SSND", 4)) { /* sound data chunk */ - unsigned int offset= 0U, block_size= 0U, align_remainder= 0U, data_bytes; - const size_t bytes_per_frame= channels*(bps>>3); - FLAC__uint64 total_samples_in_input, trim = 0; - FLAC__bool pad= false; - - if(got_comm_chunk==false) { - flac__utils_printf(stderr, 1, "%s: ERROR: got 'SSND' chunk before 'COMM' chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - /* SSND chunk size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(options.common.ignore_chunk_sizes) { - FLAC__ASSERT(!options.common.sector_align); - data_bytes = (unsigned)(-(int)bytes_per_frame); /* max out data_bytes; we'll use EOF as signal to stop reading */ - } - else { - data_bytes= xx; - data_bytes-= 8U; /* discount the offset and block size fields */ - } - pad= (data_bytes & 1U) ? true : false; - - /* offset */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - offset= xx; - data_bytes-= offset; - - /* block size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(xx!=0U) { - flac__utils_printf(stderr, 1, "%s: ERROR: block size is %u; must be 0\n", encoder_session.inbasefilename, (unsigned int)xx); - return EncoderSession_finish_error(&encoder_session); - } - block_size= xx; - - /* skip any SSND offset bytes */ - FLAC__ASSERT(offset<=LONG_MAX); - if(!fskip_ahead(infile, offset)) { - flac__utils_printf(stderr, 1, "%s: ERROR: skipping offset in SSND chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - if(data_bytes!=(sample_frames*bytes_per_frame)) { - flac__utils_printf(stderr, 1, "%s: ERROR: SSND chunk size inconsistent with sample frame count\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - /* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */ - FLAC__ASSERT(options.common.sector_align || *options.common.align_reservoir_samples == 0); - total_samples_in_input = data_bytes / bytes_per_frame + *options.common.align_reservoir_samples; - - /* - * now that we know the input size, canonicalize the - * --until string to an absolute sample number: - */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, sample_rate, encoder_session.skip, total_samples_in_input)) - return EncoderSession_finish_error(&encoder_session); - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.until == 0); - - if(encoder_session.skip>0U) { - if(!fskip_ahead(infile, encoder_session.skip*bytes_per_frame)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - data_bytes-= (unsigned int)encoder_session.skip*bytes_per_frame; /*@@@ WATCHOUT: 4GB limit */ - if(options.common.ignore_chunk_sizes) { - encoder_session.total_samples_to_encode= 0; - flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n"); - FLAC__ASSERT(0 == encoder_session.until); - } - else { - encoder_session.total_samples_to_encode= total_samples_in_input - encoder_session.skip; - } - if(encoder_session.until > 0) { - trim = total_samples_in_input - encoder_session.until; - FLAC__ASSERT(total_samples_in_input > 0); - FLAC__ASSERT(!options.common.sector_align); - data_bytes-= (unsigned int)trim*bytes_per_frame; - encoder_session.total_samples_to_encode-= trim; - } - if(options.common.sector_align) { - align_remainder= (unsigned int)(encoder_session.total_samples_to_encode % 588U); - if(options.common.is_last_file) - encoder_session.total_samples_to_encode+= (588U-align_remainder); /* will pad with zeroes */ - else - encoder_session.total_samples_to_encode-= align_remainder; /* will stop short and carry over to next file */ - } - - /* +54 for the size of the AIFF headers; this is just an estimate for the progress indicator and doesn't need to be exact */ - encoder_session.unencoded_size= encoder_session.total_samples_to_encode*bytes_per_frame+54; - - if(!EncoderSession_init_encoder(&encoder_session, options.common, /*channel_mask=*/0, channels, bps-shift, sample_rate, options.foreign_metadata, /*flac_decoder_data=*/0)) - return EncoderSession_finish_error(&encoder_session); - - /* first do any samples in the reservoir */ - if(options.common.sector_align && *options.common.align_reservoir_samples>0U) { - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 *const *)options.common.align_reservoir, *options.common.align_reservoir_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* decrement the data_bytes counter if we need to align the file */ - if(options.common.sector_align) { - if(options.common.is_last_file) - *options.common.align_reservoir_samples= 0U; - else { - *options.common.align_reservoir_samples= align_remainder; - data_bytes-= (*options.common.align_reservoir_samples)*bytes_per_frame; - } - } - - /* now do from the file */ - while(data_bytes>0) { - size_t bytes_read= fread(ucbuffer_, 1U, min(data_bytes, CHUNK_OF_SAMPLES*bytes_per_frame), infile); - - if(bytes_read==0U) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(feof(infile)) { - if(options.common.ignore_chunk_sizes) { - flac__utils_printf(stderr, 1, "%s: INFO: hit EOF with --ignore-chunk-sizes, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.samples_written); - } - else { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - data_bytes= 0; - } - } - else { - if(bytes_read % bytes_per_frame != 0U) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else { - unsigned int frames= bytes_read/bytes_per_frame; - if(!format_input(input_, frames, is_big_endian_pcm, /*is_unsigned_samples=*/false, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 *const *)input_, frames)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - else - data_bytes-= bytes_read; - } - } - } - - if(trim>0) { - FLAC__ASSERT(!options.common.sector_align); - if(!fskip_ahead(infile, trim*bytes_per_frame)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* now read unaligned samples into reservoir or pad with zeroes if necessary */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - unsigned int pad_frames= 588U-align_remainder; - - if(pad_frames<588U) { - unsigned int i; - - info_align_zero= pad_frames; - for(i= 0U; i 0) { - size_t bytes_read= fread(ucbuffer_, 1U, (*options.common.align_reservoir_samples)*bytes_per_frame, infile); - - FLAC__ASSERT(CHUNK_OF_SAMPLES>=588U); - if(bytes_read==0U && ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_frame) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned int)bytes_read, (unsigned int)encoder_session.total_samples_to_encode, (unsigned int)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - else { - info_align_carry= *options.common.align_reservoir_samples; - if(!format_input(options.common.align_reservoir, *options.common.align_reservoir_samples, is_big_endian_pcm, /*is_unsigned_samples=*/false, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - } - } - } - } - - if(pad==true) { - unsigned char tmp; - - if(fread(&tmp, 1U, 1U, infile)<1U) { - flac__utils_printf(stderr, 1, "%s: ERROR during read of SSND pad byte\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - got_ssnd_chunk= true; - } - else { /* other chunk */ - if(!options.foreign_metadata) { - if(!memcmp(chunk_id, "COMM", 4)) - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'COMM' chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); - else if(!memcmp(chunk_id, "SSND", 4)) - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'SSND' chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); - else if(!options.foreign_metadata) - flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown chunk '%s' (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename, chunk_id); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - - /* chunk size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else { - unsigned long skip= xx+(xx & 1U); - - FLAC__ASSERT(skip<=LONG_MAX); - if(!fskip_ahead(infile, skip)) { - fprintf(stderr, "%s: ERROR during read while skipping over unknown chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - } - } - - if(got_ssnd_chunk==false && sample_frames!=0U) { - flac__utils_printf(stderr, 1, "%s: ERROR: missing SSND chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero, options.foreign_metadata); -} - -int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options) -{ - EncoderSession encoder_session; - FLAC__bool is_unsigned_samples = false; - unsigned channels = 0, bps = 0, sample_rate = 0, shift = 0; - size_t bytes_read; - size_t channel_map[FLAC__MAX_CHANNELS]; - FLAC__uint16 x, format; /* format is the wFormatTag word from the 'fmt ' chunk */ - FLAC__uint32 xx, channel_mask = 0; - FLAC__bool got_fmt_chunk = false, got_data_chunk = false; - unsigned align_remainder = 0; - int info_align_carry = -1, info_align_zero = -1; - - (void)infilesize; - (void)lookahead; - (void)lookahead_length; - - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; - - /* initialize default channel map that preserves channel order */ - { - size_t i; - for(i = 0; i < sizeof(channel_map)/sizeof(channel_map[0]); i++) - channel_map[i] = i; - } - - if(options.foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_read_from_wave(options.foreign_metadata, infilename, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", encoder_session.inbasefilename, error); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* - * lookahead[] already has "RIFFxxxxWAVE", do sub-chunks - */ - while(!feof(infile)) { - if(!read_little_endian_uint32(infile, &xx, true, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(feof(infile)) - break; - if(xx == 0x20746d66 && !got_fmt_chunk) { /* "fmt " */ - unsigned block_align, data_bytes; - - /* see - * http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html - * http://windowssdk.msdn.microsoft.com/en-us/library/ms713497.aspx - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/audio_r/hh/Audio_r/aud-prop_d40f094e-44f9-4baa-8a15-03e4fb369501.xml.asp - * - * WAVEFORMAT is - * 4 byte: subchunk size - * 2 byte: format type: 1 for WAVE_FORMAT_PCM, 65534 for WAVE_FORMAT_EXTENSIBLE - * 2 byte: # channels - * 4 byte: sample rate (Hz) - * 4 byte: avg bytes per sec - * 2 byte: block align - * 2 byte: bits per sample (not necessarily all significant) - * WAVEFORMATEX adds - * 2 byte: extension size in bytes (usually 0 for WAVEFORMATEX and 22 for WAVEFORMATEXTENSIBLE with PCM) - * WAVEFORMATEXTENSIBLE adds - * 2 byte: valid bits per sample - * 4 byte: channel mask - * 16 byte: subformat GUID, first 2 bytes have format type, 1 being PCM - * - * Current spec says WAVEFORMATEX with PCM must have bps == 8 or 16, or any multiple of 8 for WAVEFORMATEXTENSIBLE. - * Lots of old broken WAVEs/apps have don't follow it, e.g. 20 bps but a block align of 3/6 for mono/stereo. - * - * Block align for WAVE_FORMAT_PCM or WAVE_FORMAT_EXTENSIBLE is also supposed to be channels*bps/8 - * - * If the channel mask has more set bits than # of channels, the extra MSBs are ignored. - * If the channel mask has less set bits than # of channels, the extra channels are unassigned to any speaker. - * - * Data is supposed to be unsigned for bps <= 8 else signed. - */ - - /* fmt sub-chunk size */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - data_bytes = xx; - if(data_bytes < 16) { - flac__utils_printf(stderr, 1, "%s: ERROR: found non-standard 'fmt ' sub-chunk which has length = %u\n", encoder_session.inbasefilename, data_bytes); - return EncoderSession_finish_error(&encoder_session); - } - /* format code */ - if(!read_little_endian_uint16(infile, &format, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(format != 1 /*WAVE_FORMAT_PCM*/ && format != 65534 /*WAVE_FORMAT_EXTENSIBLE*/) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported format type %u\n", encoder_session.inbasefilename, (unsigned)format); - return EncoderSession_finish_error(&encoder_session); - } - /* number of channels */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - channels = (unsigned)x; - if(channels == 0 || channels > FLAC__MAX_CHANNELS) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number of channels %u\n", encoder_session.inbasefilename, channels); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && channels != 2) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u channels, must be 2 for --sector-align\n", encoder_session.inbasefilename, channels); - return EncoderSession_finish_error(&encoder_session); - } - /* sample rate */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - sample_rate = xx; - if(!FLAC__format_sample_rate_is_valid(sample_rate)) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported sample rate %u\n", encoder_session.inbasefilename, sample_rate); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && sample_rate != 44100) { - flac__utils_printf(stderr, 1, "%s: ERROR: file's sample rate is %u, must be 44100 for --sector-align\n", encoder_session.inbasefilename, sample_rate); - return EncoderSession_finish_error(&encoder_session); - } - /* avg bytes per second (ignored) */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - /* block align */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - block_align = (unsigned)x; - /* bits per sample */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - bps = (unsigned)x; - is_unsigned_samples = (bps <= 8); - if(format == 1) { - if(bps != 8 && bps != 16) { - if(bps == 24 || bps == 32) { - /* let these slide with a warning since they're unambiguous */ - flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file has format type %u but bits-per-sample=%u\n", encoder_session.inbasefilename, (unsigned)format, bps); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - else { - /* @@@ we could add an option to specify left- or right-justified blocks so we knew how to set 'shift' */ - flac__utils_printf(stderr, 1, "%s: ERROR: legacy WAVE file has format type %u but bits-per-sample=%u\n", encoder_session.inbasefilename, (unsigned)format, bps); - return EncoderSession_finish_error(&encoder_session); - } - } -#if 0 /* @@@ reinstate once we can get an answer about whether the samples are left- or right-justified */ - if((bps+7)/8 * channels == block_align) { - if(bps % 8) { - /* assume legacy file is byte aligned with some LSBs zero; this is double-checked in format_input() */ - flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", encoder_session.inbasefilename, (unsigned)format, block_align, bps, channels); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - shift = 8 - (bps % 8); - bps += shift; - } - else - shift = 0; - } - else { - flac__utils_printf(stderr, 1, "%s: ERROR: illegal WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", encoder_session.inbasefilename, (unsigned)format, block_align, bps, channels); - return EncoderSession_finish_error(&encoder_session); - } -#else - shift = 0; -#endif - if(channels > 2 && !options.common.channel_map_none) { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot assign channels\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - FLAC__ASSERT(data_bytes >= 16); - data_bytes -= 16; - } - else { - if(data_bytes < 40) { - flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with size %u\n", encoder_session.inbasefilename, data_bytes); - return EncoderSession_finish_error(&encoder_session); - } - /* cbSize */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(x < 22) { - flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with cbSize %u\n", encoder_session.inbasefilename, (unsigned)x); - return EncoderSession_finish_error(&encoder_session); - } - /* valid bps */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if((unsigned)x > bps) { - flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with wValidBitsPerSample (%u) > wBitsPerSample (%u)\n", encoder_session.inbasefilename, (unsigned)x, bps); - return EncoderSession_finish_error(&encoder_session); - } - shift = bps - (unsigned)x; - /* channel mask */ - if(!read_little_endian_uint32(infile, &channel_mask, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - /* for mono/stereo and unassigned channels, we fake the mask */ - if(channel_mask == 0) { - if(channels == 1) - channel_mask = 0x0001; - else if(channels == 2) - channel_mask = 0x0003; - } - /* set channel mapping */ - /* FLAC order follows SMPTE and WAVEFORMATEXTENSIBLE but with fewer channels, which are: */ - /* front left, front right, center, LFE, back left, back right, surround left, surround right */ - /* the default mapping is sufficient for 1-6 channels and 7-8 are currently unspecified anyway */ -#if 0 - /* @@@ example for dolby/vorbis order, for reference later in case it becomes important */ - if( - options.common.channel_map_none || - channel_mask == 0x0001 || /* 1 channel: (mono) */ - channel_mask == 0x0003 || /* 2 channels: front left, front right */ - channel_mask == 0x0033 || /* 4 channels: front left, front right, back left, back right */ - channel_mask == 0x0603 /* 4 channels: front left, front right, side left, side right */ - ) { - /* keep default channel order */ - } - else if( - channel_mask == 0x0007 || /* 3 channels: front left, front right, front center */ - channel_mask == 0x0037 || /* 5 channels: front left, front right, front center, back left, back right */ - channel_mask == 0x0607 /* 5 channels: front left, front right, front center, side left, side right */ - ) { - /* to dolby order: front left, center, front right [, surround left, surround right ] */ - channel_map[1] = 2; - channel_map[2] = 1; - } - else if( - channel_mask == 0x003f || /* 6 channels: front left, front right, front center, LFE, back left, back right */ - channel_mask == 0x060f /* 6 channels: front left, front right, front center, LFE, side left, side right */ - ) { - /* to dolby order: front left, center, front right, surround left, surround right, LFE */ - channel_map[1] = 2; - channel_map[2] = 1; - channel_map[3] = 5; - channel_map[4] = 3; - channel_map[5] = 4; - } -#else - if( - options.common.channel_map_none || - channel_mask == 0x0001 || /* 1 channel: (mono) */ - channel_mask == 0x0003 || /* 2 channels: front left, front right */ - channel_mask == 0x0007 || /* 3 channels: front left, front right, front center */ - channel_mask == 0x0033 || /* 4 channels: front left, front right, back left, back right */ - channel_mask == 0x0603 || /* 4 channels: front left, front right, side left, side right */ - channel_mask == 0x0037 || /* 5 channels: front left, front right, front center, back left, back right */ - channel_mask == 0x0607 || /* 5 channels: front left, front right, front center, side left, side right */ - channel_mask == 0x003f || /* 6 channels: front left, front right, front center, LFE, back left, back right */ - channel_mask == 0x060f /* 6 channels: front left, front right, front center, LFE, side left, side right */ - ) { - /* keep default channel order */ - } -#endif - else { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk with unsupported channel mask=0x%04X\n", encoder_session.inbasefilename, (unsigned)channel_mask); - return EncoderSession_finish_error(&encoder_session); - } - if(!options.common.channel_map_none) { - if(count_channel_mask_bits(channel_mask) < channels) { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has unassigned channels (#channels=%u)\n", encoder_session.inbasefilename, (unsigned)channel_mask, channels); - return EncoderSession_finish_error(&encoder_session); - } -#if 0 - /* supporting this is too difficult with channel mapping; e.g. what if mask is 0x003f but #channels=4? - * there would be holes in the order that would have to be filled in, or the mask would have to be - * limited and the logic above rerun to see if it still fits into the FLAC mapping. - */ - else if(count_channel_mask_bits(channel_mask) > channels) - channel_mask = limit_channel_mask(channel_mask, channels); -#else - else if(count_channel_mask_bits(channel_mask) > channels) { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has extra bits for non-existant channels (#channels=%u)\n", encoder_session.inbasefilename, (unsigned)channel_mask, channels); - return EncoderSession_finish_error(&encoder_session); - } -#endif - } - /* first part of GUID */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(x != 1) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported WAVEFORMATEXTENSIBLE chunk with non-PCM format %u\n", encoder_session.inbasefilename, (unsigned)x); - return EncoderSession_finish_error(&encoder_session); - } - data_bytes -= 26; - } - - if(bps-shift < 4 || bps-shift > 24) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported bits-per-sample %u\n", encoder_session.inbasefilename, bps-shift); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && bps-shift != 16) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u bits-per-sample, must be 16 for --sector-align\n", encoder_session.inbasefilename, bps-shift); - return EncoderSession_finish_error(&encoder_session); - } - - /* skip any extra data in the fmt sub-chunk */ - if(!fskip_ahead(infile, data_bytes)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over extra 'fmt' data\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - /* - * now that we know the sample rate, canonicalize the - * --skip string to a number of samples: - */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.skip == 0); - - got_fmt_chunk = true; - } - else if(xx == 0x61746164 && !got_data_chunk && got_fmt_chunk) { /* "data" */ - FLAC__uint64 total_samples_in_input, trim = 0; - FLAC__bool pad = false; - const size_t bytes_per_wide_sample = channels * (bps >> 3); - unsigned data_bytes; - - /* data size */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(options.common.ignore_chunk_sizes) { - FLAC__ASSERT(!options.common.sector_align); - data_bytes = (unsigned)(-(int)bytes_per_wide_sample); /* max out data_bytes; we'll use EOF as signal to stop reading */ - } - else { - data_bytes = xx; - if(0 == data_bytes) { - flac__utils_printf(stderr, 1, "%s: ERROR: 'data' subchunk has size of 0\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - pad = (data_bytes & 1U) ? true : false; - - /* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */ - FLAC__ASSERT(options.common.sector_align || *options.common.align_reservoir_samples == 0); - total_samples_in_input = data_bytes / bytes_per_wide_sample + *options.common.align_reservoir_samples; - - /* - * now that we know the input size, canonicalize the - * --until string to an absolute sample number: - */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, sample_rate, encoder_session.skip, total_samples_in_input)) - return EncoderSession_finish_error(&encoder_session); - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.until == 0); - - if(encoder_session.skip > 0) { - if(!fskip_ahead(infile, encoder_session.skip * bytes_per_wide_sample)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - data_bytes -= (unsigned)encoder_session.skip * bytes_per_wide_sample; /*@@@ WATCHOUT: 4GB limit */ - if(options.common.ignore_chunk_sizes) { - encoder_session.total_samples_to_encode = 0; - flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n"); - FLAC__ASSERT(0 == encoder_session.until); - } - else { - encoder_session.total_samples_to_encode = total_samples_in_input - encoder_session.skip; - } - if(encoder_session.until > 0) { - trim = total_samples_in_input - encoder_session.until; - FLAC__ASSERT(total_samples_in_input > 0); - FLAC__ASSERT(!options.common.sector_align); - data_bytes -= (unsigned int)trim * bytes_per_wide_sample; - encoder_session.total_samples_to_encode -= trim; - } - if(options.common.sector_align) { - align_remainder = (unsigned)(encoder_session.total_samples_to_encode % 588); - if(options.common.is_last_file) - encoder_session.total_samples_to_encode += (588-align_remainder); /* will pad with zeroes */ - else - encoder_session.total_samples_to_encode -= align_remainder; /* will stop short and carry over to next file */ - } - - /* +44 for the size of the WAV headers; this is just an estimate for the progress indicator and doesn't need to be exact */ - encoder_session.unencoded_size = encoder_session.total_samples_to_encode * bytes_per_wide_sample + 44; - - if(!EncoderSession_init_encoder(&encoder_session, options.common, channel_mask, channels, bps-shift, sample_rate, options.foreign_metadata, /*flac_decoder_data=*/0)) - return EncoderSession_finish_error(&encoder_session); - - /* - * first do any samples in the reservoir - */ - if(options.common.sector_align && *options.common.align_reservoir_samples > 0) { - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)options.common.align_reservoir, *options.common.align_reservoir_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* - * decrement the data_bytes counter if we need to align the file - */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - *options.common.align_reservoir_samples = 0; - } - else { - *options.common.align_reservoir_samples = align_remainder; - data_bytes -= (*options.common.align_reservoir_samples) * bytes_per_wide_sample; - } - } - - /* - * now do from the file - */ - while(data_bytes > 0) { - bytes_read = fread(ucbuffer_, sizeof(unsigned char), min(data_bytes, CHUNK_OF_SAMPLES * bytes_per_wide_sample), infile); - if(bytes_read == 0) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(feof(infile)) { - if(options.common.ignore_chunk_sizes) { - flac__utils_printf(stderr, 1, "%s: INFO: hit EOF with --ignore-chunk-sizes, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.samples_written); - } - else { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - data_bytes = 0; - } - } - else { - if(bytes_read % bytes_per_wide_sample != 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else { - unsigned wide_samples = bytes_read / bytes_per_wide_sample; - if(!format_input(input_, wide_samples, /*is_big_endian=*/false, is_unsigned_samples, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - data_bytes -= bytes_read; - } - } - } - - if(trim > 0) { - FLAC__ASSERT(!options.common.sector_align); - if(!fskip_ahead(infile, trim * bytes_per_wide_sample)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* - * now read unaligned samples into reservoir or pad with zeroes if necessary - */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - unsigned wide_samples = 588 - align_remainder; - if(wide_samples < 588) { - unsigned channel; - - info_align_zero = wide_samples; - for(channel = 0; channel < channels; channel++) - memset(input_[channel], 0, sizeof(input_[0][0]) * wide_samples); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - } - else { - if(*options.common.align_reservoir_samples > 0) { - FLAC__ASSERT(CHUNK_OF_SAMPLES >= 588); - bytes_read = fread(ucbuffer_, sizeof(unsigned char), (*options.common.align_reservoir_samples) * bytes_per_wide_sample, infile); - if(bytes_read == 0 && ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_wide_sample) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - else { - info_align_carry = *options.common.align_reservoir_samples; - if(!format_input(options.common.align_reservoir, *options.common.align_reservoir_samples, /*is_big_endian=*/false, is_unsigned_samples, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - } - } - } - } - - if(pad == true) { - unsigned char tmp; - - if(fread(&tmp, 1U, 1U, infile) < 1U) { - flac__utils_printf(stderr, 1, "%s: ERROR during read of data pad byte\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - got_data_chunk = true; - } - else { - if(xx == 0x61746164 && !got_fmt_chunk) { /* "data" */ - flac__utils_printf(stderr, 1, "%s: ERROR: got 'data' sub-chunk before 'fmt' sub-chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - if(!options.foreign_metadata) { - if(xx == 0x20746d66 && got_fmt_chunk) /* "fmt " */ - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'fmt ' sub-chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); - else if(xx == 0x61746164) /* "data" */ - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'data' sub-chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); - else - flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown sub-chunk '%c%c%c%c' (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename, (char)(xx&255), (char)((xx>>8)&255), (char)((xx>>16)&255), (char)(xx>>24)); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - - /* sub-chunk size */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else { - unsigned long skip = xx+(xx & 1U); - - FLAC__ASSERT(skip<=LONG_MAX); - if(!fskip_ahead(infile, skip)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over unsupported sub-chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - } - } - - return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero, options.foreign_metadata); -} - -int flac__encode_raw(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options) -{ - EncoderSession encoder_session; - size_t bytes_read; - const size_t bytes_per_wide_sample = options.channels * (options.bps >> 3); - unsigned align_remainder = 0; - int info_align_carry = -1, info_align_zero = -1; - FLAC__uint64 total_samples_in_input = 0; - - FLAC__ASSERT(!options.common.sector_align || options.channels == 2); - FLAC__ASSERT(!options.common.sector_align || options.bps == 16); - FLAC__ASSERT(!options.common.sector_align || options.sample_rate == 44100); - FLAC__ASSERT(!options.common.sector_align || infilesize >= 0); - FLAC__ASSERT(!options.common.replay_gain || options.channels <= 2); - FLAC__ASSERT(!options.common.replay_gain || grabbag__replaygain_is_valid_sample_frequency(options.sample_rate)); - - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; - - /* - * now that we know the sample rate, canonicalize the - * --skip string to a number of samples: - */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, options.sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.skip == 0); - - if(infilesize < 0) - total_samples_in_input = 0; - else { - /* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */ - FLAC__ASSERT(options.common.sector_align || *options.common.align_reservoir_samples == 0); - total_samples_in_input = (FLAC__uint64)infilesize / bytes_per_wide_sample + *options.common.align_reservoir_samples; - } - - /* - * now that we know the input size, canonicalize the - * --until strings to a number of samples: - */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, options.sample_rate, encoder_session.skip, total_samples_in_input)) - return EncoderSession_finish_error(&encoder_session); - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.until == 0); - - infilesize -= (off_t)encoder_session.skip * bytes_per_wide_sample; - encoder_session.total_samples_to_encode = total_samples_in_input - encoder_session.skip; - if(encoder_session.until > 0) { - const FLAC__uint64 trim = total_samples_in_input - encoder_session.until; - FLAC__ASSERT(total_samples_in_input > 0); - FLAC__ASSERT(!options.common.sector_align); - infilesize -= (off_t)trim * bytes_per_wide_sample; - encoder_session.total_samples_to_encode -= trim; - } - if(infilesize >= 0 && options.common.sector_align) { - FLAC__ASSERT(encoder_session.skip == 0); - align_remainder = (unsigned)(encoder_session.total_samples_to_encode % 588); - if(options.common.is_last_file) - encoder_session.total_samples_to_encode += (588-align_remainder); /* will pad with zeroes */ - else - encoder_session.total_samples_to_encode -= align_remainder; /* will stop short and carry over to next file */ - } - encoder_session.unencoded_size = encoder_session.total_samples_to_encode * bytes_per_wide_sample; - - if(encoder_session.total_samples_to_encode <= 0) - flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n"); - - if(encoder_session.skip > 0) { - unsigned skip_bytes = bytes_per_wide_sample * (unsigned)encoder_session.skip; - if(skip_bytes > lookahead_length) { - skip_bytes -= lookahead_length; - lookahead_length = 0; - if(!fskip_ahead(infile, skip_bytes)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - else { - lookahead += skip_bytes; - lookahead_length -= skip_bytes; - } - } - - if(!EncoderSession_init_encoder(&encoder_session, options.common, /*channel_mask=*/0, options.channels, options.bps, options.sample_rate, /*foreign_metadata=*/0, /*flac_decoder_data=*/0)) - return EncoderSession_finish_error(&encoder_session); - - /* - * first do any samples in the reservoir - */ - if(options.common.sector_align && *options.common.align_reservoir_samples > 0) { - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)options.common.align_reservoir, *options.common.align_reservoir_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* - * decrement infilesize if we need to align the file - */ - if(options.common.sector_align) { - FLAC__ASSERT(infilesize >= 0); - if(options.common.is_last_file) { - *options.common.align_reservoir_samples = 0; - } - else { - *options.common.align_reservoir_samples = align_remainder; - infilesize -= (off_t)((*options.common.align_reservoir_samples) * bytes_per_wide_sample); - FLAC__ASSERT(infilesize >= 0); - } - } - - /* - * now do from the file - */ - if(infilesize < 0) { - while(!feof(infile)) { - if(lookahead_length > 0) { - FLAC__ASSERT(lookahead_length < CHUNK_OF_SAMPLES * bytes_per_wide_sample); - memcpy(ucbuffer_, lookahead, lookahead_length); - bytes_read = fread(ucbuffer_+lookahead_length, sizeof(unsigned char), CHUNK_OF_SAMPLES * bytes_per_wide_sample - lookahead_length, infile) + lookahead_length; - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - lookahead_length = 0; - } - else - bytes_read = fread(ucbuffer_, sizeof(unsigned char), CHUNK_OF_SAMPLES * bytes_per_wide_sample, infile); - - if(bytes_read == 0) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - else if(bytes_read % bytes_per_wide_sample != 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else { - unsigned wide_samples = bytes_read / bytes_per_wide_sample; - if(!format_input(input_, wide_samples, options.is_big_endian, options.is_unsigned_samples, options.channels, options.bps, /*shift=*/0, /*channel_map=*/0)) - return EncoderSession_finish_error(&encoder_session); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - } - } - else { - const FLAC__uint64 max_input_bytes = infilesize; - FLAC__uint64 total_input_bytes_read = 0; - while(total_input_bytes_read < max_input_bytes) { - { - size_t wanted = (CHUNK_OF_SAMPLES * bytes_per_wide_sample); - wanted = (size_t) min((FLAC__uint64)wanted, max_input_bytes - total_input_bytes_read); - - if(lookahead_length > 0) { - FLAC__ASSERT(lookahead_length <= wanted); - memcpy(ucbuffer_, lookahead, lookahead_length); - wanted -= lookahead_length; - bytes_read = lookahead_length; - if(wanted > 0) { - bytes_read += fread(ucbuffer_+lookahead_length, sizeof(unsigned char), wanted, infile); - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - lookahead_length = 0; - } - else - bytes_read = fread(ucbuffer_, sizeof(unsigned char), wanted, infile); - } - - if(bytes_read == 0) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(feof(infile)) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - total_input_bytes_read = max_input_bytes; - } - } - else { - if(bytes_read % bytes_per_wide_sample != 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else { - unsigned wide_samples = bytes_read / bytes_per_wide_sample; - if(!format_input(input_, wide_samples, options.is_big_endian, options.is_unsigned_samples, options.channels, options.bps, /*shift=*/0, /*channel_map=*/0)) - return EncoderSession_finish_error(&encoder_session); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - total_input_bytes_read += bytes_read; - } - } - } - } - - /* - * now read unaligned samples into reservoir or pad with zeroes if necessary - */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - unsigned wide_samples = 588 - align_remainder; - if(wide_samples < 588) { - unsigned channel; - - info_align_zero = wide_samples; - for(channel = 0; channel < options.channels; channel++) - memset(input_[channel], 0, sizeof(input_[0][0]) * wide_samples); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - } - else { - if(*options.common.align_reservoir_samples > 0) { - FLAC__ASSERT(CHUNK_OF_SAMPLES >= 588); - bytes_read = fread(ucbuffer_, sizeof(unsigned char), (*options.common.align_reservoir_samples) * bytes_per_wide_sample, infile); - if(bytes_read == 0 && ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_wide_sample) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - else { - info_align_carry = *options.common.align_reservoir_samples; - if(!format_input(options.common.align_reservoir, *options.common.align_reservoir_samples, options.is_big_endian, options.is_unsigned_samples, options.channels, options.bps, /*shift=*/0, /*channel_map=*/0)) - return EncoderSession_finish_error(&encoder_session); - } - } - } - } - - return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero, /*foreign_metadata=*/0); -} - -int flac__encode_flac(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, flac_encode_options_t options, FLAC__bool input_is_ogg) -{ - EncoderSession encoder_session; - FLAC__StreamDecoder *decoder = 0; - FLACDecoderData decoder_data; - size_t i; - int retval; - - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; - - decoder_data.encoder_session = &encoder_session; - decoder_data.filesize = (infilesize == (off_t)(-1)? 0 : infilesize); - decoder_data.lookahead = lookahead; - decoder_data.lookahead_length = lookahead_length; - decoder_data.num_metadata_blocks = 0; - decoder_data.samples_left_to_process = 0; - decoder_data.fatal_error = false; - - /* - * set up FLAC decoder for the input - */ - if (0 == (decoder = FLAC__stream_decoder_new())) { - flac__utils_printf(stderr, 1, "%s: ERROR: creating decoder for FLAC input\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - if (!( - FLAC__stream_decoder_set_md5_checking(decoder, false) && - FLAC__stream_decoder_set_metadata_respond_all(decoder) - )) { - flac__utils_printf(stderr, 1, "%s: ERROR: setting up decoder for FLAC input\n", encoder_session.inbasefilename); - goto fubar1; /*@@@ yuck */ - } - - if (input_is_ogg) { - if (FLAC__stream_decoder_init_ogg_stream(decoder, flac_decoder_read_callback, flac_decoder_seek_callback, flac_decoder_tell_callback, flac_decoder_length_callback, flac_decoder_eof_callback, flac_decoder_write_callback, flac_decoder_metadata_callback, flac_decoder_error_callback, /*client_data=*/&decoder_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - flac__utils_printf(stderr, 1, "%s: ERROR: initializing decoder for Ogg FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar1; /*@@@ yuck */ - } - } - else if (FLAC__stream_decoder_init_stream(decoder, flac_decoder_read_callback, flac_decoder_seek_callback, flac_decoder_tell_callback, flac_decoder_length_callback, flac_decoder_eof_callback, flac_decoder_write_callback, flac_decoder_metadata_callback, flac_decoder_error_callback, /*client_data=*/&decoder_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - flac__utils_printf(stderr, 1, "%s: ERROR: initializing decoder for FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar1; /*@@@ yuck */ - } - - if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder) || decoder_data.fatal_error) { - if (decoder_data.fatal_error) - flac__utils_printf(stderr, 1, "%s: ERROR: out of memory or too many metadata blocks while reading metadata in FLAC input\n", encoder_session.inbasefilename); - else - flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar1; /*@@@ yuck */ - } - - if (decoder_data.num_metadata_blocks == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, got no metadata blocks\n", encoder_session.inbasefilename); - goto fubar2; /*@@@ yuck */ - } - else if (decoder_data.metadata_blocks[0]->type != FLAC__METADATA_TYPE_STREAMINFO) { - flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, first metadata block is not STREAMINFO\n", encoder_session.inbasefilename); - goto fubar2; /*@@@ yuck */ - } - else if (decoder_data.metadata_blocks[0]->data.stream_info.total_samples == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: FLAC input has STREAMINFO with unknown total samples which is not supported\n", encoder_session.inbasefilename); - goto fubar2; /*@@@ yuck */ - } - - /* - * now that we have the STREAMINFO and know the sample rate, - * canonicalize the --skip string to a number of samples: - */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, decoder_data.metadata_blocks[0]->data.stream_info.sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align); /* --sector-align with FLAC input is not supported */ - - { - FLAC__uint64 total_samples_in_input, trim = 0; - - total_samples_in_input = decoder_data.metadata_blocks[0]->data.stream_info.total_samples; - - /* - * now that we know the input size, canonicalize the - * --until string to an absolute sample number: - */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, decoder_data.metadata_blocks[0]->data.stream_info.sample_rate, encoder_session.skip, total_samples_in_input)) - goto fubar2; /*@@@ yuck */ - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - - encoder_session.total_samples_to_encode = total_samples_in_input - encoder_session.skip; - if(encoder_session.until > 0) { - trim = total_samples_in_input - encoder_session.until; - FLAC__ASSERT(total_samples_in_input > 0); - encoder_session.total_samples_to_encode -= trim; - } - - encoder_session.unencoded_size = decoder_data.filesize; - - /* (channel mask will get copied over from the source VORBIS_COMMENT if it exists) */ - if(!EncoderSession_init_encoder(&encoder_session, options.common, /*channel_mask=*/0, decoder_data.metadata_blocks[0]->data.stream_info.channels, decoder_data.metadata_blocks[0]->data.stream_info.bits_per_sample, decoder_data.metadata_blocks[0]->data.stream_info.sample_rate, /*foreign_metadata=*/0, &decoder_data)) - goto fubar2; /*@@@ yuck */ - - /* - * have to wait until the FLAC encoder is set up for writing - * before any seeking in the input FLAC file, because the seek - * itself will usually call the decoder's write callback, and - * our decoder's write callback passes samples to our FLAC - * encoder - */ - decoder_data.samples_left_to_process = encoder_session.total_samples_to_encode; - if(encoder_session.skip > 0) { - if(!FLAC__stream_decoder_seek_absolute(decoder, encoder_session.skip)) { - flac__utils_printf(stderr, 1, "%s: ERROR while skipping samples, FLAC decoder state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar2; /*@@@ yuck */ - } - } - - /* - * now do samples from the file - */ - while(!decoder_data.fatal_error && decoder_data.samples_left_to_process > 0) { - /* We can also hit the end of stream without samples_left_to_process - * going to 0 if there are errors and continue_through_decode_errors - * is on, so we want to break in that case too: - */ - if(encoder_session.continue_through_decode_errors && FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) - break; - if(!FLAC__stream_decoder_process_single(decoder)) { - flac__utils_printf(stderr, 1, "%s: ERROR: while decoding FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar2; /*@@@ yuck */ - } - } - if(decoder_data.fatal_error) { - flac__utils_printf(stderr, 1, "%s: ERROR: while decoding FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar2; /*@@@ yuck */ - } - } - - FLAC__stream_decoder_delete(decoder); - retval = EncoderSession_finish_ok(&encoder_session, -1, -1, /*foreign_metadata=*/0); - /* have to wail until encoder is completely finished before deleting because of the final step of writing the seekpoint offsets */ - for(i = 0; i < decoder_data.num_metadata_blocks; i++) - FLAC__metadata_object_delete(decoder_data.metadata_blocks[i]); - return retval; - -fubar2: - for(i = 0; i < decoder_data.num_metadata_blocks; i++) - FLAC__metadata_object_delete(decoder_data.metadata_blocks[i]); -fubar1: - FLAC__stream_decoder_delete(decoder); - return EncoderSession_finish_error(&encoder_session); -} - -FLAC__bool EncoderSession_construct(EncoderSession *e, FLAC__bool use_ogg, FLAC__bool verify, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FILE *infile, const char *infilename, const char *outfilename) -{ - unsigned i; - FLAC__uint32 test = 1; - - /* - * initialize globals - */ - - is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; - - for(i = 0; i < FLAC__MAX_CHANNELS; i++) - input_[i] = &(in_[i][0]); - - - /* - * initialize instance - */ - -#if FLAC__HAS_OGG - e->use_ogg = use_ogg; -#else - (void)use_ogg; -#endif - e->verify = verify; - e->treat_warnings_as_errors = treat_warnings_as_errors; - e->continue_through_decode_errors = continue_through_decode_errors; - - e->is_stdout = (0 == strcmp(outfilename, "-")); - e->outputfile_opened = false; - - e->inbasefilename = grabbag__file_get_basename(infilename); - e->infilename = infilename; - e->outfilename = outfilename; - - e->skip = 0; /* filled in later after the sample_rate is known */ - e->unencoded_size = 0; - e->total_samples_to_encode = 0; - e->bytes_written = 0; - e->samples_written = 0; - e->stats_mask = 0; - - e->encoder = 0; - - e->fin = infile; - e->seek_table_template = 0; - - if(0 == (e->seek_table_template = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE))) { - flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for seek table\n", e->inbasefilename); - return false; - } - - e->encoder = FLAC__stream_encoder_new(); - if(0 == e->encoder) { - flac__utils_printf(stderr, 1, "%s: ERROR creating the encoder instance\n", e->inbasefilename); - EncoderSession_destroy(e); - return false; - } - - return true; -} - -void EncoderSession_destroy(EncoderSession *e) -{ - if(e->fin != stdin) - fclose(e->fin); - - if(0 != e->encoder) { - FLAC__stream_encoder_delete(e->encoder); - e->encoder = 0; - } - - if(0 != e->seek_table_template) { - FLAC__metadata_object_delete(e->seek_table_template); - e->seek_table_template = 0; - } -} - -int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_align_zero, foreign_metadata_t *foreign_metadata) -{ - FLAC__StreamEncoderState fse_state = FLAC__STREAM_ENCODER_OK; - int ret = 0; - FLAC__bool verify_error = false; - - if(e->encoder) { - fse_state = FLAC__stream_encoder_get_state(e->encoder); - ret = FLAC__stream_encoder_finish(e->encoder)? 0 : 1; - verify_error = - fse_state == FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA || - FLAC__stream_encoder_get_state(e->encoder) == FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA - ; - } - /* all errors except verify errors should interrupt the stats */ - if(ret && !verify_error) - print_error_with_state(e, "ERROR during encoding"); - else if(e->total_samples_to_encode > 0) { - print_stats(e); - flac__utils_printf(stderr, 2, "\n"); - } - - if(verify_error) { - print_verify_error(e); - ret = 1; - } - else { - if(info_align_carry >= 0) { - flac__utils_printf(stderr, 1, "%s: INFO: sector alignment causing %d samples to be carried over\n", e->inbasefilename, info_align_carry); - } - if(info_align_zero >= 0) { - flac__utils_printf(stderr, 1, "%s: INFO: sector alignment causing %d zero samples to be appended\n", e->inbasefilename, info_align_zero); - } - } - - /*@@@@@@ should this go here or somewhere else? */ - if(ret == 0 && foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_write_to_flac(foreign_metadata, e->infilename, e->outfilename, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR: updating foreign metadata in FLAC file: %s\n", e->inbasefilename, error); - ret = 1; - } - } - - EncoderSession_destroy(e); - - return ret; -} - -int EncoderSession_finish_error(EncoderSession *e) -{ - FLAC__ASSERT(e->encoder); - - if(e->total_samples_to_encode > 0) - flac__utils_printf(stderr, 2, "\n"); - - if(FLAC__stream_encoder_get_state(e->encoder) == FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA) - print_verify_error(e); - else if(e->outputfile_opened) - /* only want to delete the file if we opened it; otherwise it could be an existing file and our overwrite failed */ - unlink(e->outfilename); - - EncoderSession_destroy(e); - - return 1; -} - -typedef struct { - unsigned num_metadata; - FLAC__bool *needs_delete; - FLAC__StreamMetadata **metadata; - FLAC__StreamMetadata *cuesheet; /* always needs to be deleted */ -} static_metadata_t; - -static void static_metadata_init(static_metadata_t *m) -{ - m->num_metadata = 0; - m->needs_delete = 0; - m->metadata = 0; - m->cuesheet = 0; -} - -static void static_metadata_clear(static_metadata_t *m) -{ - unsigned i; - for(i = 0; i < m->num_metadata; i++) - if(m->needs_delete[i]) - FLAC__metadata_object_delete(m->metadata[i]); - if(m->metadata) - free(m->metadata); - if(m->needs_delete) - free(m->needs_delete); - if(m->cuesheet) - FLAC__metadata_object_delete(m->cuesheet); - static_metadata_init(m); -} - -static FLAC__bool static_metadata_append(static_metadata_t *m, FLAC__StreamMetadata *d, FLAC__bool needs_delete) -{ - void *x; - if(0 == (x = safe_realloc_muladd2_(m->metadata, sizeof(*m->metadata), /*times (*/m->num_metadata, /*+*/1/*)*/))) - return false; - m->metadata = (FLAC__StreamMetadata**)x; - if(0 == (x = safe_realloc_muladd2_(m->needs_delete, sizeof(*m->needs_delete), /*times (*/m->num_metadata, /*+*/1/*)*/))) - return false; - m->needs_delete = (FLAC__bool*)x; - m->metadata[m->num_metadata] = d; - m->needs_delete[m->num_metadata] = needs_delete; - m->num_metadata++; - return true; -} - -FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options, FLAC__uint32 channel_mask, unsigned channels, unsigned bps, unsigned sample_rate, const foreign_metadata_t *foreign_metadata, FLACDecoderData *flac_decoder_data) -{ - FLAC__StreamMetadata padding; - FLAC__StreamMetadata **metadata = 0; - static_metadata_t static_metadata; - unsigned num_metadata = 0, i; - FLAC__StreamEncoderInitStatus init_status; - const FLAC__bool is_cdda = (channels == 1 || channels == 2) && (bps == 16) && (sample_rate == 44100); - char apodizations[2000]; - - FLAC__ASSERT(sizeof(options.pictures)/sizeof(options.pictures[0]) <= 64); - - static_metadata_init(&static_metadata); - - e->replay_gain = options.replay_gain; - e->channels = channels; - e->bits_per_sample = bps; - e->sample_rate = sample_rate; - - apodizations[0] = '\0'; - - if(e->replay_gain) { - if(channels != 1 && channels != 2) { - flac__utils_printf(stderr, 1, "%s: ERROR, number of channels (%u) must be 1 or 2 for --replay-gain\n", e->inbasefilename, channels); - return false; - } - if(!grabbag__replaygain_is_valid_sample_frequency(sample_rate)) { - flac__utils_printf(stderr, 1, "%s: ERROR, invalid sample rate (%u) for --replay-gain\n", e->inbasefilename, sample_rate); - return false; - } - if(options.is_first_file) { - if(!grabbag__replaygain_init(sample_rate)) { - flac__utils_printf(stderr, 1, "%s: ERROR initializing ReplayGain stage\n", e->inbasefilename); - return false; - } - } - } - - if(!parse_cuesheet(&static_metadata.cuesheet, options.cuesheet_filename, e->inbasefilename, is_cdda, e->total_samples_to_encode, e->treat_warnings_as_errors)) - return false; - - if(!convert_to_seek_table_template(options.requested_seek_points, options.num_requested_seek_points, options.cued_seekpoints? static_metadata.cuesheet : 0, e)) { - flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for seek table\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - - /* build metadata */ - if(flac_decoder_data) { - /* - * we're encoding from FLAC so we will use the FLAC file's - * metadata as the basis for the encoded file - */ - { - /* - * first handle pictures: simple append any --pictures - * specified. - */ - for(i = 0; i < options.num_pictures; i++) { - FLAC__StreamMetadata *pic = FLAC__metadata_object_clone(options.pictures[i]); - if(0 == pic) { - flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for PICTURE block\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - flac_decoder_data->metadata_blocks[flac_decoder_data->num_metadata_blocks++] = pic; - } - } - { - /* - * next handle vorbis comment: if any tags were specified - * or there is no existing vorbis comment, we create a - * new vorbis comment (discarding any existing one); else - * we keep the existing one. also need to make sure to - * propagate any channel mask tag. - */ - /* @@@ change to append -T values from options.vorbis_comment if input has VC already? */ - size_t i, j; - FLAC__bool vc_found = false; - for(i = 0, j = 0; i < flac_decoder_data->num_metadata_blocks; i++) { - if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) - vc_found = true; - if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT && options.vorbis_comment->data.vorbis_comment.num_comments > 0) { - (void) flac__utils_get_channel_mask_tag(flac_decoder_data->metadata_blocks[i], &channel_mask); - flac__utils_printf(stderr, 1, "%s: WARNING, replacing tags from input FLAC file with those given on the command-line\n", e->inbasefilename); - if(e->treat_warnings_as_errors) { - static_metadata_clear(&static_metadata); - return false; - } - FLAC__metadata_object_delete(flac_decoder_data->metadata_blocks[i]); - flac_decoder_data->metadata_blocks[i] = 0; - } - else - flac_decoder_data->metadata_blocks[j++] = flac_decoder_data->metadata_blocks[i]; - } - flac_decoder_data->num_metadata_blocks = j; - if((!vc_found || options.vorbis_comment->data.vorbis_comment.num_comments > 0) && flac_decoder_data->num_metadata_blocks < sizeof(flac_decoder_data->metadata_blocks)/sizeof(flac_decoder_data->metadata_blocks[0])) { - /* prepend ours */ - FLAC__StreamMetadata *vc = FLAC__metadata_object_clone(options.vorbis_comment); - if(0 == vc || (channel_mask && !flac__utils_set_channel_mask_tag(vc, channel_mask))) { - flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for VORBIS_COMMENT block\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - for(i = flac_decoder_data->num_metadata_blocks; i > 1; i--) - flac_decoder_data->metadata_blocks[i] = flac_decoder_data->metadata_blocks[i-1]; - flac_decoder_data->metadata_blocks[1] = vc; - flac_decoder_data->num_metadata_blocks++; - } - } - { - /* - * next handle cuesheet: if --cuesheet was specified, use - * it; else if file has existing CUESHEET and cuesheet's - * lead-out offset is correct, keep it; else no CUESHEET - */ - size_t i, j; - for(i = 0, j = 0; i < flac_decoder_data->num_metadata_blocks; i++) { - FLAC__bool existing_cuesheet_is_bad = false; - /* check if existing cuesheet matches the input audio */ - if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_CUESHEET && 0 == static_metadata.cuesheet) { - const FLAC__StreamMetadata_CueSheet *cs = &flac_decoder_data->metadata_blocks[i]->data.cue_sheet; - if(e->total_samples_to_encode == 0) { - flac__utils_printf(stderr, 1, "%s: WARNING, cuesheet in input FLAC file cannot be kept if input size is not known, dropping it...\n", e->inbasefilename); - if(e->treat_warnings_as_errors) { - static_metadata_clear(&static_metadata); - return false; - } - existing_cuesheet_is_bad = true; - } - else if(e->total_samples_to_encode != cs->tracks[cs->num_tracks-1].offset) { - flac__utils_printf(stderr, 1, "%s: WARNING, lead-out offset of cuesheet in input FLAC file does not match input length, dropping existing cuesheet...\n", e->inbasefilename); - if(e->treat_warnings_as_errors) { - static_metadata_clear(&static_metadata); - return false; - } - existing_cuesheet_is_bad = true; - } - } - if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_CUESHEET && (existing_cuesheet_is_bad || 0 != static_metadata.cuesheet)) { - if(0 != static_metadata.cuesheet) { - flac__utils_printf(stderr, 1, "%s: WARNING, replacing cuesheet in input FLAC file with the one given on the command-line\n", e->inbasefilename); - if(e->treat_warnings_as_errors) { - static_metadata_clear(&static_metadata); - return false; - } - } - FLAC__metadata_object_delete(flac_decoder_data->metadata_blocks[i]); - flac_decoder_data->metadata_blocks[i] = 0; - } - else - flac_decoder_data->metadata_blocks[j++] = flac_decoder_data->metadata_blocks[i]; - } - flac_decoder_data->num_metadata_blocks = j; - if(0 != static_metadata.cuesheet && flac_decoder_data->num_metadata_blocks < sizeof(flac_decoder_data->metadata_blocks)/sizeof(flac_decoder_data->metadata_blocks[0])) { - /* prepend ours */ - FLAC__StreamMetadata *cs = FLAC__metadata_object_clone(static_metadata.cuesheet); - if(0 == cs) { - flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for CUESHEET block\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - for(i = flac_decoder_data->num_metadata_blocks; i > 1; i--) - flac_decoder_data->metadata_blocks[i] = flac_decoder_data->metadata_blocks[i-1]; - flac_decoder_data->metadata_blocks[1] = cs; - flac_decoder_data->num_metadata_blocks++; - } - } - { - /* - * next handle seektable: if -S- was specified, no - * SEEKTABLE; else if -S was specified, use it/them; - * else if file has existing SEEKTABLE and input size is - * preserved (no --skip/--until/etc specified), keep it; - * else use default seektable options - * - * note: meanings of num_requested_seek_points: - * -1 : no -S option given, default to some value - * 0 : -S- given (no seektable) - * >0 : one or more -S options given - */ - size_t i, j; - FLAC__bool existing_seektable = false; - for(i = 0, j = 0; i < flac_decoder_data->num_metadata_blocks; i++) { - if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) - existing_seektable = true; - if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_SEEKTABLE && (e->total_samples_to_encode != flac_decoder_data->metadata_blocks[0]->data.stream_info.total_samples || options.num_requested_seek_points >= 0)) { - if(options.num_requested_seek_points > 0) { - flac__utils_printf(stderr, 1, "%s: WARNING, replacing seektable in input FLAC file with the one given on the command-line\n", e->inbasefilename); - if(e->treat_warnings_as_errors) { - static_metadata_clear(&static_metadata); - return false; - } - } - else if(options.num_requested_seek_points == 0) - ; /* no warning, silently delete existing SEEKTABLE since user specified --no-seektable (-S-) */ - else { - flac__utils_printf(stderr, 1, "%s: WARNING, can't use existing seektable in input FLAC since the input size is changing or unknown, dropping existing SEEKTABLE block...\n", e->inbasefilename); - if(e->treat_warnings_as_errors) { - static_metadata_clear(&static_metadata); - return false; - } - } - FLAC__metadata_object_delete(flac_decoder_data->metadata_blocks[i]); - flac_decoder_data->metadata_blocks[i] = 0; - existing_seektable = false; - } - else - flac_decoder_data->metadata_blocks[j++] = flac_decoder_data->metadata_blocks[i]; - } - flac_decoder_data->num_metadata_blocks = j; - if((options.num_requested_seek_points > 0 || (options.num_requested_seek_points < 0 && !existing_seektable)) && flac_decoder_data->num_metadata_blocks < sizeof(flac_decoder_data->metadata_blocks)/sizeof(flac_decoder_data->metadata_blocks[0])) { - /* prepend ours */ - FLAC__StreamMetadata *st = FLAC__metadata_object_clone(e->seek_table_template); - if(0 == st) { - flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for SEEKTABLE block\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - for(i = flac_decoder_data->num_metadata_blocks; i > 1; i--) - flac_decoder_data->metadata_blocks[i] = flac_decoder_data->metadata_blocks[i-1]; - flac_decoder_data->metadata_blocks[1] = st; - flac_decoder_data->num_metadata_blocks++; - } - } - { - /* - * finally handle padding: if --no-padding was specified, - * then delete all padding; else if -P was specified, - * use that instead of existing padding (if any); else - * if existing file has padding, move all existing - * padding blocks to one padding block at the end; else - * use default padding. - */ - int p = -1; - size_t i, j; - for(i = 0, j = 0; i < flac_decoder_data->num_metadata_blocks; i++) { - if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_PADDING) { - if(p < 0) - p = 0; - p += flac_decoder_data->metadata_blocks[i]->length; - FLAC__metadata_object_delete(flac_decoder_data->metadata_blocks[i]); - flac_decoder_data->metadata_blocks[i] = 0; - } - else - flac_decoder_data->metadata_blocks[j++] = flac_decoder_data->metadata_blocks[i]; - } - flac_decoder_data->num_metadata_blocks = j; - if(options.padding > 0) - p = options.padding; - if(p < 0) - p = e->total_samples_to_encode / e->sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8; - if(options.padding != 0) { - if(p > 0 && flac_decoder_data->num_metadata_blocks < sizeof(flac_decoder_data->metadata_blocks)/sizeof(flac_decoder_data->metadata_blocks[0])) { - flac_decoder_data->metadata_blocks[flac_decoder_data->num_metadata_blocks] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); - if(0 == flac_decoder_data->metadata_blocks[flac_decoder_data->num_metadata_blocks]) { - flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for PADDING block\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - flac_decoder_data->metadata_blocks[flac_decoder_data->num_metadata_blocks]->is_last = false; /* the encoder will set this for us */ - flac_decoder_data->metadata_blocks[flac_decoder_data->num_metadata_blocks]->length = p; - flac_decoder_data->num_metadata_blocks++; - } - } - } - metadata = &flac_decoder_data->metadata_blocks[1]; /* don't include STREAMINFO */ - num_metadata = flac_decoder_data->num_metadata_blocks - 1; - } - else { - /* - * we're not encoding from FLAC so we will build the metadata - * from scratch - */ - if(e->seek_table_template->data.seek_table.num_points > 0) { - e->seek_table_template->is_last = false; /* the encoder will set this for us */ - static_metadata_append(&static_metadata, e->seek_table_template, /*needs_delete=*/false); - } - if(0 != static_metadata.cuesheet) - static_metadata_append(&static_metadata, static_metadata.cuesheet, /*needs_delete=*/false); - if(channel_mask) { - if(!flac__utils_set_channel_mask_tag(options.vorbis_comment, channel_mask)) { - flac__utils_printf(stderr, 1, "%s: ERROR adding channel mask tag\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - } - static_metadata_append(&static_metadata, options.vorbis_comment, /*needs_delete=*/false); - for(i = 0; i < options.num_pictures; i++) - static_metadata_append(&static_metadata, options.pictures[i], /*needs_delete=*/false); - if(foreign_metadata) { - for(i = 0; i < foreign_metadata->num_blocks; i++) { - FLAC__StreamMetadata *p = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); - if(!p) { - flac__utils_printf(stderr, 1, "%s: ERROR: out of memory\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - static_metadata_append(&static_metadata, p, /*needs_delete=*/true); - static_metadata.metadata[static_metadata.num_metadata-1]->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8 + foreign_metadata->blocks[i].size; -/*fprintf(stderr,"@@@@@@ add PADDING=%u\n",static_metadata.metadata[static_metadata.num_metadata-1]->length);*/ - } - } - if(options.padding != 0) { - padding.is_last = false; /* the encoder will set this for us */ - padding.type = FLAC__METADATA_TYPE_PADDING; - padding.length = (unsigned)(options.padding>0? options.padding : (e->total_samples_to_encode / e->sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8)); - static_metadata_append(&static_metadata, &padding, /*needs_delete=*/false); - } - metadata = static_metadata.metadata; - num_metadata = static_metadata.num_metadata; - } - - /* check for a few things that have not already been checked. the - * FLAC__stream_encoder_init*() will check it but only return - * FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA so we check some - * up front to give a better error message. - */ - if(!verify_metadata(e, metadata, num_metadata)) { - static_metadata_clear(&static_metadata); - return false; - } - - FLAC__stream_encoder_set_verify(e->encoder, options.verify); - FLAC__stream_encoder_set_streamable_subset(e->encoder, !options.lax); - FLAC__stream_encoder_set_channels(e->encoder, channels); - FLAC__stream_encoder_set_bits_per_sample(e->encoder, bps); - FLAC__stream_encoder_set_sample_rate(e->encoder, sample_rate); - for(i = 0; i < options.num_compression_settings; i++) { - switch(options.compression_settings[i].type) { - case CST_BLOCKSIZE: - FLAC__stream_encoder_set_blocksize(e->encoder, options.compression_settings[i].value.t_unsigned); - break; - case CST_COMPRESSION_LEVEL: - FLAC__stream_encoder_set_compression_level(e->encoder, options.compression_settings[i].value.t_unsigned); - apodizations[0] = '\0'; - break; - case CST_DO_MID_SIDE: - FLAC__stream_encoder_set_do_mid_side_stereo(e->encoder, options.compression_settings[i].value.t_bool); - break; - case CST_LOOSE_MID_SIDE: - FLAC__stream_encoder_set_loose_mid_side_stereo(e->encoder, options.compression_settings[i].value.t_bool); - break; - case CST_APODIZATION: - if(strlen(apodizations)+strlen(options.compression_settings[i].value.t_string)+2 >= sizeof(apodizations)) { - flac__utils_printf(stderr, 1, "%s: ERROR: too many apodization functions requested\n", e->inbasefilename); - static_metadata_clear(&static_metadata); - return false; - } - else { - strcat(apodizations, options.compression_settings[i].value.t_string); - strcat(apodizations, ";"); - } - break; - case CST_MAX_LPC_ORDER: - FLAC__stream_encoder_set_max_lpc_order(e->encoder, options.compression_settings[i].value.t_unsigned); - break; - case CST_QLP_COEFF_PRECISION: - FLAC__stream_encoder_set_qlp_coeff_precision(e->encoder, options.compression_settings[i].value.t_unsigned); - break; - case CST_DO_QLP_COEFF_PREC_SEARCH: - FLAC__stream_encoder_set_do_qlp_coeff_prec_search(e->encoder, options.compression_settings[i].value.t_bool); - break; - case CST_DO_ESCAPE_CODING: - FLAC__stream_encoder_set_do_escape_coding(e->encoder, options.compression_settings[i].value.t_bool); - break; - case CST_DO_EXHAUSTIVE_MODEL_SEARCH: - FLAC__stream_encoder_set_do_exhaustive_model_search(e->encoder, options.compression_settings[i].value.t_bool); - break; - case CST_MIN_RESIDUAL_PARTITION_ORDER: - FLAC__stream_encoder_set_min_residual_partition_order(e->encoder, options.compression_settings[i].value.t_unsigned); - break; - case CST_MAX_RESIDUAL_PARTITION_ORDER: - FLAC__stream_encoder_set_max_residual_partition_order(e->encoder, options.compression_settings[i].value.t_unsigned); - break; - case CST_RICE_PARAMETER_SEARCH_DIST: - FLAC__stream_encoder_set_rice_parameter_search_dist(e->encoder, options.compression_settings[i].value.t_unsigned); - break; - } - } - if(*apodizations) - FLAC__stream_encoder_set_apodization(e->encoder, apodizations); - FLAC__stream_encoder_set_total_samples_estimate(e->encoder, e->total_samples_to_encode); - FLAC__stream_encoder_set_metadata(e->encoder, (num_metadata > 0)? metadata : 0, num_metadata); - - FLAC__stream_encoder_disable_constant_subframes(e->encoder, options.debug.disable_constant_subframes); - FLAC__stream_encoder_disable_fixed_subframes(e->encoder, options.debug.disable_fixed_subframes); - FLAC__stream_encoder_disable_verbatim_subframes(e->encoder, options.debug.disable_verbatim_subframes); - if(!options.debug.do_md5) { - flac__utils_printf(stderr, 1, "%s: WARNING, MD5 computation disabled, resulting file will not have MD5 sum\n", e->inbasefilename); - if(e->treat_warnings_as_errors) { - static_metadata_clear(&static_metadata); - return false; - } - FLAC__stream_encoder_set_do_md5(e->encoder, false); - } - -#if FLAC__HAS_OGG - if(e->use_ogg) { - FLAC__stream_encoder_set_ogg_serial_number(e->encoder, options.serial_number); - - init_status = FLAC__stream_encoder_init_ogg_file(e->encoder, e->is_stdout? 0 : e->outfilename, encoder_progress_callback, /*client_data=*/e); - } - else -#endif - { - init_status = FLAC__stream_encoder_init_file(e->encoder, e->is_stdout? 0 : e->outfilename, encoder_progress_callback, /*client_data=*/e); - } - - if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) { - print_error_with_init_status(e, "ERROR initializing encoder", init_status); - if(FLAC__stream_encoder_get_state(e->encoder) != FLAC__STREAM_ENCODER_IO_ERROR) - e->outputfile_opened = true; - static_metadata_clear(&static_metadata); - return false; - } - else - e->outputfile_opened = true; - - e->stats_mask = - (FLAC__stream_encoder_get_do_exhaustive_model_search(e->encoder) && FLAC__stream_encoder_get_do_qlp_coeff_prec_search(e->encoder))? 0x07 : - (FLAC__stream_encoder_get_do_exhaustive_model_search(e->encoder) || FLAC__stream_encoder_get_do_qlp_coeff_prec_search(e->encoder))? 0x0f : - 0x3f; - - static_metadata_clear(&static_metadata); - - return true; -} - -FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], unsigned samples) -{ - if(e->replay_gain) { - if(!grabbag__replaygain_analyze(buffer, e->channels==2, e->bits_per_sample, samples)) { - flac__utils_printf(stderr, 1, "%s: WARNING, error while calculating ReplayGain\n", e->inbasefilename); - if(e->treat_warnings_as_errors) - return false; - } - } - - return FLAC__stream_encoder_process(e->encoder, buffer, samples); -} - -FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int num_requested_seek_points, FLAC__StreamMetadata *cuesheet, EncoderSession *e) -{ - const FLAC__bool only_placeholders = e->is_stdout; - FLAC__bool has_real_points; - - if(num_requested_seek_points == 0 && 0 == cuesheet) - return true; - - if(num_requested_seek_points < 0) { -#if FLAC__HAS_OGG - /*@@@@@@ workaround ogg bug: too many seekpoints makes table not fit in one page */ - if(e->use_ogg && e->total_samples_to_encode > 0 && e->total_samples_to_encode / e->sample_rate / 10 > 230) - requested_seek_points = "230x;"; - else -#endif - requested_seek_points = "10s;"; - num_requested_seek_points = 1; - } - - if(num_requested_seek_points > 0) { - if(!grabbag__seektable_convert_specification_to_template(requested_seek_points, only_placeholders, e->total_samples_to_encode, e->sample_rate, e->seek_table_template, &has_real_points)) - return false; - } - - if(0 != cuesheet) { - unsigned i, j; - const FLAC__StreamMetadata_CueSheet *cs = &cuesheet->data.cue_sheet; - for(i = 0; i < cs->num_tracks; i++) { - const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+i; - for(j = 0; j < tr->num_indices; j++) { - if(!FLAC__metadata_object_seektable_template_append_point(e->seek_table_template, tr->offset + tr->indices[j].offset)) - return false; - has_real_points = true; - } - } - if(has_real_points) - if(!FLAC__metadata_object_seektable_template_sort(e->seek_table_template, /*compact=*/true)) - return false; - } - - if(has_real_points) { - if(e->is_stdout) { - flac__utils_printf(stderr, 1, "%s: WARNING, cannot write back seekpoints when encoding to stdout\n", e->inbasefilename); - if(e->treat_warnings_as_errors) - return false; - } - } - - return true; -} - -FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input) -{ - /* convert from mm:ss.sss to sample number if necessary */ - flac__utils_canonicalize_skip_until_specification(spec, sample_rate); - - /* special case: if "--until=-0", use the special value '0' to mean "end-of-stream" */ - if(spec->is_relative && spec->value.samples == 0) { - spec->is_relative = false; - return true; - } - - /* in any other case the total samples in the input must be known */ - if(total_samples_in_input == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR, cannot use --until when input length is unknown\n", inbasefilename); - return false; - } - - FLAC__ASSERT(spec->value_is_samples); - - /* convert relative specifications to absolute */ - if(spec->is_relative) { - if(spec->value.samples <= 0) - spec->value.samples += (FLAC__int64)total_samples_in_input; - else - spec->value.samples += skip; - spec->is_relative = false; - } - - /* error check */ - if(spec->value.samples < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR, --until value is before beginning of input\n", inbasefilename); - return false; - } - if((FLAC__uint64)spec->value.samples <= skip) { - flac__utils_printf(stderr, 1, "%s: ERROR, --until value is before --skip point\n", inbasefilename); - return false; - } - if((FLAC__uint64)spec->value.samples > total_samples_in_input) { - flac__utils_printf(stderr, 1, "%s: ERROR, --until value is after end of input\n", inbasefilename); - return false; - } - - return true; -} - -FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, unsigned num_metadata) -{ - FLAC__bool metadata_picture_has_type1 = false; - FLAC__bool metadata_picture_has_type2 = false; - unsigned i; - - FLAC__ASSERT(0 != metadata); - for(i = 0; i < num_metadata; i++) { - const FLAC__StreamMetadata *m = metadata[i]; - if(m->type == FLAC__METADATA_TYPE_SEEKTABLE) { - if(!FLAC__format_seektable_is_legal(&m->data.seek_table)) { - flac__utils_printf(stderr, 1, "%s: ERROR: SEEKTABLE metadata block is invalid\n", e->inbasefilename); - return false; - } - } - else if(m->type == FLAC__METADATA_TYPE_CUESHEET) { - if(!FLAC__format_cuesheet_is_legal(&m->data.cue_sheet, m->data.cue_sheet.is_cd, /*violation=*/0)) { - flac__utils_printf(stderr, 1, "%s: ERROR: CUESHEET metadata block is invalid\n", e->inbasefilename); - return false; - } - } - else if(m->type == FLAC__METADATA_TYPE_PICTURE) { - const char *error = 0; - if(!FLAC__format_picture_is_legal(&m->data.picture, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR: PICTURE metadata block is invalid: %s\n", e->inbasefilename, error); - return false; - } - if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD) { - if(metadata_picture_has_type1) { - flac__utils_printf(stderr, 1, "%s: ERROR: there may only be one picture of type 1 (32x32 icon) in the file\n", e->inbasefilename); - return false; - } - metadata_picture_has_type1 = true; - } - else if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON) { - if(metadata_picture_has_type2) { - flac__utils_printf(stderr, 1, "%s: ERROR: there may only be one picture of type 2 (icon) in the file\n", e->inbasefilename); - return false; - } - metadata_picture_has_type2 = true; - } - } - } - - return true; -} - -FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map) -{ - unsigned wide_sample, sample, channel, byte; - FLAC__int32 *out[FLAC__MAX_CHANNELS]; - - if(0 == channel_map) { - for(channel = 0; channel < channels; channel++) - out[channel] = dest[channel]; - } - else { - for(channel = 0; channel < channels; channel++) - out[channel] = dest[channel_map[channel]]; - } - - if(bps == 8) { - if(is_unsigned_samples) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)ucbuffer_[sample] - 0x80; - } - else { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)scbuffer_[sample]; - } - } - else if(bps == 16) { - if(is_big_endian != is_big_endian_host_) { - unsigned char tmp; - const unsigned bytes = wide_samples * channels * (bps >> 3); - for(byte = 0; byte < bytes; byte += 2) { - tmp = ucbuffer_[byte]; - ucbuffer_[byte] = ucbuffer_[byte+1]; - ucbuffer_[byte+1] = tmp; - } - } - if(is_unsigned_samples) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)usbuffer_[sample] - 0x8000; - } - else { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)ssbuffer_[sample]; - } - } - else if(bps == 24) { - if(!is_big_endian) { - unsigned char tmp; - const unsigned bytes = wide_samples * channels * (bps >> 3); - for(byte = 0; byte < bytes; byte += 3) { - tmp = ucbuffer_[byte]; - ucbuffer_[byte] = ucbuffer_[byte+2]; - ucbuffer_[byte+2] = tmp; - } - } - if(is_unsigned_samples) { - for(byte = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) { - out[channel][wide_sample] = ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; - out[channel][wide_sample] -= 0x800000; - } - } - else { - for(byte = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) { - out[channel][wide_sample] = scbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; - } - } - } - else { - FLAC__ASSERT(0); - } - if(shift > 0) { - FLAC__int32 mask = (1<>= shift; - } - } - return true; -} - -void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data) -{ - EncoderSession *encoder_session = (EncoderSession*)client_data; - - (void)encoder, (void)total_frames_estimate; - - encoder_session->bytes_written = bytes_written; - encoder_session->samples_written = samples_written; - - if(encoder_session->total_samples_to_encode > 0 && !((frames_written-1) & encoder_session->stats_mask)) - print_stats(encoder_session); -} - -FLAC__StreamDecoderReadStatus flac_decoder_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - size_t n = 0; - FLACDecoderData *data = (FLACDecoderData*)client_data; - (void)decoder; - - if (data->fatal_error) - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - - /* use up lookahead first */ - if (data->lookahead_length) { - n = min(data->lookahead_length, *bytes); - memcpy(buffer, data->lookahead, n); - buffer += n; - data->lookahead += n; - data->lookahead_length -= n; - } - - /* get the rest from file */ - if (*bytes > n) { - *bytes = n + fread(buffer, 1, *bytes-n, data->encoder_session->fin); - if(ferror(data->encoder_session->fin)) - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - else if(0 == *bytes) - 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; -} - -FLAC__StreamDecoderSeekStatus flac_decoder_seek_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) -{ - FLACDecoderData *data = (FLACDecoderData*)client_data; - (void)decoder; - - if(fseeko(data->encoder_session->fin, (off_t)absolute_byte_offset, SEEK_SET) < 0) - return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - else - return FLAC__STREAM_DECODER_SEEK_STATUS_OK; -} - -FLAC__StreamDecoderTellStatus flac_decoder_tell_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) -{ - FLACDecoderData *data = (FLACDecoderData*)client_data; - off_t pos; - (void)decoder; - - if((pos = ftello(data->encoder_session->fin)) < 0) - return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - else { - *absolute_byte_offset = (FLAC__uint64)pos; - return FLAC__STREAM_DECODER_TELL_STATUS_OK; - } -} - -FLAC__StreamDecoderLengthStatus flac_decoder_length_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) -{ - FLACDecoderData *data = (FLACDecoderData*)client_data; - (void)decoder; - - if(0 == data->filesize) - return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - else { - *stream_length = (FLAC__uint64)data->filesize; - return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; - } -} - -FLAC__bool flac_decoder_eof_callback(const FLAC__StreamDecoder *decoder, void *client_data) -{ - FLACDecoderData *data = (FLACDecoderData*)client_data; - (void)decoder; - - return feof(data->encoder_session->fin)? true : false; -} - -FLAC__StreamDecoderWriteStatus flac_decoder_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - FLACDecoderData *data = (FLACDecoderData*)client_data; - FLAC__uint64 n = min(data->samples_left_to_process, frame->header.blocksize); - (void)decoder; - - if(!EncoderSession_process(data->encoder_session, buffer, (unsigned)n)) { - print_error_with_state(data->encoder_session, "ERROR during encoding"); - data->fatal_error = true; - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - - data->samples_left_to_process -= n; - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -void flac_decoder_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - FLACDecoderData *data = (FLACDecoderData*)client_data; - (void)decoder; - - if (data->fatal_error) - return; - - if ( - data->num_metadata_blocks == sizeof(data->metadata_blocks)/sizeof(data->metadata_blocks[0]) || - 0 == (data->metadata_blocks[data->num_metadata_blocks] = FLAC__metadata_object_clone(metadata)) - ) - data->fatal_error = true; - else - data->num_metadata_blocks++; -} - -void flac_decoder_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - FLACDecoderData *data = (FLACDecoderData*)client_data; - (void)decoder; - - flac__utils_printf(stderr, 1, "%s: ERROR got %s while decoding FLAC input\n", data->encoder_session->inbasefilename, FLAC__StreamDecoderErrorStatusString[status]); - if(!data->encoder_session->continue_through_decode_errors) - data->fatal_error = true; -} - -FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors) -{ - FILE *f; - unsigned last_line_read; - const char *error_message; - - if(0 == cuesheet_filename) - return true; - - if(lead_out_offset == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR cannot import cuesheet when the number of input samples to encode is unknown\n", inbasefilename); - return false; - } - - if(0 == (f = fopen(cuesheet_filename, "r"))) { - flac__utils_printf(stderr, 1, "%s: ERROR opening cuesheet \"%s\" for reading: %s\n", inbasefilename, cuesheet_filename, strerror(errno)); - return false; - } - - *cuesheet = grabbag__cuesheet_parse(f, &error_message, &last_line_read, is_cdda, lead_out_offset); - - fclose(f); - - if(0 == *cuesheet) { - flac__utils_printf(stderr, 1, "%s: ERROR parsing cuesheet \"%s\" on line %u: %s\n", inbasefilename, cuesheet_filename, last_line_read, error_message); - return false; - } - - if(!FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/false, &error_message)) { - flac__utils_printf(stderr, 1, "%s: ERROR parsing cuesheet \"%s\": %s\n", inbasefilename, cuesheet_filename, error_message); - return false; - } - - /* if we're expecting CDDA, warn about non-compliance */ - if(is_cdda && !FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/true, &error_message)) { - flac__utils_printf(stderr, 1, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", inbasefilename, cuesheet_filename, error_message); - if(treat_warnings_as_errors) - return false; - (*cuesheet)->data.cue_sheet.is_cd = false; - } - - return true; -} - -void print_stats(const EncoderSession *encoder_session) -{ - const FLAC__uint64 samples_written = min(encoder_session->total_samples_to_encode, encoder_session->samples_written); -#if defined _MSC_VER || defined __MINGW32__ - /* with MSVC you have to spoon feed it the casting */ - const double progress = (double)(FLAC__int64)samples_written / (double)(FLAC__int64)encoder_session->total_samples_to_encode; - const double ratio = (double)(FLAC__int64)encoder_session->bytes_written / ((double)(FLAC__int64)encoder_session->unencoded_size * min(1.0, progress)); -#else - const double progress = (double)samples_written / (double)encoder_session->total_samples_to_encode; - const double ratio = (double)encoder_session->bytes_written / ((double)encoder_session->unencoded_size * min(1.0, progress)); -#endif - - FLAC__ASSERT(encoder_session->total_samples_to_encode > 0); - - if(samples_written == encoder_session->total_samples_to_encode) { - flac__utils_printf(stderr, 2, "\r%s:%s wrote %u bytes, ratio=%0.3f", - encoder_session->inbasefilename, - encoder_session->verify? " Verify OK," : "", - (unsigned)encoder_session->bytes_written, - ratio - ); - } - else { - flac__utils_printf(stderr, 2, "\r%s: %u%% complete, ratio=%0.3f", encoder_session->inbasefilename, (unsigned)floor(progress * 100.0 + 0.5), ratio); - } -} - -void print_error_with_init_status(const EncoderSession *e, const char *message, FLAC__StreamEncoderInitStatus init_status) -{ - const int ilen = strlen(e->inbasefilename) + 1; - const char *state_string = ""; - - flac__utils_printf(stderr, 1, "\n%s: %s\n", e->inbasefilename, message); - - flac__utils_printf(stderr, 1, "%*s init_status = %s\n", ilen, "", FLAC__StreamEncoderInitStatusString[init_status]); - - if(init_status == FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR) { - state_string = FLAC__stream_encoder_get_resolved_state_string(e->encoder); - - flac__utils_printf(stderr, 1, "%*s state = %s\n", ilen, "", state_string); - - /* print out some more info for some errors: */ - if(0 == strcmp(state_string, FLAC__StreamEncoderStateString[FLAC__STREAM_ENCODER_CLIENT_ERROR])) { - flac__utils_printf(stderr, 1, - "\n" - "An error occurred while writing; the most common cause is that the disk is full.\n" - ); - } - else if(0 == strcmp(state_string, FLAC__StreamEncoderStateString[FLAC__STREAM_ENCODER_IO_ERROR])) { - flac__utils_printf(stderr, 1, - "\n" - "An error occurred opening the output file; it is likely that the output\n" - "directory does not exist or is not writable, the output file already exists and\n" - "is not writable, or the disk is full.\n" - ); - } - } - else if(init_status == FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE) { - flac__utils_printf(stderr, 1, - "\n" - "The encoding parameters specified do not conform to the FLAC Subset and may not\n" - "be streamable or playable in hardware devices. If you really understand the\n" - "consequences, you can add --lax to the command-line options to encode with\n" - "these parameters anyway. See http://flac.sourceforge.net/format.html#subset\n" - ); - } -} - -void print_error_with_state(const EncoderSession *e, const char *message) -{ - const int ilen = strlen(e->inbasefilename) + 1; - const char *state_string; - - flac__utils_printf(stderr, 1, "\n%s: %s\n", e->inbasefilename, message); - - state_string = FLAC__stream_encoder_get_resolved_state_string(e->encoder); - - flac__utils_printf(stderr, 1, "%*s state = %s\n", ilen, "", state_string); - - /* print out some more info for some errors: */ - if(0 == strcmp(state_string, FLAC__StreamEncoderStateString[FLAC__STREAM_ENCODER_CLIENT_ERROR])) { - flac__utils_printf(stderr, 1, - "\n" - "An error occurred while writing; the most common cause is that the disk is full.\n" - ); - } -} - -void print_verify_error(EncoderSession *e) -{ - FLAC__uint64 absolute_sample; - unsigned frame_number; - unsigned channel; - unsigned sample; - FLAC__int32 expected; - FLAC__int32 got; - - FLAC__stream_encoder_get_verify_decoder_error_stats(e->encoder, &absolute_sample, &frame_number, &channel, &sample, &expected, &got); - - flac__utils_printf(stderr, 1, "%s: ERROR: mismatch in decoded data, verify FAILED!\n", e->inbasefilename); - flac__utils_printf(stderr, 1, " Absolute sample=%u, frame=%u, channel=%u, sample=%u, expected %d, got %d\n", (unsigned)absolute_sample, frame_number, channel, sample, expected, got); - flac__utils_printf(stderr, 1, " In all known cases, verify errors are caused by hardware problems,\n"); - flac__utils_printf(stderr, 1, " usually overclocking or bad RAM. Delete %s\n", e->outfilename); - flac__utils_printf(stderr, 1, " and repeat the flac command exactly as before. If it does not give a\n"); - flac__utils_printf(stderr, 1, " verify error in the exact same place each time you try it, then there is\n"); - flac__utils_printf(stderr, 1, " a problem with your hardware; please see the FAQ:\n"); - flac__utils_printf(stderr, 1, " http://flac.sourceforge.net/faq.html#tools__hardware_prob\n"); - flac__utils_printf(stderr, 1, " If it does fail in the exact same place every time, keep\n"); - flac__utils_printf(stderr, 1, " %s and submit a bug report to:\n", e->outfilename); - flac__utils_printf(stderr, 1, " https://sourceforge.net/bugs/?func=addbug&group_id=13478\n"); - flac__utils_printf(stderr, 1, " Make sure to upload the FLAC file and use the \"Monitor\" feature to\n"); - flac__utils_printf(stderr, 1, " monitor the bug status.\n"); - flac__utils_printf(stderr, 1, "Verify FAILED! Do not trust %s\n", e->outfilename); -} - -FLAC__bool read_little_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn) -{ - size_t bytes_read = fread(val, 1, 2, f); - - if(bytes_read == 0) { - if(!eof_ok) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - else - return true; - } - else if(bytes_read < 2) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - else { - if(is_big_endian_host_) { - FLAC__byte tmp, *b = (FLAC__byte*)val; - tmp = b[1]; b[1] = b[0]; b[0] = tmp; - } - return true; - } -} - -FLAC__bool read_little_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn) -{ - size_t bytes_read = fread(val, 1, 4, f); - - if(bytes_read == 0) { - if(!eof_ok) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - else - return true; - } - else if(bytes_read < 4) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - else { - if(is_big_endian_host_) { - FLAC__byte tmp, *b = (FLAC__byte*)val; - tmp = b[3]; b[3] = b[0]; b[0] = tmp; - tmp = b[2]; b[2] = b[1]; b[1] = tmp; - } - return true; - } -} - -FLAC__bool read_big_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn) -{ - unsigned char buf[4]; - size_t bytes_read= fread(buf, 1, 2, f); - - if(bytes_read==0U && eof_ok) - return true; - else if(bytes_read<2U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - - /* this is independent of host endianness */ - *val= (FLAC__uint16)(buf[0])<<8 | buf[1]; - - return true; -} - -FLAC__bool read_big_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn) -{ - unsigned char buf[4]; - size_t bytes_read= fread(buf, 1, 4, f); - - if(bytes_read==0U && eof_ok) - return true; - else if(bytes_read<4U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - - /* this is independent of host endianness */ - *val= (FLAC__uint32)(buf[0])<<24 | (FLAC__uint32)(buf[1])<<16 | - (FLAC__uint32)(buf[2])<<8 | buf[3]; - - return true; -} - -FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn) - /* Read an IEEE 754 80-bit (aka SANE) extended floating point value from 'f', - * convert it into an integral value and store in 'val'. Return false if only - * between 1 and 9 bytes remain in 'f', if 0 bytes remain in 'f' and 'eof_ok' is - * false, or if the value is negative, between zero and one, or too large to be - * represented by 'val'; return true otherwise. - */ -{ - unsigned int i; - unsigned char buf[10]; - size_t bytes_read= fread(buf, 1U, 10U, f); - FLAC__int16 e= ((FLAC__uint16)(buf[0])<<8 | (FLAC__uint16)(buf[1]))-0x3FFF; - FLAC__int16 shift= 63-e; - FLAC__uint64 p= 0U; - - if(bytes_read==0U && eof_ok) - return true; - else if(bytes_read<10U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - else if((buf[0]>>7)==1U || e<0 || e>63) { - flac__utils_printf(stderr, 1, "%s: ERROR: invalid floating-point value\n", fn); - return false; - } - - for(i= 0U; i<8U; ++i) - p|= (FLAC__uint64)(buf[i+2])<<(56U-i*8); - *val= (FLAC__uint32)((p>>shift)+(p>>(shift-1) & 0x1)); - - return true; -} - -FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset) -{ - static unsigned char dump[8192]; - -#ifdef _MSC_VER - if(f == stdin) { - /* MS' stdio impl can't even seek forward on stdin, have to use pure non-fseek() version: */ - while(offset > 0) { - const long need = (long)min(offset, sizeof(dump)); - if((long)fread(dump, 1, need, f) < need) - return false; - offset -= need; - } - } - else -#endif - { - while(offset > 0) { - long need = (long)min(offset, LONG_MAX); - if(fseeko(f, need, SEEK_CUR) < 0) { - need = (long)min(offset, sizeof(dump)); - if((long)fread(dump, 1, need, f) < need) - return false; - } - offset -= need; - } - } - return true; -} - -unsigned count_channel_mask_bits(FLAC__uint32 mask) -{ - unsigned count = 0; - while(mask) { - if(mask & 1) - count++; - mask >>= 1; - } - return count; -} - -#if 0 -FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, unsigned channels) -{ - FLAC__uint32 x = 0x80000000; - unsigned count = count_channel_mask_bits(mask); - while(x && count > channels) { - if(mask & x) { - mask &= ~x; - count--; - } - x >>= 1; - } - FLAC__ASSERT(count_channel_mask_bits(mask) == channels); - return mask; -} -#endif diff --git a/src/lib/dl/ext/flac/encode.h b/src/lib/dl/ext/flac/encode.h deleted file mode 100755 index 4d45df0a..00000000 --- a/src/lib/dl/ext/flac/encode.h +++ /dev/null @@ -1,122 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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__encode_h -#define flac__encode_h - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "flac/metadata.h" -#include "foreign_metadata.h" -#include "utils.h" - -extern const int FLAC_ENCODE__DEFAULT_PADDING; - -typedef enum { - CST_BLOCKSIZE, - CST_COMPRESSION_LEVEL, - CST_DO_MID_SIDE, - CST_LOOSE_MID_SIDE, - CST_APODIZATION, - CST_MAX_LPC_ORDER, - CST_QLP_COEFF_PRECISION, - CST_DO_QLP_COEFF_PREC_SEARCH, - CST_DO_ESCAPE_CODING, - CST_DO_EXHAUSTIVE_MODEL_SEARCH, - CST_MIN_RESIDUAL_PARTITION_ORDER, - CST_MAX_RESIDUAL_PARTITION_ORDER, - CST_RICE_PARAMETER_SEARCH_DIST -} compression_setting_type_t; - -typedef struct { - compression_setting_type_t type; - union { - FLAC__bool t_bool; - unsigned t_unsigned; - const char *t_string; - } value; -} compression_setting_t; - -typedef struct { - utils__SkipUntilSpecification skip_specification; - utils__SkipUntilSpecification until_specification; - FLAC__bool verify; -#if FLAC__HAS_OGG - FLAC__bool use_ogg; - long serial_number; -#endif - FLAC__bool lax; - int padding; - size_t num_compression_settings; - compression_setting_t compression_settings[64]; - char *requested_seek_points; - int num_requested_seek_points; - const char *cuesheet_filename; - FLAC__bool treat_warnings_as_errors; - FLAC__bool continue_through_decode_errors; /* currently only obeyed when encoding from FLAC or Ogg FLAC */ - FLAC__bool cued_seekpoints; - FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ - - /* options related to --replay-gain and --sector-align */ - FLAC__bool is_first_file; - FLAC__bool is_last_file; - FLAC__int32 **align_reservoir; - unsigned *align_reservoir_samples; - FLAC__bool replay_gain; - FLAC__bool ignore_chunk_sizes; - FLAC__bool sector_align; - - FLAC__StreamMetadata *vorbis_comment; - FLAC__StreamMetadata *pictures[64]; - unsigned num_pictures; - - struct { - FLAC__bool disable_constant_subframes; - FLAC__bool disable_fixed_subframes; - FLAC__bool disable_verbatim_subframes; - FLAC__bool do_md5; - } debug; -} encode_options_t; - -typedef struct { - encode_options_t common; - foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ -} wav_encode_options_t; - -typedef struct { - encode_options_t common; - - FLAC__bool is_big_endian; - FLAC__bool is_unsigned_samples; - unsigned channels; - unsigned bps; - unsigned sample_rate; -} raw_encode_options_t; - -typedef struct { - encode_options_t common; -} flac_encode_options_t; - -int flac__encode_aif(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc); -int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options); -int flac__encode_raw(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options); -int flac__encode_flac(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, flac_encode_options_t options, FLAC__bool input_is_ogg); - -#endif diff --git a/src/lib/dl/ext/flac/export.h b/src/lib/dl/ext/flac/export.h deleted file mode 100755 index a525f29c..00000000 --- a/src/lib/dl/ext/flac/export.h +++ /dev/null @@ -1,91 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 - -/** \file include/FLAC/export.h - * - * \brief - * This module contains #defines and symbols for exporting function - * calls, and providing version information and compiled-in features. - * - * See the \link flac_export export \endlink module. - */ - -/** \defgroup flac_export FLAC/export.h: export symbols - * \ingroup flac - * - * \brief - * This module contains #defines and symbols for exporting function - * calls, and providing version information and compiled-in features. - * - * If you are compiling with MSVC and will link to the static library - * (libFLAC.lib) you should define FLAC__NO_DLL in your project to - * make sure the symbols are exported properly. - * - * \{ - */ - -#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 - -/** These #defines will mirror the libtool-based library version number, see - * http://www.gnu.org/software/libtool/manual.html#Libtool-versioning - */ -#define FLAC_API_VERSION_CURRENT 10 -#define FLAC_API_VERSION_REVISION 0 /**< see above */ -#define FLAC_API_VERSION_AGE 2 /**< see above */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */ -extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC; - -#ifdef __cplusplus -} -#endif - -/* \} */ - -#endif diff --git a/src/lib/dl/ext/flac/fast_float_math_hack.h b/src/lib/dl/ext/flac/fast_float_math_hack.h deleted file mode 100755 index d8608fc4..00000000 --- a/src/lib/dl/ext/flac/fast_float_math_hack.h +++ /dev/null @@ -1,39 +0,0 @@ -# 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/src/lib/dl/ext/flac/file.c b/src/lib/dl/ext/flac/file.c deleted file mode 100755 index 675213f0..00000000 --- a/src/lib/dl/ext/flac/file.c +++ /dev/null @@ -1,192 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#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 -#if defined __CYGWIN__ || defined __EMX__ -#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() */ -#if defined _WIN32 && !defined __CYGWIN__ -// for GetFileInformationByHandle() etc -#include -#include -#endif -#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_are_same(const char *f1, const char *f2) -{ -#if defined _MSC_VER || defined __MINGW32__ - /* see - * http://www.hydrogenaudio.org/forums/index.php?showtopic=49439&pid=444300&st=0 - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getfileinformationbyhandle.asp - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/by_handle_file_information_str.asp - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfile.asp - * apparently both the files have to be open at the same time for the comparison to work - */ - FLAC__bool same = false; - BY_HANDLE_FILE_INFORMATION info1, info2; - HANDLE h1, h2; - BOOL ok = 1; - h1 = CreateFile(f1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - h2 = CreateFile(f2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if(h1 == INVALID_HANDLE_VALUE || h2 == INVALID_HANDLE_VALUE) - ok = 0; - ok &= GetFileInformationByHandle(h1, &info1); - ok &= GetFileInformationByHandle(h2, &info2); - if(ok) - same = - info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber && - info1.nFileIndexHigh == info2.nFileIndexHigh && - info1.nFileIndexLow == info2.nFileIndexLow - ; - if(h1 != INVALID_HANDLE_VALUE) - CloseHandle(h1); - if(h2 != INVALID_HANDLE_VALUE) - CloseHandle(h2); - return same; -#else - struct stat s1, s2; - return f1 && f2 && stat(f1, &s1) == 0 && stat(f2, &s2) == 0 && s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev; -#endif -} - -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(void) -{ - /* 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); -#elif defined __EMX__ - setmode(fileno(stdin), O_BINARY); -#endif - - return stdin; -} - -FILE *grabbag__file_get_binary_stdout(void) -{ - /* 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); -#elif defined __EMX__ - setmode(fileno(stdout), O_BINARY); -#endif - - return stdout; -} diff --git a/src/lib/dl/ext/flac/fixed.c b/src/lib/dl/ext/flac/fixed.c deleted file mode 100755 index aafab679..00000000 --- a/src/lib/dl/ext/flac/fixed.c +++ /dev/null @@ -1,435 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#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: - FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0])); - memcpy(residual, data, sizeof(residual[0])*data_len); - 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++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - residual[i] = data[i] - (data[i-1] << 1) + data[i-2]; -#else - residual[i] = data[i] - 2*data[i-1] + data[i-2]; -#endif - break; - case 3: - for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - residual[i] = data[i] - (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) - data[i-3]; -#else - residual[i] = data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3]; -#endif - break; - case 4: - for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - residual[i] = data[i] - ((data[i-1]+data[i-3])<<2) + ((data[i-2]<<2) + (data[i-2]<<1)) + data[i-4]; -#else - residual[i] = data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4]; -#endif - 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: - FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0])); - memcpy(data, residual, sizeof(residual[0])*data_len); - 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++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - data[i] = residual[i] + (data[i-1]<<1) - data[i-2]; -#else - data[i] = residual[i] + 2*data[i-1] - data[i-2]; -#endif - break; - case 3: - for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - data[i] = residual[i] + (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) + data[i-3]; -#else - data[i] = residual[i] + 3*data[i-1] - 3*data[i-2] + data[i-3]; -#endif - break; - case 4: - for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - data[i] = residual[i] + ((data[i-1]+data[i-3])<<2) - ((data[i-2]<<2) + (data[i-2]<<1)) - data[i-4]; -#else - data[i] = residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4]; -#endif - break; - default: - FLAC__ASSERT(0); - } -} diff --git a/src/lib/dl/ext/flac/float.c b/src/lib/dl/ext/flac/float.c deleted file mode 100755 index 32cf055d..00000000 --- a/src/lib/dl/ext/flac/float.c +++ /dev/null @@ -1,308 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#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/src/lib/dl/ext/flac/foreign_metadata.c b/src/lib/dl/ext/flac/foreign_metadata.c deleted file mode 100755 index e79c3c82..00000000 --- a/src/lib/dl/ext/flac/foreign_metadata.c +++ /dev/null @@ -1,593 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#if defined _MSC_VER || defined __MINGW32__ -#include /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif -#include /* for FILE etc. */ -#include /* for calloc() etc. */ -#include /* for memcmp() etc. */ -#include "flac/assert.h" -#include "flac/metadata.h" -#include "share/alloc.h" -#include "foreign_metadata.h" - -#ifdef TARGET_MSDOS /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif - -#ifdef min -#undef min -#endif -#define min(x,y) ((x)<(y)?(x):(y)) - - -static const char *FLAC__FOREIGN_METADATA_APPLICATION_ID[2] = { "aiff" , "riff" }; - -static FLAC__uint32 unpack32be_(const FLAC__byte *b) -{ - return ((FLAC__uint32)b[0]<<24) + ((FLAC__uint32)b[1]<<16) + ((FLAC__uint32)b[2]<<8) + (FLAC__uint32)b[3]; -} - -static FLAC__uint32 unpack32le_(const FLAC__byte *b) -{ - return (FLAC__uint32)b[0] + ((FLAC__uint32)b[1]<<8) + ((FLAC__uint32)b[2]<<16) + ((FLAC__uint32)b[3]<<24); -} - -static FLAC__bool copy_data_(FILE *fin, FILE *fout, size_t size, const char **error, const char * const read_error, const char * const write_error) -{ - static FLAC__byte buffer[4096]; - size_t left; - for(left = size; left > 0; ) { - size_t need = min(sizeof(buffer), left); - if(fread(buffer, 1, need, fin) < need) { - if(error) *error = read_error; - return false; - } - if(fwrite(buffer, 1, need, fout) < need) { - if(error) *error = write_error; - return false; - } - left -= need; - } - return true; -} - -static FLAC__bool append_block_(foreign_metadata_t *fm, off_t offset, FLAC__uint32 size, const char **error) -{ - foreign_block_t *fb = safe_realloc_muladd2_(fm->blocks, sizeof(foreign_block_t), /*times (*/fm->num_blocks, /*+*/1/*)*/); - if(fb) { - fb[fm->num_blocks].offset = offset; - fb[fm->num_blocks].size = size; - fm->num_blocks++; - fm->blocks = fb; - return true; - } - if(error) *error = "out of memory"; - return false; -} - -static FLAC__bool read_from_aiff_(foreign_metadata_t *fm, FILE *f, const char **error) -{ - FLAC__byte buffer[12]; - off_t offset, eof_offset; - if((offset = ftello(f)) < 0) { - if(error) *error = "ftello() error (001)"; - return false; - } - if(fread(buffer, 1, 12, f) < 12 || memcmp(buffer, "FORM", 4) || (memcmp(buffer+8, "AIFF", 4) && memcmp(buffer+8, "AIFC", 4))) { - if(error) *error = "unsupported FORM layout (002)"; - return false; - } - if(!append_block_(fm, offset, 12, error)) - return false; - eof_offset = 8 + unpack32be_(buffer+4); - while(!feof(f)) { - FLAC__uint32 size; - if((offset = ftello(f)) < 0) { - if(error) *error = "ftello() error (003)"; - return false; - } - if((size = fread(buffer, 1, 8, f)) < 8) { - if(size == 0 && feof(f)) - break; - if(error) *error = "invalid AIFF file (004)"; - return false; - } - size = unpack32be_(buffer+4); - /* check if pad byte needed */ - if(size & 1) - size++; - if(!memcmp(buffer, "COMM", 4)) { - if(fm->format_block) { - if(error) *error = "invalid AIFF file: multiple \"COMM\" chunks (005)"; - return false; - } - if(fm->audio_block) { - if(error) *error = "invalid AIFF file: \"SSND\" chunk before \"COMM\" chunk (006)"; - return false; - } - fm->format_block = fm->num_blocks; - } - else if(!memcmp(buffer, "SSND", 4)) { - if(fm->audio_block) { - if(error) *error = "invalid AIFF file: multiple \"SSND\" chunks (007)"; - return false; - } - if(!fm->format_block) { - if(error) *error = "invalid AIFF file: \"SSND\" chunk before \"COMM\" chunk (008)"; - return false; - } - fm->audio_block = fm->num_blocks; - /* read #offset bytes */ - if(fread(buffer+8, 1, 4, f) < 4) { - if(error) *error = "invalid AIFF file (009)"; - return false; - } - fm->ssnd_offset_size = unpack32be_(buffer+8); - if(fseeko(f, -4, SEEK_CUR) < 0) { - if(error) *error = "invalid AIFF file: seek error (010)"; - return false; - } - } - if(!append_block_(fm, offset, 8 + (memcmp(buffer, "SSND", 4)? size : 8 + fm->ssnd_offset_size), error)) - return false; - if(fseeko(f, size, SEEK_CUR) < 0) { - if(error) *error = "invalid AIFF file: seek error (011)"; - return false; - } - } - if(eof_offset != ftello(f)) { - if(error) *error = "invalid AIFF file: unexpected EOF (012)"; - return false; - } - if(!fm->format_block) { - if(error) *error = "invalid AIFF file: missing \"COMM\" chunk (013)"; - return false; - } - if(!fm->audio_block) { - if(error) *error = "invalid AIFF file: missing \"SSND\" chunk (014)"; - return false; - } - return true; -} - -static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char **error) -{ - FLAC__byte buffer[12]; - off_t offset, eof_offset; - if((offset = ftello(f)) < 0) { - if(error) *error = "ftello() error (001)"; - return false; - } - if(fread(buffer, 1, 12, f) < 12 || memcmp(buffer, "RIFF", 4) || memcmp(buffer+8, "WAVE", 4)) { - if(error) *error = "unsupported RIFF layout (002)"; - return false; - } - if(!append_block_(fm, offset, 12, error)) - return false; - eof_offset = 8 + unpack32le_(buffer+4); - while(!feof(f)) { - FLAC__uint32 size; - if((offset = ftello(f)) < 0) { - if(error) *error = "ftello() error (003)"; - return false; - } - if((size = fread(buffer, 1, 8, f)) < 8) { - if(size == 0 && feof(f)) - break; - if(error) *error = "invalid WAVE file (004)"; - return false; - } - size = unpack32le_(buffer+4); - /* check if pad byte needed */ - if(size & 1) - size++; - if(!memcmp(buffer, "fmt ", 4)) { - if(fm->format_block) { - if(error) *error = "invalid WAVE file: multiple \"fmt \" chunks (005)"; - return false; - } - if(fm->audio_block) { - if(error) *error = "invalid WAVE file: \"data\" chunk before \"fmt \" chunk (006)"; - return false; - } - fm->format_block = fm->num_blocks; - } - else if(!memcmp(buffer, "data", 4)) { - if(fm->audio_block) { - if(error) *error = "invalid WAVE file: multiple \"data\" chunks (007)"; - return false; - } - if(!fm->format_block) { - if(error) *error = "invalid WAVE file: \"data\" chunk before \"fmt \" chunk (008)"; - return false; - } - fm->audio_block = fm->num_blocks; - } - if(!append_block_(fm, offset, 8 + (memcmp(buffer, "data", 4)? size : 0), error)) - return false; - if(fseeko(f, size, SEEK_CUR) < 0) { - if(error) *error = "invalid WAVE file: seek error (009)"; - return false; - } - } - if(eof_offset != ftello(f)) { - if(error) *error = "invalid WAVE file: unexpected EOF (010)"; - return false; - } - if(!fm->format_block) { - if(error) *error = "invalid WAVE file: missing \"fmt \" chunk (011)"; - return false; - } - if(!fm->audio_block) { - if(error) *error = "invalid WAVE file: missing \"data\" chunk (012)"; - return false; - } - return true; -} - -static FLAC__bool write_to_flac_(foreign_metadata_t *fm, FILE *fin, FILE *fout, FLAC__Metadata_SimpleIterator *it, const char **error) -{ - FLAC__byte buffer[4]; - const unsigned ID_LEN = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8; - size_t block_num = 0; - FLAC__ASSERT(sizeof(buffer) >= ID_LEN); - while(block_num < fm->num_blocks) { - /* find next matching padding block */ - do { - /* even on the first chunk's loop there will be a skippable STREAMINFO block, on subsequent loops we are first moving past the PADDING we just used */ - if(!FLAC__metadata_simple_iterator_next(it)) { - if(error) *error = "no matching PADDING block found (004)"; - return false; - } - } while(FLAC__metadata_simple_iterator_get_block_type(it) != FLAC__METADATA_TYPE_PADDING); - if(FLAC__metadata_simple_iterator_get_block_length(it) != ID_LEN+fm->blocks[block_num].size) { - if(error) *error = "PADDING block with wrong size found (005)"; - return false; - } - /* transfer chunk into APPLICATION block */ - /* first set up the file pointers */ - if(fseeko(fin, fm->blocks[block_num].offset, SEEK_SET) < 0) { - if(error) *error = "seek failed in WAVE/AIFF file (006)"; - return false; - } - if(fseeko(fout, FLAC__metadata_simple_iterator_get_block_offset(it), SEEK_SET) < 0) { - if(error) *error = "seek failed in FLAC file (007)"; - return false; - } - /* update the type */ - buffer[0] = FLAC__METADATA_TYPE_APPLICATION; - if(FLAC__metadata_simple_iterator_is_last(it)) - buffer[0] |= 0x80; /*MAGIC number*/ - if(fwrite(buffer, 1, 1, fout) < 1) { - if(error) *error = "write failed in FLAC file (008)"; - return false; - } - /* length stays the same so skip over it */ - if(fseeko(fout, FLAC__STREAM_METADATA_LENGTH_LEN/8, SEEK_CUR) < 0) { - if(error) *error = "seek failed in FLAC file (009)"; - return false; - } - /* write the APPLICATION ID */ - memcpy(buffer, FLAC__FOREIGN_METADATA_APPLICATION_ID[fm->type], ID_LEN); - if(fwrite(buffer, 1, ID_LEN, fout) < ID_LEN) { - if(error) *error = "write failed in FLAC file (010)"; - return false; - } - /* transfer the foreign metadata */ - if(!copy_data_(fin, fout, fm->blocks[block_num].size, error, "read failed in WAVE/AIFF file (011)", "write failed in FLAC file (012)")) - return false; - block_num++; - } - return true; -} - -static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadata_SimpleIterator *it, const char **error) -{ - FLAC__byte id[4], buffer[12]; - off_t offset; - FLAC__bool type_found = false; - - FLAC__ASSERT(FLAC__STREAM_METADATA_APPLICATION_ID_LEN == sizeof(id)*8); - - while(FLAC__metadata_simple_iterator_next(it)) { - if(FLAC__metadata_simple_iterator_get_block_type(it) != FLAC__METADATA_TYPE_APPLICATION) - continue; - if(!FLAC__metadata_simple_iterator_get_application_id(it, id)) { - if(error) *error = "FLAC__metadata_simple_iterator_get_application_id() error (003)"; - return false; - } - if(memcmp(id, FLAC__FOREIGN_METADATA_APPLICATION_ID[fm->type], sizeof(id))) - continue; - offset = FLAC__metadata_simple_iterator_get_block_offset(it); - /* skip over header and app ID */ - offset += (FLAC__STREAM_METADATA_IS_LAST_LEN + FLAC__STREAM_METADATA_TYPE_LEN + FLAC__STREAM_METADATA_LENGTH_LEN) / 8; - offset += sizeof(id); - /* look for format or audio blocks */ - if(fseek(f, offset, SEEK_SET) < 0) { - if(error) *error = "seek error (004)"; - return false; - } - if(fread(buffer, 1, 4, f) != 4) { - if(error) *error = "read error (005)"; - return false; - } - if(fm->num_blocks == 0) { - if(fm->type == FOREIGN_BLOCK_TYPE__RIFF && 0 == memcmp(buffer, "RIFF", 4)) - type_found = true; - else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF && 0 == memcmp(buffer, "FORM", 4)) - type_found = true; - else { - if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (005)"; - return false; - } - } - else if(!type_found) { - FLAC__ASSERT(0); - /* double protection: */ - if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (006)"; - return false; - } - else if(fm->type == FOREIGN_BLOCK_TYPE__RIFF) { - if(!memcmp(buffer, "fmt ", 4)) { - if(fm->format_block) { - if(error) *error = "invalid WAVE metadata: multiple \"fmt \" chunks (007)"; - return false; - } - if(fm->audio_block) { - if(error) *error = "invalid WAVE metadata: \"data\" chunk before \"fmt \" chunk (008)"; - return false; - } - fm->format_block = fm->num_blocks; - } - else if(!memcmp(buffer, "data", 4)) { - if(fm->audio_block) { - if(error) *error = "invalid WAVE metadata: multiple \"data\" chunks (009)"; - return false; - } - if(!fm->format_block) { - if(error) *error = "invalid WAVE metadata: \"data\" chunk before \"fmt \" chunk (010)"; - return false; - } - fm->audio_block = fm->num_blocks; - } - } - else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF) { - if(!memcmp(buffer, "COMM", 4)) { - if(fm->format_block) { - if(error) *error = "invalid AIFF metadata: multiple \"COMM\" chunks (011)"; - return false; - } - if(fm->audio_block) { - if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (012)"; - return false; - } - fm->format_block = fm->num_blocks; - } - else if(!memcmp(buffer, "SSND", 4)) { - if(fm->audio_block) { - if(error) *error = "invalid AIFF metadata: multiple \"SSND\" chunks (013)"; - return false; - } - if(!fm->format_block) { - if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (014)"; - return false; - } - fm->audio_block = fm->num_blocks; - /* read SSND offset size */ - if(fread(buffer+4, 1, 8, f) != 8) { - if(error) *error = "read error (015)"; - return false; - } - fm->ssnd_offset_size = unpack32be_(buffer+8); - } - } - else { - FLAC__ASSERT(0); - /* double protection: */ - if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (016)"; - return false; - } - if(!append_block_(fm, offset, FLAC__metadata_simple_iterator_get_block_length(it)-sizeof(id), error)) - return false; - } - if(!type_found) { - if(error) *error = "no foreign metadata found (017)"; - return false; - } - if(!fm->format_block) { - if(error) *error = fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"fmt \" chunk (018)" : "invalid AIFF file: missing \"COMM\" chunk (018)"; - return false; - } - if(!fm->audio_block) { - if(error) *error = fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"data\" chunk (019)" : "invalid AIFF file: missing \"SSND\" chunk (019)"; - return false; - } - return true; -} - -static FLAC__bool write_to_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, off_t offset1, off_t offset2, off_t offset3, const char **error) -{ - size_t i; - if(fseeko(fout, offset1, SEEK_SET) < 0) { - if(error) *error = "seek failed in WAVE/AIFF file (002)"; - return false; - } - for(i = 1; i < fm->format_block; i++) { - if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { - if(error) *error = "seek failed in FLAC file (003)"; - return false; - } - if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (004)", "write failed in FLAC file (005)")) - return false; - } - if(fseeko(fout, offset2, SEEK_SET) < 0) { - if(error) *error = "seek failed in WAVE/AIFF file (006)"; - return false; - } - for(i = fm->format_block+1; i < fm->audio_block; i++) { - if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { - if(error) *error = "seek failed in FLAC file (007)"; - return false; - } - if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (008)", "write failed in FLAC file (009)")) - return false; - } - if(fseeko(fout, offset3, SEEK_SET) < 0) { - if(error) *error = "seek failed in WAVE/AIFF file (010)"; - return false; - } - for(i = fm->audio_block+1; i < fm->num_blocks; i++) { - if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { - if(error) *error = "seek failed in FLAC file (011)"; - return false; - } - if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (012)", "write failed in FLAC file (013)")) - return false; - } - return true; -} - -foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type) -{ - foreign_metadata_t *x = (foreign_metadata_t*)calloc(sizeof(foreign_metadata_t), 1); - if(x) - x->type = type; - return x; -} - -void flac__foreign_metadata_delete(foreign_metadata_t *fm) -{ - if(fm) { - if(fm->blocks) - free(fm->blocks); - free(fm); - } -} - -FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error) -{ - FLAC__bool ok; - FILE *f = fopen(filename, "rb"); - if(!f) { - if(error) *error = "can't open AIFF file for reading (000)"; - return false; - } - ok = read_from_aiff_(fm, f, error); - fclose(f); - return ok; -} - -FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error) -{ - FLAC__bool ok; - FILE *f = fopen(filename, "rb"); - if(!f) { - if(error) *error = "can't open WAVE file for reading (000)"; - return false; - } - ok = read_from_wave_(fm, f, error); - fclose(f); - return ok; -} - -FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error) -{ - FLAC__bool ok; - FILE *fin, *fout; - FLAC__Metadata_SimpleIterator *it = FLAC__metadata_simple_iterator_new(); - if(!it) { - if(error) *error = "out of memory (000)"; - return false; - } - if(!FLAC__metadata_simple_iterator_init(it, outfilename, /*read_only=*/true, /*preserve_file_stats=*/false)) { - if(error) *error = "can't initialize iterator (001)"; - FLAC__metadata_simple_iterator_delete(it); - return false; - } - if(0 == (fin = fopen(infilename, "rb"))) { - if(error) *error = "can't open WAVE/AIFF file for reading (002)"; - FLAC__metadata_simple_iterator_delete(it); - return false; - } - if(0 == (fout = fopen(outfilename, "r+b"))) { - if(error) *error = "can't open FLAC file for updating (003)"; - FLAC__metadata_simple_iterator_delete(it); - fclose(fin); - return false; - } - ok = write_to_flac_(fm, fin, fout, it, error); - FLAC__metadata_simple_iterator_delete(it); - fclose(fin); - fclose(fout); - return ok; -} - -FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const char *filename, const char **error) -{ - FLAC__bool ok; - FILE *f; - FLAC__Metadata_SimpleIterator *it = FLAC__metadata_simple_iterator_new(); - if(!it) { - if(error) *error = "out of memory (000)"; - return false; - } - if(!FLAC__metadata_simple_iterator_init(it, filename, /*read_only=*/true, /*preserve_file_stats=*/false)) { - if(error) *error = "can't initialize iterator (001)"; - FLAC__metadata_simple_iterator_delete(it); - return false; - } - if(0 == (f = fopen(filename, "rb"))) { - if(error) *error = "can't open FLAC file for reading (002)"; - FLAC__metadata_simple_iterator_delete(it); - return false; - } - ok = read_from_flac_(fm, f, it, error); - FLAC__metadata_simple_iterator_delete(it); - fclose(f); - return ok; -} - -FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error) -{ - FLAC__bool ok; - FILE *fin, *fout; - if(0 == (fin = fopen(infilename, "rb"))) { - if(error) *error = "can't open FLAC file for reading (000)"; - return false; - } - if(0 == (fout = fopen(outfilename, "r+b"))) { - if(error) *error = "can't open WAVE/AIFF file for updating (001)"; - fclose(fin); - return false; - } - ok = write_to_iff_(fm, fin, fout, offset1, offset2, offset3, error); - fclose(fin); - fclose(fout); - return ok; -} diff --git a/src/lib/dl/ext/flac/foreign_metadata.h b/src/lib/dl/ext/flac/foreign_metadata.h deleted file mode 100755 index f9c06040..00000000 --- a/src/lib/dl/ext/flac/foreign_metadata.h +++ /dev/null @@ -1,59 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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__foreign_metadata_h -#define flac__foreign_metadata_h - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "flac/metadata.h" -#include "utils.h" - -/* WATCHOUT: these enums are used to index internal arrays */ -typedef enum { FOREIGN_BLOCK_TYPE__AIFF = 0, FOREIGN_BLOCK_TYPE__RIFF = 1 } foreign_block_type_t; - -typedef struct { - /* for encoding, this will be the offset in the WAVE/AIFF file of the chunk */ - /* for decoding, this will be the offset in the FLAC file of the chunk data inside the APPLICATION block */ - off_t offset; - FLAC__uint32 size; -} foreign_block_t; - -typedef struct { - foreign_block_type_t type; /* currently we don't support multiple foreign types in a stream (an maybe never will) */ - foreign_block_t *blocks; - size_t num_blocks; - size_t format_block; /* block number of 'fmt ' or 'COMM' chunk */ - size_t audio_block; /* block number of 'data' or 'SSND' chunk */ - FLAC__uint32 ssnd_offset_size; /* 0 if type!=AIFF */ -} foreign_metadata_t; - -foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type); - -void flac__foreign_metadata_delete(foreign_metadata_t *fm); - -FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error); -FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error); -FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error); - -FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const char *filename, const char **error); -FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error); - -#endif diff --git a/src/lib/dl/ext/flac/format.c b/src/lib/dl/ext/flac/format.c deleted file mode 100755 index 3471195d..00000000 --- a/src/lib/dl/ext/flac/format.c +++ /dev/null @@ -1,593 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include /* for qsort() */ -#include /* for memset() */ -#include "flac/assert.h" -#include "flac/format.h" -#include "private/format.h" - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#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 __BORLANDC__ || defined __MINW32__ -/* yet one more hack because of MSVC6: */ -FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.2.1 20070917"; -#else -FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " VERSION " 20070917"; -#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_PICTURE_TYPE_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN = 32; /* 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 = 1; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN = 1; /* 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_RICE2_PARAMETER_LEN = 5; /* 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) { - return false; - } - else - return true; -} - -FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate) -{ - if( - !FLAC__format_sample_rate_is_valid(sample_rate) || - ( - sample_rate >= (1u << 16) && - !(sample_rate % 1000 == 0 || sample_rate % 10 == 0) - ) - ) { - return false; - } - else - return true; -} - -/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ -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; -} - -/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ -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; -} - -/* - * also disallows non-shortest-form encodings, c.f. - * http://www.unicode.org/versions/corrigendum1.html - * and a more clear explanation at the end of this section: - * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - */ -static FLaC__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) { - if ((utf8[0] & 0xFE) == 0xC0) /* overlong sequence check */ - return 0; - return 2; - } - else if ((utf8[0] & 0xF0) == 0xE0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80) { - if (utf8[0] == 0xE0 && (utf8[1] & 0xE0) == 0x80) /* overlong sequence check */ - return 0; - /* illegal surrogates check (U+D800...U+DFFF and U+FFFE...U+FFFF) */ - if (utf8[0] == 0xED && (utf8[1] & 0xE0) == 0xA0) /* D800-DFFF */ - return 0; - if (utf8[0] == 0xEF && utf8[1] == 0xBF && (utf8[2] & 0xFE) == 0xBE) /* FFFE-FFFF */ - return 0; - return 3; - } - else if ((utf8[0] & 0xF8) == 0xF0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80) { - if (utf8[0] == 0xF0 && (utf8[1] & 0xF0) == 0x80) /* overlong sequence check */ - return 0; - return 4; - } - else if ((utf8[0] & 0xFC) == 0xF8 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80) { - if (utf8[0] == 0xF8 && (utf8[1] & 0xF8) == 0x80) /* overlong sequence check */ - return 0; - return 5; - } - else if ((utf8[0] & 0xFE) == 0xFC && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80 && (utf8[5] & 0xC0) == 0x80) { - if (utf8[0] == 0xFC && (utf8[1] & 0xFC) == 0x80) /* overlong sequence check */ - return 0; - return 6; - } - 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; -} - -/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ -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) { - if(i == cue_sheet->num_tracks-1) /* the lead-out track... */ - *violation = "CD-DA cue sheet lead-out offset must be evenly divisible by 588 samples"; - else - *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; -} - -/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ -FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation) -{ - char *p; - FLAC__byte *b; - - for(p = picture->mime_type; *p; p++) { - if(*p < 0x20 || *p > 0x7e) { - if(violation) *violation = "MIME type string must contain only printable ASCII characters (0x20-0x7e)"; - return false; - } - } - - for(b = picture->description; *b; ) { - unsigned n = utf8len_(b); - if(n == 0) { - if(violation) *violation = "description string must be valid UTF-8"; - return false; - } - b += n; - } - - 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; - memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order)); - object->capacity_by_order = max_partition_order; - } - - return true; -} diff --git a/src/lib/dl/ext/flac/format.h b/src/lib/dl/ext/flac/format.h deleted file mode 100755 index 77e2d013..00000000 --- a/src/lib/dl/ext/flac/format.h +++ /dev/null @@ -1,1010 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 block size, in samples, permitted by the FLAC subset for - * sample rates up to 48kHz. */ -#define FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ (4608u) - -/** 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 maximum LPC order permitted by the FLAC subset for sample rates - * up to 48kHz. */ -#define FLAC__SUBSET_MAX_LPC_ORDER_48000HZ (12u) - -/** 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 NUL-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 - * 4-bit Rice parameter. */ - - FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 = 1 - /**< Residual is coded by partitioning into contexts, each with it's own - * 5-bit 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. Will be non-zero for escaped - * partitions and zero for unescaped 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_RICE2_PARAMETER_LEN; /**< == 5 (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; - -/** == 1 (bit) - * - * This used to be a zero-padding bit (hence the name - * FLAC__SUBFRAME_ZERO_PAD_LEN) but is now a reserved bit. It still has a - * mandatory value of \c 0 but in the future may take on the value \c 0 or \c 1 - * to mean something else. - */ -extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN; -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. As a convenience, the - * decoder will always convert a frame number to a sample number because - * the rules are complex. */ - - 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; /**< == 1 (bits) */ -extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN; /**< == 1 (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 (a.k.a. FLAC tags) */ - - FLAC__METADATA_TYPE_CUESHEET = 5, - /**< CUESHEET block */ - - FLAC__METADATA_TYPE_PICTURE = 6, - /**< PICTURE block */ - - FLAC__METADATA_TYPE_UNDEFINED = 7 - /**< 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 \c NUL byte */ - - 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) */ - - -/** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */ -typedef enum { - FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER = 0, /**< Other */ - FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD = 1, /**< 32x32 pixels 'file icon' (PNG only) */ - FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON = 2, /**< Other file icon */ - FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER = 3, /**< Cover (front) */ - FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER = 4, /**< Cover (back) */ - FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE = 5, /**< Leaflet page */ - FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA = 6, /**< Media (e.g. label side of CD) */ - FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST = 7, /**< Lead artist/lead performer/soloist */ - FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST = 8, /**< Artist/performer */ - FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR = 9, /**< Conductor */ - FLAC__STREAM_METADATA_PICTURE_TYPE_BAND = 10, /**< Band/Orchestra */ - FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER = 11, /**< Composer */ - FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST = 12, /**< Lyricist/text writer */ - FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION = 13, /**< Recording Location */ - FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING = 14, /**< During recording */ - FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE = 15, /**< During performance */ - FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE = 16, /**< Movie/video screen capture */ - FLAC__STREAM_METADATA_PICTURE_TYPE_FISH = 17, /**< A bright coloured fish */ - FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION = 18, /**< Illustration */ - FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE = 19, /**< Band/artist logotype */ - FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE = 20, /**< Publisher/Studio logotype */ - FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED -} FLAC__StreamMetadata_Picture_Type; - -/** Maps a FLAC__StreamMetadata_Picture_Type to a C string. - * - * Using a FLAC__StreamMetadata_Picture_Type as the index to this array - * will give the string equivalent. The contents should not be - * modified. - */ -extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[]; - -/** FLAC PICTURE structure. (See the - * format specification - * for the full description of each field.) - */ -typedef struct { - FLAC__StreamMetadata_Picture_Type type; - /**< The kind of picture stored. */ - - char *mime_type; - /**< Picture data's MIME type, in ASCII printable characters - * 0x20-0x7e, NUL terminated. For best compatibility with players, - * use picture data of MIME type \c image/jpeg or \c image/png. A - * MIME type of '-->' is also allowed, in which case the picture - * data should be a complete URL. In file storage, the MIME type is - * stored as a 32-bit length followed by the ASCII string with no NUL - * terminator, but is converted to a plain C string in this structure - * for convenience. - */ - - FLAC__byte *description; - /**< Picture's description in UTF-8, NUL terminated. In file storage, - * the description is stored as a 32-bit length followed by the UTF-8 - * string with no NUL terminator, but is converted to a plain C string - * in this structure for convenience. - */ - - FLAC__uint32 width; - /**< Picture's width in pixels. */ - - FLAC__uint32 height; - /**< Picture's height in pixels. */ - - FLAC__uint32 depth; - /**< Picture's color depth in bits-per-pixel. */ - - FLAC__uint32 colors; - /**< For indexed palettes (like GIF), picture's number of colors (the - * number of palette entries), or \c 0 for non-indexed (i.e. 2^depth). - */ - - FLAC__uint32 data_length; - /**< Length of binary picture data in bytes. */ - - FLAC__byte *data; - /**< Binary picture data. */ - -} FLAC__StreamMetadata_Picture; - -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */ -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */ -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */ -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */ -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */ -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */ -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */ -extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (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_Picture picture; - 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. - * - * \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); - -/** Tests that a sample rate is valid for the FLAC subset. The subset rules - * for valid sample rates are slightly more complex since the rate has to - * be expressible completely in the frame header. - * - * \param sample_rate The sample rate to test for compliance. - * \retval FLAC__bool - * \c true if the given sample rate conforms to the specification for the - * subset, else \c false. - */ -FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(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 entry An entry to be checked. - * \param length The length of \a entry in bytes. - * \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); - -/** 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); - -/** 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); - -/** 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); - -/** Check picture data to see if it conforms to the FLAC specification. - * See the format specification for limits on the contents of the - * PICTURE block. - * - * \param picture A pointer to existing picture data to be checked. - * \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 picture != NULL \endcode - * \retval FLAC__bool - * \c false if picture data is illegal, else \c true. - */ -FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation); - -/* \} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/flac/getopt.c b/src/lib/dl/ext/flac/getopt.c deleted file mode 100755 index 6ab474b4..00000000 --- a/src/lib/dl/ext/flac/getopt.c +++ /dev/null @@ -1,1047 +0,0 @@ -/* 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 "config.h" -#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 - -#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 `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 `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 "getopt.h" - -/* For communication from `getopt' to the caller. - When `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 *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 `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `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 optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* 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 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 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 `getopt' to return -1 with `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,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 = 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 += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_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 = 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; -#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 `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `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 `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 `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `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 `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 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 -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[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[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[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 > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = 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 != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = 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 (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - 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 (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) - 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; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[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[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct 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 (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - 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) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[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[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - 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 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[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[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[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (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); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct 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') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = 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 (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - 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) - optarg = nameend + 1; - else - { - if (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 (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[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') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct 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 `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = 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", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/lib/dl/ext/flac/getopt.h b/src/lib/dl/ext/flac/getopt.h deleted file mode 100755 index 49c94f4b..00000000 --- a/src/lib/dl/ext/flac/getopt.h +++ /dev/null @@ -1,171 +0,0 @@ -/* 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 _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef DONT_DEFINE_GETOPT_VARS -/* For communication from `getopt' to the caller. - When `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 *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 `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; -#endif - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - 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 `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, `getopt' - returns the contents of the `val' field. */ - -struct 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 option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#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, `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 `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `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 - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# 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 getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/src/lib/dl/ext/flac/getopt1.c b/src/lib/dl/ext/flac/getopt1.c deleted file mode 100755 index 8c1a78f3..00000000 --- a/src/lib/dl/ext/flac/getopt1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* 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 "config.h" -#endif - -#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 - -#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 -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like 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 -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _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 = optind ? optind : 1; - int option_index = 0; - static struct 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 = 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 (optarg) - printf (" with arg %s", 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", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/lib/dl/ext/flac/iffscan.c b/src/lib/dl/ext/flac/iffscan.c deleted file mode 100755 index e69de29b..00000000 diff --git a/src/lib/dl/ext/flac/local_string_utils.c b/src/lib/dl/ext/flac/local_string_utils.c deleted file mode 100755 index 7efd3880..00000000 --- a/src/lib/dl/ext/flac/local_string_utils.c +++ /dev/null @@ -1,109 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "utils.h" -#include "local_string_utils.h" - -/* $OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $ - * - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t -flac__strlcpy(char *dst, const char *src, size_t siz) -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} - -/* $OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $ - * - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz <= strlen(dst)). - * Returns strlen(src) + MIN(siz, strlen(initial dst)). - * If retval >= siz, truncation occurred. - */ -size_t -flac__strlcat(char *dst, const char *src, size_t siz) -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (n-- != 0 && *d != '\0') - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen + (s - src)); /* count does not include NUL */ -} diff --git a/src/lib/dl/ext/flac/local_string_utils.h b/src/lib/dl/ext/flac/local_string_utils.h deleted file mode 100755 index e43041ba..00000000 --- a/src/lib/dl/ext/flac/local_string_utils.h +++ /dev/null @@ -1,27 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 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__local_string_utils_h -#define flac__local_string_utils_h - -#include /* for size_t */ - -size_t flac__strlcpy(char *dst, const char *src, size_t siz); -size_t flac__strlcat(char *dst, const char *src, size_t siz); - -#endif diff --git a/src/lib/dl/ext/flac/lpc.c b/src/lib/dl/ext/flac/lpc.c deleted file mode 100755 index 80cd0b91..00000000 --- a/src/lib/dl/ext/flac/lpc.c +++ /dev/null @@ -1,1377 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#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 - -/* OPT: #undef'ing this may improve the speed on some architectures */ -#define FLAC__LPC_UNROLLED_FILTER_LOOPS - - -void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len) -{ - unsigned i; - for(i = 0; i < data_len; i++) - out[i] = in[i] * window[i]; -} - -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); - - /* - * Technically we should subtract the mean first like so: - * for(i = 0; i < data_len; i++) - * data[i] -= mean; - * but it appears not to make enough of a difference to matter, and - * most signals are already closely centered around zero - */ - 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(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; - - /* see SF bug #1601812 http://sourceforge.net/tracker/index.php?func=detail&aid=1601812&group_id=13478&atid=113478 */ - if(err == 0.0) { - *max_order = i+1; - return; - } - } -} - -int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift) -{ - unsigned i; - FLAC__double cmax; - FLAC__int32 qmax, qmin; - - 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--; - - /* calc cmax = max( |lp_coeff[i]| ) */ - cmax = 0.0; - for(i = 0; i < order; i++) { - const FLAC__double d = fabs(lp_coeff[i]); - if(d > cmax) - cmax = d; - } - - if(cmax <= 0.0) { - /* => coefficients are all 0, which means our constant-detect didn't work */ - return 2; - } - else { - const int max_shiftlimit = (1 << (FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN-1)) - 1; - const int min_shiftlimit = -max_shiftlimit - 1; - int log2cmax; - - (void)frexp(cmax, &log2cmax); - log2cmax--; - *shift = (int)precision - log2cmax - 1; - - if(*shift > max_shiftlimit) - *shift = max_shiftlimit; - else if(*shift < min_shiftlimit) - return 1; - } - - if(*shift >= 0) { - FLAC__double error = 0.0; - FLAC__int32 q; - for(i = 0; i < order; i++) { - error += lp_coeff[i] * (1 << *shift); -#if 1 /* unfortunately lround() is C99 */ - if(error >= 0.0) - q = (FLAC__int32)(error + 0.5); - else - q = (FLAC__int32)(error - 0.5); -#else - q = lround(error); -#endif -#ifdef FLAC__OVERFLOW_DETECT - if(q > qmax+1) /* we expect q==qmax+1 occasionally due to rounding */ - fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]); - else if(q < qmin) - fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q qmax) - q = qmax; - else if(q < qmin) - q = qmin; - error -= q; - qlp_coeff[i] = q; - } - } - /* negative shift is very rare but due to design flaw, negative shift is - * a NOP in the decoder, so it must be handled specially by scaling down - * coeffs - */ - else { - const int nshift = -(*shift); - FLAC__double error = 0.0; - FLAC__int32 q; -#ifdef DEBUG - fprintf(stderr,"FLAC__lpc_quantize_coefficients: negative shift=%d order=%u cmax=%f\n", *shift, order, cmax); -#endif - for(i = 0; i < order; i++) { - error += lp_coeff[i] / (1 << nshift); -#if 1 /* unfortunately lround() is C99 */ - if(error >= 0.0) - q = (FLAC__int32)(error + 0.5); - else - q = (FLAC__int32)(error - 0.5); -#else - q = lround(error); -#endif -#ifdef FLAC__OVERFLOW_DETECT - if(q > qmax+1) /* we expect q==qmax+1 occasionally due to rounding */ - fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]); - else if(q < qmin) - fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q qmax) - q = qmax; - else if(q < qmin) - q = qmin; - error -= q; - qlp_coeff[i] = q; - } - *shift = 0; - } - - 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[]) -#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) -{ - FLAC__int64 sumo; - 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++) { - sumo = 0; - sum = 0; - history = data; - for(j = 0; j < order; j++) { - sum += qlp_coeff[j] * (*(--history)); - 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,(long long)sumo); -#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); - } - */ -} -#else /* fully unrolled version for normal use */ -{ - int i; - FLAC__int32 sum; - - FLAC__ASSERT(order > 0); - FLAC__ASSERT(order <= 32); - - /* - * We do unique versions up to 12th order since that's the subset limit. - * Also they are roughly ordered to match frequency of occurrence to - * minimize branching. - */ - if(order <= 12) { - if(order > 8) { - if(order > 10) { - if(order == 12) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[11] * data[i-12]; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[9] * data[i-10]; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - else { /* order == 11 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[9] * data[i-10]; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - } - else { - if(order == 10) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[9] * data[i-10]; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - else { /* order == 9 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - } - } - else if(order > 4) { - if(order > 6) { - if(order == 8) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - else { /* order == 7 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - } - else { - if(order == 6) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - else { /* order == 5 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - } - } - else { - if(order > 2) { - if(order == 4) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - else { /* order == 3 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - } - else { - if(order == 2) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - residual[i] = data[i] - (sum >> lp_quantization); - } - } - else { /* order == 1 */ - for(i = 0; i < (int)data_len; i++) - residual[i] = data[i] - ((qlp_coeff[0] * data[i-1]) >> lp_quantization); - } - } - } - } - else { /* order > 12 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - switch(order) { - case 32: sum += qlp_coeff[31] * data[i-32]; - case 31: sum += qlp_coeff[30] * data[i-31]; - case 30: sum += qlp_coeff[29] * data[i-30]; - case 29: sum += qlp_coeff[28] * data[i-29]; - case 28: sum += qlp_coeff[27] * data[i-28]; - case 27: sum += qlp_coeff[26] * data[i-27]; - case 26: sum += qlp_coeff[25] * data[i-26]; - case 25: sum += qlp_coeff[24] * data[i-25]; - case 24: sum += qlp_coeff[23] * data[i-24]; - case 23: sum += qlp_coeff[22] * data[i-23]; - case 22: sum += qlp_coeff[21] * data[i-22]; - case 21: sum += qlp_coeff[20] * data[i-21]; - case 20: sum += qlp_coeff[19] * data[i-20]; - case 19: sum += qlp_coeff[18] * data[i-19]; - case 18: sum += qlp_coeff[17] * data[i-18]; - case 17: sum += qlp_coeff[16] * data[i-17]; - case 16: sum += qlp_coeff[15] * data[i-16]; - case 15: sum += qlp_coeff[14] * data[i-15]; - case 14: sum += qlp_coeff[13] * data[i-14]; - case 13: sum += qlp_coeff[12] * data[i-13]; - sum += qlp_coeff[11] * data[i-12]; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[ 9] * data[i-10]; - sum += qlp_coeff[ 8] * data[i- 9]; - sum += qlp_coeff[ 7] * data[i- 8]; - sum += qlp_coeff[ 6] * data[i- 7]; - sum += qlp_coeff[ 5] * data[i- 6]; - sum += qlp_coeff[ 4] * data[i- 5]; - sum += qlp_coeff[ 3] * data[i- 4]; - sum += qlp_coeff[ 2] * data[i- 3]; - sum += qlp_coeff[ 1] * data[i- 2]; - sum += qlp_coeff[ 0] * data[i- 1]; - } - residual[i] = data[i] - (sum >> lp_quantization); - } - } -} -#endif - -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[]) -#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) -{ - 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)); - if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) { -#if defined _MSC_VER - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization); -#else - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization)); -#endif - break; - } - if(FLAC__bitmath_silog2_wide((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32) { -#if defined _MSC_VER - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%I64d, residual=%I64d\n", i, *data, sum >> lp_quantization, (FLAC__int64)(*data) - (sum >> lp_quantization)); -#else - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%lld, residual=%lld\n", i, *data, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*data) - (sum >> lp_quantization))); -#endif - break; - } - *(residual++) = *(data++) - (FLAC__int32)(sum >> lp_quantization); - } -} -#else /* fully unrolled version for normal use */ -{ - int i; - FLAC__int64 sum; - - FLAC__ASSERT(order > 0); - FLAC__ASSERT(order <= 32); - - /* - * We do unique versions up to 12th order since that's the subset limit. - * Also they are roughly ordered to match frequency of occurrence to - * minimize branching. - */ - if(order <= 12) { - if(order > 8) { - if(order > 10) { - if(order == 12) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 11 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - } - else { - if(order == 10) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 9 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - } - } - else if(order > 4) { - if(order > 6) { - if(order == 8) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 7 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - } - else { - if(order == 6) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 5 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - } - } - else { - if(order > 2) { - if(order == 4) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 3 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - } - else { - if(order == 2) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 1 */ - for(i = 0; i < (int)data_len; i++) - residual[i] = data[i] - (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization); - } - } - } - } - else { /* order > 12 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - switch(order) { - case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; - case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; - case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; - case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; - case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; - case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; - case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; - case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; - case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; - case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; - case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; - case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; - case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; - case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; - case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; - case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; - case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; - case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; - case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; - case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; - sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; - sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; - sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; - sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; - sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; - sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; - sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; - sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; - sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; - } - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); - } - } -} -#endif - -#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[]) -#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) -{ - FLAC__int64 sumo; - unsigned i, j; - FLAC__int32 sum; - const FLAC__int32 *r = residual, *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++) { - sumo = 0; - sum = 0; - history = data; - for(j = 0; j < order; j++) { - sum += qlp_coeff[j] * (*(--history)); - 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,(long long)sumo); -#endif - } - *(data++) = *(r++) + (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); - } - */ -} -#else /* fully unrolled version for normal use */ -{ - int i; - FLAC__int32 sum; - - FLAC__ASSERT(order > 0); - FLAC__ASSERT(order <= 32); - - /* - * We do unique versions up to 12th order since that's the subset limit. - * Also they are roughly ordered to match frequency of occurrence to - * minimize branching. - */ - if(order <= 12) { - if(order > 8) { - if(order > 10) { - if(order == 12) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[11] * data[i-12]; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[9] * data[i-10]; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - else { /* order == 11 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[9] * data[i-10]; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - } - else { - if(order == 10) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[9] * data[i-10]; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - else { /* order == 9 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[8] * data[i-9]; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - } - } - else if(order > 4) { - if(order > 6) { - if(order == 8) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[7] * data[i-8]; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - else { /* order == 7 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[6] * data[i-7]; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - } - else { - if(order == 6) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[5] * data[i-6]; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - else { /* order == 5 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[4] * data[i-5]; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - } - } - else { - if(order > 2) { - if(order == 4) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[3] * data[i-4]; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - else { /* order == 3 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[2] * data[i-3]; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - } - else { - if(order == 2) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[1] * data[i-2]; - sum += qlp_coeff[0] * data[i-1]; - data[i] = residual[i] + (sum >> lp_quantization); - } - } - else { /* order == 1 */ - for(i = 0; i < (int)data_len; i++) - data[i] = residual[i] + ((qlp_coeff[0] * data[i-1]) >> lp_quantization); - } - } - } - } - else { /* order > 12 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - switch(order) { - case 32: sum += qlp_coeff[31] * data[i-32]; - case 31: sum += qlp_coeff[30] * data[i-31]; - case 30: sum += qlp_coeff[29] * data[i-30]; - case 29: sum += qlp_coeff[28] * data[i-29]; - case 28: sum += qlp_coeff[27] * data[i-28]; - case 27: sum += qlp_coeff[26] * data[i-27]; - case 26: sum += qlp_coeff[25] * data[i-26]; - case 25: sum += qlp_coeff[24] * data[i-25]; - case 24: sum += qlp_coeff[23] * data[i-24]; - case 23: sum += qlp_coeff[22] * data[i-23]; - case 22: sum += qlp_coeff[21] * data[i-22]; - case 21: sum += qlp_coeff[20] * data[i-21]; - case 20: sum += qlp_coeff[19] * data[i-20]; - case 19: sum += qlp_coeff[18] * data[i-19]; - case 18: sum += qlp_coeff[17] * data[i-18]; - case 17: sum += qlp_coeff[16] * data[i-17]; - case 16: sum += qlp_coeff[15] * data[i-16]; - case 15: sum += qlp_coeff[14] * data[i-15]; - case 14: sum += qlp_coeff[13] * data[i-14]; - case 13: sum += qlp_coeff[12] * data[i-13]; - sum += qlp_coeff[11] * data[i-12]; - sum += qlp_coeff[10] * data[i-11]; - sum += qlp_coeff[ 9] * data[i-10]; - sum += qlp_coeff[ 8] * data[i- 9]; - sum += qlp_coeff[ 7] * data[i- 8]; - sum += qlp_coeff[ 6] * data[i- 7]; - sum += qlp_coeff[ 5] * data[i- 6]; - sum += qlp_coeff[ 4] * data[i- 5]; - sum += qlp_coeff[ 3] * data[i- 4]; - sum += qlp_coeff[ 2] * data[i- 3]; - sum += qlp_coeff[ 1] * data[i- 2]; - sum += qlp_coeff[ 0] * data[i- 1]; - } - data[i] = residual[i] + (sum >> lp_quantization); - } - } -} -#endif - -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[]) -#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) -{ - unsigned i, j; - FLAC__int64 sum; - const FLAC__int32 *r = residual, *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)); - if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) { -#ifdef _MSC_VER - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization); -#else - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization)); -#endif - break; - } - if(FLAC__bitmath_silog2_wide((FLAC__int64)(*r) + (sum >> lp_quantization)) > 32) { -#ifdef _MSC_VER - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%I64d, data=%I64d\n", i, *r, sum >> lp_quantization, (FLAC__int64)(*r) + (sum >> lp_quantization)); -#else - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *r, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*r) + (sum >> lp_quantization))); -#endif - break; - } - *(data++) = *(r++) + (FLAC__int32)(sum >> lp_quantization); - } -} -#else /* fully unrolled version for normal use */ -{ - int i; - FLAC__int64 sum; - - FLAC__ASSERT(order > 0); - FLAC__ASSERT(order <= 32); - - /* - * We do unique versions up to 12th order since that's the subset limit. - * Also they are roughly ordered to match frequency of occurrence to - * minimize branching. - */ - if(order <= 12) { - if(order > 8) { - if(order > 10) { - if(order == 12) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 11 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - } - else { - if(order == 10) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 9 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - } - } - else if(order > 4) { - if(order > 6) { - if(order == 8) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 7 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - } - else { - if(order == 6) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 5 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - } - } - else { - if(order > 2) { - if(order == 4) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 3 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - } - else { - if(order == 2) { - for(i = 0; i < (int)data_len; i++) { - sum = 0; - sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; - sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } - else { /* order == 1 */ - for(i = 0; i < (int)data_len; i++) - data[i] = residual[i] + (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization); - } - } - } - } - else { /* order > 12 */ - for(i = 0; i < (int)data_len; i++) { - sum = 0; - switch(order) { - case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; - case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; - case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; - case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; - case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; - case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; - case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; - case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; - case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; - case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; - case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; - case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; - case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; - case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; - case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; - case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; - case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; - case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; - case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; - case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; - sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; - sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; - sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; - sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; - sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; - sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; - sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; - sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; - sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; - sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; - sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; - sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; - } - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); - } - } -} -#endif - -#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 overhead_bits_per_order) -{ - unsigned order, index, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */ - FLAC__double bits, best_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_index = 0; - best_bits = (unsigned)(-1); - - for(index = 0, order = 1; index < max_order; index++, order++) { - bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[index], error_scale) * (FLAC__double)(total_samples - order) + (FLAC__double)(order * overhead_bits_per_order); - if(bits < best_bits) { - best_index = index; - best_bits = bits; - } - } - - return best_index+1; /* +1 since index of lpc_error[] is order-1 */ -} - -#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/src/lib/dl/ext/flac/main.c b/src/lib/dl/ext/flac/main.c deleted file mode 100755 index e9eaac86..00000000 --- a/src/lib/dl/ext/flac/main.c +++ /dev/null @@ -1,2181 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined _MSC_VER && !defined __MINGW32__ -/* unlink is in stdio.h in VC++ */ -#include /* for unlink() */ -#endif -#include "flac/all.h" -#include "share/alloc.h" -#include "share/grabbag.h" -#include "analyze.h" -#include "decode.h" -#include "encode.h" -#include "local_string_utils.h" /* for flac__strlcat() and flac__strlcpy() */ -#include "utils.h" -#include "vorbiscomment.h" - -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ -#define FLAC__STRCASECMP stricmp -#else -#define FLAC__STRCASECMP strcasecmp -#endif - -#if 0 -/*[JEC] was:#if HAVE_GETOPT_LONG*/ -/*[JEC] see flac/include/share/getopt.h as to why the change */ -# include -#else -# include "share/getopt.h" -#endif - -typedef enum { RAW, WAV, AIF, FLAC, OGGFLAC } FileFormat; - -static int do_it(void); - -static FLAC__bool init_options(void); -static int parse_options(int argc, char *argv[]); -static int parse_option(int short_option, const char *long_option, const char *option_argument); -static void free_options(void); -static void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool value); -static void add_compression_setting_string(compression_setting_type_t type, const char *value); -static void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value); - -static int usage_error(const char *message, ...); -static void short_usage(void); -static void show_version(void); -static void show_help(void); -static void show_explain(void); -static void format_mistake(const char *infilename, FileFormat wrong, FileFormat right); - -static int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_last_file); -static int decode_file(const char *infilename); - -static const char *get_encoded_outfilename(const char *infilename); -static const char *get_decoded_outfilename(const char *infilename); -static const char *get_outfilename(const char *infilename, const char *suffix); - -static void die(const char *message); -static int conditional_fclose(FILE *f); -static char *local_strdup(const char *source); -#ifdef _MSC_VER -/* There's no strtoll() in MSVC6 so we just write a specialized one */ -static FLAC__int64 local__strtoll(const char *src, char **endptr); -#endif - - -/* - * share__getopt format struct; note that for long options with no - * short option equivalent we just set the 'val' field to 0. - */ -static struct share__option long_options_[] = { - /* - * general options - */ - { "help" , share__no_argument, 0, 'h' }, - { "explain" , share__no_argument, 0, 'H' }, - { "version" , share__no_argument, 0, 'v' }, - { "decode" , share__no_argument, 0, 'd' }, - { "analyze" , share__no_argument, 0, 'a' }, - { "test" , share__no_argument, 0, 't' }, - { "stdout" , share__no_argument, 0, 'c' }, - { "silent" , share__no_argument, 0, 's' }, - { "totally-silent" , share__no_argument, 0, 0 }, - { "warnings-as-errors" , share__no_argument, 0, 'w' }, - { "force" , share__no_argument, 0, 'f' }, - { "delete-input-file" , share__no_argument, 0, 0 }, - { "keep-foreign-metadata" , share__no_argument, 0, 0 }, - { "output-prefix" , share__required_argument, 0, 0 }, - { "output-name" , share__required_argument, 0, 'o' }, - { "skip" , share__required_argument, 0, 0 }, - { "until" , share__required_argument, 0, 0 }, - { "channel-map" , share__required_argument, 0, 0 }, /* undocumented */ - - /* - * decoding options - */ - { "decode-through-errors", share__no_argument, 0, 'F' }, - { "cue" , share__required_argument, 0, 0 }, - { "apply-replaygain-which-is-not-lossless", share__optional_argument, 0, 0 }, /* undocumented */ - - /* - * encoding options - */ - { "cuesheet" , share__required_argument, 0, 0 }, - { "no-cued-seekpoints" , share__no_argument, 0, 0 }, - { "picture" , share__required_argument, 0, 0 }, - { "tag" , share__required_argument, 0, 'T' }, - { "tag-from-file" , share__required_argument, 0, 0 }, - { "compression-level-0" , share__no_argument, 0, '0' }, - { "compression-level-1" , share__no_argument, 0, '1' }, - { "compression-level-2" , share__no_argument, 0, '2' }, - { "compression-level-3" , share__no_argument, 0, '3' }, - { "compression-level-4" , share__no_argument, 0, '4' }, - { "compression-level-5" , share__no_argument, 0, '5' }, - { "compression-level-6" , share__no_argument, 0, '6' }, - { "compression-level-7" , share__no_argument, 0, '7' }, - { "compression-level-8" , share__no_argument, 0, '8' }, - { "compression-level-9" , share__no_argument, 0, '9' }, - { "best" , share__no_argument, 0, '8' }, - { "fast" , share__no_argument, 0, '0' }, - { "verify" , share__no_argument, 0, 'V' }, - { "force-aiff-format" , share__no_argument, 0, 0 }, - { "force-raw-format" , share__no_argument, 0, 0 }, - { "lax" , share__no_argument, 0, 0 }, - { "replay-gain" , share__no_argument, 0, 0 }, - { "ignore-chunk-sizes" , share__no_argument, 0, 0 }, - { "sector-align" , share__no_argument, 0, 0 }, - { "seekpoint" , share__required_argument, 0, 'S' }, - { "padding" , share__required_argument, 0, 'P' }, -#if FLAC__HAS_OGG - { "ogg" , share__no_argument, 0, 0 }, - { "serial-number" , share__required_argument, 0, 0 }, -#endif - { "blocksize" , share__required_argument, 0, 'b' }, - { "exhaustive-model-search" , share__no_argument, 0, 'e' }, - { "max-lpc-order" , share__required_argument, 0, 'l' }, - { "apodization" , share__required_argument, 0, 'A' }, - { "mid-side" , share__no_argument, 0, 'm' }, - { "adaptive-mid-side" , share__no_argument, 0, 'M' }, - { "qlp-coeff-precision-search", share__no_argument, 0, 'p' }, - { "qlp-coeff-precision" , share__required_argument, 0, 'q' }, - { "rice-partition-order" , share__required_argument, 0, 'r' }, - { "endian" , share__required_argument, 0, 0 }, - { "channels" , share__required_argument, 0, 0 }, - { "bps" , share__required_argument, 0, 0 }, - { "sample-rate" , share__required_argument, 0, 0 }, - { "sign" , share__required_argument, 0, 0 }, - { "input-size" , share__required_argument, 0, 0 }, - - /* - * analysis options - */ - { "residual-gnuplot", share__no_argument, 0, 0 }, - { "residual-text", share__no_argument, 0, 0 }, - - /* - * negatives - */ - { "no-decode-through-errors" , share__no_argument, 0, 0 }, - { "no-silent" , share__no_argument, 0, 0 }, - { "no-force" , share__no_argument, 0, 0 }, - { "no-seektable" , share__no_argument, 0, 0 }, - { "no-delete-input-file" , share__no_argument, 0, 0 }, - { "no-keep-foreign-metadata" , share__no_argument, 0, 0 }, - { "no-replay-gain" , share__no_argument, 0, 0 }, - { "no-ignore-chunk-sizes" , share__no_argument, 0, 0 }, - { "no-sector-align" , share__no_argument, 0, 0 }, - { "no-utf8-convert" , share__no_argument, 0, 0 }, - { "no-lax" , share__no_argument, 0, 0 }, -#if FLAC__HAS_OGG - { "no-ogg" , share__no_argument, 0, 0 }, -#endif - { "no-exhaustive-model-search", share__no_argument, 0, 0 }, - { "no-mid-side" , share__no_argument, 0, 0 }, - { "no-adaptive-mid-side" , share__no_argument, 0, 0 }, - { "no-qlp-coeff-prec-search" , share__no_argument, 0, 0 }, - { "no-padding" , share__no_argument, 0, 0 }, - { "no-verify" , share__no_argument, 0, 0 }, - { "no-warnings-as-errors" , share__no_argument, 0, 0 }, - { "no-residual-gnuplot" , share__no_argument, 0, 0 }, - { "no-residual-text" , share__no_argument, 0, 0 }, - /* - * undocumented debugging options for the test suite - */ - { "disable-constant-subframes", share__no_argument, 0, 0 }, - { "disable-fixed-subframes" , share__no_argument, 0, 0 }, - { "disable-verbatim-subframes", share__no_argument, 0, 0 }, - { "no-md5-sum" , share__no_argument, 0, 0 }, - - {0, 0, 0, 0} -}; - - -/* - * global to hold command-line option values - */ - -static struct { - FLAC__bool show_help; - FLAC__bool show_explain; - FLAC__bool show_version; - FLAC__bool mode_decode; - FLAC__bool verify; - FLAC__bool treat_warnings_as_errors; - FLAC__bool force_file_overwrite; - FLAC__bool continue_through_decode_errors; - replaygain_synthesis_spec_t replaygain_synthesis_spec; - FLAC__bool lax; - FLAC__bool test_only; - FLAC__bool analyze; - FLAC__bool use_ogg; - FLAC__bool has_serial_number; /* true iff --serial-number was used */ - long serial_number; /* this is the Ogg serial number and is unused for native FLAC */ - FLAC__bool force_to_stdout; - FLAC__bool force_aiff_format; - FLAC__bool force_raw_format; - FLAC__bool delete_input; - FLAC__bool keep_foreign_metadata; - FLAC__bool replay_gain; - FLAC__bool ignore_chunk_sizes; - FLAC__bool sector_align; - FLAC__bool utf8_convert; /* true by default, to convert tag strings from locale to utf-8, false if --no-utf8-convert used */ - const char *cmdline_forced_outfilename; - const char *output_prefix; - analysis_options aopts; - int padding; /* -1 => no -P options were given, 0 => -P- was given, else -P value */ - size_t num_compression_settings; - compression_setting_t compression_settings[64]; /* bad MAGIC NUMBER but buffer overflow is checked */ - const char *skip_specification; - const char *until_specification; - const char *cue_specification; - int format_is_big_endian; - int format_is_unsigned_samples; - int format_channels; - int format_bps; - int format_sample_rate; - off_t format_input_size; - char requested_seek_points[5000]; /* bad MAGIC NUMBER but buffer overflow is checked */ - int num_requested_seek_points; /* -1 => no -S options were given, 0 => -S- was given */ - const char *cuesheet_filename; - FLAC__bool cued_seekpoints; - FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ - - unsigned num_files; - char **filenames; - - FLAC__StreamMetadata *vorbis_comment; - FLAC__StreamMetadata *pictures[64]; - unsigned num_pictures; - - struct { - FLAC__bool disable_constant_subframes; - FLAC__bool disable_fixed_subframes; - FLAC__bool disable_verbatim_subframes; - FLAC__bool do_md5; - } debug; -} option_values; - - -/* - * miscellaneous globals - */ - -static FLAC__int32 align_reservoir_0[588], align_reservoir_1[588]; /* for carrying over samples from --sector-align */ -static FLAC__int32 *align_reservoir[2] = { align_reservoir_0, align_reservoir_1 }; -static unsigned align_reservoir_samples = 0; /* 0 .. 587 */ - - -int main(int argc, char *argv[]) -{ - int retval = 0; - -#ifdef __EMX__ - _response(&argc, &argv); - _wildcard(&argc, &argv); -#endif - - srand((unsigned)time(0)); - setlocale(LC_ALL, ""); - if(!init_options()) { - flac__utils_printf(stderr, 1, "ERROR: allocating memory\n"); - retval = 1; - } - else { - if((retval = parse_options(argc, argv)) == 0) - retval = do_it(); - } - - free_options(); - - return retval; -} - -int do_it(void) -{ - int retval = 0; - - if(option_values.show_version) { - show_version(); - return 0; - } - else if(option_values.show_explain) { - show_explain(); - return 0; - } - else if(option_values.show_help) { - show_help(); - return 0; - } - else { - if(option_values.num_files == 0) { - if(flac__utils_verbosity_ >= 1) - short_usage(); - return 0; - } - - /* - * tweak options; validate the values - */ - if(!option_values.mode_decode) { - if(0 != option_values.cue_specification) - return usage_error("ERROR: --cue is not allowed in test mode\n"); - } - else { - if(option_values.test_only) { - if(0 != option_values.skip_specification) - return usage_error("ERROR: --skip is not allowed in test mode\n"); - if(0 != option_values.until_specification) - return usage_error("ERROR: --until is not allowed in test mode\n"); - if(0 != option_values.cue_specification) - return usage_error("ERROR: --cue is not allowed in test mode\n"); - if(0 != option_values.analyze) - return usage_error("ERROR: analysis mode (-a/--analyze) and test mode (-t/--test) cannot be used together\n"); - } - } - - if(0 != option_values.cue_specification && (0 != option_values.skip_specification || 0 != option_values.until_specification)) - return usage_error("ERROR: --cue may not be combined with --skip or --until\n"); - - if(option_values.format_channels >= 0) { - if(option_values.format_channels == 0 || (unsigned)option_values.format_channels > FLAC__MAX_CHANNELS) - return usage_error("ERROR: invalid number of channels '%u', must be > 0 and <= %u\n", option_values.format_channels, FLAC__MAX_CHANNELS); - } - if(option_values.format_bps >= 0) { - if(option_values.format_bps != 8 && option_values.format_bps != 16 && option_values.format_bps != 24) - return usage_error("ERROR: invalid bits per sample '%u' (must be 8/16/24)\n", option_values.format_bps); - } - if(option_values.format_sample_rate >= 0) { - if(!FLAC__format_sample_rate_is_valid(option_values.format_sample_rate)) - return usage_error("ERROR: invalid sample rate '%u', must be > 0 and <= %u\n", option_values.format_sample_rate, FLAC__MAX_SAMPLE_RATE); - } - if(option_values.force_raw_format && option_values.force_aiff_format) - return usage_error("ERROR: only one of --force-raw-format and --force-aiff-format allowed\n"); - if(option_values.mode_decode) { - if(!option_values.force_raw_format) { - if(option_values.format_is_big_endian >= 0) - return usage_error("ERROR: --endian only allowed with --force-raw-format\n"); - if(option_values.format_is_unsigned_samples >= 0) - return usage_error("ERROR: --sign only allowed with --force-raw-format\n"); - } - if(option_values.format_channels >= 0) - return usage_error("ERROR: --channels not allowed with --decode\n"); - if(option_values.format_bps >= 0) - return usage_error("ERROR: --bps not allowed with --decode\n"); - if(option_values.format_sample_rate >= 0) - return usage_error("ERROR: --sample-rate not allowed with --decode\n"); - } - - if(option_values.ignore_chunk_sizes) { - if(option_values.mode_decode) - return usage_error("ERROR: --ignore-chunk-sizes only allowed for encoding\n"); - if(0 != option_values.sector_align) - return usage_error("ERROR: --ignore-chunk-sizes not allowed with --sector-align\n"); - if(0 != option_values.until_specification) - return usage_error("ERROR: --ignore-chunk-sizes not allowed with --until\n"); - if(0 != option_values.cue_specification) - return usage_error("ERROR: --ignore-chunk-sizes not allowed with --cue\n"); - if(0 != option_values.cuesheet_filename) - return usage_error("ERROR: --ignore-chunk-sizes not allowed with --cuesheet\n"); - } - if(option_values.sector_align) { - if(option_values.mode_decode) - return usage_error("ERROR: --sector-align only allowed for encoding\n"); - if(0 != option_values.skip_specification) - return usage_error("ERROR: --sector-align not allowed with --skip\n"); - if(0 != option_values.until_specification) - return usage_error("ERROR: --sector-align not allowed with --until\n"); - if(0 != option_values.cue_specification) - return usage_error("ERROR: --sector-align not allowed with --cue\n"); - if(option_values.format_channels >= 0 && option_values.format_channels != 2) - return usage_error("ERROR: --sector-align can only be done with stereo input\n"); - if(option_values.format_bps >= 0 && option_values.format_bps != 16) - return usage_error("ERROR: --sector-align can only be done with 16-bit samples\n"); - if(option_values.format_sample_rate >= 0 && option_values.format_sample_rate != 44100) - return usage_error("ERROR: --sector-align can only be done with a sample rate of 44100\n"); - } - if(option_values.replay_gain) { - if(option_values.force_to_stdout) - return usage_error("ERROR: --replay-gain not allowed with -c/--stdout\n"); - if(option_values.mode_decode) - return usage_error("ERROR: --replay-gain only allowed for encoding\n"); - if(option_values.format_channels > 2) - return usage_error("ERROR: --replay-gain can only be done with mono/stereo input\n"); - if(option_values.format_sample_rate >= 0 && !grabbag__replaygain_is_valid_sample_frequency(option_values.format_sample_rate)) - return usage_error("ERROR: invalid sample rate used with --replay-gain\n"); - /* - * We want to reserve padding space for the ReplayGain - * tags that we will set later, to avoid rewriting the - * whole file. - */ - if( - (option_values.padding >= 0 && option_values.padding < (int)GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED) || - (option_values.padding < 0 && FLAC_ENCODE__DEFAULT_PADDING < (int)GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED) - ) { - flac__utils_printf(stderr, 1, "NOTE: --replay-gain may leave a small PADDING block even with --no-padding\n"); - option_values.padding = GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; - } - else { - option_values.padding += GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; - } - } - if(option_values.num_files > 1 && option_values.cmdline_forced_outfilename) { - return usage_error("ERROR: -o/--output-name cannot be used with multiple files\n"); - } - if(option_values.cmdline_forced_outfilename && option_values.output_prefix) { - return usage_error("ERROR: --output-prefix conflicts with -o/--output-name\n"); - } - if(!option_values.mode_decode && 0 != option_values.cuesheet_filename && option_values.num_files > 1) { - return usage_error("ERROR: --cuesheet cannot be used when encoding multiple files\n"); - } - if(option_values.keep_foreign_metadata) { - /* we're not going to try and support the re-creation of broken WAVE files */ - if(option_values.ignore_chunk_sizes) - return usage_error("ERROR: using --keep-foreign-metadata cannot be used with --ignore-chunk-sizes\n"); - if(option_values.test_only) - return usage_error("ERROR: --keep-foreign-metadata is not allowed in test mode\n"); - if(option_values.analyze) - return usage_error("ERROR: --keep-foreign-metadata is not allowed in analyis mode\n"); - /*@@@@@@*/ - if(option_values.delete_input) - return usage_error("ERROR: using --delete-input-file with --keep-foreign-metadata has been disabled until more testing has been done.\n"); - flac__utils_printf(stderr, 1, "NOTE: --keep-foreign-metadata is a new feature; make sure to test the output file before deleting the original.\n"); - } - } - - flac__utils_printf(stderr, 2, "\n"); - flac__utils_printf(stderr, 2, "flac %s, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n", FLAC__VERSION_STRING); - flac__utils_printf(stderr, 2, "flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are\n"); - flac__utils_printf(stderr, 2, "welcome to redistribute it under certain conditions. Type `flac' for details.\n\n"); - - if(option_values.mode_decode) { - FLAC__bool first = true; - - if(option_values.num_files == 0) { - retval = decode_file("-"); - } - else { - unsigned i; - if(option_values.num_files > 1) - option_values.cmdline_forced_outfilename = 0; - for(i = 0, retval = 0; i < option_values.num_files; i++) { - if(0 == strcmp(option_values.filenames[i], "-") && !first) - continue; - retval |= decode_file(option_values.filenames[i]); - first = false; - } - } - } - else { /* encode */ - FLAC__bool first = true; - - if(option_values.ignore_chunk_sizes) - flac__utils_printf(stderr, 1, "INFO: Make sure you know what you're doing when using --ignore-chunk-sizes.\n Improper use can cause flac to encode non-audio data as audio.\n"); - - if(option_values.num_files == 0) { - retval = encode_file("-", first, true); - } - else { - unsigned i; - if(option_values.num_files > 1) - option_values.cmdline_forced_outfilename = 0; - for(i = 0, retval = 0; i < option_values.num_files; i++) { - if(0 == strcmp(option_values.filenames[i], "-") && !first) - continue; - retval |= encode_file(option_values.filenames[i], first, i == (option_values.num_files-1)); - first = false; - } - if(option_values.replay_gain && retval == 0) { - float album_gain, album_peak; - grabbag__replaygain_get_album(&album_gain, &album_peak); - for(i = 0; i < option_values.num_files; i++) { - const char *error, *outfilename = get_encoded_outfilename(option_values.filenames[i]); - if(0 == outfilename) { - flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", option_values.filenames[i]); - return 1; - } - if(0 == strcmp(option_values.filenames[i], "-")) { - FLAC__ASSERT(0); - /* double protection */ - flac__utils_printf(stderr, 1, "internal error\n"); - return 2; - } - if(0 != (error = grabbag__replaygain_store_to_file_album(outfilename, album_gain, album_peak, /*preserve_modtime=*/true))) { - flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain album tags (%s)\n", outfilename, error); - retval = 1; - } - } - } - } - } - - return retval; -} - -FLAC__bool init_options(void) -{ - option_values.show_help = false; - option_values.show_explain = false; - option_values.mode_decode = false; - option_values.verify = false; - option_values.treat_warnings_as_errors = false; - option_values.force_file_overwrite = false; - option_values.continue_through_decode_errors = false; - option_values.replaygain_synthesis_spec.apply = false; - option_values.replaygain_synthesis_spec.use_album_gain = true; - option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__HARD; - option_values.replaygain_synthesis_spec.noise_shaping = NOISE_SHAPING_LOW; - option_values.replaygain_synthesis_spec.preamp = 0.0; - option_values.lax = false; - option_values.test_only = false; - option_values.analyze = false; - option_values.use_ogg = false; - option_values.has_serial_number = false; - option_values.serial_number = 0; - option_values.force_to_stdout = false; - option_values.force_aiff_format = false; - option_values.force_raw_format = false; - option_values.delete_input = false; - option_values.keep_foreign_metadata = false; - option_values.replay_gain = false; - option_values.ignore_chunk_sizes = false; - option_values.sector_align = false; - option_values.utf8_convert = true; - option_values.cmdline_forced_outfilename = 0; - option_values.output_prefix = 0; - option_values.aopts.do_residual_text = false; - option_values.aopts.do_residual_gnuplot = false; - option_values.padding = -1; - option_values.num_compression_settings = 1; - option_values.compression_settings[0].type = CST_COMPRESSION_LEVEL; - option_values.compression_settings[0].value.t_unsigned = 5; - option_values.skip_specification = 0; - option_values.until_specification = 0; - option_values.cue_specification = 0; - option_values.format_is_big_endian = -1; - option_values.format_is_unsigned_samples = -1; - option_values.format_channels = -1; - option_values.format_bps = -1; - option_values.format_sample_rate = -1; - option_values.format_input_size = (off_t)(-1); - option_values.requested_seek_points[0] = '\0'; - option_values.num_requested_seek_points = -1; - option_values.cuesheet_filename = 0; - option_values.cued_seekpoints = true; - option_values.channel_map_none = false; - - option_values.num_files = 0; - option_values.filenames = 0; - - if(0 == (option_values.vorbis_comment = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT))) - return false; - option_values.num_pictures = 0; - - option_values.debug.disable_constant_subframes = false; - option_values.debug.disable_fixed_subframes = false; - option_values.debug.disable_verbatim_subframes = false; - option_values.debug.do_md5 = true; - - return true; -} - -int parse_options(int argc, char *argv[]) -{ - int short_option; - int option_index = 1; - FLAC__bool had_error = false; - const char *short_opts = "0123456789aA:b:cdefFhHl:mMo:pP:q:r:sS:tT:vVw"; - - while ((short_option = getopt_long(argc, argv, short_opts, long_options_, &option_index)) != -1) { - switch (short_option) { - case 0: /* long option with no equivalent short option */ - had_error |= (parse_option(short_option, long_options_[option_index].name, optarg) != 0); - break; - case '?': - case ':': - had_error = true; - break; - default: /* short option */ - had_error |= (parse_option(short_option, 0, optarg) != 0); - break; - } - } - - if(had_error) { - return 1; - } - - FLAC__ASSERT(optind <= argc); - - option_values.num_files = argc - optind; - - if(option_values.num_files > 0) { - unsigned i = 0; - if(0 == (option_values.filenames = (char**)malloc(sizeof(char*) * option_values.num_files))) - die("out of memory allocating space for file names list"); - while(optind < argc) - option_values.filenames[i++] = local_strdup(argv[optind++]); - } - - return 0; -} - -int parse_option(int short_option, const char *long_option, const char *option_argument) -{ - const char *violation; - char *p; - int i; - - if(short_option == 0) { - FLAC__ASSERT(0 != long_option); - if(0 == strcmp(long_option, "totally-silent")) { - flac__utils_verbosity_ = 0; - } - else if(0 == strcmp(long_option, "delete-input-file")) { - option_values.delete_input = true; - } - else if(0 == strcmp(long_option, "keep-foreign-metadata")) { - option_values.keep_foreign_metadata = true; - } - else if(0 == strcmp(long_option, "output-prefix")) { - FLAC__ASSERT(0 != option_argument); - option_values.output_prefix = option_argument; - } - else if(0 == strcmp(long_option, "skip")) { - FLAC__ASSERT(0 != option_argument); - option_values.skip_specification = option_argument; - } - else if(0 == strcmp(long_option, "until")) { - FLAC__ASSERT(0 != option_argument); - option_values.until_specification = option_argument; - } - else if(0 == strcmp(long_option, "input-size")) { - FLAC__ASSERT(0 != option_argument); - { - char *end; -#ifdef _MSC_VER - FLAC__int64 i; - i = local__strtoll(option_argument, &end); -#else - long long i; - i = strtoll(option_argument, &end, 10); -#endif - if(0 == strlen(option_argument) || *end) - return usage_error("ERROR: --%s must be a number\n", long_option); - option_values.format_input_size = (off_t)i; - if(option_values.format_input_size != i) /* check if off_t is smaller than long long */ - return usage_error("ERROR: --%s too large; this build of flac does not support filesizes over 2GB\n", long_option); - if(option_values.format_input_size <= 0) - return usage_error("ERROR: --%s must be > 0\n", long_option); - } - } - else if(0 == strcmp(long_option, "cue")) { - FLAC__ASSERT(0 != option_argument); - option_values.cue_specification = option_argument; - } - else if(0 == strcmp(long_option, "apply-replaygain-which-is-not-lossless")) { - option_values.replaygain_synthesis_spec.apply = true; - if (0 != option_argument) { - char *p; - option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__NONE; - option_values.replaygain_synthesis_spec.noise_shaping = NOISE_SHAPING_NONE; - option_values.replaygain_synthesis_spec.preamp = strtod(option_argument, &p); - for ( ; *p; p++) { - if (*p == 'a') - option_values.replaygain_synthesis_spec.use_album_gain = true; - else if (*p == 't') - option_values.replaygain_synthesis_spec.use_album_gain = false; - else if (*p == 'l') - option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__PEAK; - else if (*p == 'L') - option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__HARD; - else if (*p == 'n' && p[1] >= '0' && p[1] <= '3') { - option_values.replaygain_synthesis_spec.noise_shaping = p[1] - '0'; - p++; - } - else - return usage_error("ERROR: bad specification string \"%s\" for --%s\n", option_argument, long_option); - } - } - } - else if(0 == strcmp(long_option, "channel-map")) { - if (0 == option_argument || strcmp(option_argument, "none")) - return usage_error("ERROR: only --channel-map=none currently supported\n"); - option_values.channel_map_none = true; - } - else if(0 == strcmp(long_option, "cuesheet")) { - FLAC__ASSERT(0 != option_argument); - option_values.cuesheet_filename = option_argument; - } - else if(0 == strcmp(long_option, "picture")) { - const unsigned max_pictures = sizeof(option_values.pictures)/sizeof(option_values.pictures[0]); - FLAC__ASSERT(0 != option_argument); - if(option_values.num_pictures >= max_pictures) - return usage_error("ERROR: too many --picture arguments, only %u allowed\n", max_pictures); - if(0 == (option_values.pictures[option_values.num_pictures] = grabbag__picture_parse_specification(option_argument, &violation))) - return usage_error("ERROR: (--picture) %s\n", violation); - option_values.num_pictures++; - } - else if(0 == strcmp(long_option, "tag-from-file")) { - FLAC__ASSERT(0 != option_argument); - if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/true, /*raw=*/!option_values.utf8_convert, &violation)) - return usage_error("ERROR: (--tag-from-file) %s\n", violation); - } - else if(0 == strcmp(long_option, "no-cued-seekpoints")) { - option_values.cued_seekpoints = false; - } - else if(0 == strcmp(long_option, "force-aiff-format")) { - option_values.force_aiff_format = true; - } - else if(0 == strcmp(long_option, "force-raw-format")) { - option_values.force_raw_format = true; - } - else if(0 == strcmp(long_option, "lax")) { - option_values.lax = true; - } - else if(0 == strcmp(long_option, "replay-gain")) { - option_values.replay_gain = true; - } - else if(0 == strcmp(long_option, "ignore-chunk-sizes")) { - option_values.ignore_chunk_sizes = true; - } - else if(0 == strcmp(long_option, "sector-align")) { - option_values.sector_align = true; - } -#if FLAC__HAS_OGG - else if(0 == strcmp(long_option, "ogg")) { - option_values.use_ogg = true; - } - else if(0 == strcmp(long_option, "serial-number")) { - option_values.has_serial_number = true; - option_values.serial_number = atol(option_argument); - } -#endif - else if(0 == strcmp(long_option, "endian")) { - FLAC__ASSERT(0 != option_argument); - if(0 == strncmp(option_argument, "big", strlen(option_argument))) - option_values.format_is_big_endian = true; - else if(0 == strncmp(option_argument, "little", strlen(option_argument))) - option_values.format_is_big_endian = false; - else - return usage_error("ERROR: argument to --endian must be \"big\" or \"little\"\n"); - } - else if(0 == strcmp(long_option, "channels")) { - FLAC__ASSERT(0 != option_argument); - option_values.format_channels = atoi(option_argument); - } - else if(0 == strcmp(long_option, "bps")) { - FLAC__ASSERT(0 != option_argument); - option_values.format_bps = atoi(option_argument); - } - else if(0 == strcmp(long_option, "sample-rate")) { - FLAC__ASSERT(0 != option_argument); - option_values.format_sample_rate = atoi(option_argument); - } - else if(0 == strcmp(long_option, "sign")) { - FLAC__ASSERT(0 != option_argument); - if(0 == strncmp(option_argument, "signed", strlen(option_argument))) - option_values.format_is_unsigned_samples = false; - else if(0 == strncmp(option_argument, "unsigned", strlen(option_argument))) - option_values.format_is_unsigned_samples = true; - else - return usage_error("ERROR: argument to --sign must be \"signed\" or \"unsigned\"\n"); - } - else if(0 == strcmp(long_option, "residual-gnuplot")) { - option_values.aopts.do_residual_gnuplot = true; - } - else if(0 == strcmp(long_option, "residual-text")) { - option_values.aopts.do_residual_text = true; - } - /* - * negatives - */ - else if(0 == strcmp(long_option, "no-decode-through-errors")) { - option_values.continue_through_decode_errors = false; - } - else if(0 == strcmp(long_option, "no-silent")) { - flac__utils_verbosity_ = 2; - } - else if(0 == strcmp(long_option, "no-force")) { - option_values.force_file_overwrite = false; - } - else if(0 == strcmp(long_option, "no-seektable")) { - option_values.num_requested_seek_points = 0; - option_values.requested_seek_points[0] = '\0'; - } - else if(0 == strcmp(long_option, "no-delete-input-file")) { - option_values.delete_input = false; - } - else if(0 == strcmp(long_option, "no-keep-foreign-metadata")) { - option_values.keep_foreign_metadata = false; - } - else if(0 == strcmp(long_option, "no-replay-gain")) { - option_values.replay_gain = false; - } - else if(0 == strcmp(long_option, "no-ignore-chunk-sizes")) { - option_values.ignore_chunk_sizes = false; - } - else if(0 == strcmp(long_option, "no-sector-align")) { - option_values.sector_align = false; - } - else if(0 == strcmp(long_option, "no-utf8-convert")) { - option_values.utf8_convert = false; - } - else if(0 == strcmp(long_option, "no-lax")) { - option_values.lax = false; - } -#if FLAC__HAS_OGG - else if(0 == strcmp(long_option, "no-ogg")) { - option_values.use_ogg = false; - } -#endif - else if(0 == strcmp(long_option, "no-exhaustive-model-search")) { - add_compression_setting_bool(CST_DO_EXHAUSTIVE_MODEL_SEARCH, false); - } - else if(0 == strcmp(long_option, "no-mid-side")) { - add_compression_setting_bool(CST_DO_MID_SIDE, false); - add_compression_setting_bool(CST_LOOSE_MID_SIDE, false); - } - else if(0 == strcmp(long_option, "no-adaptive-mid-side")) { - add_compression_setting_bool(CST_DO_MID_SIDE, false); - add_compression_setting_bool(CST_LOOSE_MID_SIDE, false); - } - else if(0 == strcmp(long_option, "no-qlp-coeff-prec-search")) { - add_compression_setting_bool(CST_DO_QLP_COEFF_PREC_SEARCH, false); - } - else if(0 == strcmp(long_option, "no-padding")) { - option_values.padding = 0; - } - else if(0 == strcmp(long_option, "no-verify")) { - option_values.verify = false; - } - else if(0 == strcmp(long_option, "no-warnings-as-errors")) { - option_values.treat_warnings_as_errors = false; - } - else if(0 == strcmp(long_option, "no-residual-gnuplot")) { - option_values.aopts.do_residual_gnuplot = false; - } - else if(0 == strcmp(long_option, "no-residual-text")) { - option_values.aopts.do_residual_text = false; - } - else if(0 == strcmp(long_option, "disable-constant-subframes")) { - option_values.debug.disable_constant_subframes = true; - } - else if(0 == strcmp(long_option, "disable-fixed-subframes")) { - option_values.debug.disable_fixed_subframes = true; - } - else if(0 == strcmp(long_option, "disable-verbatim-subframes")) { - option_values.debug.disable_verbatim_subframes = true; - } - else if(0 == strcmp(long_option, "no-md5-sum")) { - option_values.debug.do_md5 = false; - } - } - else { - switch(short_option) { - case 'h': - option_values.show_help = true; - break; - case 'H': - option_values.show_explain = true; - break; - case 'v': - option_values.show_version = true; - break; - case 'd': - option_values.mode_decode = true; - break; - case 'a': - option_values.mode_decode = true; - option_values.analyze = true; - break; - case 't': - option_values.mode_decode = true; - option_values.test_only = true; - break; - case 'c': - option_values.force_to_stdout = true; - break; - case 's': - flac__utils_verbosity_ = 1; - break; - case 'f': - option_values.force_file_overwrite = true; - break; - case 'o': - FLAC__ASSERT(0 != option_argument); - option_values.cmdline_forced_outfilename = option_argument; - break; - case 'F': - option_values.continue_through_decode_errors = true; - break; - case 'T': - FLAC__ASSERT(0 != option_argument); - if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/false, /*raw=*/!option_values.utf8_convert, &violation)) - return usage_error("ERROR: (-T/--tag) %s\n", violation); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - add_compression_setting_unsigned(CST_COMPRESSION_LEVEL, short_option-'0'); - break; - case '9': - return usage_error("ERROR: compression level '9' is reserved\n"); - case 'V': - option_values.verify = true; - break; - case 'w': - option_values.treat_warnings_as_errors = true; - break; - case 'S': - FLAC__ASSERT(0 != option_argument); - if(0 == strcmp(option_argument, "-")) { - option_values.num_requested_seek_points = 0; - option_values.requested_seek_points[0] = '\0'; - } - else { - if(option_values.num_requested_seek_points < 0) - option_values.num_requested_seek_points = 0; - option_values.num_requested_seek_points++; - if(strlen(option_values.requested_seek_points)+strlen(option_argument)+2 >= sizeof(option_values.requested_seek_points)) { - return usage_error("ERROR: too many seekpoints requested\n"); - } - else { - strcat(option_values.requested_seek_points, option_argument); - strcat(option_values.requested_seek_points, ";"); - } - } - break; - case 'P': - FLAC__ASSERT(0 != option_argument); - option_values.padding = atoi(option_argument); - if(option_values.padding < 0) - return usage_error("ERROR: argument to -%c must be >= 0; for no padding use -%c-\n", short_option, short_option); - break; - case 'b': - FLAC__ASSERT(0 != option_argument); - i = atoi(option_argument); - if((i < (int)FLAC__MIN_BLOCK_SIZE || i > (int)FLAC__MAX_BLOCK_SIZE)) - return usage_error("ERROR: invalid blocksize (-%c) '%d', must be >= %u and <= %u\n", short_option, i, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); - add_compression_setting_unsigned(CST_BLOCKSIZE, (unsigned)i); - break; - case 'e': - add_compression_setting_bool(CST_DO_EXHAUSTIVE_MODEL_SEARCH, true); - break; - case 'E': - add_compression_setting_bool(CST_DO_ESCAPE_CODING, true); - break; - case 'l': - FLAC__ASSERT(0 != option_argument); - i = atoi(option_argument); - if((i < 0 || i > (int)FLAC__MAX_LPC_ORDER)) - return usage_error("ERROR: invalid LPC order (-%c) '%d', must be >= %u and <= %u\n", short_option, i, 0, FLAC__MAX_LPC_ORDER); - add_compression_setting_unsigned(CST_MAX_LPC_ORDER, (unsigned)i); - break; - case 'A': - FLAC__ASSERT(0 != option_argument); - add_compression_setting_string(CST_APODIZATION, option_argument); - break; - case 'm': - add_compression_setting_bool(CST_DO_MID_SIDE, true); - add_compression_setting_bool(CST_LOOSE_MID_SIDE, false); - break; - case 'M': - add_compression_setting_bool(CST_DO_MID_SIDE, true); - add_compression_setting_bool(CST_LOOSE_MID_SIDE, true); - break; - case 'p': - add_compression_setting_bool(CST_DO_QLP_COEFF_PREC_SEARCH, true); - break; - case 'q': - FLAC__ASSERT(0 != option_argument); - i = atoi(option_argument); - if(i < 0 || (i > 0 && (i < (int)FLAC__MIN_QLP_COEFF_PRECISION || i > (int)FLAC__MAX_QLP_COEFF_PRECISION))) - return usage_error("ERROR: invalid value '%d' for qlp coeff precision (-%c), must be 0 or between %u and %u, inclusive\n", i, short_option, FLAC__MIN_QLP_COEFF_PRECISION, FLAC__MAX_QLP_COEFF_PRECISION); - add_compression_setting_unsigned(CST_QLP_COEFF_PRECISION, (unsigned)i); - break; - case 'r': - FLAC__ASSERT(0 != option_argument); - p = strchr(option_argument, ','); - if(0 == p) { - add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, 0); - i = atoi(option_argument); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); - add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, (unsigned)i); - } - else { - i = atoi(option_argument); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for min residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); - add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, (unsigned)i); - i = atoi(++p); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for max residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); - add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, (unsigned)i); - } - break; - case 'R': - i = atoi(option_argument); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for Rice parameter search distance (-%c), must be >= 0\n", i, short_option); - add_compression_setting_unsigned(CST_RICE_PARAMETER_SEARCH_DIST, (unsigned)i); - break; - default: - FLAC__ASSERT(0); - } - } - - return 0; -} - -void free_options(void) -{ - unsigned i; - if(0 != option_values.filenames) { - for(i = 0; i < option_values.num_files; i++) { - if(0 != option_values.filenames[i]) - free(option_values.filenames[i]); - } - free(option_values.filenames); - } - if(0 != option_values.vorbis_comment) - FLAC__metadata_object_delete(option_values.vorbis_comment); - for(i = 0; i < option_values.num_pictures; i++) - FLAC__metadata_object_delete(option_values.pictures[i]); -} - -void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool value) -{ - if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) - die("too many compression settings"); - option_values.compression_settings[option_values.num_compression_settings].type = type; - option_values.compression_settings[option_values.num_compression_settings].value.t_bool = value; - option_values.num_compression_settings++; -} - -void add_compression_setting_string(compression_setting_type_t type, const char *value) -{ - if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) - die("too many compression settings"); - option_values.compression_settings[option_values.num_compression_settings].type = type; - option_values.compression_settings[option_values.num_compression_settings].value.t_string = value; - option_values.num_compression_settings++; -} - -void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value) -{ - if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) - die("too many compression settings"); - option_values.compression_settings[option_values.num_compression_settings].type = type; - option_values.compression_settings[option_values.num_compression_settings].value.t_unsigned = value; - option_values.num_compression_settings++; -} - -int usage_error(const char *message, ...) -{ - if(flac__utils_verbosity_ >= 1) { - va_list args; - - FLAC__ASSERT(0 != message); - - va_start(args, message); - - (void) vfprintf(stderr, message, args); - - va_end(args); - - printf("Type \"flac\" for a usage summary or \"flac --help\" for all options\n"); - } - - return 1; -} - -void show_version(void) -{ - printf("flac %s\n", FLAC__VERSION_STRING); -} - -static void usage_header(void) -{ - printf("===============================================================================\n"); - printf("flac - Command-line FLAC encoder/decoder version %s\n", FLAC__VERSION_STRING); - printf("Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n"); - printf("\n"); - printf("This program is free software; you can redistribute it and/or\n"); - printf("modify it under the terms of the GNU General Public License\n"); - printf("as published by the Free Software Foundation; either version 2\n"); - printf("of the License, or (at your option) any later version.\n"); - printf("\n"); - printf("This program is distributed in the hope that it will be useful,\n"); - printf("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); - printf("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); - printf("GNU General Public License for more details.\n"); - printf("\n"); - printf("You should have received a copy of the GNU General Public License\n"); - printf("along with this program; if not, write to the Free Software\n"); - printf("Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"); - printf("===============================================================================\n"); -} - -static void usage_summary(void) -{ - printf("Usage:\n"); - printf("\n"); - printf(" Encoding: flac [] [] [INPUTFILE [...]]\n"); - printf(" Decoding: flac -d [] [] [FLACFILE [...]]\n"); - printf(" Testing: flac -t [] [FLACFILE [...]]\n"); - printf("Analyzing: flac -a [] [] [FLACFILE [...]]\n"); - printf("\n"); -} - -void short_usage(void) -{ - usage_header(); - printf("\n"); - printf("This is the short help; for all options use 'flac --help'; for even more\n"); - printf("instructions use 'flac --explain'\n"); - printf("\n"); - printf("To encode:\n"); - printf(" flac [-#] [INPUTFILE [...]]\n"); - printf("\n"); - printf(" -# is -0 (fastest compression) to -8 (highest compression); -5 is the default\n"); - printf("\n"); - printf("To decode:\n"); - printf(" flac -d [INPUTFILE [...]]\n"); - printf("\n"); - printf("To test:\n"); - printf(" flac -t [INPUTFILE [...]]\n"); -} - -void show_help(void) -{ - usage_header(); - usage_summary(); - printf("general options:\n"); - printf(" -v, --version Show the flac version number\n"); - printf(" -h, --help Show this screen\n"); - printf(" -H, --explain Show detailed explanation of usage and options\n"); - printf(" -d, --decode Decode (the default behavior is to encode)\n"); - printf(" -t, --test Same as -d except no decoded file is written\n"); - printf(" -a, --analyze Same as -d except an analysis file is written\n"); - printf(" -c, --stdout Write output to stdout\n"); - printf(" -s, --silent Do not write runtime encode/decode statistics\n"); - printf(" --totally-silent Do not print anything, including errors\n"); - printf(" --no-utf8-convert Do not convert tags from local charset to UTF-8\n"); - printf(" -w, --warnings-as-errors Treat all warnings as errors\n"); - printf(" -f, --force Force overwriting of output files\n"); - printf(" -o, --output-name=FILENAME Force the output file name\n"); - printf(" --output-prefix=STRING Prepend STRING to output names\n"); - printf(" --delete-input-file Deletes after a successful encode/decode\n"); - printf(" --keep-foreign-metadata Save/restore WAVE or AIFF non-audio chunks\n"); - printf(" --skip={#|mm:ss.ss} Skip the given initial samples for each input\n"); - printf(" --until={#|[+|-]mm:ss.ss} Stop at the given sample for each input file\n"); -#if FLAC__HAS_OGG - printf(" --ogg Use Ogg as transport layer\n"); - printf(" --serial-number Serial number to use for the FLAC stream\n"); -#endif - printf("analysis options:\n"); - printf(" --residual-text Include residual signal in text output\n"); - printf(" --residual-gnuplot Generate gnuplot files of residual distribution\n"); - printf("decoding options:\n"); - printf(" -F, --decode-through-errors Continue decoding through stream errors\n"); - printf(" --cue=[#.#][-[#.#]] Set the beginning and ending cuepoints to decode\n"); - printf("encoding options:\n"); - printf(" -V, --verify Verify a correct encoding\n"); - printf(" --lax Allow encoder to generate non-Subset files\n"); -#if 0 /*@@@ currently undocumented */ - printf(" --ignore-chunk-sizes Ignore data chunk sizes in WAVE/AIFF files\n"); -#endif - printf(" --sector-align Align multiple files on sector boundaries\n"); - printf(" --replay-gain Calculate ReplayGain & store in FLAC tags\n"); - printf(" --cuesheet=FILENAME Import cuesheet and store in CUESHEET block\n"); - printf(" --picture=SPECIFICATION Import picture and store in PICTURE block\n"); - printf(" -T, --tag=FIELD=VALUE Add a FLAC tag; may appear multiple times\n"); - printf(" --tag-from-file=FIELD=FILENAME Like --tag but gets value from file\n"); - printf(" -S, --seekpoint={#|X|#x|#s} Add seek point(s)\n"); - printf(" -P, --padding=# Write a PADDING block of length #\n"); - printf(" -0, --compression-level-0, --fast Synonymous with -l 0 -b 1152 -r 3\n"); - printf(" -1, --compression-level-1 Synonymous with -l 0 -b 1152 -M -r 3\n"); - printf(" -2, --compression-level-2 Synonymous with -l 0 -b 1152 -m -r 3\n"); - printf(" -3, --compression-level-3 Synonymous with -l 6 -b 4096 -r 4\n"); - printf(" -4, --compression-level-4 Synonymous with -l 8 -b 4096 -M -r 4\n"); - printf(" -5, --compression-level-5 Synonymous with -l 8 -b 4096 -m -r 5\n"); - printf(" -6, --compression-level-6 Synonymous with -l 8 -b 4096 -m -r 6\n"); - printf(" -7, --compression-level-7 Synonymous with -l 8 -b 4096 -m -e -r 6\n"); - printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -e -r 6\n"); - printf(" -b, --blocksize=# Specify blocksize in samples\n"); - printf(" -m, --mid-side Try mid-side coding for each frame\n"); - printf(" -M, --adaptive-mid-side Adaptive mid-side coding for all frames\n"); - printf(" -e, --exhaustive-model-search Do exhaustive model search (expensive!)\n"); - printf(" -A, --apodization=\"function\" Window audio data with given the function\n"); - printf(" -l, --max-lpc-order=# Max LPC order; 0 => only fixed predictors\n"); - printf(" -p, --qlp-coeff-precision-search Exhaustively search LP coeff quantization\n"); - printf(" -q, --qlp-coeff-precision=# Specify precision in bits\n"); - printf(" -r, --rice-partition-order=[#,]# Set [min,]max residual partition order\n"); - printf("format options:\n"); - printf(" --endian={big|little} Set byte order for samples\n"); - printf(" --channels=# Number of channels\n"); - printf(" --bps=# Number of bits per sample\n"); - printf(" --sample-rate=# Sample rate in Hz\n"); - printf(" --sign={signed|unsigned} Sign of samples\n"); - printf(" --input-size=# Size of the raw input in bytes\n"); - printf(" --force-aiff-format Force decoding to AIFF format\n"); - printf(" --force-raw-format Treat input or output as raw samples\n"); - printf("negative options:\n"); - printf(" --no-adaptive-mid-side\n"); - printf(" --no-decode-through-errors\n"); - printf(" --no-delete-input-file\n"); - printf(" --no-keep-foreign-metadata\n"); - printf(" --no-exhaustive-model-search\n"); - printf(" --no-lax\n"); - printf(" --no-mid-side\n"); -#if FLAC__HAS_OGG - printf(" --no-ogg\n"); -#endif - printf(" --no-padding\n"); - printf(" --no-qlp-coeff-prec-search\n"); - printf(" --no-replay-gain\n"); - printf(" --no-residual-gnuplot\n"); - printf(" --no-residual-text\n"); -#if 0 /*@@@ currently undocumented */ - printf(" --no-ignore-chunk-sizes\n"); -#endif - printf(" --no-sector-align\n"); - printf(" --no-seektable\n"); - printf(" --no-silent\n"); - printf(" --no-force\n"); - printf(" --no-verify\n"); - printf(" --no-warnings-as-errors\n"); -} - -void show_explain(void) -{ - usage_header(); - usage_summary(); - printf("For encoding:\n"); - printf(" The input file(s) may be a PCM WAVE file, AIFF (or uncompressed AIFF-C)\n"); - printf(" file, or raw samples.\n"); - printf(" The output file(s) will be in native FLAC or Ogg FLAC format\n"); - printf("For decoding, the reverse is true.\n"); - printf("\n"); - printf("A single INPUTFILE may be - for stdin. No INPUTFILE implies stdin. Use of\n"); - printf("stdin implies -c (write to stdout). Normally you should use:\n"); - printf(" flac [options] -o outfilename or flac -d [options] -o outfilename\n"); - printf("instead of:\n"); - printf(" flac [options] > outfilename or flac -d [options] > outfilename\n"); - printf("since the former allows flac to seek backwards to write the STREAMINFO or\n"); - printf("WAVE/AIFF header contents when necessary.\n"); - printf("\n"); - printf("flac checks for the presence of a AIFF/WAVE header to decide whether or not to\n"); - printf("treat an input file as AIFF/WAVE format or raw samples. If any input file is\n"); - printf("raw you must specify the format options {-fb|fl} -fc -fp and -fs, which will\n"); - printf("apply to all raw files. You can force AIFF/WAVE files to be treated as raw\n"); - printf("files using -fr.\n"); - printf("\n"); - printf("general options:\n"); - printf(" -v, --version Show the flac version number\n"); - printf(" -h, --help Show basic usage a list of all options\n"); - printf(" -H, --explain Show this screen\n"); - printf(" -d, --decode Decode (the default behavior is to encode)\n"); - printf(" -t, --test Same as -d except no decoded file is written\n"); - printf(" -a, --analyze Same as -d except an analysis file is written\n"); - printf(" -c, --stdout Write output to stdout\n"); - printf(" -s, --silent Do not write runtime encode/decode statistics\n"); - printf(" --totally-silent Do not print anything of any kind, including\n"); - printf(" warnings or errors. The exit code will be the\n"); - printf(" only way to determine successful completion.\n"); - printf(" --no-utf8-convert Do not convert tags from local charset to UTF-8.\n"); - printf(" This is useful for scripts, and setting tags in\n"); - printf(" situations where the locale is wrong. This\n"); - printf(" option must appear before any tag options!\n"); - printf(" -w, --warnings-as-errors Treat all warnings as errors\n"); - printf(" -f, --force Force overwriting of output files\n"); - printf(" -o, --output-name=FILENAME Force the output file name; usually flac just\n"); - printf(" changes the extension. May only be used when\n"); - printf(" encoding a single file. May not be used in\n"); - printf(" conjunction with --output-prefix.\n"); - printf(" --output-prefix=STRING Prefix each output file name with the given\n"); - printf(" STRING. This can be useful for encoding or\n"); - printf(" decoding files to a different directory. Make\n"); - printf(" sure if your STRING is a path name that it ends\n"); - printf(" with a '/' slash.\n"); - printf(" --delete-input-file Automatically delete the input file after a\n"); - printf(" successful encode or decode. If there was an\n"); - printf(" error (including a verify error) the input file\n"); - printf(" is left intact.\n"); - printf(" --keep-foreign-metadata If encoding, save WAVE or AIFF non-audio chunks\n"); - printf(" in FLAC metadata. If decoding, restore any saved\n"); - printf(" non-audio chunks from FLAC metadata when writing\n"); - printf(" the decoded file. Foreign metadata cannot be\n"); - printf(" transcoded, e.g. WAVE chunks saved in a FLAC file\n"); - printf(" cannot be restored when decoding to AIFF. Input\n"); - printf(" and output must be regular files, not stdin/out.\n"); - printf(" --skip={#|mm:ss.ss} Skip the first # samples of each input file; can\n"); - printf(" be used both for encoding and decoding. The\n"); - printf(" alternative form mm:ss.ss can be used to specify\n"); - printf(" minutes, seconds, and fractions of a second.\n"); - printf(" --until={#|[+|-]mm:ss.ss} Stop at the given sample number for each input\n"); - printf(" file. The given sample number is not included\n"); - printf(" in the decoded output. The alternative form\n"); - printf(" mm:ss.ss can be used to specify minutes,\n"); - printf(" seconds, and fractions of a second. If a `+'\n"); - printf(" sign is at the beginning, the --until point is\n"); - printf(" relative to the --skip point. If a `-' sign is\n"); - printf(" at the beginning, the --until point is relative\n"); - printf(" to end of the audio.\n"); -#if FLAC__HAS_OGG - printf(" --ogg When encoding, generate Ogg FLAC output instead\n"); - printf(" of native FLAC. Ogg FLAC streams are FLAC\n"); - printf(" streams wrapped in an Ogg transport layer. The\n"); - printf(" resulting file should have an '.oga' extension\n"); - printf(" and will still be decodable by flac. When\n"); - printf(" decoding, force the input to be treated as\n"); - printf(" Ogg FLAC. This is useful when piping input\n"); - printf(" from stdin or when the filename does not end in\n"); - printf(" '.oga' or '.ogg'.\n"); - printf(" --serial-number Serial number to use for the FLAC stream. When\n"); - printf(" encoding and no serial number is given, flac\n"); - printf(" uses a random one. If encoding to multiple files\n"); - printf(" the serial number is incremented for each file.\n"); - printf(" When decoding and no number is given, flac uses\n"); - printf(" the serial number of the first page.\n"); -#endif - printf("analysis options:\n"); - printf(" --residual-text Include residual signal in text output. This\n"); - printf(" will make the file very big, much larger than\n"); - printf(" even the decoded file.\n"); - printf(" --residual-gnuplot Generate gnuplot files of residual distribution\n"); - printf(" of each subframe\n"); - printf("decoding options:\n"); - printf(" -F, --decode-through-errors By default flac stops decoding with an error\n"); - printf(" and removes the partially decoded file if it\n"); - printf(" encounters a bitstream error. With -F, errors\n"); - printf(" are still printed but flac will continue\n"); - printf(" decoding to completion. Note that errors may\n"); - printf(" cause the decoded audio to be missing some\n"); - printf(" samples or have silent sections.\n"); - printf(" --cue=[#.#][-[#.#]] Set the beginning and ending cuepoints to\n"); - printf(" decode. The optional first #.# is the track and\n"); - printf(" index point at which decoding will start; the\n"); - printf(" default is the beginning of the stream. The\n"); - printf(" optional second #.# is the track and index point\n"); - printf(" at which decoding will end; the default is the\n"); - printf(" end of the stream. If the cuepoint does not\n"); - printf(" exist, the closest one before it (for the start\n"); - printf(" point) or after it (for the end point) will be\n"); - printf(" used. The cuepoints are merely translated into\n"); - printf(" sample numbers then used as --skip and --until.\n"); - printf(" A CD track can always be cued by, for example,\n"); - printf(" --cue=9.1-10.1 for track 9, even if the CD has\n"); - printf(" no 10th track.\n"); - printf("encoding options:\n"); - printf(" -V, --verify Verify a correct encoding by decoding the\n"); - printf(" output in parallel and comparing to the\n"); - printf(" original\n"); - printf(" --lax Allow encoder to generate non-Subset files\n"); -#if 0 /*@@@ currently undocumented */ - printf(" --ignore-chunk-sizes Ignore data chunk sizes in WAVE/AIFF files;\n"); - printf(" useful when piping data from programs which\n"); - printf(" generate bogus data chunk sizes.\n"); -#endif - printf(" --sector-align Align encoding of multiple CD format WAVE files\n"); - printf(" on sector boundaries.\n"); - printf(" --replay-gain Calculate ReplayGain values and store them as\n"); - printf(" FLAC tags. Title gains/peaks will be computed\n"); - printf(" for each file, and an album gain/peak will be\n"); - printf(" computed for all files. All input files must\n"); - printf(" have the same resolution, sample rate, and\n"); - printf(" number of channels. The sample rate must be\n"); - printf(" one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1,\n"); - printf(" or 48 kHz. NOTE: this option may also leave a\n"); - printf(" few extra bytes in the PADDING block.\n"); - printf(" --cuesheet=FILENAME Import the given cuesheet file and store it in\n"); - printf(" a CUESHEET metadata block. This option may only\n"); - printf(" be used when encoding a single file. A\n"); - printf(" seekpoint will be added for each index point in\n"); - printf(" the cuesheet to the SEEKTABLE unless\n"); - printf(" --no-cued-seekpoints is specified.\n"); - printf(" --picture=SPECIFICATION Import a picture and store it in a PICTURE block.\n"); - printf(" More than one --picture command can be specified.\n"); - printf(" The SPECIFICATION can either be a simple filename\n"); - printf(" for the picture file, or a complete specification\n"); - printf(" whose parts are separated by | characters. Some\n"); - printf(" parts may be left empty to invoke default values.\n"); - printf(" Using a filename is shorthand for \"||||FILE\".\n"); - printf(" The SPECIFICATION format is:\n"); - printf(" [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE\n"); - printf(" TYPE is optional; it is a number from one of:\n"); - printf(" 0: Other\n"); - printf(" 1: 32x32 pixels 'file icon' (PNG only)\n"); - printf(" 2: Other file icon\n"); - printf(" 3: Cover (front)\n"); - printf(" 4: Cover (back)\n"); - printf(" 5: Leaflet page\n"); - printf(" 6: Media (e.g. label side of CD)\n"); - printf(" 7: Lead artist/lead performer/soloist\n"); - printf(" 8: Artist/performer\n"); - printf(" 9: Conductor\n"); - printf(" 10: Band/Orchestra\n"); - printf(" 11: Composer\n"); - printf(" 12: Lyricist/text writer\n"); - printf(" 13: Recording Location\n"); - printf(" 14: During recording\n"); - printf(" 15: During performance\n"); - printf(" 16: Movie/video screen capture\n"); - printf(" 17: A bright coloured fish\n"); - printf(" 18: Illustration\n"); - printf(" 19: Band/artist logotype\n"); - printf(" 20: Publisher/Studio logotype\n"); - printf(" The default is 3 (front cover). There may only be one picture each\n"); - printf(" of type 1 and 2 in a file.\n"); - printf(" MIME-TYPE is optional; if left blank, it will be detected from the\n"); - printf(" file. For best compatibility with players, use pictures with MIME\n"); - printf(" type image/jpeg or image/png. The MIME type can also be --> to\n"); - printf(" mean that FILE is actually a URL to an image, though this use is\n"); - printf(" discouraged.\n"); - printf(" DESCRIPTION is optional; the default is an empty string\n"); - printf(" The next part specfies the resolution and color information. If\n"); - printf(" the MIME-TYPE is image/jpeg, image/png, or image/gif, you can\n"); - printf(" usually leave this empty and they can be detected from the file.\n"); - printf(" Otherwise, you must specify the width in pixels, height in pixels,\n"); - printf(" and color depth in bits-per-pixel. If the image has indexed colors\n"); - printf(" you should also specify the number of colors used.\n"); - printf(" FILE is the path to the picture file to be imported, or the URL if\n"); - printf(" MIME type is -->\n"); - printf(" -T, --tag=FIELD=VALUE Add a FLAC tag. Make sure to quote the\n"); - printf(" comment if necessary. This option may appear\n"); - printf(" more than once to add several comments. NOTE:\n"); - printf(" all tags will be added to all encoded files.\n"); - printf(" --tag-from-file=FIELD=FILENAME Like --tag, except FILENAME is a file\n"); - printf(" whose contents will be read verbatim to set the\n"); - printf(" tag value. The contents will be converted to\n"); - printf(" UTF-8 from the local charset. This can be used\n"); - printf(" to store a cuesheet in a tag (e.g.\n"); - printf(" --tag-from-file=\"CUESHEET=image.cue\"). Do not\n"); - printf(" try to store binary data in tag fields! Use\n"); - printf(" APPLICATION blocks for that.\n"); - printf(" -S, --seekpoint={#|X|#x|#s} Include a point or points in a SEEKTABLE\n"); - printf(" # : a specific sample number for a seek point\n"); - printf(" X : a placeholder point (always goes at the end of the SEEKTABLE)\n"); - printf(" #x : # evenly spaced seekpoints, the first being at sample 0\n"); - printf(" #s : a seekpoint every # seconds; # does not have to be a whole number\n"); - printf(" You may use many -S options; the resulting SEEKTABLE will be the unique-\n"); - printf(" ified union of all such values.\n"); - printf(" With no -S options, flac defaults to '-S 10s'. Use -S- for no SEEKTABLE.\n"); - printf(" Note: -S #x and -S #s will not work if the encoder can't determine the\n"); - printf(" input size before starting.\n"); - printf(" Note: if you use -S # and # is >= samples in the input, there will be\n"); - printf(" either no seek point entered (if the input size is determinable\n"); - printf(" before encoding starts) or a placeholder point (if input size is not\n"); - printf(" determinable)\n"); - printf(" -P, --padding=# Tell the encoder to write a PADDING metadata\n"); - printf(" block of the given length (in bytes) after the\n"); - printf(" STREAMINFO block. This is useful if you plan\n"); - printf(" to tag the file later with an APPLICATION\n"); - printf(" block; instead of having to rewrite the entire\n"); - printf(" file later just to insert your block, you can\n"); - printf(" write directly over the PADDING block. Note\n"); - printf(" that the total length of the PADDING block will\n"); - printf(" be 4 bytes longer than the length given because\n"); - printf(" of the 4 metadata block header bytes. You can\n"); - printf(" force no PADDING block at all to be written with\n"); - printf(" --no-padding. The encoder writes a PADDING\n"); - printf(" block of 8192 bytes by default, or 65536 bytes\n"); - printf(" if the input audio is more than 20 minutes long.\n"); - printf(" -b, --blocksize=# Specify the blocksize in samples; the default is\n"); - printf(" 1152 for -l 0, else 4096; must be one of 192,\n"); - printf(" 576, 1152, 2304, 4608, 256, 512, 1024, 2048,\n"); - printf(" 4096 (and 8192 or 16384 if the sample rate is\n"); - printf(" >48kHz) for Subset streams.\n"); - printf(" -0, --compression-level-0, --fast Synonymous with -l 0 -b 1152 -r 3\n"); - printf(" -1, --compression-level-1 Synonymous with -l 0 -b 1152 -M -r 3\n"); - printf(" -2, --compression-level-2 Synonymous with -l 0 -b 1152 -m -r 3\n"); - printf(" -3, --compression-level-3 Synonymous with -l 6 -b 4096 -r 4\n"); - printf(" -4, --compression-level-4 Synonymous with -l 8 -b 4096 -M -r 4\n"); - printf(" -5, --compression-level-5 Synonymous with -l 8 -b 4096 -m -r 5\n"); - printf(" -5 is the default setting\n"); - printf(" -6, --compression-level-6 Synonymous with -l 8 -b 4096 -m -r 6\n"); - printf(" -7, --compression-level-7 Synonymous with -l 8 -b 4096 -m -e -r 6\n"); - printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -e -r 6\n"); - printf(" -m, --mid-side Try mid-side coding for each frame\n"); - printf(" (stereo only)\n"); - printf(" -M, --adaptive-mid-side Adaptive mid-side coding for all frames\n"); - printf(" (stereo only)\n"); - printf(" -e, --exhaustive-model-search Do exhaustive model search (expensive!)\n"); - printf(" -A, --apodization=\"function\" Window audio data with given the function.\n"); - printf(" The functions are: bartlett, bartlett_hann,\n"); - printf(" blackman, blackman_harris_4term_92db,\n"); - printf(" connes, flattop, gauss(STDDEV), hamming,\n"); - printf(" hann, kaiser_bessel, nuttall, rectangle,\n"); - printf(" triangle, tukey(P), welch. More than one\n"); - printf(" may be specified but encoding time is a\n"); - printf(" multiple of the number of functions since\n"); - printf(" they are each tried in turn. The encoder\n"); - printf(" chooses suitable defaults in the absence\n"); - printf(" of any -A options.\n"); - printf(" -l, --max-lpc-order=# Max LPC order; 0 => only fixed predictors.\n"); - printf(" Must be <= 12 for Subset streams if sample\n"); - printf(" rate is <=48kHz.\n"); - printf(" -p, --qlp-coeff-precision-search Do exhaustive search of LP coefficient\n"); - printf(" quantization (expensive!); overrides -q;\n"); - printf(" does nothing if using -l 0\n"); - printf(" -q, --qlp-coeff-precision=# Specify precision in bits of quantized\n"); - printf(" linear-predictor coefficients; 0 => let\n"); - printf(" encoder decide (the minimun is %u, the\n", FLAC__MIN_QLP_COEFF_PRECISION); - printf(" default is -q 0)\n"); - printf(" -r, --rice-partition-order=[#,]# Set [min,]max residual partition order\n"); - printf(" (# is 0..16; min defaults to 0; the\n"); - printf(" default is -r 0; above 4 doesn't usually\n"); - printf(" help much)\n"); - printf("format options:\n"); - printf(" --endian={big|little} Set byte order for samples\n"); - printf(" --channels=# Number of channels\n"); - printf(" --bps=# Number of bits per sample\n"); - printf(" --sample-rate=# Sample rate in Hz\n"); - printf(" --sign={signed|unsigned} Sign of samples (the default is signed)\n"); - printf(" --input-size=# Size of the raw input in bytes. If you are\n"); - printf(" encoding raw samples from stdin, you must set\n"); - printf(" this option in order to be able to use --skip,\n"); - printf(" --until, --cue-sheet, or other options that need\n"); - printf(" to know the size of the input beforehand. If\n"); - printf(" the size given is greater than what is found in\n"); - printf(" the input stream, the encoder will complain\n"); - printf(" about an unexpected end-of-file. If the size\n"); - printf(" given is less, samples will be truncated.\n"); - printf(" --force-aiff-format Force the decoder to output AIFF format. This\n"); - printf(" option is not needed if the output filename (as\n"); - printf(" set by -o) ends with .aif or .aiff; this option\n"); - printf(" has no effect when encoding since input AIFF is\n"); - printf(" auto-detected.\n"); - printf(" --force-raw-format Force input (when encoding) or output (when\n"); - printf(" decoding) to be treated as raw samples\n"); - printf("negative options:\n"); - printf(" --no-adaptive-mid-side\n"); - printf(" --no-decode-through-errors\n"); - printf(" --no-delete-input-file\n"); - printf(" --no-keep-foreign-metadata\n"); - printf(" --no-exhaustive-model-search\n"); - printf(" --no-lax\n"); - printf(" --no-mid-side\n"); -#if FLAC__HAS_OGG - printf(" --no-ogg\n"); -#endif - printf(" --no-padding\n"); - printf(" --no-qlp-coeff-prec-search\n"); - printf(" --no-residual-gnuplot\n"); - printf(" --no-residual-text\n"); -#if 0 /*@@@ currently undocumented */ - printf(" --no-ignore-chunk-sizes\n"); -#endif - printf(" --no-sector-align\n"); - printf(" --no-seektable\n"); - printf(" --no-silent\n"); - printf(" --no-force\n"); - printf(" --no-verify\n"); - printf(" --no-warnings-as-errors\n"); -} - -void format_mistake(const char *infilename, FileFormat wrong, FileFormat right) -{ - /* WATCHOUT: indexed by FileFormat */ - static const char * const ff[] = { "raw", "WAVE", "AIFF", "FLAC", "Ogg FLAC" }; - flac__utils_printf(stderr, 1, "WARNING: %s is not a %s file; treating as a %s file\n", infilename, ff[wrong], ff[right]); -} - -int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_last_file) -{ - FILE *encode_infile; - FLAC__byte lookahead[12]; - unsigned lookahead_length = 0; - FileFormat input_format = RAW; - FLAC__bool is_aifc = false; - int retval; - off_t infilesize; - encode_options_t common_options; - const char *outfilename = get_encoded_outfilename(infilename); /* the final name of the encoded file */ - /* internal_outfilename is the file we will actually write to; it will be a temporary name if infilename==outfilename */ - char *internal_outfilename = 0; /* NULL implies 'use outfilename' */ - - if(0 == outfilename) { - flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", infilename); - return 1; - } - - if(0 == strcmp(infilename, "-")) { - infilesize = (off_t)(-1); - encode_infile = grabbag__file_get_binary_stdin(); - } - else { - infilesize = grabbag__file_get_filesize(infilename); - if(0 == (encode_infile = fopen(infilename, "rb"))) { - flac__utils_printf(stderr, 1, "ERROR: can't open input file %s: %s\n", infilename, strerror(errno)); - return 1; - } - } - - if(!option_values.force_raw_format) { - /* first set format based on name */ - if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".wav")) - input_format = WAV; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".aif")) - input_format = AIF; - else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".aiff")) - input_format = AIF; - else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".flac")) - input_format = FLAC; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".oga")) - input_format = OGGFLAC; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".ogg")) - input_format = OGGFLAC; - - /* attempt to guess the file type based on the first 12 bytes */ - if((lookahead_length = fread(lookahead, 1, 12, encode_infile)) < 12) { - if(input_format != RAW) { - format_mistake(infilename, input_format, RAW); - if(option_values.treat_warnings_as_errors) { - conditional_fclose(encode_infile); - return 1; - } - } - input_format = RAW; - } - else { - if(!strncmp((const char *)lookahead, "ID3", 3)) { - flac__utils_printf(stderr, 1, "ERROR: input file %s has an ID3v2 tag\n", infilename); - return 1; - } - else if(!strncmp((const char *)lookahead, "RIFF", 4) && !strncmp((const char *)lookahead+8, "WAVE", 4)) - input_format = WAV; - else if(!strncmp((const char *)lookahead, "FORM", 4) && !strncmp((const char *)lookahead+8, "AIFF", 4)) - input_format = AIF; - else if(!strncmp((const char *)lookahead, "FORM", 4) && !strncmp((const char *)lookahead+8, "AIFC", 4)) { - input_format = AIF; - is_aifc = true; - } - else if(!memcmp(lookahead, FLAC__STREAM_SYNC_STRING, sizeof(FLAC__STREAM_SYNC_STRING))) - input_format = FLAC; - /* this could be made more accurate by looking at the first packet */ - else if(!memcmp(lookahead, "OggS", 4)) - input_format = OGGFLAC; - else { - if(input_format != RAW) { - format_mistake(infilename, input_format, RAW); - if(option_values.treat_warnings_as_errors) { - conditional_fclose(encode_infile); - return 1; - } - } - input_format = RAW; - } - } - } - - if(option_values.keep_foreign_metadata) { - if(encode_infile == stdin || option_values.force_to_stdout) { - conditional_fclose(encode_infile); - return usage_error("ERROR: --keep-foreign-metadata cannot be used when encoding from stdin or to stdout\n"); - } - if(input_format != WAV && input_format != AIF) { - conditional_fclose(encode_infile); - return usage_error("ERROR: --keep-foreign-metadata can only be used with WAVE or AIFF input\n"); - } - } - - /* - * Error if output file already exists (and -f not used). - * Use grabbag__file_get_filesize() as a cheap way to check. - */ - if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { - if(input_format == FLAC) { - /* need more detailed error message when re-flac'ing to avoid confusing the user */ - flac__utils_printf(stderr, 1, - "ERROR: output file %s already exists.\n\n" - "By default flac encodes files to FLAC format; if you meant to decode this file\n" - "from FLAC to something else, use -d. If you meant to re-encode this file from\n" - "FLAC to FLAC again, use -f to force writing to the same file, or -o to specify\n" - "a different output filename.\n", - outfilename - ); - } - else if(input_format == OGGFLAC) { - /* need more detailed error message when re-flac'ing to avoid confusing the user */ - flac__utils_printf(stderr, 1, - "ERROR: output file %s already exists.\n\n" - "By default 'flac -ogg' encodes files to Ogg FLAC format; if you meant to decode\n" - "this file from Ogg FLAC to something else, use -d. If you meant to re-encode\n" - "this file from Ogg FLAC to Ogg FLAC again, use -f to force writing to the same\n" - "file, or -o to specify a different output filename.\n", - outfilename - ); - } - else - flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to override\n", outfilename); - conditional_fclose(encode_infile); - return 1; - } - - if(option_values.format_input_size >= 0) { - if (input_format != RAW || infilesize >= 0) { - flac__utils_printf(stderr, 1, "ERROR: can only use --input-size when encoding raw samples from stdin\n"); - conditional_fclose(encode_infile); - return 1; - } - else { - infilesize = option_values.format_input_size; - } - } - - if(option_values.sector_align && (input_format == FLAC || input_format == OGGFLAC)) { - flac__utils_printf(stderr, 1, "ERROR: can't use --sector-align when the input file is FLAC or Ogg FLAC\n"); - conditional_fclose(encode_infile); - return 1; - } - if(option_values.sector_align && input_format == RAW && infilesize < 0) { - flac__utils_printf(stderr, 1, "ERROR: can't use --sector-align when the input size is unknown\n"); - conditional_fclose(encode_infile); - return 1; - } - - if(input_format == RAW) { - if(option_values.format_is_big_endian < 0 || option_values.format_is_unsigned_samples < 0 || option_values.format_channels < 0 || option_values.format_bps < 0 || option_values.format_sample_rate < 0) { - conditional_fclose(encode_infile); - return usage_error("ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate\n"); - } - } - - if(/*@@@@@@why no stdin?*/encode_infile == stdin || option_values.force_to_stdout) { - if(option_values.replay_gain) { - conditional_fclose(encode_infile); - return usage_error("ERROR: --replay-gain cannot be used when encoding to stdout\n"); - } - } - if(option_values.replay_gain && option_values.use_ogg) { - conditional_fclose(encode_infile); - return usage_error("ERROR: --replay-gain cannot be used when encoding to Ogg FLAC yet\n"); - } - - if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &common_options.skip_specification) || common_options.skip_specification.is_relative) { - conditional_fclose(encode_infile); - return usage_error("ERROR: invalid value for --skip\n"); - } - - if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &common_options.until_specification)) { /*@@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ - conditional_fclose(encode_infile); - return usage_error("ERROR: invalid value for --until\n"); - } - /* if there is no "--until" we want to default to "--until=-0" */ - if(0 == option_values.until_specification) - common_options.until_specification.is_relative = true; - - common_options.verify = option_values.verify; - common_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; -#if FLAC__HAS_OGG - common_options.use_ogg = option_values.use_ogg; - /* set a random serial number if one has not yet been specified */ - if(!option_values.has_serial_number) { - option_values.serial_number = rand(); - option_values.has_serial_number = true; - } - common_options.serial_number = option_values.serial_number++; -#endif - common_options.lax = option_values.lax; - common_options.padding = option_values.padding; - common_options.num_compression_settings = option_values.num_compression_settings; - FLAC__ASSERT(sizeof(common_options.compression_settings) >= sizeof(option_values.compression_settings)); - memcpy(common_options.compression_settings, option_values.compression_settings, sizeof(option_values.compression_settings)); - common_options.requested_seek_points = option_values.requested_seek_points; - common_options.num_requested_seek_points = option_values.num_requested_seek_points; - common_options.cuesheet_filename = option_values.cuesheet_filename; - common_options.continue_through_decode_errors = option_values.continue_through_decode_errors; - common_options.cued_seekpoints = option_values.cued_seekpoints; - common_options.channel_map_none = option_values.channel_map_none; - common_options.is_first_file = is_first_file; - common_options.is_last_file = is_last_file; - common_options.align_reservoir = align_reservoir; - common_options.align_reservoir_samples = &align_reservoir_samples; - common_options.replay_gain = option_values.replay_gain; - common_options.ignore_chunk_sizes = option_values.ignore_chunk_sizes; - common_options.sector_align = option_values.sector_align; - common_options.vorbis_comment = option_values.vorbis_comment; - FLAC__ASSERT(sizeof(common_options.pictures) >= sizeof(option_values.pictures)); - memcpy(common_options.pictures, option_values.pictures, sizeof(option_values.pictures)); - common_options.num_pictures = option_values.num_pictures; - common_options.debug.disable_constant_subframes = option_values.debug.disable_constant_subframes; - common_options.debug.disable_fixed_subframes = option_values.debug.disable_fixed_subframes; - common_options.debug.disable_verbatim_subframes = option_values.debug.disable_verbatim_subframes; - common_options.debug.do_md5 = option_values.debug.do_md5; - - /* if infilename and outfilename point to the same file, we need to write to a temporary file */ - if(encode_infile != stdin && grabbag__file_are_same(infilename, outfilename)) { - static const char *tmp_suffix = ".tmp,fl-ac+en'c"; - /*@@@@ still a remote possibility that a file with this filename exists */ - if(0 == (internal_outfilename = (char *)safe_malloc_add_3op_(strlen(outfilename), /*+*/strlen(tmp_suffix), /*+*/1))) { - flac__utils_printf(stderr, 1, "ERROR allocating memory for tempfile name\n"); - conditional_fclose(encode_infile); - return 1; - } - strcpy(internal_outfilename, outfilename); - strcat(internal_outfilename, tmp_suffix); - } - - if(input_format == RAW) { - raw_encode_options_t options; - - options.common = common_options; - options.is_big_endian = option_values.format_is_big_endian; - options.is_unsigned_samples = option_values.format_is_unsigned_samples; - options.channels = option_values.format_channels; - options.bps = option_values.format_bps; - options.sample_rate = option_values.format_sample_rate; - - retval = flac__encode_raw(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options); - } - else if(input_format == FLAC || input_format == OGGFLAC) { - flac_encode_options_t options; - - options.common = common_options; - - retval = flac__encode_flac(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options, input_format==OGGFLAC); - } - else { - wav_encode_options_t options; - - options.common = common_options; - options.foreign_metadata = 0; - - /* read foreign metadata if requested */ - if(option_values.keep_foreign_metadata) { - if(0 == (options.foreign_metadata = flac__foreign_metadata_new(input_format==AIF? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) { - flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n"); - conditional_fclose(encode_infile); - return 1; - } - } - - if(input_format == AIF) - retval = flac__encode_aif(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options, is_aifc); - else - retval = flac__encode_wav(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options); - - if(options.foreign_metadata) - flac__foreign_metadata_delete(options.foreign_metadata); - } - - if(retval == 0) { - if(strcmp(outfilename, "-")) { - if(option_values.replay_gain) { - float title_gain, title_peak; - const char *error; - grabbag__replaygain_get_title(&title_gain, &title_peak); - if( - 0 != (error = grabbag__replaygain_store_to_file_reference(internal_outfilename? internal_outfilename : outfilename, /*preserve_modtime=*/true)) || - 0 != (error = grabbag__replaygain_store_to_file_title(internal_outfilename? internal_outfilename : outfilename, title_gain, title_peak, /*preserve_modtime=*/true)) - ) { - flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain reference/title tags (%s)\n", outfilename, error); - retval = 1; - } - } - if(strcmp(infilename, "-")) - grabbag__file_copy_metadata(infilename, internal_outfilename? internal_outfilename : outfilename); - } - } - - /* rename temporary file if necessary */ - if(retval == 0 && internal_outfilename != 0) { - if(rename(internal_outfilename, outfilename) < 0) { -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, rename() will fail if the destination already exists, so we unlink and try again */ - if(unlink(outfilename) < 0) { - flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both\n", internal_outfilename, outfilename); - retval = 1; - } - else if(rename(internal_outfilename, outfilename) < 0) { - flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, you must do it\n", internal_outfilename, outfilename); - retval = 1; - } -#else - flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both\n", internal_outfilename, outfilename); - retval = 1; -#endif - } - } - - /* handle --delete-input-file, but don't want to delete if piping from stdin, or if input filename and output filename are the same */ - if(retval == 0 && option_values.delete_input && strcmp(infilename, "-") && internal_outfilename == 0) - unlink(infilename); - - if(internal_outfilename != 0) - free(internal_outfilename); - - return retval; -} - -int decode_file(const char *infilename) -{ - int retval; - FLAC__bool treat_as_ogg = false; - FileFormat output_format = WAV; - decode_options_t common_options; - const char *outfilename = get_decoded_outfilename(infilename); - - if(0 == outfilename) { - flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", infilename); - return 1; - } - - /* - * Error if output file already exists (and -f not used). - * Use grabbag__file_get_filesize() as a cheap way to check. - */ - if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { - flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to override\n", outfilename); - return 1; - } - - if(option_values.force_raw_format) - output_format = RAW; - else if( - option_values.force_aiff_format || - (strlen(outfilename) >= 4 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-4), ".aif")) || - (strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".aiff")) - ) - output_format = AIF; - else - output_format = WAV; - - if(!option_values.test_only && !option_values.analyze) { - if(output_format == RAW && (option_values.format_is_big_endian < 0 || option_values.format_is_unsigned_samples < 0)) - return usage_error("ERROR: for decoding to a raw file you must specify a value for --endian and --sign\n"); - } - - if(option_values.keep_foreign_metadata) { - if(0 == strcmp(infilename, "-") || 0 == strcmp(outfilename, "-")) - return usage_error("ERROR: --keep-foreign-metadata cannot be used when decoding from stdin or to stdout\n"); - if(output_format != WAV && output_format != AIF) - return usage_error("ERROR: --keep-foreign-metadata can only be used with WAVE or AIFF output\n"); - } - - if(option_values.use_ogg) - treat_as_ogg = true; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".oga")) - treat_as_ogg = true; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".ogg")) - treat_as_ogg = true; - else - treat_as_ogg = false; - -#if !FLAC__HAS_OGG - if(treat_as_ogg) { - flac__utils_printf(stderr, 1, "%s: Ogg support has not been built into this copy of flac\n", infilename); - return 1; - } -#endif - - if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &common_options.skip_specification) || common_options.skip_specification.is_relative) - return usage_error("ERROR: invalid value for --skip\n"); - - if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &common_options.until_specification)) /*@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ - return usage_error("ERROR: invalid value for --until\n"); - /* if there is no "--until" we want to default to "--until=-0" */ - if(0 == option_values.until_specification) - common_options.until_specification.is_relative = true; - - if(option_values.cue_specification) { - if(!flac__utils_parse_cue_specification(option_values.cue_specification, &common_options.cue_specification)) - return usage_error("ERROR: invalid value for --cue\n"); - common_options.has_cue_specification = true; - } - else - common_options.has_cue_specification = false; - - common_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; - common_options.continue_through_decode_errors = option_values.continue_through_decode_errors; - common_options.replaygain_synthesis_spec = option_values.replaygain_synthesis_spec; -#if FLAC__HAS_OGG - common_options.is_ogg = treat_as_ogg; - common_options.use_first_serial_number = !option_values.has_serial_number; - common_options.serial_number = option_values.serial_number; -#endif - common_options.channel_map_none = option_values.channel_map_none; - - if(output_format == RAW) { - raw_decode_options_t options; - - options.common = common_options; - options.is_big_endian = option_values.format_is_big_endian; - options.is_unsigned_samples = option_values.format_is_unsigned_samples; - - retval = flac__decode_raw(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options); - } - else { - wav_decode_options_t options; - - options.common = common_options; - options.foreign_metadata = 0; - - /* read foreign metadata if requested */ - if(option_values.keep_foreign_metadata) { - if(0 == (options.foreign_metadata = flac__foreign_metadata_new(output_format==AIF? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) { - flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n"); - return 1; - } - } - - if(output_format == AIF) - retval = flac__decode_aiff(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options); - else - retval = flac__decode_wav(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options); - - if(options.foreign_metadata) - flac__foreign_metadata_delete(options.foreign_metadata); - } - - if(retval == 0 && strcmp(infilename, "-")) { - if(strcmp(outfilename, "-")) - grabbag__file_copy_metadata(infilename, outfilename); - if(option_values.delete_input && !option_values.test_only && !option_values.analyze) - unlink(infilename); - } - - return retval; -} - -const char *get_encoded_outfilename(const char *infilename) -{ - const char *suffix = (option_values.use_ogg? ".oga" : ".flac"); - return get_outfilename(infilename, suffix); -} - -const char *get_decoded_outfilename(const char *infilename) -{ - const char *suffix; - if(option_values.analyze) { - suffix = ".ana"; - } - else if(option_values.force_raw_format) { - suffix = ".raw"; - } - else if(option_values.force_aiff_format) { - suffix = ".aiff"; - } - else { - suffix = ".wav"; - } - return get_outfilename(infilename, suffix); -} - -const char *get_outfilename(const char *infilename, const char *suffix) -{ - if(0 == option_values.cmdline_forced_outfilename) { - static char buffer[4096]; /* @@@ bad MAGIC NUMBER */ - - if(0 == strcmp(infilename, "-") || option_values.force_to_stdout) { - strcpy(buffer, "-"); - } - else { - char *p; - if (flac__strlcpy(buffer, option_values.output_prefix? option_values.output_prefix : "", sizeof buffer) >= sizeof buffer) - return 0; - if (flac__strlcat(buffer, infilename, sizeof buffer) >= sizeof buffer) - return 0; - /* the . must come after any / to avoid problems with, e.g. "some.directory/extensionless-filename" */ - if(0 == (p = strrchr(buffer, '.')) || strchr(p, '/')) { - if (flac__strlcat(buffer, suffix, sizeof buffer) >= sizeof buffer) - return 0; - } - else { - *p = '\0'; - if (flac__strlcat(buffer, suffix, sizeof buffer) >= sizeof buffer) - return 0; - } - } - return buffer; - } - else - return option_values.cmdline_forced_outfilename; -} - -void die(const char *message) -{ - FLAC__ASSERT(0 != message); - flac__utils_printf(stderr, 1, "ERROR: %s\n", message); - exit(1); -} - -int conditional_fclose(FILE *f) -{ - if(f == 0 || f == stdin || f == stdout) - return 0; - else - return fclose(f); -} - -char *local_strdup(const char *source) -{ - char *ret; - FLAC__ASSERT(0 != source); - if(0 == (ret = strdup(source))) - die("out of memory during strdup()"); - return ret; -} - -#ifdef _MSC_VER -/* There's no strtoll() in MSVC6 so we just write a specialized one */ -FLAC__int64 local__strtoll(const char *src, char **endptr) -{ - FLAC__bool neg = false; - FLAC__int64 ret = 0; - int c; - FLAC__ASSERT(0 != src); - if(*src == '-') { - neg = true; - src++; - } - while(0 != (c = *src)) { - c -= '0'; - if(c >= 0 && c <= 9) - ret = (ret * 10) + c; - else - break; - src++; - } - if(endptr) - *endptr = (char*)src; - return neg? -ret : ret; -} -#endif diff --git a/src/lib/dl/ext/flac/md5.c b/src/lib/dl/ext/flac/md5.c deleted file mode 100755 index 9da37dc6..00000000 --- a/src/lib/dl/ext/flac/md5.c +++ /dev/null @@ -1,424 +0,0 @@ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include /* for malloc() */ -#include /* for memcpy() */ - -#include "private/md5.h" -#include "share/alloc.h" - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - -/* - * 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. - */ - -/* 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. - */ -static 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; -} - -#if WORDS_BIGENDIAN -//@@@@@@ OPT: use bswap/intrinsics -static void byteSwap(FLAC__uint32 *buf, unsigned words) -{ - register FLAC__uint32 x; - do { - x = *buf; - x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); - *buf++ = (x >> 16) | (x << 16); - } while (--words); -} -static void byteSwapX16(FLAC__uint32 *buf) -{ - register FLAC__uint32 x; - - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); - x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf = (x >> 16) | (x << 16); -} -#else -#define byteSwap(buf, words) -#define byteSwapX16(buf) -#endif - -/* - * Update context to reflect the concatenation of another buffer full - * of bytes. - */ -static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte 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((FLAC__byte *)ctx->in + 64 - t, buf, len); - return; - } - /* First chunk is an odd size */ - memcpy((FLAC__byte *)ctx->in + 64 - t, buf, t); - byteSwapX16(ctx->in); - FLAC__MD5Transform(ctx->buf, ctx->in); - buf += t; - len -= t; - - /* Process data in 64-byte chunks */ - while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteSwapX16(ctx->in); - FLAC__MD5Transform(ctx->buf, ctx->in); - buf += 64; - len -= 64; - } - - /* Handle any remaining bytes of data. */ - memcpy(ctx->in, buf, len); -} - -/* - * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious - * initialization constants. - */ -void FLAC__MD5Init(FLAC__MD5Context *ctx) -{ - 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; -} - -/* - * Final wrapup - pad to 64-byte boundary with the bit pattern - * 1 0* (64-bit count of bits processed, MSB-first) - */ -void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx) -{ - int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ - FLAC__byte *p = (FLAC__byte *)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); - byteSwapX16(ctx->in); - FLAC__MD5Transform(ctx->buf, ctx->in); - p = (FLAC__byte *)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; - } -} - -/* - * Convert the incoming audio signal to a byte stream - */ -static void format_input_(FLAC__byte *buf, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample) -{ - unsigned channel, sample; - register FLAC__int32 a_word; - register FLAC__byte *buf_ = buf; - -#if WORDS_BIGENDIAN -#else - if(channels == 2 && bytes_per_sample == 2) { - FLAC__int16 *buf1_ = ((FLAC__int16*)buf_) + 1; - memcpy(buf_, signal[0], sizeof(FLAC__int32) * samples); - for(sample = 0; sample < samples; sample++, buf1_+=2) - *buf1_ = (FLAC__int16)signal[1][sample]; - } - else if(channels == 1 && bytes_per_sample == 2) { - FLAC__int16 *buf1_ = (FLAC__int16*)buf_; - for(sample = 0; sample < samples; sample++) - *buf1_++ = (FLAC__int16)signal[0][sample]; - } - else -#endif - if(bytes_per_sample == 2) { - if(channels == 2) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - a_word = signal[1][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - else if(channels == 1) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - else { - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { - a_word = signal[channel][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - } - } - else if(bytes_per_sample == 3) { - if(channels == 2) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - a_word = signal[1][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - else if(channels == 1) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - else { - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { - a_word = signal[channel][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - } - } - else if(bytes_per_sample == 1) { - if(channels == 2) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; - a_word = signal[1][sample]; - *buf_++ = (FLAC__byte)a_word; - } - } - else if(channels == 1) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; - } - } - else { - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { - a_word = signal[channel][sample]; - *buf_++ = (FLAC__byte)a_word; - } - } - } - } - else { /* bytes_per_sample == 4, maybe optimize more later */ - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { - a_word = signal[channel][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - } -} - -/* - * Convert the incoming audio signal to a byte stream and FLAC__MD5Update it. - */ -FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample) -{ - const size_t bytes_needed = (size_t)channels * (size_t)samples * (size_t)bytes_per_sample; - - /* overflow check */ - if((size_t)channels > SIZE_MAX / (size_t)bytes_per_sample) - return false; - if((size_t)channels * (size_t)bytes_per_sample > SIZE_MAX / (size_t)samples) - return false; - - 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*)safe_malloc_(bytes_needed))) - return false; - } - ctx->internal_buf = tmp; - ctx->capacity = bytes_needed; - } - - format_input_(ctx->internal_buf, signal, channels, samples, bytes_per_sample); - - FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed); - - return true; -} diff --git a/src/lib/dl/ext/flac/memory.c b/src/lib/dl/ext/flac/memory.c deleted file mode 100755 index fae1e30e..00000000 --- a/src/lib/dl/ext/flac/memory.c +++ /dev/null @@ -1,221 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include "private/memory.h" -#include "flac/assert.h" -#include "share/alloc.h" - -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 = safe_malloc_add_2op_(bytes, /*+*/31); -#ifdef SIZEOF_VOIDP -#if SIZEOF_VOIDP == 4 - /* could do *aligned_address = x + ((unsigned) (32 - (((unsigned)x) & 31))) & 31; */ - *aligned_address = (void*)(((unsigned)x + 31) & -32); -#elif SIZEOF_VOIDP == 8 - *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32))); -#else -# error Unsupported sizeof(void*) -#endif -#else - /* there's got to be a better way to do this right for all archs */ - if(sizeof(void*) == sizeof(unsigned)) - *aligned_address = (void*)(((unsigned)x + 31) & -32); - else if(sizeof(void*) == sizeof(FLAC__uint64)) - *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32))); - else - return 0; -#endif -#else - x = safe_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); - - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ - return false; - - pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * (size_t)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); - - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ - return false; - - pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * 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); - - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ - return false; - - pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * 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); - - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ - return false; - - pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * 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); - - if((size_t)elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ - return false; - - pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * 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/src/lib/dl/ext/flac/metadata.h b/src/lib/dl/ext/flac/metadata.h deleted file mode 100755 index fff90b0b..00000000 --- a/src/lib/dl/ext/flac/metadata.h +++ /dev/null @@ -1,2181 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 /* for off_t */ -#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 native FLAC files. - * Note that currently only the Chain interface (level 2) supports Ogg - * FLAC files, and it is read-only i.e. no writing back changed - * metadata to file. - * - * There are three metadata interfaces of increasing complexity: - * - * Level 0: - * Read-only access to the STREAMINFO, VORBIS_COMMENT, CUESHEET, and - * PICTURE 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 situations where 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, VORBIS_COMMENT, CUESHEET, and PICTURE blocks, requiring - * only a filename. - * - * They try to skip any ID3v2 tag at the head of the file. - * - * \{ - */ - -/** Read the STREAMINFO metadata block of the given FLAC file. This function - * will try to 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 try to 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 tags != 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 metadata 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); - -/** Read the CUESHEET metadata block of the given FLAC file. This - * function will try to skip any ID3v2 tag at the head of the file. - * - * \param filename The path to the FLAC file to read. - * \param cuesheet The address where the returned pointer will be - * stored. The \a cuesheet object must be deleted by - * the caller using FLAC__metadata_object_delete(). - * \assert - * \code filename != NULL \endcode - * \code cuesheet != NULL \endcode - * \retval FLAC__bool - * \c true if a valid CUESHEET block was read from \a filename, - * and \a *cuesheet will be set to the address of the metadata - * structure. Returns \c false if there was a memory allocation - * error, a file decoder error, or the file contained no CUESHEET - * block, and \a *cuesheet will be set to \c NULL. - */ -FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__StreamMetadata **cuesheet); - -/** Read a PICTURE metadata block of the given FLAC file. This - * function will try to skip any ID3v2 tag at the head of the file. - * Since there can be more than one PICTURE block in a file, this - * function takes a number of parameters that act as constraints to - * the search. The PICTURE block with the largest area matching all - * the constraints will be returned, or \a *picture will be set to - * \c NULL if there was no such block. - * - * \param filename The path to the FLAC file to read. - * \param picture The address where the returned pointer will be - * stored. The \a picture object must be deleted by - * the caller using FLAC__metadata_object_delete(). - * \param type The desired picture type. Use \c -1 to mean - * "any type". - * \param mime_type The desired MIME type, e.g. "image/jpeg". The - * string will be matched exactly. Use \c NULL to - * mean "any MIME type". - * \param description The desired description. The string will be - * matched exactly. Use \c NULL to mean "any - * description". - * \param max_width The maximum width in pixels desired. Use - * \c (unsigned)(-1) to mean "any width". - * \param max_height The maximum height in pixels desired. Use - * \c (unsigned)(-1) to mean "any height". - * \param max_depth The maximum color depth in bits-per-pixel desired. - * Use \c (unsigned)(-1) to mean "any depth". - * \param max_colors The maximum number of colors desired. Use - * \c (unsigned)(-1) to mean "any number of colors". - * \assert - * \code filename != NULL \endcode - * \code picture != NULL \endcode - * \retval FLAC__bool - * \c true if a valid PICTURE block was read from \a filename, - * and \a *picture will be set to the address of the metadata - * structure. Returns \c false if there was a memory allocation - * error, a file decoder error, or the file contained no PICTURE - * block, and \a *picture will be set to \c NULL. - */ -FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors); - -/* \} */ - - -/** \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 only read access is allowed. - * - Use FLAC__metadata_simple_iterator_next() and - * FLAC__metadata_simple_iterator_prev() to traverse 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(void); - -/** 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); - -/** Returns a flag telling if the current metadata block is the last. - * - * \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 true if the current metadata block is the last in the file, - * else \c false. - */ -FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator); - -/** Get the offset 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 off_t - * The offset of the metadata block at the current iterator position. - * This is the byte offset relative to the beginning of the file of - * the current metadata block's header. - */ -FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const 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 length 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 unsigned - * The length of the metadata block at the current iterator position. - * The is same length as that in the - * metadata block header, - * i.e. the length of the metadata body that follows the header. - */ -FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator); - -/** Get the application ID of the \c APPLICATION 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. - * \param id A pointer to a buffer of at least \c 4 bytes where - * the ID will be stored. - * \assert - * \code iterator != NULL \endcode - * \code id != NULL \endcode - * \a iterator has been successfully initialized with - * FLAC__metadata_simple_iterator_init() - * \retval FLAC__bool - * \c true if the ID was successfully read, else \c false, in which - * case you should check FLAC__metadata_simple_iterator_status() to - * find out why. If the status is - * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT, then the - * current metadata block is not an \c APPLICATION block. Otherwise - * if the status is - * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR or - * \c FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR, an I/O error - * occurred and the iterator can no longer be used. - */ -FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id); - -/** 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, or \c NULL if there was a memory - * allocation error. - */ -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. - * - * Currently Ogg FLAC is supported for read only, via - * FLAC__metadata_chain_read_ogg() but a subsequent - * FLAC__metadata_chain_write() will fail. - * - * 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() or FLAC__metadata_chain_read_ogg() 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()/FLAC__metadata_chain_read_ogg() - * 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()/FLAC__metadata_chain_read_ogg_with_callbacks(), - * or - * FLAC__metadata_chain_write_with_callbacks()/FLAC__metadata_chain_write_with_callbacks_and_tempfile() - * was called on a chain read by - * FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). - * 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(void); - -/** 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 an Ogg FLAC file into the chain. - * - * \note Ogg FLAC metadata data writing is not supported yet and - * FLAC__metadata_chain_write() will fail. - * - * \param chain A pointer to an existing chain. - * \param filename The path to the Ogg 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_ogg(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); - -/** Read all metadata from an Ogg 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). - * - * \note Ogg FLAC metadata data writing is not supported yet and - * FLAC__metadata_chain_write() will fail. - * - * \param chain A pointer to an existing chain. - * \param handle The I/O handle of the Ogg 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_ogg_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()/FLAC__metadata_chain_read_ogg(), not - * FLAC__metadata_chain_read_with_callbacks()/FLAC__metadata_chain_read_ogg_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()/FLAC__metadata_chain_read_ogg_with_callbacks(), - * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). - * 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()/FLAC__metadata_chain_read_ogg_with_callbacks(), - * not FLAC__metadata_chain_read()/FLAC__metadata_chain_read_ogg(). - * 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(void); - -/** 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. The existing data will be freed if this - * function is successful, otherwise the original data will remain if \a copy - * is \c true and malloc() fails. - * - * \note It is safe to pass a const pointer to \a data if \a copy is \c true. - * - * \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 - * \code total_samples > 0 \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); - -/** 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 samples The number of samples apart to space the placeholder - * points. The first point will be at sample \c 0, the - * second at sample \a samples, then 2*\a samples, and - * so on. As long as \a samples and \a total_samples - * are greater than \c 0, there will always be at least - * one seekpoint at sample \c 0. - * \param total_samples The total number of samples to be encoded; - * the seekpoints will be spaced - * \a samples samples apart. - * \assert - * \code object != NULL \endcode - * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode - * \code samples > 0 \endcode - * \code total_samples > 0 \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_by_samples(FLAC__StreamMetadata *object, unsigned samples, 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(void); - -/** 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); - -/** Calculate and return the CDDB/freedb ID for a cue sheet. The function - * assumes the cue sheet corresponds to a CD; the result is undefined - * if the cuesheet's is_cd bit is not set. - * - * \param object A pointer to an existing CUESHEET object. - * \assert - * \code object != NULL \endcode - * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode - * \retval FLAC__uint32 - * The unsigned integer representation of the CDDB/freedb ID - */ -FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id(const FLAC__StreamMetadata *object); - -/** Sets the MIME type of a PICTURE block. - * - * If \a copy is \c true, a copy of the string is stored; otherwise, the object - * takes ownership of the pointer. The existing string will be freed if this - * function is successful, otherwise the original string will remain if \a copy - * is \c true and malloc() fails. - * - * \note It is safe to pass a const pointer to \a mime_type if \a copy is \c true. - * - * \param object A pointer to an existing PICTURE object. - * \param mime_type A pointer to the MIME type string. The string must be - * ASCII characters 0x20-0x7e, NUL-terminated. No validation - * is done. - * \param copy See above. - * \assert - * \code object != NULL \endcode - * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode - * \code (mime_type != NULL) \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_picture_set_mime_type(FLAC__StreamMetadata *object, char *mime_type, FLAC__bool copy); - -/** Sets the description of a PICTURE block. - * - * If \a copy is \c true, a copy of the string is stored; otherwise, the object - * takes ownership of the pointer. The existing string will be freed if this - * function is successful, otherwise the original string will remain if \a copy - * is \c true and malloc() fails. - * - * \note It is safe to pass a const pointer to \a description if \a copy is \c true. - * - * \param object A pointer to an existing PICTURE object. - * \param description A pointer to the description string. The string must be - * valid UTF-8, NUL-terminated. No validation is done. - * \param copy See above. - * \assert - * \code object != NULL \endcode - * \code object->type == FLAC__METADATA_TYPE_PICTURE \endcode - * \code (description != NULL) \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_picture_set_description(FLAC__StreamMetadata *object, FLAC__byte *description, FLAC__bool copy); - -/** Sets the picture data of a PICTURE block. - * - * If \a copy is \c true, a copy of the data is stored; otherwise, the object - * takes ownership of the pointer. Also sets the \a data_length field of the - * metadata object to what is passed in as the \a length parameter. The - * existing data will be freed if this function is successful, otherwise the - * original data and data_length will remain if \a copy is \c true and - * malloc() fails. - * - * \note It is safe to pass a const pointer to \a data if \a copy is \c true. - * - * \param object A pointer to an existing PICTURE 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_PICTURE \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_picture_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, FLAC__uint32 length, FLAC__bool copy); - -/** Check a PICTURE block to see if it conforms to the FLAC specification. - * See the format specification for limits on the contents of the - * PICTURE block. - * - * \param object A pointer to existing PICTURE block to be checked. - * \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_PICTURE \endcode - * \retval FLAC__bool - * \c false if PICTURE block is illegal, else \c true. - */ -FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation); - -/* \} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/flac/metadata_iterators.c b/src/lib/dl/ext/flac/metadata_iterators.c deleted file mode 100755 index 331b7f28..00000000 --- a/src/lib/dl/ext/flac/metadata_iterators.c +++ /dev/null @@ -1,3368 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include - -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#if defined __BORLANDC__ -#include /* for utime() */ -#else -#include /* for utime() */ -#endif -#include /* for chmod() */ -#include /* for off_t */ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#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/stream_decoder.h" -#include "share/alloc.h" - -#ifdef TARGET_MSDOS /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif - -#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_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *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_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *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, off_t fixup_is_last_flag_offset, FLAC__bool backup); - -static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, 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, off_t bytes, 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__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); - -typedef struct { - FLAC__bool got_error; - FLAC__StreamMetadata *object; -} level0_client_data; - -static FLAC__StreamMetadata *get_one_metadata_block_(const char *filename, FLAC__MetadataType type) -{ - level0_client_data cd; - FLAC__StreamDecoder *decoder; - - FLAC__ASSERT(0 != filename); - - cd.got_error = false; - cd.object = 0; - - decoder = FLAC__stream_decoder_new(); - - if(0 == decoder) - return 0; - - FLAC__stream_decoder_set_md5_checking(decoder, false); - FLAC__stream_decoder_set_metadata_ignore_all(decoder); - FLAC__stream_decoder_set_metadata_respond(decoder, type); - - if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, &cd) != FLAC__STREAM_DECODER_INIT_STATUS_OK || cd.got_error) { - (void)FLAC__stream_decoder_finish(decoder); - FLAC__stream_decoder_delete(decoder); - return 0; - } - - if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder) || cd.got_error) { - (void)FLAC__stream_decoder_finish(decoder); - FLAC__stream_decoder_delete(decoder); - if(0 != cd.object) - FLAC__metadata_object_delete(cd.object); - return 0; - } - - (void)FLAC__stream_decoder_finish(decoder); - FLAC__stream_decoder_delete(decoder); - - return cd.object; -} - -FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo) -{ - FLAC__StreamMetadata *object; - - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != streaminfo); - - object = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_STREAMINFO); - - if (object) { - /* can just copy the contents since STREAMINFO has no internal structure */ - *streaminfo = *object; - FLAC__metadata_object_delete(object); - return true; - } - else { - return false; - } -} - -FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != tags); - - *tags = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_VORBIS_COMMENT); - - return 0 != *tags; -} - -FLAC_API FLAC__bool FLAC__metadata_get_cuesheet(const char *filename, FLAC__StreamMetadata **cuesheet) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != cuesheet); - - *cuesheet = get_one_metadata_block_(filename, FLAC__METADATA_TYPE_CUESHEET); - - return 0 != *cuesheet; -} - -FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *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__StreamDecoder *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_error && 0 == cd->object) { - if(0 == (cd->object = FLAC__metadata_object_clone(metadata))) - cd->got_error = true; - } -} - -void error_callback_(const FLAC__StreamDecoder *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; -} - -FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors) -{ - FLAC__Metadata_SimpleIterator *it; - FLAC__uint64 max_area_seen = 0; - FLAC__uint64 max_depth_seen = 0; - - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != picture); - - *picture = 0; - - it = FLAC__metadata_simple_iterator_new(); - if(0 == it) - return false; - if(!FLAC__metadata_simple_iterator_init(it, filename, /*read_only=*/true, /*preserve_file_stats=*/true)) { - FLAC__metadata_simple_iterator_delete(it); - return false; - } - do { - if(FLAC__metadata_simple_iterator_get_block_type(it) == FLAC__METADATA_TYPE_PICTURE) { - FLAC__StreamMetadata *obj = FLAC__metadata_simple_iterator_get_block(it); - FLAC__uint64 area = (FLAC__uint64)obj->data.picture.width * (FLAC__uint64)obj->data.picture.height; - /* check constraints */ - if( - (type == (FLAC__StreamMetadata_Picture_Type)(-1) || type == obj->data.picture.type) && - (mime_type == 0 || !strcmp(mime_type, obj->data.picture.mime_type)) && - (description == 0 || !strcmp((const char *)description, (const char *)obj->data.picture.description)) && - obj->data.picture.width <= max_width && - obj->data.picture.height <= max_height && - obj->data.picture.depth <= max_depth && - obj->data.picture.colors <= max_colors && - (area > max_area_seen || (area == max_area_seen && obj->data.picture.depth > max_depth_seen)) - ) { - if(*picture) - FLAC__metadata_object_delete(*picture); - *picture = obj; - max_area_seen = area; - max_depth_seen = obj->data.picture.depth; - } - else { - FLAC__metadata_object_delete(obj); - } - } - } while(FLAC__metadata_simple_iterator_next(it)); - - FLAC__metadata_simple_iterator_delete(it); - - return (0 != *picture); -} - - -/**************************************************************************** - * - * 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; - off_t offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH]; - off_t 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(void) -{ - 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] = ftello(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 != fseeko(iterator->file, iterator->length, SEEK_CUR)) { - iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; - return false; - } - - iterator->offset[iterator->depth] = ftello(iterator->file); - - return read_metadata_block_header_(iterator); -} - -FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator) -{ - off_t this_offset; - - FLAC__ASSERT(0 != iterator); - FLAC__ASSERT(0 != iterator->file); - - if(iterator->offset[iterator->depth] == iterator->first_offset) - return false; - - if(0 != fseeko(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 ftello() and catch it in fseeko() */ - while(ftello(iterator->file) + (off_t)iterator->length < iterator->offset[iterator->depth]) { - if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR)) { - iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; - return false; - } - this_offset = ftello(iterator->file); - if(!read_metadata_block_header_(iterator)) - return false; - } - - iterator->offset[iterator->depth] = this_offset; - - return true; -} - -/*@@@@add to tests*/ -FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_SimpleIterator *iterator) -{ - FLAC__ASSERT(0 != iterator); - FLAC__ASSERT(0 != iterator->file); - - return iterator->is_last; -} - -/*@@@@add to tests*/ -FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metadata_SimpleIterator *iterator) -{ - FLAC__ASSERT(0 != iterator); - FLAC__ASSERT(0 != iterator->file); - - return iterator->offset[iterator->depth]; -} - -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; -} - -/*@@@@add to tests*/ -FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator) -{ - FLAC__ASSERT(0 != iterator); - FLAC__ASSERT(0 != iterator->file); - - return iterator->length; -} - -/*@@@@add to tests*/ -FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id) -{ - const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; - - FLAC__ASSERT(0 != iterator); - FLAC__ASSERT(0 != iterator->file); - FLAC__ASSERT(0 != id); - - if(iterator->type != FLAC__METADATA_TYPE_APPLICATION) { - iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT; - return false; - } - - if(fread(id, 1, id_bytes, iterator->file) != id_bytes) { - iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - return false; - } - - /* back up */ - if(0 != fseeko(iterator->file, -((int)id_bytes), SEEK_CUR)) { - iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; - return false; - } - - return true; -} - -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 != fseeko(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(off_t 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 || ftello(iterator->file) == debug_target_offset + (off_t)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 || ftello(iterator->file) == debug_target_offset + (off_t)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 || ftello(iterator->file) == debug_target_offset + (off_t)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 || ftello(iterator->file) == debug_target_offset + (off_t)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 || ftello(iterator->file) == debug_target_offset + (off_t)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(off_t 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(ftello(iterator->file) == debug_target_offset + (off_t)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(ftello(iterator->file) == debug_target_offset + (off_t)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(ftello(iterator->file) == debug_target_offset + (off_t)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(off_t 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] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset); - FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset); - return true; - } - else { - ret = rewrite_whole_file_(iterator, 0, /*append=*/false); - FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset); - FLAC__ASSERT(ftello(iterator->file) + (off_t)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__bool is_ogg; - FLAC__Metadata_Node *head; - FLAC__Metadata_Node *tail; - unsigned nodes; - FLAC__Metadata_ChainStatus status; - off_t first_offset, last_offset; - /* - * 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. - */ - off_t initial_length; - /* @@@ hacky, these are currently only needed by ogg reader */ - FLAC__IOHandle handle; - FLAC__IOCallback_Read read_cb; -}; - -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_(void) -{ - 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->is_ogg = false; - chain->head = chain->tail = 0; - chain->nodes = 0; - chain->status = FLAC__METADATA_CHAIN_STATUS_OK; - chain->initial_length = 0; - chain->read_cb = 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 off_t chain_calculate_length_(FLAC__Metadata_Chain *chain) -{ - const FLAC__Metadata_Node *node; - off_t 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 off_t chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding) -{ - off_t 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 off_t 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 + (off_t)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 off_t 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((off_t)chain->tail->data->length + (off_t)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((off_t)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 = (off_t)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 = (off_t)pos; - } - - chain->initial_length = chain_calculate_length_(chain); - - return true; -} - -static FLAC__StreamDecoderReadStatus chain_read_ogg_read_cb_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data; - (void)decoder; - if(*bytes > 0 && chain->status == FLAC__METADATA_CHAIN_STATUS_OK) { - *bytes = chain->read_cb(buffer, sizeof(FLAC__byte), *bytes, chain->handle); - if(*bytes == 0) - return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - else - return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - } - else - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; -} - -static FLAC__StreamDecoderWriteStatus chain_read_ogg_write_cb_(const FLAC__StreamDecoder *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_ABORT; -} - -static void chain_read_ogg_metadata_cb_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data; - FLAC__Metadata_Node *node; - - (void)decoder; - - node = node_new_(); - if(0 == node) { - chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; - return; - } - - node->data = FLAC__metadata_object_clone(metadata); - if(0 == node->data) { - node_delete_(node); - chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; - return; - } - - chain_append_node_(chain, node); -} - -static void chain_read_ogg_error_cb_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)client_data; - (void)decoder, (void)status; - chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */ -} - -static FLAC__bool chain_read_ogg_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb) -{ - FLAC__StreamDecoder *decoder; - - FLAC__ASSERT(0 != chain); - - /* we assume we're already at the beginning of the file */ - - chain->handle = handle; - chain->read_cb = read_cb; - if(0 == (decoder = FLAC__stream_decoder_new())) { - chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; - return false; - } - FLAC__stream_decoder_set_metadata_respond_all(decoder); - if(FLAC__stream_decoder_init_ogg_stream(decoder, chain_read_ogg_read_cb_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, chain_read_ogg_write_cb_, chain_read_ogg_metadata_cb_, chain_read_ogg_error_cb_, chain) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - FLAC__stream_decoder_delete(decoder); - chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */ - return false; - } - - chain->first_offset = 0; /*@@@ wrong; will need to be set correctly to implement metadata writing for Ogg FLAC */ - - if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) - chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; /*@@@ maybe needs better error code */ - if(chain->status != FLAC__METADATA_CHAIN_STATUS_OK) { - FLAC__stream_decoder_delete(decoder); - return false; - } - - FLAC__stream_decoder_delete(decoder); - - chain->last_offset = 0; /*@@@ wrong; will need to be set correctly to implement metadata writing for Ogg FLAC */ - - 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(), ftello() == 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(), ftello() == chain->last_offset);*/ - - /* copy the file postfix (everything after the metadata) */ - if(0 != fseeko(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(), ftello() == 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(void) -{ - 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; -} - -static FLAC__bool chain_read_(FLAC__Metadata_Chain *chain, const char *filename, FLAC__bool is_ogg) -{ - 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; - } - - chain->is_ogg = is_ogg; - - if(0 == (file = fopen(filename, "rb"))) { - chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; - return false; - } - - /* the function also sets chain->status for us */ - ret = is_ogg? - chain_read_ogg_cb_(chain, file, (FLAC__IOCallback_Read)fread) : - 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(FLAC__Metadata_Chain *chain, const char *filename) -{ - return chain_read_(chain, filename, /*is_ogg=*/false); -} - -/*@@@@add to tests*/ -FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg(FLAC__Metadata_Chain *chain, const char *filename) -{ - return chain_read_(chain, filename, /*is_ogg=*/true); -} - -static FLAC__bool chain_read_with_callbacks_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__bool is_ogg) -{ - FLAC__bool ret; - - 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; - } - - chain->is_ogg = is_ogg; - - /* rewind */ - if(0 != callbacks.seek(handle, 0, SEEK_SET)) { - chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; - return false; - } - - /* the function also sets chain->status for us */ - ret = is_ogg? - chain_read_ogg_cb_(chain, handle, callbacks.read) : - chain_read_cb_(chain, handle, callbacks.read, callbacks.seek, callbacks.tell) - ; - - return ret; -} - -FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) -{ - return chain_read_with_callbacks_(chain, handle, callbacks, /*is_ogg=*/false); -} - -/*@@@@add to tests*/ -FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) -{ - return chain_read_with_callbacks_(chain, handle, callbacks, /*is_ogg=*/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 off_t 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 + (off_t)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 off_t 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((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta) - return false; - /* if there is at least 'delta' bytes of padding, trim the padding down */ - else if((off_t)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; - off_t current_length; - - FLAC__ASSERT(0 != chain); - - if (chain->is_ogg) { /* cannot write back to Ogg FLAC yet */ - chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; - return false; - } - - 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) -{ - off_t current_length; - - FLAC__ASSERT(0 != chain); - - if (chain->is_ogg) { /* cannot write back to Ogg FLAC yet */ - chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; - return false; - } - - 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) -{ - off_t current_length; - - FLAC__ASSERT(0 != chain); - - if (chain->is_ogg) { /* cannot write back to Ogg FLAC yet */ - chain->status = FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; - return false; - } - - 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(void) -{ - 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); - case FLAC__METADATA_TYPE_PICTURE: - return read_metadata_block_data_picture_cb_(handle, read_cb, &block->data.picture); - 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; - - if(block_length < 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*)safe_malloc_mul_2op_(block->num_points, /*times*/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 == sizeof(buffer)); - - 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*)safe_malloc_add_2op_(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 == sizeof(buffer)); - - 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; -} - -static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cstring_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__byte **data, FLAC__uint32 *length, FLAC__uint32 length_len) -{ - FLAC__byte buffer[sizeof(FLAC__uint32)]; - - FLAC__ASSERT(0 != data); - FLAC__ASSERT(length_len%8 == 0); - - length_len /= 8; /* convert to bytes */ - - FLAC__ASSERT(sizeof(buffer) >= length_len); - - if(read_cb(buffer, 1, length_len, handle) != length_len) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - *length = unpack_uint32_(buffer, length_len); - - if(0 != *data) - free(*data); - - if(0 == (*data = (FLAC__byte*)safe_malloc_add_2op_(*length, /*+*/1))) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; - - if(*length > 0) { - if(read_cb(*data, 1, *length, handle) != *length) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - } - - (*data)[*length] = '\0'; - - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; -} - -FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *block) -{ - FLAC__Metadata_SimpleIteratorStatus status; - FLAC__byte buffer[4]; /* asserted below that this is big enough */ - FLAC__uint32 len; - - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_TYPE_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_COLORS_LEN/8); - - FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_TYPE_LEN % 8 == 0); - len = FLAC__STREAM_METADATA_PICTURE_TYPE_LEN / 8; - if(read_cb(buffer, 1, len, handle) != len) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - block->type = (FLAC__StreamMetadata_Picture_Type)unpack_uint32_(buffer, len); - - if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, (FLAC__byte**)(&(block->mime_type)), &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) - return status; - - if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->description), &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) - return status; - - FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN % 8 == 0); - len = FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN / 8; - if(read_cb(buffer, 1, len, handle) != len) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - block->width = unpack_uint32_(buffer, len); - - FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN % 8 == 0); - len = FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN / 8; - if(read_cb(buffer, 1, len, handle) != len) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - block->height = unpack_uint32_(buffer, len); - - FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN % 8 == 0); - len = FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN / 8; - if(read_cb(buffer, 1, len, handle) != len) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - block->depth = unpack_uint32_(buffer, len); - - FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_COLORS_LEN % 8 == 0); - len = FLAC__STREAM_METADATA_PICTURE_COLORS_LEN / 8; - if(read_cb(buffer, 1, len, handle) != len) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - block->colors = unpack_uint32_(buffer, len); - - /* for convenience we use read_metadata_block_data_picture_cstring_cb_() even though it adds an extra terminating NUL we don't use */ - if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->data), &(block->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) - 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); - case FLAC__METADATA_TYPE_PICTURE: - return write_metadata_block_data_picture_cb_(handle, write_cb, &block->data.picture); - 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 == sizeof(buffer)); - - 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_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block) -{ - unsigned len; - size_t slen; - FLAC__byte buffer[4]; /* magic number is asserted below */ - - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_TYPE_LEN%8); - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN%8); - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN%8); - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN%8); - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN%8); - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN%8); - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_COLORS_LEN%8); - FLAC__ASSERT(0 == FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN%8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_TYPE_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_COLORS_LEN/8); - FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN/8); - - len = FLAC__STREAM_METADATA_PICTURE_TYPE_LEN/8; - pack_uint32_(block->type, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - - len = FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN/8; - slen = strlen(block->mime_type); - pack_uint32_(slen, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - if(write_cb(block->mime_type, 1, slen, handle) != slen) - return false; - - len = FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN/8; - slen = strlen((const char *)block->description); - pack_uint32_(slen, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - if(write_cb(block->description, 1, slen, handle) != slen) - return false; - - len = FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN/8; - pack_uint32_(block->width, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - - len = FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN/8; - pack_uint32_(block->height, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - - len = FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN/8; - pack_uint32_(block->depth, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - - len = FLAC__STREAM_METADATA_PICTURE_COLORS_LEN/8; - pack_uint32_(block->colors, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - - len = FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN/8; - pack_uint32_(block->data_length, buffer, len); - if(write_cb(buffer, 1, len, handle) != len) - return false; - if(write_cb(block->data, 1, block->data_length, handle) != block->data_length) - 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 != fseeko(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 != fseeko(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 != fseeko(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 != fseeko(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 */ - off_t 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 != fseeko(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 == sizeof(buffer)); - - /* 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 off_t offset_end = append? iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length : iterator->offset[iterator->depth]; - - if(0 != fseeko(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, off_t fixup_is_last_flag_offset, FLAC__bool backup) -{ - off_t save_offset = iterator->offset[iterator->depth]; - FLAC__ASSERT(0 != *tempfile); - - if(0 != fseeko(iterator->file, save_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)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 != fseeko(*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 != fseeko(*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] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)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, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status) -{ - FLAC__byte buffer[8192]; - size_t n; - - FLAC__ASSERT(bytes >= 0); - while(bytes > 0) { - n = min(sizeof(buffer), (size_t)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, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status) -{ - FLAC__byte buffer[8192]; - size_t n; - - FLAC__ASSERT(bytes >= 0); - while(bytes > 0) { - n = min(sizeof(buffer), (size_t)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*)safe_malloc_add_3op_(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*)safe_malloc_add_4op_(strlen(tempfile_path_prefix), /*+*/strlen(p), /*+*/strlen(tempfile_suffix), /*+*/2))) { - *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 __BORLANDC__ || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, rename() will fail if the destination already exists */ - 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 __BORLANDC__ && !defined __MINGW32__ && !defined __EMX__ && !defined TARGET_MSDOS - (void)chown(filename, stats->st_uid, -1); - (void)chown(filename, -1, stats->st_gid); -#endif -} - -int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence) -{ - return fseeko((FILE*)handle, (off_t)offset, whence); -} - -FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle) -{ - return ftello((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/src/lib/dl/ext/flac/metadata_object.c b/src/lib/dl/ext/flac/metadata_object.c deleted file mode 100755 index 2b3429a8..00000000 --- a/src/lib/dl/ext/flac/metadata_object.c +++ /dev/null @@ -1,1819 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "private/metadata.h" - -#include "flac/assert.h" -#include "share/alloc.h" - - -/**************************************************************************** - * - * Local routines - * - ***************************************************************************/ - -/* copy bytes: - * from = NULL && bytes = 0 - * to <- NULL - * from != NULL && bytes > 0 - * to <- copy of from - * else ASSERT - * malloc error leaves 'to' unchanged - */ -static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes) -{ - FLAC__ASSERT(0 != to); - if(bytes > 0 && 0 != from) { - FLAC__byte *x; - if(0 == (x = (FLAC__byte*)safe_malloc_(bytes))) - return false; - memcpy(x, from, bytes); - *to = x; - } - else { - FLAC__ASSERT(0 == from); - FLAC__ASSERT(bytes == 0); - *to = 0; - } - return true; -} - -#if 0 /* UNUSED */ -/* like copy_bytes_(), but free()s the original '*to' if the copy succeeds and the original '*to' is non-NULL */ -static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes) -{ - FLAC__byte *copy; - FLAC__ASSERT(0 != to); - if(copy_bytes_(©, from, bytes)) { - if(*to) - free(*to); - *to = copy; - return true; - } - else - return false; -} -#endif - -/* reallocate entry to 1 byte larger and add a terminating NUL */ -/* realloc() failure leaves entry unchanged */ -static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length) -{ - FLAC__byte *x = (FLAC__byte*)safe_realloc_add_2op_(*entry, length, /*+*/1); - if(0 != x) { - x[length] = '\0'; - *entry = x; - return true; - } - else - return false; -} - -/* copies the NUL-terminated C-string 'from' to '*to', leaving '*to' - * unchanged if malloc fails, free()ing the original '*to' if it - * succeeds and the original '*to' was not NULL - */ -static FLAC__bool copy_cstring_(char **to, const char *from) -{ - char *copy = strdup(from); - FLAC__ASSERT(to); - if(copy) { - if(*to) - free(*to); - *to = copy; - 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*)safe_malloc_add_2op_(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*)safe_malloc_mul_2op_(from->num_indices, /*times*/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*)safe_malloc_mul_2op_(num_points, /*times*/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*)safe_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*)safe_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*)safe_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; - case FLAC__METADATA_TYPE_PICTURE: - object->length = ( - FLAC__STREAM_METADATA_PICTURE_TYPE_LEN + - FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + /* empty mime_type string */ - FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + /* empty description string */ - FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN + - FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN + - FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN + - FLAC__STREAM_METADATA_PICTURE_COLORS_LEN + - FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN + - 0 /* no data */ - ) / 8; - object->data.picture.type = FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER; - object->data.picture.mime_type = 0; - object->data.picture.description = 0; - /* calloc() took care of this for us: - object->data.picture.width = 0; - object->data.picture.height = 0; - object->data.picture.depth = 0; - object->data.picture.colors = 0; - object->data.picture.data_length = 0; - object->data.picture.data = 0; - */ - /* now initialize mime_type and description with empty strings to make things easier on the client */ - if(!copy_cstring_(&object->data.picture.mime_type, "")) { - free(object); - return 0; - } - if(!copy_cstring_((char**)(&object->data.picture.description), "")) { - if(object->data.picture.mime_type) - free(object->data.picture.mime_type); - free(object); - return 0; - } - 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: - if(to->length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) { /* underflow check */ - FLAC__metadata_object_delete(to); - return 0; - } - 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(to->data.seek_table.num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) { /* overflow check */ - FLAC__metadata_object_delete(to); - return 0; - } - 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; - case FLAC__METADATA_TYPE_PICTURE: - to->data.picture.type = object->data.picture.type; - if(!copy_cstring_(&to->data.picture.mime_type, object->data.picture.mime_type)) { - FLAC__metadata_object_delete(to); - return 0; - } - if(!copy_cstring_((char**)(&to->data.picture.description), (const char*)object->data.picture.description)) { - FLAC__metadata_object_delete(to); - return 0; - } - to->data.picture.width = object->data.picture.width; - to->data.picture.height = object->data.picture.height; - to->data.picture.depth = object->data.picture.depth; - to->data.picture.colors = object->data.picture.colors; - to->data.picture.data_length = object->data.picture.data_length; - if(!copy_bytes_((&to->data.picture.data), object->data.picture.data, object->data.picture.data_length)) { - 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; - case FLAC__METADATA_TYPE_PICTURE: - if(0 != object->data.picture.mime_type) { - free(object->data.picture.mime_type); - object->data.picture.mime_type = 0; - } - if(0 != object->data.picture.description) { - free(object->data.picture.description); - object->data.picture.description = 0; - } - if(0 != object->data.picture.data) { - free(object->data.picture.data); - object->data.picture.data = 0; - } - 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_picture_(const FLAC__StreamMetadata_Picture *block1, const FLAC__StreamMetadata_Picture *block2) -{ - if(block1->type != block2->type) - return false; - if(block1->mime_type != block2->mime_type && (0 == block1->mime_type || 0 == block2->mime_type || strcmp(block1->mime_type, block2->mime_type))) - return false; - if(block1->description != block2->description && (0 == block1->description || 0 == block2->description || strcmp((const char *)block1->description, (const char *)block2->description))) - return false; - if(block1->width != block2->width) - return false; - if(block1->height != block2->height) - return false; - if(block1->depth != block2->depth) - return false; - if(block1->colors != block2->colors) - return false; - if(block1->data_length != block2->data_length) - return false; - if(block1->data != block2->data && (0 == block1->data || 0 == block2->data || memcmp(block1->data, block2->data, block1->data_length))) - 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); - case FLAC__METADATA_TYPE_PICTURE: - return compare_block_data_picture_(&block1->data.picture, &block2->data.picture); - 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 size_t old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint); - const size_t new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint); - - /* overflow check */ - if((size_t)new_num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) - return false; - - 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 && total_samples > 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_append_spaced_points_by_samples(FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples) -{ - FLAC__ASSERT(0 != object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); - FLAC__ASSERT(samples > 0); - FLAC__ASSERT(total_samples > 0); - - if(samples > 0 && total_samples > 0) { - FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table; - unsigned i, j; - FLAC__uint64 num, sample; - - num = 1 + total_samples / samples; /* 1+ for the first sample at 0 */ - /* now account for the fact that we don't place a seekpoint at "total_samples" since samples are number from 0: */ - if(total_samples % samples == 0) - num--; - - i = seek_table->num_points; - - if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (unsigned)num)) - return false; - - sample = 0; - for(j = 0; j < num; i++, j++, sample += samples) { - seek_table->points[i].sample_number = sample; - 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 size_t old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); - const size_t new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); - - /* overflow check */ - if((size_t)new_num_comments > SIZE_MAX / sizeof(FLAC__StreamMetadata_VorbisComment_Entry)) - return false; - - 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; - size_t 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, (const char *)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, (const char *)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, (const char *)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((const FLAC__byte *)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*)safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/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*)safe_malloc_add_2op_(nn, /*+*/1))) - return false; - if(0 == (*field_value = (char*)safe_malloc_add_2op_(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 __BORLANDC__ || defined __MINGW32__ || defined __EMX__ -#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(void) -{ - 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 size_t old_size = track->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); - const size_t new_size = new_num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); - - /* overflow check */ - if((size_t)new_num_indices > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Index)) - return false; - - 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 size_t old_size = object->data.cue_sheet.num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); - const size_t new_size = new_num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); - - /* overflow check */ - if((size_t)new_num_tracks > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Track)) - return false; - - 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); -} - -static FLAC__uint64 get_index_01_offset_(const FLAC__StreamMetadata_CueSheet *cs, unsigned track) -{ - if (track >= (cs->num_tracks-1) || cs->tracks[track].num_indices < 1) - return 0; - else if (cs->tracks[track].indices[0].number == 1) - return cs->tracks[track].indices[0].offset + cs->tracks[track].offset + cs->lead_in; - else if (cs->tracks[track].num_indices < 2) - return 0; - else if (cs->tracks[track].indices[1].number == 1) - return cs->tracks[track].indices[1].offset + cs->tracks[track].offset + cs->lead_in; - else - return 0; -} - -static FLAC__uint32 cddb_add_digits_(FLAC__uint32 x) -{ - FLAC__uint32 n = 0; - while (x) { - n += (x%10); - x /= 10; - } - return n; -} - -/*@@@@add to tests*/ -FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id(const FLAC__StreamMetadata *object) -{ - const FLAC__StreamMetadata_CueSheet *cs; - - FLAC__ASSERT(0 != object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); - - cs = &object->data.cue_sheet; - - if (cs->num_tracks < 2) /* need at least one real track and the lead-out track */ - return 0; - - { - FLAC__uint32 i, length, sum = 0; - for (i = 0; i < (cs->num_tracks-1); i++) /* -1 to avoid counting the lead-out */ - sum += cddb_add_digits_((FLAC__uint32)(get_index_01_offset_(cs, i) / 44100)); - length = (FLAC__uint32)((cs->tracks[cs->num_tracks-1].offset+cs->lead_in) / 44100) - (FLAC__uint32)(get_index_01_offset_(cs, 0) / 44100); - - return (sum % 0xFF) << 24 | length << 8 | (FLAC__uint32)(cs->num_tracks-1); - } -} - -FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type(FLAC__StreamMetadata *object, char *mime_type, FLAC__bool copy) -{ - char *old; - size_t old_length, new_length; - - FLAC__ASSERT(0 != object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); - FLAC__ASSERT(0 != mime_type); - - old = object->data.picture.mime_type; - old_length = old? strlen(old) : 0; - new_length = strlen(mime_type); - - /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(new_length >= SIZE_MAX) /* overflow check */ - return false; - if(!copy_bytes_((FLAC__byte**)(&object->data.picture.mime_type), (FLAC__byte*)mime_type, new_length+1)) - return false; - } - else { - object->data.picture.mime_type = mime_type; - } - - if(0 != old) - free(old); - - object->length -= old_length; - object->length += new_length; - return true; -} - -FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description(FLAC__StreamMetadata *object, FLAC__byte *description, FLAC__bool copy) -{ - FLAC__byte *old; - size_t old_length, new_length; - - FLAC__ASSERT(0 != object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); - FLAC__ASSERT(0 != description); - - old = object->data.picture.description; - old_length = old? strlen((const char *)old) : 0; - new_length = strlen((const char *)description); - - /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(new_length >= SIZE_MAX) /* overflow check */ - return false; - if(!copy_bytes_(&object->data.picture.description, description, new_length+1)) - return false; - } - else { - object->data.picture.description = description; - } - - if(0 != old) - free(old); - - object->length -= old_length; - object->length += new_length; - return true; -} - -FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, FLAC__uint32 length, FLAC__bool copy) -{ - FLAC__byte *old; - - FLAC__ASSERT(0 != object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); - FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false)); - - old = object->data.picture.data; - - /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(!copy_bytes_(&object->data.picture.data, data, length)) - return false; - } - else { - object->data.picture.data = data; - } - - if(0 != old) - free(old); - - object->length -= object->data.picture.data_length; - object->data.picture.data_length = length; - object->length += length; - return true; -} - -FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation) -{ - FLAC__ASSERT(0 != object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); - - return FLAC__format_picture_is_legal(&object->data.picture, violation); -} diff --git a/src/lib/dl/ext/flac/ogg_decoder_aspect.c b/src/lib/dl/ext/flac/ogg_decoder_aspect.c deleted file mode 100755 index ae621cd4..00000000 --- a/src/lib/dl/ext/flac/ogg_decoder_aspect.c +++ /dev/null @@ -1,253 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#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 FLAC__ogg_decoder_aspect_init(FLAC__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 FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect) -{ - (void)ogg_sync_clear(&aspect->sync_state); - (void)ogg_stream_clear(&aspect->stream_state); -} - -void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value) -{ - aspect->use_first_serial_number = false; - aspect->serial_number = value; -} - -void FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect) -{ - aspect->use_first_serial_number = true; -} - -void FLAC__ogg_decoder_aspect_flush(FLAC__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 FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect) -{ - FLAC__ogg_decoder_aspect_flush(aspect); - - if(aspect->use_first_serial_number) - aspect->need_serial_number = true; -} - -FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data) -{ - static const size_t OGG_BYTES_CHUNK = 8192; - const size_t 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) { - size_t n = bytes_requested - *bytes; - if ((size_t)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] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE) { - const FLAC__byte *b = aspect->working_packet.packet; - const unsigned header_length = - FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH + - FLAC__OGG_MAPPING_MAGIC_LENGTH + - FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH + - FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH + - FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH; - if (aspect->working_packet.bytes < (long)header_length) - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC; - b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH; - if (memcmp(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH)) - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC; - b += FLAC__OGG_MAPPING_MAGIC_LENGTH; - aspect->version_major = (unsigned)(*b); - b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH; - aspect->version_minor = (unsigned)(*b); - if (aspect->version_major != 1) - return FLAC__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 FLAC__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 size_t 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 FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR; - } - else { - size_t ogg_bytes_read = ogg_bytes_to_read; - - switch(read_callback(decoder, (FLAC__byte*)oggbuf, &ogg_bytes_read, client_data)) { - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK: - break; - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM: - aspect->end_of_stream = true; - break; - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT: - return FLAC__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 FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR; - } - } - } - else { /* ret < 0 */ - /* lost sync, bail out */ - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC; - } - } - } - - if (aspect->end_of_stream && *bytes == 0) { - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM; - } - - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK; -} diff --git a/src/lib/dl/ext/flac/ogg_encoder_aspect.c b/src/lib/dl/ext/flac/ogg_encoder_aspect.c deleted file mode 100755 index 5041168c..00000000 --- a/src/lib/dl/ext/flac/ogg_encoder_aspect.c +++ /dev/null @@ -1,227 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include /* for memset() */ -#include "flac/assert.h" -#include "private/ogg_encoder_aspect.h" -#include "private/ogg_mapping.h" - -static const FLAC__byte FLAC__OGG_MAPPING_VERSION_MAJOR = 1; -static const FLAC__byte FLAC__OGG_MAPPING_VERSION_MINOR = 0; - -/*********************************************************************** - * - * Public class methods - * - ***********************************************************************/ - -FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__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 FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect) -{ - (void)ogg_stream_clear(&aspect->stream_state); - /*@@@ what about the page? */ -} - -void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value) -{ - aspect->serial_number = value; -} - -FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value) -{ - if(value < (1u << FLAC__OGG_MAPPING_NUM_HEADERS_LEN)) { - aspect->num_metadata = value; - return true; - } - else - return false; -} - -void FLAC__ogg_encoder_aspect_set_defaults(FLAC__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 FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__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[ - FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH + - FLAC__OGG_MAPPING_MAGIC_LENGTH + - FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH + - FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH + - FLAC__OGG_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 = FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE; - b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH; - /* add 'FLAC' mapping magic */ - memcpy(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH); - b += FLAC__OGG_MAPPING_MAGIC_LENGTH; - /* add Ogg FLAC mapping major version number */ - memcpy(b, &FLAC__OGG_MAPPING_VERSION_MAJOR, FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH); - b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH; - /* add Ogg FLAC mapping minor version number */ - memcpy(b, &FLAC__OGG_MAPPING_VERSION_MINOR, FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH); - b += FLAC__OGG_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(is_last_block) { - /* we used to check: - * FLAC__ASSERT(total_samples_estimate == 0 || total_samples_estimate == aspect->samples_written + samples); - * but it's really not useful since total_samples_estimate is an estimate and can be inexact - */ - 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/src/lib/dl/ext/flac/ogg_helper.c b/src/lib/dl/ext/flac/ogg_helper.c deleted file mode 100755 index e64c4911..00000000 --- a/src/lib/dl/ext/flac/ogg_helper.c +++ /dev/null @@ -1,209 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include /* for malloc() */ -#include /* for memcmp(), memcpy() */ -#include "flac/assert.h" -#include "share/alloc.h" -#include "private/ogg_helper.h" -#include "protected/stream_encoder.h" - - -static FLAC__bool full_read_(FLAC__StreamEncoder *encoder, FLAC__byte *buffer, size_t bytes, FLAC__StreamEncoderReadCallback read_callback, void *client_data) -{ - while(bytes > 0) { - size_t bytes_read = bytes; - switch(read_callback(encoder, buffer, &bytes_read, client_data)) { - case FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE: - bytes -= bytes_read; - buffer += bytes_read; - break; - case FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM: - if(bytes_read == 0) { - encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR; - return false; - } - bytes -= bytes_read; - buffer += bytes_read; - break; - case FLAC__STREAM_ENCODER_READ_STATUS_ABORT: - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return false; - case FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED: - return false; - default: - /* double protection: */ - FLAC__ASSERT(0); - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_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(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderReadCallback 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__StreamEncoderSeekStatus seek_status; - - 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(0 == seek_callback) - return false; - if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) { - if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR) - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return false; - } - - /* allocate space for the page header */ - if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN))) { - encoder->protected_->state = FLAC__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 = FLAC__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 = FLAC__STREAM_ENCODER_OGG_ERROR; - return false; - } - } - - page->body_len = 255 * i + page->header[i + OGG_HEADER_FIXED_PORTION_LEN]; - } - - /* allocate space for the page body */ - if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len))) { - encoder->protected_->state = FLAC__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 = FLAC__STREAM_ENCODER_OGG_ERROR; - return false; - } - - return true; -} - -FLAC__bool simple_ogg_page__set_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderWriteCallback write_callback, void *client_data) -{ - FLAC__StreamEncoderSeekStatus seek_status; - - 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(0 == seek_callback) - return false; - if((seek_status = seek_callback((FLAC__StreamEncoder*)encoder, position, client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) { - if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR) - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return false; - } - - ogg_page_checksum_set(page); - - /* re-write the page */ - if(write_callback((FLAC__StreamEncoder*)encoder, page->header, page->header_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return false; - } - if(write_callback((FLAC__StreamEncoder*)encoder, page->body, page->body_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return false; - } - - return true; -} diff --git a/src/lib/dl/ext/flac/ogg_mapping.c b/src/lib/dl/ext/flac/ogg_mapping.c deleted file mode 100755 index 51b35de5..00000000 --- a/src/lib/dl/ext/flac/ogg_mapping.c +++ /dev/null @@ -1,47 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include "private/ogg_mapping.h" - -const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */ - -const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE = 0x7f; - -const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC = (const FLAC__byte * const)"FLAC"; - -const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */ -const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */ - -const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */ diff --git a/src/lib/dl/ext/flac/operations.c b/src/lib/dl/ext/flac/operations.c deleted file mode 100755 index 54774bf6..00000000 --- a/src/lib/dl/ext/flac/operations.c +++ /dev/null @@ -1,682 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include -#endif - -#include "operations.h" -#include "usage.h" -#include "utils.h" -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include "share/alloc.h" -#include "share/grabbag.h" -#include -#include -#include -#include "operations_shorthand.h" - -static void show_version(void); -static FLAC__bool do_major_operation(const CommandLineOptions *options); -static FLAC__bool do_major_operation_on_file(const char *filename, const CommandLineOptions *options); -static FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain *chain, const CommandLineOptions *options); -static FLAC__bool do_major_operation__append(FLAC__Metadata_Chain *chain, const CommandLineOptions *options); -static FLAC__bool do_major_operation__remove(FLAC__Metadata_Chain *chain, const CommandLineOptions *options); -static FLAC__bool do_major_operation__remove_all(FLAC__Metadata_Chain *chain, const CommandLineOptions *options); -static FLAC__bool do_shorthand_operations(const CommandLineOptions *options); -static FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLineOptions *options); -static FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool utf8_convert); -static FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned num_files, FLAC__bool preserve_modtime); -static FLAC__bool do_shorthand_operation__add_padding(const char *filename, FLAC__Metadata_Chain *chain, unsigned length, FLAC__bool *needs_write); - -static FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMetadata *block, unsigned block_number); -static void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned block_number, FLAC__bool raw, FLAC__bool hexdump_application); - -/* from operations_shorthand_seektable.c */ -extern FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Metadata_Chain *chain, const char *specification, FLAC__bool *needs_write); - -/* from operations_shorthand_streaminfo.c */ -extern FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); - -/* from operations_shorthand_vorbiscomment.c */ -extern FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw); - -/* from operations_shorthand_cuesheet.c */ -extern FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); - -/* from operations_shorthand_picture.c */ -extern FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); - - -FLAC__bool do_operations(const CommandLineOptions *options) -{ - FLAC__bool ok = true; - - if(options->show_long_help) { - long_usage(0); - } - if(options->show_version) { - show_version(); - } - else if(options->args.checks.num_major_ops > 0) { - FLAC__ASSERT(options->args.checks.num_shorthand_ops == 0); - FLAC__ASSERT(options->args.checks.num_major_ops == 1); - FLAC__ASSERT(options->args.checks.num_major_ops == options->ops.num_operations); - ok = do_major_operation(options); - } - else if(options->args.checks.num_shorthand_ops > 0) { - FLAC__ASSERT(options->args.checks.num_shorthand_ops == options->ops.num_operations); - ok = do_shorthand_operations(options); - } - - return ok; -} - -/* - * local routines - */ - -void show_version(void) -{ - printf("metaflac %s\n", FLAC__VERSION_STRING); -} - -FLAC__bool do_major_operation(const CommandLineOptions *options) -{ - unsigned i; - FLAC__bool ok = true; - - /* to die after first error, v--- add '&& ok' here */ - for(i = 0; i < options->num_files; i++) - ok &= do_major_operation_on_file(options->filenames[i], options); - - return ok; -} - -FLAC__bool do_major_operation_on_file(const char *filename, const CommandLineOptions *options) -{ - FLAC__bool ok = true, needs_write = false, is_ogg = false; - FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new(); - - if(0 == chain) - die("out of memory allocating chain"); - - /*@@@@ lame way of guessing the file type */ - if(strlen(filename) >= 4 && (0 == strcmp(filename+strlen(filename)-4, ".oga") || 0 == strcmp(filename+strlen(filename)-4, ".ogg"))) - is_ogg = true; - - if(! (is_ogg? FLAC__metadata_chain_read_ogg(chain, filename) : FLAC__metadata_chain_read(chain, filename)) ) { - print_error_with_chain_status(chain, "%s: ERROR: reading metadata", filename); - FLAC__metadata_chain_delete(chain); - return false; - } - - switch(options->ops.operations[0].type) { - case OP__LIST: - ok = do_major_operation__list(options->prefix_with_filename? filename : 0, chain, options); - break; - case OP__APPEND: - ok = do_major_operation__append(chain, options); - needs_write = true; - break; - case OP__REMOVE: - ok = do_major_operation__remove(chain, options); - needs_write = true; - break; - case OP__REMOVE_ALL: - ok = do_major_operation__remove_all(chain, options); - needs_write = true; - break; - case OP__MERGE_PADDING: - FLAC__metadata_chain_merge_padding(chain); - needs_write = true; - break; - case OP__SORT_PADDING: - FLAC__metadata_chain_sort_padding(chain); - needs_write = true; - break; - default: - FLAC__ASSERT(0); - return false; - } - - if(ok && needs_write) { - if(options->use_padding) - FLAC__metadata_chain_sort_padding(chain); - ok = FLAC__metadata_chain_write(chain, options->use_padding, options->preserve_modtime); - if(!ok) - print_error_with_chain_status(chain, "%s: ERROR: writing FLAC file", filename); - } - - FLAC__metadata_chain_delete(chain); - - return ok; -} - -FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain *chain, const CommandLineOptions *options) -{ - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - FLAC__StreamMetadata *block; - FLAC__bool ok = true; - unsigned block_number; - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - block_number = 0; - do { - block = FLAC__metadata_iterator_get_block(iterator); - ok &= (0 != block); - if(!ok) - fprintf(stderr, "%s: ERROR: couldn't get block from chain\n", filename); - else if(passes_filter(options, FLAC__metadata_iterator_get_block(iterator), block_number)) - write_metadata(filename, block, block_number, !options->utf8_convert, options->application_data_format_is_hexdump); - block_number++; - } while(ok && FLAC__metadata_iterator_next(iterator)); - - FLAC__metadata_iterator_delete(iterator); - - return ok; -} - -FLAC__bool do_major_operation__append(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) -{ - (void) chain, (void) options; - fprintf(stderr, "ERROR: --append not implemented yet\n"); - return false; -} - -FLAC__bool do_major_operation__remove(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) -{ - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - FLAC__bool ok = true; - unsigned block_number; - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - block_number = 0; - while(ok && FLAC__metadata_iterator_next(iterator)) { - block_number++; - if(passes_filter(options, FLAC__metadata_iterator_get_block(iterator), block_number)) { - ok &= FLAC__metadata_iterator_delete_block(iterator, options->use_padding); - if(options->use_padding) - ok &= FLAC__metadata_iterator_next(iterator); - } - } - - FLAC__metadata_iterator_delete(iterator); - - return ok; -} - -FLAC__bool do_major_operation__remove_all(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) -{ - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - FLAC__bool ok = true; - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - while(ok && FLAC__metadata_iterator_next(iterator)) { - ok &= FLAC__metadata_iterator_delete_block(iterator, options->use_padding); - if(options->use_padding) - ok &= FLAC__metadata_iterator_next(iterator); - } - - FLAC__metadata_iterator_delete(iterator); - - return ok; -} - -FLAC__bool do_shorthand_operations(const CommandLineOptions *options) -{ - unsigned i; - FLAC__bool ok = true; - - /* to die after first error, v--- add '&& ok' here */ - for(i = 0; i < options->num_files; i++) - ok &= do_shorthand_operations_on_file(options->filenames[i], options); - - /* check if OP__ADD_REPLAY_GAIN requested */ - if(ok && options->num_files > 0) { - for(i = 0; i < options->ops.num_operations; i++) { - if(options->ops.operations[i].type == OP__ADD_REPLAY_GAIN) - ok = do_shorthand_operation__add_replay_gain(options->filenames, options->num_files, options->preserve_modtime); - } - } - - return ok; -} - -FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLineOptions *options) -{ - unsigned i; - FLAC__bool ok = true, needs_write = false, use_padding = options->use_padding; - FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new(); - - if(0 == chain) - die("out of memory allocating chain"); - - if(!FLAC__metadata_chain_read(chain, filename)) { - print_error_with_chain_status(chain, "%s: ERROR: reading metadata", filename); - return false; - } - - for(i = 0; i < options->ops.num_operations && ok; i++) { - /* - * Do OP__ADD_SEEKPOINT last to avoid decoding twice if both - * --add-seekpoint and --import-cuesheet-from are used. - */ - if(options->ops.operations[i].type != OP__ADD_SEEKPOINT) - ok &= do_shorthand_operation(filename, options->prefix_with_filename, chain, &options->ops.operations[i], &needs_write, options->utf8_convert); - - /* The following seems counterintuitive but the meaning - * of 'use_padding' is 'try to keep the overall metadata - * to its original size, adding or truncating extra - * padding if necessary' which is why we need to turn it - * off in this case. If we don't, the extra padding block - * will just be truncated. - */ - if(options->ops.operations[i].type == OP__ADD_PADDING) - use_padding = false; - } - - /* - * Do OP__ADD_SEEKPOINT last to avoid decoding twice if both - * --add-seekpoint and --import-cuesheet-from are used. - */ - for(i = 0; i < options->ops.num_operations && ok; i++) { - if(options->ops.operations[i].type == OP__ADD_SEEKPOINT) - ok &= do_shorthand_operation(filename, options->prefix_with_filename, chain, &options->ops.operations[i], &needs_write, options->utf8_convert); - } - - if(ok && needs_write) { - if(use_padding) - FLAC__metadata_chain_sort_padding(chain); - ok = FLAC__metadata_chain_write(chain, use_padding, options->preserve_modtime); - if(!ok) - print_error_with_chain_status(chain, "%s: ERROR: writing FLAC file", filename); - } - - FLAC__metadata_chain_delete(chain); - - return ok; -} - -FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool utf8_convert) -{ - FLAC__bool ok = true; - - switch(operation->type) { - case OP__SHOW_MD5SUM: - case OP__SHOW_MIN_BLOCKSIZE: - case OP__SHOW_MAX_BLOCKSIZE: - case OP__SHOW_MIN_FRAMESIZE: - case OP__SHOW_MAX_FRAMESIZE: - case OP__SHOW_SAMPLE_RATE: - case OP__SHOW_CHANNELS: - case OP__SHOW_BPS: - case OP__SHOW_TOTAL_SAMPLES: - case OP__SET_MD5SUM: - case OP__SET_MIN_BLOCKSIZE: - case OP__SET_MAX_BLOCKSIZE: - case OP__SET_MIN_FRAMESIZE: - case OP__SET_MAX_FRAMESIZE: - case OP__SET_SAMPLE_RATE: - case OP__SET_CHANNELS: - case OP__SET_BPS: - case OP__SET_TOTAL_SAMPLES: - ok = do_shorthand_operation__streaminfo(filename, prefix_with_filename, chain, operation, needs_write); - break; - case OP__SHOW_VC_VENDOR: - case OP__SHOW_VC_FIELD: - case OP__REMOVE_VC_ALL: - case OP__REMOVE_VC_FIELD: - case OP__REMOVE_VC_FIRSTFIELD: - case OP__SET_VC_FIELD: - case OP__IMPORT_VC_FROM: - case OP__EXPORT_VC_TO: - ok = do_shorthand_operation__vorbis_comment(filename, prefix_with_filename, chain, operation, needs_write, !utf8_convert); - break; - case OP__IMPORT_CUESHEET_FROM: - case OP__EXPORT_CUESHEET_TO: - ok = do_shorthand_operation__cuesheet(filename, chain, operation, needs_write); - break; - case OP__IMPORT_PICTURE_FROM: - case OP__EXPORT_PICTURE_TO: - ok = do_shorthand_operation__picture(filename, chain, operation, needs_write); - break; - case OP__ADD_SEEKPOINT: - ok = do_shorthand_operation__add_seekpoints(filename, chain, operation->argument.add_seekpoint.specification, needs_write); - break; - case OP__ADD_REPLAY_GAIN: - /* this command is always executed last */ - ok = true; - break; - case OP__ADD_PADDING: - ok = do_shorthand_operation__add_padding(filename, chain, operation->argument.add_padding.length, needs_write); - break; - default: - ok = false; - FLAC__ASSERT(0); - break; - }; - - return ok; -} - -FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned num_files, FLAC__bool preserve_modtime) -{ - FLAC__StreamMetadata streaminfo; - float *title_gains = 0, *title_peaks = 0; - float album_gain, album_peak; - unsigned sample_rate = 0; - unsigned bits_per_sample = 0; - unsigned channels = 0; - unsigned i; - const char *error; - FLAC__bool first = true; - - FLAC__ASSERT(num_files > 0); - - for(i = 0; i < num_files; i++) { - FLAC__ASSERT(0 != filenames[i]); - if(!FLAC__metadata_get_streaminfo(filenames[i], &streaminfo)) { - fprintf(stderr, "%s: ERROR: can't open file or get STREAMINFO block\n", filenames[i]); - return false; - } - if(first) { - first = false; - sample_rate = streaminfo.data.stream_info.sample_rate; - bits_per_sample = streaminfo.data.stream_info.bits_per_sample; - channels = streaminfo.data.stream_info.channels; - } - else { - if(sample_rate != streaminfo.data.stream_info.sample_rate) { - fprintf(stderr, "%s: ERROR: sample rate of %u Hz does not match previous files' %u Hz\n", filenames[i], streaminfo.data.stream_info.sample_rate, sample_rate); - return false; - } - if(bits_per_sample != streaminfo.data.stream_info.bits_per_sample) { - fprintf(stderr, "%s: ERROR: resolution of %u bps does not match previous files' %u bps\n", filenames[i], streaminfo.data.stream_info.bits_per_sample, bits_per_sample); - return false; - } - if(channels != streaminfo.data.stream_info.channels) { - fprintf(stderr, "%s: ERROR: # channels (%u) does not match previous files' (%u)\n", filenames[i], streaminfo.data.stream_info.channels, channels); - return false; - } - } - if(!grabbag__replaygain_is_valid_sample_frequency(sample_rate)) { - fprintf(stderr, "%s: ERROR: sample rate of %u Hz is not supported\n", filenames[i], sample_rate); - return false; - } - if(channels != 1 && channels != 2) { - fprintf(stderr, "%s: ERROR: # of channels (%u) is not supported, must be 1 or 2\n", filenames[i], channels); - return false; - } - } - FLAC__ASSERT(bits_per_sample >= FLAC__MIN_BITS_PER_SAMPLE && bits_per_sample <= FLAC__MAX_BITS_PER_SAMPLE); - - if(!grabbag__replaygain_init(sample_rate)) { - FLAC__ASSERT(0); - /* double protection */ - fprintf(stderr, "internal error\n"); - return false; - } - - if( - 0 == (title_gains = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) || - 0 == (title_peaks = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) - ) - die("out of memory allocating space for title gains/peaks"); - - for(i = 0; i < num_files; i++) { - if(0 != (error = grabbag__replaygain_analyze_file(filenames[i], title_gains+i, title_peaks+i))) { - fprintf(stderr, "%s: ERROR: during analysis (%s)\n", filenames[i], error); - free(title_gains); - free(title_peaks); - return false; - } - } - grabbag__replaygain_get_album(&album_gain, &album_peak); - - for(i = 0; i < num_files; i++) { - if(0 != (error = grabbag__replaygain_store_to_file(filenames[i], album_gain, album_peak, title_gains[i], title_peaks[i], preserve_modtime))) { - fprintf(stderr, "%s: ERROR: writing tags (%s)\n", filenames[i], error); - free(title_gains); - free(title_peaks); - return false; - } - } - - free(title_gains); - free(title_peaks); - return true; -} - -FLAC__bool do_shorthand_operation__add_padding(const char *filename, FLAC__Metadata_Chain *chain, unsigned length, FLAC__bool *needs_write) -{ - FLAC__StreamMetadata *padding = 0; - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - while(FLAC__metadata_iterator_next(iterator)) - ; - - padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); - if(0 == padding) - die("out of memory allocating PADDING block"); - - padding->length = length; - - if(!FLAC__metadata_iterator_insert_block_after(iterator, padding)) { - print_error_with_chain_status(chain, "%s: ERROR: adding new PADDING block to metadata", filename); - FLAC__metadata_object_delete(padding); - FLAC__metadata_iterator_delete(iterator); - return false; - } - - FLAC__metadata_iterator_delete(iterator); - *needs_write = true; - return true; -} - -FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMetadata *block, unsigned block_number) -{ - unsigned i, j; - FLAC__bool matches_number = false, matches_type = false; - FLAC__bool has_block_number_arg = false; - - for(i = 0; i < options->args.num_arguments; i++) { - if(options->args.arguments[i].type == ARG__BLOCK_TYPE || options->args.arguments[i].type == ARG__EXCEPT_BLOCK_TYPE) { - for(j = 0; j < options->args.arguments[i].value.block_type.num_entries; j++) { - if(options->args.arguments[i].value.block_type.entries[j].type == block->type) { - if(block->type != FLAC__METADATA_TYPE_APPLICATION || !options->args.arguments[i].value.block_type.entries[j].filter_application_by_id || 0 == memcmp(options->args.arguments[i].value.block_type.entries[j].application_id, block->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)) - matches_type = true; - } - } - } - else if(options->args.arguments[i].type == ARG__BLOCK_NUMBER) { - has_block_number_arg = true; - for(j = 0; j < options->args.arguments[i].value.block_number.num_entries; j++) { - if(options->args.arguments[i].value.block_number.entries[j] == block_number) - matches_number = true; - } - } - } - - if(!has_block_number_arg) - matches_number = true; - - if(options->args.checks.has_block_type) { - FLAC__ASSERT(!options->args.checks.has_except_block_type); - } - else if(options->args.checks.has_except_block_type) - matches_type = !matches_type; - else - matches_type = true; - - return matches_number && matches_type; -} - -void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned block_number, FLAC__bool raw, FLAC__bool hexdump_application) -{ - unsigned i, j; - -/*@@@ yuck, should do this with a varargs function or something: */ -#define PPR if(filename)printf("%s:",filename); - PPR; printf("METADATA block #%u\n", block_number); - PPR; printf(" type: %u (%s)\n", (unsigned)block->type, block->type < FLAC__METADATA_TYPE_UNDEFINED? FLAC__MetadataTypeString[block->type] : "UNKNOWN"); - PPR; printf(" is last: %s\n", block->is_last? "true":"false"); - PPR; printf(" length: %u\n", block->length); - - switch(block->type) { - case FLAC__METADATA_TYPE_STREAMINFO: - PPR; printf(" minimum blocksize: %u samples\n", block->data.stream_info.min_blocksize); - PPR; printf(" maximum blocksize: %u samples\n", block->data.stream_info.max_blocksize); - PPR; printf(" minimum framesize: %u bytes\n", block->data.stream_info.min_framesize); - PPR; printf(" maximum framesize: %u bytes\n", block->data.stream_info.max_framesize); - PPR; printf(" sample_rate: %u Hz\n", block->data.stream_info.sample_rate); - PPR; printf(" channels: %u\n", block->data.stream_info.channels); - PPR; printf(" bits-per-sample: %u\n", block->data.stream_info.bits_per_sample); -#ifdef _MSC_VER - PPR; printf(" total samples: %I64u\n", block->data.stream_info.total_samples); -#else - PPR; printf(" total samples: %llu\n", (unsigned long long)block->data.stream_info.total_samples); -#endif - PPR; printf(" MD5 signature: "); - for(i = 0; i < 16; i++) { - printf("%02x", (unsigned)block->data.stream_info.md5sum[i]); - } - printf("\n"); - break; - case FLAC__METADATA_TYPE_PADDING: - /* nothing to print */ - break; - case FLAC__METADATA_TYPE_APPLICATION: - PPR; printf(" application ID: "); - for(i = 0; i < 4; i++) - printf("%02x", block->data.application.id[i]); - printf("\n"); - PPR; printf(" data contents:\n"); - if(0 != block->data.application.data) { - if(hexdump_application) - hexdump(filename, block->data.application.data, block->length - FLAC__STREAM_METADATA_HEADER_LENGTH, " "); - else - (void) local_fwrite(block->data.application.data, 1, block->length - FLAC__STREAM_METADATA_HEADER_LENGTH, stdout); - } - break; - case FLAC__METADATA_TYPE_SEEKTABLE: - PPR; printf(" seek points: %u\n", block->data.seek_table.num_points); - for(i = 0; i < block->data.seek_table.num_points; i++) { - if(block->data.seek_table.points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) { -#ifdef _MSC_VER - PPR; printf(" point %u: sample_number=%I64u, stream_offset=%I64u, frame_samples=%u\n", i, block->data.seek_table.points[i].sample_number, block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples); -#else - PPR; printf(" point %u: sample_number=%llu, stream_offset=%llu, frame_samples=%u\n", i, (unsigned long long)block->data.seek_table.points[i].sample_number, (unsigned long long)block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples); -#endif - } - else { - PPR; printf(" point %u: PLACEHOLDER\n", i); - } - } - break; - case FLAC__METADATA_TYPE_VORBIS_COMMENT: - PPR; printf(" vendor string: "); - write_vc_field(0, &block->data.vorbis_comment.vendor_string, raw, stdout); - PPR; printf(" comments: %u\n", block->data.vorbis_comment.num_comments); - for(i = 0; i < block->data.vorbis_comment.num_comments; i++) { - PPR; printf(" comment[%u]: ", i); - write_vc_field(0, &block->data.vorbis_comment.comments[i], raw, stdout); - } - break; - case FLAC__METADATA_TYPE_CUESHEET: - PPR; printf(" media catalog number: %s\n", block->data.cue_sheet.media_catalog_number); -#ifdef _MSC_VER - PPR; printf(" lead-in: %I64u\n", block->data.cue_sheet.lead_in); -#else - PPR; printf(" lead-in: %llu\n", (unsigned long long)block->data.cue_sheet.lead_in); -#endif - PPR; printf(" is CD: %s\n", block->data.cue_sheet.is_cd? "true":"false"); - PPR; printf(" number of tracks: %u\n", block->data.cue_sheet.num_tracks); - for(i = 0; i < block->data.cue_sheet.num_tracks; i++) { - const FLAC__StreamMetadata_CueSheet_Track *track = block->data.cue_sheet.tracks+i; - const FLAC__bool is_last = (i == block->data.cue_sheet.num_tracks-1); - const FLAC__bool is_leadout = is_last && track->num_indices == 0; - PPR; printf(" track[%u]\n", i); -#ifdef _MSC_VER - PPR; printf(" offset: %I64u\n", track->offset); -#else - PPR; printf(" offset: %llu\n", (unsigned long long)track->offset); -#endif - if(is_last) { - PPR; printf(" number: %u (%s)\n", (unsigned)track->number, is_leadout? "LEAD-OUT" : "INVALID"); - } - else { - PPR; printf(" number: %u\n", (unsigned)track->number); - } - if(!is_leadout) { - PPR; printf(" ISRC: %s\n", track->isrc); - PPR; printf(" type: %s\n", track->type == 1? "DATA" : "AUDIO"); - PPR; printf(" pre-emphasis: %s\n", track->pre_emphasis? "true":"false"); - PPR; printf(" number of index points: %u\n", track->num_indices); - for(j = 0; j < track->num_indices; j++) { - const FLAC__StreamMetadata_CueSheet_Index *index = track->indices+j; - PPR; printf(" index[%u]\n", j); -#ifdef _MSC_VER - PPR; printf(" offset: %I64u\n", index->offset); -#else - PPR; printf(" offset: %llu\n", (unsigned long long)index->offset); -#endif - PPR; printf(" number: %u\n", (unsigned)index->number); - } - } - } - break; - case FLAC__METADATA_TYPE_PICTURE: - PPR; printf(" type: %u (%s)\n", block->data.picture.type, block->data.picture.type < FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED? FLAC__StreamMetadata_Picture_TypeString[block->data.picture.type] : "UNDEFINED"); - PPR; printf(" MIME type: %s\n", block->data.picture.mime_type); - PPR; printf(" description: %s\n", block->data.picture.description); - PPR; printf(" width: %u\n", (unsigned)block->data.picture.width); - PPR; printf(" height: %u\n", (unsigned)block->data.picture.height); - PPR; printf(" depth: %u\n", (unsigned)block->data.picture.depth); - PPR; printf(" colors: %u%s\n", (unsigned)block->data.picture.colors, block->data.picture.colors? "" : " (unindexed)"); - PPR; printf(" data length: %u\n", (unsigned)block->data.picture.data_length); - PPR; printf(" data:\n"); - if(0 != block->data.picture.data) - hexdump(filename, block->data.picture.data, block->data.picture.data_length, " "); - break; - default: - PPR; printf(" data contents:\n"); - if(0 != block->data.unknown.data) - hexdump(filename, block->data.unknown.data, block->length, " "); - break; - } -#undef PPR -} diff --git a/src/lib/dl/ext/flac/operations.h b/src/lib/dl/ext/flac/operations.h deleted file mode 100755 index b5144a36..00000000 --- a/src/lib/dl/ext/flac/operations.h +++ /dev/null @@ -1,26 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 metaflac__operations_h -#define metaflac__operations_h - -#include "options.h" - -FLAC__bool do_operations(const CommandLineOptions *options); - -#endif diff --git a/src/lib/dl/ext/flac/operations_shorthand.h b/src/lib/dl/ext/flac/operations_shorthand.h deleted file mode 100755 index 112c079b..00000000 --- a/src/lib/dl/ext/flac/operations_shorthand.h +++ /dev/null @@ -1,25 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 "options.h" - -FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); -FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); -FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Metadata_Chain *chain, const char *specification, FLAC__bool *needs_write); -FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write); -FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw); diff --git a/src/lib/dl/ext/flac/operations_shorthand_cuesheet.c b/src/lib/dl/ext/flac/operations_shorthand_cuesheet.c deleted file mode 100755 index 14912c11..00000000 --- a/src/lib/dl/ext/flac/operations_shorthand_cuesheet.c +++ /dev/null @@ -1,217 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include -#endif - -#include -#include /* for snprintf() */ -#include -#include "options.h" -#include "utils.h" -#include "FLAC/assert.h" -#include "share/grabbag.h" -#include "operations_shorthand.h" - -static FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link); -static FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cuesheet, const char *cs_filename); - -FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write) -{ - FLAC__bool ok = true; - FLAC__StreamMetadata *cuesheet = 0; - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - FLAC__uint64 lead_out_offset = 0; - FLAC__bool is_cdda = false; - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - do { - FLAC__StreamMetadata *block = FLAC__metadata_iterator_get_block(iterator); - if(block->type == FLAC__METADATA_TYPE_STREAMINFO) { - lead_out_offset = block->data.stream_info.total_samples; - if(lead_out_offset == 0) { - fprintf(stderr, "%s: ERROR: FLAC file must have total_samples set in STREAMINFO in order to import/export cuesheet\n", filename); - FLAC__metadata_iterator_delete(iterator); - return false; - } - is_cdda = (block->data.stream_info.channels == 1 || block->data.stream_info.channels == 2) && (block->data.stream_info.bits_per_sample == 16) && (block->data.stream_info.sample_rate == 44100); - } - else if(block->type == FLAC__METADATA_TYPE_CUESHEET) - cuesheet = block; - } while(FLAC__metadata_iterator_next(iterator)); - - if(lead_out_offset == 0) { - fprintf(stderr, "%s: ERROR: FLAC stream has no STREAMINFO block\n", filename); - FLAC__metadata_iterator_delete(iterator); - return false; - } - - switch(operation->type) { - case OP__IMPORT_CUESHEET_FROM: - if(0 != cuesheet) { - fprintf(stderr, "%s: ERROR: FLAC file already has CUESHEET block\n", filename); - ok = false; - } - else { - ok = import_cs_from(filename, &cuesheet, operation->argument.import_cuesheet_from.filename, needs_write, lead_out_offset, is_cdda, operation->argument.import_cuesheet_from.add_seekpoint_link); - if(ok) { - /* append CUESHEET block */ - while(FLAC__metadata_iterator_next(iterator)) - ; - if(!FLAC__metadata_iterator_insert_block_after(iterator, cuesheet)) { - print_error_with_chain_status(chain, "%s: ERROR: adding new CUESHEET block to metadata", filename); - FLAC__metadata_object_delete(cuesheet); - ok = false; - } - } - } - break; - case OP__EXPORT_CUESHEET_TO: - if(0 == cuesheet) { - fprintf(stderr, "%s: ERROR: FLAC file has no CUESHEET block\n", filename); - ok = false; - } - else - ok = export_cs_to(filename, cuesheet, operation->argument.filename.value); - break; - default: - ok = false; - FLAC__ASSERT(0); - break; - }; - - FLAC__metadata_iterator_delete(iterator); - return ok; -} - -/* - * local routines - */ - -FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link) -{ - FILE *f; - const char *error_message; - char **seekpoint_specification = add_seekpoint_link? &(add_seekpoint_link->specification) : 0; - unsigned last_line_read; - - if(0 == cs_filename || strlen(cs_filename) == 0) { - fprintf(stderr, "%s: ERROR: empty import file name\n", filename); - return false; - } - if(0 == strcmp(cs_filename, "-")) - f = stdin; - else - f = fopen(cs_filename, "r"); - - if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, cs_filename, strerror(errno)); - return false; - } - - *cuesheet = grabbag__cuesheet_parse(f, &error_message, &last_line_read, is_cdda, lead_out_offset); - - if(f != stdin) - fclose(f); - - if(0 == *cuesheet) { - fprintf(stderr, "%s: ERROR: while parsing cuesheet \"%s\" on line %u: %s\n", filename, cs_filename, last_line_read, error_message); - return false; - } - - if(!FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/false, &error_message)) { - fprintf(stderr, "%s: ERROR parsing cuesheet \"%s\": %s\n", filename, cs_filename, error_message); - return false; - } - - /* if we're expecting CDDA, warn about non-compliance */ - if(is_cdda && !FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/true, &error_message)) { - fprintf(stderr, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", filename, cs_filename, error_message); - (*cuesheet)->data.cue_sheet.is_cd = false; - } - - /* add seekpoints for each index point if required */ - if(0 != seekpoint_specification) { - char spec[128]; - unsigned track, index; - const FLAC__StreamMetadata_CueSheet *cs = &(*cuesheet)->data.cue_sheet; - if(0 == *seekpoint_specification) - *seekpoint_specification = local_strdup(""); - for(track = 0; track < cs->num_tracks; track++) { - const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+track; - for(index = 0; index < tr->num_indices; index++) { -#ifdef _MSC_VER - sprintf(spec, "%I64u;", tr->offset + tr->indices[index].offset); -#else - sprintf(spec, "%llu;", (unsigned long long)(tr->offset + tr->indices[index].offset)); -#endif - local_strcat(seekpoint_specification, spec); - } - } - } - - *needs_write = true; - return true; -} - -FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cuesheet, const char *cs_filename) -{ - FILE *f; - char *ref = 0; - size_t reflen; - - if(0 == cs_filename || strlen(cs_filename) == 0) { - fprintf(stderr, "%s: ERROR: empty export file name\n", filename); - return false; - } - if(0 == strcmp(cs_filename, "-")) - f = stdout; - else - f = fopen(cs_filename, "w"); - - if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, cs_filename, strerror(errno)); - return false; - } - - reflen = strlen(filename) + 7 + 1; - if(0 == (ref = malloc(reflen))) { - fprintf(stderr, "%s: ERROR: allocating memory\n", filename); - return false; - } - -#if defined _MSC_VER || defined __MINGW32__ - _snprintf(ref, reflen, "\"%s\" FLAC", filename); -#else - snprintf(ref, reflen, "\"%s\" FLAC", filename); -#endif - - grabbag__cuesheet_emit(f, cuesheet, ref); - - free(ref); - - if(f != stdout) - fclose(f); - - return true; -} diff --git a/src/lib/dl/ext/flac/operations_shorthand_picture.c b/src/lib/dl/ext/flac/operations_shorthand_picture.c deleted file mode 100755 index 9045aaeb..00000000 --- a/src/lib/dl/ext/flac/operations_shorthand_picture.c +++ /dev/null @@ -1,173 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "options.h" -#include "utils.h" -#include "FLAC/assert.h" -#include "share/grabbag.h" /* for grabbag__picture_parse_specification() etc */ - -#include "operations_shorthand.h" - -static FLAC__bool import_pic_from(const char *filename, FLAC__StreamMetadata **picture, const char *specification, FLAC__bool *needs_write); -static FLAC__bool export_pic_to(const char *filename, const FLAC__StreamMetadata *picture, const char *pic_filename); - -FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write) -{ - FLAC__bool ok = true, has_type1 = false, has_type2 = false; - FLAC__StreamMetadata *picture = 0; - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - switch(operation->type) { - case OP__IMPORT_PICTURE_FROM: - ok = import_pic_from(filename, &picture, operation->argument.specification.value, needs_write); - if(ok) { - /* append PICTURE block */ - while(FLAC__metadata_iterator_next(iterator)) - ; - if(!FLAC__metadata_iterator_insert_block_after(iterator, picture)) { - print_error_with_chain_status(chain, "%s: ERROR: adding new PICTURE block to metadata", filename); - FLAC__metadata_object_delete(picture); - ok = false; - } - } - if(ok) { - /* check global PICTURE constraints (max 1 block each of type=1 and type=2) */ - while(FLAC__metadata_iterator_prev(iterator)) - ; - do { - FLAC__StreamMetadata *block = FLAC__metadata_iterator_get_block(iterator); - if(block->type == FLAC__METADATA_TYPE_PICTURE) { - if(block->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD) { - if(has_type1) { - print_error_with_chain_status(chain, "%s: ERROR: FLAC stream can only have one 32x32 standard icon (type=1) PICTURE block", filename); - ok = false; - } - has_type1 = true; - } - else if(block->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON) { - if(has_type2) { - print_error_with_chain_status(chain, "%s: ERROR: FLAC stream can only have one icon (type=2) PICTURE block", filename); - ok = false; - } - has_type2 = true; - } - } - } while(FLAC__metadata_iterator_next(iterator)); - } - break; - case OP__EXPORT_PICTURE_TO: - { - const Argument_BlockNumber *a = operation->argument.export_picture_to.block_number_link; - int block_number = (a && a->num_entries > 0)? (int)a->entries[0] : -1; - unsigned i = 0; - do { - FLAC__StreamMetadata *block = FLAC__metadata_iterator_get_block(iterator); - if(block->type == FLAC__METADATA_TYPE_PICTURE && (block_number < 0 || i == (unsigned)block_number)) - picture = block; - i++; - } while(FLAC__metadata_iterator_next(iterator) && 0 == picture); - if(0 == picture) { - if(block_number < 0) - fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block\n", filename); - else - fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block at block #%d\n", filename, block_number); - ok = false; - } - else - ok = export_pic_to(filename, picture, operation->argument.filename.value); - } - break; - default: - ok = false; - FLAC__ASSERT(0); - break; - }; - - FLAC__metadata_iterator_delete(iterator); - return ok; -} - -/* - * local routines - */ - -FLAC__bool import_pic_from(const char *filename, FLAC__StreamMetadata **picture, const char *specification, FLAC__bool *needs_write) -{ - const char *error_message; - - if(0 == specification || strlen(specification) == 0) { - fprintf(stderr, "%s: ERROR: empty picture specification\n", filename); - return false; - } - - *picture = grabbag__picture_parse_specification(specification, &error_message); - - if(0 == *picture) { - fprintf(stderr, "%s: ERROR: while parsing picture specification \"%s\": %s\n", filename, specification, error_message); - return false; - } - - if(!FLAC__format_picture_is_legal(&(*picture)->data.picture, &error_message)) { - fprintf(stderr, "%s: ERROR: new PICTURE block for \"%s\" is illegal: %s\n", filename, specification, error_message); - return false; - } - - *needs_write = true; - return true; -} - -FLAC__bool export_pic_to(const char *filename, const FLAC__StreamMetadata *picture, const char *pic_filename) -{ - FILE *f; - const FLAC__uint32 len = picture->data.picture.data_length; - - if(0 == pic_filename || strlen(pic_filename) == 0) { - fprintf(stderr, "%s: ERROR: empty export file name\n", filename); - return false; - } - if(0 == strcmp(pic_filename, "-")) - f = grabbag__file_get_binary_stdout(); - else - f = fopen(pic_filename, "wb"); - - if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, pic_filename, strerror(errno)); - return false; - } - - if(fwrite(picture->data.picture.data, 1, len, f) != len) { - fprintf(stderr, "%s: ERROR: writing PICTURE data to file\n", filename); - return false; - } - - if(f != stdout) - fclose(f); - - return true; -} diff --git a/src/lib/dl/ext/flac/operations_shorthand_seektable.c b/src/lib/dl/ext/flac/operations_shorthand_seektable.c deleted file mode 100755 index 4f4fb5d9..00000000 --- a/src/lib/dl/ext/flac/operations_shorthand_seektable.c +++ /dev/null @@ -1,217 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include -#endif - -#include "utils.h" -#include "FLAC/assert.h" -#include "FLAC/stream_decoder.h" -#include "FLAC/metadata.h" -#include "share/grabbag.h" -#include "operations_shorthand.h" - -static FLAC__bool populate_seekpoint_values(const char *filename, FLAC__StreamMetadata *block, FLAC__bool *needs_write); - -FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Metadata_Chain *chain, const char *specification, FLAC__bool *needs_write) -{ - FLAC__bool ok = true, found_seektable_block = false; - FLAC__StreamMetadata *block = 0; - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - FLAC__uint64 total_samples = 0; - unsigned sample_rate = 0; - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - do { - block = FLAC__metadata_iterator_get_block(iterator); - if(block->type == FLAC__METADATA_TYPE_STREAMINFO) { - sample_rate = block->data.stream_info.sample_rate; - total_samples = block->data.stream_info.total_samples; - } - else if(block->type == FLAC__METADATA_TYPE_SEEKTABLE) - found_seektable_block = true; - } while(!found_seektable_block && FLAC__metadata_iterator_next(iterator)); - - if(total_samples == 0) { - fprintf(stderr, "%s: ERROR: cannot add seekpoints because STREAMINFO block does not specify total_samples\n", filename); - return false; - } - - if(!found_seektable_block) { - /* create a new block */ - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE); - if(0 == block) - die("out of memory allocating SEEKTABLE block"); - while(FLAC__metadata_iterator_prev(iterator)) - ; - if(!FLAC__metadata_iterator_insert_block_after(iterator, block)) { - print_error_with_chain_status(chain, "%s: ERROR: adding new SEEKTABLE block to metadata", filename); - FLAC__metadata_object_delete(block); - return false; - } - /* 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_SEEKTABLE); - - if(!grabbag__seektable_convert_specification_to_template(specification, /*only_explicit_placeholders=*/false, total_samples, sample_rate, block, /*spec_has_real_points=*/0)) { - fprintf(stderr, "%s: ERROR (internal) preparing seektable with seekpoints\n", filename); - return false; - } - - ok = populate_seekpoint_values(filename, block, needs_write); - - if(ok) - (void) FLAC__format_seektable_sort(&block->data.seek_table); - - return ok; -} - -/* - * local routines - */ - -typedef struct { - FLAC__StreamMetadata_SeekTable *seektable_template; - FLAC__uint64 samples_written; - FLAC__uint64 audio_offset, last_offset; - unsigned first_seekpoint_to_check; - FLAC__bool error_occurred; - FLAC__StreamDecoderErrorStatus error_status; -} ClientData; - -static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - ClientData *cd = (ClientData*)client_data; - - (void)buffer; - FLAC__ASSERT(0 != cd); - - if(!cd->error_occurred) { - const unsigned blocksize = frame->header.blocksize; - const FLAC__uint64 frame_first_sample = cd->samples_written; - const FLAC__uint64 frame_last_sample = frame_first_sample + (FLAC__uint64)blocksize - 1; - FLAC__uint64 test_sample; - unsigned i; - for(i = cd->first_seekpoint_to_check; i < cd->seektable_template->num_points; i++) { - test_sample = cd->seektable_template->points[i].sample_number; - if(test_sample > frame_last_sample) { - break; - } - else if(test_sample >= frame_first_sample) { - cd->seektable_template->points[i].sample_number = frame_first_sample; - cd->seektable_template->points[i].stream_offset = cd->last_offset - cd->audio_offset; - cd->seektable_template->points[i].frame_samples = blocksize; - cd->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 { - cd->first_seekpoint_to_check++; - } - } - cd->samples_written += blocksize; - if(!FLAC__stream_decoder_get_decode_position(decoder, &cd->last_offset)) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; - } - else - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; -} - -static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - ClientData *cd = (ClientData*)client_data; - - (void)decoder; - FLAC__ASSERT(0 != cd); - - if(!cd->error_occurred) { /* don't let multiple errors overwrite the first one */ - cd->error_occurred = true; - cd->error_status = status; - } -} - -FLAC__bool populate_seekpoint_values(const char *filename, FLAC__StreamMetadata *block, FLAC__bool *needs_write) -{ - FLAC__StreamDecoder *decoder; - ClientData client_data; - FLAC__bool ok = true; - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_SEEKTABLE); - - client_data.seektable_template = &block->data.seek_table; - client_data.samples_written = 0; - /* client_data.audio_offset must be determined later */ - client_data.first_seekpoint_to_check = 0; - client_data.error_occurred = false; - - decoder = FLAC__stream_decoder_new(); - - if(0 == decoder) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) creating the decoder instance\n", filename); - return false; - } - - FLAC__stream_decoder_set_md5_checking(decoder, false); - FLAC__stream_decoder_set_metadata_ignore_all(decoder); - - if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, /*metadata_callback=*/0, error_callback_, &client_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) initializing the decoder instance (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - ok = false; - } - - if(ok && !FLAC__stream_decoder_process_until_end_of_metadata(decoder)) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - ok = false; - } - - if(ok && !FLAC__stream_decoder_get_decode_position(decoder, &client_data.audio_offset)) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file\n", filename); - ok = false; - } - client_data.last_offset = client_data.audio_offset; - - if(ok && !FLAC__stream_decoder_process_until_end_of_stream(decoder)) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - ok = false; - } - - if(ok && client_data.error_occurred) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%u:%s)\n", filename, (unsigned)client_data.error_status, FLAC__StreamDecoderErrorStatusString[client_data.error_status]); - ok = false; - } - - *needs_write = true; - FLAC__stream_decoder_delete(decoder); - return ok; -} diff --git a/src/lib/dl/ext/flac/operations_shorthand_streaminfo.c b/src/lib/dl/ext/flac/operations_shorthand_streaminfo.c deleted file mode 100755 index b4593f50..00000000 --- a/src/lib/dl/ext/flac/operations_shorthand_streaminfo.c +++ /dev/null @@ -1,129 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include -#endif - -#include "options.h" -#include "utils.h" -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include -#include "operations_shorthand.h" - -FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write) -{ - unsigned i; - FLAC__bool ok = true; - FLAC__StreamMetadata *block; - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - - if(0 == iterator) - die("out of memory allocating iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - block = FLAC__metadata_iterator_get_block(iterator); - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_STREAMINFO); - - if(prefix_with_filename) - printf("%s:", filename); - - switch(operation->type) { - case OP__SHOW_MD5SUM: - for(i = 0; i < 16; i++) - printf("%02x", block->data.stream_info.md5sum[i]); - printf("\n"); - break; - case OP__SHOW_MIN_BLOCKSIZE: - printf("%u\n", block->data.stream_info.min_blocksize); - break; - case OP__SHOW_MAX_BLOCKSIZE: - printf("%u\n", block->data.stream_info.max_blocksize); - break; - case OP__SHOW_MIN_FRAMESIZE: - printf("%u\n", block->data.stream_info.min_framesize); - break; - case OP__SHOW_MAX_FRAMESIZE: - printf("%u\n", block->data.stream_info.max_framesize); - break; - case OP__SHOW_SAMPLE_RATE: - printf("%u\n", block->data.stream_info.sample_rate); - break; - case OP__SHOW_CHANNELS: - printf("%u\n", block->data.stream_info.channels); - break; - case OP__SHOW_BPS: - printf("%u\n", block->data.stream_info.bits_per_sample); - break; - case OP__SHOW_TOTAL_SAMPLES: -#ifdef _MSC_VER - printf("%I64u\n", block->data.stream_info.total_samples); -#else - printf("%llu\n", (unsigned long long)block->data.stream_info.total_samples); -#endif - break; - case OP__SET_MD5SUM: - memcpy(block->data.stream_info.md5sum, operation->argument.streaminfo_md5.value, 16); - *needs_write = true; - break; - case OP__SET_MIN_BLOCKSIZE: - block->data.stream_info.min_blocksize = operation->argument.streaminfo_uint32.value; - *needs_write = true; - break; - case OP__SET_MAX_BLOCKSIZE: - block->data.stream_info.max_blocksize = operation->argument.streaminfo_uint32.value; - *needs_write = true; - break; - case OP__SET_MIN_FRAMESIZE: - block->data.stream_info.min_framesize = operation->argument.streaminfo_uint32.value; - *needs_write = true; - break; - case OP__SET_MAX_FRAMESIZE: - block->data.stream_info.max_framesize = operation->argument.streaminfo_uint32.value; - *needs_write = true; - break; - case OP__SET_SAMPLE_RATE: - block->data.stream_info.sample_rate = operation->argument.streaminfo_uint32.value; - *needs_write = true; - break; - case OP__SET_CHANNELS: - block->data.stream_info.channels = operation->argument.streaminfo_uint32.value; - *needs_write = true; - break; - case OP__SET_BPS: - block->data.stream_info.bits_per_sample = operation->argument.streaminfo_uint32.value; - *needs_write = true; - break; - case OP__SET_TOTAL_SAMPLES: - block->data.stream_info.total_samples = operation->argument.streaminfo_uint64.value; - *needs_write = true; - break; - default: - ok = false; - FLAC__ASSERT(0); - break; - }; - - FLAC__metadata_iterator_delete(iterator); - - return ok; -} diff --git a/src/lib/dl/ext/flac/operations_shorthand_vorbiscomment.c b/src/lib/dl/ext/flac/operations_shorthand_vorbiscomment.c deleted file mode 100755 index ba00859b..00000000 --- a/src/lib/dl/ext/flac/operations_shorthand_vorbiscomment.c +++ /dev/null @@ -1,368 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include -#endif - -#include "options.h" -#include "utils.h" -#include "FLAC/assert.h" -#include "share/grabbag.h" /* for grabbag__file_get_filesize() */ -#include "share/utf8.h" -#include -#include -#include -#include "operations_shorthand.h" - -static FLAC__bool remove_vc_all(const char *filename, FLAC__StreamMetadata *block, FLAC__bool *needs_write); -static FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write); -static FLAC__bool remove_vc_firstfield(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write); -static FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write, FLAC__bool raw); -static FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool *needs_write, FLAC__bool raw); -static FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool raw); - -FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool raw) -{ - FLAC__bool ok = true, found_vc_block = false; - FLAC__StreamMetadata *block = 0; - FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); - - if(0 == iterator) - die("out of memory allocating iterator"); - - 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 if necessary */ - if(operation->type == OP__SET_VC_FIELD || operation->type == OP__IMPORT_VC_FROM) { - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(0 == block) - die("out of memory allocating VORBIS_COMMENT block"); - while(FLAC__metadata_iterator_next(iterator)) - ; - if(!FLAC__metadata_iterator_insert_block_after(iterator, block)) { - print_error_with_chain_status(chain, "%s: ERROR: adding new VORBIS_COMMENT block to metadata", filename); - return false; - } - /* iterator is left pointing to new block */ - FLAC__ASSERT(FLAC__metadata_iterator_get_block(iterator) == block); - } - else { - FLAC__metadata_iterator_delete(iterator); - return ok; - } - } - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - switch(operation->type) { - case OP__SHOW_VC_VENDOR: - write_vc_field(prefix_with_filename? filename : 0, &block->data.vorbis_comment.vendor_string, raw, stdout); - break; - case OP__SHOW_VC_FIELD: - write_vc_fields(prefix_with_filename? filename : 0, operation->argument.vc_field_name.value, block->data.vorbis_comment.comments, block->data.vorbis_comment.num_comments, raw, stdout); - break; - case OP__REMOVE_VC_ALL: - ok = remove_vc_all(filename, block, needs_write); - break; - case OP__REMOVE_VC_FIELD: - ok = remove_vc_field(filename, block, operation->argument.vc_field_name.value, needs_write); - break; - case OP__REMOVE_VC_FIRSTFIELD: - ok = remove_vc_firstfield(filename, block, operation->argument.vc_field_name.value, needs_write); - break; - case OP__SET_VC_FIELD: - ok = set_vc_field(filename, block, &operation->argument.vc_field, needs_write, raw); - break; - case OP__IMPORT_VC_FROM: - ok = import_vc_from(filename, block, &operation->argument.filename, needs_write, raw); - break; - case OP__EXPORT_VC_TO: - ok = export_vc_to(filename, block, &operation->argument.filename, raw); - break; - default: - ok = false; - FLAC__ASSERT(0); - break; - }; - - FLAC__metadata_iterator_delete(iterator); - return ok; -} - -/* - * local routines - */ - -FLAC__bool remove_vc_all(const char *filename, FLAC__StreamMetadata *block, FLAC__bool *needs_write) -{ - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(0 != needs_write); - - if(0 != block->data.vorbis_comment.comments) { - FLAC__ASSERT(block->data.vorbis_comment.num_comments > 0); - if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, 0)) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); - return false; - } - *needs_write = true; - } - else { - FLAC__ASSERT(block->data.vorbis_comment.num_comments == 0); - } - - return true; -} - -FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write) -{ - int n; - - FLAC__ASSERT(0 != needs_write); - - n = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, field_name); - - if(n < 0) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); - return false; - } - else if(n > 0) - *needs_write = true; - - return true; -} - -FLAC__bool remove_vc_firstfield(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write) -{ - int n; - - FLAC__ASSERT(0 != needs_write); - - n = FLAC__metadata_object_vorbiscomment_remove_entry_matching(block, field_name); - - if(n < 0) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); - return false; - } - else if(n > 0) - *needs_write = true; - - return true; -} - -FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write, FLAC__bool raw) -{ - FLAC__StreamMetadata_VorbisComment_Entry entry; - char *converted; - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(0 != field); - FLAC__ASSERT(0 != needs_write); - - if(field->field_value_from_file) { - /* read the file into 'data' */ - FILE *f = 0; - char *data = 0; - const off_t size = grabbag__file_get_filesize(field->field_value); - if(size < 0) { - fprintf(stderr, "%s: ERROR: can't open file '%s' for '%s' tag value\n", filename, field->field_value, field->field_name); - return false; - } - if(size >= 0x100000) { /* magic arbitrary limit, actual format limit is near 16MB */ - fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is too large\n", filename, field->field_value, field->field_name); - return false; - } - if(0 == (data = malloc(size+1))) - die("out of memory allocating tag value"); - data[size] = '\0'; - if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) { - fprintf(stderr, "%s: ERROR: while reading file '%s' for '%s' tag value: %s\n", filename, field->field_value, field->field_name, strerror(errno)); - free(data); - if(f) - fclose(f); - return false; - } - fclose(f); - if(strlen(data) != (size_t)size) { - free(data); - fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value has embedded NULs\n", filename, field->field_value, field->field_name); - return false; - } - - /* move 'data' into 'converted', converting to UTF-8 if necessary */ - if(raw) { - converted = data; - } - else if(utf8_encode(data, &converted) >= 0) { - free(data); - } - else { - free(data); - fprintf(stderr, "%s: ERROR: converting file '%s' contents to UTF-8 for tag value\n", filename, field->field_value); - return false; - } - - /* create and entry and append it */ - if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, field->field_name, converted)) { - free(converted); - fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is not valid UTF-8\n", filename, field->field_value, field->field_name); - return false; - } - free(converted); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); - return false; - } - - *needs_write = true; - return true; - } - else { - FLAC__bool needs_free = false; - if(raw) { - entry.entry = (FLAC__byte *)field->field; - } - else if(utf8_encode(field->field, &converted) >= 0) { - entry.entry = (FLAC__byte *)converted; - needs_free = true; - } - else { - fprintf(stderr, "%s: ERROR: converting comment '%s' to UTF-8\n", filename, field->field); - return false; - } - entry.length = strlen((const char *)entry.entry); - if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) { - if(needs_free) - free(converted); - /* - * our previous parsing has already established that the field - * name is OK, so it must be the field value - */ - fprintf(stderr, "%s: ERROR: tag value for '%s' is not valid UTF-8\n", filename, field->field_name); - return false; - } - - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { - if(needs_free) - free(converted); - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); - return false; - } - - *needs_write = true; - if(needs_free) - free(converted); - return true; - } -} - -FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool *needs_write, FLAC__bool raw) -{ - FILE *f; - char line[65536]; - FLAC__bool ret; - - if(0 == vc_filename->value || strlen(vc_filename->value) == 0) { - fprintf(stderr, "%s: ERROR: empty import file name\n", filename); - return false; - } - if(0 == strcmp(vc_filename->value, "-")) - f = stdin; - else - f = fopen(vc_filename->value, "r"); - - if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, vc_filename->value, strerror(errno)); - return false; - } - - ret = true; - while(ret && !feof(f)) { - fgets(line, sizeof(line), f); - if(!feof(f)) { - char *p = strchr(line, '\n'); - if(0 == p) { - fprintf(stderr, "%s: ERROR: line too long, aborting\n", vc_filename->value); - ret = false; - } - else { - const char *violation; - Argument_VcField field; - *p = '\0'; - memset(&field, 0, sizeof(Argument_VcField)); - field.field_value_from_file = false; - if(!parse_vorbis_comment_field(line, &field.field, &field.field_name, &field.field_value, &field.field_value_length, &violation)) { - FLAC__ASSERT(0 != violation); - fprintf(stderr, "%s: ERROR: malformed vorbis comment field \"%s\",\n %s\n", vc_filename->value, line, violation); - ret = false; - } - else { - ret = set_vc_field(filename, block, &field, needs_write, raw); - } - if(0 != field.field) - free(field.field); - if(0 != field.field_name) - free(field.field_name); - if(0 != field.field_value) - free(field.field_value); - } - } - }; - - if(f != stdin) - fclose(f); - return ret; -} - -FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const Argument_String *vc_filename, FLAC__bool raw) -{ - FILE *f; - FLAC__bool ret; - - if(0 == vc_filename->value || strlen(vc_filename->value) == 0) { - fprintf(stderr, "%s: ERROR: empty export file name\n", filename); - return false; - } - if(0 == strcmp(vc_filename->value, "-")) - f = stdout; - else - f = fopen(vc_filename->value, "w"); - - if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, vc_filename->value, strerror(errno)); - return false; - } - - ret = true; - - write_vc_fields(0, 0, block->data.vorbis_comment.comments, block->data.vorbis_comment.num_comments, raw, f); - - if(f != stdout) - fclose(f); - return ret; -} diff --git a/src/lib/dl/ext/flac/options.c b/src/lib/dl/ext/flac/options.c deleted file mode 100755 index 56c44169..00000000 --- a/src/lib/dl/ext/flac/options.c +++ /dev/null @@ -1,1109 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include -#endif - -#include "options.h" -#include "usage.h" -#include "utils.h" -#include "FLAC/assert.h" -#include "share/alloc.h" -#include "share/grabbag/replaygain.h" -#include -#include -#include -#include - -/* - share__getopt format struct; note we don't use short options so we just - set the 'val' field to 0 everywhere to indicate a valid option. -*/ -struct share__option long_options_[] = { - /* global options */ - { "preserve-modtime", 0, 0, 0 }, - { "with-filename", 0, 0, 0 }, - { "no-filename", 0, 0, 0 }, - { "no-utf8-convert", 0, 0, 0 }, - { "dont-use-padding", 0, 0, 0 }, - { "no-cued-seekpoints", 0, 0, 0 }, - /* shorthand operations */ - { "show-md5sum", 0, 0, 0 }, - { "show-min-blocksize", 0, 0, 0 }, - { "show-max-blocksize", 0, 0, 0 }, - { "show-min-framesize", 0, 0, 0 }, - { "show-max-framesize", 0, 0, 0 }, - { "show-sample-rate", 0, 0, 0 }, - { "show-channels", 0, 0, 0 }, - { "show-bps", 0, 0, 0 }, - { "show-total-samples", 0, 0, 0 }, - { "set-md5sum", 1, 0, 0 }, /* undocumented */ - { "set-min-blocksize", 1, 0, 0 }, /* undocumented */ - { "set-max-blocksize", 1, 0, 0 }, /* undocumented */ - { "set-min-framesize", 1, 0, 0 }, /* undocumented */ - { "set-max-framesize", 1, 0, 0 }, /* undocumented */ - { "set-sample-rate", 1, 0, 0 }, /* undocumented */ - { "set-channels", 1, 0, 0 }, /* undocumented */ - { "set-bps", 1, 0, 0 }, /* undocumented */ - { "set-total-samples", 1, 0, 0 }, /* undocumented */ /* WATCHOUT: used by test/test_flac.sh on windows */ - { "show-vendor-tag", 0, 0, 0 }, - { "show-tag", 1, 0, 0 }, - { "remove-all-tags", 0, 0, 0 }, - { "remove-tag", 1, 0, 0 }, - { "remove-first-tag", 1, 0, 0 }, - { "set-tag", 1, 0, 0 }, - { "set-tag-from-file", 1, 0, 0 }, - { "import-tags-from", 1, 0, 0 }, - { "export-tags-to", 1, 0, 0 }, - { "import-cuesheet-from", 1, 0, 0 }, - { "export-cuesheet-to", 1, 0, 0 }, - { "import-picture-from", 1, 0, 0 }, - { "export-picture-to", 1, 0, 0 }, - { "add-seekpoint", 1, 0, 0 }, - { "add-replay-gain", 0, 0, 0 }, - { "remove-replay-gain", 0, 0, 0 }, - { "add-padding", 1, 0, 0 }, - /* major operations */ - { "help", 0, 0, 0 }, - { "version", 0, 0, 0 }, - { "list", 0, 0, 0 }, - { "append", 0, 0, 0 }, - { "remove", 0, 0, 0 }, - { "remove-all", 0, 0, 0 }, - { "merge-padding", 0, 0, 0 }, - { "sort-padding", 0, 0, 0 }, - /* major operation arguments */ - { "block-number", 1, 0, 0 }, - { "block-type", 1, 0, 0 }, - { "except-block-type", 1, 0, 0 }, - { "data-format", 1, 0, 0 }, - { "application-data-format", 1, 0, 0 }, - { "from-file", 1, 0, 0 }, - {0, 0, 0, 0} -}; - -static FLAC__bool parse_option(int option_index, const char *option_argument, CommandLineOptions *options); -static void append_new_operation(CommandLineOptions *options, Operation operation); -static void append_new_argument(CommandLineOptions *options, Argument argument); -static Operation *append_major_operation(CommandLineOptions *options, OperationType type); -static Operation *append_shorthand_operation(CommandLineOptions *options, OperationType type); -static Argument *find_argument(CommandLineOptions *options, ArgumentType type); -static Operation *find_shorthand_operation(CommandLineOptions *options, OperationType type); -static Argument *append_argument(CommandLineOptions *options, ArgumentType type); -static FLAC__bool parse_md5(const char *src, FLAC__byte dest[16]); -static FLAC__bool parse_uint32(const char *src, FLAC__uint32 *dest); -static FLAC__bool parse_uint64(const char *src, FLAC__uint64 *dest); -static FLAC__bool parse_string(const char *src, char **dest); -static FLAC__bool parse_vorbis_comment_field_name(const char *field_ref, char **name, const char **violation); -static FLAC__bool parse_add_seekpoint(const char *in, char **out, const char **violation); -static FLAC__bool parse_add_padding(const char *in, unsigned *out); -static FLAC__bool parse_block_number(const char *in, Argument_BlockNumber *out); -static FLAC__bool parse_block_type(const char *in, Argument_BlockType *out); -static FLAC__bool parse_data_format(const char *in, Argument_DataFormat *out); -static FLAC__bool parse_application_data_format(const char *in, FLAC__bool *out); -static void undocumented_warning(const char *opt); - - -void init_options(CommandLineOptions *options) -{ - options->preserve_modtime = false; - - /* '2' is a hack to mean "use default if not forced on command line" */ - FLAC__ASSERT(true != 2); - options->prefix_with_filename = 2; - - options->utf8_convert = true; - options->use_padding = true; - options->cued_seekpoints = true; - options->show_long_help = false; - options->show_version = false; - options->application_data_format_is_hexdump = false; - - options->ops.operations = 0; - options->ops.num_operations = 0; - options->ops.capacity = 0; - - options->args.arguments = 0; - options->args.num_arguments = 0; - options->args.capacity = 0; - - options->args.checks.num_shorthand_ops = 0; - options->args.checks.num_major_ops = 0; - options->args.checks.has_block_type = false; - options->args.checks.has_except_block_type = false; - - options->num_files = 0; - options->filenames = 0; -} - -FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options) -{ - int ret; - int option_index = 1; - FLAC__bool had_error = false; - - while ((ret = share__getopt_long(argc, argv, "", long_options_, &option_index)) != -1) { - switch (ret) { - case 0: - had_error |= !parse_option(option_index, share__optarg, options); - break; - case '?': - case ':': - had_error = true; - break; - default: - FLAC__ASSERT(0); - break; - } - } - - if(options->prefix_with_filename == 2) - options->prefix_with_filename = (argc - share__optind > 1); - - if(share__optind >= argc && !options->show_long_help && !options->show_version) { - fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n"); - fprintf(stderr," metaflac cannot be used as a pipe\n"); - had_error = true; - } - - options->num_files = argc - share__optind; - - if(options->num_files > 0) { - unsigned i = 0; - if(0 == (options->filenames = (char**)safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files))) - die("out of memory allocating space for file names list"); - while(share__optind < argc) - options->filenames[i++] = local_strdup(argv[share__optind++]); - } - - if(options->args.checks.num_major_ops > 0) { - if(options->args.checks.num_major_ops > 1) { - fprintf(stderr, "ERROR: you may only specify one major operation at a time\n"); - had_error = true; - } - else if(options->args.checks.num_shorthand_ops > 0) { - fprintf(stderr, "ERROR: you may not mix shorthand and major operations\n"); - had_error = true; - } - } - - /* check for only one FLAC file used with certain options */ - if(options->num_files > 1) { - if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from'\n"); - had_error = true; - } - if(0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO)) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-cuesheet-to'\n"); - had_error = true; - } - if(0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO)) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-picture-to'\n"); - had_error = true; - } - if( - 0 != find_shorthand_operation(options, OP__IMPORT_VC_FROM) && - 0 == strcmp(find_shorthand_operation(options, OP__IMPORT_VC_FROM)->argument.filename.value, "-") - ) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-tags-from=-'\n"); - had_error = true; - } - } - - if(options->args.checks.has_block_type && options->args.checks.has_except_block_type) { - fprintf(stderr, "ERROR: you may not specify both '--block-type' and '--except-block-type'\n"); - had_error = true; - } - - if(had_error) - short_usage(0); - - /* - * We need to create an OP__ADD_SEEKPOINT operation if there is - * not one already, and --import-cuesheet-from was specified but - * --no-cued-seekpoints was not: - */ - if(options->cued_seekpoints) { - Operation *op = find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM); - if(0 != op) { - Operation *op2 = find_shorthand_operation(options, OP__ADD_SEEKPOINT); - if(0 == op2) - op2 = append_shorthand_operation(options, OP__ADD_SEEKPOINT); - op->argument.import_cuesheet_from.add_seekpoint_link = &(op2->argument.add_seekpoint); - } - } - - return !had_error; -} - -void free_options(CommandLineOptions *options) -{ - unsigned i; - Operation *op; - Argument *arg; - - FLAC__ASSERT(0 == options->ops.operations || options->ops.num_operations > 0); - FLAC__ASSERT(0 == options->args.arguments || options->args.num_arguments > 0); - - for(i = 0, op = options->ops.operations; i < options->ops.num_operations; i++, op++) { - switch(op->type) { - case OP__SHOW_VC_FIELD: - case OP__REMOVE_VC_FIELD: - case OP__REMOVE_VC_FIRSTFIELD: - if(0 != op->argument.vc_field_name.value) - free(op->argument.vc_field_name.value); - break; - case OP__SET_VC_FIELD: - if(0 != op->argument.vc_field.field) - free(op->argument.vc_field.field); - if(0 != op->argument.vc_field.field_name) - free(op->argument.vc_field.field_name); - if(0 != op->argument.vc_field.field_value) - free(op->argument.vc_field.field_value); - break; - case OP__IMPORT_VC_FROM: - case OP__EXPORT_VC_TO: - case OP__EXPORT_CUESHEET_TO: - if(0 != op->argument.filename.value) - free(op->argument.filename.value); - break; - case OP__IMPORT_CUESHEET_FROM: - if(0 != op->argument.import_cuesheet_from.filename) - free(op->argument.import_cuesheet_from.filename); - break; - case OP__IMPORT_PICTURE_FROM: - if(0 != op->argument.specification.value) - free(op->argument.specification.value); - break; - case OP__EXPORT_PICTURE_TO: - if(0 != op->argument.export_picture_to.filename) - free(op->argument.export_picture_to.filename); - break; - case OP__ADD_SEEKPOINT: - if(0 != op->argument.add_seekpoint.specification) - free(op->argument.add_seekpoint.specification); - break; - default: - break; - } - } - - for(i = 0, arg = options->args.arguments; i < options->args.num_arguments; i++, arg++) { - switch(arg->type) { - case ARG__BLOCK_NUMBER: - if(0 != arg->value.block_number.entries) - free(arg->value.block_number.entries); - break; - case ARG__BLOCK_TYPE: - case ARG__EXCEPT_BLOCK_TYPE: - if(0 != arg->value.block_type.entries) - free(arg->value.block_type.entries); - break; - case ARG__FROM_FILE: - if(0 != arg->value.from_file.file_name) - free(arg->value.from_file.file_name); - break; - default: - break; - } - } - - if(0 != options->ops.operations) - free(options->ops.operations); - - if(0 != options->args.arguments) - free(options->args.arguments); - - if(0 != options->filenames) { - for(i = 0; i < options->num_files; i++) { - if(0 != options->filenames[i]) - free(options->filenames[i]); - } - free(options->filenames); - } -} - -/* - * local routines - */ - -FLAC__bool parse_option(int option_index, const char *option_argument, CommandLineOptions *options) -{ - const char *opt = long_options_[option_index].name; - Operation *op; - Argument *arg; - FLAC__bool ok = true; - - if(0 == strcmp(opt, "preserve-modtime")) { - options->preserve_modtime = true; - } - else if(0 == strcmp(opt, "with-filename")) { - options->prefix_with_filename = true; - } - else if(0 == strcmp(opt, "no-filename")) { - options->prefix_with_filename = false; - } - else if(0 == strcmp(opt, "no-utf8-convert")) { - options->utf8_convert = false; - } - else if(0 == strcmp(opt, "dont-use-padding")) { - options->use_padding = false; - } - else if(0 == strcmp(opt, "no-cued-seekpoints")) { - options->cued_seekpoints = false; - } - else if(0 == strcmp(opt, "show-md5sum")) { - (void) append_shorthand_operation(options, OP__SHOW_MD5SUM); - } - else if(0 == strcmp(opt, "show-min-blocksize")) { - (void) append_shorthand_operation(options, OP__SHOW_MIN_BLOCKSIZE); - } - else if(0 == strcmp(opt, "show-max-blocksize")) { - (void) append_shorthand_operation(options, OP__SHOW_MAX_BLOCKSIZE); - } - else if(0 == strcmp(opt, "show-min-framesize")) { - (void) append_shorthand_operation(options, OP__SHOW_MIN_FRAMESIZE); - } - else if(0 == strcmp(opt, "show-max-framesize")) { - (void) append_shorthand_operation(options, OP__SHOW_MAX_FRAMESIZE); - } - else if(0 == strcmp(opt, "show-sample-rate")) { - (void) append_shorthand_operation(options, OP__SHOW_SAMPLE_RATE); - } - else if(0 == strcmp(opt, "show-channels")) { - (void) append_shorthand_operation(options, OP__SHOW_CHANNELS); - } - else if(0 == strcmp(opt, "show-bps")) { - (void) append_shorthand_operation(options, OP__SHOW_BPS); - } - else if(0 == strcmp(opt, "show-total-samples")) { - (void) append_shorthand_operation(options, OP__SHOW_TOTAL_SAMPLES); - } - else if(0 == strcmp(opt, "set-md5sum")) { - op = append_shorthand_operation(options, OP__SET_MD5SUM); - FLAC__ASSERT(0 != option_argument); - if(!parse_md5(option_argument, op->argument.streaminfo_md5.value)) { - fprintf(stderr, "ERROR (--%s): bad MD5 sum\n", opt); - ok = false; - } - else - undocumented_warning(opt); - } - else if(0 == strcmp(opt, "set-min-blocksize")) { - op = append_shorthand_operation(options, OP__SET_MIN_BLOCKSIZE); - if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) { - fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); - ok = false; - } - else - undocumented_warning(opt); - } - else if(0 == strcmp(opt, "set-max-blocksize")) { - op = append_shorthand_operation(options, OP__SET_MAX_BLOCKSIZE); - if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) { - fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); - ok = false; - } - else - undocumented_warning(opt); - } - else if(0 == strcmp(opt, "set-min-framesize")) { - op = append_shorthand_operation(options, OP__SET_MIN_FRAMESIZE); - if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<argument.streaminfo_uint32.value)) || !FLAC__format_sample_rate_is_valid(op->argument.streaminfo_uint32.value)) { - fprintf(stderr, "ERROR (--%s): invalid sample rate\n", opt); - ok = false; - } - else - undocumented_warning(opt); - } - else if(0 == strcmp(opt, "set-channels")) { - op = append_shorthand_operation(options, OP__SET_CHANNELS); - if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value > FLAC__MAX_CHANNELS) { - fprintf(stderr, "ERROR (--%s): value must be > 0 and <= %u\n", opt, FLAC__MAX_CHANNELS); - ok = false; - } - else - undocumented_warning(opt); - } - else if(0 == strcmp(opt, "set-bps")) { - op = append_shorthand_operation(options, OP__SET_BPS); - if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BITS_PER_SAMPLE || op->argument.streaminfo_uint32.value > FLAC__MAX_BITS_PER_SAMPLE) { - fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE); - ok = false; - } - else - undocumented_warning(opt); - } - else if(0 == strcmp(opt, "set-total-samples")) { - op = append_shorthand_operation(options, OP__SET_TOTAL_SAMPLES); - if(!parse_uint64(option_argument, &(op->argument.streaminfo_uint64.value)) || op->argument.streaminfo_uint64.value >= (((FLAC__uint64)1)<argument.vc_field_name.value), &violation)) { - FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); - ok = false; - } - } - else if(0 == strcmp(opt, "remove-all-tags")) { - (void) append_shorthand_operation(options, OP__REMOVE_VC_ALL); - } - else if(0 == strcmp(opt, "remove-tag")) { - const char *violation; - op = append_shorthand_operation(options, OP__REMOVE_VC_FIELD); - FLAC__ASSERT(0 != option_argument); - if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { - FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); - ok = false; - } - } - else if(0 == strcmp(opt, "remove-first-tag")) { - const char *violation; - op = append_shorthand_operation(options, OP__REMOVE_VC_FIRSTFIELD); - FLAC__ASSERT(0 != option_argument); - if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { - FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); - ok = false; - } - } - else if(0 == strcmp(opt, "set-tag")) { - const char *violation; - op = append_shorthand_operation(options, OP__SET_VC_FIELD); - FLAC__ASSERT(0 != option_argument); - op->argument.vc_field.field_value_from_file = false; - if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) { - FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation); - ok = false; - } - } - else if(0 == strcmp(opt, "set-tag-from-file")) { - const char *violation; - op = append_shorthand_operation(options, OP__SET_VC_FIELD); - FLAC__ASSERT(0 != option_argument); - op->argument.vc_field.field_value_from_file = true; - if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) { - FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation); - ok = false; - } - } - else if(0 == strcmp(opt, "import-tags-from")) { - op = append_shorthand_operation(options, OP__IMPORT_VC_FROM); - FLAC__ASSERT(0 != option_argument); - if(!parse_string(option_argument, &(op->argument.filename.value))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); - ok = false; - } - } - else if(0 == strcmp(opt, "export-tags-to")) { - op = append_shorthand_operation(options, OP__EXPORT_VC_TO); - FLAC__ASSERT(0 != option_argument); - if(!parse_string(option_argument, &(op->argument.filename.value))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); - ok = false; - } - } - else if(0 == strcmp(opt, "import-cuesheet-from")) { - if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) { - fprintf(stderr, "ERROR (--%s): may be specified only once\n", opt); - ok = false; - } - op = append_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM); - FLAC__ASSERT(0 != option_argument); - if(!parse_string(option_argument, &(op->argument.import_cuesheet_from.filename))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); - ok = false; - } - } - else if(0 == strcmp(opt, "export-cuesheet-to")) { - op = append_shorthand_operation(options, OP__EXPORT_CUESHEET_TO); - FLAC__ASSERT(0 != option_argument); - if(!parse_string(option_argument, &(op->argument.filename.value))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); - ok = false; - } - } - else if(0 == strcmp(opt, "import-picture-from")) { - op = append_shorthand_operation(options, OP__IMPORT_PICTURE_FROM); - FLAC__ASSERT(0 != option_argument); - if(!parse_string(option_argument, &(op->argument.specification.value))) { - fprintf(stderr, "ERROR (--%s): missing specification\n", opt); - ok = false; - } - } - else if(0 == strcmp(opt, "export-picture-to")) { - const Argument *arg = find_argument(options, ARG__BLOCK_NUMBER); - op = append_shorthand_operation(options, OP__EXPORT_PICTURE_TO); - FLAC__ASSERT(0 != option_argument); - if(!parse_string(option_argument, &(op->argument.export_picture_to.filename))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); - ok = false; - } - op->argument.export_picture_to.block_number_link = arg? &(arg->value.block_number) : 0; - } - else if(0 == strcmp(opt, "add-seekpoint")) { - const char *violation; - char *spec; - FLAC__ASSERT(0 != option_argument); - if(!parse_add_seekpoint(option_argument, &spec, &violation)) { - FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n %s\n", opt, option_argument, violation); - ok = false; - } - else { - op = find_shorthand_operation(options, OP__ADD_SEEKPOINT); - if(0 == op) - op = append_shorthand_operation(options, OP__ADD_SEEKPOINT); - local_strcat(&(op->argument.add_seekpoint.specification), spec); - local_strcat(&(op->argument.add_seekpoint.specification), ";"); - free(spec); - } - } - else if(0 == strcmp(opt, "add-replay-gain")) { - (void) append_shorthand_operation(options, OP__ADD_REPLAY_GAIN); - } - else if(0 == strcmp(opt, "remove-replay-gain")) { - const FLAC__byte * const tags[5] = { - GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS, - GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN, - GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK, - GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN, - GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK - }; - size_t i; - for(i = 0; i < sizeof(tags)/sizeof(tags[0]); i++) { - op = append_shorthand_operation(options, OP__REMOVE_VC_FIELD); - op->argument.vc_field_name.value = local_strdup((const char *)tags[i]); - } - } - else if(0 == strcmp(opt, "add-padding")) { - op = append_shorthand_operation(options, OP__ADD_PADDING); - FLAC__ASSERT(0 != option_argument); - if(!parse_add_padding(option_argument, &(op->argument.add_padding.length))) { - fprintf(stderr, "ERROR (--%s): illegal length \"%s\", length must be >= 0 and < 2^%u\n", opt, option_argument, FLAC__STREAM_METADATA_LENGTH_LEN); - ok = false; - } - } - else if(0 == strcmp(opt, "help")) { - options->show_long_help = true; - } - else if(0 == strcmp(opt, "version")) { - options->show_version = true; - } - else if(0 == strcmp(opt, "list")) { - (void) append_major_operation(options, OP__LIST); - } - else if(0 == strcmp(opt, "append")) { - (void) append_major_operation(options, OP__APPEND); - } - else if(0 == strcmp(opt, "remove")) { - (void) append_major_operation(options, OP__REMOVE); - } - else if(0 == strcmp(opt, "remove-all")) { - (void) append_major_operation(options, OP__REMOVE_ALL); - } - else if(0 == strcmp(opt, "merge-padding")) { - (void) append_major_operation(options, OP__MERGE_PADDING); - } - else if(0 == strcmp(opt, "sort-padding")) { - (void) append_major_operation(options, OP__SORT_PADDING); - } - else if(0 == strcmp(opt, "block-number")) { - arg = append_argument(options, ARG__BLOCK_NUMBER); - FLAC__ASSERT(0 != option_argument); - if(!parse_block_number(option_argument, &(arg->value.block_number))) { - fprintf(stderr, "ERROR: malformed block number specification \"%s\"\n", option_argument); - ok = false; - } - } - else if(0 == strcmp(opt, "block-type")) { - arg = append_argument(options, ARG__BLOCK_TYPE); - FLAC__ASSERT(0 != option_argument); - if(!parse_block_type(option_argument, &(arg->value.block_type))) { - fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument); - ok = false; - } - options->args.checks.has_block_type = true; - } - else if(0 == strcmp(opt, "except-block-type")) { - arg = append_argument(options, ARG__EXCEPT_BLOCK_TYPE); - FLAC__ASSERT(0 != option_argument); - if(!parse_block_type(option_argument, &(arg->value.block_type))) { - fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument); - ok = false; - } - options->args.checks.has_except_block_type = true; - } - else if(0 == strcmp(opt, "data-format")) { - arg = append_argument(options, ARG__DATA_FORMAT); - FLAC__ASSERT(0 != option_argument); - if(!parse_data_format(option_argument, &(arg->value.data_format))) { - fprintf(stderr, "ERROR (--%s): illegal data format \"%s\"\n", opt, option_argument); - ok = false; - } - } - else if(0 == strcmp(opt, "application-data-format")) { - FLAC__ASSERT(0 != option_argument); - if(!parse_application_data_format(option_argument, &(options->application_data_format_is_hexdump))) { - fprintf(stderr, "ERROR (--%s): illegal application data format \"%s\"\n", opt, option_argument); - ok = false; - } - } - else if(0 == strcmp(opt, "from-file")) { - arg = append_argument(options, ARG__FROM_FILE); - FLAC__ASSERT(0 != option_argument); - arg->value.from_file.file_name = local_strdup(option_argument); - } - else { - FLAC__ASSERT(0); - } - - return ok; -} - -void append_new_operation(CommandLineOptions *options, Operation operation) -{ - if(options->ops.capacity == 0) { - options->ops.capacity = 50; - if(0 == (options->ops.operations = (Operation*)malloc(sizeof(Operation) * options->ops.capacity))) - die("out of memory allocating space for option list"); - memset(options->ops.operations, 0, sizeof(Operation) * options->ops.capacity); - } - if(options->ops.capacity <= options->ops.num_operations) { - unsigned original_capacity = options->ops.capacity; - if(options->ops.capacity > SIZE_MAX / 2) /* overflow check */ - die("out of memory allocating space for option list"); - options->ops.capacity *= 2; - if(0 == (options->ops.operations = (Operation*)safe_realloc_mul_2op_(options->ops.operations, sizeof(Operation), /*times*/options->ops.capacity))) - die("out of memory allocating space for option list"); - memset(options->ops.operations + original_capacity, 0, sizeof(Operation) * (options->ops.capacity - original_capacity)); - } - - options->ops.operations[options->ops.num_operations++] = operation; -} - -void append_new_argument(CommandLineOptions *options, Argument argument) -{ - if(options->args.capacity == 0) { - options->args.capacity = 50; - if(0 == (options->args.arguments = (Argument*)malloc(sizeof(Argument) * options->args.capacity))) - die("out of memory allocating space for option list"); - memset(options->args.arguments, 0, sizeof(Argument) * options->args.capacity); - } - if(options->args.capacity <= options->args.num_arguments) { - unsigned original_capacity = options->args.capacity; - if(options->args.capacity > SIZE_MAX / 2) /* overflow check */ - die("out of memory allocating space for option list"); - options->args.capacity *= 2; - if(0 == (options->args.arguments = (Argument*)safe_realloc_mul_2op_(options->args.arguments, sizeof(Argument), /*times*/options->args.capacity))) - die("out of memory allocating space for option list"); - memset(options->args.arguments + original_capacity, 0, sizeof(Argument) * (options->args.capacity - original_capacity)); - } - - options->args.arguments[options->args.num_arguments++] = argument; -} - -Operation *append_major_operation(CommandLineOptions *options, OperationType type) -{ - Operation op; - memset(&op, 0, sizeof(op)); - op.type = type; - append_new_operation(options, op); - options->args.checks.num_major_ops++; - return options->ops.operations + (options->ops.num_operations - 1); -} - -Operation *append_shorthand_operation(CommandLineOptions *options, OperationType type) -{ - Operation op; - memset(&op, 0, sizeof(op)); - op.type = type; - append_new_operation(options, op); - options->args.checks.num_shorthand_ops++; - return options->ops.operations + (options->ops.num_operations - 1); -} - -Argument *find_argument(CommandLineOptions *options, ArgumentType type) -{ - unsigned i; - for(i = 0; i < options->args.num_arguments; i++) - if(options->args.arguments[i].type == type) - return &options->args.arguments[i]; - return 0; -} - -Operation *find_shorthand_operation(CommandLineOptions *options, OperationType type) -{ - unsigned i; - for(i = 0; i < options->ops.num_operations; i++) - if(options->ops.operations[i].type == type) - return &options->ops.operations[i]; - return 0; -} - -Argument *append_argument(CommandLineOptions *options, ArgumentType type) -{ - Argument arg; - memset(&arg, 0, sizeof(arg)); - arg.type = type; - append_new_argument(options, arg); - return options->args.arguments + (options->args.num_arguments - 1); -} - -FLAC__bool parse_md5(const char *src, FLAC__byte dest[16]) -{ - unsigned i, d; - int c; - FLAC__ASSERT(0 != src); - if(strlen(src) != 32) - return false; - /* strtoul() accepts negative numbers which we do not want, so we do it the hard way */ - for(i = 0; i < 16; i++) { - c = (int)(*src++); - if(isdigit(c)) - d = (unsigned)(c - '0'); - else if(c >= 'a' && c <= 'f') - d = (unsigned)(c - 'a') + 10u; - else if(c >= 'A' && c <= 'F') - d = (unsigned)(c - 'A') + 10u; - else - return false; - d <<= 4; - c = (int)(*src++); - if(isdigit(c)) - d |= (unsigned)(c - '0'); - else if(c >= 'a' && c <= 'f') - d |= (unsigned)(c - 'a') + 10u; - else if(c >= 'A' && c <= 'F') - d |= (unsigned)(c - 'A') + 10u; - else - return false; - dest[i] = (FLAC__byte)d; - } - return true; -} - -FLAC__bool parse_uint32(const char *src, FLAC__uint32 *dest) -{ - FLAC__ASSERT(0 != src); - if(strlen(src) == 0 || strspn(src, "0123456789") != strlen(src)) - return false; - *dest = strtoul(src, 0, 10); - return true; -} - -#ifdef _MSC_VER -/* There's no strtoull() in MSVC6 so we just write a specialized one */ -static FLAC__uint64 local__strtoull(const char *src) -{ - FLAC__uint64 ret = 0; - int c; - FLAC__ASSERT(0 != src); - while(0 != (c = *src++)) { - c -= '0'; - if(c >= 0 && c <= 9) - ret = (ret * 10) + c; - else - break; - } - return ret; -} -#endif - -FLAC__bool parse_uint64(const char *src, FLAC__uint64 *dest) -{ - FLAC__ASSERT(0 != src); - if(strlen(src) == 0 || strspn(src, "0123456789") != strlen(src)) - return false; -#ifdef _MSC_VER - *dest = local__strtoull(src); -#else - *dest = strtoull(src, 0, 10); -#endif - return true; -} - -FLAC__bool parse_string(const char *src, char **dest) -{ - if(0 == src || strlen(src) == 0) - return false; - *dest = strdup(src); - return true; -} - -FLAC__bool parse_vorbis_comment_field_name(const char *field_ref, char **name, const char **violation) -{ - static const char * const violations[] = { - "field name contains invalid character" - }; - - char *q, *s; - - s = local_strdup(field_ref); - - for(q = s; *q; q++) { - if(*q < 0x20 || *q > 0x7d || *q == 0x3d) { - free(s); - *violation = violations[0]; - return false; - } - } - - *name = s; - - return true; -} - -FLAC__bool parse_add_seekpoint(const char *in, char **out, const char **violation) -{ - static const char *garbled_ = "garbled specification"; - const unsigned n = strlen(in); - - FLAC__ASSERT(0 != in); - FLAC__ASSERT(0 != out); - - if(n == 0) { - *violation = "specification is empty"; - return false; - } - - if(n > strspn(in, "0123456789.Xsx")) { - *violation = "specification contains invalid character"; - return false; - } - - if(in[n-1] == 'X') { - if(n > 1) { - *violation = garbled_; - return false; - } - } - else if(in[n-1] == 's') { - if(n-1 > strspn(in, "0123456789.")) { - *violation = garbled_; - return false; - } - } - else if(in[n-1] == 'x') { - if(n-1 > strspn(in, "0123456789")) { - *violation = garbled_; - return false; - } - } - else { - if(n > strspn(in, "0123456789")) { - *violation = garbled_; - return false; - } - } - - *out = local_strdup(in); - return true; -} - -FLAC__bool parse_add_padding(const char *in, unsigned *out) -{ - FLAC__ASSERT(0 != in); - FLAC__ASSERT(0 != out); - *out = (unsigned)strtoul(in, 0, 10); - return *out < (1u << FLAC__STREAM_METADATA_LENGTH_LEN); -} - -FLAC__bool parse_block_number(const char *in, Argument_BlockNumber *out) -{ - char *p, *q, *s, *end; - long i; - unsigned entry; - - if(*in == '\0') - return false; - - s = local_strdup(in); - - /* first count the entries */ - for(out->num_entries = 1, p = strchr(s, ','); p; out->num_entries++, p = strchr(++p, ',')) - ; - - /* make space */ - FLAC__ASSERT(out->num_entries > 0); - if(0 == (out->entries = (unsigned*)safe_malloc_mul_2op_(sizeof(unsigned), /*times*/out->num_entries))) - die("out of memory allocating space for option list"); - - /* load 'em up */ - entry = 0; - q = s; - while(q) { - FLAC__ASSERT(entry < out->num_entries); - if(0 != (p = strchr(q, ','))) - *p++ = '\0'; - if(!isdigit((int)(*q)) || (i = strtol(q, &end, 10)) < 0 || *end) { - free(s); - return false; - } - out->entries[entry++] = (unsigned)i; - q = p; - } - FLAC__ASSERT(entry == out->num_entries); - - free(s); - return true; -} - -FLAC__bool parse_block_type(const char *in, Argument_BlockType *out) -{ - char *p, *q, *r, *s; - unsigned entry; - - if(*in == '\0') - return false; - - s = local_strdup(in); - - /* first count the entries */ - for(out->num_entries = 1, p = strchr(s, ','); p; out->num_entries++, p = strchr(++p, ',')) - ; - - /* make space */ - FLAC__ASSERT(out->num_entries > 0); - if(0 == (out->entries = (Argument_BlockTypeEntry*)safe_malloc_mul_2op_(sizeof(Argument_BlockTypeEntry), /*times*/out->num_entries))) - die("out of memory allocating space for option list"); - - /* load 'em up */ - entry = 0; - q = s; - while(q) { - FLAC__ASSERT(entry < out->num_entries); - if(0 != (p = strchr(q, ','))) - *p++ = 0; - r = strchr(q, ':'); - if(r) - *r++ = '\0'; - if(0 != r && 0 != strcmp(q, "APPLICATION")) { - free(s); - return false; - } - if(0 == strcmp(q, "STREAMINFO")) { - out->entries[entry++].type = FLAC__METADATA_TYPE_STREAMINFO; - } - else if(0 == strcmp(q, "PADDING")) { - out->entries[entry++].type = FLAC__METADATA_TYPE_PADDING; - } - else if(0 == strcmp(q, "APPLICATION")) { - out->entries[entry].type = FLAC__METADATA_TYPE_APPLICATION; - out->entries[entry].filter_application_by_id = (0 != r); - if(0 != r) { - if(strlen(r) == 4) { - strcpy(out->entries[entry].application_id, r); - } - else if(strlen(r) == 10 && strncmp(r, "0x", 2) == 0 && strspn(r+2, "0123456789ABCDEFabcdef") == 8) { - FLAC__uint32 x = strtoul(r+2, 0, 16); - out->entries[entry].application_id[3] = (FLAC__byte)(x & 0xff); - out->entries[entry].application_id[2] = (FLAC__byte)((x>>=8) & 0xff); - out->entries[entry].application_id[1] = (FLAC__byte)((x>>=8) & 0xff); - out->entries[entry].application_id[0] = (FLAC__byte)((x>>=8) & 0xff); - } - else { - free(s); - return false; - } - } - entry++; - } - else if(0 == strcmp(q, "SEEKTABLE")) { - out->entries[entry++].type = FLAC__METADATA_TYPE_SEEKTABLE; - } - else if(0 == strcmp(q, "VORBIS_COMMENT")) { - out->entries[entry++].type = FLAC__METADATA_TYPE_VORBIS_COMMENT; - } - else if(0 == strcmp(q, "CUESHEET")) { - out->entries[entry++].type = FLAC__METADATA_TYPE_CUESHEET; - } - else if(0 == strcmp(q, "PICTURE")) { - out->entries[entry++].type = FLAC__METADATA_TYPE_PICTURE; - } - else { - free(s); - return false; - } - q = p; - } - FLAC__ASSERT(entry == out->num_entries); - - free(s); - return true; -} - -FLAC__bool parse_data_format(const char *in, Argument_DataFormat *out) -{ - if(0 == strcmp(in, "binary")) - out->is_binary = true; - else if(0 == strcmp(in, "text")) - out->is_binary = false; - else - return false; - return true; -} - -FLAC__bool parse_application_data_format(const char *in, FLAC__bool *out) -{ - if(0 == strcmp(in, "hexdump")) - *out = true; - else if(0 == strcmp(in, "text")) - *out = false; - else - return false; - return true; -} - -void undocumented_warning(const char *opt) -{ - fprintf(stderr, "WARNING: undocmented option --%s should be used with caution,\n only for repairing a damaged STREAMINFO block\n", opt); -} diff --git a/src/lib/dl/ext/flac/options.h b/src/lib/dl/ext/flac/options.h deleted file mode 100755 index 244a8d01..00000000 --- a/src/lib/dl/ext/flac/options.h +++ /dev/null @@ -1,215 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 metaflac__options_h -#define metaflac__options_h - -#include "FLAC/format.h" - -#if 0 -/*[JEC] was:#if HAVE_GETOPT_LONG*/ -/*[JEC] see flac/include/share/getopt.h as to why the change */ -# include -#else -# include "share/getopt.h" -#endif - -extern struct share__option long_options_[]; - -typedef enum { - OP__SHOW_MD5SUM, - OP__SHOW_MIN_BLOCKSIZE, - OP__SHOW_MAX_BLOCKSIZE, - OP__SHOW_MIN_FRAMESIZE, - OP__SHOW_MAX_FRAMESIZE, - OP__SHOW_SAMPLE_RATE, - OP__SHOW_CHANNELS, - OP__SHOW_BPS, - OP__SHOW_TOTAL_SAMPLES, - OP__SET_MD5SUM, - OP__SET_MIN_BLOCKSIZE, - OP__SET_MAX_BLOCKSIZE, - OP__SET_MIN_FRAMESIZE, - OP__SET_MAX_FRAMESIZE, - OP__SET_SAMPLE_RATE, - OP__SET_CHANNELS, - OP__SET_BPS, - OP__SET_TOTAL_SAMPLES, - OP__SHOW_VC_VENDOR, - OP__SHOW_VC_FIELD, - OP__REMOVE_VC_ALL, - OP__REMOVE_VC_FIELD, - OP__REMOVE_VC_FIRSTFIELD, - OP__SET_VC_FIELD, - OP__IMPORT_VC_FROM, - OP__EXPORT_VC_TO, - OP__IMPORT_CUESHEET_FROM, - OP__EXPORT_CUESHEET_TO, - OP__IMPORT_PICTURE_FROM, - OP__EXPORT_PICTURE_TO, - OP__ADD_SEEKPOINT, - OP__ADD_REPLAY_GAIN, - OP__ADD_PADDING, - OP__LIST, - OP__APPEND, - OP__REMOVE, - OP__REMOVE_ALL, - OP__MERGE_PADDING, - OP__SORT_PADDING -} OperationType; - -typedef enum { - ARG__BLOCK_NUMBER, - ARG__BLOCK_TYPE, - ARG__EXCEPT_BLOCK_TYPE, - ARG__DATA_FORMAT, - ARG__FROM_FILE -} ArgumentType; - -typedef struct { - FLAC__byte value[16]; -} Argument_StreaminfoMD5; - -typedef struct { - FLAC__uint32 value; -} Argument_StreaminfoUInt32; - -typedef struct { - FLAC__uint64 value; -} Argument_StreaminfoUInt64; - -typedef struct { - char *value; -} Argument_VcFieldName; - -typedef struct { - char *field; /* the whole field as passed on the command line, i.e. "NAME=VALUE" */ - char *field_name; - /* according to the vorbis spec, field values can contain \0 so simple C strings are not enough here */ - unsigned field_value_length; - char *field_value; - FLAC__bool field_value_from_file; /* true if field_value holds a filename for the value, false for plain value */ -} Argument_VcField; - -typedef struct { - char *value; -} Argument_String; - -typedef struct { - unsigned num_entries; - unsigned *entries; -} Argument_BlockNumber; - -typedef struct { - FLAC__MetadataType type; - char application_id[4]; /* only relevant if type == FLAC__STREAM_METADATA_TYPE_APPLICATION */ - FLAC__bool filter_application_by_id; -} Argument_BlockTypeEntry; - -typedef struct { - unsigned num_entries; - Argument_BlockTypeEntry *entries; -} Argument_BlockType; - -typedef struct { - FLAC__bool is_binary; -} Argument_DataFormat; - -typedef struct { - char *file_name; -} Argument_FromFile; - -typedef struct { - char *specification; -} Argument_AddSeekpoint; - -typedef struct { - char *filename; - Argument_AddSeekpoint *add_seekpoint_link; -} Argument_ImportCuesheetFrom; - -typedef struct { - char *filename; - const Argument_BlockNumber *block_number_link; /* may be NULL to mean 'first PICTURE block' */ -} Argument_ExportPictureTo; - -typedef struct { - unsigned length; -} Argument_AddPadding; - -typedef struct { - OperationType type; - union { - Argument_StreaminfoMD5 streaminfo_md5; - Argument_StreaminfoUInt32 streaminfo_uint32; - Argument_StreaminfoUInt64 streaminfo_uint64; - Argument_VcFieldName vc_field_name; - Argument_VcField vc_field; - Argument_String filename; - Argument_String specification; - Argument_ImportCuesheetFrom import_cuesheet_from; - Argument_ExportPictureTo export_picture_to; - Argument_AddSeekpoint add_seekpoint; - Argument_AddPadding add_padding; - } argument; -} Operation; - -typedef struct { - ArgumentType type; - union { - Argument_BlockNumber block_number; - Argument_BlockType block_type; - Argument_DataFormat data_format; - Argument_FromFile from_file; - } value; -} Argument; - -typedef struct { - FLAC__bool preserve_modtime; - FLAC__bool prefix_with_filename; - FLAC__bool utf8_convert; - FLAC__bool use_padding; - FLAC__bool cued_seekpoints; - FLAC__bool show_long_help; - FLAC__bool show_version; - FLAC__bool application_data_format_is_hexdump; - struct { - Operation *operations; - unsigned num_operations; - unsigned capacity; - } ops; - struct { - struct { - unsigned num_shorthand_ops; - unsigned num_major_ops; - FLAC__bool has_block_type; - FLAC__bool has_except_block_type; - } checks; - Argument *arguments; - unsigned num_arguments; - unsigned capacity; - } args; - unsigned num_files; - char **filenames; -} CommandLineOptions; - -void init_options(CommandLineOptions *options); -FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options); -void free_options(CommandLineOptions *options); - -#endif diff --git a/src/lib/dl/ext/flac/ordinals.h b/src/lib/dl/ext/flac/ordinals.h deleted file mode 100755 index a7a5cd96..00000000 --- a/src/lib/dl/ext/flac/ordinals.h +++ /dev/null @@ -1,80 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 - -#if !(defined(_MSC_VER) || defined(__BORLANDC__) || defined(__EMX__)) -#include -#endif - -typedef signed char FLAC__int8; -typedef unsigned char FLAC__uint8; - -#if defined(_MSC_VER) || defined(__BORLANDC__) -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; -#elif defined(__EMX__) -typedef short FLAC__int16; -typedef long FLAC__int32; -typedef long long FLAC__int64; -typedef unsigned short FLAC__uint16; -typedef unsigned long FLAC__uint32; -typedef unsigned long long 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/src/lib/dl/ext/flac/picture.c b/src/lib/dl/ext/flac/picture.c deleted file mode 100755 index 4c055c69..00000000 --- a/src/lib/dl/ext/flac/picture.c +++ /dev/null @@ -1,407 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include "share/alloc.h" -#include "share/grabbag.h" -#include "flac/assert.h" -#include -#include -#include - -/* slightly different that strndup(): this always copies 'size' bytes starting from s into a NUL-terminated string. */ -static char *local__strndup_(const char *s, size_t size) -{ - char *x = (char*)safe_malloc_add_2op_(size, /*+*/1); - if(x) { - memcpy(x, s, size); - x[size] = '\0'; - } - return x; -} - -static FLAC__bool local__parse_type_(const char *s, size_t len, FLAC__StreamMetadata_Picture *picture) -{ - size_t i; - FLAC__uint32 val = 0; - - picture->type = FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER; - - if(len == 0) - return true; /* empty string implies default to 'front cover' */ - - for(i = 0; i < len; i++) { - if(s[i] >= '0' && s[i] <= '9') - val = 10*val + (FLAC__uint32)(s[i] - '0'); - else - return false; - } - - if(i == len) - picture->type = val; - else - return false; - - return true; -} - -static FLAC__bool local__parse_resolution_(const char *s, size_t len, FLAC__StreamMetadata_Picture *picture) -{ - int state = 0; - size_t i; - FLAC__uint32 val = 0; - - picture->width = picture->height = picture->depth = picture->colors = 0; - - if(len == 0) - return true; /* empty string implies client wants to get info from the file itself */ - - for(i = 0; i < len; i++) { - if(s[i] == 'x') { - if(state == 0) - picture->width = val; - else if(state == 1) - picture->height = val; - else - return false; - state++; - val = 0; - } - else if(s[i] == '/') { - if(state == 2) - picture->depth = val; - else - return false; - state++; - val = 0; - } - else if(s[i] >= '0' && s[i] <= '9') - val = 10*val + (FLAC__uint32)(s[i] - '0'); - else - return false; - } - - if(state < 2) - return false; - else if(state == 2) - picture->depth = val; - else if(state == 3) - picture->colors = val; - else - return false; - if(picture->depth < 32 && 1u<depth < picture->colors) - return false; - - return true; -} - -static FLAC__bool local__extract_mime_type_(FLAC__StreamMetadata *obj) -{ - if(obj->data.picture.data_length >= 8 && 0 == memcmp(obj->data.picture.data, "\x89PNG\x0d\x0a\x1a\x0a", 8)) - return FLAC__metadata_object_picture_set_mime_type(obj, "image/png", /*copy=*/true); - else if(obj->data.picture.data_length >= 6 && (0 == memcmp(obj->data.picture.data, "GIF87a", 6) || 0 == memcmp(obj->data.picture.data, "GIF89a", 6))) - return FLAC__metadata_object_picture_set_mime_type(obj, "image/gif", /*copy=*/true); - else if(obj->data.picture.data_length >= 2 && 0 == memcmp(obj->data.picture.data, "\xff\xd8", 2)) - return FLAC__metadata_object_picture_set_mime_type(obj, "image/jpeg", /*copy=*/true); - return false; -} - -static FLAC__bool local__extract_resolution_color_info_(FLAC__StreamMetadata_Picture *picture) -{ - const FLAC__byte *data = picture->data; - FLAC__uint32 len = picture->data_length; - - if(0 == strcmp(picture->mime_type, "image/png")) { - /* c.f. http://www.w3.org/TR/PNG/ */ - FLAC__bool need_palette = false; /* if IHDR has color_type=3, we need to also read the PLTE chunk to get the #colors */ - if(len < 8 || memcmp(data, "\x89PNG\x0d\x0a\x1a\x0a", 8)) - return false; - /* try to find IHDR chunk */ - data += 8; - len -= 8; - while(len > 12) { /* every PNG chunk must be at least 12 bytes long */ - const FLAC__uint32 clen = (FLAC__uint32)data[0] << 24 | (FLAC__uint32)data[1] << 16 | (FLAC__uint32)data[2] << 8 | (FLAC__uint32)data[3]; - if(0 == memcmp(data+4, "IHDR", 4) && clen == 13) { - unsigned color_type = data[17]; - picture->width = (FLAC__uint32)data[8] << 24 | (FLAC__uint32)data[9] << 16 | (FLAC__uint32)data[10] << 8 | (FLAC__uint32)data[11]; - picture->height = (FLAC__uint32)data[12] << 24 | (FLAC__uint32)data[13] << 16 | (FLAC__uint32)data[14] << 8 | (FLAC__uint32)data[15]; - if(color_type == 3) { - /* even though the bit depth for color_type==3 can be 1,2,4,or 8, - * the spec in 11.2.2 of http://www.w3.org/TR/PNG/ says that the - * sample depth is always 8 - */ - picture->depth = 8 * 3u; - need_palette = true; - data += 12 + clen; - len -= 12 + clen; - } - else { - if(color_type == 0) /* greyscale, 1 sample per pixel */ - picture->depth = (FLAC__uint32)data[16]; - if(color_type == 2) /* truecolor, 3 samples per pixel */ - picture->depth = (FLAC__uint32)data[16] * 3u; - if(color_type == 4) /* greyscale+alpha, 2 samples per pixel */ - picture->depth = (FLAC__uint32)data[16] * 2u; - if(color_type == 6) /* truecolor+alpha, 4 samples per pixel */ - picture->depth = (FLAC__uint32)data[16] * 4u; - picture->colors = 0; - return true; - } - } - else if(need_palette && 0 == memcmp(data+4, "PLTE", 4)) { - picture->colors = clen / 3u; - return true; - } - else if(clen + 12 > len) - return false; - else { - data += 12 + clen; - len -= 12 + clen; - } - } - } - else if(0 == strcmp(picture->mime_type, "image/jpeg")) { - /* c.f. http://www.w3.org/Graphics/JPEG/itu-t81.pdf and Q22 of http://www.faqs.org/faqs/jpeg-faq/part1/ */ - if(len < 2 || memcmp(data, "\xff\xd8", 2)) - return false; - data += 2; - len -= 2; - while(1) { - /* look for sync FF byte */ - for( ; len > 0; data++, len--) { - if(*data == 0xff) - break; - } - if(len == 0) - return false; - /* eat any extra pad FF bytes before marker */ - for( ; len > 0; data++, len--) { - if(*data != 0xff) - break; - } - if(len == 0) - return false; - /* if we hit SOS or EOI, bail */ - if(*data == 0xda || *data == 0xd9) - return false; - /* looking for some SOFn */ - else if(memchr("\xc0\xc1\xc2\xc3\xc5\xc6\xc7\xc9\xca\xcb\xcd\xce\xcf", *data, 13)) { - data++; len--; /* skip marker byte */ - if(len < 2) - return false; - else { - const FLAC__uint32 clen = (FLAC__uint32)data[0] << 8 | (FLAC__uint32)data[1]; - if(clen < 8 || len < clen) - return false; - picture->width = (FLAC__uint32)data[5] << 8 | (FLAC__uint32)data[6]; - picture->height = (FLAC__uint32)data[3] << 8 | (FLAC__uint32)data[4]; - picture->depth = (FLAC__uint32)data[2] * (FLAC__uint32)data[7]; - picture->colors = 0; - return true; - } - } - /* else skip it */ - else { - data++; len--; /* skip marker byte */ - if(len < 2) - return false; - else { - const FLAC__uint32 clen = (FLAC__uint32)data[0] << 8 | (FLAC__uint32)data[1]; - if(clen < 2 || len < clen) - return false; - data += clen; - len -= clen; - } - } - } - } - else if(0 == strcmp(picture->mime_type, "image/gif")) { - /* c.f. http://www.w3.org/Graphics/GIF/spec-gif89a.txt */ - if(len < 14) - return false; - if(memcmp(data, "GIF87a", 6) && memcmp(data, "GIF89a", 6)) - return false; -#if 0 - /* according to the GIF spec, even if the GCTF is 0, the low 3 bits should still tell the total # colors used */ - if(data[10] & 0x80 == 0) - return false; -#endif - picture->width = (FLAC__uint32)data[6] | ((FLAC__uint32)data[7] << 8); - picture->height = (FLAC__uint32)data[8] | ((FLAC__uint32)data[9] << 8); -#if 0 - /* this value doesn't seem to be reliable... */ - picture->depth = (((FLAC__uint32)(data[10] & 0x70) >> 4) + 1) * 3u; -#else - /* ...just pessimistically assume it's 24-bit color without scanning all the color tables */ - picture->depth = 8u * 3u; -#endif - picture->colors = 1u << ((FLAC__uint32)(data[10] & 0x07) + 1u); - return true; - } - return false; -} - -FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message) -{ - FLAC__StreamMetadata *obj; - int state = 0; - static const char *error_messages[] = { - "memory allocation error", - "invalid picture specification", - "invalid picture specification: can't parse resolution/color part", - "unable to extract resolution and color info from URL, user must set explicitly", - "unable to extract resolution and color info from file, user must set explicitly", - "error opening picture file", - "error reading picture file", - "invalid picture type", - "unable to guess MIME type from file, user must set explicitly", - "type 1 icon must be a 32x32 pixel PNG" - }; - - FLAC__ASSERT(0 != spec); - FLAC__ASSERT(0 != error_message); - - /* double protection */ - if(0 == spec) - return 0; - if(0 == error_message) - return 0; - - *error_message = 0; - - if(0 == (obj = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PICTURE))) - *error_message = error_messages[0]; - - if(strchr(spec, '|')) { /* full format */ - const char *p; - char *q; - for(p = spec; *error_message==0 && *p; ) { - if(*p == '|') { - switch(state) { - case 0: /* type */ - if(!local__parse_type_(spec, p-spec, &obj->data.picture)) - *error_message = error_messages[7]; - break; - case 1: /* mime type */ - if(p-spec) { /* if blank, we'll try to guess later from the picture data */ - if(0 == (q = local__strndup_(spec, p-spec))) - *error_message = error_messages[0]; - else if(!FLAC__metadata_object_picture_set_mime_type(obj, q, /*copy=*/false)) - *error_message = error_messages[0]; - } - break; - case 2: /* description */ - if(0 == (q = local__strndup_(spec, p-spec))) - *error_message = error_messages[0]; - else if(!FLAC__metadata_object_picture_set_description(obj, (FLAC__byte*)q, /*copy=*/false)) - *error_message = error_messages[0]; - break; - case 3: /* resolution/color (e.g. [300x300x16[/1234]] */ - if(!local__parse_resolution_(spec, p-spec, &obj->data.picture)) - *error_message = error_messages[2]; - break; - default: - *error_message = error_messages[1]; - break; - } - p++; - spec = p; - state++; - } - else - p++; - } - } - else { /* simple format, filename only, everything else guessed */ - if(!local__parse_type_("", 0, &obj->data.picture)) /* use default picture type */ - *error_message = error_messages[7]; - /* leave MIME type to be filled in later */ - /* leave description empty */ - /* leave the rest to be filled in later: */ - else if(!local__parse_resolution_("", 0, &obj->data.picture)) - *error_message = error_messages[2]; - else - state = 4; - } - - /* parse filename, read file, try to extract resolution/color info if needed */ - if(*error_message == 0) { - if(state != 4) - *error_message = error_messages[1]; - else { /* 'spec' points to filename/URL */ - if(0 == strcmp(obj->data.picture.mime_type, "-->")) { /* magic MIME type means URL */ - if(!FLAC__metadata_object_picture_set_data(obj, (FLAC__byte*)spec, strlen(spec), /*copy=*/true)) - *error_message = error_messages[0]; - else if(obj->data.picture.width == 0 || obj->data.picture.height == 0 || obj->data.picture.depth == 0) - *error_message = error_messages[3]; - } - else { /* regular picture file */ - const off_t size = grabbag__file_get_filesize(spec); - if(size < 0) - *error_message = error_messages[5]; - else { - FLAC__byte *buffer = (FLAC__byte*)safe_malloc_(size); - if(0 == buffer) - *error_message = error_messages[0]; - else { - FILE *f = fopen(spec, "rb"); - if(0 == f) - *error_message = error_messages[5]; - else { - if(fread(buffer, 1, size, f) != (size_t)size) - *error_message = error_messages[6]; - fclose(f); - if(0 == *error_message) { - if(!FLAC__metadata_object_picture_set_data(obj, buffer, size, /*copy=*/false)) - *error_message = error_messages[6]; - /* try to extract MIME type if user left it blank */ - else if(*obj->data.picture.mime_type == '\0' && !local__extract_mime_type_(obj)) - *error_message = error_messages[8]; - /* try to extract resolution/color info if user left it blank */ - else if((obj->data.picture.width == 0 || obj->data.picture.height == 0 || obj->data.picture.depth == 0) && !local__extract_resolution_color_info_(&obj->data.picture)) - *error_message = error_messages[4]; - } - } - } - } - } - } - } - - if(*error_message == 0) { - if( - obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && - ( - (strcmp(obj->data.picture.mime_type, "image/png") && strcmp(obj->data.picture.mime_type, "-->")) || - obj->data.picture.width != 32 || - obj->data.picture.height != 32 - ) - ) - *error_message = error_messages[9]; - } - - if(*error_message && obj) { - FLAC__metadata_object_delete(obj); - obj = 0; - } - - return obj; -} diff --git a/src/lib/dl/ext/flac/private/all.h b/src/lib/dl/ext/flac/private/all.h deleted file mode 100755 index 304c471a..00000000 --- a/src/lib/dl/ext/flac/private/all.h +++ /dev/null @@ -1,49 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 "bitmath.h" -#include "bitreader.h" -#include "bitwriter.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/src/lib/dl/ext/flac/private/bitmath.h b/src/lib/dl/ext/flac/private/bitmath.h deleted file mode 100755 index f3f53239..00000000 --- a/src/lib/dl/ext/flac/private/bitmath.h +++ /dev/null @@ -1,42 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 - -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/src/lib/dl/ext/flac/private/bitreader.h b/src/lib/dl/ext/flac/private/bitreader.h deleted file mode 100755 index e22bf210..00000000 --- a/src/lib/dl/ext/flac/private/bitreader.h +++ /dev/null @@ -1,99 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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__BITREADER_H -#define FLAC__PRIVATE__BITREADER_H - -#include /* for FILE */ -#include "flac/ordinals.h" -#include "cpu.h" - -/* - * opaque structure definition - */ -struct FLAC__BitReader; -typedef struct FLAC__BitReader FLAC__BitReader; - -typedef FLAC__bool (*FLAC__BitReaderReadCallback)(FLAC__byte buffer[], size_t *bytes, void *client_data); - -/* - * construction, deletion, initialization, etc functions - */ -FLAC__BitReader *FLAC__bitreader_new(void); -void FLAC__bitreader_delete(FLAC__BitReader *br); -FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__BitReaderReadCallback rcb, void *cd); -void FLAC__bitreader_free(FLAC__BitReader *br); /* does not 'free(br)' */ -FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br); -void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out); - -/* - * CRC functions - */ -void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed); -FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br); - -/* - * info functions - */ -FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br); -unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br); -unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br); - -/* - * read functions - */ - -FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits); -FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits); -FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits); -FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val); /*only for bits=32*/ -FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */ -FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals); /* WATCHOUT: does not CRC the read data! */ -FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals); /* WATCHOUT: does not CRC the read data! */ -FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val); -FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter); -FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); -#ifndef FLAC__NO_ASM -# ifdef FLAC__CPU_IA32 -# ifdef FLAC__HAS_NASM -FLAC__bool FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); -# endif -# endif -#endif -#if 0 /* UNUSED */ -FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter); -FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter); -#endif -FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen); -FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen); - -FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br); -#endif diff --git a/src/lib/dl/ext/flac/private/bitwriter.h b/src/lib/dl/ext/flac/private/bitwriter.h deleted file mode 100755 index 11eee199..00000000 --- a/src/lib/dl/ext/flac/private/bitwriter.h +++ /dev/null @@ -1,103 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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__BITWRITER_H -#define FLAC__PRIVATE__BITWRITER_H - -#include /* for FILE */ -#include "flac/ordinals.h" - -/* - * opaque structure definition - */ -struct FLAC__BitWriter; -typedef struct FLAC__BitWriter FLAC__BitWriter; - -/* - * construction, deletion, initialization, etc functions - */ -FLAC__BitWriter *FLAC__bitwriter_new(void); -void FLAC__bitwriter_delete(FLAC__BitWriter *bw); -FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw); -void FLAC__bitwriter_free(FLAC__BitWriter *bw); /* does not 'free(buffer)' */ -void FLAC__bitwriter_clear(FLAC__BitWriter *bw); -void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out); - -/* - * CRC functions - * - * non-const *bw because they have to cal FLAC__bitwriter_get_buffer() - */ -FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc); -FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc); - -/* - * info functions - */ -FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw); -unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */ - -/* - * direct buffer access - * - * there may be no calls on the bitwriter between get and release. - * the bitwriter continues to own the returned buffer. - * before get, bitwriter MUST be byte aligned: check with FLAC__bitwriter_is_byte_aligned() - */ -FLAC__bool FLAC__bitwriter_get_buffer(FLAC__BitWriter *bw, const FLAC__byte **buffer, size_t *bytes); -void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw); - -/* - * write functions - */ -FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits); -FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits); -FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits); -FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits); -FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val); /*only for bits=32*/ -FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals); -FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val); -unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter); -#if 0 /* UNUSED */ -unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter); -unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned val, unsigned parameter); -#endif -FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter); -FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter); -#if 0 /* UNUSED */ -FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter); -FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned val, unsigned parameter); -#endif -FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val); -FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val); -FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw); - -#endif diff --git a/src/lib/dl/ext/flac/private/cpu.h b/src/lib/dl/ext/flac/private/cpu.h deleted file mode 100755 index bc3b60f8..00000000 --- a/src/lib/dl/ext/flac/private/cpu.h +++ /dev/null @@ -1,88 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 "config.h" -#endif - -typedef enum { - FLAC__CPUINFO_TYPE_IA32, - FLAC__CPUINFO_TYPE_PPC, - FLAC__CPUINFO_TYPE_UNKNOWN -} FLAC__CPUInfo_Type; - -typedef struct { - FLAC__bool cpuid; - FLAC__bool bswap; - FLAC__bool cmov; - FLAC__bool mmx; - FLAC__bool fxsr; - FLAC__bool sse; - FLAC__bool sse2; - FLAC__bool sse3; - FLAC__bool ssse3; - FLAC__bool _3dnow; - FLAC__bool ext3dnow; - FLAC__bool extmmx; -} FLAC__CPUInfo_IA32; - -typedef struct { - FLAC__bool altivec; - FLAC__bool ppc64; -} FLAC__CPUInfo_PPC; - -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 -FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void); -void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx); -FLAC__uint32 FLAC__cpu_info_extended_amd_asm_ia32(void); -#endif -#endif -#endif - -#endif diff --git a/src/lib/dl/ext/flac/private/crc.h b/src/lib/dl/ext/flac/private/crc.h deleted file mode 100755 index 2f2a5574..00000000 --- a/src/lib/dl/ext/flac/private/crc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 unsigned FLAC__crc16_table[256]; - -#define FLAC__CRC16_UPDATE(data, crc) (((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)])) -/* this alternate may be faster on some systems/compilers */ -#if 0 -#define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff) -#endif - -unsigned FLAC__crc16(const FLAC__byte *data, unsigned len); - -#endif diff --git a/src/lib/dl/ext/flac/private/fixed.h b/src/lib/dl/ext/flac/private/fixed.h deleted file mode 100755 index 7d83d881..00000000 --- a/src/lib/dl/ext/flac/private/fixed.h +++ /dev/null @@ -1,97 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 "config.h" -#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/src/lib/dl/ext/flac/private/float.h b/src/lib/dl/ext/flac/private/float.h deleted file mode 100755 index a128c2bb..00000000 --- a/src/lib/dl/ext/flac/private/float.h +++ /dev/null @@ -1,97 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2004,2005,2006,2007 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 "config.h" -#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< 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 (more - * specifically, the variance of - * the error signal times # of - * samples in the signal) - * - * 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 overhead_bits_per_order # of bits overhead for each increased LP order - * (includes warmup sample size and quantized LP coefficient) - * RETURN [1,max_order] best order - */ -unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order); - -#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ - -#endif diff --git a/src/lib/dl/ext/flac/private/md5.h b/src/lib/dl/ext/flac/private/md5.h deleted file mode 100755 index 8178ff9c..00000000 --- a/src/lib/dl/ext/flac/private/md5.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef FLAC__PRIVATE__MD5_H -#define FLAC__PRIVATE__MD5_H - -/* - * 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, with no warranty. - */ - -#include "flac/ordinals.h" - -typedef struct { - FLAC__uint32 in[16]; - FLAC__uint32 buf[4]; - FLAC__uint32 bytes[2]; - FLAC__byte *internal_buf; - size_t capacity; -} FLAC__MD5Context; - -void FLAC__MD5Init(FLAC__MD5Context *context); -void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context); - -FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample); - -#endif diff --git a/src/lib/dl/ext/flac/private/memory.h b/src/lib/dl/ext/flac/private/memory.h deleted file mode 100755 index 61c224c1..00000000 --- a/src/lib/dl/ext/flac/private/memory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 "config.h" -#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/src/lib/dl/ext/flac/private/metadata.h b/src/lib/dl/ext/flac/private/metadata.h deleted file mode 100755 index 3529ade4..00000000 --- a/src/lib/dl/ext/flac/private/metadata.h +++ /dev/null @@ -1,45 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2002,2003,2004,2005,2006,2007 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" - -/* WATCHOUT: all malloc()ed data in the block is free()ed; this may not - * be a consistent state (e.g. PICTURE) or equivalent to the initial - * state after FLAC__metadata_object_new() - */ -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/src/lib/dl/ext/flac/private/ogg_decoder_aspect.h b/src/lib/dl/ext/flac/private/ogg_decoder_aspect.h deleted file mode 100755 index 0fe6bb29..00000000 --- a/src/lib/dl/ext/flac/private/ogg_decoder_aspect.h +++ /dev/null @@ -1,79 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 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__OGG_DECODER_ASPECT_H -#define FLAC__PRIVATE__OGG_DECODER_ASPECT_H - -#include - -#include "flac/ordinals.h" -#include "flac/stream_decoder.h" /* for FLAC__StreamDecoderReadStatus */ - -typedef struct FLAC__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 */ -} FLAC__OggDecoderAspect; - -void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value); -void FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect); -FLAC__bool FLAC__ogg_decoder_aspect_init(FLAC__OggDecoderAspect *aspect); -void FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect); -void FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect); -void FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect); - -typedef enum { - FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK = 0, - FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM, - FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC, - FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC, - FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION, - FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT, - FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR, - FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR -} FLAC__OggDecoderAspectReadStatus; - -typedef FLAC__OggDecoderAspectReadStatus (*FLAC__OggDecoderAspectReadCallbackProxy)(const void *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); - -FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data); - -#endif diff --git a/src/lib/dl/ext/flac/private/ogg_encoder_aspect.h b/src/lib/dl/ext/flac/private/ogg_encoder_aspect.h deleted file mode 100755 index ebaa2edd..00000000 --- a/src/lib/dl/ext/flac/private/ogg_encoder_aspect.h +++ /dev/null @@ -1,62 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 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__OGG_ENCODER_ASPECT_H -#define FLAC__PRIVATE__OGG_ENCODER_ASPECT_H - -#include - -#include "flac/ordinals.h" -#include "flac/stream_encoder.h" /* for FLAC__StreamEncoderWriteStatus */ - -typedef struct FLAC__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; -} FLAC__OggEncoderAspect; - -void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value); -FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value); -void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect); -FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect); -void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect); - -typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); - -FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data); -#endif diff --git a/src/lib/dl/ext/flac/private/ogg_helper.h b/src/lib/dl/ext/flac/private/ogg_helper.h deleted file mode 100755 index 04590398..00000000 --- a/src/lib/dl/ext/flac/private/ogg_helper.h +++ /dev/null @@ -1,43 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 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__OGG_HELPER_H -#define FLAC__PRIVATE__OGG_HELPER_H - -#include -#include "flac/stream_encoder.h" /* for FLAC__StreamEncoder */ - -void simple_ogg_page__init(ogg_page *page); -void simple_ogg_page__clear(ogg_page *page); -FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderReadCallback read_callback, void *client_data); -FLAC__bool simple_ogg_page__set_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderWriteCallback write_callback, void *client_data); - -#endif diff --git a/src/lib/dl/ext/flac/private/ogg_mapping.h b/src/lib/dl/ext/flac/private/ogg_mapping.h deleted file mode 100755 index c04cbbf4..00000000 --- a/src/lib/dl/ext/flac/private/ogg_mapping.h +++ /dev/null @@ -1,63 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 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__OGG_MAPPING_H -#define FLAC__PRIVATE__OGG_MAPPING_H - -#include "flac/ordinals.h" - -/** The length of the 'FLAC' magic in bytes. */ -#define FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH (1u) - -extern const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN; /* = 8 bits */ - -extern const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE; /* = 0x7f */ - -/** The length of the 'FLAC' magic in bytes. */ -#define FLAC__OGG_MAPPING_MAGIC_LENGTH (4u) - -extern const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC; /* = "FLAC" */ - -extern const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN; /* = 8 bits */ -extern const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */ - -/** The length of the Ogg FLAC mapping major version number in bytes. */ -#define FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH (1u) - -/** The length of the Ogg FLAC mapping minor version number in bytes. */ -#define FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH (1u) - -extern const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN; /* = 16 bits */ - -/** The length of the #-of-header-packets number bytes. */ -#define FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH (2u) - -#endif diff --git a/src/lib/dl/ext/flac/private/stream_encoder_framing.h b/src/lib/dl/ext/flac/private/stream_encoder_framing.h deleted file mode 100755 index a27e7d66..00000000 --- a/src/lib/dl/ext/flac/private/stream_encoder_framing.h +++ /dev/null @@ -1,45 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 "bitwriter.h" - -FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw); -FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); - -#endif diff --git a/src/lib/dl/ext/flac/private/window.h b/src/lib/dl/ext/flac/private/window.h deleted file mode 100755 index 4e6d82a9..00000000 --- a/src/lib/dl/ext/flac/private/window.h +++ /dev/null @@ -1,71 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2006,2007 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__WINDOW_H -#define FLAC__PRIVATE__WINDOW_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "private/float.h" -#include "flac/format.h" - -#ifndef FLAC__INTEGER_ONLY_LIBRARY - -/* - * FLAC__window_*() - * -------------------------------------------------------------------- - * Calculates window coefficients according to different apodization - * functions. - * - * OUT window[0,L-1] - * IN L (number of points in window) - */ -void FLAC__window_bartlett(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev); /* 0.0 < stddev <= 0.5 */ -void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_triangle(FLAC__real *window, const FLAC__int32 L); -void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p); -void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L); - -#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ - -#endif diff --git a/src/lib/dl/ext/flac/protected/all.h b/src/lib/dl/ext/flac/protected/all.h deleted file mode 100755 index 2921092b..00000000 --- a/src/lib/dl/ext/flac/protected/all.h +++ /dev/null @@ -1,38 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 "stream_decoder.h" -#include "stream_encoder.h" - -#endif diff --git a/src/lib/dl/ext/flac/protected/stream_decoder.h b/src/lib/dl/ext/flac/protected/stream_decoder.h deleted file mode 100755 index d77d51c0..00000000 --- a/src/lib/dl/ext/flac/protected/stream_decoder.h +++ /dev/null @@ -1,58 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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" -#if FLAC__HAS_OGG -#include "private/ogg_decoder_aspect.h" -#endif - -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__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ -#if FLAC__HAS_OGG - FLAC__OggDecoderAspect ogg_decoder_aspect; -#endif -} 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/src/lib/dl/ext/flac/protected/stream_encoder.h b/src/lib/dl/ext/flac/protected/stream_encoder.h deleted file mode 100755 index 7cd9649e..00000000 --- a/src/lib/dl/ext/flac/protected/stream_encoder.h +++ /dev/null @@ -1,110 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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" -#if FLAC__HAS_OGG -#include "private/ogg_encoder_aspect.h" -#endif - -#ifndef FLAC__INTEGER_ONLY_LIBRARY - -#include "private/float.h" - -#define FLAC__MAX_APODIZATION_FUNCTIONS 32 - -typedef enum { - FLAC__APODIZATION_BARTLETT, - FLAC__APODIZATION_BARTLETT_HANN, - FLAC__APODIZATION_BLACKMAN, - FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE, - FLAC__APODIZATION_CONNES, - FLAC__APODIZATION_FLATTOP, - FLAC__APODIZATION_GAUSS, - FLAC__APODIZATION_HAMMING, - FLAC__APODIZATION_HANN, - FLAC__APODIZATION_KAISER_BESSEL, - FLAC__APODIZATION_NUTTALL, - FLAC__APODIZATION_RECTANGLE, - FLAC__APODIZATION_TRIANGLE, - FLAC__APODIZATION_TUKEY, - FLAC__APODIZATION_WELCH -} FLAC__ApodizationFunction; - -typedef struct { - FLAC__ApodizationFunction type; - union { - struct { - FLAC__real stddev; - } gauss; - struct { - FLAC__real p; - } tukey; - } parameters; -} FLAC__ApodizationSpecification; - -#endif // #ifndef FLAC__INTEGER_ONLY_LIBRARY - -typedef struct FLAC__StreamEncoderProtected { - FLAC__StreamEncoderState state; - FLAC__bool verify; - FLAC__bool streamable_subset; - FLAC__bool do_md5; - FLAC__bool do_mid_side_stereo; - FLAC__bool loose_mid_side_stereo; - unsigned channels; - unsigned bits_per_sample; - unsigned sample_rate; - unsigned blocksize; -#ifndef FLAC__INTEGER_ONLY_LIBRARY - unsigned num_apodizations; - FLAC__ApodizationSpecification apodizations[FLAC__MAX_APODIZATION_FUNCTIONS]; -#endif - 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__uint64 streaminfo_offset, seektable_offset, audio_offset; -#if FLAC__HAS_OGG - FLAC__OggEncoderAspect ogg_encoder_aspect; -#endif -} FLAC__StreamEncoderProtected; - -#endif diff --git a/src/lib/dl/ext/flac/replaygain.c b/src/lib/dl/ext/flac/replaygain.c deleted file mode 100755 index 581d5cc6..00000000 --- a/src/lib/dl/ext/flac/replaygain.c +++ /dev/null @@ -1,666 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "share/grabbag.h" -#include "share/replaygain_analysis.h" -#include "flac/assert.h" -#include "flac/metadata.h" -#include "flac/stream_decoder.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 char *reference_format_ = "%s=%2.1f dB"; -static const char *gain_format_ = "%s=%+2.2f dB"; -static const char *peak_format_ = "%s=%1.8f"; - -static double album_peak_, title_peak_; - -const unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED = 190; -/* - FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 29 + 1 + 8 + - 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 -*/ - -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS = (const FLAC__byte * const)"REPLAYGAIN_REFERENCE_LOUDNESS"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN = (const FLAC__byte * const)"REPLAYGAIN_TRACK_GAIN"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK = (const FLAC__byte * const)"REPLAYGAIN_TRACK_PEAK"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN = (const FLAC__byte * const)"REPLAYGAIN_ALBUM_GAIN"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK = (const FLAC__byte * const)"REPLAYGAIN_ALBUM_PEAK"; - - -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); -} - -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 != format); - FLAC__ASSERT(0 != name); - - 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 = strdup(setlocale(LC_ALL, 0)); - if (0 == saved_locale) - return false; - 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); - free(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__StreamDecoder *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__StreamDecoder *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__StreamDecoder *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__StreamDecoder *decoder = FLAC__stream_decoder_new(); - - if(0 == decoder) - return "memory allocation error"; - - instance.error = false; - - /* It does these three by default but lets be explicit: */ - FLAC__stream_decoder_set_md5_checking(decoder, false); - FLAC__stream_decoder_set_metadata_ignore_all(decoder); - FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_STREAMINFO); - - if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, &instance) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - FLAC__stream_decoder_delete(decoder); - return "initializing decoder"; - } - - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder) || instance.error) { - FLAC__stream_decoder_delete(decoder); - return "decoding file"; - } - - FLAC__stream_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_reference(block))) - return 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_reference(FLAC__StreamMetadata *block) -{ - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - if(FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS) < 0) - return "memory allocation error"; - - if(!append_tag_(block, reference_format_, GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS, ReplayGainReferenceLoudness)) - return "memory allocation 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 *)GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN) < 0 || - FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK) < 0 - ) - return "memory allocation error"; - - if( - !append_tag_(block, gain_format_, GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN, album_gain) || - !append_tag_(block, peak_format_, GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK, album_peak) - ) - 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 *)GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN) < 0 || - FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK) < 0 - ) - return "memory allocation error"; - - if( - !append_tag_(block, gain_format_, GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN, title_gain) || - !append_tag_(block, peak_format_, GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK, title_peak) - ) - 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_reference(const char *filename, 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_reference(block))) { - 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, FLAC__bool strict, double *reference, double *gain, double *peak) -{ - int reference_offset, gain_offset, peak_offset; - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(0 != reference); - FLAC__ASSERT(0 != gain); - FLAC__ASSERT(0 != peak); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - /* Default to current level until overridden by a detected tag; this - * will always be true until we change replaygain_analysis.c - */ - *reference = ReplayGainReferenceLoudness; - - if(0 <= (reference_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS))) - (void)parse_double_(block->data.vorbis_comment.comments + reference_offset, reference); - - if(0 > (gain_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)(album_mode? GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN : GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN)))) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); - if(0 > (peak_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)(album_mode? GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK : GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK)))) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); - - if(!parse_double_(block->data.vorbis_comment.comments + gain_offset, gain)) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); - if(!parse_double_(block->data.vorbis_comment.comments + peak_offset, peak)) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); - - 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/src/lib/dl/ext/flac/replaygain_analysis.c b/src/lib/dl/ext/flac/replaygain_analysis.c deleted file mode 100755 index d795606e..00000000 --- a/src/lib/dl/ext/flac/replaygain_analysis.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * 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. - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include - -#include "share/replaygain_analysis.h" - -Float_t ReplayGainReferenceLoudness = 89.0; /* in dB SPL */ - -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. - */ -#ifndef __sun - #define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 1.) /* max. Samples per Time slice */ -#else - /* [JEC] Solaris Forte compiler doesn't like float calc in array indices */ - #define MAX_SAMPLES_PER_WINDOW (size_t) (2401) -#endif -#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; -#ifndef __sun -static Uint32_t A [(size_t)(STEPS_per_dB * MAX_dB)]; -static Uint32_t B [(size_t)(STEPS_per_dB * MAX_dB)]; -#else -/* [JEC] Solaris Forte compiler doesn't like float calc in array indices */ -static Uint32_t A [12000]; -static Uint32_t B [12000]; -#endif - -/* 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/src/lib/dl/ext/flac/replaygain_synthesis.c b/src/lib/dl/ext/flac/replaygain_synthesis.c deleted file mode 100755 index b3a98aa3..00000000 --- a/src/lib/dl/ext/flac/replaygain_synthesis.c +++ /dev/null @@ -1,467 +0,0 @@ -/* replaygain_synthesis - Routines for applying ReplayGain to a signal - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include /* for memset() */ -#include -#include "fast_float_math_hack.h" -#include "share/replaygain_synthesis.h" -#include "flac/assert.h" - -#ifndef FLaC__INLINE -#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_(void) -{ - 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/src/lib/dl/ext/flac/seektable.c b/src/lib/dl/ext/flac/seektable.c deleted file mode 100755 index 33419af7..00000000 --- a/src/lib/dl/ext/flac/seektable.c +++ /dev/null @@ -1,132 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "share/grabbag.h" -#include "flac/assert.h" -#include /* for atoi() */ -#include - -#ifdef _MSC_VER -/* There's no strtoll() in MSVC6 so we just write a specialized one */ -static FLAC__int64 local__strtoll(const char *src, char **endptr) -{ - FLAC__bool neg = false; - FLAC__int64 ret = 0; - int c; - FLAC__ASSERT(0 != src); - if(*src == '-') { - neg = true; - src++; - } - while(0 != (c = *src)) { - c -= '0'; - if(c >= 0 && c <= 9) - ret = (ret * 10) + c; - else - break; - src++; - } - if(endptr) - *endptr = (char*)src; - return neg? -ret : ret; -} -#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) -{ - 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) { - const int n = (unsigned)atoi(pt); - if(n > 0) - if(!FLAC__metadata_object_seektable_template_append_spaced_points(seektable_template, (unsigned)n, 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) { - const double sec = atof(pt); - if(sec > 0.0) { - unsigned samples = (unsigned)(sec * (double)sample_rate); - if(samples > 0) { - /* +1 for the initial point at sample 0 */ - if(!FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(seektable_template, samples, total_samples_to_encode)) - return false; - } - } - } - } - } - else { /* -S # */ - if(0 != spec_has_real_points) - *spec_has_real_points = true; - if(!only_explicit_placeholders) { - char *endptr; -#ifdef _MSC_VER - const FLAC__int64 n = local__strtoll(pt, &endptr); -#else - const FLAC__int64 n = (FLAC__int64)strtoll(pt, &endptr, 10); -#endif - if( - (n > 0 || (endptr > pt && *endptr == ';')) && /* is a valid number (extra check needed for "0") */ - (total_samples_to_encode == 0 || (FLAC__uint64)n < total_samples_to_encode) /* number is not >= the known total_samples_to_encode */ - ) - if(!FLAC__metadata_object_seektable_template_append_point(seektable_template, (FLAC__uint64)n)) - return false; - } - } - } - - pt = ++q; - } - - if(!FLAC__metadata_object_seektable_template_sort(seektable_template, /*compact=*/true)) - return false; - - return true; -} diff --git a/src/lib/dl/ext/flac/share/alloc.h b/src/lib/dl/ext/flac/share/alloc.h deleted file mode 100755 index b4980aa5..00000000 --- a/src/lib/dl/ext/flac/share/alloc.h +++ /dev/null @@ -1,212 +0,0 @@ -/* alloc - Convenience routines for safely allocating memory - * Copyright (C) 2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef FLAC__SHARE__ALLOC_H -#define FLAC__SHARE__ALLOC_H - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -/* WATCHOUT: for c++ you may have to #define __STDC_LIMIT_MACROS 1 real early - * before #including this file, otherwise SIZE_MAX might not be defined - */ - -#include /* for SIZE_MAX */ -#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ -#include /* for SIZE_MAX in case limits.h didn't get it */ -#endif -#include /* for size_t, malloc(), etc */ - -#ifndef SIZE_MAX -# ifndef SIZE_T_MAX -# ifdef _MSC_VER -# define SIZE_T_MAX UINT_MAX -# else -# error -# endif -# endif -# define SIZE_MAX SIZE_T_MAX -#endif - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - -/* avoid malloc()ing 0 bytes, see: - * https://www.securecoding.cert.org/confluence/display/seccode/MEM04-A.+Do+not+make+assumptions+about+the+result+of+allocating+0+bytes?focusedCommentId=5407003 -*/ -static FLaC__INLINE void *safe_malloc_(size_t size) -{ - /* malloc(0) is undefined; FLAC src convention is to always allocate */ - if(!size) - size++; - return malloc(size); -} - -static FLaC__INLINE void *safe_calloc_(size_t nmemb, size_t size) -{ - if(!nmemb || !size) - return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ - return calloc(nmemb, size); -} - -/*@@@@ there's probably a better way to prevent overflows when allocating untrusted sums but this works for now */ - -static FLaC__INLINE void *safe_malloc_add_2op_(size_t size1, size_t size2) -{ - size2 += size1; - if(size2 < size1) - return 0; - return safe_malloc_(size2); -} - -static FLaC__INLINE void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3) -{ - size2 += size1; - if(size2 < size1) - return 0; - size3 += size2; - if(size3 < size2) - return 0; - return safe_malloc_(size3); -} - -static FLaC__INLINE void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4) -{ - size2 += size1; - if(size2 < size1) - return 0; - size3 += size2; - if(size3 < size2) - return 0; - size4 += size3; - if(size4 < size3) - return 0; - return safe_malloc_(size4); -} - -static FLaC__INLINE void *safe_malloc_mul_2op_(size_t size1, size_t size2) -#if 0 -needs support for cases where sizeof(size_t) != 4 -{ - /* could be faster #ifdef'ing off SIZEOF_SIZE_T */ - if(sizeof(size_t) == 4) { - if ((double)size1 * (double)size2 < 4294967296.0) - return malloc(size1*size2); - } - return 0; -} -#else -/* better? */ -{ - if(!size1 || !size2) - return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ - if(size1 > SIZE_MAX / size2) - return 0; - return malloc(size1*size2); -} -#endif - -static FLaC__INLINE void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3) -{ - if(!size1 || !size2 || !size3) - return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ - if(size1 > SIZE_MAX / size2) - return 0; - size1 *= size2; - if(size1 > SIZE_MAX / size3) - return 0; - return malloc(size1*size3); -} - -/* size1*size2 + size3 */ -static FLaC__INLINE void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3) -{ - if(!size1 || !size2) - return safe_malloc_(size3); - if(size1 > SIZE_MAX / size2) - return 0; - return safe_malloc_add_2op_(size1*size2, size3); -} - -/* size1 * (size2 + size3) */ -static FLaC__INLINE void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3) -{ - if(!size1 || (!size2 && !size3)) - return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ - size2 += size3; - if(size2 < size3) - return 0; - return safe_malloc_mul_2op_(size1, size2); -} - -static FLaC__INLINE void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2) -{ - size2 += size1; - if(size2 < size1) - return 0; - return realloc(ptr, size2); -} - -static FLaC__INLINE void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3) -{ - size2 += size1; - if(size2 < size1) - return 0; - size3 += size2; - if(size3 < size2) - return 0; - return realloc(ptr, size3); -} - -static FLaC__INLINE void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4) -{ - size2 += size1; - if(size2 < size1) - return 0; - size3 += size2; - if(size3 < size2) - return 0; - size4 += size3; - if(size4 < size3) - return 0; - return realloc(ptr, size4); -} - -static FLaC__INLINE void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2) -{ - if(!size1 || !size2) - return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */ - if(size1 > SIZE_MAX / size2) - return 0; - return realloc(ptr, size1*size2); -} - -/* size1 * (size2 + size3) */ -static FLaC__INLINE void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3) -{ - if(!size1 || (!size2 && !size3)) - return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */ - size2 += size3; - if(size2 < size3) - return 0; - return safe_realloc_mul_2op_(ptr, size1, size2); -} - -#endif diff --git a/src/lib/dl/ext/flac/share/getopt.h b/src/lib/dl/ext/flac/share/getopt.h deleted file mode 100755 index 1b314b2e..00000000 --- a/src/lib/dl/ext/flac/share/getopt.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - 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 removed 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/src/lib/dl/ext/flac/share/grabbag.h b/src/lib/dl/ext/flac/share/grabbag.h deleted file mode 100755 index 42c6998e..00000000 --- a/src/lib/dl/ext/flac/share/grabbag.h +++ /dev/null @@ -1,29 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/picture.h" -#include "grabbag/replaygain.h" -#include "grabbag/seektable.h" - -#endif diff --git a/src/lib/dl/ext/flac/share/grabbag/cuesheet.h b/src/lib/dl/ext/flac/share/grabbag/cuesheet.h deleted file mode 100755 index f13b0b9f..00000000 --- a/src/lib/dl/ext/flac/share/grabbag/cuesheet.h +++ /dev/null @@ -1,42 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/src/lib/dl/ext/flac/share/grabbag/file.h b/src/lib/dl/ext/flac/share/grabbag/file.h deleted file mode 100755 index 00ebaa2a..00000000 --- a/src/lib/dl/ext/flac/share/grabbag/file.h +++ /dev/null @@ -1,63 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 - -/* needed because of off_t */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#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); - -/* returns true iff stat() succeeds for both files and they have the same device and inode. */ -/* on windows, uses GetFileInformationByHandle() to compare */ -FLAC__bool grabbag__file_are_same(const char *f1, const char *f2); - -/* 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(void); -FILE *grabbag__file_get_binary_stdout(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/flac/share/grabbag/picture.h b/src/lib/dl/ext/flac/share/grabbag/picture.h deleted file mode 100755 index e6a56a1d..00000000 --- a/src/lib/dl/ext/flac/share/grabbag/picture.h +++ /dev/null @@ -1,46 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2006,2007 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__PICTURE_H -#define GRABBAG__PICTURE_H - -#include "flac/metadata.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g. - * "|image/jpeg|||cover.jpg" - * "4|image/jpeg||300x300x24|backcover.jpg" - * "|image/png|description|300x300x24/71|cover.png" - * "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif" - * - * empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER - * empty resolution spec means to get from the file (cannot get used with "-->" linked images) - * spec and error_message must not be NULL - */ -FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/flac/share/grabbag/replaygain.h b/src/lib/dl/ext/flac/share/grabbag/replaygain.h deleted file mode 100755 index 9c11d2af..00000000 --- a/src/lib/dl/ext/flac/share/grabbag/replaygain.h +++ /dev/null @@ -1,72 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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; - -extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS; /* = "REPLAYGAIN_REFERENCE_LOUDNESS" */ -extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN; /* = "REPLAYGAIN_TRACK_GAIN" */ -extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK; /* = "REPLAYGAIN_TRACK_PEAK" */ -extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN; /* = "REPLAYGAIN_ALBUM_GAIN" */ -extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK; /* = "REPLAYGAIN_ALBUM_PEAK" */ - -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_reference(FLAC__StreamMetadata *block); -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_reference(const char *filename, 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, FLAC__bool strict, double *reference, 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/src/lib/dl/ext/flac/share/grabbag/seektable.h b/src/lib/dl/ext/flac/share/grabbag/seektable.h deleted file mode 100755 index 0b8e8f43..00000000 --- a/src/lib/dl/ext/flac/share/grabbag/seektable.h +++ /dev/null @@ -1,38 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/src/lib/dl/ext/flac/share/replaygain_analysis.h b/src/lib/dl/ext/flac/share/replaygain_analysis.h deleted file mode 100755 index 02067d21..00000000 --- a/src/lib/dl/ext/flac/share/replaygain_analysis.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 */ - -extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */ - -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/src/lib/dl/ext/flac/share/replaygain_synthesis.h b/src/lib/dl/ext/flac/share/replaygain_synthesis.h deleted file mode 100755 index 51e32af6..00000000 --- a/src/lib/dl/ext/flac/share/replaygain_synthesis.h +++ /dev/null @@ -1,51 +0,0 @@ -/* replaygain_synthesis - Routines for applying ReplayGain to a signal - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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/src/lib/dl/ext/flac/share/utf8.h b/src/lib/dl/ext/flac/share/utf8.h deleted file mode 100755 index 7d6650d6..00000000 --- a/src/lib/dl/ext/flac/share/utf8.h +++ /dev/null @@ -1,25 +0,0 @@ -#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 '?') - */ - -int utf8_encode(const char *from, char **to); -int utf8_decode(const char *from, char **to); - -#endif diff --git a/src/lib/dl/ext/flac/stream_decoder.c b/src/lib/dl/ext/flac/stream_decoder.c deleted file mode 100755 index 2805cea6..00000000 --- a/src/lib/dl/ext/flac/stream_decoder.c +++ /dev/null @@ -1,3392 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#if defined _MSC_VER || defined __MINGW32__ -#include /* for _setmode() */ -#include /* for _O_BINARY */ -#endif -#if defined __CYGWIN__ || defined __EMX__ -#include /* for setmode(), O_BINARY */ -#include /* for _O_BINARY */ -#endif -#include -#include /* for malloc() */ -#include /* for memset/memcpy() */ -#include /* for stat() */ -#include /* for off_t */ -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif -#include "flac/assert.h" -#include "share/alloc.h" -#include "protected/stream_decoder.h" -#include "private/bitreader.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/md5.h" -#include "private/memory.h" - -#ifdef TARGET_MSDOS /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#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 - - -/* technically this should be in an "export.c" but this is convenient enough */ -FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = -#if FLAC__HAS_OGG - 1 -#else - 0 -#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 FILE *get_binary_stdin_(void); -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 read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_Picture *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, FLAC__bool is_extended); -static FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder); -static FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data); -#if FLAC__HAS_OGG -static FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes); -static FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); -#endif -static FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[]); -static void send_error_to_client_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status); -static FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample); -#if FLAC__HAS_OGG -static FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample); -#endif -static FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); -static FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); -static FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); -static FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); -static FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *client_data); - -/*********************************************************************** - * - * Private class data - * - ***********************************************************************/ - -typedef struct FLAC__StreamDecoderPrivate { -#if FLAC__HAS_OGG - FLAC__bool is_ogg; -#endif - FLAC__StreamDecoderReadCallback read_callback; - FLAC__StreamDecoderSeekCallback seek_callback; - FLAC__StreamDecoderTellCallback tell_callback; - FLAC__StreamDecoderLengthCallback length_callback; - FLAC__StreamDecoderEofCallback eof_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[]); - FLAC__bool (*local_bitreader_read_rice_signed_block)(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); - void *client_data; - FILE *file; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */ - FLAC__BitReader *input; - 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 fixed_block_size, next_fixed_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; - size_t 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__bool do_md5_checking; /* initially gets protected_->md5_checking but is turned off after a seek or if the metadata has a zero MD5 */ - FLAC__bool internal_reset_hack; /* used only during init() so we can call reset to set up the decoder without rewinding the input */ - FLAC__bool is_seeking; - FLAC__MD5Context md5context; - 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__Frame last_frame; /* holds the info of the last frame we seeked to */ - FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */ - FLAC__uint64 target_sample; - unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */ -#if FLAC__HAS_OGG - FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */ -#endif -} 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_OGG_ERROR", - "FLAC__STREAM_DECODER_SEEK_ERROR", - "FLAC__STREAM_DECODER_ABORTED", - "FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR", - "FLAC__STREAM_DECODER_UNINITIALIZED" -}; - -FLAC_API const char * const FLAC__StreamDecoderInitStatusString[] = { - "FLAC__STREAM_DECODER_INIT_STATUS_OK", - "FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER", - "FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS", - "FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR", - "FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE", - "FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED" -}; - -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__StreamDecoderSeekStatusString[] = { - "FLAC__STREAM_DECODER_SEEK_STATUS_OK", - "FLAC__STREAM_DECODER_SEEK_STATUS_ERROR", - "FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED" -}; - -FLAC_API const char * const FLAC__StreamDecoderTellStatusString[] = { - "FLAC__STREAM_DECODER_TELL_STATUS_OK", - "FLAC__STREAM_DECODER_TELL_STATUS_ERROR", - "FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED" -}; - -FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[] = { - "FLAC__STREAM_DECODER_LENGTH_STATUS_OK", - "FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR", - "FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED" -}; - -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", - "FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM" -}; - -/*********************************************************************** - * - * Class constructor/destructor - * - ***********************************************************************/ -FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) -{ - 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__bitreader_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__bitreader_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]); - - decoder->private_->file = 0; - - 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); - - (void)FLAC__stream_decoder_finish(decoder); - - if(0 != decoder->private_->metadata_filter_ids) - free(decoder->private_->metadata_filter_ids); - - FLAC__bitreader_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 - * - ***********************************************************************/ - -static FLAC__StreamDecoderInitStatus init_stream_internal_( - FLAC__StreamDecoder *decoder, - FLAC__StreamDecoderReadCallback read_callback, - FLAC__StreamDecoderSeekCallback seek_callback, - FLAC__StreamDecoderTellCallback tell_callback, - FLAC__StreamDecoderLengthCallback length_callback, - FLAC__StreamDecoderEofCallback eof_callback, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data, - FLAC__bool is_ogg -) -{ - FLAC__ASSERT(0 != decoder); - - if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) - return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; - -#if !FLAC__HAS_OGG - if(is_ogg) - return FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER; -#endif - - if( - 0 == read_callback || - 0 == write_callback || - 0 == error_callback || - (seek_callback && (0 == tell_callback || 0 == length_callback || 0 == eof_callback)) - ) - return FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; - -#if FLAC__HAS_OGG - decoder->private_->is_ogg = is_ogg; - if(is_ogg && !FLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect)) - return decoder->protected_->state = FLAC__STREAM_DECODER_OGG_ERROR; -#endif - - /* - * 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; - decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block; - /* now override with asm where appropriate */ -#ifndef FLAC__NO_ASM - if(decoder->private_->cpuinfo.use_asm) { -#ifdef FLAC__CPU_IA32 - FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32); -#ifdef FLAC__HAS_NASM -#if 1 /*@@@@@@ OPT: not clearly faster, needs more testing */ - if(decoder->private_->cpuinfo.data.ia32.bswap) - decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap; -#endif - 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 - - /* from here on, errors are fatal */ - - if(!FLAC__bitreader_init(decoder->private_->input, decoder->private_->cpuinfo, read_callback_, decoder)) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR; - } - - decoder->private_->read_callback = read_callback; - decoder->private_->seek_callback = seek_callback; - decoder->private_->tell_callback = tell_callback; - decoder->private_->length_callback = length_callback; - decoder->private_->eof_callback = eof_callback; - decoder->private_->write_callback = write_callback; - decoder->private_->metadata_callback = metadata_callback; - decoder->private_->error_callback = error_callback; - decoder->private_->client_data = client_data; - decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size = 0; - decoder->private_->samples_decoded = 0; - decoder->private_->has_stream_info = false; - decoder->private_->cached = false; - - decoder->private_->do_md5_checking = decoder->protected_->md5_checking; - decoder->private_->is_seeking = false; - - decoder->private_->internal_reset_hack = true; /* so the following reset does not try to rewind the input */ - if(!FLAC__stream_decoder_reset(decoder)) { - /* above call sets the state for us */ - return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR; - } - - return FLAC__STREAM_DECODER_INIT_STATUS_OK; -} - -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream( - FLAC__StreamDecoder *decoder, - FLAC__StreamDecoderReadCallback read_callback, - FLAC__StreamDecoderSeekCallback seek_callback, - FLAC__StreamDecoderTellCallback tell_callback, - FLAC__StreamDecoderLengthCallback length_callback, - FLAC__StreamDecoderEofCallback eof_callback, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -) -{ - return init_stream_internal_( - decoder, - read_callback, - seek_callback, - tell_callback, - length_callback, - eof_callback, - write_callback, - metadata_callback, - error_callback, - client_data, - /*is_ogg=*/false - ); -} - -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream( - FLAC__StreamDecoder *decoder, - FLAC__StreamDecoderReadCallback read_callback, - FLAC__StreamDecoderSeekCallback seek_callback, - FLAC__StreamDecoderTellCallback tell_callback, - FLAC__StreamDecoderLengthCallback length_callback, - FLAC__StreamDecoderEofCallback eof_callback, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -) -{ - return init_stream_internal_( - decoder, - read_callback, - seek_callback, - tell_callback, - length_callback, - eof_callback, - write_callback, - metadata_callback, - error_callback, - client_data, - /*is_ogg=*/true - ); -} - -static FLAC__StreamDecoderInitStatus init_FILE_internal_( - FLAC__StreamDecoder *decoder, - FILE *file, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data, - FLAC__bool is_ogg -) -{ - FLAC__ASSERT(0 != decoder); - FLAC__ASSERT(0 != file); - - if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; - - if(0 == write_callback || 0 == error_callback) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; - - /* - * To make sure that our file does not go unclosed after an error, we - * must assign the FILE pointer before any further error can occur in - * this routine. - */ - if(file == stdin) - file = get_binary_stdin_(); /* just to be safe */ - - decoder->private_->file = file; - - return init_stream_internal_( - decoder, - file_read_callback_, - decoder->private_->file == stdin? 0: file_seek_callback_, - decoder->private_->file == stdin? 0: file_tell_callback_, - decoder->private_->file == stdin? 0: file_length_callback_, - file_eof_callback_, - write_callback, - metadata_callback, - error_callback, - client_data, - is_ogg - ); -} - -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE( - FLAC__StreamDecoder *decoder, - FILE *file, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -) -{ - return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/false); -} - -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE( - FLAC__StreamDecoder *decoder, - FILE *file, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -) -{ - return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/true); -} - -static FLAC__StreamDecoderInitStatus init_file_internal_( - FLAC__StreamDecoder *decoder, - const char *filename, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data, - FLAC__bool is_ogg -) -{ - FILE *file; - - FLAC__ASSERT(0 != decoder); - - /* - * To make sure that our file does not go unclosed after an error, we - * have to do the same entrance checks here that are later performed - * in FLAC__stream_decoder_init_FILE() before the FILE* is assigned. - */ - if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; - - if(0 == write_callback || 0 == error_callback) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; - - file = filename? fopen(filename, "rb") : stdin; - - if(0 == file) - return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE; - - return init_FILE_internal_(decoder, file, write_callback, metadata_callback, error_callback, client_data, is_ogg); -} - -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file( - FLAC__StreamDecoder *decoder, - const char *filename, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -) -{ - return init_file_internal_(decoder, filename, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/false); -} - -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file( - FLAC__StreamDecoder *decoder, - const char *filename, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -) -{ - return init_file_internal_(decoder, filename, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/true); -} - -FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder) -{ - FLAC__bool md5_failed = false; - 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 true; - - /* see the comment in FLAC__seekable_stream_decoder_reset() as to why we - * always call FLAC__MD5Final() - */ - FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context); - - if(decoder->private_->has_seek_table && 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__bitreader_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; - -#if FLAC__HAS_OGG - if(decoder->private_->is_ogg) - FLAC__ogg_decoder_aspect_finish(&decoder->protected_->ogg_decoder_aspect); -#endif - - if(0 != decoder->private_->file) { - if(decoder->private_->file != stdin) - fclose(decoder->private_->file); - decoder->private_->file = 0; - } - - if(decoder->private_->do_md5_checking) { - if(memcmp(decoder->private_->stream_info.data.stream_info.md5sum, decoder->private_->computed_md5sum, 16)) - md5_failed = true; - } - decoder->private_->is_seeking = false; - - set_defaults_(decoder); - - decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED; - - return !md5_failed; -} - -FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long 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; -#if FLAC__HAS_OGG - /* can't check decoder->private_->is_ogg since that's not set until init time */ - FLAC__ogg_decoder_aspect_set_serial_number(&decoder->protected_->ogg_decoder_aspect, value); - return true; -#else - (void)value; - return false; -#endif -} - -FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value) -{ - FLAC__ASSERT(0 != decoder); - FLAC__ASSERT(0 != decoder->protected_); - if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) - return false; - decoder->protected_->md5_checking = 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*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - 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*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - 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 FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder) -{ - FLAC__ASSERT(0 != decoder); - FLAC__ASSERT(0 != decoder->protected_); - return decoder->protected_->md5_checking; -} - -FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder) -{ - FLAC__ASSERT(0 != decoder); - FLAC__ASSERT(0 != decoder->protected_); - return decoder->private_->has_stream_info? decoder->private_->stream_info.data.stream_info.total_samples : 0; -} - -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_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position) -{ - FLAC__ASSERT(0 != decoder); - FLAC__ASSERT(0 != decoder->private_); - FLAC__ASSERT(0 != position); - -#if FLAC__HAS_OGG - if(decoder->private_->is_ogg) - return false; -#endif - if(0 == decoder->private_->tell_callback) - return false; - if(decoder->private_->tell_callback(decoder, position, decoder->private_->client_data) != FLAC__STREAM_DECODER_TELL_STATUS_OK) - return false; - /* should never happen since all FLAC frames and metadata blocks are byte aligned, but check just in case */ - if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)) - return false; - FLAC__ASSERT(*position >= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder)); - *position -= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder); - return true; -} - -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_); - - decoder->private_->samples_decoded = 0; - decoder->private_->do_md5_checking = false; - -#if FLAC__HAS_OGG - if(decoder->private_->is_ogg) - FLAC__ogg_decoder_aspect_flush(&decoder->protected_->ogg_decoder_aspect); -#endif - - if(!FLAC__bitreader_clear(decoder->private_->input)) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - 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)) { - /* above call sets the state for us */ - return false; - } - -#if FLAC__HAS_OGG - /*@@@ could go in !internal_reset_hack block below */ - if(decoder->private_->is_ogg) - FLAC__ogg_decoder_aspect_reset(&decoder->protected_->ogg_decoder_aspect); -#endif - - /* Rewind if necessary. If FLAC__stream_decoder_init() is calling us, - * (internal_reset_hack) don't try to rewind since we are already at - * the beginning of the stream and don't want to fail if the input is - * not seekable. - */ - if(!decoder->private_->internal_reset_hack) { - if(decoder->private_->file == stdin) - return false; /* can't rewind stdin, reset fails */ - if(decoder->private_->seek_callback && decoder->private_->seek_callback(decoder, 0, decoder->private_->client_data) == FLAC__STREAM_DECODER_SEEK_STATUS_ERROR) - return false; /* seekable and seek fails, reset fails */ - } - else - decoder->private_->internal_reset_hack = false; - - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA; - - decoder->private_->has_stream_info = false; - if(decoder->private_->has_seek_table && 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; - } - decoder->private_->do_md5_checking = decoder->protected_->md5_checking; - /* - * This goes in reset() and not flush() because according to the spec, a - * fixed-blocksize stream must stay that way through the whole stream. - */ - decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size = 0; - - /* 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 init the context here and finalize it in - * FLAC__stream_decoder_finish() to make sure things are always cleaned up - * properly. - */ - FLAC__MD5Init(&decoder->private_->md5context); - - decoder->private_->first_frame_offset = 0; - decoder->private_->unparseable_frame_count = 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; - } - } -} - -FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample) -{ - FLAC__uint64 length; - - FLAC__ASSERT(0 != decoder); - - if( - decoder->protected_->state != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA && - decoder->protected_->state != FLAC__STREAM_DECODER_READ_METADATA && - decoder->protected_->state != FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC && - decoder->protected_->state != FLAC__STREAM_DECODER_READ_FRAME && - decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM - ) - return false; - - if(0 == decoder->private_->seek_callback) - return false; - - FLAC__ASSERT(decoder->private_->seek_callback); - FLAC__ASSERT(decoder->private_->tell_callback); - FLAC__ASSERT(decoder->private_->length_callback); - FLAC__ASSERT(decoder->private_->eof_callback); - - if(FLAC__stream_decoder_get_total_samples(decoder) > 0 && sample >= FLAC__stream_decoder_get_total_samples(decoder)) - return false; - - decoder->private_->is_seeking = true; - - /* turn off md5 checking if a seek is attempted */ - decoder->private_->do_md5_checking = false; - - /* get the file length (currently our algorithm needs to know the length so it's also an error to get FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED) */ - if(decoder->private_->length_callback(decoder, &length, decoder->private_->client_data) != FLAC__STREAM_DECODER_LENGTH_STATUS_OK) { - decoder->private_->is_seeking = false; - return false; - } - - /* if we haven't finished processing the metadata yet, do that so we have the STREAMINFO, SEEK_TABLE, and first_frame_offset */ - if( - decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA || - decoder->protected_->state == FLAC__STREAM_DECODER_READ_METADATA - ) { - if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) { - /* above call sets the state for us */ - decoder->private_->is_seeking = false; - return false; - } - /* check this again in case we didn't know total_samples the first time */ - if(FLAC__stream_decoder_get_total_samples(decoder) > 0 && sample >= FLAC__stream_decoder_get_total_samples(decoder)) { - decoder->private_->is_seeking = false; - return false; - } - } - - { - const FLAC__bool ok = -#if FLAC__HAS_OGG - decoder->private_->is_ogg? - seek_to_absolute_sample_ogg_(decoder, length, sample) : -#endif - seek_to_absolute_sample_(decoder, length, sample) - ; - decoder->private_->is_seeking = false; - return ok; - } -} - -/*********************************************************************** - * - * Protected class methods - * - ***********************************************************************/ - -unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder) -{ - FLAC__ASSERT(0 != decoder); - FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); - FLAC__ASSERT(!(FLAC__bitreader_get_input_bits_unconsumed(decoder->private_->input) & 7)); - return FLAC__bitreader_get_input_bits_unconsumed(decoder->private_->input) / 8; -} - -/*********************************************************************** - * - * Private class methods - * - ***********************************************************************/ - -void set_defaults_(FLAC__StreamDecoder *decoder) -{ -#if FLAC__HAS_OGG - decoder->private_->is_ogg = false; -#endif - 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; - - 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; - - decoder->protected_->md5_checking = false; - -#if FLAC__HAS_OGG - FLAC__ogg_decoder_aspect_set_defaults(&decoder->protected_->ogg_decoder_aspect); -#endif -} - -/* - * This will forcibly set stdin to binary mode (for OSes that require it) - */ -FILE *get_binary_stdin_(void) -{ - /* 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); -#elif defined __EMX__ - setmode(fileno(stdin), O_BINARY); -#endif - - return stdin; -} - -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*)safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/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) -{ - size_t 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__bitreader_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__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* 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; /* skip_id3v2_tag_ sets the state for us */ - } - continue; - } - id = 0; - if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ - decoder->private_->header_warmup[0] = (FLAC__byte)x; - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* 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) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - 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__bitreader_is_consumed_byte_aligned(decoder->private_->input)); - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_IS_LAST_LEN)) - return false; /* read_callback_ sets the state for us */ - is_last = x? true : false; - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &type, FLAC__STREAM_METADATA_TYPE_LEN)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &length, FLAC__STREAM_METADATA_LENGTH_LEN)) - return false; /* 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(0 == memcmp(decoder->private_->stream_info.data.stream_info.md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)) - decoder->private_->do_md5_checking = false; - if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO] && decoder->private_->metadata_callback) - 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_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE] && decoder->private_->metadata_callback) - 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__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)) - return false; /* read_callback_ sets the state for us */ - - if(real_length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) { /* underflow check */ - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;/*@@@@@@ maybe wrong error? need to resync?*/ - return false; - } - - 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__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, real_length)) - return false; /* read_callback_ sets the state for us */ - } - else { - switch(type) { - case FLAC__METADATA_TYPE_PADDING: - /* skip the padding bytes */ - if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, real_length)) - return false; /* 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__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.data, real_length)) - return false; /* 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_PICTURE: - if(!read_metadata_picture_(decoder, &block.data.picture)) - 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__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.unknown.data, real_length)) - return false; /* read_callback_ sets the state for us */ - } - else - block.data.unknown.data = 0; - break; - } - if(!decoder->private_->is_seeking && decoder->private_->metadata_callback) - 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_PICTURE: - if(0 != block.data.picture.mime_type) - free(block.data.picture.mime_type); - if(0 != block.data.picture.description) - free(block.data.picture.description); - if(0 != block.data.picture.data) - free(block.data.picture.data); - 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) { - /* if this fails, it's OK, it's just a hint for the seek routine */ - if(!FLAC__stream_decoder_get_decode_position(decoder, &decoder->private_->first_frame_offset)) - decoder->private_->first_frame_offset = 0; - 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__bitreader_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__bitreader_read_raw_uint32(decoder->private_->input, &x, bits)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN)) - return false; /* 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__bitreader_read_raw_uint64(decoder->private_->input, &decoder->private_->stream_info.data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) - return false; /* read_callback_ sets the state for us */ - used_bits += bits; - - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, decoder->private_->stream_info.data.stream_info.md5sum, 16)) - return false; /* 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__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length)) - return false; /* 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__bitreader_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*)safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/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__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN)) - return false; /* read_callback_ sets the state for us */ - decoder->private_->seek_table.data.seek_table.points[i].sample_number = xx; - - if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN)) - return false; /* read_callback_ sets the state for us */ - decoder->private_->seek_table.data.seek_table.points[i].stream_offset = xx; - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN)) - return false; /* 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 a send_error_to_client_() here? there's an argument for either way */ - if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length)) - return false; /* 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__bitreader_is_consumed_byte_aligned(decoder->private_->input)); - - /* read vendor string */ - FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); - if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length)) - return false; /* read_callback_ sets the state for us */ - if(obj->vendor_string.length > 0) { - if(0 == (obj->vendor_string.entry = (FLAC__byte*)safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->vendor_string.entry, obj->vendor_string.length)) - return false; /* 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__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->num_comments)) - return false; /* read_callback_ sets the state for us */ - - /* read comments */ - if(obj->num_comments > 0) { - if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_malloc_mul_2op_(obj->num_comments, /*times*/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__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length)) - return false; /* read_callback_ sets the state for us */ - if(obj->comments[i].length > 0) { - if(0 == (obj->comments[i].entry = (FLAC__byte*)safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length)) - return false; /* 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__bitreader_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__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN/8)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &obj->lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN)) - return false; /* read_callback_ sets the state for us */ - obj->is_cd = x? true : false; - - if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN)) - return false; /* read_callback_ sets the state for us */ - obj->num_tracks = x; - - if(obj->num_tracks > 0) { - if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_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__bitreader_read_raw_uint64(decoder->private_->input, &track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN)) - return false; /* 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__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN/8)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN)) - return false; /* read_callback_ sets the state for us */ - track->type = x; - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN)) - return false; /* read_callback_ sets the state for us */ - track->pre_emphasis = x; - - if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN)) - return false; /* 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*)safe_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__bitreader_read_raw_uint64(decoder->private_->input, &index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN)) - return false; /* read_callback_ sets the state for us */ - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN)) - return false; /* read_callback_ sets the state for us */ - index->number = (FLAC__byte)x; - - if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN)) - return false; /* read_callback_ sets the state for us */ - } - } - } - } - - return true; -} - -FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_Picture *obj) -{ - FLAC__uint32 x; - - FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); - - /* read type */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN)) - return false; /* read_callback_ sets the state for us */ - obj->type = x; - - /* read MIME type */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) - return false; /* read_callback_ sets the state for us */ - if(0 == (obj->mime_type = (char*)safe_malloc_add_2op_(x, /*+*/1))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - if(x > 0) { - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->mime_type, x)) - return false; /* read_callback_ sets the state for us */ - } - obj->mime_type[x] = '\0'; - - /* read description */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) - return false; /* read_callback_ sets the state for us */ - if(0 == (obj->description = (FLAC__byte*)safe_malloc_add_2op_(x, /*+*/1))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - if(x > 0) { - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->description, x)) - return false; /* read_callback_ sets the state for us */ - } - obj->description[x] = '\0'; - - /* read width */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN)) - return false; /* read_callback_ sets the state for us */ - - /* read height */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->height, FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN)) - return false; /* read_callback_ sets the state for us */ - - /* read depth */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->depth, FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN)) - return false; /* read_callback_ sets the state for us */ - - /* read colors */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &obj->colors, FLAC__STREAM_METADATA_PICTURE_COLORS_LEN)) - return false; /* read_callback_ sets the state for us */ - - /* read data */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) - return false; /* read_callback_ sets the state for us */ - if(0 == (obj->data = (FLAC__byte*)safe_malloc_(obj->data_length))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; - } - if(obj->data_length > 0) { - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->data, obj->data_length)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, 24)) - return false; /* read_callback_ sets the state for us */ - /* get the size (in bytes) to skip */ - skip = 0; - for(i = 0; i < 4; i++) { - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* read_callback_ sets the state for us */ - skip <<= 7; - skip |= (x & 0x7f); - } - /* skip the rest of the tag */ - if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, skip)) - return false; /* 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(FLAC__stream_decoder_get_total_samples(decoder) > 0) { - if(decoder->private_->samples_decoded >= FLAC__stream_decoder_get_total_samples(decoder)) { - decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM; - return true; - } - } - - /* make sure we're byte aligned */ - if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)) { - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input))) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* 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) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - 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; - unsigned frame_crc; /* the one we calculate from the input stream */ - FLAC__uint32 x; - - *got_a_frame = false; - - /* init the CRC */ - frame_crc = 0; - frame_crc = FLAC__CRC16_UPDATE(decoder->private_->header_warmup[0], frame_crc); - frame_crc = FLAC__CRC16_UPDATE(decoder->private_->header_warmup[1], frame_crc); - FLAC__bitreader_reset_read_crc16(decoder->private_->input, (FLAC__uint16)frame_crc); - - if(!read_frame_header_(decoder)) - return false; - if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means we didn't sync on a valid header */ - 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_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ - return true; - } - if(!read_zero_padding_(decoder)) - return false; - if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption (i.e. "zero bits" were not all zeroes) */ - return true; - - /* - * Read the frame CRC-16 from the footer and check - */ - frame_crc = FLAC__bitreader_get_read_crc16(decoder->private_->input); - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__FRAME_FOOTER_CRC_LEN)) - return false; /* read_callback_ sets the state for us */ - if(frame_crc == 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++) { -#if 1 - mid = decoder->private_->output[0][i]; - side = decoder->private_->output[1][i]; - mid <<= 1; - mid |= (side & 1); /* i.e. if 'side' is odd... */ - decoder->private_->output[0][i] = (mid + side) >> 1; - decoder->private_->output[1][i] = (mid - side) >> 1; -#else - /* OPT: without 'side' temp variable */ - mid = (decoder->private_->output[0][i] << 1) | (decoder->private_->output[1][i] & 1); /* i.e. if 'side' is odd... */ - decoder->private_->output[0][i] = (mid + decoder->private_->output[1][i]) >> 1; - decoder->private_->output[1][i] = (mid - decoder->private_->output[1][i]) >> 1; -#endif - } - break; - default: - FLAC__ASSERT(0); - break; - } - } - } - else { - /* Bad frame, emit error and zero the output signal */ - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH); - 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; - - /* we wait to update fixed_block_size until here, when we're sure we've got a proper frame and hence a correct blocksize */ - if(decoder->private_->next_fixed_block_size) - decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size; - - /* 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(write_audio_frame_to_client_(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output) != 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; - - FLAC__ASSERT(FLAC__bitreader_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 reserved bit is 0 */ - if(raw_header[1] & 0x02) /* 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. - * - * Three kinds of things can go wrong when reading the frame header: - * 1) We may have sync'ed incorrectly and not landed on a frame header. - * If we don't find a sync code, it can end up looking like we read - * a valid but unparseable header, until getting to the frame header - * CRC. Even then we could get a false positive on the CRC. - * 2) We may have sync'ed correctly but on an unparseable frame (from a - * future encoder). - * 3) We may be on a damaged frame which appears valid but unparseable. - * - * For all these reasons, we try and read a complete frame header as - * long as it seems valid, even if unparseable, up until the frame - * header CRC. - */ - - /* - * 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__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* 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; - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER); - 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: - 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: - decoder->private_->frame.header.sample_rate = 88200; - break; - case 2: - decoder->private_->frame.header.sample_rate = 176400; - break; - case 3: - decoder->private_->frame.header.sample_rate = 192000; - 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: - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER); - 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; - } - - /* check to make sure that reserved bit is 0 */ - if(raw_header[3] & 0x01) /* MAGIC NUMBER */ - is_unparseable = true; - - /* read the frame's starting sample number (or frame number as the case may be) */ - if( - raw_header[1] & 0x01 || - /*@@@ this clause is a concession to the old way of doing variable blocksize; the only known implementation is flake and can probably be removed without inconveniencing anyone */ - (decoder->private_->has_stream_info && decoder->private_->stream_info.data.stream_info.min_blocksize != decoder->private_->stream_info.data.stream_info.max_blocksize) - ) { /* variable blocksize */ - if(!FLAC__bitreader_read_utf8_uint64(decoder->private_->input, &xx, raw_header, &raw_header_len)) - return false; /* 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; - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER); - 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 { /* fixed blocksize */ - if(!FLAC__bitreader_read_utf8_uint32(decoder->private_->input, &x, raw_header, &raw_header_len)) - return false; /* 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; - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER; - decoder->private_->frame.header.number.frame_number = x; - } - - if(blocksize_hint) { - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* read_callback_ sets the state for us */ - raw_header[raw_header_len++] = (FLAC__byte)x; - if(blocksize_hint == 7) { - FLAC__uint32 _x; - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &_x, 8)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &_x, 8)) - return false; /* 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__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) - return false; /* read_callback_ sets the state for us */ - crc8 = (FLAC__byte)x; - - if(FLAC__crc8(raw_header, raw_header_len) != crc8) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - - /* calculate the sample number from the frame number if needed */ - decoder->private_->next_fixed_block_size = 0; - if(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER) { - x = decoder->private_->frame.header.number.frame_number; - decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER; - if(decoder->private_->fixed_block_size) - decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->fixed_block_size * (FLAC__uint64)x; - else if(decoder->private_->has_stream_info) { - if(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_->next_fixed_block_size = decoder->private_->stream_info.data.stream_info.max_blocksize; - } - else - is_unparseable = true; - } - else if(x == 0) { - decoder->private_->frame.header.number.sample_number = 0; - decoder->private_->next_fixed_block_size = decoder->private_->frame.header.blocksize; - } - else { - /* can only get here if the stream has invalid frame numbering and no STREAMINFO, so assume it's not the last (possibly short) frame */ - decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->frame.header.blocksize * (FLAC__uint64)x; - } - } - - if(is_unparseable) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - - 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; - unsigned i; - - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) /* MAGIC NUMBER */ - return false; /* read_callback_ sets the state for us */ - - wasted_bits = (x & 1); - x &= 0xfe; - - if(wasted_bits) { - unsigned u; - if(!FLAC__bitreader_read_unary_unsigned(decoder->private_->input, &u)) - return false; /* 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) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - 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) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - else if(x <= 24) { - if(!read_subframe_fixed_(decoder, channel, bps, (x>>1)&7, do_full_decode)) - return false; - if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ - return true; - } - else if(x < 64) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - else { - if(!read_subframe_lpc_(decoder, channel, bps, ((x>>1)&31)+1, do_full_decode)) - return false; - if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ - return true; - } - - if(wasted_bits && do_full_decode) { - 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__bitreader_read_raw_int32(decoder->private_->input, &x, bps)) - return false; /* 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__bitreader_read_raw_int32(decoder->private_->input, &i32, bps)) - return false; /* read_callback_ sets the state for us */ - subframe->warmup[u] = i32; - } - - /* read entropy coding method info */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN)) - return false; /* 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: - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN)) - return false; /* 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: - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - - /* read residual */ - switch(subframe->entropy_coding_method.type) { - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: - 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], /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2)) - 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__bitreader_read_raw_int32(decoder->private_->input, &i32, bps)) - return false; /* read_callback_ sets the state for us */ - subframe->warmup[u] = i32; - } - - /* read qlp coeff precision */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN)) - return false; /* read_callback_ sets the state for us */ - if(u32 == (1u << FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN) - 1) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - subframe->qlp_coeff_precision = u32+1; - - /* read qlp shift */ - if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN)) - return false; /* read_callback_ sets the state for us */ - subframe->quantization_level = i32; - - /* read quantized lp coefficiencts */ - for(u = 0; u < order; u++) { - if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, subframe->qlp_coeff_precision)) - return false; /* read_callback_ sets the state for us */ - subframe->qlp_coeff[u] = i32; - } - - /* read entropy coding method info */ - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN)) - return false; /* 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: - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN)) - return false; /* 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: - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - - /* read residual */ - switch(subframe->entropy_coding_method.type) { - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: - 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], /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2)) - 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); - /*@@@@@@ technically not pessimistic enough, should be more like - if( (FLAC__uint64)order * ((((FLAC__uint64)1)<qlp_coeff_precision)-1) < (((FLAC__uint64)-1) << 32) ) - */ - 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__bitreader_read_raw_int32(decoder->private_->input, &x, bps)) - return false; /* 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__bool is_extended) -{ - 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; - const unsigned plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; - const unsigned pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; - - /* sanity checks */ - if(partition_order == 0) { - if(decoder->private_->frame.header.blocksize < predictor_order) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - } - else { - if(partition_samples < predictor_order) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - 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__bitreader_read_raw_uint32(decoder->private_->input, &rice_parameter, plen)) - return false; /* read_callback_ sets the state for us */ - partitioned_rice_contents->parameters[partition] = rice_parameter; - if(rice_parameter < pesc) { - partitioned_rice_contents->raw_bits[partition] = 0; - u = (partition_order == 0 || partition > 0)? partition_samples : partition_samples - predictor_order; - if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter)) - return false; /* read_callback_ sets the state for us */ - sample += u; - } - else { - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN)) - return false; /* 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__bitreader_read_raw_int32(decoder->private_->input, &i, rice_parameter)) - return false; /* read_callback_ sets the state for us */ - residual[sample] = i; - } - } - } - - return true; -} - -FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder) -{ - if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)) { - FLAC__uint32 zero = 0; - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &zero, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input))) - return false; /* read_callback_ sets the state for us */ - if(zero != 0) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - } - } - return true; -} - -FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder *)client_data; - - if( -#if FLAC__HAS_OGG - /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */ - !decoder->private_->is_ogg && -#endif - decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data) - ) { - *bytes = 0; - decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM; - return false; - } - else if(*bytes > 0) { - /* While seeking, 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, our - * error callback will get an - * FLAC__STREAM_DECODER_UNPARSEABLE_STREAM and increment its - * unparseable_frame_count. 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 many "unparseable" errors in - * a row before bailing out. - */ - if(decoder->private_->is_seeking && decoder->private_->unparseable_frame_count > 20) { - decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED; - return false; - } - else { - const FLAC__StreamDecoderReadStatus status = -#if FLAC__HAS_OGG - decoder->private_->is_ogg? - read_callback_ogg_aspect_(decoder, buffer, bytes) : -#endif - decoder->private_->read_callback(decoder, buffer, bytes, decoder->private_->client_data) - ; - if(status == FLAC__STREAM_DECODER_READ_STATUS_ABORT) { - decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED; - return false; - } - else if(*bytes == 0) { - if( - status == FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM || - ( -#if FLAC__HAS_OGG - /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */ - !decoder->private_->is_ogg && -#endif - decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data) - ) - ) { - decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM; - return false; - } - else - return true; - } - else - return true; - } - } - else { - /* abort to avoid a deadlock */ - decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED; - return false; - } - /* [1] @@@ HACK NOTE: The end-of-stream checking has to be hacked around - * for Ogg FLAC. This is because the ogg decoder aspect can lose sync - * and at the same time hit the end of the stream (for example, seeking - * to a point that is after the beginning of the last Ogg page). There - * is no way to report an Ogg sync loss through the callbacks (see note - * in read_callback_ogg_aspect_()) so it returns CONTINUE with *bytes==0. - * So to keep the decoder from stopping at this point we gate the call - * to the eof_callback and let the Ogg decoder aspect set the - * end-of-stream state when it is needed. - */ -} - -#if FLAC__HAS_OGG -FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes) -{ - switch(FLAC__ogg_decoder_aspect_read_callback_wrapper(&decoder->protected_->ogg_decoder_aspect, buffer, bytes, read_callback_proxy_, decoder, decoder->private_->client_data)) { - case FLAC__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 FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC: - return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM: - return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC: - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION: - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT: - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR: - case FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR: - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - default: - FLAC__ASSERT(0); - /* double protection */ - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - } -} - -FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder*)void_decoder; - - switch(decoder->private_->read_callback(decoder, buffer, bytes, client_data)) { - case FLAC__STREAM_DECODER_READ_STATUS_CONTINUE: - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK; - case FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM: - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM; - case FLAC__STREAM_DECODER_READ_STATUS_ABORT: - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; - default: - /* double protection: */ - FLAC__ASSERT(0); - return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; - } -} -#endif - -FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[]) -{ - if(decoder->private_->is_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 = decoder->private_->target_sample; - - FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); - -#if FLAC__HAS_OGG - decoder->private_->got_a_frame = true; -#endif - 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 */ - decoder->private_->is_seeking = false; - /* 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; - decoder->private_->last_frame.header.blocksize -= delta; - decoder->private_->last_frame.header.number.sample_number += (FLAC__uint64)delta; - /* write the relevant samples */ - return decoder->private_->write_callback(decoder, &decoder->private_->last_frame, newbuffer, decoder->private_->client_data); - } - else { - /* write the relevant samples */ - return decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data); - } - } - else { - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; - } - } - else { - /* - * If we never got STREAMINFO, turn off MD5 checking to save - * cycles since we don't have a sum to compare to anyway - */ - if(!decoder->private_->has_stream_info) - decoder->private_->do_md5_checking = false; - if(decoder->private_->do_md5_checking) { - if(!FLAC__MD5Accumulate(&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 decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data); - } -} - -void send_error_to_client_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status) -{ - if(!decoder->private_->is_seeking) - decoder->private_->error_callback(decoder, status, decoder->private_->client_data); - else if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM) - decoder->private_->unparseable_frame_count++; -} - -FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample) -{ - FLAC__uint64 first_frame_offset = decoder->private_->first_frame_offset, lower_bound, upper_bound, lower_bound_sample, upper_bound_sample, this_frame_sample; - FLAC__int64 pos = -1; - int i; - unsigned approx_bytes_per_frame; - FLAC__bool first_seek = true; - const FLAC__uint64 total_samples = FLAC__stream_decoder_get_total_samples(decoder); - const unsigned min_blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize; - const unsigned max_blocksize = decoder->private_->stream_info.data.stream_info.max_blocksize; - const unsigned max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize; - const unsigned min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize; - /* take these from the current frame in case they've changed mid-stream */ - unsigned channels = FLAC__stream_decoder_get_channels(decoder); - unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder); - const FLAC__StreamMetadata_SeekTable *seek_table = decoder->private_->has_seek_table? &decoder->private_->seek_table.data.seek_table : 0; - - /* use values from stream info if we didn't decode a frame */ - if(channels == 0) - channels = decoder->private_->stream_info.data.stream_info.channels; - if(bps == 0) - bps = decoder->private_->stream_info.data.stream_info.bits_per_sample; - - /* we are just guessing here */ - if(max_framesize > 0) - approx_bytes_per_frame = (max_framesize + min_framesize) / 2 + 1; - /* - * 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 = 4096 * channels * bps/8 + 64; - - /* - * 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 frame and end of the stream. - */ - lower_bound = first_frame_offset; - lower_bound_sample = 0; - upper_bound = stream_length; - upper_bound_sample = total_samples > 0 ? total_samples : target_sample /*estimate it*/; - - /* - * 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. - * - * Note: to protect against invalid seek tables we will ignore points - * that have frame_samples==0 or sample_number>=total_samples - */ - if(seek_table) { - FLAC__uint64 new_lower_bound = lower_bound; - FLAC__uint64 new_upper_bound = upper_bound; - FLAC__uint64 new_lower_bound_sample = lower_bound_sample; - FLAC__uint64 new_upper_bound_sample = upper_bound_sample; - - /* find the closest seek point <= target_sample, if it exists */ - for(i = (int)seek_table->num_points - 1; i >= 0; i--) { - if( - seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER && - seek_table->points[i].frame_samples > 0 && /* defense against bad seekpoints */ - (total_samples <= 0 || seek_table->points[i].sample_number < total_samples) && /* defense against bad seekpoints */ - seek_table->points[i].sample_number <= target_sample - ) - break; - } - if(i >= 0) { /* i.e. we found a suitable seek point... */ - new_lower_bound = first_frame_offset + seek_table->points[i].stream_offset; - new_lower_bound_sample = seek_table->points[i].sample_number; - } - - /* find the closest seek point > target_sample, if it exists */ - for(i = 0; i < (int)seek_table->num_points; i++) { - if( - seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER && - seek_table->points[i].frame_samples > 0 && /* defense against bad seekpoints */ - (total_samples <= 0 || seek_table->points[i].sample_number < total_samples) && /* defense against bad seekpoints */ - seek_table->points[i].sample_number > target_sample - ) - break; - } - if(i < (int)seek_table->num_points) { /* i.e. we found a suitable seek point... */ - new_upper_bound = first_frame_offset + seek_table->points[i].stream_offset; - new_upper_bound_sample = seek_table->points[i].sample_number; - } - /* final protection against unsorted seek tables; keep original values if bogus */ - if(new_upper_bound >= new_lower_bound) { - lower_bound = new_lower_bound; - upper_bound = new_upper_bound; - lower_bound_sample = new_lower_bound_sample; - upper_bound_sample = new_upper_bound_sample; - } - } - - FLAC__ASSERT(upper_bound_sample >= lower_bound_sample); - /* there are 2 insidious ways that the following equality occurs, which - * we need to fix: - * 1) total_samples is 0 (unknown) and target_sample is 0 - * 2) total_samples is 0 (unknown) and target_sample happens to be - * exactly equal to the last seek point in the seek table; this - * means there is no seek point above it, and upper_bound_samples - * remains equal to the estimate (of target_samples) we made above - * in either case it does not hurt to move upper_bound_sample up by 1 - */ - if(upper_bound_sample == lower_bound_sample) - upper_bound_sample++; - - decoder->private_->target_sample = target_sample; - while(1) { - /* check if the bounds are still ok */ - if (lower_bound_sample >= upper_bound_sample || lower_bound > upper_bound) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } -#ifndef FLAC__INTEGER_ONLY_LIBRARY -#if defined _MSC_VER || defined __MINGW32__ - /* with VC++ you have to spoon feed it the casting */ - pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(FLAC__int64)(target_sample - lower_bound_sample) / (FLAC__double)(FLAC__int64)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(FLAC__int64)(upper_bound - lower_bound)) - approx_bytes_per_frame; -#else - pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(target_sample - lower_bound_sample) / (FLAC__double)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(upper_bound - lower_bound)) - approx_bytes_per_frame; -#endif -#else - /* a little less accurate: */ - if(upper_bound - lower_bound < 0xffffffff) - pos = (FLAC__int64)lower_bound + (FLAC__int64)(((target_sample - lower_bound_sample) * (upper_bound - lower_bound)) / (upper_bound_sample - lower_bound_sample)) - approx_bytes_per_frame; - else /* @@@ WATCHOUT, ~2TB limit */ - pos = (FLAC__int64)lower_bound + (FLAC__int64)((((target_sample - lower_bound_sample)>>8) * ((upper_bound - lower_bound)>>8)) / ((upper_bound_sample - lower_bound_sample)>>16)) - approx_bytes_per_frame; -#endif - if(pos >= (FLAC__int64)upper_bound) - pos = (FLAC__int64)upper_bound - 1; - if(pos < (FLAC__int64)lower_bound) - pos = (FLAC__int64)lower_bound; - if(decoder->private_->seek_callback(decoder, (FLAC__uint64)pos, decoder->private_->client_data) != FLAC__STREAM_DECODER_SEEK_STATUS_OK) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - if(!FLAC__stream_decoder_flush(decoder)) { - /* above call sets the state for us */ - return false; - } - /* Now we need to get a frame. First we need to reset our - * unparseable_frame_count; if we get too many unparseable - * frames in a row, the read callback will return - * FLAC__STREAM_DECODER_READ_STATUS_ABORT, causing - * FLAC__stream_decoder_process_single() to return false. - */ - decoder->private_->unparseable_frame_count = 0; - if(!FLAC__stream_decoder_process_single(decoder)) { - decoder->protected_->state = FLAC__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__STREAM_DECODER_END_OF_STREAM so we need to check for that also */ -#if 0 - /*@@@@@@ used to be the following; not clear if the check for end of stream is needed anymore */ - if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_SEEKING && decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM) - break; -#endif - if(!decoder->private_->is_seeking) - break; - - FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); - this_frame_sample = decoder->private_->last_frame.header.number.sample_number; - - if (0 == decoder->private_->samples_decoded || (this_frame_sample + decoder->private_->last_frame.header.blocksize >= upper_bound_sample && !first_seek)) { - if (pos == (FLAC__int64)lower_bound) { - /* can't move back any more than the first frame, something is fatally wrong */ - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - /* our last move backwards wasn't big enough, try again */ - approx_bytes_per_frame = approx_bytes_per_frame? approx_bytes_per_frame * 2 : 16; - continue; - } - /* allow one seek over upper bound, so we can get a correct upper_bound_sample for streams with unknown total_samples */ - first_seek = false; - - /* make sure we are not seeking in corrupted stream */ - if (this_frame_sample < lower_bound_sample) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - - /* we need to narrow the search */ - if(target_sample < this_frame_sample) { - upper_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize; -/*@@@@@@ what will decode position be if at end of stream? */ - if(!FLAC__stream_decoder_get_decode_position(decoder, &upper_bound)) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - approx_bytes_per_frame = (unsigned)(2 * (upper_bound - pos) / 3 + 16); - } - else { /* target_sample >= this_frame_sample + this frame's blocksize */ - lower_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize; - if(!FLAC__stream_decoder_get_decode_position(decoder, &lower_bound)) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - approx_bytes_per_frame = (unsigned)(2 * (lower_bound - pos) / 3 + 16); - } - } - - return true; -} - -#if FLAC__HAS_OGG -FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *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 = FLAC__stream_decoder_get_total_samples(decoder); - FLAC__uint64 this_frame_sample = (FLAC__uint64)0 - 1; - 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 - * than 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 - * 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_frame_sample and so having a better - * estimate. - */ - } - - /* physical seek */ - if(decoder->private_->seek_callback((FLAC__StreamDecoder*)decoder, (FLAC__uint64)pos, decoder->private_->client_data) != FLAC__STREAM_DECODER_SEEK_STATUS_OK) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - if(!FLAC__stream_decoder_flush(decoder)) { - /* above call sets the state for us */ - return false; - } - did_a_seek = true; - } - else - did_a_seek = false; - - decoder->private_->got_a_frame = false; - if(!FLAC__stream_decoder_process_single(decoder)) { - decoder->protected_->state = FLAC__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 = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - } - /* our write callback will change the state when it gets to the target frame */ - else if(!decoder->private_->is_seeking) { - 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 - * FLAC__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 = FLAC__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 = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; - } - right_pos = pos; - } - } - } - } - - return true; -} -#endif - -FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - (void)client_data; - - if(*bytes > 0) { - *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, decoder->private_->file); - if(ferror(decoder->private_->file)) - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - else if(*bytes == 0) - return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - else - return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - } - else - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ -} - -FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) -{ - (void)client_data; - - if(decoder->private_->file == stdin) - return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; - else if(fseeko(decoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0) - return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - else - return FLAC__STREAM_DECODER_SEEK_STATUS_OK; -} - -FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) -{ - off_t pos; - (void)client_data; - - if(decoder->private_->file == stdin) - return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED; - else if((pos = ftello(decoder->private_->file)) < 0) - return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - else { - *absolute_byte_offset = (FLAC__uint64)pos; - return FLAC__STREAM_DECODER_TELL_STATUS_OK; - } -} - -FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) -{ - struct stat filestats; - (void)client_data; - - if(decoder->private_->file == stdin) - return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; - else if(fstat(fileno(decoder->private_->file), &filestats) != 0) - return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - else { - *stream_length = (FLAC__uint64)filestats.st_size; - return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; - } -} - -FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *client_data) -{ - (void)client_data; - - return feof(decoder->private_->file)? true : false; -} diff --git a/src/lib/dl/ext/flac/stream_decoder.h b/src/lib/dl/ext/flac/stream_decoder.h deleted file mode 100755 index 9ac15947..00000000 --- a/src/lib/dl/ext/flac/stream_decoder.h +++ /dev/null @@ -1,1559 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 /* for FILE */ -#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 decoder layers provided by libFLAC. - * - * The stream decoder can be used to decode complete streams either from - * the client via callbacks, or directly from a file, depending on how - * it is initialized. When decoding via callbacks, the client provides - * callbacks for reading FLAC data and writing decoded samples, and - * handling metadata and errors. If the client also supplies seek-related - * callback, the decoder function for sample-accurate seeking within the - * FLAC input is also available. When decoding from a file, the client - * needs only supply a filename or open \c FILE* and write/metadata/error - * callbacks; the rest of the callbacks are supplied internally. For more - * info see the \link flac_stream_decoder stream decoder \endlink module. - */ - -/** \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 stream decoder can decode native FLAC, and optionally Ogg FLAC - * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files. - * - * 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 using - * FLAC__stream_decoder_set_*() functions. - * - The program initializes the instance to validate the settings and - * prepare for decoding using - * - FLAC__stream_decoder_init_stream() or FLAC__stream_decoder_init_FILE() - * or FLAC__stream_decoder_init_file() for native FLAC, - * - FLAC__stream_decoder_init_ogg_stream() or FLAC__stream_decoder_init_ogg_FILE() - * or FLAC__stream_decoder_init_ogg_file() for Ogg FLAC - * - 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 override the default decoder options, and call - * one of the FLAC__stream_decoder_init_*() functions. - * - * There are three initialization functions for native FLAC, one for - * setting up the decoder to decode FLAC data from the client via - * callbacks, and two for decoding directly from a FLAC file. - * - * For decoding via callbacks, use FLAC__stream_decoder_init_stream(). - * You must also supply several callbacks for handling I/O. Some (like - * seeking) are optional, depending on the capabilities of the input. - * - * For decoding directly from a file, use FLAC__stream_decoder_init_FILE() - * or FLAC__stream_decoder_init_file(). Then you must only supply an open - * \c FILE* or filename and fewer callbacks; the decoder will handle - * the other callbacks internally. - * - * There are three similarly-named init functions for decoding from Ogg - * FLAC streams. Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the - * library has been built with Ogg support. - * - * 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 client 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 client 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. - * - * Seeking is exposed through the FLAC__stream_decoder_seek_absolute() method. - * At any point after the stream decoder has been initialized, the client 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. - * - * If the client cannot seek via the callback interface provided, but still - * has another way of seeking, it can flush the decoder using - * FLAC__stream_decoder_flush() and start feeding data from the new position - * through the read callback. - * - * The stream decoder also provides MD5 signature checking. If this is - * turned on before initialization, FLAC__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__stream_decoder_reset()) if there is no signature - * in the STREAMINFO block or when a seek is attempted. - * - * 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 metadata blocks can potentially - * be big (for example, cover art) 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_OGG_ERROR, - /**< An error occurred in the underlying Ogg layer. */ - - FLAC__STREAM_DECODER_SEEK_ERROR, - /**< An error occurred while seeking. The decoder must be flushed - * with FLAC__stream_decoder_flush() or reset with - * FLAC__stream_decoder_reset() before decoding can continue. - */ - - FLAC__STREAM_DECODER_ABORTED, - /**< The decoder was aborted by the read callback. */ - - FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR, - /**< An error occurred allocating memory. The decoder is in an invalid - * state and can no longer be used. - */ - - FLAC__STREAM_DECODER_UNINITIALIZED - /**< The decoder is in the uninitialized state; one of the - * FLAC__stream_decoder_init_*() functions must be called before samples - * can be processed. - */ - -} 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[]; - - -/** Possible return values for the FLAC__stream_decoder_init_*() functions. - */ -typedef enum { - - FLAC__STREAM_DECODER_INIT_STATUS_OK = 0, - /**< Initialization was successful. */ - - FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER, - /**< The library was not compiled with support for the given container - * format. - */ - - FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS, - /**< A required callback was not supplied. */ - - FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR, - /**< An error occurred allocating memory. */ - - FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE, - /**< fopen() failed in FLAC__stream_decoder_init_file() or - * FLAC__stream_decoder_init_ogg_file(). */ - - FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED - /**< FLAC__stream_decoder_init_*() was called when the decoder was - * already initialized, usually because - * FLAC__stream_decoder_finish() was not called. - */ - -} FLAC__StreamDecoderInitStatus; - -/** Maps a FLAC__StreamDecoderInitStatus to a C string. - * - * Using a FLAC__StreamDecoderInitStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamDecoderInitStatusString[]; - - -/** 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 while at the end of the stream. Note that - * the client must only return this value when the read callback was - * called when already at the end of the stream. Otherwise, if the read - * itself moves to the end of the stream, the client should still return - * the data and \c FLAC__STREAM_DECODER_READ_STATUS_CONTINUE, and then on - * the next read callback it should return - * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM with a byte count - * of \c 0. - */ - - 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 seek callback. - */ -typedef enum { - - FLAC__STREAM_DECODER_SEEK_STATUS_OK, - /**< The seek was OK and decoding can continue. */ - - FLAC__STREAM_DECODER_SEEK_STATUS_ERROR, - /**< An unrecoverable error occurred. The decoder will return from the process call. */ - - FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED - /**< Client does not support seeking. */ - -} FLAC__StreamDecoderSeekStatus; - -/** Maps a FLAC__StreamDecoderSeekStatus to a C string. - * - * Using a FLAC__StreamDecoderSeekStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[]; - - -/** Return values for the FLAC__StreamDecoder tell callback. - */ -typedef enum { - - FLAC__STREAM_DECODER_TELL_STATUS_OK, - /**< The tell was OK and decoding can continue. */ - - FLAC__STREAM_DECODER_TELL_STATUS_ERROR, - /**< An unrecoverable error occurred. The decoder will return from the process call. */ - - FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED - /**< Client does not support telling the position. */ - -} FLAC__StreamDecoderTellStatus; - -/** Maps a FLAC__StreamDecoderTellStatus to a C string. - * - * Using a FLAC__StreamDecoderTellStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamDecoderTellStatusString[]; - - -/** Return values for the FLAC__StreamDecoder length callback. - */ -typedef enum { - - FLAC__STREAM_DECODER_LENGTH_STATUS_OK, - /**< The length call was OK and decoding can continue. */ - - FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR, - /**< An unrecoverable error occurred. The decoder will return from the process call. */ - - FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED - /**< Client does not support reporting the length. */ - -} FLAC__StreamDecoderLengthStatus; - -/** Maps a FLAC__StreamDecoderLengthStatus to a C string. - * - * Using a FLAC__StreamDecoderLengthStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[]; - - -/** 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 back to the FLAC__StreamDecoder error callback. - * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC is the generic catch- - * all. The rest could be caused by bad sync (false synchronization on - * data that is not the start of a frame) or corrupted data. The error - * itself is the decoder's best guess at what happened assuming a correct - * sync. For example \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER - * could be caused by a correct sync on the start of a frame, but some - * data in the frame header was corrupted. Or it could be the result of - * syncing on a point the stream that looked like the starting of a frame - * but was not. \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM - * could be because the decoder encountered a valid frame made by a future - * version of the encoder which it cannot parse, or because of a false - * sync making it appear as though an encountered frame was generated by - * a future encoder. - */ -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__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM - /**< The decoder encountered reserved fields in use in the stream. */ - -} 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. - * - * A function pointer matching this signature must be passed to - * FLAC__stream_decoder_init*_stream(). 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. - * - * Here is an example of a read callback for stdio streams: - * \code - * FLAC__StreamDecoderReadStatus read_cb(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) - * { - * FILE *file = ((MyClientData*)client_data)->file; - * if(*bytes > 0) { - * *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file); - * if(ferror(file)) - * return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - * else if(*bytes == 0) - * return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - * else - * return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - * } - * else - * return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - * } - * \endcode - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \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_init_*(). - * \retval FLAC__StreamDecoderReadStatus - * The callee's return status. Note that the callback should return - * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM if and only if - * zero bytes were read and there is no more data to be read. - */ -typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); - -/** Signature for the seek callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_decoder_init*_stream(). 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. - * - * Here is an example of a seek callback for stdio streams: - * \code - * FLAC__StreamDecoderSeekStatus seek_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) - * { - * FILE *file = ((MyClientData*)client_data)->file; - * if(file == stdin) - * return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; - * else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0) - * return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - * else - * return FLAC__STREAM_DECODER_SEEK_STATUS_OK; - * } - * \endcode - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \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__stream_decoder_init_*(). - * \retval FLAC__StreamDecoderSeekStatus - * The callee's return status. - */ -typedef FLAC__StreamDecoderSeekStatus (*FLAC__StreamDecoderSeekCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); - -/** Signature for the tell callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_decoder_init*_stream(). 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. - * - * Here is an example of a tell callback for stdio streams: - * \code - * FLAC__StreamDecoderTellStatus tell_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) - * { - * FILE *file = ((MyClientData*)client_data)->file; - * off_t pos; - * if(file == stdin) - * return FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED; - * else if((pos = ftello(file)) < 0) - * return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - * else { - * *absolute_byte_offset = (FLAC__uint64)pos; - * return FLAC__STREAM_DECODER_TELL_STATUS_OK; - * } - * } - * \endcode - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \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__stream_decoder_init_*(). - * \retval FLAC__StreamDecoderTellStatus - * The callee's return status. - */ -typedef FLAC__StreamDecoderTellStatus (*FLAC__StreamDecoderTellCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); - -/** Signature for the length callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_decoder_init*_stream(). The supplied function will be - * called when the decoder wants to know the total length of the stream - * in bytes. - * - * Here is an example of a length callback for stdio streams: - * \code - * FLAC__StreamDecoderLengthStatus length_cb(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) - * { - * FILE *file = ((MyClientData*)client_data)->file; - * struct stat filestats; - * - * if(file == stdin) - * return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; - * else if(fstat(fileno(file), &filestats) != 0) - * return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - * else { - * *stream_length = (FLAC__uint64)filestats.st_size; - * return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; - * } - * } - * \endcode - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \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__stream_decoder_init_*(). - * \retval FLAC__StreamDecoderLengthStatus - * The callee's return status. - */ -typedef FLAC__StreamDecoderLengthStatus (*FLAC__StreamDecoderLengthCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); - -/** Signature for the EOF callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_decoder_init*_stream(). The supplied function will be - * called when the decoder needs to know if the end of the stream has - * been reached. - * - * Here is an example of a EOF callback for stdio streams: - * FLAC__bool eof_cb(const FLAC__StreamDecoder *decoder, void *client_data) - * \code - * { - * FILE *file = ((MyClientData*)client_data)->file; - * return feof(file)? true : false; - * } - * \endcode - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \param decoder The decoder instance calling the callback. - * \param client_data The callee's client data set through - * FLAC__stream_decoder_init_*(). - * \retval FLAC__bool - * \c true if the currently at the end of the stream, else \c false. - */ -typedef FLAC__bool (*FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *decoder, void *client_data); - -/** Signature for the write callback. - * - * A function pointer matching this signature must be passed to one of - * the FLAC__stream_decoder_init_*() functions. - * The supplied function will be called when the decoder has decoded a - * single audio frame. The decoder will pass the frame metadata as well - * as an array of pointers (one for each channel) pointing to the - * decoded audio. - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \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. - * Channels will be ordered according to the FLAC - * specification; see the documentation for the - * frame header. - * \param client_data The callee's client data set through - * FLAC__stream_decoder_init_*(). - * \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. - * - * A function pointer matching this signature must be passed to one of - * the FLAC__stream_decoder_init_*() functions. - * The supplied function will be called when the decoder has decoded a - * metadata block. In a valid FLAC file there will always be one - * \c 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 - * \c STREAMINFO block; you can instruct the decoder to pass or filter - * other blocks with FLAC__stream_decoder_set_metadata_*() calls. - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \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_init_*(). - */ -typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); - -/** Signature for the error callback. - * - * A function pointer matching this signature must be passed to one of - * the FLAC__stream_decoder_init_*() functions. - * The supplied function will be called whenever an error occurs during - * decoding. - * - * \note In general, FLAC__StreamDecoder functions which change the - * state should not be called on the \a decoder while in the callback. - * - * \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_init_*(). - */ -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(void); - -/** 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 serial number for the FLAC stream within the Ogg container. - * 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. - * - * \note - * This does not need to be set for native FLAC decoding. - * - * \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. - */ -FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number); - -/** 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__stream_decoder_finish(). - * - * MD5 signature checking will be turned off (until the next - * FLAC__stream_decoder_reset()) if there is no signature in the - * STREAMINFO block or when a seek is attempted. - * - * Clients that do not use the MD5 check should leave this off to speed - * up decoding. - * - * \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__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool 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 "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__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder); - -/** Get the total number of samples in the stream being decoded. - * Will only be valid after decoding has started and will contain the - * value from the \c STREAMINFO block. A value of \c 0 means "unknown". - * - * \param decoder A decoder instance to query. - * \assert - * \code decoder != NULL \endcode - * \retval unsigned - * See above. - */ -FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(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); - -/** 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. - * - * \warning This function currently only works for native FLAC, - * not Ogg FLAC streams. - * - * \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 the stream is not native FLAC, - * or there was an error from the 'tell' callback or it returned - * \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED. - */ -FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position); - -/** Initialize the decoder instance to decode native FLAC streams. - * - * This flavor of initialization sets up the decoder to decode from a - * native FLAC stream. I/O is performed via callbacks to the client. - * For decoding from a plain file via filename or open FILE*, - * FLAC__stream_decoder_init_file() and FLAC__stream_decoder_init_FILE() - * provide a simpler interface. - * - * This function should be called after FLAC__stream_decoder_new() and - * FLAC__stream_decoder_set_*() but before any of the - * FLAC__stream_decoder_process_*() functions. Will set and return the - * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA - * if initialization succeeded. - * - * \param decoder An uninitialized decoder instance. - * \param read_callback See FLAC__StreamDecoderReadCallback. This - * pointer must not be \c NULL. - * \param seek_callback See FLAC__StreamDecoderSeekCallback. This - * pointer may be \c NULL if seeking is not - * supported. If \a seek_callback is not \c NULL then a - * \a tell_callback, \a length_callback, and \a eof_callback must also be supplied. - * Alternatively, a dummy seek callback that just - * returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param tell_callback See FLAC__StreamDecoderTellCallback. This - * pointer may be \c NULL if not supported by the client. If - * \a seek_callback is not \c NULL then a - * \a tell_callback must also be supplied. - * Alternatively, a dummy tell callback that just - * returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param length_callback See FLAC__StreamDecoderLengthCallback. This - * pointer may be \c NULL if not supported by the client. If - * \a seek_callback is not \c NULL then a - * \a length_callback must also be supplied. - * Alternatively, a dummy length callback that just - * returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param eof_callback See FLAC__StreamDecoderEofCallback. This - * pointer may be \c NULL if not supported by the client. If - * \a seek_callback is not \c NULL then a - * \a eof_callback must also be supplied. - * Alternatively, a dummy length callback that just - * returns \c false - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param write_callback See FLAC__StreamDecoderWriteCallback. This - * pointer must not be \c NULL. - * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This - * pointer may be \c NULL if the callback is not - * desired. - * \param error_callback See FLAC__StreamDecoderErrorCallback. This - * pointer must not be \c NULL. - * \param client_data This value will be supplied to callbacks in their - * \a client_data argument. - * \assert - * \code decoder != NULL \endcode - * \retval FLAC__StreamDecoderInitStatus - * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful; - * see FLAC__StreamDecoderInitStatus for the meanings of other return values. - */ -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream( - FLAC__StreamDecoder *decoder, - FLAC__StreamDecoderReadCallback read_callback, - FLAC__StreamDecoderSeekCallback seek_callback, - FLAC__StreamDecoderTellCallback tell_callback, - FLAC__StreamDecoderLengthCallback length_callback, - FLAC__StreamDecoderEofCallback eof_callback, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -); - -/** Initialize the decoder instance to decode Ogg FLAC streams. - * - * This flavor of initialization sets up the decoder to decode from a - * FLAC stream in an Ogg container. I/O is performed via callbacks to the - * client. For decoding from a plain file via filename or open FILE*, - * FLAC__stream_decoder_init_ogg_file() and FLAC__stream_decoder_init_ogg_FILE() - * provide a simpler interface. - * - * This function should be called after FLAC__stream_decoder_new() and - * FLAC__stream_decoder_set_*() but before any of the - * FLAC__stream_decoder_process_*() functions. Will set and return the - * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA - * if initialization succeeded. - * - * \note Support for Ogg FLAC in the library is optional. If this - * library has been built without support for Ogg FLAC, this function - * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER. - * - * \param decoder An uninitialized decoder instance. - * \param read_callback See FLAC__StreamDecoderReadCallback. This - * pointer must not be \c NULL. - * \param seek_callback See FLAC__StreamDecoderSeekCallback. This - * pointer may be \c NULL if seeking is not - * supported. If \a seek_callback is not \c NULL then a - * \a tell_callback, \a length_callback, and \a eof_callback must also be supplied. - * Alternatively, a dummy seek callback that just - * returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param tell_callback See FLAC__StreamDecoderTellCallback. This - * pointer may be \c NULL if not supported by the client. If - * \a seek_callback is not \c NULL then a - * \a tell_callback must also be supplied. - * Alternatively, a dummy tell callback that just - * returns \c FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param length_callback See FLAC__StreamDecoderLengthCallback. This - * pointer may be \c NULL if not supported by the client. If - * \a seek_callback is not \c NULL then a - * \a length_callback must also be supplied. - * Alternatively, a dummy length callback that just - * returns \c FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param eof_callback See FLAC__StreamDecoderEofCallback. This - * pointer may be \c NULL if not supported by the client. If - * \a seek_callback is not \c NULL then a - * \a eof_callback must also be supplied. - * Alternatively, a dummy length callback that just - * returns \c false - * may also be supplied, all though this is slightly - * less efficient for the decoder. - * \param write_callback See FLAC__StreamDecoderWriteCallback. This - * pointer must not be \c NULL. - * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This - * pointer may be \c NULL if the callback is not - * desired. - * \param error_callback See FLAC__StreamDecoderErrorCallback. This - * pointer must not be \c NULL. - * \param client_data This value will be supplied to callbacks in their - * \a client_data argument. - * \assert - * \code decoder != NULL \endcode - * \retval FLAC__StreamDecoderInitStatus - * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful; - * see FLAC__StreamDecoderInitStatus for the meanings of other return values. - */ -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream( - FLAC__StreamDecoder *decoder, - FLAC__StreamDecoderReadCallback read_callback, - FLAC__StreamDecoderSeekCallback seek_callback, - FLAC__StreamDecoderTellCallback tell_callback, - FLAC__StreamDecoderLengthCallback length_callback, - FLAC__StreamDecoderEofCallback eof_callback, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -); - -/** Initialize the decoder instance to decode native FLAC files. - * - * This flavor of initialization sets up the decoder to decode from a - * plain native FLAC file. For non-stdio streams, you must use - * FLAC__stream_decoder_init_stream() and provide callbacks for the I/O. - * - * This function should be called after FLAC__stream_decoder_new() and - * FLAC__stream_decoder_set_*() but before any of the - * FLAC__stream_decoder_process_*() functions. Will set and return the - * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA - * if initialization succeeded. - * - * \param decoder An uninitialized decoder instance. - * \param file An open FLAC file. The file should have been - * opened with mode \c "rb" and rewound. The file - * becomes owned by the decoder and should not be - * manipulated by the client while decoding. - * Unless \a file is \c stdin, it will be closed - * when FLAC__stream_decoder_finish() is called. - * Note however that seeking will not work when - * decoding from \c stdout since it is not seekable. - * \param write_callback See FLAC__StreamDecoderWriteCallback. This - * pointer must not be \c NULL. - * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This - * pointer may be \c NULL if the callback is not - * desired. - * \param error_callback See FLAC__StreamDecoderErrorCallback. This - * pointer must not be \c NULL. - * \param client_data This value will be supplied to callbacks in their - * \a client_data argument. - * \assert - * \code decoder != NULL \endcode - * \code file != NULL \endcode - * \retval FLAC__StreamDecoderInitStatus - * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful; - * see FLAC__StreamDecoderInitStatus for the meanings of other return values. - */ -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE( - FLAC__StreamDecoder *decoder, - FILE *file, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -); - -/** Initialize the decoder instance to decode Ogg FLAC files. - * - * This flavor of initialization sets up the decoder to decode from a - * plain Ogg FLAC file. For non-stdio streams, you must use - * FLAC__stream_decoder_init_ogg_stream() and provide callbacks for the I/O. - * - * This function should be called after FLAC__stream_decoder_new() and - * FLAC__stream_decoder_set_*() but before any of the - * FLAC__stream_decoder_process_*() functions. Will set and return the - * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA - * if initialization succeeded. - * - * \note Support for Ogg FLAC in the library is optional. If this - * library has been built without support for Ogg FLAC, this function - * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER. - * - * \param decoder An uninitialized decoder instance. - * \param file An open FLAC file. The file should have been - * opened with mode \c "rb" and rewound. The file - * becomes owned by the decoder and should not be - * manipulated by the client while decoding. - * Unless \a file is \c stdin, it will be closed - * when FLAC__stream_decoder_finish() is called. - * Note however that seeking will not work when - * decoding from \c stdout since it is not seekable. - * \param write_callback See FLAC__StreamDecoderWriteCallback. This - * pointer must not be \c NULL. - * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This - * pointer may be \c NULL if the callback is not - * desired. - * \param error_callback See FLAC__StreamDecoderErrorCallback. This - * pointer must not be \c NULL. - * \param client_data This value will be supplied to callbacks in their - * \a client_data argument. - * \assert - * \code decoder != NULL \endcode - * \code file != NULL \endcode - * \retval FLAC__StreamDecoderInitStatus - * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful; - * see FLAC__StreamDecoderInitStatus for the meanings of other return values. - */ -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE( - FLAC__StreamDecoder *decoder, - FILE *file, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -); - -/** Initialize the decoder instance to decode native FLAC files. - * - * This flavor of initialization sets up the decoder to decode from a plain - * native FLAC file. If POSIX fopen() semantics are not sufficient, (for - * example, with Unicode filenames on Windows), you must use - * FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream() - * and provide callbacks for the I/O. - * - * This function should be called after FLAC__stream_decoder_new() and - * FLAC__stream_decoder_set_*() but before any of the - * FLAC__stream_decoder_process_*() functions. Will set and return the - * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA - * if initialization succeeded. - * - * \param decoder An uninitialized decoder instance. - * \param filename The name of the file to decode from. The file will - * be opened with fopen(). Use \c NULL to decode from - * \c stdin. Note that \c stdin is not seekable. - * \param write_callback See FLAC__StreamDecoderWriteCallback. This - * pointer must not be \c NULL. - * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This - * pointer may be \c NULL if the callback is not - * desired. - * \param error_callback See FLAC__StreamDecoderErrorCallback. This - * pointer must not be \c NULL. - * \param client_data This value will be supplied to callbacks in their - * \a client_data argument. - * \assert - * \code decoder != NULL \endcode - * \retval FLAC__StreamDecoderInitStatus - * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful; - * see FLAC__StreamDecoderInitStatus for the meanings of other return values. - */ -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file( - FLAC__StreamDecoder *decoder, - const char *filename, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -); - -/** Initialize the decoder instance to decode Ogg FLAC files. - * - * This flavor of initialization sets up the decoder to decode from a plain - * Ogg FLAC file. If POSIX fopen() semantics are not sufficient, (for - * example, with Unicode filenames on Windows), you must use - * FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream() - * and provide callbacks for the I/O. - * - * This function should be called after FLAC__stream_decoder_new() and - * FLAC__stream_decoder_set_*() but before any of the - * FLAC__stream_decoder_process_*() functions. Will set and return the - * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA - * if initialization succeeded. - * - * \note Support for Ogg FLAC in the library is optional. If this - * library has been built without support for Ogg FLAC, this function - * will return \c FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER. - * - * \param decoder An uninitialized decoder instance. - * \param filename The name of the file to decode from. The file will - * be opened with fopen(). Use \c NULL to decode from - * \c stdin. Note that \c stdin is not seekable. - * \param write_callback See FLAC__StreamDecoderWriteCallback. This - * pointer must not be \c NULL. - * \param metadata_callback See FLAC__StreamDecoderMetadataCallback. This - * pointer may be \c NULL if the callback is not - * desired. - * \param error_callback See FLAC__StreamDecoderErrorCallback. This - * pointer must not be \c NULL. - * \param client_data This value will be supplied to callbacks in their - * \a client_data argument. - * \assert - * \code decoder != NULL \endcode - * \retval FLAC__StreamDecoderInitStatus - * \c FLAC__STREAM_DECODER_INIT_STATUS_OK if initialization was successful; - * see FLAC__StreamDecoderInitStatus for the meanings of other return values. - */ -FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file( - FLAC__StreamDecoder *decoder, - const char *filename, - FLAC__StreamDecoderWriteCallback write_callback, - FLAC__StreamDecoderMetadataCallback metadata_callback, - FLAC__StreamDecoderErrorCallback error_callback, - void *client_data -); - -/** 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 - * \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__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. 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 - * error occurs (in which case the state will be set to - * \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR). - */ -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. MD5 checking will be restored to its original - * setting. - * - * If the decoder is seekable, or was initialized with - * FLAC__stream_decoder_init*_FILE() or FLAC__stream_decoder_init*_file(), - * the decoder will also attempt to seek to the beginning of the file. - * If this rewind fails, this function will return \c false. It follows - * that FLAC__stream_decoder_reset() cannot be used when decoding from - * \c stdin. - * - * If the decoder was initialized with FLAC__stream_encoder_init*_stream() - * and is not seekable (i.e. no seek callback was provided or the seek - * callback returns \c FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED), it - * is the duty of the client to start feeding data from the beginning of - * the stream on the next FLAC__stream_decoder_process() or - * FLAC__stream_decoder_process_interleaved() call. - * - * \param decoder A decoder instance. - * \assert - * \code decoder != NULL \endcode - * \retval FLAC__bool - * \c true if successful, else \c false if a memory allocation occurs - * (in which case the state will be set to - * \c FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR) or a seek error - * occurs (the state will be unchanged). - */ -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 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 - * a 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 fatal read, write, or memory allocation error - * occurred (meaning decoding must stop), else \c true; for more - * information about the decoder, check the decoder state with - * FLAC__stream_decoder_get_state(). - */ -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. - * - * \param decoder An initialized decoder instance. - * \assert - * \code decoder != NULL \endcode - * \retval FLAC__bool - * \c false if any fatal read, write, or memory allocation error - * occurred (meaning decoding must stop), else \c true; for more - * information about the decoder, check the decoder state with - * FLAC__stream_decoder_get_state(). - */ -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. - * - * \param decoder An initialized decoder instance. - * \assert - * \code decoder != NULL \endcode - * \retval FLAC__bool - * \c false if any fatal read, write, or memory allocation error - * occurred (meaning decoding must stop), else \c true; for more - * information about the decoder, check the decoder state with - * FLAC__stream_decoder_get_state(). - */ -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 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__stream_decoder_skip_single_frame() to quickly advance - * to the next frame, then use - * FLAC__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 fatal read, write, or memory allocation error - * occurred (meaning decoding must stop), or if the decoder - * is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or - * FLAC__STREAM_DECODER_READ_METADATA state, else \c true; for more - * information about the decoder, check the decoder state with - * FLAC__stream_decoder_get_state(). - */ -FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *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. The - * client must support seeking the input or this function will fail - * and return \c false. Furthermore, if the decoder state is - * \c FLAC__STREAM_DECODER_SEEK_ERROR, then the decoder must be flushed - * with FLAC__stream_decoder_flush() or reset with - * FLAC__stream_decoder_reset() before decoding can continue. - * - * \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__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample); - -/* \} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/flac/stream_encoder.c b/src/lib/dl/ext/flac/stream_encoder.c deleted file mode 100755 index ee14f530..00000000 --- a/src/lib/dl/ext/flac/stream_encoder.c +++ /dev/null @@ -1,4364 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#if defined _MSC_VER || defined __MINGW32__ -#include /* for _setmode() */ -#include /* for _O_BINARY */ -#endif -#if defined __CYGWIN__ || defined __EMX__ -#include /* for setmode(), O_BINARY */ -#include /* for _O_BINARY */ -#endif -#include -#include -#include /* for malloc() */ -#include /* for memcpy() */ -#include /* for off_t */ -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif -#include "flac/assert.h" -#include "flac/stream_decoder.h" -#include "share/alloc.h" -#include "protected/stream_encoder.h" -#include "private/bitwriter.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" -#if FLAC__HAS_OGG -#include "private/ogg_helper.h" -#include "private/ogg_mapping.h" -#endif -#include "private/stream_encoder_framing.h" -#include "private/window.h" - -#ifdef TARGET_MSDOS /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#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)) - -/* Exact Rice codeword length calculation is off by default. The simple - * (and fast) estimation (of how many bits a residual value will be - * encoded with) in this encoder is very good, almost always yielding - * compression within 0.1% of exact calculation. - */ -#undef EXACT_RICE_BITS_CALCULATION -/* Rice parameter searching is off by default. The simple (and fast) - * parameter estimation in this encoder is very good, almost always - * yielding compression within 0.1% of the optimal parameters. - */ -#undef ENABLE_RICE_PARAMETER_SEARCH - - -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; - -static struct CompressionLevels { - FLAC__bool do_mid_side_stereo; - FLAC__bool loose_mid_side_stereo; - unsigned max_lpc_order; - unsigned qlp_coeff_precision; - FLAC__bool do_qlp_coeff_prec_search; - FLAC__bool do_escape_coding; - FLAC__bool do_exhaustive_model_search; - unsigned min_residual_partition_order; - unsigned max_residual_partition_order; - unsigned rice_parameter_search_dist; -} compression_levels_[] = { - { false, false, 0, 0, false, false, false, 0, 3, 0 }, - { true , true , 0, 0, false, false, false, 0, 3, 0 }, - { true , false, 0, 0, false, false, false, 0, 3, 0 }, - { false, false, 6, 0, false, false, false, 0, 4, 0 }, - { true , true , 8, 0, false, false, false, 0, 4, 0 }, - { true , false, 8, 0, false, false, false, 0, 5, 0 }, - { true , false, 8, 0, false, false, false, 0, 6, 0 }, - { true , false, 8, 0, false, false, true , 0, 6, 0 }, - { true , false, 12, 0, false, false, true , 0, 6, 0 } -}; - - -/*********************************************************************** - * - * 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_blocksize); -static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block); -static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block); -static void update_metadata_(const FLAC__StreamEncoder *encoder); -#if FLAC__HAS_OGG -static void update_ogg_metadata_(FLAC__StreamEncoder *encoder); -#endif -static FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block, FLAC__bool is_last_block); -static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block); - -static FLAC__bool process_subframe_( - FLAC__StreamEncoder *encoder, - unsigned min_partition_order, - unsigned max_partition_order, - const FLAC__FrameHeader *frame_header, - unsigned subframe_bps, - const FLAC__int32 integer_signal[], - 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, - unsigned blocksize, - unsigned subframe_bps, - const FLAC__Subframe *subframe, - FLAC__BitWriter *frame -); - -static unsigned evaluate_constant_subframe_( - FLAC__StreamEncoder *encoder, - const FLAC__int32 signal, - unsigned blocksize, - unsigned subframe_bps, - FLAC__Subframe *subframe -); - -static unsigned evaluate_fixed_subframe_( - FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], - FLAC__int32 residual[], - FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned blocksize, - unsigned subframe_bps, - unsigned order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - 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__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 rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - 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_( - FLAC__StreamEncoder *encoder, - 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__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned residual_samples, - unsigned predictor_order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps, - FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, - FLAC__EntropyCodingMethod *best_ecm -); - -static void precompute_partition_info_sums_( - const FLAC__int32 residual[], - FLAC__uint64 abs_residual_partition_sums[], - unsigned residual_samples, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps -); - -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 -); - -static FLAC__bool set_partitioned_rice_( -#ifdef EXACT_RICE_BITS_CALCULATION - const FLAC__int32 residual[], -#endif - 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_limit, - const unsigned rice_parameter_search_dist, - const unsigned partition_order, - const FLAC__bool search_for_escapes, - FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, - unsigned *bits -); - -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[], size_t *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); - -static FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data); -static FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); -static FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); -static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); -static FILE *get_binary_stdout_(void); - - -/*********************************************************************** - * - * 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]; /* (@@@ currently unused) the floating-point version of the input signal */ - FLAC__real *real_signal_mid_side[2]; /* (@@@ currently unused) the floating-point version of the mid-side input signal (stereo only) */ - FLAC__real *window[FLAC__MAX_APODIZATION_FUNCTIONS]; /* the pre-computed floating-point window for each apodization function */ - FLAC__real *windowed_signal; /* the integer_signal[] * current window[] */ -#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 (0 or 1) into 2nd dimension of 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__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__BitWriter *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 streaminfo; /* scratchpad for STREAMINFO as it is built */ - FLAC__StreamMetadata_SeekTable *seek_table; /* pointer into encoder->protected_->metadata_ where the seek table is */ - unsigned current_sample_number; - unsigned current_frame_number; - 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 disable_constant_subframes; - FLAC__bool disable_fixed_subframes; - FLAC__bool disable_verbatim_subframes; -#if FLAC__HAS_OGG - FLAC__bool is_ogg; -#endif - FLAC__StreamEncoderReadCallback read_callback; /* currently only needed for Ogg FLAC */ - FLAC__StreamEncoderSeekCallback seek_callback; - FLAC__StreamEncoderTellCallback tell_callback; - FLAC__StreamEncoderWriteCallback write_callback; - FLAC__StreamEncoderMetadataCallback metadata_callback; - FLAC__StreamEncoderProgressCallback progress_callback; - void *client_data; - unsigned first_seekpoint_to_check; - FILE *file; /* only used when encoding to a file */ - FLAC__uint64 bytes_written; - FLAC__uint64 samples_written; - unsigned frames_written; - unsigned total_frames_estimate; - /* 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]; /* (@@@ currently unused) */ - FLAC__real *real_signal_mid_side_unaligned[2]; /* (@@@ currently unused) */ - FLAC__real *window_unaligned[FLAC__MAX_APODIZATION_FUNCTIONS]; - FLAC__real *windowed_signal_unaligned; -#endif - FLAC__int32 *residual_workspace_unaligned[FLAC__MAX_CHANNELS][2]; - FLAC__int32 *residual_workspace_mid_side_unaligned[2][2]; - 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_UNINITIALIZED", - "FLAC__STREAM_ENCODER_OGG_ERROR", - "FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR", - "FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA", - "FLAC__STREAM_ENCODER_CLIENT_ERROR", - "FLAC__STREAM_ENCODER_IO_ERROR", - "FLAC__STREAM_ENCODER_FRAMING_ERROR", - "FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR" -}; - -FLAC_API const char * const FLAC__StreamEncoderInitStatusString[] = { - "FLAC__STREAM_ENCODER_INIT_STATUS_OK", - "FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR", - "FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION", - "FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER", - "FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE", - "FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA", - "FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED" -}; - -FLAC_API const char * const FLAC__treamEncoderReadStatusString[] = { - "FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE", - "FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM", - "FLAC__STREAM_ENCODER_READ_STATUS_ABORT", - "FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED" -}; - -FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[] = { - "FLAC__STREAM_ENCODER_WRITE_STATUS_OK", - "FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR" -}; - -FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[] = { - "FLAC__STREAM_ENCODER_SEEK_STATUS_OK", - "FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR", - "FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED" -}; - -FLAC_API const char * const FLAC__StreamEncoderTellStatusString[] = { - "FLAC__STREAM_ENCODER_TELL_STATUS_OK", - "FLAC__STREAM_ENCODER_TELL_STATUS_ERROR", - "FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED" -}; - -/* Number of samples that will be overread to watch for end of stream. By - * 'overread', we mean that the FLAC__stream_encoder_process*() calls will - * always try to read blocksize+1 samples before encoding a block, so that - * even if the stream has a total sample count that is an integral multiple - * of the blocksize, we will still notice when we are encoding the last - * block. This is needed, for example, to correctly set the end-of-stream - * marker in Ogg FLAC. - * - * WATCHOUT: some parts of the code assert that OVERREAD_ == 1 and there's - * not really any reason to change it. - */ -static const unsigned OVERREAD_ = 1; - -/*********************************************************************** - * - * Class constructor/destructor - * - */ -FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void) -{ - 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__bitwriter_new(); - if(encoder->private_->frame == 0) { - free(encoder->private_); - free(encoder->protected_); - free(encoder); - return 0; - } - - encoder->private_->file = 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; - - (void)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__bitwriter_delete(encoder->private_->frame); - free(encoder->private_); - free(encoder->protected_); - free(encoder); -} - -/*********************************************************************** - * - * Public class methods - * - ***********************************************************************/ - -static FLAC__StreamEncoderInitStatus init_stream_internal_( - FLAC__StreamEncoder *encoder, - FLAC__StreamEncoderReadCallback read_callback, - FLAC__StreamEncoderWriteCallback write_callback, - FLAC__StreamEncoderSeekCallback seek_callback, - FLAC__StreamEncoderTellCallback tell_callback, - FLAC__StreamEncoderMetadataCallback metadata_callback, - void *client_data, - FLAC__bool is_ogg -) -{ - unsigned i; - FLAC__bool metadata_has_seektable, metadata_has_vorbis_comment, metadata_picture_has_type1, metadata_picture_has_type2; - - FLAC__ASSERT(0 != encoder); - - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED; - -#if !FLAC__HAS_OGG - if(is_ogg) - return FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER; -#endif - - if(0 == write_callback || (seek_callback && 0 == tell_callback)) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS; - - if(encoder->protected_->channels == 0 || encoder->protected_->channels > FLAC__MAX_CHANNELS) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS; - - if(encoder->protected_->channels != 2) { - encoder->protected_->do_mid_side_stereo = false; - encoder->protected_->loose_mid_side_stereo = false; - } - else if(!encoder->protected_->do_mid_side_stereo) - encoder->protected_->loose_mid_side_stereo = false; - - if(encoder->protected_->bits_per_sample >= 32) - encoder->protected_->do_mid_side_stereo = false; /* since we currenty 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 FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE; - - if(!FLAC__format_sample_rate_is_valid(encoder->protected_->sample_rate)) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE; - - if(encoder->protected_->blocksize == 0) { - if(encoder->protected_->max_lpc_order == 0) - encoder->protected_->blocksize = 1152; - else - encoder->protected_->blocksize = 4096; - } - - if(encoder->protected_->blocksize < FLAC__MIN_BLOCK_SIZE || encoder->protected_->blocksize > FLAC__MAX_BLOCK_SIZE) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE; - - if(encoder->protected_->max_lpc_order > FLAC__MAX_LPC_ORDER) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER; - - if(encoder->protected_->blocksize < encoder->protected_->max_lpc_order) - return FLAC__STREAM_ENCODER_INIT_STATUS_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 FLAC__STREAM_ENCODER_INIT_STATUS_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 FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE; - if(!FLAC__format_sample_rate_is_subset(encoder->protected_->sample_rate)) - return FLAC__STREAM_ENCODER_INIT_STATUS_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 FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE; - if(encoder->protected_->max_residual_partition_order > FLAC__SUBSET_MAX_RICE_PARTITION_ORDER) - return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE; - if( - encoder->protected_->sample_rate <= 48000 && - ( - encoder->protected_->blocksize > FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ || - encoder->protected_->max_lpc_order > FLAC__SUBSET_MAX_LPC_ORDER_48000HZ - ) - ) { - return FLAC__STREAM_ENCODER_INIT_STATUS_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; - -#if FLAC__HAS_OGG - /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */ - if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 1) { - unsigned i; - for(i = 1; i < encoder->protected_->num_metadata_blocks; i++) { - if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - FLAC__StreamMetadata *vc = encoder->protected_->metadata[i]; - for( ; i > 0; i--) - encoder->protected_->metadata[i] = encoder->protected_->metadata[i-1]; - encoder->protected_->metadata[0] = vc; - break; - } - } - } -#endif - /* keep track of any SEEKTABLE block */ - if(0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) { - unsigned i; - for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) { - if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) { - encoder->private_->seek_table = &encoder->protected_->metadata[i]->data.seek_table; - break; /* take only the first one */ - } - } - } - - /* validate metadata */ - if(0 == encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - metadata_has_seektable = false; - metadata_has_vorbis_comment = false; - metadata_picture_has_type1 = false; - metadata_picture_has_type2 = false; - for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) { - const FLAC__StreamMetadata *m = encoder->protected_->metadata[i]; - if(m->type == FLAC__METADATA_TYPE_STREAMINFO) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - else if(m->type == FLAC__METADATA_TYPE_SEEKTABLE) { - if(metadata_has_seektable) /* only one is allowed */ - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - metadata_has_seektable = true; - if(!FLAC__format_seektable_is_legal(&m->data.seek_table)) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - } - else if(m->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - if(metadata_has_vorbis_comment) /* only one is allowed */ - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - metadata_has_vorbis_comment = true; - } - else if(m->type == FLAC__METADATA_TYPE_CUESHEET) { - if(!FLAC__format_cuesheet_is_legal(&m->data.cue_sheet, m->data.cue_sheet.is_cd, /*violation=*/0)) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - } - else if(m->type == FLAC__METADATA_TYPE_PICTURE) { - if(!FLAC__format_picture_is_legal(&m->data.picture, /*violation=*/0)) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD) { - if(metadata_picture_has_type1) /* there should only be 1 per stream */ - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - metadata_picture_has_type1 = true; - /* standard icon must be 32x32 pixel PNG */ - if( - m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && - ( - (strcmp(m->data.picture.mime_type, "image/png") && strcmp(m->data.picture.mime_type, "-->")) || - m->data.picture.width != 32 || - m->data.picture.height != 32 - ) - ) - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - } - else if(m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON) { - if(metadata_picture_has_type2) /* there should only be 1 per stream */ - return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA; - metadata_picture_has_type2 = true; - } - } - } - - 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 - } -#ifndef FLAC__INTEGER_ONLY_LIBRARY - for(i = 0; i < encoder->protected_->num_apodizations; i++) - encoder->private_->window_unaligned[i] = encoder->private_->window[i] = 0; - encoder->private_->windowed_signal_unaligned = encoder->private_->windowed_signal = 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_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 - 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 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; - } - - /* set state to OK; from here on, errors are fatal and we'll override the state then */ - encoder->protected_->state = FLAC__STREAM_ENCODER_OK; - -#if FLAC__HAS_OGG - encoder->private_->is_ogg = is_ogg; - if(is_ogg && !FLAC__ogg_encoder_aspect_init(&encoder->protected_->ogg_encoder_aspect)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } -#endif - - encoder->private_->read_callback = read_callback; - encoder->private_->write_callback = write_callback; - encoder->private_->seek_callback = seek_callback; - encoder->private_->tell_callback = tell_callback; - encoder->private_->metadata_callback = metadata_callback; - encoder->private_->client_data = client_data; - - if(!resize_buffers_(encoder, encoder->protected_->blocksize)) { - /* the above function sets the state for us in case of an error */ - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - - if(!FLAC__bitwriter_init(encoder->private_->frame)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_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+OVERREAD_; - for(i = 0; i < encoder->protected_->channels; i++) { - if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)safe_malloc_mul_2op_(sizeof(FLAC__int32), /*times*/encoder->private_->verify.input_fifo.size))) { - encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_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) { - encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - - if(FLAC__stream_decoder_init_stream(encoder->private_->verify.decoder, verify_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, verify_write_callback_, verify_metadata_callback_, verify_error_callback_, /*client_data=*/encoder) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_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; - - /* - * These must be done before we write any metadata, 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; - - /* - * write the stream header - */ - if(encoder->protected_->verify) - encoder->private_->verify.state_hint = ENCODER_IN_MAGIC; - if(!FLAC__bitwriter_write_raw_uint32(encoder->private_->frame, FLAC__STREAM_SYNC, FLAC__STREAM_SYNC_LEN)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) { - /* the above function sets the state for us in case of an error */ - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - - /* - * write the STREAMINFO metadata block - */ - if(encoder->protected_->verify) - encoder->private_->verify.state_hint = ENCODER_IN_METADATA; - encoder->private_->streaminfo.type = FLAC__METADATA_TYPE_STREAMINFO; - encoder->private_->streaminfo.is_last = false; /* we will have at a minimum a VORBIS_COMMENT afterwards */ - encoder->private_->streaminfo.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; - encoder->private_->streaminfo.data.stream_info.min_blocksize = encoder->protected_->blocksize; /* this encoder uses the same blocksize for the whole stream */ - encoder->private_->streaminfo.data.stream_info.max_blocksize = encoder->protected_->blocksize; - encoder->private_->streaminfo.data.stream_info.min_framesize = 0; /* we don't know this yet; have to fill it in later */ - encoder->private_->streaminfo.data.stream_info.max_framesize = 0; /* we don't know this yet; have to fill it in later */ - encoder->private_->streaminfo.data.stream_info.sample_rate = encoder->protected_->sample_rate; - encoder->private_->streaminfo.data.stream_info.channels = encoder->protected_->channels; - encoder->private_->streaminfo.data.stream_info.bits_per_sample = encoder->protected_->bits_per_sample; - encoder->private_->streaminfo.data.stream_info.total_samples = encoder->protected_->total_samples_estimate; /* we will replace this later with the real total */ - memset(encoder->private_->streaminfo.data.stream_info.md5sum, 0, 16); /* we don't know this yet; have to fill it in later */ - if(encoder->protected_->do_md5) - FLAC__MD5Init(&encoder->private_->md5context); - if(!FLAC__add_metadata_block(&encoder->private_->streaminfo, encoder->private_->frame)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) { - /* the above function sets the state for us in case of an error */ - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - - /* - * Now that the STREAMINFO block is written, we can init this to an - * absurdly-high value... - */ - encoder->private_->streaminfo.data.stream_info.min_framesize = (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN) - 1; - /* ... and clear this to 0 */ - encoder->private_->streaminfo.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: the Ogg FLAC mapping requires us to write this block after - * the STREAMINFO. (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__add_metadata_block(&vorbis_comment, encoder->private_->frame)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) { - /* the above function sets the state for us in case of an error */ - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - } - - /* - * 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__add_metadata_block(encoder->protected_->metadata[i], encoder->private_->frame)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - if(!write_bitbuffer_(encoder, 0, /*is_last_block=*/false)) { - /* the above function sets the state for us in case of an error */ - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - } - - /* now that all the metadata is written, we save the stream offset */ - if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &encoder->protected_->audio_offset, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR) { /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */ - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - - if(encoder->protected_->verify) - encoder->private_->verify.state_hint = ENCODER_IN_AUDIO; - - return FLAC__STREAM_ENCODER_INIT_STATUS_OK; -} - -FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream( - FLAC__StreamEncoder *encoder, - FLAC__StreamEncoderWriteCallback write_callback, - FLAC__StreamEncoderSeekCallback seek_callback, - FLAC__StreamEncoderTellCallback tell_callback, - FLAC__StreamEncoderMetadataCallback metadata_callback, - void *client_data -) -{ - return init_stream_internal_( - encoder, - /*read_callback=*/0, - write_callback, - seek_callback, - tell_callback, - metadata_callback, - client_data, - /*is_ogg=*/false - ); -} - -FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream( - FLAC__StreamEncoder *encoder, - FLAC__StreamEncoderReadCallback read_callback, - FLAC__StreamEncoderWriteCallback write_callback, - FLAC__StreamEncoderSeekCallback seek_callback, - FLAC__StreamEncoderTellCallback tell_callback, - FLAC__StreamEncoderMetadataCallback metadata_callback, - void *client_data -) -{ - return init_stream_internal_( - encoder, - read_callback, - write_callback, - seek_callback, - tell_callback, - metadata_callback, - client_data, - /*is_ogg=*/true - ); -} - -static FLAC__StreamEncoderInitStatus init_FILE_internal_( - FLAC__StreamEncoder *encoder, - FILE *file, - FLAC__StreamEncoderProgressCallback progress_callback, - void *client_data, - FLAC__bool is_ogg -) -{ - FLAC__StreamEncoderInitStatus init_status; - - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != file); - - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED; - - /* double protection */ - if(file == 0) { - encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - - /* - * To make sure that our file does not go unclosed after an error, we - * must assign the FILE pointer before any further error can occur in - * this routine. - */ - if(file == stdout) - file = get_binary_stdout_(); /* just to be safe */ - - encoder->private_->file = file; - - encoder->private_->progress_callback = progress_callback; - encoder->private_->bytes_written = 0; - encoder->private_->samples_written = 0; - encoder->private_->frames_written = 0; - - init_status = init_stream_internal_( - encoder, - encoder->private_->file == stdout? 0 : is_ogg? file_read_callback_ : 0, - file_write_callback_, - encoder->private_->file == stdout? 0 : file_seek_callback_, - encoder->private_->file == stdout? 0 : file_tell_callback_, - /*metadata_callback=*/0, - client_data, - is_ogg - ); - if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) { - /* the above function sets the state for us in case of an error */ - return init_status; - } - - { - unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder); - - FLAC__ASSERT(blocksize != 0); - encoder->private_->total_frames_estimate = (unsigned)((FLAC__stream_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize); - } - - return init_status; -} - -FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( - FLAC__StreamEncoder *encoder, - FILE *file, - FLAC__StreamEncoderProgressCallback progress_callback, - void *client_data -) -{ - return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/false); -} - -FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE( - FLAC__StreamEncoder *encoder, - FILE *file, - FLAC__StreamEncoderProgressCallback progress_callback, - void *client_data -) -{ - return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/true); -} - -static FLAC__StreamEncoderInitStatus init_file_internal_( - FLAC__StreamEncoder *encoder, - const char *filename, - FLAC__StreamEncoderProgressCallback progress_callback, - void *client_data, - FLAC__bool is_ogg -) -{ - FILE *file; - - FLAC__ASSERT(0 != encoder); - - /* - * To make sure that our file does not go unclosed after an error, we - * have to do the same entrance checks here that are later performed - * in FLAC__stream_encoder_init_FILE() before the FILE* is assigned. - */ - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED; - - file = filename? fopen(filename, "w+b") : stdout; - - if(file == 0) { - encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; - } - - return init_FILE_internal_(encoder, file, progress_callback, client_data, is_ogg); -} - -FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file( - FLAC__StreamEncoder *encoder, - const char *filename, - FLAC__StreamEncoderProgressCallback progress_callback, - void *client_data -) -{ - return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/false); -} - -FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file( - FLAC__StreamEncoder *encoder, - const char *filename, - FLAC__StreamEncoderProgressCallback progress_callback, - void *client_data -) -{ - return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/true); -} - -FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder) -{ - FLAC__bool error = false; - - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - - if(encoder->protected_->state == FLAC__STREAM_ENCODER_UNINITIALIZED) - return true; - - if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK && !encoder->private_->is_being_deleted) { - if(encoder->private_->current_sample_number != 0) { - const FLAC__bool is_fractional_block = encoder->protected_->blocksize != encoder->private_->current_sample_number; - encoder->protected_->blocksize = encoder->private_->current_sample_number; - if(!process_frame_(encoder, is_fractional_block, /*is_last_block=*/true)) - error = true; - } - } - - if(encoder->protected_->do_md5) - FLAC__MD5Final(encoder->private_->streaminfo.data.stream_info.md5sum, &encoder->private_->md5context); - - if(!encoder->private_->is_being_deleted) { - if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK) { - if(encoder->private_->seek_callback) { -#if FLAC__HAS_OGG - if(encoder->private_->is_ogg) - update_ogg_metadata_(encoder); - else -#endif - update_metadata_(encoder); - - /* check if an error occurred while updating metadata */ - if(encoder->protected_->state != FLAC__STREAM_ENCODER_OK) - error = true; - } - if(encoder->private_->metadata_callback) - encoder->private_->metadata_callback(encoder, &encoder->private_->streaminfo, encoder->private_->client_data); - } - - if(encoder->protected_->verify && 0 != encoder->private_->verify.decoder && !FLAC__stream_decoder_finish(encoder->private_->verify.decoder)) { - if(!error) - encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA; - error = true; - } - } - - if(0 != encoder->private_->file) { - if(encoder->private_->file != stdout) - fclose(encoder->private_->file); - encoder->private_->file = 0; - } - -#if FLAC__HAS_OGG - if(encoder->private_->is_ogg) - FLAC__ogg_encoder_aspect_finish(&encoder->protected_->ogg_encoder_aspect); -#endif - - free_(encoder); - set_defaults_(encoder); - - if(!error) - encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED; - - return !error; -} - -FLAC_API FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncoder *encoder, long value) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return false; -#if FLAC__HAS_OGG - /* can't check encoder->private_->is_ogg since that's not set until init time */ - FLAC__ogg_encoder_aspect_set_serial_number(&encoder->protected_->ogg_encoder_aspect, value); - return true; -#else - (void)value; - return false; -#endif -} - -FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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_md5(FLAC__StreamEncoder *encoder, FLAC__bool value) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return false; - encoder->protected_->do_md5 = value; - return true; -} - -FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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_compression_level(FLAC__StreamEncoder *encoder, unsigned value) -{ - FLAC__bool ok = true; - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return false; - if(value >= sizeof(compression_levels_)/sizeof(compression_levels_[0])) - value = sizeof(compression_levels_)/sizeof(compression_levels_[0]) - 1; - ok &= FLAC__stream_encoder_set_do_mid_side_stereo (encoder, compression_levels_[value].do_mid_side_stereo); - ok &= FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, compression_levels_[value].loose_mid_side_stereo); -#ifndef FLAC__INTEGER_ONLY_LIBRARY -#if 0 - /* was: */ - ok &= FLAC__stream_encoder_set_apodization (encoder, compression_levels_[value].apodization); - /* but it's too hard to specify the string in a locale-specific way */ -#else - encoder->protected_->num_apodizations = 1; - encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY; - encoder->protected_->apodizations[0].parameters.tukey.p = 0.5; -#endif -#endif - ok &= FLAC__stream_encoder_set_max_lpc_order (encoder, compression_levels_[value].max_lpc_order); - ok &= FLAC__stream_encoder_set_qlp_coeff_precision (encoder, compression_levels_[value].qlp_coeff_precision); - ok &= FLAC__stream_encoder_set_do_qlp_coeff_prec_search (encoder, compression_levels_[value].do_qlp_coeff_prec_search); - ok &= FLAC__stream_encoder_set_do_escape_coding (encoder, compression_levels_[value].do_escape_coding); - ok &= FLAC__stream_encoder_set_do_exhaustive_model_search (encoder, compression_levels_[value].do_exhaustive_model_search); - ok &= FLAC__stream_encoder_set_min_residual_partition_order(encoder, compression_levels_[value].min_residual_partition_order); - ok &= FLAC__stream_encoder_set_max_residual_partition_order(encoder, compression_levels_[value].max_residual_partition_order); - ok &= FLAC__stream_encoder_set_rice_parameter_search_dist (encoder, compression_levels_[value].rice_parameter_search_dist); - return ok; -} - -FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return false; - encoder->protected_->blocksize = 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return false; - encoder->protected_->loose_mid_side_stereo = value; - return true; -} - -/*@@@@add to tests*/ -FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - FLAC__ASSERT(0 != specification); - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return false; -#ifdef FLAC__INTEGER_ONLY_LIBRARY - (void)specification; /* silently ignore since we haven't integerized; will always use a rectangular window */ -#else - encoder->protected_->num_apodizations = 0; - while(1) { - const char *s = strchr(specification, ';'); - const size_t n = s? (size_t)(s - specification) : strlen(specification); - if (n==8 && 0 == strncmp("bartlett" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT; - else if(n==13 && 0 == strncmp("bartlett_hann", specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BARTLETT_HANN; - else if(n==8 && 0 == strncmp("blackman" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN; - else if(n==26 && 0 == strncmp("blackman_harris_4term_92db", specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE; - else if(n==6 && 0 == strncmp("connes" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_CONNES; - else if(n==7 && 0 == strncmp("flattop" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_FLATTOP; - else if(n>7 && 0 == strncmp("gauss(" , specification, 6)) { - FLAC__real stddev = (FLAC__real)strtod(specification+6, 0); - if (stddev > 0.0 && stddev <= 0.5) { - encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.gauss.stddev = stddev; - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_GAUSS; - } - } - else if(n==7 && 0 == strncmp("hamming" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HAMMING; - else if(n==4 && 0 == strncmp("hann" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_HANN; - else if(n==13 && 0 == strncmp("kaiser_bessel", specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_KAISER_BESSEL; - else if(n==7 && 0 == strncmp("nuttall" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_NUTTALL; - else if(n==9 && 0 == strncmp("rectangle" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_RECTANGLE; - else if(n==8 && 0 == strncmp("triangle" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TRIANGLE; - else if(n>7 && 0 == strncmp("tukey(" , specification, 6)) { - FLAC__real p = (FLAC__real)strtod(specification+6, 0); - if (p >= 0.0 && p <= 1.0) { - encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.tukey.p = p; - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TUKEY; - } - } - else if(n==5 && 0 == strncmp("welch" , specification, n)) - encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_WELCH; - if (encoder->protected_->num_apodizations == 32) - break; - if (s) - specification = s+1; - else - break; - } - if(encoder->protected_->num_apodizations == 0) { - encoder->protected_->num_apodizations = 1; - encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY; - encoder->protected_->apodizations[0].parameters.tukey.p = 0.5; - } -#endif - return true; -} - -FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) - return false; - if(0 == metadata) - num_blocks = 0; - if(0 == num_blocks) - metadata = 0; - /* realloc() does not do exactly what we want so... */ - if(encoder->protected_->metadata) { - free(encoder->protected_->metadata); - encoder->protected_->metadata = 0; - encoder->protected_->num_metadata_blocks = 0; - } - if(num_blocks) { - FLAC__StreamMetadata **m; - if(0 == (m = (FLAC__StreamMetadata**)safe_malloc_mul_2op_(sizeof(m[0]), /*times*/num_blocks))) - return false; - memcpy(m, metadata, sizeof(m[0]) * num_blocks); - encoder->protected_->metadata = m; - encoder->protected_->num_metadata_blocks = num_blocks; - } -#if FLAC__HAS_OGG - if(!FLAC__ogg_encoder_aspect_set_num_metadata(&encoder->protected_->ogg_encoder_aspect, num_blocks)) - return false; -#endif - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->state; -} - -FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->verify; -} - -FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->streamable_subset; -} - -FLAC_API FLAC__bool FLAC__stream_encoder_get_do_md5(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->do_md5; -} - -FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->channels; -} - -FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->bits_per_sample; -} - -FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->sample_rate; -} - -FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->blocksize; -} - -FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->loose_mid_side_stereo; -} - -FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - return encoder->protected_->max_lpc_order; -} - -FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder) -{ - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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 = 0, channel; - const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; - - FLAC__ASSERT(0 != encoder); - FLAC__ASSERT(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); - - do { - const unsigned n = min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j); - - if(encoder->protected_->verify) - append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, n); - - for(channel = 0; channel < channels; channel++) - memcpy(&encoder->private_->integer_signal[channel][encoder->private_->current_sample_number], &buffer[channel][j], sizeof(buffer[channel][0]) * n); - - if(encoder->protected_->do_mid_side_stereo) { - FLAC__ASSERT(channels == 2); - /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */ - for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) { - encoder->private_->integer_signal_mid_side[1][i] = buffer[0][j] - buffer[1][j]; - encoder->private_->integer_signal_mid_side[0][i] = (buffer[0][j] + buffer[1][j]) >> 1; /* NOTE: not the same as 'mid = (buffer[0][j] + buffer[1][j]) / 2' ! */ - } - } - else - j += n; - - encoder->private_->current_sample_number += n; - - /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */ - if(encoder->private_->current_sample_number > blocksize) { - FLAC__ASSERT(encoder->private_->current_sample_number == blocksize+OVERREAD_); - FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */ - if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false)) - return false; - /* move unprocessed overread samples to beginnings of arrays */ - for(channel = 0; channel < channels; channel++) - encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize]; - if(encoder->protected_->do_mid_side_stereo) { - encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize]; - encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize]; - } - encoder->private_->current_sample_number = 1; - } - } 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(0 != encoder->private_); - FLAC__ASSERT(0 != encoder->protected_); - 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_->do_mid_side_stereo && channels == 2) { - /* - * stereo coding: unroll channel loop - */ - do { - if(encoder->protected_->verify) - append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j)); - - /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */ - 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 = i; - /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */ - if(i > blocksize) { - if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false)) - return false; - /* move unprocessed overread samples to beginnings of arrays */ - FLAC__ASSERT(i == blocksize+OVERREAD_); - FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */ - encoder->private_->integer_signal[0][0] = encoder->private_->integer_signal[0][blocksize]; - encoder->private_->integer_signal[1][0] = encoder->private_->integer_signal[1][blocksize]; - encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize]; - encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize]; - encoder->private_->current_sample_number = 1; - } - } while(j < samples); - } - else { - /* - * independent channel coding: buffer each channel in inner loop - */ - do { - if(encoder->protected_->verify) - append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j)); - - /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */ - 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 = i; - /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */ - if(i > blocksize) { - if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false)) - return false; - /* move unprocessed overread samples to beginnings of arrays */ - FLAC__ASSERT(i == blocksize+OVERREAD_); - FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */ - for(channel = 0; channel < channels; channel++) - encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize]; - encoder->private_->current_sample_number = 1; - } - } 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_md5 = 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 = 0; -#ifndef FLAC__INTEGER_ONLY_LIBRARY - encoder->protected_->num_apodizations = 1; - encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY; - encoder->protected_->apodizations[0].parameters.tukey.p = 0.5; -#endif - 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_->seek_table = 0; - encoder->private_->disable_constant_subframes = false; - encoder->private_->disable_fixed_subframes = false; - encoder->private_->disable_verbatim_subframes = false; -#if FLAC__HAS_OGG - encoder->private_->is_ogg = false; -#endif - encoder->private_->read_callback = 0; - encoder->private_->write_callback = 0; - encoder->private_->seek_callback = 0; - encoder->private_->tell_callback = 0; - encoder->private_->metadata_callback = 0; - encoder->private_->progress_callback = 0; - encoder->private_->client_data = 0; - -#if FLAC__HAS_OGG - FLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect); -#endif -} - -void free_(FLAC__StreamEncoder *encoder) -{ - unsigned i, channel; - - FLAC__ASSERT(0 != encoder); - if(encoder->protected_->metadata) { - free(encoder->protected_->metadata); - encoder->protected_->metadata = 0; - encoder->protected_->num_metadata_blocks = 0; - } - 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 - } -#ifndef FLAC__INTEGER_ONLY_LIBRARY - for(i = 0; i < encoder->protected_->num_apodizations; i++) { - if(0 != encoder->private_->window_unaligned[i]) { - free(encoder->private_->window_unaligned[i]); - encoder->private_->window_unaligned[i] = 0; - } - } - if(0 != encoder->private_->windowed_signal_unaligned) { - free(encoder->private_->windowed_signal_unaligned); - encoder->private_->windowed_signal_unaligned = 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_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__bitwriter_free(encoder->private_->frame); -} - -FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize) -{ - FLAC__bool ok; - unsigned i, channel; - - FLAC__ASSERT(new_blocksize > 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_blocksize <= 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 in front to keep the data well-aligned. - */ - - for(i = 0; ok && i < encoder->protected_->channels; i++) { - ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_unaligned[i], &encoder->private_->integer_signal[i]); - memset(encoder->private_->integer_signal[i], 0, sizeof(FLAC__int32)*4); - encoder->private_->integer_signal[i] += 4; -#ifndef FLAC__INTEGER_ONLY_LIBRARY -#if 0 /* @@@ currently unused */ - if(encoder->protected_->max_lpc_order > 0) - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize+OVERREAD_, &encoder->private_->real_signal_unaligned[i], &encoder->private_->real_signal[i]); -#endif -#endif - } - for(i = 0; ok && i < 2; i++) { - ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_mid_side_unaligned[i], &encoder->private_->integer_signal_mid_side[i]); - memset(encoder->private_->integer_signal_mid_side[i], 0, sizeof(FLAC__int32)*4); - encoder->private_->integer_signal_mid_side[i] += 4; -#ifndef FLAC__INTEGER_ONLY_LIBRARY -#if 0 /* @@@ currently unused */ - if(encoder->protected_->max_lpc_order > 0) - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize+OVERREAD_, &encoder->private_->real_signal_mid_side_unaligned[i], &encoder->private_->real_signal_mid_side[i]); -#endif -#endif - } -#ifndef FLAC__INTEGER_ONLY_LIBRARY - if(ok && encoder->protected_->max_lpc_order > 0) { - for(i = 0; ok && i < encoder->protected_->num_apodizations; i++) - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->window_unaligned[i], &encoder->private_->window[i]); - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->windowed_signal_unaligned, &encoder->private_->windowed_signal); - } -#endif - 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_blocksize, &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_blocksize, &encoder->private_->residual_workspace_mid_side_unaligned[channel][i], &encoder->private_->residual_workspace_mid_side[channel][i]); - } - } - /* the *2 is an approximation to the series 1 + 1/2 + 1/4 + ... that sums tree occupies in a flat array */ - /*@@@ new_blocksize*2 is too pessimistic, but to fix, we need smarter logic because a smaller new_blocksize can actually increase the # of partitions; would require moving this out into a separate function, then checking its capacity against the need of the current blocksize&min/max_partition_order (and maybe predictor order) */ - ok = ok && FLAC__memory_alloc_aligned_uint64_array(new_blocksize * 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_blocksize * 2, &encoder->private_->raw_bits_per_partition_unaligned, &encoder->private_->raw_bits_per_partition); - - /* now adjust the windows if the blocksize has changed */ -#ifndef FLAC__INTEGER_ONLY_LIBRARY - if(ok && new_blocksize != encoder->private_->input_capacity && encoder->protected_->max_lpc_order > 0) { - for(i = 0; ok && i < encoder->protected_->num_apodizations; i++) { - switch(encoder->protected_->apodizations[i].type) { - case FLAC__APODIZATION_BARTLETT: - FLAC__window_bartlett(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_BARTLETT_HANN: - FLAC__window_bartlett_hann(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_BLACKMAN: - FLAC__window_blackman(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE: - FLAC__window_blackman_harris_4term_92db_sidelobe(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_CONNES: - FLAC__window_connes(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_FLATTOP: - FLAC__window_flattop(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_GAUSS: - FLAC__window_gauss(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.gauss.stddev); - break; - case FLAC__APODIZATION_HAMMING: - FLAC__window_hamming(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_HANN: - FLAC__window_hann(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_KAISER_BESSEL: - FLAC__window_kaiser_bessel(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_NUTTALL: - FLAC__window_nuttall(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_RECTANGLE: - FLAC__window_rectangle(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_TRIANGLE: - FLAC__window_triangle(encoder->private_->window[i], new_blocksize); - break; - case FLAC__APODIZATION_TUKEY: - FLAC__window_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.tukey.p); - break; - case FLAC__APODIZATION_WELCH: - FLAC__window_welch(encoder->private_->window[i], new_blocksize); - break; - default: - FLAC__ASSERT(0); - /* double protection */ - FLAC__window_hann(encoder->private_->window[i], new_blocksize); - break; - } - } - } -#endif - - if(ok) - encoder->private_->input_capacity = new_blocksize; - else - encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; - - return ok; -} - -FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block) -{ - const FLAC__byte *buffer; - size_t bytes; - - FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(encoder->private_->frame)); - - if(!FLAC__bitwriter_get_buffer(encoder->private_->frame, &buffer, &bytes)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; - return false; - } - - 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__bitwriter_release_buffer(encoder->private_->frame); - FLAC__bitwriter_clear(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(write_frame_(encoder, buffer, bytes, samples, is_last_block) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { - FLAC__bitwriter_release_buffer(encoder->private_->frame); - FLAC__bitwriter_clear(encoder->private_->frame); - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return false; - } - - FLAC__bitwriter_release_buffer(encoder->private_->frame); - FLAC__bitwriter_clear(encoder->private_->frame); - - if(samples > 0) { - encoder->private_->streaminfo.data.stream_info.min_framesize = min(bytes, encoder->private_->streaminfo.data.stream_info.min_framesize); - encoder->private_->streaminfo.data.stream_info.max_framesize = max(bytes, encoder->private_->streaminfo.data.stream_info.max_framesize); - } - - return true; -} - -FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block) -{ - FLAC__StreamEncoderWriteStatus status; - FLAC__uint64 output_position = 0; - - /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */ - if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &output_position, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR) { - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_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); - 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++; - } - } - } - -#if FLAC__HAS_OGG - if(encoder->private_->is_ogg) { - status = FLAC__ogg_encoder_aspect_write_callback_wrapper( - &encoder->protected_->ogg_encoder_aspect, - buffer, - bytes, - samples, - encoder->private_->current_frame_number, - is_last_block, - (FLAC__OggEncoderAspectWriteCallbackProxy)encoder->private_->write_callback, - encoder, - encoder->private_->client_data - ); - } - else -#endif - status = encoder->private_->write_callback(encoder, buffer, bytes, samples, encoder->private_->current_frame_number, encoder->private_->client_data); - - if(status == FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { - encoder->private_->bytes_written += bytes; - 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. - */ - encoder->private_->frames_written = max(encoder->private_->frames_written, encoder->private_->current_frame_number+1); - } - else - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; - - return status; -} - -/* Gets called when the encoding process has finished so that we can update the STREAMINFO and SEEKTABLE blocks. */ -void update_metadata_(const FLAC__StreamEncoder *encoder) -{ - FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; - const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo; - 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__StreamEncoderSeekStatus seek_status; - - FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO); - - /* 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((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + md5_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) { - if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR) - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_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__STREAM_ENCODER_CLIENT_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((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + total_samples_byte_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) { - if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR) - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_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__STREAM_ENCODER_CLIENT_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((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + min_framesize_offset, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) { - if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR) - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_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__STREAM_ENCODER_CLIENT_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((seek_status = encoder->private_->seek_callback(encoder, encoder->protected_->seektable_offset + FLAC__STREAM_METADATA_HEADER_LENGTH, encoder->private_->client_data)) != FLAC__STREAM_ENCODER_SEEK_STATUS_OK) { - if(seek_status == FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR) - encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_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__STREAM_ENCODER_CLIENT_ERROR; - return; - } - } - } -} - -#if FLAC__HAS_OGG -/* Gets called when the encoding process has finished so that we can update the STREAMINFO and SEEKTABLE blocks. */ -void update_ogg_metadata_(FLAC__StreamEncoder *encoder) -{ - /* the # of bytes in the 1st packet that precede the STREAMINFO */ - static const unsigned FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH = - FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH + - FLAC__OGG_MAPPING_MAGIC_LENGTH + - FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH + - FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH + - FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH + - FLAC__STREAM_SYNC_LENGTH - ; - FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; - const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo; - 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); - FLAC__ASSERT(0 != encoder->private_->seek_callback); - - /* Pre-check that client supports seeking, since we don't want the - * ogg_helper code to ever have to deal with this condition. - */ - if(encoder->private_->seek_callback(encoder, 0, encoder->private_->client_data) == FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED) - return; - - /* 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 */ - } - - /* - * Write MD5 signature - */ - { - const unsigned md5_offset = - FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH + - 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 = FLAC__STREAM_ENCODER_OGG_ERROR; - simple_ogg_page__clear(&page); - return; - } - memcpy(page.body + md5_offset, metadata->data.stream_info.md5sum, 16); - } - - /* - * Write total samples - */ - { - const unsigned total_samples_byte_offset = - FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH + - 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 = FLAC__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); - } - - /* - * Write min/max framesize - */ - { - const unsigned min_framesize_offset = - FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH + - 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 = FLAC__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 = FLAC__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; - 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); - } -} -#endif - -FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block, FLAC__bool is_last_block) -{ - FLAC__uint16 crc; - FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); - - /* - * Accumulate raw signal to the MD5 signature - */ - if(encoder->protected_->do_md5 && !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_fractional_block)) { - /* 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__bitwriter_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__bitwriter_is_byte_aligned(encoder->private_->frame)); - if( - !FLAC__bitwriter_get_write_crc16(encoder->private_->frame, &crc) || - !FLAC__bitwriter_write_raw_uint32(encoder->private_->frame, crc, FLAC__FRAME_FOOTER_CRC_LEN) - ) { - encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; - return false; - } - - /* - * Write it - */ - if(!write_bitbuffer_(encoder, encoder->protected_->blocksize, is_last_block)) { - /* 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_->streaminfo.data.stream_info.total_samples += (FLAC__uint64)encoder->protected_->blocksize; - - return true; -} - -FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block) -{ - 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; - - /* - * Calculate the min,max Rice partition orders - */ - if(is_fractional_block) { - 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); - - /* - * Setup the frame - */ - 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, - &frame_header, - encoder->private_->subframe_bps[channel], - encoder->private_->integer_signal[channel], - 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, - &frame_header, - encoder->private_->subframe_bps_mid_side[channel], - encoder->private_->integer_signal_mid_side[channel], - 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; - int ca; - - FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT == 0); - FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE == 1); - FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE == 2); - FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_MID_SIDE == 3); - 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]; - - channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT; - min_bits = bits[channel_assignment]; - for(ca = 1; ca <= 3; ca++) { - if(bits[ca] < min_bits) { - min_bits = bits[ca]; - channel_assignment = (FLAC__ChannelAssignment)ca; - } - } - } - - frame_header.channel_assignment = channel_assignment; - - if(!FLAC__frame_add_header(&frame_header, 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.blocksize, left_bps , left_subframe , encoder->private_->frame)) - return false; - if(!add_subframe_(encoder, frame_header.blocksize, right_bps, right_subframe, encoder->private_->frame)) - return false; - } - else { - if(!FLAC__frame_add_header(&frame_header, 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.blocksize, 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, - const FLAC__FrameHeader *frame_header, - unsigned subframe_bps, - const FLAC__int32 integer_signal[], - 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; - /* only use RICE2 partitions if stream bps > 16 */ - const unsigned rice_parameter_limit = FLAC__stream_encoder_get_bits_per_sample(encoder) > 16? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; - - FLAC__ASSERT(frame_header->blocksize > 0); - - /* 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_(encoder, 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_(encoder, integer_signal[0], frame_header->blocksize, 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; - } - if(max_fixed_order >= frame_header->blocksize) - max_fixed_order = frame_header->blocksize - 1; - 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 - rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */ - if(rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @0\n", rice_parameter, rice_parameter_limit - 1); -#endif - rice_parameter = rice_parameter_limit - 1; - } - _candidate_bits = - evaluate_fixed_subframe_( - encoder, - integer_signal, - residual[!_best_subframe], - encoder->private_->abs_residual_partition_sums, - encoder->private_->raw_bits_per_partition, - frame_header->blocksize, - subframe_bps, - fixed_order, - rice_parameter, - rice_parameter_limit, - min_partition_order, - max_partition_order, - 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) { - unsigned a; - for (a = 0; a < encoder->protected_->num_apodizations; a++) { - FLAC__lpc_window_data(integer_signal, encoder->private_->window[a], encoder->private_->windowed_signal, frame_header->blocksize); - encoder->private_->local_lpc_compute_autocorrelation(encoder->private_->windowed_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 { - const unsigned guess_lpc_order = - FLAC__lpc_compute_best_order( - lpc_error, - max_lpc_order, - frame_header->blocksize, - subframe_bps + ( - encoder->protected_->do_qlp_coeff_prec_search? - FLAC__MIN_QLP_COEFF_PRECISION : /* have to guess; use the min possible size to avoid accidentally favoring lower orders */ - encoder->protected_->qlp_coeff_precision - ) - ); - min_lpc_order = max_lpc_order = guess_lpc_order; - } - if(max_lpc_order >= frame_header->blocksize) - max_lpc_order = frame_header->blocksize - 1; - 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 */ - rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */ - if(rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @1\n", rice_parameter, rice_parameter_limit - 1); -#endif - rice_parameter = rice_parameter_limit - 1; - } - if(encoder->protected_->do_qlp_coeff_prec_search) { - min_qlp_coeff_precision = FLAC__MIN_QLP_COEFF_PRECISION; - /* try to ensure a 32-bit datapath throughout for 16bps(+1bps for side channel) or less */ - if(subframe_bps <= 17) { - max_qlp_coeff_precision = min(32 - subframe_bps - lpc_order, FLAC__MAX_QLP_COEFF_PRECISION); - max_qlp_coeff_precision = max(max_qlp_coeff_precision, min_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_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, - rice_parameter_limit, - min_partition_order, - max_partition_order, - 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_(encoder, 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, - unsigned blocksize, - unsigned subframe_bps, - const FLAC__Subframe *subframe, - FLAC__BitWriter *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_FRAMING_ERROR; - return false; - } - break; - case FLAC__SUBFRAME_TYPE_FIXED: - if(!FLAC__subframe_add_fixed(&(subframe->data.fixed), blocksize - subframe->data.fixed.order, subframe_bps, subframe->wasted_bits, frame)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; - return false; - } - break; - case FLAC__SUBFRAME_TYPE_LPC: - if(!FLAC__subframe_add_lpc(&(subframe->data.lpc), blocksize - subframe->data.lpc.order, subframe_bps, subframe->wasted_bits, frame)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; - return false; - } - break; - case FLAC__SUBFRAME_TYPE_VERBATIM: - if(!FLAC__subframe_add_verbatim(&(subframe->data.verbatim), blocksize, subframe_bps, subframe->wasted_bits, frame)) { - encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; - return false; - } - break; - default: - FLAC__ASSERT(0); - } - - return true; -} - -#define SPOTCHECK_ESTIMATE 0 -#if SPOTCHECK_ESTIMATE -static void spotcheck_subframe_estimate_( - FLAC__StreamEncoder *encoder, - unsigned blocksize, - unsigned subframe_bps, - const FLAC__Subframe *subframe, - unsigned estimate -) -{ - FLAC__bool ret; - FLAC__BitWriter *frame = FLAC__bitwriter_new(); - if(frame == 0) { - fprintf(stderr, "EST: can't allocate frame\n"); - return; - } - if(!FLAC__bitwriter_init(frame)) { - fprintf(stderr, "EST: can't init frame\n"); - return; - } - ret = add_subframe_(encoder, blocksize, subframe_bps, subframe, frame); - FLAC__ASSERT(ret); - { - const unsigned actual = FLAC__bitwriter_get_input_bits_unconsumed(frame); - if(estimate != actual) - fprintf(stderr, "EST: bad, frame#%u sub#%%d type=%8s est=%u, actual=%u, delta=%d\n", encoder->private_->current_frame_number, FLAC__SubframeTypeString[subframe->type], estimate, actual, (int)actual-(int)estimate); - } - FLAC__bitwriter_delete(frame); -} -#endif - -unsigned evaluate_constant_subframe_( - FLAC__StreamEncoder *encoder, - const FLAC__int32 signal, - unsigned blocksize, - unsigned subframe_bps, - FLAC__Subframe *subframe -) -{ - unsigned estimate; - subframe->type = FLAC__SUBFRAME_TYPE_CONSTANT; - subframe->data.constant.value = signal; - - estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + subframe_bps; - -#if SPOTCHECK_ESTIMATE - spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate); -#else - (void)encoder, (void)blocksize; -#endif - - return estimate; -} - -unsigned evaluate_fixed_subframe_( - FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], - FLAC__int32 residual[], - FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned blocksize, - unsigned subframe_bps, - unsigned order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, - FLAC__Subframe *subframe, - FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents -) -{ - unsigned i, residual_bits, estimate; - 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_partition_sums, - raw_bits_per_partition, - residual_samples, - order, - rice_parameter, - rice_parameter_limit, - min_partition_order, - max_partition_order, - subframe_bps, - do_escape_coding, - rice_parameter_search_dist, - &subframe->data.fixed.entropy_coding_method - ); - - subframe->data.fixed.order = order; - for(i = 0; i < order; i++) - subframe->data.fixed.warmup[i] = signal[i]; - - estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (order * subframe_bps) + residual_bits; - -#if SPOTCHECK_ESTIMATE - spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate); -#endif - - return estimate; -} - -#ifndef FLAC__INTEGER_ONLY_LIBRARY -unsigned evaluate_lpc_subframe_( - FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], - FLAC__int32 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 rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - 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, estimate; - 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_partition_sums, - raw_bits_per_partition, - residual_samples, - order, - rice_parameter, - rice_parameter_limit, - min_partition_order, - max_partition_order, - subframe_bps, - do_escape_coding, - rice_parameter_search_dist, - &subframe->data.lpc.entropy_coding_method - ); - - 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]; - - estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN + FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN + (order * (qlp_coeff_precision + subframe_bps)) + residual_bits; - -#if SPOTCHECK_ESTIMATE - spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate); -#endif - - return estimate; -} -#endif - -unsigned evaluate_verbatim_subframe_( - FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], - unsigned blocksize, - unsigned subframe_bps, - FLAC__Subframe *subframe -) -{ - unsigned estimate; - - subframe->type = FLAC__SUBFRAME_TYPE_VERBATIM; - - subframe->data.verbatim.data = signal; - - estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (blocksize * subframe_bps); - -#if SPOTCHECK_ESTIMATE - spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate); -#else - (void)encoder; -#endif - - return estimate; -} - -unsigned find_best_partition_order_( - FLAC__StreamEncoderPrivate *private_, - const FLAC__int32 residual[], - FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned residual_samples, - unsigned predictor_order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps, - FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, - FLAC__EntropyCodingMethod *best_ecm -) -{ - unsigned residual_bits, best_residual_bits = 0; - unsigned best_parameters_index = 0; - unsigned best_partition_order = 0; - const unsigned blocksize = residual_samples + predictor_order; - - 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); - - precompute_partition_info_sums_(residual, abs_residual_partition_sums, residual_samples, predictor_order, min_partition_order, max_partition_order, bps); - - if(do_escape_coding) - precompute_partition_info_escapes_(residual, raw_bits_per_partition, residual_samples, predictor_order, min_partition_order, max_partition_order); - - { - int partition_order; - unsigned sum; - - for(partition_order = (int)max_partition_order, sum = 0; partition_order >= (int)min_partition_order; partition_order--) { - if(! - set_partitioned_rice_( -#ifdef EXACT_RICE_BITS_CALCULATION - residual, -#endif - abs_residual_partition_sums+sum, - raw_bits_per_partition+sum, - residual_samples, - predictor_order, - rice_parameter, - rice_parameter_limit, - rice_parameter_search_dist, - (unsigned)partition_order, - do_escape_coding, - &private_->partitioned_rice_contents_extra[!best_parameters_index], - &residual_bits - ) - ) - { - 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_partition_order = partition_order; - } - } - } - - best_ecm->data.partitioned_rice.order = best_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* prc = (FLAC__EntropyCodingMethod_PartitionedRiceContents*)best_ecm->data.partitioned_rice.contents; - unsigned partition; - - /* save best parameters and raw_bits */ - FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(prc, max(6, best_partition_order)); - memcpy(prc->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, sizeof(unsigned)*(1<<(best_partition_order))); - if(do_escape_coding) - memcpy(prc->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, sizeof(unsigned)*(1<<(best_partition_order))); - /* - * Now need to check if the type should be changed to - * FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 based on the - * size of the rice parameters. - */ - for(partition = 0; partition < (1u<parameters[partition] >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { - best_ecm->type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2; - break; - } - } - } - - return best_residual_bits; -} - -#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM -extern void precompute_partition_info_sums_32bit_asm_ia32_( - const FLAC__int32 residual[], - FLAC__uint64 abs_residual_partition_sums[], - unsigned blocksize, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order -); -#endif - -void precompute_partition_info_sums_( - const FLAC__int32 residual[], - FLAC__uint64 abs_residual_partition_sums[], - unsigned residual_samples, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps -) -{ - const unsigned default_partition_samples = (residual_samples + predictor_order) >> max_partition_order; - unsigned partitions = 1u << max_partition_order; - - FLAC__ASSERT(default_partition_samples > predictor_order); - -#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM - /* slightly pessimistic but still catches all common cases */ - /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */ - if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32) { - precompute_partition_info_sums_32bit_asm_ia32_(residual, abs_residual_partition_sums, residual_samples + predictor_order, predictor_order, min_partition_order, max_partition_order); - return; - } -#endif - - /* first do max_partition_order */ - { - unsigned partition, residual_sample, end = (unsigned)(-(int)predictor_order); - /* slightly pessimistic but still catches all common cases */ - /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */ - if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32) { - FLAC__uint32 abs_residual_partition_sum; - - for(partition = residual_sample = 0; partition < partitions; partition++) { - end += default_partition_samples; - abs_residual_partition_sum = 0; - for( ; residual_sample < end; residual_sample++) - abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */ - abs_residual_partition_sums[partition] = abs_residual_partition_sum; - } - } - else { /* have to pessimistically use 64 bits for accumulator */ - FLAC__uint64 abs_residual_partition_sum; - - for(partition = residual_sample = 0; partition < partitions; partition++) { - end += default_partition_samples; - abs_residual_partition_sum = 0; - for( ; residual_sample < end; residual_sample++) - abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */ - abs_residual_partition_sums[partition] = abs_residual_partition_sum; - } - } - } - - /* now merge partitions for lower orders */ - { - unsigned from_partition = 0, to_partition = partitions; - int partition_order; - for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) { - unsigned i; - partitions >>= 1; - for(i = 0; i < partitions; i++) { - abs_residual_partition_sums[to_partition++] = - abs_residual_partition_sums[from_partition ] + - abs_residual_partition_sums[from_partition+1]; - from_partition += 2; - } - } - } -} - -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; - FLAC__uint32 rmax; - 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; - rmax = 0; - for(partition_sample = 0; partition_sample < partition_samples; partition_sample++) { - r = residual[residual_sample++]; - /* OPT: maybe faster: rmax |= r ^ (r>>31) */ - if(r < 0) - rmax |= ~r; - else - rmax |= r; - } - /* now we know all residual values are in the range [-rmax-1,rmax] */ - raw_bits_per_partition[partition] = rmax? FLAC__bitmath_ilog2(rmax) + 2 : 1; - } - to_partition = partitions; - break; /*@@@ yuck, should remove the 'for' loop instead */ - } - - /* 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 EXACT_RICE_BITS_CALCULATION -static FLaC__INLINE unsigned count_rice_bits_in_partition_( - const unsigned rice_parameter, - const unsigned partition_samples, - const FLAC__int32 *residual -) -{ - unsigned i, partition_bits = - FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */ - (1+rice_parameter) * partition_samples /* 1 for unary stop bit + rice_parameter for the binary portion */ - ; - for(i = 0; i < partition_samples; i++) - partition_bits += ( (FLAC__uint32)((residual[i]<<1)^(residual[i]>>31)) >> rice_parameter ); - return partition_bits; -} -#else -static FLaC__INLINE unsigned count_rice_bits_in_partition_( - const unsigned rice_parameter, - const unsigned partition_samples, - const FLAC__uint64 abs_residual_partition_sum -) -{ - return - FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */ - (1+rice_parameter) * partition_samples + /* 1 for unary stop bit + rice_parameter for the binary portion */ - ( - rice_parameter? - (unsigned)(abs_residual_partition_sum >> (rice_parameter-1)) /* rice_parameter-1 because the real coder sign-folds instead of using a sign bit */ - : (unsigned)(abs_residual_partition_sum << 1) /* can't shift by negative number, so reverse */ - ) - - (partition_samples >> 1) - /* -(partition_samples>>1) to subtract out extra contributions to the abs_residual_partition_sum. - * The actual number of bits used is closer to the sum(for all i in the partition) of abs(residual[i])>>(rice_parameter-1) - * By using the abs_residual_partition sum, we also add in bits in the LSBs that would normally be shifted out. - * So the subtraction term tries to guess how many extra bits were contributed. - * If the LSBs are randomly distributed, this should average to 0.5 extra bits per sample. - */ - ; -} -#endif - -FLAC__bool set_partitioned_rice_( -#ifdef EXACT_RICE_BITS_CALCULATION - const FLAC__int32 residual[], -#endif - 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_limit, - const unsigned rice_parameter_search_dist, - const unsigned partition_order, - const FLAC__bool search_for_escapes, - FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, - unsigned *bits -) -{ - unsigned rice_parameter, partition_bits; - unsigned best_partition_bits, best_rice_parameter = 0; - unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; - unsigned *parameters, *raw_bits; -#ifdef ENABLE_RICE_PARAMETER_SEARCH - unsigned min_rice_parameter, max_rice_parameter; -#else - (void)rice_parameter_search_dist; -#endif - - FLAC__ASSERT(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER); - FLAC__ASSERT(rice_parameter_limit <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_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) { - best_partition_bits = (unsigned)(-1); -#ifdef ENABLE_RICE_PARAMETER_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 >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @5\n", max_rice_parameter, rice_parameter_limit - 1); -#endif - max_rice_parameter = rice_parameter_limit - 1; - } - } - else - min_rice_parameter = max_rice_parameter = suggested_rice_parameter; - - for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { -#else - rice_parameter = suggested_rice_parameter; -#endif -#ifdef EXACT_RICE_BITS_CALCULATION - partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, residual); -#else - partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, abs_residual_partition_sums[0]); -#endif - if(partition_bits < best_partition_bits) { - best_rice_parameter = rice_parameter; - best_partition_bits = partition_bits; - } -#ifdef ENABLE_RICE_PARAMETER_SEARCH - } -#endif - if(search_for_escapes) { - partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[0] * residual_samples; - if(partition_bits <= best_partition_bits) { - raw_bits[0] = raw_bits_per_partition[0]; - best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */ - best_partition_bits = partition_bits; - } - else - raw_bits[0] = 0; - } - parameters[0] = best_rice_parameter; - bits_ += best_partition_bits; - } - else { - unsigned partition, residual_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]; - /* 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) - ; - if(rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @6\n", rice_parameter, rice_parameter_limit - 1); -#endif - rice_parameter = rice_parameter_limit - 1; - } - - best_partition_bits = (unsigned)(-1); -#ifdef ENABLE_RICE_PARAMETER_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 >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @7\n", max_rice_parameter, rice_parameter_limit - 1); -#endif - max_rice_parameter = rice_parameter_limit - 1; - } - } - else - min_rice_parameter = max_rice_parameter = rice_parameter; - - for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { -#endif -#ifdef EXACT_RICE_BITS_CALCULATION - partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, residual+residual_sample); -#else - partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, abs_residual_partition_sums[partition]); -#endif - if(partition_bits < best_partition_bits) { - best_rice_parameter = rice_parameter; - best_partition_bits = partition_bits; - } -#ifdef ENABLE_RICE_PARAMETER_SEARCH - } -#endif - if(search_for_escapes) { - partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[partition] * partition_samples; - if(partition_bits <= best_partition_bits) { - raw_bits[partition] = raw_bits_per_partition[partition]; - best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */ - best_partition_bits = partition_bits; - } - else - raw_bits[partition] = 0; - } - parameters[partition] = best_rice_parameter; - bits_ += best_partition_bits; - residual_sample += partition_samples; - } - } - - *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[], size_t *bytes, void *client_data) -{ - FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder*)client_data; - const size_t 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 = frame->header.channels; - const unsigned blocksize = frame->header.blocksize; - const unsigned bytes_per_block = sizeof(FLAC__int32) * blocksize; - - (void)decoder; - - 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 */ - encoder->private_->verify.input_fifo.tail -= blocksize; - FLAC__ASSERT(encoder->private_->verify.input_fifo.tail <= OVERREAD_); - 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 * sizeof(encoder->private_->verify.input_fifo.data[0][0])); - 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; -} - -FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - (void)client_data; - - *bytes = fread(buffer, 1, *bytes, encoder->private_->file); - if (*bytes == 0) { - if (feof(encoder->private_->file)) - return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM; - else if (ferror(encoder->private_->file)) - return FLAC__STREAM_ENCODER_READ_STATUS_ABORT; - } - return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE; -} - -FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) -{ - (void)client_data; - - if(fseeko(encoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0) - return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR; - else - return FLAC__STREAM_ENCODER_SEEK_STATUS_OK; -} - -FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) -{ - off_t offset; - - (void)client_data; - - offset = ftello(encoder->private_->file); - - if(offset < 0) { - return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR; - } - else { - *absolute_byte_offset = (FLAC__uint64)offset; - return FLAC__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 file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) -{ - (void)client_data, (void)current_frame; - - if(local__fwrite(buffer, sizeof(FLAC__byte), bytes, encoder->private_->file) == bytes) { - FLAC__bool call_it = 0 != encoder->private_->progress_callback && ( -#if FLAC__HAS_OGG - /* We would like to be able to use 'samples > 0' in the - * 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. - */ - encoder->private_->is_ogg? true : -#endif - samples > 0 - ); - if(call_it) { - /* NOTE: We have to add +bytes, +samples, and +1 to the stats - * because at this point in the callback chain, the stats - * have not been updated. Only after we return and control - * gets back to write_frame_() are the stats updated - */ - encoder->private_->progress_callback(encoder, encoder->private_->bytes_written+bytes, encoder->private_->samples_written+samples, encoder->private_->frames_written+(samples?1:0), encoder->private_->total_frames_estimate, encoder->private_->client_data); - } - return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; - } - else - return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; -} - -/* - * This will forcibly set stdout to binary mode (for OSes that require it) - */ -FILE *get_binary_stdout_(void) -{ - /* 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); -#elif defined __EMX__ - setmode(fileno(stdout), O_BINARY); -#endif - - return stdout; -} diff --git a/src/lib/dl/ext/flac/stream_encoder.h b/src/lib/dl/ext/flac/stream_encoder.h deleted file mode 100755 index dbbbb23e..00000000 --- a/src/lib/dl/ext/flac/stream_encoder.h +++ /dev/null @@ -1,1768 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 /* for FILE */ -#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 encoder layers provided by libFLAC. - * - * The stream encoder can be used to encode complete streams either to the - * client via callbacks, or directly to a file, depending on how it is - * initialized. When encoding via callbacks, the client provides a write - * callback which will be called whenever FLAC data is ready to be written. - * If the client also supplies a seek callback, the encoder will also - * automatically handle the writing back of metadata discovered while - * encoding, like stream info, seek points offsets, etc. When encoding to - * a file, the client needs only supply a filename or open \c FILE* and an - * optional progress callback for periodic notification of progress; the - * write and seek callbacks are supplied internally. For more info see the - * \link flac_stream_encoder stream encoder \endlink module. - */ - -/** \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 stream encoder can encode to native FLAC, and optionally Ogg FLAC - * (check FLAC_API_SUPPORTS_OGG_FLAC) streams and files. - * - * 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 using - * FLAC__stream_encoder_set_*() functions. At a minimum, the following - * functions should be called: - * - FLAC__stream_encoder_set_channels() - * - FLAC__stream_encoder_set_bits_per_sample() - * - FLAC__stream_encoder_set_sample_rate() - * - FLAC__stream_encoder_set_ogg_serial_number() (if encoding to Ogg FLAC) - * - FLAC__stream_encoder_set_total_samples_estimate() (if known) - * - If the application wants to control the compression level or set its own - * metadata, then the following should also be called: - * - FLAC__stream_encoder_set_compression_level() - * - FLAC__stream_encoder_set_verify() - * - FLAC__stream_encoder_set_metadata() - * - The rest of the set functions should only be called if the client needs - * exact control over how the audio is compressed; thorough understanding - * of the FLAC format is necessary to achieve good results. - * - The program initializes the instance to validate the settings and - * prepare for encoding using - * - FLAC__stream_encoder_init_stream() or FLAC__stream_encoder_init_FILE() - * or FLAC__stream_encoder_init_file() for native FLAC - * - FLAC__stream_encoder_init_ogg_stream() or FLAC__stream_encoder_init_ogg_FILE() - * or FLAC__stream_encoder_init_ogg_file() for Ogg FLAC - * - 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, - * update the metadata with the final encoding statistics if output - * seeking is possible, 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 client will create a new - * instance by calling FLAC__stream_encoder_new(), then set the necessary - * parameters with FLAC__stream_encoder_set_*(), and initialize it by - * calling one of the FLAC__stream_encoder_init_*() functions. - * - * 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_*() - * functions 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_INIT_STATUS_OK. Any parameters that are not set - * before FLAC__stream_encoder_init_*() will take on the defaults from - * the constructor. - * - * There are three initialization functions for native FLAC, one for - * setting up the encoder to encode FLAC data to the client via - * callbacks, and two for encoding directly to a file. - * - * For encoding via callbacks, use FLAC__stream_encoder_init_stream(). - * You must also supply a write callback which will be called anytime - * there is raw encoded data to write. If the client can seek the output - * it is best to also supply seek and tell callbacks, as this allows the - * encoder to go back after encoding is finished to write back - * information that was collected while encoding, like seek point offsets, - * frame sizes, etc. - * - * For encoding directly to a file, use FLAC__stream_encoder_init_FILE() - * or FLAC__stream_encoder_init_file(). Then you must only supply a - * filename or open \c FILE*; the encoder will handle all the callbacks - * internally. You may also supply a progress callback for periodic - * notification of the encoding progress. - * - * There are three similarly-named init functions for encoding to Ogg - * FLAC streams. Check \c FLAC_API_SUPPORTS_OGG_FLAC to find out if the - * library has been built with Ogg support. - * - * 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. Note that for Ogg FLAC - * encoding you will usually get at least twice the number of callbacks than - * with native FLAC, one for the Ogg page header and one for the page body. - * - * After initializing the instance, the client may feed audio data to the - * encoder in one of two ways: - * - * - Channel separate, through FLAC__stream_encoder_process() - The client - * 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, but each channel should have the same number of samples. - * - Channel interleaved, through - * FLAC__stream_encoder_process_interleaved() - The client 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. - * - * Note that for either process call, each sample in the buffers should be a - * signed integer, right-justified to the resolution set by - * FLAC__stream_encoder_set_bits_per_sample(). For example, if the resolution - * is 16 bits per sample, the samples should all be in the range [-32768,32767]. - * - * When the client 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 - * If you are writing the FLAC data to a file via callbacks, 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. (If using FLAC__stream_encoder_init*_file() or - * FLAC__stream_encoder_init*_FILE(), the file is managed internally.) - * - * \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. - * - * \{ - */ - - -/** State values for a FLAC__StreamEncoder. - * - * The encoder's state can be obtained by calling FLAC__stream_encoder_get_state(). - * - * If the encoder gets into any other state besides \c FLAC__STREAM_ENCODER_OK - * or \c FLAC__STREAM_ENCODER_UNINITIALIZED, it becomes invalid for encoding and - * must be deleted with FLAC__stream_encoder_delete(). - */ -typedef enum { - - FLAC__STREAM_ENCODER_OK = 0, - /**< The encoder is in the normal OK state and samples can be processed. */ - - FLAC__STREAM_ENCODER_UNINITIALIZED, - /**< The encoder is in the uninitialized state; one of the - * FLAC__stream_encoder_init_*() functions must be called before samples - * can be processed. - */ - - FLAC__STREAM_ENCODER_OGG_ERROR, - /**< An error occurred in the underlying Ogg layer. */ - - 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_CLIENT_ERROR, - /**< One of the callbacks returned a fatal error. */ - - FLAC__STREAM_ENCODER_IO_ERROR, - /**< An I/O error occurred while opening/reading/writing a file. - * Check \c errno. - */ - - FLAC__STREAM_ENCODER_FRAMING_ERROR, - /**< An error occurred while writing the stream; usually, the - * write_callback returned an error. - */ - - FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR - /**< Memory allocation failed. */ - -} 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[]; - - -/** Possible return values for the FLAC__stream_encoder_init_*() functions. - */ -typedef enum { - - FLAC__STREAM_ENCODER_INIT_STATUS_OK = 0, - /**< Initialization was successful. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR, - /**< General failure to set up encoder; call FLAC__stream_encoder_get_state() for cause. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER, - /**< The library was not compiled with support for the given container - * format. - */ - - FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS, - /**< A required callback was not supplied. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS, - /**< The encoder has an invalid setting for number of channels. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_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_INIT_STATUS_INVALID_SAMPLE_RATE, - /**< The encoder has an invalid setting for the input sample rate. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE, - /**< The encoder has an invalid setting for the block size. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER, - /**< The encoder has an invalid setting for the maximum LPC order. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION, - /**< The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER, - /**< The specified block size is less than the maximum LPC order. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE, - /**< The encoder is bound to the Subset but other settings violate it. */ - - FLAC__STREAM_ENCODER_INIT_STATUS_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_INIT_STATUS_ALREADY_INITIALIZED - /**< FLAC__stream_encoder_init_*() was called when the encoder was - * already initialized, usually because - * FLAC__stream_encoder_finish() was not called. - */ - -} FLAC__StreamEncoderInitStatus; - -/** Maps a FLAC__StreamEncoderInitStatus to a C string. - * - * Using a FLAC__StreamEncoderInitStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamEncoderInitStatusString[]; - - -/** Return values for the FLAC__StreamEncoder read callback. - */ -typedef enum { - - FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE, - /**< The read was OK and decoding can continue. */ - - FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM, - /**< The read was attempted at the end of the stream. */ - - FLAC__STREAM_ENCODER_READ_STATUS_ABORT, - /**< An unrecoverable error occurred. */ - - FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED - /**< Client does not support reading back from the output. */ - -} FLAC__StreamEncoderReadStatus; - -/** Maps a FLAC__StreamEncoderReadStatus to a C string. - * - * Using a FLAC__StreamEncoderReadStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamEncoderReadStatusString[]; - - -/** 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[]; - - -/** Return values for the FLAC__StreamEncoder seek callback. - */ -typedef enum { - - FLAC__STREAM_ENCODER_SEEK_STATUS_OK, - /**< The seek was OK and encoding can continue. */ - - FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR, - /**< An unrecoverable error occurred. */ - - FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED - /**< Client does not support seeking. */ - -} FLAC__StreamEncoderSeekStatus; - -/** Maps a FLAC__StreamEncoderSeekStatus to a C string. - * - * Using a FLAC__StreamEncoderSeekStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[]; - - -/** Return values for the FLAC__StreamEncoder tell callback. - */ -typedef enum { - - FLAC__STREAM_ENCODER_TELL_STATUS_OK, - /**< The tell was OK and encoding can continue. */ - - FLAC__STREAM_ENCODER_TELL_STATUS_ERROR, - /**< An unrecoverable error occurred. */ - - FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED - /**< Client does not support seeking. */ - -} FLAC__StreamEncoderTellStatus; - -/** Maps a FLAC__StreamEncoderTellStatus to a C string. - * - * Using a FLAC__StreamEncoderTellStatus as the index to this array - * will give the string equivalent. The contents should not be modified. - */ -extern FLAC_API const char * const FLAC__StreamEncoderTellStatusString[]; - - -/*********************************************************************** - * - * 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 read callback. - * - * A function pointer matching this signature must be passed to - * FLAC__stream_encoder_init_ogg_stream() if seeking is supported. - * 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 - * FLAC__StreamEncoderReadStatus. - * - * Here is an example of a read callback for stdio streams: - * \code - * FLAC__StreamEncoderReadStatus read_cb(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data) - * { - * FILE *file = ((MyClientData*)client_data)->file; - * if(*bytes > 0) { - * *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file); - * if(ferror(file)) - * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT; - * else if(*bytes == 0) - * return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM; - * else - * return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE; - * } - * else - * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT; - * } - * \endcode - * - * \note In general, FLAC__StreamEncoder functions which change the - * state should not be called on the \a encoder while in the callback. - * - * \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 - * FLAC__stream_encoder_set_client_data(). - * \retval FLAC__StreamEncoderReadStatus - * The callee's return status. - */ -typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data); - -/** Signature for the write callback. - * - * A function pointer matching this signature must be passed to - * FLAC__stream_encoder_init*_stream(). 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 it indicates that the write - * callback is being called to write metadata. - * - * \note - * Unlike when writing to native FLAC, when writing to Ogg FLAC the - * write callback will be called twice when writing each audio - * frame; 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 In general, FLAC__StreamEncoder functions which change the - * state should not be called on the \a encoder while in the callback. - * - * \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 above. - * \param current_frame The number of the current frame being encoded. - * \param client_data The callee's client data set through - * FLAC__stream_encoder_init_*(). - * \retval FLAC__StreamEncoderWriteStatus - * The callee's return status. - */ -typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); - -/** Signature for the seek callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_encoder_init*_stream(). 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. - * - * Here is an example of a seek callback for stdio streams: - * \code - * FLAC__StreamEncoderSeekStatus seek_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) - * { - * FILE *file = ((MyClientData*)client_data)->file; - * if(file == stdin) - * return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED; - * else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0) - * return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR; - * else - * return FLAC__STREAM_ENCODER_SEEK_STATUS_OK; - * } - * \endcode - * - * \note In general, FLAC__StreamEncoder functions which change the - * state should not be called on the \a encoder while in the callback. - * - * \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__stream_encoder_init_*(). - * \retval FLAC__StreamEncoderSeekStatus - * The callee's return status. - */ -typedef FLAC__StreamEncoderSeekStatus (*FLAC__StreamEncoderSeekCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); - -/** Signature for the tell callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_encoder_init*_stream(). The supplied function will be called - * when the encoder needs to know the current position of the output stream. - * - * \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. - * - * Here is an example of a tell callback for stdio streams: - * \code - * FLAC__StreamEncoderTellStatus tell_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) - * { - * FILE *file = ((MyClientData*)client_data)->file; - * off_t pos; - * if(file == stdin) - * return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED; - * else if((pos = ftello(file)) < 0) - * return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR; - * else { - * *absolute_byte_offset = (FLAC__uint64)pos; - * return FLAC__STREAM_ENCODER_TELL_STATUS_OK; - * } - * } - * \endcode - * - * \note In general, FLAC__StreamEncoder functions which change the - * state should not be called on the \a encoder while in the callback. - * - * \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__stream_encoder_init_*(). - * \retval FLAC__StreamEncoderTellStatus - * The callee's return status. - */ -typedef FLAC__StreamEncoderTellStatus (*FLAC__StreamEncoderTellCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); - -/** Signature for the metadata callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_encoder_init*_stream(). The supplied function will be called - * once at the end of encoding with the populated STREAMINFO structure. This - * is so the client 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 In general, FLAC__StreamEncoder functions which change the - * state should not be called on the \a encoder while in the callback. - * - * \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_init_*(). - */ -typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data); - -/** Signature for the progress callback. - * - * A function pointer matching this signature may be passed to - * FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE(). - * 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__stream_encoder_set_total_samples_estimate(). - * - * \note In general, FLAC__StreamEncoder functions which change the - * state should not be called on the \a encoder while in the callback. - * - * \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__stream_encoder_init_*(). - */ -typedef void (*FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *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 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(void); - -/** 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 serial number for the FLAC stream to use in the Ogg container. - * - * \note - * This does not need to be set for native FLAC encoding. - * - * \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. - */ -FLAC_API FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncoder *encoder, long serial_number); - -/** 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 Subset flag. If \c true, - * the encoder will comply with the Subset 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 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 compression level - * - * The compression level is roughly proportional to the amount of effort - * the encoder expends to compress the file. A higher level usually - * means more computation but higher compression. The default level is - * suitable for most applications. - * - * Currently the levels range from \c 0 (fastest, least compression) to - * \c 8 (slowest, most compression). A value larger than \c 8 will be - * treated as \c 8. - * - * This function automatically calls the following other \c _set_ - * functions with appropriate values, so the client does not need to - * unless it specifically wants to override them: - * - FLAC__stream_encoder_set_do_mid_side_stereo() - * - FLAC__stream_encoder_set_loose_mid_side_stereo() - * - FLAC__stream_encoder_set_apodization() - * - FLAC__stream_encoder_set_max_lpc_order() - * - FLAC__stream_encoder_set_qlp_coeff_precision() - * - FLAC__stream_encoder_set_do_qlp_coeff_prec_search() - * - FLAC__stream_encoder_set_do_escape_coding() - * - FLAC__stream_encoder_set_do_exhaustive_model_search() - * - FLAC__stream_encoder_set_min_residual_partition_order() - * - FLAC__stream_encoder_set_max_residual_partition_order() - * - FLAC__stream_encoder_set_rice_parameter_search_dist() - * - * The actual values set for each level are: - * - * - * - * - * - * - * - * - * - * - * - * - *
level - * do mid-side stereo - * loose mid-side stereo - * apodization - * max lpc order - * qlp coeff precision - * qlp coeff prec search - * escape coding - * exhaustive model search - * min residual partition order - * max residual partition order - * rice parameter search dist - *
0 false false tukey(0.5) 0 0 false false false 0 3 0
1 true true tukey(0.5) 0 0 false false false 0 3 0
2 true false tukey(0.5) 0 0 false false false 0 3 0
3 false false tukey(0.5) 6 0 false false false 0 4 0
4 true true tukey(0.5) 8 0 false false false 0 4 0
5 true false tukey(0.5) 8 0 false false false 0 5 0
6 true false tukey(0.5) 8 0 false false false 0 6 0
7 true false tukey(0.5) 8 0 false false true 0 6 0
8 true false tukey(0.5) 12 0 false false true 0 6 0
- * - * \default \c 5 - * \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_compression_level(FLAC__StreamEncoder *encoder, unsigned value); - -/** Set the blocksize to use while encoding. - * - * The number of samples to use per frame. Use \c 0 to let the encoder - * estimate a blocksize; this is usually 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_blocksize(FLAC__StreamEncoder *encoder, unsigned value); - -/** Set to \c true to enable mid-side encoding on stereo input. The - * number of channels must be 2 for this to have any effect. 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. Set to \c false to use - * exhaustive searching. Setting this to \c true requires - * FLAC__stream_encoder_set_do_mid_side_stereo() to also be set to - * \c true in order to have any effect. - * - * \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); - -/** Sets the apodization function(s) the encoder will use when windowing - * audio data for LPC analysis. - * - * The \a specification is a plain ASCII string which specifies exactly - * which functions to use. There may be more than one (up to 32), - * separated by \c ';' characters. Some functions take one or more - * comma-separated arguments in parentheses. - * - * The available functions are \c bartlett, \c bartlett_hann, - * \c blackman, \c blackman_harris_4term_92db, \c connes, \c flattop, - * \c gauss(STDDEV), \c hamming, \c hann, \c kaiser_bessel, \c nuttall, - * \c rectangle, \c triangle, \c tukey(P), \c welch. - * - * For \c gauss(STDDEV), STDDEV specifies the standard deviation - * (0blocksize / (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, and - * in some cases update seek point offsets. Otherwise, the encoder will - * not modify or free the blocks. It is up to the caller to free the - * metadata blocks after encoding finishes. - * - * \note - * The encoder stores only copies of the pointers in the \a metadata array; - * the metadata blocks themselves must survive at least until after - * FLAC__stream_encoder_finish() returns. Do not 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, but the client has specified that it does not - * support seeking, then the SEEKTABLE will be written verbatim. However - * by itself this is not very useful as the client will not know the stream - * offsets for the seekpoints ahead of time. In order to get a proper - * seektable the client must support seeking. See next note. - * - * \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. If the - * client has specified that it supports seeking by providing a seek - * callback to FLAC__stream_encoder_init_stream() or both seek AND read - * callback to FLAC__stream_encoder_init_ogg_stream() (or by using - * FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE()), - * then while it is encoding the encoder will fill the stream offsets 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_*(). If the client does - * not support seeking, the SEEKTABLE will have inaccurate offsets which - * will slow down or remove the ability to seek in the FLAC stream. - * - * \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. - * - * \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. - * - * \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, the init 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, else \c true. - * \c false if the encoder is already initialized, or if - * \a num_blocks > 65535 if encoding to Ogg FLAC, else \c true. - */ -FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); - -/** 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 frame header. - * - * \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. Each sample should be a signed - * integer, right-justified to the resolution set by - * FLAC__stream_encoder_set_bits_per_sample(). For example, if the - * resolution is 16 bits per sample, the samples should all be in the - * range [-32768,32767]. - * - * For applications where channel order is important, channels must - * follow the order as described in the - * frame header. - * - * \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/src/lib/dl/ext/flac/stream_encoder_framing.c b/src/lib/dl/ext/flac/stream_encoder_framing.c deleted file mode 100755 index 15e3aaac..00000000 --- a/src/lib/dl/ext/flac/stream_encoder_framing.c +++ /dev/null @@ -1,553 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#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__BitWriter *bw, const FLAC__EntropyCodingMethod *method); -static FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order, const FLAC__bool is_extended); - -FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw) -{ - unsigned i, j; - const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING); - - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->is_last, FLAC__STREAM_METADATA_IS_LAST_LEN)) - return false; - - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.bits_per_sample-1, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.stream_info.md5sum, 16)) - return false; - break; - case FLAC__METADATA_TYPE_PADDING: - if(!FLAC__bitwriter_write_zeroes(bw, metadata->length * 8)) - return false; - break; - case FLAC__METADATA_TYPE_APPLICATION: - if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, 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__bitwriter_write_raw_uint64(bw, metadata->data.seek_table.points[i].sample_number, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.seek_table.points[i].stream_offset, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32_little_endian(bw, vendor_string_length)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)FLAC__VENDOR_STRING, vendor_string_length)) - return false; - if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.num_comments)) - return false; - for(i = 0; i < metadata->data.vorbis_comment.num_comments; i++) { - if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.comments[i].length)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, 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__bitwriter_write_byte_block(bw, (const FLAC__byte*)metadata->data.cue_sheet.media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN/8)) - return false; - if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.cue_sheet.lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.cue_sheet.is_cd? 1 : 0, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN)) - return false; - if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint64(bw, track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, track->number, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN)) - return false; - FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0); - if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN/8)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, track->type, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, track->pre_emphasis, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN)) - return false; - if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint64(bw, index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, index->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN)) - return false; - if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN)) - return false; - } - } - break; - case FLAC__METADATA_TYPE_PICTURE: - { - size_t len; - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.type, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN)) - return false; - len = strlen(metadata->data.picture.mime_type); - if(!FLAC__bitwriter_write_raw_uint32(bw, len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)metadata->data.picture.mime_type, len)) - return false; - len = strlen((const char *)metadata->data.picture.description); - if(!FLAC__bitwriter_write_raw_uint32(bw, len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.picture.description, len)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.width, FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.height, FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.depth, FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.colors, FLAC__STREAM_METADATA_PICTURE_COLORS_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.picture.data_length, FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.picture.data, metadata->data.picture.data_length)) - return false; - } - break; - default: - if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.unknown.data, metadata->length)) - return false; - break; - } - - FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw)); - return true; -} - -FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw) -{ - unsigned u, blocksize_hint, sample_rate_hint; - FLAC__byte crc; - - FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw)); - - if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__FRAME_HEADER_SYNC, FLAC__FRAME_HEADER_SYNC_LEN)) - return false; - - if(!FLAC__bitwriter_write_raw_uint32(bw, 0, FLAC__FRAME_HEADER_RESERVED_LEN)) - return false; - - if(!FLAC__bitwriter_write_raw_uint32(bw, (header->number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER)? 0 : 1, FLAC__FRAME_HEADER_BLOCKING_STRATEGY_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 - blocksize_hint = u = 7; - break; - } - if(!FLAC__bitwriter_write_raw_uint32(bw, 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 88200: u = 1; break; - case 176400: u = 2; break; - case 192000: u = 3; break; - 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 - u = 0; - break; - } - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN)) - return false; - - if(!FLAC__bitwriter_write_raw_uint32(bw, 0, FLAC__FRAME_HEADER_ZERO_PAD_LEN)) - return false; - - if(header->number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER) { - if(!FLAC__bitwriter_write_utf8_uint32(bw, header->number.frame_number)) - return false; - } - else { - if(!FLAC__bitwriter_write_utf8_uint64(bw, header->number.sample_number)) - return false; - } - - if(blocksize_hint) - if(!FLAC__bitwriter_write_raw_uint32(bw, header->blocksize-1, (blocksize_hint==6)? 8:16)) - return false; - - switch(sample_rate_hint) { - case 12: - if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate / 1000, 8)) - return false; - break; - case 13: - if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate, 16)) - return false; - break; - case 14: - if(!FLAC__bitwriter_write_raw_uint32(bw, header->sample_rate / 10, 16)) - return false; - break; - } - - /* write the CRC */ - if(!FLAC__bitwriter_get_write_crc8(bw, &crc)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, crc, 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__BitWriter *bw) -{ - FLAC__bool ok; - - ok = - FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_unary_unsigned(bw, wasted_bits-1) : true) && - FLAC__bitwriter_write_raw_int32(bw, 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__BitWriter *bw) -{ - unsigned i; - - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_unary_unsigned(bw, wasted_bits-1)) - return false; - - for(i = 0; i < subframe->order; i++) - if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps)) - return false; - - if(!add_entropy_coding_method_(bw, &subframe->entropy_coding_method)) - return false; - switch(subframe->entropy_coding_method.type) { - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: - if(!add_residual_partitioned_rice_( - bw, - 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, - /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 - )) - 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__BitWriter *bw) -{ - unsigned i; - - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_unary_unsigned(bw, wasted_bits-1)) - return false; - - for(i = 0; i < subframe->order; i++) - if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps)) - return false; - - if(!FLAC__bitwriter_write_raw_uint32(bw, subframe->qlp_coeff_precision-1, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN)) - return false; - if(!FLAC__bitwriter_write_raw_int32(bw, subframe->quantization_level, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN)) - return false; - for(i = 0; i < subframe->order; i++) - if(!FLAC__bitwriter_write_raw_int32(bw, subframe->qlp_coeff[i], subframe->qlp_coeff_precision)) - return false; - - if(!add_entropy_coding_method_(bw, &subframe->entropy_coding_method)) - return false; - switch(subframe->entropy_coding_method.type) { - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: - if(!add_residual_partitioned_rice_( - bw, - 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, - /*is_extended=*/subframe->entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 - )) - 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__BitWriter *bw) -{ - unsigned i; - const FLAC__int32 *signal = subframe->data; - - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__bitwriter_write_unary_unsigned(bw, wasted_bits-1)) - return false; - - for(i = 0; i < samples; i++) - if(!FLAC__bitwriter_write_raw_int32(bw, signal[i], subframe_bps)) - return false; - - return true; -} - -FLAC__bool add_entropy_coding_method_(FLAC__BitWriter *bw, const FLAC__EntropyCodingMethod *method) -{ - if(!FLAC__bitwriter_write_raw_uint32(bw, method->type, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN)) - return false; - switch(method->type) { - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: - case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: - if(!FLAC__bitwriter_write_raw_uint32(bw, 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__BitWriter *bw, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order, const FLAC__bool is_extended) -{ - const unsigned plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; - const unsigned pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; - - if(partition_order == 0) { - unsigned i; - - if(raw_bits[0] == 0) { - if(!FLAC__bitwriter_write_raw_uint32(bw, rice_parameters[0], plen)) - return false; - if(!FLAC__bitwriter_write_rice_signed_block(bw, residual, residual_samples, rice_parameters[0])) - return false; - } - else { - FLAC__ASSERT(rice_parameters[0] == 0); - if(!FLAC__bitwriter_write_raw_uint32(bw, pesc, plen)) - return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, raw_bits[0], FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN)) - return false; - for(i = 0; i < residual_samples; i++) { - if(!FLAC__bitwriter_write_raw_int32(bw, 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< -#endif - -#include "usage.h" -#include "FLAC/format.h" -#include -#include - -static void usage_header(FILE *out) -{ - fprintf(out, "==============================================================================\n"); - fprintf(out, "metaflac - Command-line FLAC metadata editor version %s\n", FLAC__VERSION_STRING); - fprintf(out, "Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n"); - fprintf(out, "\n"); - fprintf(out, "This program is free software; you can redistribute it and/or\n"); - fprintf(out, "modify it under the terms of the GNU General Public License\n"); - fprintf(out, "as published by the Free Software Foundation; either version 2\n"); - fprintf(out, "of the License, or (at your option) any later version.\n"); - fprintf(out, "\n"); - fprintf(out, "This program is distributed in the hope that it will be useful,\n"); - fprintf(out, "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); - fprintf(out, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); - fprintf(out, "GNU General Public License for more details.\n"); - fprintf(out, "\n"); - fprintf(out, "You should have received a copy of the GNU General Public License\n"); - fprintf(out, "along with this program; if not, write to the Free Software\n"); - fprintf(out, "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"); - fprintf(out, "==============================================================================\n"); -} - -static void usage_summary(FILE *out) -{ - fprintf(out, "Usage:\n"); - fprintf(out, " metaflac [options] [operations] FLACfile [FLACfile ...]\n"); - fprintf(out, "\n"); - fprintf(out, "Use metaflac to list, add, remove, or edit metadata in one or more FLAC files.\n"); - fprintf(out, "You may perform one major operation, or many shorthand operations at a time.\n"); - fprintf(out, "\n"); - fprintf(out, "Options:\n"); - fprintf(out, "--preserve-modtime Preserve the original modification time in spite of edits\n"); - fprintf(out, "--with-filename Prefix each output line with the FLAC file name\n"); - fprintf(out, " (the default if more than one FLAC file is specified)\n"); - fprintf(out, "--no-filename Do not prefix each output line with the FLAC file name\n"); - fprintf(out, " (the default if only one FLAC file is specified)\n"); - fprintf(out, "--no-utf8-convert Do not convert tags from UTF-8 to local charset,\n"); - fprintf(out, " or vice versa. This is useful for scripts, and setting\n"); - fprintf(out, " tags in situations where the locale is wrong.\n"); - fprintf(out, "--dont-use-padding By default metaflac tries to use padding where possible\n"); - fprintf(out, " to avoid rewriting the entire file if the metadata size\n"); - fprintf(out, " changes. Use this option to tell metaflac to not take\n"); - fprintf(out, " advantage of padding this way.\n"); -} - -int short_usage(const char *message, ...) -{ - va_list args; - - if(message) { - va_start(args, message); - - (void) vfprintf(stderr, message, args); - - va_end(args); - - } - usage_header(stderr); - fprintf(stderr, "\n"); - fprintf(stderr, "This is the short help; for full help use 'metaflac --help'\n"); - fprintf(stderr, "\n"); - usage_summary(stderr); - - return message? 1 : 0; -} - -int long_usage(const char *message, ...) -{ - FILE *out = (message? stderr : stdout); - va_list args; - - if(message) { - va_start(args, message); - - (void) vfprintf(stderr, message, args); - - va_end(args); - - } - usage_header(out); - fprintf(out, "\n"); - usage_summary(out); - fprintf(out, "\n"); - fprintf(out, "Shorthand operations:\n"); - fprintf(out, "--show-md5sum Show the MD5 signature from the STREAMINFO block.\n"); - fprintf(out, "--show-min-blocksize Show the minimum block size from the STREAMINFO block.\n"); - fprintf(out, "--show-max-blocksize Show the maximum block size from the STREAMINFO block.\n"); - fprintf(out, "--show-min-framesize Show the minimum frame size from the STREAMINFO block.\n"); - fprintf(out, "--show-max-framesize Show the maximum frame size from the STREAMINFO block.\n"); - fprintf(out, "--show-sample-rate Show the sample rate from the STREAMINFO block.\n"); - fprintf(out, "--show-channels Show the number of channels from the STREAMINFO block.\n"); - fprintf(out, "--show-bps Show the # of bits per sample from the STREAMINFO block.\n"); - fprintf(out, "--show-total-samples Show the total # of samples from the STREAMINFO block.\n"); - fprintf(out, "\n"); - fprintf(out, "--show-vendor-tag Show the vendor string from the VORBIS_COMMENT block.\n"); - fprintf(out, "--show-tag=NAME Show all tags where the the field name matches 'NAME'.\n"); - fprintf(out, "--remove-tag=NAME Remove all tags whose field name is 'NAME'.\n"); - fprintf(out, "--remove-first-tag=NAME Remove first tag whose field name is 'NAME'.\n"); - fprintf(out, "--remove-all-tags Remove all tags, leaving only the vendor string.\n"); - fprintf(out, "--set-tag=FIELD Add a tag. The FIELD must comply with the Vorbis comment\n"); - fprintf(out, " spec, of the form \"NAME=VALUE\". If there is currently\n"); - fprintf(out, " no tag block, one will be created.\n"); - fprintf(out, "--set-tag-from-file=FIELD Like --set-tag, except the VALUE is a filename\n"); - fprintf(out, " whose contents will be read verbatim to set the tag value.\n"); - fprintf(out, " Unless --no-utf8-convert is specified, the contents will\n"); - fprintf(out, " be converted to UTF-8 from the local charset. This can\n"); - fprintf(out, " be used to store a cuesheet in a tag (e.g.\n"); - fprintf(out, " --set-tag-from-file=\"CUESHEET=image.cue\"). Do not try\n"); - fprintf(out, " to store binary data in tag fields! Use APPLICATION\n"); - fprintf(out, " blocks for that.\n"); - fprintf(out, "--import-tags-from=FILE Import tags from a file. Use '-' for stdin. Each line\n"); - fprintf(out, " should be of the form NAME=VALUE. Multi-line comments\n"); - fprintf(out, " are currently not supported. Specify --remove-all-tags\n"); - fprintf(out, " and/or --no-utf8-convert before --import-tags-from if\n"); - fprintf(out, " necessary. If FILE is '-' (stdin), only one FLAC file\n"); - fprintf(out, " may be specified.\n"); - fprintf(out, "--export-tags-to=FILE Export tags to a file. Use '-' for stdout. Each line\n"); - fprintf(out, " will be of the form NAME=VALUE. Specify\n"); - fprintf(out, " --no-utf8-convert if necessary.\n"); - fprintf(out, "--import-cuesheet-from=FILE Import a cuesheet from a file. Use '-' for stdin.\n"); - fprintf(out, " Only one FLAC file may be specified. A seekpoint will be\n"); - fprintf(out, " added for each index point in the cuesheet to the\n"); - fprintf(out, " SEEKTABLE unless --no-cued-seekpoints is specified.\n"); - fprintf(out, "--export-cuesheet-to=FILE Export CUESHEET block to a cuesheet file, suitable\n"); - fprintf(out, " for use by CD authoring software. Use '-' for stdout.\n"); - fprintf(out, " Only one FLAC file may be specified on the command line.\n"); - fprintf(out, "--import-picture-from=FILENAME|SPECIFICATION Import a picture and store it in a\n"); - fprintf(out, " PICTURE block. Either a filename for the picture file or\n"); - fprintf(out, " a more complete specification form can be used. The\n"); - fprintf(out, " SPECIFICATION is a string whose parts are separated by |\n"); - fprintf(out, " characters. Some parts may be left empty to invoke\n"); - fprintf(out, " default values. FILENAME is just shorthand for\n"); - fprintf(out, " \"||||FILENAME\". The format of SPECIFICATION is:\n"); - fprintf(out, " [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE\n"); - fprintf(out, " TYPE is optional; it is a number from one of:\n"); - fprintf(out, " 0: Other\n"); - fprintf(out, " 1: 32x32 pixels 'file icon' (PNG only)\n"); - fprintf(out, " 2: Other file icon\n"); - fprintf(out, " 3: Cover (front)\n"); - fprintf(out, " 4: Cover (back)\n"); - fprintf(out, " 5: Leaflet page\n"); - fprintf(out, " 6: Media (e.g. label side of CD)\n"); - fprintf(out, " 7: Lead artist/lead performer/soloist\n"); - fprintf(out, " 8: Artist/performer\n"); - fprintf(out, " 9: Conductor\n"); - fprintf(out, " 10: Band/Orchestra\n"); - fprintf(out, " 11: Composer\n"); - fprintf(out, " 12: Lyricist/text writer\n"); - fprintf(out, " 13: Recording Location\n"); - fprintf(out, " 14: During recording\n"); - fprintf(out, " 15: During performance\n"); - fprintf(out, " 16: Movie/video screen capture\n"); - fprintf(out, " 17: A bright coloured fish\n"); - fprintf(out, " 18: Illustration\n"); - fprintf(out, " 19: Band/artist logotype\n"); - fprintf(out, " 20: Publisher/Studio logotype\n"); - fprintf(out, " The default is 3 (front cover). There may only be one picture each\n"); - fprintf(out, " of type 1 and 2 in a file.\n"); - fprintf(out, " MIME-TYPE is optional; if left blank, it will be detected from the\n"); - fprintf(out, " file. For best compatibility with players, use pictures with MIME\n"); - fprintf(out, " type image/jpeg or image/png. The MIME type can also be --> to\n"); - fprintf(out, " mean that FILE is actually a URL to an image, though this use is\n"); - fprintf(out, " discouraged.\n"); - fprintf(out, " DESCRIPTION is optional; the default is an empty string\n"); - fprintf(out, " The next part specfies the resolution and color information. If\n"); - fprintf(out, " the MIME-TYPE is image/jpeg, image/png, or image/gif, you can\n"); - fprintf(out, " usually leave this empty and they can be detected from the file.\n"); - fprintf(out, " Otherwise, you must specify the width in pixels, height in pixels,\n"); - fprintf(out, " and color depth in bits-per-pixel. If the image has indexed colors\n"); - fprintf(out, " you should also specify the number of colors used.\n"); - fprintf(out, " FILE is the path to the picture file to be imported, or the URL if\n"); - fprintf(out, " MIME type is -->\n"); - fprintf(out, "--export-picture-to=FILE Export PICTURE block to a file. Use '-' for stdout.\n"); - fprintf(out, " Only one FLAC file may be specified. The first PICTURE\n"); - fprintf(out, " block will be exported unless --export-picture-to is\n"); - fprintf(out, " preceded by a --block-number=# option to specify the exact\n"); - fprintf(out, " metadata block to extract. Note that the block number is\n"); - fprintf(out, " the one shown by --list.\n"); - fprintf(out, "--add-replay-gain Calculates the title and album gains/peaks of the given\n"); - fprintf(out, " FLAC files as if all the files were part of one album,\n"); - fprintf(out, " then stores them in the VORBIS_COMMENT block. The tags\n"); - fprintf(out, " are the same as those used by vorbisgain. Existing\n"); - fprintf(out, " ReplayGain tags will be replaced. If only one FLAC file\n"); - fprintf(out, " is given, the album and title gains will be the same.\n"); - fprintf(out, " Since this operation requires two passes, it is always\n"); - fprintf(out, " executed last, after all other operations have been\n"); - fprintf(out, " completed and written to disk. All FLAC files specified\n"); - fprintf(out, " must have the same resolution, sample rate, and number\n"); - fprintf(out, " of channels. The sample rate must be one of 8, 11.025,\n"); - fprintf(out, " 12, 16, 22.05, 24, 32, 44.1, or 48 kHz.\n"); - fprintf(out, "--remove-replay-gain Removes the ReplayGain tags.\n"); - fprintf(out, "--add-seekpoint={#|X|#x|#s} Add seek points to a SEEKTABLE block\n"); - fprintf(out, " # : a specific sample number for a seek point\n"); - fprintf(out, " X : a placeholder point (always goes at the end of the SEEKTABLE)\n"); - fprintf(out, " #x : # evenly spaced seekpoints, the first being at sample 0\n"); - fprintf(out, " #s : a seekpoint every # seconds; # does not have to be a whole number\n"); - fprintf(out, " If no SEEKTABLE block exists, one will be created. If\n"); - fprintf(out, " one already exists, points will be added to the existing\n"); - fprintf(out, " table, and any duplicates will be turned into placeholder\n"); - fprintf(out, " points. You may use many --add-seekpoint options; the\n"); - fprintf(out, " resulting SEEKTABLE will be the unique-ified union of\n"); - fprintf(out, " all such values. Example: --add-seekpoint=100x\n"); - fprintf(out, " --add-seekpoint=3.5s will add 100 evenly spaced\n"); - fprintf(out, " seekpoints and a seekpoint every 3.5 seconds.\n"); - fprintf(out, "--add-padding=length Add a padding block of the given length (in bytes).\n"); - fprintf(out, " The overall length of the new block will be 4 + length;\n"); - fprintf(out, " the extra 4 bytes is for the metadata block header.\n"); - fprintf(out, "\n"); - fprintf(out, "Major operations:\n"); - fprintf(out, "--version\n"); - fprintf(out, " Show the metaflac version number.\n"); - fprintf(out, "--list\n"); - fprintf(out, " List the contents of one or more metadata blocks to stdout. By default,\n"); - fprintf(out, " all metadata blocks are listed in text format. Use the following options\n"); - fprintf(out, " to change this behavior:\n"); - fprintf(out, "\n"); - fprintf(out, " --block-number=#[,#[...]]\n"); - fprintf(out, " An optional comma-separated list of block numbers to display. The first\n"); - fprintf(out, " block, the STREAMINFO block, is block 0.\n"); - fprintf(out, "\n"); - fprintf(out, " --block-type=type[,type[...]]\n"); - fprintf(out, " --except-block-type=type[,type[...]]\n"); - fprintf(out, " An optional comma-separated list of block types to be included or ignored\n"); - fprintf(out, " with this option. Use only one of --block-type or --except-block-type.\n"); - fprintf(out, " The valid block types are: STREAMINFO, PADDING, APPLICATION, SEEKTABLE,\n"); - fprintf(out, " VORBIS_COMMENT. You may narrow down the types of APPLICATION blocks\n"); - fprintf(out, " displayed as follows:\n"); - fprintf(out, " APPLICATION:abcd The APPLICATION block(s) whose textual repre-\n"); - fprintf(out, " sentation of the 4-byte ID is \"abcd\"\n"); - fprintf(out, " APPLICATION:0xXXXXXXXX The APPLICATION block(s) whose hexadecimal big-\n"); - fprintf(out, " endian representation of the 4-byte ID is\n"); - fprintf(out, " \"0xXXXXXXXX\". For the example \"abcd\" above the\n"); - fprintf(out, " hexadecimal equivalalent is 0x61626364\n"); - fprintf(out, "\n"); - fprintf(out, " NOTE: if both --block-number and --[except-]block-type are specified,\n"); - fprintf(out, " the result is the logical AND of both arguments.\n"); - fprintf(out, "\n"); -#if 0 - /*@@@ not implemented yet */ - fprintf(out, " --data-format=binary|text\n"); - fprintf(out, " By default a human-readable text representation of the data is displayed.\n"); - fprintf(out, " You may specify --data-format=binary to dump the raw binary form of each\n"); - fprintf(out, " metadata block. The output can be read in using a subsequent call to\n"); - fprintf(out, " "metaflac --append --from-file=..."\n"); - fprintf(out, "\n"); -#endif - fprintf(out, " --application-data-format=hexdump|text\n"); - fprintf(out, " If the application block you are displaying contains binary data but your\n"); - fprintf(out, " --data-format=text, you can display a hex dump of the application data\n"); - fprintf(out, " contents instead using --application-data-format=hexdump\n"); - fprintf(out, "\n"); -#if 0 - /*@@@ not implemented yet */ - fprintf(out, "--append\n"); - fprintf(out, " Insert a metadata block from a file. The input file must be in the same\n"); - fprintf(out, " format as generated with --list.\n"); - fprintf(out, "\n"); - fprintf(out, " --block-number=#\n"); - fprintf(out, " Specify the insertion point (defaults to last block). The new block will\n"); - fprintf(out, " be added after the given block number. This prevents the illegal insertion\n"); - fprintf(out, " of a block before the first STREAMINFO block. You may not --append another\n"); - fprintf(out, " STREAMINFO block.\n"); - fprintf(out, "\n"); - fprintf(out, " --from-file=filename\n"); - fprintf(out, " Mandatory 'option' to specify the input file containing the block contents.\n"); - fprintf(out, "\n"); - fprintf(out, " --data-format=binary|text\n"); - fprintf(out, " By default the block contents are assumed to be in binary format. You can\n"); - fprintf(out, " override this by specifying --data-format=text\n"); - fprintf(out, "\n"); -#endif - fprintf(out, "--remove\n"); - fprintf(out, " Remove one or more metadata blocks from the metadata. Unless\n"); - fprintf(out, " --dont-use-padding is specified, the blocks will be replaced with padding.\n"); - fprintf(out, " You may not remove the STREAMINFO block.\n"); - fprintf(out, "\n"); - fprintf(out, " --block-number=#[,#[...]]\n"); - fprintf(out, " --block-type=type[,type[...]]\n"); - fprintf(out, " --except-block-type=type[,type[...]]\n"); - fprintf(out, " See --list above for usage.\n"); - fprintf(out, "\n"); - fprintf(out, " NOTE: if both --block-number and --[except-]block-type are specified,\n"); - fprintf(out, " the result is the logical AND of both arguments.\n"); - fprintf(out, "\n"); - fprintf(out, "--remove-all\n"); - fprintf(out, " Remove all metadata blocks (except the STREAMINFO block) from the\n"); - fprintf(out, " metadata. Unless --dont-use-padding is specified, the blocks will be\n"); - fprintf(out, " replaced with padding.\n"); - fprintf(out, "\n"); - fprintf(out, "--merge-padding\n"); - fprintf(out, " Merge adjacent PADDING blocks into single blocks.\n"); - fprintf(out, "\n"); - fprintf(out, "--sort-padding\n"); - fprintf(out, " Move all PADDING blocks to the end of the metadata and merge them into a\n"); - fprintf(out, " single block.\n"); - - return message? 1 : 0; -} diff --git a/src/lib/dl/ext/flac/usage.h b/src/lib/dl/ext/flac/usage.h deleted file mode 100755 index 8ad091c7..00000000 --- a/src/lib/dl/ext/flac/usage.h +++ /dev/null @@ -1,25 +0,0 @@ -/* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 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 metaflac__usage_h -#define metaflac__usage_h - -int short_usage(const char *message, ...); -int long_usage(const char *message, ...); - -#endif diff --git a/src/lib/dl/ext/flac/utils.c b/src/lib/dl/ext/flac/utils.c deleted file mode 100755 index 685122ba..00000000 --- a/src/lib/dl/ext/flac/utils.c +++ /dev/null @@ -1,316 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include "utils.h" -#include "flac/assert.h" -#include "flac/metadata.h" -#include -#include -#include -#include -#include - -const char *CHANNEL_MASK_TAG = "WAVEFORMATEXTENSIBLE_CHANNEL_MASK"; - -int flac__utils_verbosity_ = 2; - -static FLAC__bool local__parse_uint64_(const char *s, FLAC__uint64 *value) -{ - FLAC__uint64 ret = 0; - char c; - - if(*s == '\0') - return false; - - while('\0' != (c = *s++)) - if(c >= '0' && c <= '9') - ret = ret * 10 + (c - '0'); - else - return false; - - *value = ret; - return true; -} - -static FLAC__bool local__parse_timecode_(const char *s, double *value) -{ - double ret; - unsigned i; - char c; - - /* parse [0-9][0-9]*: */ - c = *s++; - if(c >= '0' && c <= '9') - i = (c - '0'); - else - return false; - while(':' != (c = *s++)) { - if(c >= '0' && c <= '9') - i = i * 10 + (c - '0'); - else - return false; - } - ret = (double)i * 60.; - - /* parse [0-9]*[.,]?[0-9]* i.e. a sign-less rational number (. or , OK for fractional seconds, to support different locales) */ - if(strspn(s, "1234567890.,") != strlen(s)) - return false; - { - const char *p = strpbrk(s, ".,"); - if(p && 0 != strpbrk(++p, ".,")) - return false; - } - ret += atof(s); - - *value = ret; - return true; -} - -static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *track, unsigned *index) -{ - FLAC__bool got_track = false, got_index = false; - unsigned t = 0, i = 0; - char c; - - while(end? s < end : *s != '\0') { - c = *s++; - if(c >= '0' && c <= '9') { - t = t * 10 + (c - '0'); - got_track = true; - } - else if(c == '.') - break; - else - return false; - } - while(end? s < end : *s != '\0') { - c = *s++; - if(c >= '0' && c <= '9') { - i = i * 10 + (c - '0'); - got_index = true; - } - else - return false; - } - *track = t; - *index = i; - return got_track && got_index; -} - -/* - * this only works with sorted cuesheets (the spec strongly recommends but - * does not require sorted cuesheets). but if it's not sorted, picking a - * nearest cue point has no significance. - */ -static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, unsigned track, unsigned index, FLAC__uint64 total_samples, FLAC__bool look_forward) -{ - int t, i; - if(look_forward) { - for(t = 0; t < (int)cuesheet->num_tracks; t++) - for(i = 0; i < (int)cuesheet->tracks[t].num_indices; i++) - if(cuesheet->tracks[t].number > track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number >= index)) - return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset; - return total_samples; - } - else { - for(t = (int)cuesheet->num_tracks - 1; t >= 0; t--) - for(i = (int)cuesheet->tracks[t].num_indices - 1; i >= 0; i--) - if(cuesheet->tracks[t].number < track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number <= index)) - return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset; - return 0; - } -} - -void flac__utils_printf(FILE *stream, int level, const char *format, ...) -{ - if(flac__utils_verbosity_ >= level) { - va_list args; - - FLAC__ASSERT(0 != format); - - va_start(args, format); - - (void) vfprintf(stream, format, args); - - va_end(args); - } -} - -#ifdef FLAC__VALGRIND_TESTING -size_t flac__utils_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; -} -#endif - -FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__SkipUntilSpecification *spec) -{ - FLAC__uint64 val; - FLAC__bool is_negative = false; - - FLAC__ASSERT(0 != spec); - - spec->is_relative = false; - spec->value_is_samples = true; - spec->value.samples = 0; - - if(0 != s) { - if(s[0] == '-') { - is_negative = true; - spec->is_relative = true; - s++; - } - else if(s[0] == '+') { - spec->is_relative = true; - s++; - } - - if(local__parse_uint64_(s, &val)) { - spec->value_is_samples = true; - spec->value.samples = (FLAC__int64)val; - if(is_negative) - spec->value.samples = -(spec->value.samples); - } - else { - double d; - if(!local__parse_timecode_(s, &d)) - return false; - spec->value_is_samples = false; - spec->value.seconds = d; - if(is_negative) - spec->value.seconds = -(spec->value.seconds); - } - } - - return true; -} - -void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, unsigned sample_rate) -{ - FLAC__ASSERT(0 != spec); - if(!spec->value_is_samples) { - spec->value.samples = (FLAC__int64)(spec->value.seconds * (double)sample_rate); - spec->value_is_samples = true; - } -} - -FLAC__bool flac__utils_parse_cue_specification(const char *s, utils__CueSpecification *spec) -{ - const char *start = s, *end = 0; - - FLAC__ASSERT(0 != spec); - - spec->has_start_point = spec->has_end_point = false; - - s = strchr(s, '-'); - - if(0 != s) { - if(s == start) - start = 0; - end = s+1; - if(*end == '\0') - end = 0; - } - - if(start) { - if(!local__parse_cue_(start, s, &spec->start_track, &spec->start_index)) - return false; - spec->has_start_point = true; - } - - if(end) { - if(!local__parse_cue_(end, 0, &spec->end_track, &spec->end_index)) - return false; - spec->has_end_point = true; - } - - return true; -} - -void flac__utils_canonicalize_cue_specification(const utils__CueSpecification *cue_spec, const FLAC__StreamMetadata_CueSheet *cuesheet, FLAC__uint64 total_samples, utils__SkipUntilSpecification *skip_spec, utils__SkipUntilSpecification *until_spec) -{ - FLAC__ASSERT(0 != cue_spec); - FLAC__ASSERT(0 != cuesheet); - FLAC__ASSERT(0 != total_samples); - FLAC__ASSERT(0 != skip_spec); - FLAC__ASSERT(0 != until_spec); - - skip_spec->is_relative = false; - skip_spec->value_is_samples = true; - - until_spec->is_relative = false; - until_spec->value_is_samples = true; - - if(cue_spec->has_start_point) - skip_spec->value.samples = local__find_closest_cue_(cuesheet, cue_spec->start_track, cue_spec->start_index, total_samples, /*look_forward=*/false); - else - skip_spec->value.samples = 0; - - if(cue_spec->has_end_point) - until_spec->value.samples = local__find_closest_cue_(cuesheet, cue_spec->end_track, cue_spec->end_index, total_samples, /*look_forward=*/true); - else - until_spec->value.samples = total_samples; -} - -FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__uint32 channel_mask) -{ - FLAC__StreamMetadata_VorbisComment_Entry entry = { 0, 0 }; - char tag[128]; - - FLAC__ASSERT(object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(strlen(CHANNEL_MASK_TAG+1+2+16+1) <= sizeof(tag)); /* +1 for =, +2 for 0x, +16 for digits, +1 for NUL */ - entry.entry = (FLAC__byte*)tag; -#if defined _MSC_VER || defined __MINGW32__ - if((entry.length = _snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag)) -#else - if((entry.length = snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag)) -#endif - return false; - if(!FLAC__metadata_object_vorbiscomment_replace_comment(object, entry, /*all=*/true, /*copy=*/true)) - return false; - return true; -} - -FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object, FLAC__uint32 *channel_mask) -{ - int offset; - unsigned val; - char *p; - FLAC__ASSERT(object); - FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(0 > (offset = FLAC__metadata_object_vorbiscomment_find_entry_from(object, /*offset=*/0, CHANNEL_MASK_TAG))) - return false; - if(object->data.vorbis_comment.comments[offset].length < strlen(CHANNEL_MASK_TAG)+4) - return false; - if(0 == (p = strchr((const char *)object->data.vorbis_comment.comments[offset].entry, '='))) /* should never happen, but just in case */ - return false; - if(strncmp(p, "=0x", 3)) - return false; - if(sscanf(p+3, "%x", &val) != 1) - return false; - *channel_mask = val; - return true; -} diff --git a/src/lib/dl/ext/flac/utils.h b/src/lib/dl/ext/flac/utils.h deleted file mode 100755 index 80df6fcc..00000000 --- a/src/lib/dl/ext/flac/utils.h +++ /dev/null @@ -1,63 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 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__utils_h -#define flac__utils_h - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include "flac/ordinals.h" -#include "flac/format.h" /* for FLAC__StreamMetadata_CueSheet */ -#include /* for FILE */ - -typedef struct { - FLAC__bool is_relative; /* i.e. specification string started with + or - */ - FLAC__bool value_is_samples; - union { - double seconds; - FLAC__int64 samples; - } value; -} utils__SkipUntilSpecification; - -typedef struct { - FLAC__bool has_start_point, has_end_point; - unsigned start_track, start_index; - unsigned end_track, end_index; -} utils__CueSpecification; - -#ifdef FLAC__VALGRIND_TESTING -size_t flac__utils_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); -#else -#define flac__utils_fwrite fwrite -#endif - -extern int flac__utils_verbosity_; -void flac__utils_printf(FILE *stream, int level, const char *format, ...); - -FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__SkipUntilSpecification *spec); -void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, unsigned sample_rate); - -FLAC__bool flac__utils_parse_cue_specification(const char *s, utils__CueSpecification *spec); -void flac__utils_canonicalize_cue_specification(const utils__CueSpecification *cue_spec, const FLAC__StreamMetadata_CueSheet *cuesheet, FLAC__uint64 total_samples, utils__SkipUntilSpecification *skip_spec, utils__SkipUntilSpecification *until_spec); - -FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__uint32 channel_mask); -FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object, FLAC__uint32 *channel_mask); - -#endif diff --git a/src/lib/dl/ext/flac/vorbiscomment.c b/src/lib/dl/ext/flac/vorbiscomment.c deleted file mode 100755 index 92fdba1a..00000000 --- a/src/lib/dl/ext/flac/vorbiscomment.c +++ /dev/null @@ -1,228 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include "vorbiscomment.h" -#include "flac/assert.h" -#include "flac/metadata.h" -#include "share/grabbag.h" /* for grabbag__file_get_filesize() */ -#include "share/utf8.h" -#include -#include -#include -#include - - -/* - * This struct and the following 4 static functions are copied from - * ../metaflac/. Maybe someday there will be a convenience - * library for Vorbis comment parsing. - */ -typedef struct { - char *field; /* the whole field as passed on the command line, i.e. "NAME=VALUE" */ - char *field_name; - /* according to the vorbis spec, field values can contain \0 so simple C strings are not enough here */ - unsigned field_value_length; - char *field_value; - FLAC__bool field_value_from_file; /* true if field_value holds a filename for the value, false for plain value */ -} Argument_VcField; - -static void die(const char *message) -{ - FLAC__ASSERT(0 != message); - fprintf(stderr, "ERROR: %s\n", message); - exit(1); -} - -static char *local_strdup(const char *source) -{ - char *ret; - FLAC__ASSERT(0 != source); - if(0 == (ret = strdup(source))) - die("out of memory during strdup()"); - return ret; -} - -static FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, unsigned *length, const char **violation) -{ - static const char * const violations[] = { - "field name contains invalid character", - "field contains no '=' character" - }; - - char *p, *q, *s; - - if(0 != field) - *field = local_strdup(field_ref); - - s = local_strdup(field_ref); - - if(0 == (p = strchr(s, '='))) { - free(s); - *violation = violations[1]; - return false; - } - *p++ = '\0'; - - for(q = s; *q; q++) { - if(*q < 0x20 || *q > 0x7d || *q == 0x3d) { - free(s); - *violation = violations[0]; - return false; - } - } - - *name = local_strdup(s); - *value = local_strdup(p); - *length = strlen(p); - - free(s); - return true; -} - -/* slight modification: no 'filename' arg, and errors are passed back in 'violation' instead of printed to stderr */ -static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write, FLAC__bool raw, const char **violation) -{ - FLAC__StreamMetadata_VorbisComment_Entry entry; - char *converted; - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(0 != field); - FLAC__ASSERT(0 != needs_write); - - if(field->field_value_from_file) { - /* read the file into 'data' */ - FILE *f = 0; - char *data = 0; - const off_t size = grabbag__file_get_filesize(field->field_value); - if(size < 0) { - *violation = "can't open file for tag value"; - return false; - } - if(size >= 0x100000) { /* magic arbitrary limit, actual format limit is near 16MB */ - *violation = "file for tag value is too large"; - return false; - } - if(0 == (data = malloc(size+1))) - die("out of memory allocating tag value"); - data[size] = '\0'; - if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) { - free(data); - if(f) - fclose(f); - *violation = "error while reading file for tag value"; - return false; - } - fclose(f); - if(strlen(data) != (size_t)size) { - free(data); - *violation = "file for tag value has embedded NULs"; - return false; - } - - /* move 'data' into 'converted', converting to UTF-8 if necessary */ - converted = data; - - /* create and entry and append it */ - if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, field->field_name, converted)) { - free(converted); - *violation = "file for tag value is not valid UTF-8"; - return false; - } - free(converted); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) { - *violation = "memory allocation failure"; - return false; - } - - *needs_write = true; - return true; - } - else { - FLAC__bool needs_free = false; - entry.entry = (FLAC__byte *)field->field; - entry.length = strlen((const char *)entry.entry); - if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) { - if(needs_free) - free(converted); - /* - * our previous parsing has already established that the field - * name is OK, so it must be the field value - */ - *violation = "tag value for is not valid UTF-8"; - return false; - } - - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { - if(needs_free) - free(converted); - *violation = "memory allocation failure"; - return false; - } - - *needs_write = true; - if(needs_free) - free(converted); - return true; - } -} - -/* - * The rest of the code is novel - */ - -static void free_field(Argument_VcField *obj) -{ - if(0 != obj->field) - free(obj->field); - if(0 != obj->field_name) - free(obj->field_name); - if(0 != obj->field_value) - free(obj->field_value); -} - -FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, FLAC__bool raw, const char **violation) -{ - Argument_VcField parsed; - FLAC__bool dummy; - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(0 != comment); - - memset(&parsed, 0, sizeof(parsed)); - - parsed.field_value_from_file = value_from_file; - if(!parse_vorbis_comment_field(comment, &(parsed.field), &(parsed.field_name), &(parsed.field_value), &(parsed.field_value_length), violation)) { - free_field(&parsed); - return false; - } - - if(!set_vc_field(block, &parsed, &dummy, raw, violation)) { - free_field(&parsed); - return false; - } - else { - free_field(&parsed); - return true; - } -} diff --git a/src/lib/dl/ext/flac/vorbiscomment.h b/src/lib/dl/ext/flac/vorbiscomment.h deleted file mode 100755 index 518b2496..00000000 --- a/src/lib/dl/ext/flac/vorbiscomment.h +++ /dev/null @@ -1,26 +0,0 @@ -/* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 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__vorbiscomment_h -#define flac__vorbiscomment_h - -#include "flac/metadata.h" - -FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, FLAC__bool raw, const char **violation); - -#endif diff --git a/src/lib/dl/ext/flac/window.c b/src/lib/dl/ext/flac/window.c deleted file mode 100755 index 9ca2ac6a..00000000 --- a/src/lib/dl/ext/flac/window.c +++ /dev/null @@ -1,225 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2006,2007 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 HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include "flac/assert.h" -#include "flac/format.h" -#include "private/window.h" - -#ifndef FLAC__INTEGER_ONLY_LIBRARY - -#ifndef M_PI -/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */ -#define M_PI 3.14159265358979323846 -#endif - - -void FLAC__window_bartlett(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - if (L & 1) { - for (n = 0; n <= N/2; n++) - window[n] = 2.0f * n / (float)N; - for (; n <= N; n++) - window[n] = 2.0f - 2.0f * n / (float)N; - } - else { - for (n = 0; n <= L/2-1; n++) - window[n] = 2.0f * n / (float)N; - for (; n <= N; n++) - window[n] = 2.0f - 2.0f * (N-n) / (float)N; - } -} - -void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f))); -} - -void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N)); -} - -/* 4-term -92dB side-lobe */ -void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n <= N; n++) - window[n] = (FLAC__real)(0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N)); -} - -void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - const double N2 = (double)N / 2.; - FLAC__int32 n; - - for (n = 0; n <= N; n++) { - double k = ((double)n - N2) / N2; - k = 1.0f - k * k; - window[n] = (FLAC__real)(k * k); - } -} - -void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = (FLAC__real)(1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N)); -} - -void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev) -{ - const FLAC__int32 N = L - 1; - const double N2 = (double)N / 2.; - FLAC__int32 n; - - for (n = 0; n <= N; n++) { - const double k = ((double)n - N2) / (stddev * N2); - window[n] = (FLAC__real)exp(-0.5f * k * k); - } -} - -void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.54f - 0.46f * cos(2.0f * M_PI * n / N)); -} - -void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.5f - 0.5f * cos(2.0f * M_PI * n / N)); -} - -void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N)); -} - -void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.3635819f - 0.4891775f*cos(2.0f*M_PI*n/N) + 0.1365995f*cos(4.0f*M_PI*n/N) - 0.0106411f*cos(6.0f*M_PI*n/N)); -} - -void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L) -{ - FLAC__int32 n; - - for (n = 0; n < L; n++) - window[n] = 1.0f; -} - -void FLAC__window_triangle(FLAC__real *window, const FLAC__int32 L) -{ - FLAC__int32 n; - - if (L & 1) { - for (n = 1; n <= L+1/2; n++) - window[n-1] = 2.0f * n / ((float)L + 1.0f); - for (; n <= L; n++) - window[n-1] = - (float)(2 * (L - n + 1)) / ((float)L + 1.0f); - } - else { - for (n = 1; n <= L/2; n++) - window[n-1] = 2.0f * n / (float)L; - for (; n <= L; n++) - window[n-1] = ((float)(2 * (L - n)) + 1.0f) / (float)L; - } -} - -void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p) -{ - if (p <= 0.0) - FLAC__window_rectangle(window, L); - else if (p >= 1.0) - FLAC__window_hann(window, L); - else { - const FLAC__int32 Np = (FLAC__int32)(p / 2.0f * L) - 1; - FLAC__int32 n; - /* start with rectangle... */ - FLAC__window_rectangle(window, L); - /* ...replace ends with hann */ - if (Np > 0) { - for (n = 0; n <= Np; n++) { - window[n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * n / Np)); - window[L-Np-1+n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * (n+Np) / Np)); - } - } - } -} - -void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L) -{ - const FLAC__int32 N = L - 1; - const double N2 = (double)N / 2.; - FLAC__int32 n; - - for (n = 0; n <= N; n++) { - const double k = ((double)n - N2) / N2; - window[n] = (FLAC__real)(1.0f - k * k); - } -} - -#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/src/lib/dl/ext/lame/CLEAN.BAT b/src/lib/dl/ext/lame/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/lame/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/lame/MAKE.BAT b/src/lib/dl/ext/lame/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/lame/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/lame/amiga_mpega.c b/src/lib/dl/ext/lame/amiga_mpega.c deleted file mode 100755 index 12f144fc..00000000 --- a/src/lib/dl/ext/lame/amiga_mpega.c +++ /dev/null @@ -1,139 +0,0 @@ -/* MPGLIB replacement using mpega.library (AmigaOS) - * Written by Thomas Wenzel and Sigbjrn (CISC) Skj�et. - * - * Big thanks to St�hane Tavernard for mpega.library. - * - */ - -/* $Id: amiga_mpega.c,v 1.3 2005/11/01 13:01:56 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef AMIGA_MPEGA - -#define __USE_SYSBASE -#include "lame.h" -#include -#include - -/* We need a small workaround here so GCC doesn't fail upon redefinition. :P */ -#define FLOAT _FLOAT -#include -#include -#undef _FLOAT - -#ifndef __GNUC__ -#include -#endif - -struct Library *MPEGABase = NULL; -MPEGA_STREAM *mstream = NULL; -MPEGA_CTRL mctrl; - -static const int smpls[2][4] = { -/* Layer x I II III */ - {0, 384, 1152, 1152}, /* MPEG-1 */ - {0, 384, 1152, 576} /* MPEG-2(.5) */ -}; - - -#ifndef __GNUC__ -static int -break_cleanup(void) -{ - /* Dummy break function to make atexit() work. :P */ - return 1; -} -#endif - -static void -exit_cleanup(void) -{ - if (mstream) { - MPEGA_close(mstream); - mstream = NULL; - } - if (MPEGABase) { - CloseLibrary(MPEGABase); - MPEGABase = NULL; - } -} - - -int -lame_decode_initfile(const char *fullname, mp3data_struct * mp3data) -{ - mctrl.bs_access = NULL; - - mctrl.layer_1_2.mono.quality = 2; - mctrl.layer_1_2.stereo.quality = 2; - mctrl.layer_1_2.mono.freq_div = 1; - mctrl.layer_1_2.stereo.freq_div = 1; - mctrl.layer_1_2.mono.freq_max = 48000; - mctrl.layer_1_2.stereo.freq_max = 48000; - mctrl.layer_3.mono.quality = 2; - mctrl.layer_3.stereo.quality = 2; - mctrl.layer_3.mono.freq_div = 1; - mctrl.layer_3.stereo.freq_div = 1; - mctrl.layer_3.mono.freq_max = 48000; - mctrl.layer_3.stereo.freq_max = 48000; - mctrl.layer_1_2.force_mono = 0; - mctrl.layer_3.force_mono = 0; - - MPEGABase = OpenLibrary("mpega.library", 2); - if (!MPEGABase) { - error_printf("Unable to open mpega.library v2\n"); - exit(1); - } -#ifndef __GNUC__ - onbreak(break_cleanup); -#endif - atexit(exit_cleanup); - - mp3data->header_parsed = 0; - mstream = MPEGA_open((char *) fullname, &mctrl); - if (!mstream) - return (-1); - - mp3data->header_parsed = 1; - mp3data->stereo = mstream->dec_channels; - mp3data->samplerate = mstream->dec_frequency; - mp3data->bitrate = mstream->bitrate; - mp3data->nsamp = (float) mstream->ms_duration / 1000 * mstream->dec_frequency; - mp3data->mode = mstream->mode; - mp3data->mode_ext = 0; /* mpega.library doesn't supply this info! :( */ - mp3data->framesize = smpls[mstream->norm - 1][mstream->layer]; - - return 0; -} - -int -lame_decode_fromfile(FILE * fd, short pcm_l[], short pcm_r[], mp3data_struct * mp3data) -{ - int outsize = 0; - WORD *b[MPEGA_MAX_CHANNELS]; - - b[0] = pcm_l; - b[1] = pcm_r; - - mp3data->header_parsed = 0; - while ((outsize == 0) || (outsize == MPEGA_ERR_BADFRAME)) /* Skip bad frames */ - outsize = MPEGA_decode_frame(mstream, b); - - if (outsize < 0) - return (-1); - - mp3data->header_parsed = 1; - mp3data->stereo = mstream->dec_channels; - mp3data->samplerate = mstream->dec_frequency; - mp3data->bitrate = mstream->bitrate; - mp3data->mode = mstream->mode; - mp3data->mode_ext = 0; /* mpega.library doesn't supply this info! :( */ - mp3data->framesize = smpls[mstream->norm - 1][mstream->layer]; - - return outsize; -} - -#endif /* AMIGA_MPEGA */ diff --git a/src/lib/dl/ext/lame/bitstream.c b/src/lib/dl/ext/lame/bitstream.c deleted file mode 100755 index 8d1c830d..00000000 --- a/src/lib/dl/ext/lame/bitstream.c +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * MP3 bitstream Output interface for LAME - * - * Copyright (c) 1999-2000 Mark Taylor - * Copyright (c) 1999-2002 Takehiro Tominaga - * - * 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. - * - * $Id: bitstream.c,v 1.97 2011/05/07 16:05:17 rbrito Exp $ - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "tables.h" -#include "quantize_pvt.h" -#include "lame_global_flags.h" -#include "gain_analysis.h" -#include "vbrtag.h" -#include "bitstream.h" -#include "tables.h" - - - -/* unsigned int is at least this large: */ -/* we work with ints, so when doing bit manipulation, we limit - * ourselves to MAX_LENGTH-2 just to be on the safe side */ -#define MAX_LENGTH 32 - - - -#ifdef DEBUG -static int hogege; -#endif - - - -static int -calcFrameLength(SessionConfig_t const *const cfg, int kbps, int pad) -{ - return 8 * ((cfg->version + 1) * 72000 * kbps / cfg->samplerate_out + pad); -} - - -/*********************************************************************** - * compute bitsperframe and mean_bits for a layer III frame - **********************************************************************/ -int -getframebits(const lame_internal_flags * gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t const *const eov = &gfc->ov_enc; - int bit_rate; - - /* get bitrate in kbps [?] */ - if (eov->bitrate_index) - bit_rate = bitrate_table[cfg->version][eov->bitrate_index]; - else - bit_rate = cfg->avg_bitrate; - /*assert(bit_rate <= 550); */ - assert(8 <= bit_rate && bit_rate <= 640); - - /* main encoding routine toggles padding on and off */ - /* one Layer3 Slot consists of 8 bits */ - return calcFrameLength(cfg, bit_rate, eov->padding); -} - -int -get_max_frame_buffer_size_by_constraint(SessionConfig_t const * cfg, int constraint) -{ - int maxmp3buf = 0; - if (cfg->avg_bitrate > 320) { - /* in freeformat the buffer is constant */ - if (constraint == MDB_STRICT_ISO) { - maxmp3buf = calcFrameLength(cfg, cfg->avg_bitrate, 0); - } - else { - /* maximum allowed bits per granule are 7680 */ - maxmp3buf = 7680 * (cfg->version + 1); - } - } - else { - int max_kbps; - if (cfg->samplerate_out < 16000) { - max_kbps = bitrate_table[cfg->version][8]; /* default: allow 64 kbps (MPEG-2.5) */ - } - else { - max_kbps = bitrate_table[cfg->version][14]; - } - switch (constraint) - { - default: - case MDB_DEFAULT: - /* Bouvigne suggests this more lax interpretation of the ISO doc instead of using 8*960. */ - /* All mp3 decoders should have enough buffer to handle this value: size of a 320kbps 32kHz frame */ - maxmp3buf = 8 * 1440; - break; - case MDB_STRICT_ISO: - maxmp3buf = calcFrameLength(cfg, max_kbps, 0); - break; - case MDB_MAXIMUM: - maxmp3buf = 7680 * (cfg->version + 1); - break; - } - } - return maxmp3buf; -} - - -static void -putheader_bits(lame_internal_flags * gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - Bit_stream_struc *bs = &gfc->bs; -#ifdef DEBUG - hogege += cfg->sideinfo_len * 8; -#endif - memcpy(&bs->buf[bs->buf_byte_idx], esv->header[esv->w_ptr].buf, cfg->sideinfo_len); - bs->buf_byte_idx += cfg->sideinfo_len; - bs->totbit += cfg->sideinfo_len * 8; - esv->w_ptr = (esv->w_ptr + 1) & (MAX_HEADER_BUF - 1); -} - - - - -/*write j bits into the bit stream */ -inline static void -putbits2(lame_internal_flags * gfc, int val, int j) -{ - EncStateVar_t const *const esv = &gfc->sv_enc; - Bit_stream_struc *bs; - bs = &gfc->bs; - - assert(j < MAX_LENGTH - 2); - - while (j > 0) { - int k; - if (bs->buf_bit_idx == 0) { - bs->buf_bit_idx = 8; - bs->buf_byte_idx++; - assert(bs->buf_byte_idx < BUFFER_SIZE); - assert(esv->header[esv->w_ptr].write_timing >= bs->totbit); - if (esv->header[esv->w_ptr].write_timing == bs->totbit) { - putheader_bits(gfc); - } - bs->buf[bs->buf_byte_idx] = 0; - } - - k = Min(j, bs->buf_bit_idx); - j -= k; - - bs->buf_bit_idx -= k; - - assert(j < MAX_LENGTH); /* 32 too large on 32 bit machines */ - assert(bs->buf_bit_idx < MAX_LENGTH); - - bs->buf[bs->buf_byte_idx] |= ((val >> j) << bs->buf_bit_idx); - bs->totbit += k; - } -} - -/*write j bits into the bit stream, ignoring frame headers */ -inline static void -putbits_noheaders(lame_internal_flags * gfc, int val, int j) -{ - Bit_stream_struc *bs; - bs = &gfc->bs; - - assert(j < MAX_LENGTH - 2); - - while (j > 0) { - int k; - if (bs->buf_bit_idx == 0) { - bs->buf_bit_idx = 8; - bs->buf_byte_idx++; - assert(bs->buf_byte_idx < BUFFER_SIZE); - bs->buf[bs->buf_byte_idx] = 0; - } - - k = Min(j, bs->buf_bit_idx); - j -= k; - - bs->buf_bit_idx -= k; - - assert(j < MAX_LENGTH); /* 32 too large on 32 bit machines */ - assert(bs->buf_bit_idx < MAX_LENGTH); - - bs->buf[bs->buf_byte_idx] |= ((val >> j) << bs->buf_bit_idx); - bs->totbit += k; - } -} - - -/* - Some combinations of bitrate, Fs, and stereo make it impossible to stuff - out a frame using just main_data, due to the limited number of bits to - indicate main_data_length. In these situations, we put stuffing bits into - the ancillary data... -*/ - -inline static void -drain_into_ancillary(lame_internal_flags * gfc, int remainingBits) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - int i; - assert(remainingBits >= 0); - - if (remainingBits >= 8) { - putbits2(gfc, 0x4c, 8); - remainingBits -= 8; - } - if (remainingBits >= 8) { - putbits2(gfc, 0x41, 8); - remainingBits -= 8; - } - if (remainingBits >= 8) { - putbits2(gfc, 0x4d, 8); - remainingBits -= 8; - } - if (remainingBits >= 8) { - putbits2(gfc, 0x45, 8); - remainingBits -= 8; - } - - if (remainingBits >= 32) { - const char *const version = get_lame_short_version(); - if (remainingBits >= 32) - for (i = 0; i < (int) strlen(version) && remainingBits >= 8; ++i) { - remainingBits -= 8; - putbits2(gfc, version[i], 8); - } - } - - for (; remainingBits >= 1; remainingBits -= 1) { - putbits2(gfc, esv->ancillary_flag, 1); - esv->ancillary_flag ^= !cfg->disable_reservoir; - } - - assert(remainingBits == 0); - -} - -/*write N bits into the header */ -inline static void -writeheader(lame_internal_flags * gfc, int val, int j) -{ - EncStateVar_t *const esv = &gfc->sv_enc; - int ptr = esv->header[esv->h_ptr].ptr; - - while (j > 0) { - int const k = Min(j, 8 - (ptr & 7)); - j -= k; - assert(j < MAX_LENGTH); /* >> 32 too large for 32 bit machines */ - esv->header[esv->h_ptr].buf[ptr >> 3] - |= ((val >> j)) << (8 - (ptr & 7) - k); - ptr += k; - } - esv->header[esv->h_ptr].ptr = ptr; -} - - -static int -CRC_update(int value, int crc) -{ - int i; - value <<= 8; - for (i = 0; i < 8; i++) { - value <<= 1; - crc <<= 1; - - if (((crc ^ value) & 0x10000)) - crc ^= CRC16_POLYNOMIAL; - } - return crc; -} - - -void -CRC_writeheader(lame_internal_flags const *gfc, char *header) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int crc = 0xffff; /* (jo) init crc16 for error_protection */ - int i; - - crc = CRC_update(((unsigned char *) header)[2], crc); - crc = CRC_update(((unsigned char *) header)[3], crc); - for (i = 6; i < cfg->sideinfo_len; i++) { - crc = CRC_update(((unsigned char *) header)[i], crc); - } - - header[4] = crc >> 8; - header[5] = crc & 255; -} - -inline static void -encodeSideInfo2(lame_internal_flags * gfc, int bitsPerFrame) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t const *const eov = &gfc->ov_enc; - EncStateVar_t *const esv = &gfc->sv_enc; - III_side_info_t *l3_side; - int gr, ch; - - l3_side = &gfc->l3_side; - esv->header[esv->h_ptr].ptr = 0; - memset(esv->header[esv->h_ptr].buf, 0, cfg->sideinfo_len); - if (cfg->samplerate_out < 16000) - writeheader(gfc, 0xffe, 12); - else - writeheader(gfc, 0xfff, 12); - writeheader(gfc, (cfg->version), 1); - writeheader(gfc, 4 - 3, 2); - writeheader(gfc, (!cfg->error_protection), 1); - writeheader(gfc, (eov->bitrate_index), 4); - writeheader(gfc, (cfg->samplerate_index), 2); - writeheader(gfc, (eov->padding), 1); - writeheader(gfc, (cfg->extension), 1); - writeheader(gfc, (cfg->mode), 2); - writeheader(gfc, (eov->mode_ext), 2); - writeheader(gfc, (cfg->copyright), 1); - writeheader(gfc, (cfg->original), 1); - writeheader(gfc, (cfg->emphasis), 2); - if (cfg->error_protection) { - writeheader(gfc, 0, 16); /* dummy */ - } - - if (cfg->version == 1) { - /* MPEG1 */ - assert(l3_side->main_data_begin >= 0); - writeheader(gfc, (l3_side->main_data_begin), 9); - - if (cfg->channels_out == 2) - writeheader(gfc, l3_side->private_bits, 3); - else - writeheader(gfc, l3_side->private_bits, 5); - - for (ch = 0; ch < cfg->channels_out; ch++) { - int band; - for (band = 0; band < 4; band++) { - writeheader(gfc, l3_side->scfsi[ch][band], 1); - } - } - - for (gr = 0; gr < 2; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info *const gi = &l3_side->tt[gr][ch]; - writeheader(gfc, gi->part2_3_length + gi->part2_length, 12); - writeheader(gfc, gi->big_values / 2, 9); - writeheader(gfc, gi->global_gain, 8); - writeheader(gfc, gi->scalefac_compress, 4); - - if (gi->block_type != NORM_TYPE) { - writeheader(gfc, 1, 1); /* window_switching_flag */ - writeheader(gfc, gi->block_type, 2); - writeheader(gfc, gi->mixed_block_flag, 1); - - if (gi->table_select[0] == 14) - gi->table_select[0] = 16; - writeheader(gfc, gi->table_select[0], 5); - if (gi->table_select[1] == 14) - gi->table_select[1] = 16; - writeheader(gfc, gi->table_select[1], 5); - - writeheader(gfc, gi->subblock_gain[0], 3); - writeheader(gfc, gi->subblock_gain[1], 3); - writeheader(gfc, gi->subblock_gain[2], 3); - } - else { - writeheader(gfc, 0, 1); /* window_switching_flag */ - if (gi->table_select[0] == 14) - gi->table_select[0] = 16; - writeheader(gfc, gi->table_select[0], 5); - if (gi->table_select[1] == 14) - gi->table_select[1] = 16; - writeheader(gfc, gi->table_select[1], 5); - if (gi->table_select[2] == 14) - gi->table_select[2] = 16; - writeheader(gfc, gi->table_select[2], 5); - - assert(0 <= gi->region0_count && gi->region0_count < 16); - assert(0 <= gi->region1_count && gi->region1_count < 8); - writeheader(gfc, gi->region0_count, 4); - writeheader(gfc, gi->region1_count, 3); - } - writeheader(gfc, gi->preflag, 1); - writeheader(gfc, gi->scalefac_scale, 1); - writeheader(gfc, gi->count1table_select, 1); - } - } - } - else { - /* MPEG2 */ - assert(l3_side->main_data_begin >= 0); - writeheader(gfc, (l3_side->main_data_begin), 8); - writeheader(gfc, l3_side->private_bits, cfg->channels_out); - - gr = 0; - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info *const gi = &l3_side->tt[gr][ch]; - writeheader(gfc, gi->part2_3_length + gi->part2_length, 12); - writeheader(gfc, gi->big_values / 2, 9); - writeheader(gfc, gi->global_gain, 8); - writeheader(gfc, gi->scalefac_compress, 9); - - if (gi->block_type != NORM_TYPE) { - writeheader(gfc, 1, 1); /* window_switching_flag */ - writeheader(gfc, gi->block_type, 2); - writeheader(gfc, gi->mixed_block_flag, 1); - - if (gi->table_select[0] == 14) - gi->table_select[0] = 16; - writeheader(gfc, gi->table_select[0], 5); - if (gi->table_select[1] == 14) - gi->table_select[1] = 16; - writeheader(gfc, gi->table_select[1], 5); - - writeheader(gfc, gi->subblock_gain[0], 3); - writeheader(gfc, gi->subblock_gain[1], 3); - writeheader(gfc, gi->subblock_gain[2], 3); - } - else { - writeheader(gfc, 0, 1); /* window_switching_flag */ - if (gi->table_select[0] == 14) - gi->table_select[0] = 16; - writeheader(gfc, gi->table_select[0], 5); - if (gi->table_select[1] == 14) - gi->table_select[1] = 16; - writeheader(gfc, gi->table_select[1], 5); - if (gi->table_select[2] == 14) - gi->table_select[2] = 16; - writeheader(gfc, gi->table_select[2], 5); - - assert(0 <= gi->region0_count && gi->region0_count < 16); - assert(0 <= gi->region1_count && gi->region1_count < 8); - writeheader(gfc, gi->region0_count, 4); - writeheader(gfc, gi->region1_count, 3); - } - - writeheader(gfc, gi->scalefac_scale, 1); - writeheader(gfc, gi->count1table_select, 1); - } - } - - if (cfg->error_protection) { - /* (jo) error_protection: add crc16 information to header */ - CRC_writeheader(gfc, esv->header[esv->h_ptr].buf); - } - - { - int const old = esv->h_ptr; - assert(esv->header[old].ptr == cfg->sideinfo_len * 8); - - esv->h_ptr = (old + 1) & (MAX_HEADER_BUF - 1); - esv->header[esv->h_ptr].write_timing = esv->header[old].write_timing + bitsPerFrame; - - if (esv->h_ptr == esv->w_ptr) { - /* yikes! we are out of header buffer space */ - ERRORF(gfc, "Error: MAX_HEADER_BUF too small in bitstream.c \n"); - } - - } -} - - -inline static int -huffman_coder_count1(lame_internal_flags * gfc, gr_info const *gi) -{ - /* Write count1 area */ - struct huffcodetab const *const h = &ht[gi->count1table_select + 32]; - int i, bits = 0; -#ifdef DEBUG - int gegebo = gfc->bs.totbit; -#endif - - int const *ix = &gi->l3_enc[gi->big_values]; - FLOAT const *xr = &gi->xr[gi->big_values]; - assert(gi->count1table_select < 2); - - for (i = (gi->count1 - gi->big_values) / 4; i > 0; --i) { - int huffbits = 0; - int p = 0, v; - - v = ix[0]; - if (v) { - p += 8; - if (xr[0] < 0.0f) - huffbits++; - assert(v <= 1); - } - - v = ix[1]; - if (v) { - p += 4; - huffbits *= 2; - if (xr[1] < 0.0f) - huffbits++; - assert(v <= 1); - } - - v = ix[2]; - if (v) { - p += 2; - huffbits *= 2; - if (xr[2] < 0.0f) - huffbits++; - assert(v <= 1); - } - - v = ix[3]; - if (v) { - p++; - huffbits *= 2; - if (xr[3] < 0.0f) - huffbits++; - assert(v <= 1); - } - - ix += 4; - xr += 4; - putbits2(gfc, huffbits + h->table[p], h->hlen[p]); - bits += h->hlen[p]; - } -#ifdef DEBUG - DEBUGF(gfc, "count1: real: %ld counted:%d (bigv %d count1len %d)\n", - gfc->bs.totbit - gegebo, gi->count1bits, gi->big_values, gi->count1); -#endif - return bits; -} - - - -/* - Implements the pseudocode of page 98 of the IS - */ -inline static int -Huffmancode(lame_internal_flags * const gfc, const unsigned int tableindex, - int start, int end, gr_info const *gi) -{ - struct huffcodetab const *const h = &ht[tableindex]; - unsigned int const linbits = h->xlen; - int i, bits = 0; - - assert(tableindex < 32u); - if (!tableindex) - return bits; - - for (i = start; i < end; i += 2) { - int16_t cbits = 0; - uint16_t xbits = 0; - unsigned int xlen = h->xlen; - unsigned int ext = 0; - unsigned int x1 = gi->l3_enc[i]; - unsigned int x2 = gi->l3_enc[i + 1]; - - assert(gi->l3_enc[i] >= 0); - assert(gi->l3_enc[i+1] >= 0); - - if (x1 != 0u) { - if (gi->xr[i] < 0.0f) - ext++; - cbits--; - } - - if (tableindex > 15u) { - /* use ESC-words */ - if (x1 >= 15u) { - uint16_t const linbits_x1 = x1 - 15u; - assert(linbits_x1 <= h->linmax); - ext |= linbits_x1 << 1u; - xbits = linbits; - x1 = 15u; - } - - if (x2 >= 15u) { - uint16_t const linbits_x2 = x2 - 15u; - assert(linbits_x2 <= h->linmax); - ext <<= linbits; - ext |= linbits_x2; - xbits += linbits; - x2 = 15u; - } - xlen = 16; - } - - if (x2 != 0u) { - ext <<= 1; - if (gi->xr[i + 1] < 0.0f) - ext++; - cbits--; - } - - assert((x1 | x2) < 16u); - - x1 = x1 * xlen + x2; - xbits -= cbits; - cbits += h->hlen[x1]; - - assert(cbits <= MAX_LENGTH); - assert(xbits <= MAX_LENGTH); - - putbits2(gfc, h->table[x1], cbits); - putbits2(gfc, (int)ext, xbits); - bits += cbits + xbits; - } - return bits; -} - -/* - Note the discussion of huffmancodebits() on pages 28 - and 29 of the IS, as well as the definitions of the side - information on pages 26 and 27. - */ -static int -ShortHuffmancodebits(lame_internal_flags * gfc, gr_info const *gi) -{ - int bits; - int region1Start; - - region1Start = 3 * gfc->scalefac_band.s[3]; - if (region1Start > gi->big_values) - region1Start = gi->big_values; - - /* short blocks do not have a region2 */ - bits = Huffmancode(gfc, gi->table_select[0], 0, region1Start, gi); - bits += Huffmancode(gfc, gi->table_select[1], region1Start, gi->big_values, gi); - return bits; -} - -static int -LongHuffmancodebits(lame_internal_flags * gfc, gr_info const *gi) -{ - unsigned int i; - int bigvalues, bits; - int region1Start, region2Start; - - bigvalues = gi->big_values; - assert(0 <= bigvalues && bigvalues <= 576); - - assert(gi->region0_count >= -1); - assert(gi->region1_count >= -1); - i = gi->region0_count + 1; - assert((size_t) i < dimension_of(gfc->scalefac_band.l)); - region1Start = gfc->scalefac_band.l[i]; - i += gi->region1_count + 1; - assert((size_t) i < dimension_of(gfc->scalefac_band.l)); - region2Start = gfc->scalefac_band.l[i]; - - if (region1Start > bigvalues) - region1Start = bigvalues; - - if (region2Start > bigvalues) - region2Start = bigvalues; - - bits = Huffmancode(gfc, gi->table_select[0], 0, region1Start, gi); - bits += Huffmancode(gfc, gi->table_select[1], region1Start, region2Start, gi); - bits += Huffmancode(gfc, gi->table_select[2], region2Start, bigvalues, gi); - return bits; -} - -inline static int -writeMainData(lame_internal_flags * const gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - III_side_info_t const *const l3_side = &gfc->l3_side; - int gr, ch, sfb, data_bits, tot_bits = 0; - - if (cfg->version == 1) { - /* MPEG 1 */ - for (gr = 0; gr < 2; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info const *const gi = &l3_side->tt[gr][ch]; - int const slen1 = slen1_tab[gi->scalefac_compress]; - int const slen2 = slen2_tab[gi->scalefac_compress]; - data_bits = 0; -#ifdef DEBUG - hogege = gfc->bs.totbit; -#endif - for (sfb = 0; sfb < gi->sfbdivide; sfb++) { - if (gi->scalefac[sfb] == -1) - continue; /* scfsi is used */ - putbits2(gfc, gi->scalefac[sfb], slen1); - data_bits += slen1; - } - for (; sfb < gi->sfbmax; sfb++) { - if (gi->scalefac[sfb] == -1) - continue; /* scfsi is used */ - putbits2(gfc, gi->scalefac[sfb], slen2); - data_bits += slen2; - } - assert(data_bits == gi->part2_length); - - if (gi->block_type == SHORT_TYPE) { - data_bits += ShortHuffmancodebits(gfc, gi); - } - else { - data_bits += LongHuffmancodebits(gfc, gi); - } - data_bits += huffman_coder_count1(gfc, gi); -#ifdef DEBUG - DEBUGF(gfc, "<%ld> ", gfc->bs.totbit - hogege); -#endif - /* does bitcount in quantize.c agree with actual bit count? */ - assert(data_bits == gi->part2_3_length + gi->part2_length); - tot_bits += data_bits; - } /* for ch */ - } /* for gr */ - } - else { - /* MPEG 2 */ - gr = 0; - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info const *const gi = &l3_side->tt[gr][ch]; - int i, sfb_partition, scale_bits = 0; - assert(gi->sfb_partition_table); - data_bits = 0; -#ifdef DEBUG - hogege = gfc->bs.totbit; -#endif - sfb = 0; - sfb_partition = 0; - - if (gi->block_type == SHORT_TYPE) { - for (; sfb_partition < 4; sfb_partition++) { - int const sfbs = gi->sfb_partition_table[sfb_partition] / 3; - int const slen = gi->slen[sfb_partition]; - for (i = 0; i < sfbs; i++, sfb++) { - putbits2(gfc, Max(gi->scalefac[sfb * 3 + 0], 0), slen); - putbits2(gfc, Max(gi->scalefac[sfb * 3 + 1], 0), slen); - putbits2(gfc, Max(gi->scalefac[sfb * 3 + 2], 0), slen); - scale_bits += 3 * slen; - } - } - data_bits += ShortHuffmancodebits(gfc, gi); - } - else { - for (; sfb_partition < 4; sfb_partition++) { - int const sfbs = gi->sfb_partition_table[sfb_partition]; - int const slen = gi->slen[sfb_partition]; - for (i = 0; i < sfbs; i++, sfb++) { - putbits2(gfc, Max(gi->scalefac[sfb], 0), slen); - scale_bits += slen; - } - } - data_bits += LongHuffmancodebits(gfc, gi); - } - data_bits += huffman_coder_count1(gfc, gi); -#ifdef DEBUG - DEBUGF(gfc, "<%ld> ", gfc->bs.totbit - hogege); -#endif - /* does bitcount in quantize.c agree with actual bit count? */ - assert(data_bits == gi->part2_3_length); - assert(scale_bits == gi->part2_length); - tot_bits += scale_bits + data_bits; - } /* for ch */ - } /* for gf */ - return tot_bits; -} /* main_data */ - - - -/* compute the number of bits required to flush all mp3 frames - currently in the buffer. This should be the same as the - reservoir size. Only call this routine between frames - i.e. - only after all headers and data have been added to the buffer - by format_bitstream(). - - Also compute total_bits_output = - size of mp3 buffer (including frame headers which may not - have yet been send to the mp3 buffer) + - number of bits needed to flush all mp3 frames. - - total_bytes_output is the size of the mp3 output buffer if - lame_encode_flush_nogap() was called right now. - - */ -int -compute_flushbits(const lame_internal_flags * gfc, int *total_bytes_output) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t const *const esv = &gfc->sv_enc; - int flushbits, remaining_headers; - int bitsPerFrame; - int last_ptr, first_ptr; - first_ptr = esv->w_ptr; /* first header to add to bitstream */ - last_ptr = esv->h_ptr - 1; /* last header to add to bitstream */ - if (last_ptr == -1) - last_ptr = MAX_HEADER_BUF - 1; - - /* add this many bits to bitstream so we can flush all headers */ - flushbits = esv->header[last_ptr].write_timing - gfc->bs.totbit; - *total_bytes_output = flushbits; - - if (flushbits >= 0) { - /* if flushbits >= 0, some headers have not yet been written */ - /* reduce flushbits by the size of the headers */ - remaining_headers = 1 + last_ptr - first_ptr; - if (last_ptr < first_ptr) - remaining_headers = 1 + last_ptr - first_ptr + MAX_HEADER_BUF; - flushbits -= remaining_headers * 8 * cfg->sideinfo_len; - } - - - /* finally, add some bits so that the last frame is complete - * these bits are not necessary to decode the last frame, but - * some decoders will ignore last frame if these bits are missing - */ - bitsPerFrame = getframebits(gfc); - flushbits += bitsPerFrame; - *total_bytes_output += bitsPerFrame; - /* round up: */ - if (*total_bytes_output % 8) - *total_bytes_output = 1 + (*total_bytes_output / 8); - else - *total_bytes_output = (*total_bytes_output / 8); - *total_bytes_output += gfc->bs.buf_byte_idx + 1; - - - if (flushbits < 0) { -#if 0 - /* if flushbits < 0, this would mean that the buffer looks like: - * (data...) last_header (data...) (extra data that should not be here...) - */ - DEBUGF(gfc, "last header write_timing = %i \n", esv->header[last_ptr].write_timing); - DEBUGF(gfc, "first header write_timing = %i \n", esv->header[first_ptr].write_timing); - DEBUGF(gfc, "bs.totbit: %i \n", gfc->bs.totbit); - DEBUGF(gfc, "first_ptr, last_ptr %i %i \n", first_ptr, last_ptr); - DEBUGF(gfc, "remaining_headers = %i \n", remaining_headers); - DEBUGF(gfc, "bitsperframe: %i \n", bitsPerFrame); - DEBUGF(gfc, "sidelen: %i \n", cfg->sideinfo_len); -#endif - ERRORF(gfc, "strange error flushing buffer ... \n"); - } - return flushbits; -} - - -void -flush_bitstream(lame_internal_flags * gfc) -{ - EncStateVar_t *const esv = &gfc->sv_enc; - III_side_info_t *l3_side; - int nbytes; - int flushbits; - int last_ptr = esv->h_ptr - 1; /* last header to add to bitstream */ - if (last_ptr == -1) - last_ptr = MAX_HEADER_BUF - 1; - l3_side = &gfc->l3_side; - - - if ((flushbits = compute_flushbits(gfc, &nbytes)) < 0) - return; - drain_into_ancillary(gfc, flushbits); - - /* check that the 100% of the last frame has been written to bitstream */ - assert(esv->header[last_ptr].write_timing + getframebits(gfc) - == gfc->bs.totbit); - - /* we have padded out all frames with ancillary data, which is the - same as filling the bitreservoir with ancillary data, so : */ - esv->ResvSize = 0; - l3_side->main_data_begin = 0; -} - - - - -void -add_dummy_byte(lame_internal_flags * gfc, unsigned char val, unsigned int n) -{ - EncStateVar_t *const esv = &gfc->sv_enc; - int i; - - while (n-- > 0u) { - putbits_noheaders(gfc, val, 8); - - for (i = 0; i < MAX_HEADER_BUF; ++i) - esv->header[i].write_timing += 8; - } -} - - -/* - format_bitstream() - - This is called after a frame of audio has been quantized and coded. - It will write the encoded audio to the bitstream. Note that - from a layer3 encoder's perspective the bit stream is primarily - a series of main_data() blocks, with header and side information - inserted at the proper locations to maintain framing. (See Figure A.7 - in the IS). - */ -int -format_bitstream(lame_internal_flags * gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - int bits, nbytes; - III_side_info_t *l3_side; - int bitsPerFrame; - l3_side = &gfc->l3_side; - - bitsPerFrame = getframebits(gfc); - drain_into_ancillary(gfc, l3_side->resvDrain_pre); - - encodeSideInfo2(gfc, bitsPerFrame); - bits = 8 * cfg->sideinfo_len; - bits += writeMainData(gfc); - drain_into_ancillary(gfc, l3_side->resvDrain_post); - bits += l3_side->resvDrain_post; - - l3_side->main_data_begin += (bitsPerFrame - bits) / 8; - - /* compare number of bits needed to clear all buffered mp3 frames - * with what we think the resvsize is: */ - if (compute_flushbits(gfc, &nbytes) != esv->ResvSize) { - ERRORF(gfc, "Internal buffer inconsistency. flushbits <> ResvSize"); - } - - - /* compare main_data_begin for the next frame with what we - * think the resvsize is: */ - if ((l3_side->main_data_begin * 8) != esv->ResvSize) { - ERRORF(gfc, "bit reservoir error: \n" - "l3_side->main_data_begin: %i \n" - "Resvoir size: %i \n" - "resv drain (post) %i \n" - "resv drain (pre) %i \n" - "header and sideinfo: %i \n" - "data bits: %i \n" - "total bits: %i (remainder: %i) \n" - "bitsperframe: %i \n", - 8 * l3_side->main_data_begin, - esv->ResvSize, - l3_side->resvDrain_post, - l3_side->resvDrain_pre, - 8 * cfg->sideinfo_len, - bits - l3_side->resvDrain_post - 8 * cfg->sideinfo_len, - bits, bits % 8, bitsPerFrame); - - ERRORF(gfc, "This is a fatal error. It has several possible causes:"); - ERRORF(gfc, "90%% LAME compiled with buggy version of gcc using advanced optimizations"); - ERRORF(gfc, " 9%% Your system is overclocked"); - ERRORF(gfc, " 1%% bug in LAME encoding library"); - - esv->ResvSize = l3_side->main_data_begin * 8; - }; - assert(gfc->bs.totbit % 8 == 0); - - if (gfc->bs.totbit > 1000000000) { - /* to avoid totbit overflow, (at 8h encoding at 128kbs) lets reset bit counter */ - int i; - for (i = 0; i < MAX_HEADER_BUF; ++i) - esv->header[i].write_timing -= gfc->bs.totbit; - gfc->bs.totbit = 0; - } - - - return 0; -} - - -static int -do_gain_analysis(lame_internal_flags * gfc, unsigned char* buffer, int minimum) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - RpgStateVar_t const *const rsv = &gfc->sv_rpg; - RpgResult_t *const rov = &gfc->ov_rpg; -#ifdef DECODE_ON_THE_FLY - if (cfg->decode_on_the_fly) { /* decode the frame */ - sample_t pcm_buf[2][1152]; - int mp3_in = minimum; - int samples_out = -1; - - /* re-synthesis to pcm. Repeat until we get a samples_out=0 */ - while (samples_out != 0) { - - samples_out = hip_decode1_unclipped(gfc->hip, buffer, mp3_in, pcm_buf[0], pcm_buf[1]); - /* samples_out = 0: need more data to decode - * samples_out = -1: error. Lets assume 0 pcm output - * samples_out = number of samples output */ - - /* set the lenght of the mp3 input buffer to zero, so that in the - * next iteration of the loop we will be querying mpglib about - * buffered data */ - mp3_in = 0; - - if (samples_out == -1) { - /* error decoding. Not fatal, but might screw up - * the ReplayGain tag. What should we do? Ignore for now */ - samples_out = 0; - } - if (samples_out > 0) { - /* process the PCM data */ - - /* this should not be possible, and indicates we have - * overflown the pcm_buf buffer */ - assert(samples_out <= 1152); - - if (cfg->findPeakSample) { - int i; - /* FIXME: is this correct? maybe Max(fabs(pcm),PeakSample) */ - for (i = 0; i < samples_out; i++) { - if (pcm_buf[0][i] > rov->PeakSample) - rov->PeakSample = pcm_buf[0][i]; - else if (-pcm_buf[0][i] > rov->PeakSample) - rov->PeakSample = -pcm_buf[0][i]; - } - if (cfg->channels_out > 1) - for (i = 0; i < samples_out; i++) { - if (pcm_buf[1][i] > rov->PeakSample) - rov->PeakSample = pcm_buf[1][i]; - else if (-pcm_buf[1][i] > rov->PeakSample) - rov->PeakSample = -pcm_buf[1][i]; - } - } - - if (cfg->findReplayGain) - if (AnalyzeSamples - (rsv->rgdata, pcm_buf[0], pcm_buf[1], samples_out, - cfg->channels_out) == GAIN_ANALYSIS_ERROR) - return -6; - - } /* if (samples_out>0) */ - } /* while (samples_out!=0) */ - } /* if (gfc->decode_on_the_fly) */ -#endif - return minimum; -} - -static int -do_copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int size) -{ - Bit_stream_struc *const bs = &gfc->bs; - int const minimum = bs->buf_byte_idx + 1; - if (minimum <= 0) - return 0; - if (size != 0 && minimum > size) - return -1; /* buffer is too small */ - memcpy(buffer, bs->buf, minimum); - bs->buf_byte_idx = -1; - bs->buf_bit_idx = 0; - return minimum; -} - -/* copy data out of the internal MP3 bit buffer into a user supplied - unsigned char buffer. - - mp3data=0 indicates data in buffer is an id3tags and VBR tags - mp3data=1 data is real mp3 frame data. - - -*/ -int -copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int size, int mp3data) -{ - int const minimum = do_copy_buffer(gfc, buffer, size); - if (minimum > 0 && mp3data) { - UpdateMusicCRC(&gfc->nMusicCRC, buffer, minimum); - - /** sum number of bytes belonging to the mp3 stream - * this info will be written into the Xing/LAME header for seeking - */ - gfc->VBR_seek_table.nBytesWritten += minimum; - - return do_gain_analysis(gfc, buffer, minimum); - } /* if (mp3data) */ - return minimum; -} - - -void -init_bit_stream_w(lame_internal_flags * gfc) -{ - EncStateVar_t *const esv = &gfc->sv_enc; - - esv->h_ptr = esv->w_ptr = 0; - esv->header[esv->h_ptr].write_timing = 0; - - gfc->bs.buf = (unsigned char *) malloc(BUFFER_SIZE); - gfc->bs.buf_size = BUFFER_SIZE; - gfc->bs.buf_byte_idx = -1; - gfc->bs.buf_bit_idx = 0; - gfc->bs.totbit = 0; -} - -/* end of bitstream.c */ diff --git a/src/lib/dl/ext/lame/bitstream.h b/src/lib/dl/ext/lame/bitstream.h deleted file mode 100755 index 3ae48d02..00000000 --- a/src/lib/dl/ext/lame/bitstream.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * MP3 bitstream Output interface for LAME - * - * Copyright (c) 1999 Takehiro TOMINAGA - * - * 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_BITSTREAM_H -#define LAME_BITSTREAM_H - -int getframebits(const lame_internal_flags * gfc); - -int format_bitstream(lame_internal_flags * gfc); - -void flush_bitstream(lame_internal_flags * gfc); -void add_dummy_byte(lame_internal_flags * gfc, unsigned char val, unsigned int n); - -int copy_buffer(lame_internal_flags * gfc, unsigned char *buffer, int buffer_size, - int update_crc); -void init_bit_stream_w(lame_internal_flags * gfc); -void CRC_writeheader(lame_internal_flags const *gfc, char *buffer); -int compute_flushbits(const lame_internal_flags * gfp, int *nbytes); - -int get_max_frame_buffer_size_by_constraint(SessionConfig_t const * cfg, int constraint); - -#endif diff --git a/src/lib/dl/ext/lame/brhist.c b/src/lib/dl/ext/lame/brhist.c deleted file mode 100755 index dcf858fb..00000000 --- a/src/lib/dl/ext/lame/brhist.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Bitrate histogram source file - * - * Copyright (c) 2000 Mark Taylor - * - * 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. - */ - -/* $Id: brhist.c,v 1.57 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -/* basic #define's */ - -#ifndef BRHIST_WIDTH -# define BRHIST_WIDTH 14 -#endif -#ifndef BRHIST_RES -# define BRHIST_RES 14 -#endif - - -/* #includes */ - -#ifdef STDC_HEADERS -# include -# include -# include -#endif - -#include "brhist.h" -#include "console.h" - -#ifdef WITH_DMALLOC -#include -#endif - - -/* Structure holding all data related to the Console I/O - * may be this should be a more global frontend structure. So it - * makes sense to print all files instead with - * printf ( "blah\n") with printf ( "blah%s\n", Console_IO.str_clreoln ); - */ - -extern Console_IO_t Console_IO; - -static struct brhist_struct { - int vbr_bitrate_min_index; - int vbr_bitrate_max_index; - int kbps[BRHIST_WIDTH]; - int hist_printed_lines; - char bar_asterisk[512 + 1]; /* buffer filled up with a lot of '*' to print a bar */ - char bar_percent[512 + 1]; /* buffer filled up with a lot of '%' to print a bar */ - char bar_coded[512 + 1]; /* buffer filled up with a lot of ' ' to print a bar */ - char bar_space[512 + 1]; /* buffer filled up with a lot of ' ' to print a bar */ -} brhist; - -static int -calculate_index(const int *const array, const int len, const int value) -{ - int i; - - for (i = 0; i < len; i++) - if (array[i] == value) - return i; - return -1; -} - -int -brhist_init(const lame_global_flags * gf, const int bitrate_kbps_min, const int bitrate_kbps_max) -{ - brhist.hist_printed_lines = 0; - - /* initialize histogramming data structure */ - lame_bitrate_kbps(gf, brhist.kbps); - brhist.vbr_bitrate_min_index = calculate_index(brhist.kbps, BRHIST_WIDTH, bitrate_kbps_min); - brhist.vbr_bitrate_max_index = calculate_index(brhist.kbps, BRHIST_WIDTH, bitrate_kbps_max); - - if (brhist.vbr_bitrate_min_index >= BRHIST_WIDTH || - brhist.vbr_bitrate_max_index >= BRHIST_WIDTH) { - error_printf("lame internal error: VBR min %d kbps or VBR max %d kbps not allowed.\n", - bitrate_kbps_min, bitrate_kbps_max); - return -1; - } - - memset(brhist.bar_asterisk, '*', sizeof(brhist.bar_asterisk) - 1); - memset(brhist.bar_percent, '%', sizeof(brhist.bar_percent) - 1); - memset(brhist.bar_space, '-', sizeof(brhist.bar_space) - 1); - memset(brhist.bar_coded, '-', sizeof(brhist.bar_space) - 1); - - return 0; -} - -static int -digits(unsigned number) -{ - int ret = 1; - - if (number >= 100000000) { - ret += 8; - number /= 100000000; - } - if (number >= 10000) { - ret += 4; - number /= 10000; - } - if (number >= 100) { - ret += 2; - number /= 100; - } - if (number >= 10) { - ret += 1; - } - - return ret; -} - - -static void -brhist_disp_line(int i, int br_hist_TOT, int br_hist_LR, int full, int frames) -{ - char brppt[14]; /* [%] and max. 10 characters for kbps */ - int barlen_TOT; - int barlen_LR; - int res = digits(frames) + 3 + 4 + 1; - - if (full != 0) { - /* some problems when br_hist_TOT \approx br_hist_LR: You can't see that there are still MS frames */ - barlen_TOT = (br_hist_TOT * (Console_IO.disp_width - res) + full - 1) / full; /* round up */ - barlen_LR = (br_hist_LR * (Console_IO.disp_width - res) + full - 1) / full; /* round up */ - } - else { - barlen_TOT = barlen_LR = 0; - } - - sprintf(brppt, " [%*i]", digits(frames), br_hist_TOT); - - if (Console_IO.str_clreoln[0]) /* ClearEndOfLine available */ - console_printf("\n%3d%s %.*s%.*s%s", - brhist.kbps[i], brppt, - barlen_LR, brhist.bar_percent, - barlen_TOT - barlen_LR, brhist.bar_asterisk, Console_IO.str_clreoln); - else - console_printf("\n%3d%s %.*s%.*s%*s", - brhist.kbps[i], brppt, - barlen_LR, brhist.bar_percent, - barlen_TOT - barlen_LR, brhist.bar_asterisk, - Console_IO.disp_width - res - barlen_TOT, ""); - - brhist.hist_printed_lines++; -} - - - -static void -progress_line(const lame_global_flags * gf, int full, int frames) -{ - char rst[20] = "\0"; - int barlen_TOT = 0, barlen_COD = 0, barlen_RST = 0; - int res = 1; - float time_in_sec = 0; - unsigned int hour, min, sec; - int fsize = lame_get_framesize(gf); - int srate = lame_get_out_samplerate(gf); - - if (full < frames) { - full = frames; - } - if (srate > 0) { - time_in_sec = (float)(full - frames); - time_in_sec *= fsize; - time_in_sec /= srate; - } - hour = (unsigned int)(time_in_sec / 3600); - time_in_sec -= hour * 3600; - min = (unsigned int)(time_in_sec / 60); - time_in_sec -= min * 60; - sec = (unsigned int)time_in_sec; - if (full != 0) { - if (hour > 0) { - sprintf(rst, "%*d:%02u:%02u", digits(hour), hour, min, sec); - res += digits(hour) + 1 + 5; - } - else { - sprintf(rst, "%02u:%02u", min, sec); - res += 5; - } - /* some problems when br_hist_TOT \approx br_hist_LR: You can't see that there are still MS frames */ - barlen_TOT = (full * (Console_IO.disp_width - res) + full - 1) / full; /* round up */ - barlen_COD = (frames * (Console_IO.disp_width - res) + full - 1) / full; /* round up */ - barlen_RST = barlen_TOT - barlen_COD; - if (barlen_RST == 0) { - sprintf(rst, "%.*s", res - 1, brhist.bar_coded); - } - } - else { - barlen_TOT = barlen_COD = barlen_RST = 0; - } - if (Console_IO.str_clreoln[0]) { /* ClearEndOfLine available */ - console_printf("\n%.*s%s%.*s%s", - barlen_COD, brhist.bar_coded, - rst, barlen_RST, brhist.bar_space, Console_IO.str_clreoln); - } - else { - console_printf("\n%.*s%s%.*s%*s", - barlen_COD, brhist.bar_coded, - rst, barlen_RST, brhist.bar_space, Console_IO.disp_width - res - barlen_TOT, - ""); - } - brhist.hist_printed_lines++; -} - - -static int -stats_value(double x) -{ - if (x > 0.0) { - console_printf(" %5.1f", x); - return 6; - } - return 0; -} - -static int -stats_head(double x, const char *txt) -{ - if (x > 0.0) { - console_printf(txt); - return 6; - } - return 0; -} - - -static void -stats_line(double *stat) -{ - int n = 1; - console_printf("\n kbps "); - n += 12; - n += stats_head(stat[1], " mono"); - n += stats_head(stat[2], " IS "); - n += stats_head(stat[3], " LR "); - n += stats_head(stat[4], " MS "); - console_printf(" %% "); - n += 6; - n += stats_head(stat[5], " long "); - n += stats_head(stat[6], "switch"); - n += stats_head(stat[7], " short"); - n += stats_head(stat[8], " mixed"); - n += console_printf(" %%"); - if (Console_IO.str_clreoln[0]) { /* ClearEndOfLine available */ - console_printf("%s", Console_IO.str_clreoln); - } - else { - console_printf("%*s", Console_IO.disp_width - n, ""); - } - brhist.hist_printed_lines++; - - n = 1; - console_printf("\n %5.1f ", stat[0]); - n += 12; - n += stats_value(stat[1]); - n += stats_value(stat[2]); - n += stats_value(stat[3]); - n += stats_value(stat[4]); - console_printf(" "); - n += 6; - n += stats_value(stat[5]); - n += stats_value(stat[6]); - n += stats_value(stat[7]); - n += stats_value(stat[8]); - if (Console_IO.str_clreoln[0]) { /* ClearEndOfLine available */ - console_printf("%s", Console_IO.str_clreoln); - } - else { - console_printf("%*s", Console_IO.disp_width - n, ""); - } - brhist.hist_printed_lines++; -} - - -/* Yes, not very good */ -#define LR 0 -#define MS 2 - -void -brhist_disp(const lame_global_flags * gf) -{ - int i, lines_used = 0; - int br_hist[BRHIST_WIDTH]; /* how often a frame size was used */ - int br_sm_hist[BRHIST_WIDTH][4]; /* how often a special frame size/stereo mode commbination was used */ - int st_mode[4]; - int bl_type[6]; - int frames; /* total number of encoded frames */ - int most_often; /* usage count of the most often used frame size, but not smaller than Console_IO.disp_width-BRHIST_RES (makes this sense?) and 1 */ - double sum = 0.; - - double stat[9] = { 0 }; - int st_frames = 0; - - - brhist.hist_printed_lines = 0; /* printed number of lines for the brhist functionality, used to skip back the right number of lines */ - - lame_bitrate_stereo_mode_hist(gf, br_sm_hist); - lame_bitrate_hist(gf, br_hist); - lame_stereo_mode_hist(gf, st_mode); - lame_block_type_hist(gf, bl_type); - - frames = most_often = 0; - for (i = 0; i < BRHIST_WIDTH; i++) { - frames += br_hist[i]; - sum += br_hist[i] * brhist.kbps[i]; - if (most_often < br_hist[i]) - most_often = br_hist[i]; - if (br_hist[i]) - ++lines_used; - } - - for (i = 0; i < BRHIST_WIDTH; i++) { - int show = br_hist[i]; - show = show && (lines_used > 1); - if (show || (i >= brhist.vbr_bitrate_min_index && i <= brhist.vbr_bitrate_max_index)) - brhist_disp_line(i, br_hist[i], br_sm_hist[i][LR], most_often, frames); - } - for (i = 0; i < 4; i++) { - st_frames += st_mode[i]; - } - if (frames > 0) { - stat[0] = sum / frames; - stat[1] = 100. * (frames - st_frames) / frames; - } - if (st_frames > 0) { - stat[2] = 0.0; - stat[3] = 100. * st_mode[LR] / st_frames; - stat[4] = 100. * st_mode[MS] / st_frames; - } - if (bl_type[5] > 0) { - stat[5] = 100. * bl_type[0] / bl_type[5]; - stat[6] = 100. * (bl_type[1] + bl_type[3]) / bl_type[5]; - stat[7] = 100. * bl_type[2] / bl_type[5]; - stat[8] = 100. * bl_type[4] / bl_type[5]; - } - progress_line(gf, lame_get_totalframes(gf), frames); - stats_line(stat); -} - -void -brhist_jump_back(void) -{ - console_up(brhist.hist_printed_lines); - brhist.hist_printed_lines = 0; -} - -/* - * 1) - * - * Taken from Termcap_Manual.html: - * - * With the Unix version of termcap, you must allocate space for the description yourself and pass - * the address of the space as the argument buffer. There is no way you can tell how much space is - * needed, so the convention is to allocate a buffer 2048 characters long and assume that is - * enough. (Formerly the convention was to allocate 1024 characters and assume that was enough. - * But one day, for one kind of terminal, that was not enough.) - */ - - diff --git a/src/lib/dl/ext/lame/brhist.h b/src/lib/dl/ext/lame/brhist.h deleted file mode 100755 index 15b16c65..00000000 --- a/src/lib/dl/ext/lame/brhist.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Bitrate histogram include file - * - * Copyright (c) 2000 Mark Taylor - * - * 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_BRHIST_H -#define LAME_BRHIST_H - -#include "lame.h" - -#if defined(__cplusplus) -extern "C" { -#endif - -int brhist_init(const lame_global_flags * gf, const int bitrate_kbps_min, - const int bitrate_kbps_max); -void brhist_disp(const lame_global_flags * gf); -void brhist_jump_back(void); - -#if defined(__cplusplus) -} -#endif - -#endif /* LAME_BRHIST_H */ diff --git a/src/lib/dl/ext/lame/common.c b/src/lib/dl/ext/lame/common.c deleted file mode 100755 index 3cc136bf..00000000 --- a/src/lib/dl/ext/lame/common.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * common.c: some common bitstream operations - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - */ - -/* $Id: common.c,v 1.40 2010/03/22 14:30:19 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#ifdef HAVE_FCNTL_H -#include -#endif - -#ifdef macintosh -#include -#include -#else -#include -#include -#endif - -#include - -#include "common.h" - -#ifdef WITH_DMALLOC -#include -#endif - -/* In C++ the array first must be prototyped, why ? */ - - - /* *INDENT-OFF* */ -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 }; - - /* *INDENT-ON* */ - - -real muls[27][64]; - -#if 0 -static void -get_II_stuff(struct frame *fr) -{ - /* *INDENT-OFF* */ - static const int translate [3] [2] [16] = /* char ? */ - { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } , - { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } , - { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } , - { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } , - { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } , - { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } }; - /* *INDENT-ON* */ - - int table, sblim; - static const struct al_table2 *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 }; - static int sblims[5] = { 27, 30, 8, 12, 30 }; - - if (fr->lsf) - table = 4; - else - table = translate[fr->sampling_frequency][2 - fr->stereo][fr->bitrate_index]; - sblim = sblims[table]; - - fr->alloc = tables[table]; - fr->II_sblimit = sblim; -} -#endif - -#define HDRCMPMASK 0xfffffd00 - -#define MAX_INPUT_FRAMESIZE 4096 - -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 (nLayer == 4) - return FALSE; - - if (check_layer > 0 && 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; - } - if ((head & 0x3) == 0x2) - /* invalid emphasis */ - return FALSE; - return TRUE; -} - - -#if 0 -static void -print_header(PMPSTR mp, struct frame *fr) -{ - static const char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" }; - static const char *layers[4] = { "Unknown", "I", "II", "III" }; - - lame_report_fnc(mp->report_msg, "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); - lame_report_fnc(mp->report_msg, "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); - lame_report_fnc(mp->report_msg, "Bitrate: %d Kbits/s, Extension value: %d\n", - tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], fr->extension); -} - -static void -print_header_compact(PMPSTR mp, struct frame *fr) -{ - static const char *modes[4] = { "stereo", "joint-stereo", "dual-channel", "mono" }; - static const char *layers[4] = { "Unknown", "I", "II", "III" }; - - lame_report_fnc(mp->report_err, "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 - -/* - * decode a header and write the information - * into the frame structure - */ -int -decode_header(PMPSTR mp, 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) { - lame_report_fnc(mp->report_err, "Stream error\n"); - exit(1); - } - 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) { - 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; - - 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; - - 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->framesize > MAX_INPUT_FRAMESIZE) { - lame_report_fnc(mp->report_err, "Frame size too big.\n"); - fr->framesize = MAX_INPUT_FRAMESIZE; - return (0); - } - - - 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: - lame_report_fnc(mp->report_err, "Sorry, layer %d not supported\n", fr->lay); - return (0); - } - /* print_header(mp, fr); */ - - return 1; -} - - -unsigned int -getbits(PMPSTR mp, int number_of_bits) -{ - unsigned long rval; - - if (number_of_bits <= 0 || !mp->wordpointer) - return 0; - - { - rval = mp->wordpointer[0]; - rval <<= 8; - rval |= mp->wordpointer[1]; - rval <<= 8; - rval |= mp->wordpointer[2]; - rval <<= mp->bitindex; - rval &= 0xffffff; - - mp->bitindex += number_of_bits; - - rval >>= (24 - number_of_bits); - - mp->wordpointer += (mp->bitindex >> 3); - mp->bitindex &= 7; - } - return rval; -} - -unsigned int -getbits_fast(PMPSTR mp, int number_of_bits) -{ - unsigned long rval; - - { - rval = mp->wordpointer[0]; - rval <<= 8; - rval |= mp->wordpointer[1]; - rval <<= mp->bitindex; - rval &= 0xffff; - mp->bitindex += number_of_bits; - - rval >>= (16 - number_of_bits); - - mp->wordpointer += (mp->bitindex >> 3); - mp->bitindex &= 7; - } - return rval; -} - -unsigned char -get_leq_8_bits(PMPSTR mp, unsigned int number_of_bits) -{ - assert(number_of_bits <= 8); - return (unsigned char) getbits_fast(mp, number_of_bits); -} - -unsigned short -get_leq_16_bits(PMPSTR mp, unsigned int number_of_bits) -{ - assert(number_of_bits <= 16); - return (unsigned short) getbits_fast(mp, number_of_bits); -} - -int -set_pointer(PMPSTR mp, long backstep) -{ - unsigned char *bsbufold; - - if (mp->fsizeold < 0 && backstep > 0) { - lame_report_fnc(mp->report_err, "hip: Can't step back %ld bytes!\n", backstep); - return MP3_ERR; - } - bsbufold = mp->bsspace[1 - mp->bsnum] + 512; - mp->wordpointer -= backstep; - if (backstep) - memcpy(mp->wordpointer, bsbufold + mp->fsizeold - backstep, (size_t) backstep); - mp->bitindex = 0; - return MP3_OK; -} diff --git a/src/lib/dl/ext/lame/common.h b/src/lib/dl/ext/lame/common.h deleted file mode 100755 index 62cf17e5..00000000 --- a/src/lib/dl/ext/lame/common.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 COMMON_H_INCLUDED -#define COMMON_H_INCLUDED - -#include "mpg123.h" -#include "mpglib.h" - -extern const int tabsel_123[2][3][16]; -extern const long freqs[9]; - -extern real muls[27][64]; - - -int head_check(unsigned long head, int check_layer); -int decode_header(PMPSTR mp, struct frame *fr, unsigned long newhead); -unsigned int getbits(PMPSTR mp, int number_of_bits); -unsigned int getbits_fast(PMPSTR mp, int number_of_bits); -unsigned char get_leq_8_bits(PMPSTR mp, unsigned int number_of_bits); -unsigned short get_leq_16_bits(PMPSTR mp, unsigned int number_of_bits); -int set_pointer(PMPSTR mp, long backstep); - -#endif diff --git a/src/lib/dl/ext/lame/common.mak b/src/lib/dl/ext/lame/common.mak deleted file mode 100755 index 6c19d764..00000000 --- a/src/lib/dl/ext/lame/common.mak +++ /dev/null @@ -1,42 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_LAME_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=. -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)bitstream.obj $(SUBDIR)$(HPS)encoder.obj $(SUBDIR)$(HPS)fft.obj $(SUBDIR)$(HPS)gain_analysis.obj $(SUBDIR)$(HPS)id3tag.obj $(SUBDIR)$(HPS)lame.obj $(SUBDIR)$(HPS)mpglib_interface.obj $(SUBDIR)$(HPS)newmdct.obj $(SUBDIR)$(HPS)presets.obj $(SUBDIR)$(HPS)psymodel.obj $(SUBDIR)$(HPS)quantize.obj $(SUBDIR)$(HPS)quantize_pvt.obj $(SUBDIR)$(HPS)reservoir.obj $(SUBDIR)$(HPS)set_get.obj $(SUBDIR)$(HPS)tables.obj $(SUBDIR)$(HPS)takehiro.obj $(SUBDIR)$(HPS)util.obj $(SUBDIR)$(HPS)vbrquantize.obj $(SUBDIR)$(HPS)vbrtag.obj $(SUBDIR)$(HPS)version.obj $(SUBDIR)$(HPS)common.obj $(SUBDIR)$(HPS)dct64_i386.obj $(SUBDIR)$(HPS)decode_i386.obj $(SUBDIR)$(HPS)interface.obj $(SUBDIR)$(HPS)layer1.obj $(SUBDIR)$(HPS)layer2.obj $(SUBDIR)$(HPS)layer3.obj $(SUBDIR)$(HPS)tabinit.obj - -!ifdef EXT_LAME_LAME_EXE -# NOTICE!!! Notice the "option stack=128000" below. It is needed to compensate for the Lame MP3 devs -# and their fetish for declaring large arrays or data types on the call stack. When all of -# those have been eliminated, then we can remove the option stack command. -# -# Until that issue is fixed, you are guaranteed stack corruption and misery in any program -# you link libmp3lame into and use, unless your program also declares a larger stack. -$(EXT_LAME_LAME_EXE): $(EXT_LAME_LIB) $(SUBDIR)$(HPS)brhist.obj $(SUBDIR)$(HPS)console.obj $(SUBDIR)$(HPS)get_audio.obj $(SUBDIR)$(HPS)lame_main.obj $(SUBDIR)$(HPS)lametime.obj $(SUBDIR)$(HPS)main.obj $(SUBDIR)$(HPS)parse.obj $(SUBDIR)$(HPS)timestatus.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)brhist.obj file $(SUBDIR)$(HPS)console.obj file $(SUBDIR)$(HPS)get_audio.obj file $(SUBDIR)$(HPS)lame_main.obj file $(SUBDIR)$(HPS)lametime.obj file $(SUBDIR)$(HPS)main.obj file $(SUBDIR)$(HPS)parse.obj file $(SUBDIR)$(HPS)timestatus.obj $(EXT_LAME_LIB_WLINK_LIBRARIES) option stack=128000 name $(EXT_LAME_LAME_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifdef EXT_LAME_LIB -$(EXT_LAME_LIB): $(OBJS) - wlib -q -b -c $(EXT_LAME_LIB) -+$(SUBDIR)$(HPS)bitstream.obj -+$(SUBDIR)$(HPS)encoder.obj -+$(SUBDIR)$(HPS)fft.obj -+$(SUBDIR)$(HPS)gain_analysis.obj -+$(SUBDIR)$(HPS)id3tag.obj -+$(SUBDIR)$(HPS)lame.obj -+$(SUBDIR)$(HPS)mpglib_interface.obj -+$(SUBDIR)$(HPS)newmdct.obj -+$(SUBDIR)$(HPS)presets.obj -+$(SUBDIR)$(HPS)psymodel.obj -+$(SUBDIR)$(HPS)quantize.obj -+$(SUBDIR)$(HPS)quantize_pvt.obj -+$(SUBDIR)$(HPS)reservoir.obj -+$(SUBDIR)$(HPS)set_get.obj -+$(SUBDIR)$(HPS)tables.obj -+$(SUBDIR)$(HPS)takehiro.obj -+$(SUBDIR)$(HPS)util.obj -+$(SUBDIR)$(HPS)vbrquantize.obj -+$(SUBDIR)$(HPS)vbrtag.obj -+$(SUBDIR)$(HPS)version.obj -+$(SUBDIR)$(HPS)common.obj -+$(SUBDIR)$(HPS)dct64_i386.obj -+$(SUBDIR)$(HPS)decode_i386.obj -+$(SUBDIR)$(HPS)interface.obj -+$(SUBDIR)$(HPS)layer1.obj -+$(SUBDIR)$(HPS)layer2.obj -+$(SUBDIR)$(HPS)layer3.obj -+$(SUBDIR)$(HPS)tabinit.obj -!endif - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_LAME_LIB) .symbolic - -exe: $(EXT_LAME_LAME_EXE) .symbolic - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/lame/config.h b/src/lib/dl/ext/lame/config.h deleted file mode 100755 index e712e3f8..00000000 --- a/src/lib/dl/ext/lame/config.h +++ /dev/null @@ -1,370 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* debug define */ -/* #undef ABORTFP */ - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -/* #undef CRAY_STACKSEG_END */ - -/* Define to 1 if using `alloca.c'. */ -/* #undef C_ALLOCA */ - -/* alot of debug output */ -/* #undef DEBUG */ - -/* allow to compute a more accurate replaygain value */ -#define DECODE_ON_THE_FLY 1 - -/* double is faster than float on Alpha */ -/* #undef FLOAT */ - -/* Define to 1 if you have `alloca', as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#define HAVE_ALLOCA_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* we link against libefence */ -/* #undef HAVE_EFENCE */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define if you have the iconv() function and it works. */ -/* #define HAVE_ICONV 1 */ - -/* add ieee754_float32_t type */ -/* #undef HAVE_IEEE754_FLOAT32_T */ -#ifndef HAVE_IEEE754_FLOAT32_T - typedef float ieee754_float32_t; -#endif - -/* add ieee754_float64_t type */ -/* #undef HAVE_IEEE754_FLOAT64_T */ -#ifndef HAVE_IEEE754_FLOAT64_T - typedef double ieee754_float64_t; -#endif - -/* system has 80 bit floats */ -#define HAVE_IEEE854_FLOAT80 1 - -/* add ieee854_float80_t type */ -/* #undef HAVE_IEEE854_FLOAT80_T */ -#ifndef HAVE_IEEE854_FLOAT80_T - typedef long double ieee854_float80_t; -#endif - -/* add int16_t type */ -#define HAVE_INT16_T 1 -#ifndef HAVE_INT16_T - typedef short int16_t; -#endif - -/* add int32_t type */ -#define HAVE_INT32_T 1 -#ifndef HAVE_INT32_T -#define A_INT32_T int - typedef A_INT32_T int32_t; -#endif - -/* add int64_t type */ -#define HAVE_INT64_T 1 -#ifndef HAVE_INT64_T -#define A_INT64_T long long - typedef A_INT64_T int64_t; -#endif - -/* add int8_t type */ -#define HAVE_INT8_T 1 -#ifndef HAVE_INT8_T - typedef char int8_t; -#endif - -/* 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_LIMITS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LINUX_SOUNDCARD_H 1 - -/* Define to 1 if the type `long double' works and has more range or precision - than `double'. */ -#define HAVE_LONG_DOUBLE 1 - -/* Define to 1 if the type `long double' works and has more range or precision - than `double'. */ -#define HAVE_LONG_DOUBLE_WIDER 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* build with mpglib support */ -#define HAVE_MPGLIB 1 - -/* have nasm */ -/* #undef HAVE_NASM */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NCURSES_TERMCAP_H */ - -/* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 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 `strtol' function. */ -#define HAVE_STRTOL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOUNDCARD_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_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* have termcap */ -/* #define HAVE_TERMCAP 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_TERMCAP_H 1 */ - -/* add uint16_t type */ -#define HAVE_UINT16_T 1 -#ifndef HAVE_UINT16_T - typedef unsigned short uint16_t; -#endif - -/* add uint32_t type */ -#define HAVE_UINT32_T 1 -#ifndef HAVE_UINT32_T -#define A_UINT32_T unsigned int - typedef A_UINT32_T uint32_t; -#endif - -/* add uint64_t type */ -#define HAVE_UINT64_T 1 -#ifndef HAVE_UINT64_T -#define A_UINT64_T unsigned long long - typedef A_UINT64_T uint64_t; -#endif - -/* add uint8_t type */ -#define HAVE_UINT8_T 1 -#ifndef HAVE_UINT8_T - typedef unsigned char uint8_t; -#endif - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_XMMINTRIN_H */ - -/* Define as const if the declaration of iconv() needs const. */ -/* #define ICONV_CONST */ - -/* requested by Frank, seems to be temporary needed for a smooth transition */ -#define LAME_LIBRARY_BUILD 1 - -/* set to 1 if you have libsndfile */ -/* #undef LIBSNDFILE */ - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* use MMX version of choose_table */ -/* #undef MMX_choose_table */ - -/* no debug build */ -#define NDEBUG 1 - -/* build without hooks for analyzer */ -/* #undef NOANALYSIS */ - -/* Name of package */ -#define PACKAGE "lame" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "lame-dev@lists.sf.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "lame" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "lame 3.99.3" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "lame" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "3.99.3" - -/* Define to 1 if the C compiler supports function prototypes. */ -#define PROTOTYPES 1 - -/* The size of `double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of `float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `long double', as computed by sizeof. */ -/* #undef SIZEOF_LONG_DOUBLE */ - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `unsigned int', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_INT 4 - -/* The size of `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 4 - -/* The size of `unsigned long long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG_LONG 8 - -/* The size of `unsigned short', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_SHORT 2 - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -/* #undef STACK_DIRECTION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* IEEE754 compatible machine */ -#define TAKEHIRO_IEEE754_HACK 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* faster log implementation with less but enough precission */ -#define USE_FAST_LOG 1 - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# define _ALL_SOURCE 1 -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS 1 -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# define _TANDEM_SOURCE 1 -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 1 -#endif - - -/* Version number of package */ -#define VERSION "3.99.3" - -/* Define if using the dmalloc debugging malloc package */ -/* #undef WITH_DMALLOC */ - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to 1 if on MINIX. */ -/* #undef _MINIX */ - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -/* #undef _POSIX_1_SOURCE */ - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -/* #undef _POSIX_SOURCE */ - -/* we're on DEC Alpha */ -/* #undef __DECALPHA__ */ - -/* work around a glibc bug */ -/* #undef __NO_MATH_INLINES */ - -/* Define like PROTOTYPES; this can be used by system headers. */ -#define __PROTOTYPES 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 `unsigned int' if does not define. */ -/* #undef size_t */ diff --git a/src/lib/dl/ext/lame/console.c b/src/lib/dl/ext/lame/console.c deleted file mode 100755 index 17ca154a..00000000 --- a/src/lib/dl/ext/lame/console.c +++ /dev/null @@ -1,296 +0,0 @@ -#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(HAVE_NCURSES_TERMCAP_H) -# include -#elif defined(HAVE_TERMCAP_H) -# include -#elif defined(HAVE_TERMCAP) -# include -# if !defined(__bsdi__) -# include -# endif -#endif - -#include -#include -#include "console.h" -#include "main.h" - -#ifdef WITH_DMALLOC -#include -#endif - -#define CLASS_ID 0x434F4E53 -#define REPORT_BUFF_SIZE 1024 - -#if defined(_WIN32) && !defined(__CYGWIN__) -# include -#endif - - - -static int -my_console_printing(FILE * fp, const char *format, va_list ap) -{ - if (fp != NULL) - return vfprintf(fp, format, ap); - return 0; -} - -static int -my_error_printing(FILE * fp, const char *format, va_list ap) -{ - if (fp != NULL) - return vfprintf(fp, format, ap); - return 0; -} - -static int -my_report_printing(FILE * fp, const char *format, va_list ap) -{ - if (fp != NULL) - return vfprintf(fp, format, ap); - return 0; -} - - -/* - * Taken from Termcap_Manual.html: - * - * With the Unix version of termcap, you must allocate space for the description yourself and pass - * the address of the space as the argument buffer. There is no way you can tell how much space is - * needed, so the convention is to allocate a buffer 2048 characters long and assume that is - * enough. (Formerly the convention was to allocate 1024 characters and assume that was enough. - * But one day, for one kind of terminal, that was not enough.) - */ - -#ifdef HAVE_TERMCAP - -static void -get_termcap_string(char const* id, char* dest, size_t n) -{ - char tc[16]; - char *tp = tc; - tp[0] = '\0'; - tp = tgetstr(id, &tp); - if (tp != NULL && dest != NULL && n > 0) { - strncpy(dest, tp, n); - dest[n-1] = '\0'; - } -} - -static void -get_termcap_number(char const* id, int* dest, int low, int high) -{ - int const val = tgetnum(id); - if (low <= val && val <= high) { - *dest = val; - } -} - -static void -apply_termcap_settings(Console_IO_t * const mfp) -{ - /* try to catch additional information about special console sequences */ - char const* term_name = getenv("TERM"); - if (NULL != term_name) { - char term_buff[4096]; - int const ret = tgetent(term_buff, term_name); - if (1 == ret) { - get_termcap_number("co", &mfp->disp_width, 40, 512); - get_termcap_number("li", &mfp->disp_height, 16, 256); - get_termcap_string("up", mfp->str_up, sizeof(mfp->str_up)); - get_termcap_string("md", mfp->str_emph, sizeof(mfp->str_emph)); - get_termcap_string("me", mfp->str_norm, sizeof(mfp->str_norm)); - get_termcap_string("ce", mfp->str_clreoln, sizeof(mfp->str_clreoln)); - } - } -} -#endif /* TERMCAP_AVAILABLE */ - -static int -init_console(Console_IO_t * const mfp) -{ - /* setup basics of brhist I/O channels */ - memset(mfp,0,sizeof(*mfp)); - mfp->disp_width = 80; - mfp->disp_height = 25; - mfp->Console_fp = stderr; - mfp->Error_fp = stderr; - mfp->Report_fp = NULL; - - /*mfp -> Console_buff = calloc ( 1, REPORT_BUFF_SIZE ); */ -// setvbuf(mfp->Console_fp, mfp->Console_buff, _IOFBF, sizeof(mfp->Console_buff)); -/* setvbuf ( mfp -> Error_fp , NULL , _IONBF, 0 ); */ - -#if defined(_WIN32) && !defined(__CYGWIN__) - mfp->Console_Handle = GetStdHandle(STD_ERROR_HANDLE); -#endif - - strcpy(mfp->str_up, "\033[A"); - -#ifdef HAVE_TERMCAP - apply_termcap_settings(mfp); -#endif /* TERMCAP_AVAILABLE */ - - mfp->ClassID = CLASS_ID; - -#if defined(_WIN32) && !defined(__CYGWIN__) -#else -#endif - return 0; -} - -static void -deinit_console(Console_IO_t * const mfp) -{ - if (mfp->Report_fp != NULL) { - fclose(mfp->Report_fp); - mfp->Report_fp = NULL; - } - fflush(mfp->Console_fp); -// setvbuf(mfp->Console_fp, NULL, _IONBF, (size_t) 0); - -// memset(mfp->Console_buff, 0x55, REPORT_BUFF_SIZE); -} - - -/* LAME console - */ -Console_IO_t Console_IO; - -int -frontend_open_console(void) -{ - return init_console(&Console_IO); -} - -void -frontend_close_console(void) -{ - deinit_console(&Console_IO); -} - -void -frontend_debugf(const char *format, va_list ap) -{ - (void) my_report_printing(Console_IO.Report_fp, format, ap); -} - -void -frontend_msgf(const char *format, va_list ap) -{ - (void) my_console_printing(Console_IO.Console_fp, format, ap); -} - -void -frontend_errorf(const char *format, va_list ap) -{ - (void) my_error_printing(Console_IO.Error_fp, format, ap); -} - -void -frontend_print_null(const char *format, va_list ap) -{ - (void) format; - (void) ap; -} - -int -console_printf(const char *format, ...) -{ - va_list args; - int ret; - - va_start(args, format); - ret = my_console_printing(Console_IO.Console_fp, format, args); - va_end(args); - - return ret; -} - -int -error_printf(const char *format, ...) -{ - va_list args; - int ret; - - va_start(args, format); - ret = my_console_printing(Console_IO.Error_fp, format, args); - va_end(args); - - return ret; -} - -int -report_printf(const char *format, ...) -{ - va_list args; - int ret; - - va_start(args, format); - ret = my_console_printing(Console_IO.Report_fp, format, args); - va_end(args); - - return ret; -} - -void -console_flush() -{ - fflush(Console_IO.Console_fp); -} - -void -error_flush() -{ - fflush(Console_IO.Error_fp); -} - -void -report_flush() -{ - fflush(Console_IO.Report_fp); -} - -void -console_up(int n_lines) -{ - while (n_lines-- > 0) - fputs(Console_IO.str_up, Console_IO.Console_fp); - console_flush(); -} - - -void -set_debug_file(const char *fn) -{ - if (Console_IO.Report_fp == NULL) { - Console_IO.Report_fp = lame_fopen(fn, "a"); - if (Console_IO.Report_fp != NULL) { - error_printf("writing debug info into: %s\n", fn); - } - else { - error_printf("Error: can't open for debug info: %s\n", fn); - } - } -} - -/* end of console.c */ diff --git a/src/lib/dl/ext/lame/console.h b/src/lib/dl/ext/lame/console.h deleted file mode 100755 index ca46b054..00000000 --- a/src/lib/dl/ext/lame/console.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * frontend/console.h - * - * This - * - * - */ - -#ifndef LAME_CONSOLE_H -#define LAME_CONSOLE_H - -#if defined(_WIN32) && !defined(__CYGWIN__) -# include -#endif - -#if defined(__cplusplus) -extern "C" { -#endif - -typedef struct console_io_struct { - unsigned long ClassID; - unsigned long ClassProt; - FILE *Console_fp; /* filepointer to stream reporting information */ - FILE *Error_fp; /* filepointer to stream fatal error reporting information */ - FILE *Report_fp; /* filepointer to stream reports (normally a text file or /dev/null) */ -#if defined(_WIN32) && !defined(__CYGWIN__) - HANDLE Console_Handle; -#endif - int disp_width; - int disp_height; - char str_up[10]; - char str_clreoln[10]; - char str_emph[10]; - char str_norm[10]; -} Console_IO_t; - -extern Console_IO_t Console_IO; -extern int frontend_open_console(void); -extern void frontend_close_console(void); - -extern void frontend_msgf(const char *format, va_list ap); -extern void frontend_debugf(const char *format, va_list ap); -extern void frontend_errorf(const char *format, va_list ap); -extern void frontend_print_null(const char *format, va_list ap); - -int console_printf(const char *format, ...); -int error_printf(const char *format, ...); -int report_printf(const char *format, ...); - -void console_flush(void); -void error_flush(void); -void report_flush(void); - -void console_up(int n_lines); - -void set_debug_file(const char *fn); - -#if defined(__cplusplus) -} -#endif - -#endif /* LAME_CONSOLE_H */ - -/* end of console.h */ diff --git a/src/lib/dl/ext/lame/dct64_i386.c b/src/lib/dl/ext/lame/dct64_i386.c deleted file mode 100755 index 0bf1509e..00000000 --- a/src/lib/dl/ext/lame/dct64_i386.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * dct64_i368.c - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - * - * - * 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: dct64_i386.c,v 1.14 2010/03/22 14:30:19 robert Exp $ */ - -#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) -{ - - { - 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]; - } - - - { - 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]; - } - - { - 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]; - } - - { - real const cos0 = pnts[3][0]; - 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; - } - - { - 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/src/lib/dl/ext/lame/dct64_i386.h b/src/lib/dl/ext/lame/dct64_i386.h deleted file mode 100755 index a140ee71..00000000 --- a/src/lib/dl/ext/lame/dct64_i386.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 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/src/lib/dl/ext/lame/decode_i386.c b/src/lib/dl/ext/lame/decode_i386.c deleted file mode 100755 index 8ffcab36..00000000 --- a/src/lib/dl/ext/lame/decode_i386.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * decode_i396.c: Mpeg Layer-1,2,3 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - * - * - * 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: decode_i386.c,v 1.22 2010/03/22 14:30:19 robert Exp $ */ - -#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_CLIPPED */ -#define WRITE_SAMPLE_CLIPPED(TYPE,samples,sum,clip) \ - if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ - else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ - else { *(samples) = (TYPE)((sum)>0 ? (sum)+0.5 : (sum)-0.5) ; } - -#define WRITE_SAMPLE_UNCLIPPED(TYPE,samples,sum,clip) \ - *samples = (TYPE)sum; - - /* *INDENT-OFF* */ - - /* versions: clipped (when TYPE == short) and unclipped (when TYPE == real) of synth_1to1_mono* functions */ -#define SYNTH_1TO1_MONO_CLIPCHOICE(TYPE,SYNTH_1TO1) \ - TYPE samples_tmp[64]; \ - TYPE *tmp1 = samples_tmp; \ - int i,ret; \ - int pnt1 = 0; \ - \ - ret = SYNTH_1TO1 (mp,bandPtr,0,(unsigned char *) samples_tmp,&pnt1); \ - out += *pnt; \ - \ - for(i=0;i<32;i++) { \ - *( (TYPE *) out) = *tmp1; \ - out += sizeof(TYPE); \ - tmp1 += 2; \ - } \ - *pnt += 32*sizeof(TYPE); \ - \ - return ret; - - /* *INDENT-ON* */ - - -int -synth_1to1_mono(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_MONO_CLIPCHOICE(short, synth_1to1) -} int -synth_1to1_mono_unclipped(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_MONO_CLIPCHOICE(real, synth_1to1_unclipped) -} - - /* *INDENT-OFF* */ -/* versions: clipped (when TYPE == short) and unclipped (when TYPE == real) of synth_1to1* functions */ -#define SYNTH_1TO1_CLIPCHOICE(TYPE,WRITE_SAMPLE) \ - static const int step = 2; \ - int bo; \ - TYPE *samples = (TYPE *) (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; \ - \ - { \ - 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 (TYPE,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 (TYPE,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 (TYPE,samples,sum,clip); \ - } \ - } \ - *pnt += 64*sizeof(TYPE); \ - \ - return clip; - /* *INDENT-ON* */ - - -int -synth_1to1(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_CLIPCHOICE(short, WRITE_SAMPLE_CLIPPED) -} int -synth_1to1_unclipped(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt) -{ - SYNTH_1TO1_CLIPCHOICE(real, WRITE_SAMPLE_UNCLIPPED) -} diff --git a/src/lib/dl/ext/lame/decode_i386.h b/src/lib/dl/ext/lame/decode_i386.h deleted file mode 100755 index 8fc9dbe8..00000000 --- a/src/lib/dl/ext/lame/decode_i386.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 DECODE_I386_H_INCLUDED -#define DECODE_I386_H_INCLUDED - -#include "common.h" - -int synth_1to1_mono(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt); -int synth_1to1(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt); - -int synth_1to1_mono_unclipped(PMPSTR mp, real * bandPtr, unsigned char *out, int *pnt); -int synth_1to1_unclipped(PMPSTR mp, real * bandPtr, int channel, unsigned char *out, int *pnt); - -#endif diff --git a/src/lib/dl/ext/lame/encoder.c b/src/lib/dl/ext/lame/encoder.c deleted file mode 100755 index 86ec7ff0..00000000 --- a/src/lib/dl/ext/lame/encoder.c +++ /dev/null @@ -1,558 +0,0 @@ -/* - * LAME MP3 encoding engine - * - * Copyright (c) 1999 Mark Taylor - * Copyright (c) 2000-2002 Takehiro Tominaga - * Copyright (c) 2000-2011 Robert Hegemann - * Copyright (c) 2001 Gabriel Bouvigne - * Copyright (c) 2001 John Dahlstrom - * - * 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. - */ - -/* $Id: encoder.c,v 1.111 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "lame_global_flags.h" -#include "newmdct.h" -#include "psymodel.h" -#include "lame-analysis.h" -#include "bitstream.h" -#include "vbrtag.h" -#include "quantize_pvt.h" - - - -/* - * auto-adjust of ATH, useful for low volume - * Gabriel Bouvigne 3 feb 2001 - * - * modifies some values in - * gfp->internal_flags->ATH - * (gfc->ATH) - */ -static void -adjust_ATH(lame_internal_flags const *const gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - FLOAT gr2_max, max_pow; - - if (gfc->ATH->use_adjust == 0) { - gfc->ATH->adjust_factor = 1.0; /* no adjustment */ - return; - } - - /* jd - 2001 mar 12, 27, jun 30 */ - /* loudness based on equal loudness curve; */ - /* use granule with maximum combined loudness */ - max_pow = gfc->ov_psy.loudness_sq[0][0]; - gr2_max = gfc->ov_psy.loudness_sq[1][0]; - if (cfg->channels_out == 2) { - max_pow += gfc->ov_psy.loudness_sq[0][1]; - gr2_max += gfc->ov_psy.loudness_sq[1][1]; - } - else { - max_pow += max_pow; - gr2_max += gr2_max; - } - if (cfg->mode_gr == 2) { - max_pow = Max(max_pow, gr2_max); - } - max_pow *= 0.5; /* max_pow approaches 1.0 for full band noise */ - - /* jd - 2001 mar 31, jun 30 */ - /* user tuning of ATH adjustment region */ - max_pow *= gfc->ATH->aa_sensitivity_p; - - /* adjust ATH depending on range of maximum value - */ - - /* jd - 2001 feb27, mar12,20, jun30, jul22 */ - /* continuous curves based on approximation */ - /* to GB's original values. */ - /* For an increase in approximate loudness, */ - /* set ATH adjust to adjust_limit immediately */ - /* after a delay of one frame. */ - /* For a loudness decrease, reduce ATH adjust */ - /* towards adjust_limit gradually. */ - /* max_pow is a loudness squared or a power. */ - if (max_pow > 0.03125) { /* ((1 - 0.000625)/ 31.98) from curve below */ - if (gfc->ATH->adjust_factor >= 1.0) { - gfc->ATH->adjust_factor = 1.0; - } - else { - /* preceding frame has lower ATH adjust; */ - /* ascend only to the preceding adjust_limit */ - /* in case there is leading low volume */ - if (gfc->ATH->adjust_factor < gfc->ATH->adjust_limit) { - gfc->ATH->adjust_factor = gfc->ATH->adjust_limit; - } - } - gfc->ATH->adjust_limit = 1.0; - } - else { /* adjustment curve */ - /* about 32 dB maximum adjust (0.000625) */ - FLOAT const adj_lim_new = 31.98 * max_pow + 0.000625; - if (gfc->ATH->adjust_factor >= adj_lim_new) { /* descend gradually */ - gfc->ATH->adjust_factor *= adj_lim_new * 0.075 + 0.925; - if (gfc->ATH->adjust_factor < adj_lim_new) { /* stop descent */ - gfc->ATH->adjust_factor = adj_lim_new; - } - } - else { /* ascend */ - if (gfc->ATH->adjust_limit >= adj_lim_new) { - gfc->ATH->adjust_factor = adj_lim_new; - } - else { /* preceding frame has lower ATH adjust; */ - /* ascend only to the preceding adjust_limit */ - if (gfc->ATH->adjust_factor < gfc->ATH->adjust_limit) { - gfc->ATH->adjust_factor = gfc->ATH->adjust_limit; - } - } - } - gfc->ATH->adjust_limit = adj_lim_new; - } -} - -/*********************************************************************** - * - * some simple statistics - * - * bitrate index 0: free bitrate -> not allowed in VBR mode - * : bitrates, kbps depending on MPEG version - * bitrate index 15: forbidden - * - * mode_ext: - * 0: LR - * 1: LR-i - * 2: MS - * 3: MS-i - * - ***********************************************************************/ - -static void -updateStats(lame_internal_flags * const gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *eov = &gfc->ov_enc; - int gr, ch; - assert(0 <= eov->bitrate_index && eov->bitrate_index < 16); - assert(0 <= eov->mode_ext && eov->mode_ext < 4); - - /* count bitrate indices */ - eov->bitrate_channelmode_hist[eov->bitrate_index][4]++; - eov->bitrate_channelmode_hist[15][4]++; - - /* count 'em for every mode extension in case of 2 channel encoding */ - if (cfg->channels_out == 2) { - eov->bitrate_channelmode_hist[eov->bitrate_index][eov->mode_ext]++; - eov->bitrate_channelmode_hist[15][eov->mode_ext]++; - } - for (gr = 0; gr < cfg->mode_gr; ++gr) { - for (ch = 0; ch < cfg->channels_out; ++ch) { - int bt = gfc->l3_side.tt[gr][ch].block_type; - if (gfc->l3_side.tt[gr][ch].mixed_block_flag) - bt = 4; - eov->bitrate_blocktype_hist[eov->bitrate_index][bt]++; - eov->bitrate_blocktype_hist[eov->bitrate_index][5]++; - eov->bitrate_blocktype_hist[15][bt]++; - eov->bitrate_blocktype_hist[15][5]++; - } - } -} - - - - -static void -lame_encode_frame_init(lame_internal_flags * gfc, const sample_t *const inbuf[2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - - int ch, gr; - - if (gfc->lame_encode_frame_init == 0) { - sample_t primebuff0[286 + 1152 + 576]; - sample_t primebuff1[286 + 1152 + 576]; - int const framesize = 576 * cfg->mode_gr; - /* prime the MDCT/polyphase filterbank with a short block */ - int i, j; - gfc->lame_encode_frame_init = 1; - memset(primebuff0, 0, sizeof(primebuff0)); - memset(primebuff1, 0, sizeof(primebuff1)); - for (i = 0, j = 0; i < 286 + 576 * (1 + cfg->mode_gr); ++i) { - if (i < framesize) { - primebuff0[i] = 0; - if (cfg->channels_out == 2) - primebuff1[i] = 0; - } - else { - primebuff0[i] = inbuf[0][j]; - if (cfg->channels_out == 2) - primebuff1[i] = inbuf[1][j]; - ++j; - } - } - /* polyphase filtering / mdct */ - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gfc->l3_side.tt[gr][ch].block_type = SHORT_TYPE; - } - } - mdct_sub48(gfc, primebuff0, primebuff1); - - /* check FFT will not use a negative starting offset */ -#if 576 < FFTOFFSET -# error FFTOFFSET greater than 576: FFT uses a negative offset -#endif - /* check if we have enough data for FFT */ - assert(gfc->sv_enc.mf_size >= (BLKSIZE + framesize - FFTOFFSET)); - /* check if we have enough data for polyphase filterbank */ - assert(gfc->sv_enc.mf_size >= (512 + framesize - 32)); - } - -} - - - - - - - -/************************************************************************ -* -* encodeframe() Layer 3 -* -* encode a single frame -* -************************************************************************ -lame_encode_frame() - - - gr 0 gr 1 -inbuf: |--------------|--------------|--------------| - - -Polyphase (18 windows, each shifted 32) -gr 0: -window1 <----512----> -window18 <----512----> - -gr 1: -window1 <----512----> -window18 <----512----> - - - -MDCT output: |--------------|--------------|--------------| - -FFT's <---------1024----------> - <---------1024--------> - - - - inbuf = buffer of PCM data size=MP3 framesize - encoder acts on inbuf[ch][0], but output is delayed by MDCTDELAY - so the MDCT coefficints are from inbuf[ch][-MDCTDELAY] - - psy-model FFT has a 1 granule delay, so we feed it data for the - next granule. - FFT is centered over granule: 224+576+224 - So FFT starts at: 576-224-MDCTDELAY - - MPEG2: FFT ends at: BLKSIZE+576-224-MDCTDELAY (1328) - MPEG1: FFT ends at: BLKSIZE+2*576-224-MDCTDELAY (1904) - - MPEG2: polyphase first window: [0..511] - 18th window: [544..1055] (1056) - MPEG1: 36th window: [1120..1631] (1632) - data needed: 512+framesize-32 - - A close look newmdct.c shows that the polyphase filterbank - only uses data from [0..510] for each window. Perhaps because the window - used by the filterbank is zero for the last point, so Takehiro's - code doesn't bother to compute with it. - - FFT starts at 576-224-MDCTDELAY (304) = 576-FFTOFFSET - -*/ - -typedef FLOAT chgrdata[2][2]; - - -int -lame_encode_mp3_frame( /* Output */ - lame_internal_flags * gfc, /* Context */ - sample_t const *inbuf_l, /* Input */ - sample_t const *inbuf_r, /* Input */ - unsigned char *mp3buf, /* Output */ - int mp3buf_size) -{ /* Output */ - SessionConfig_t const *const cfg = &gfc->cfg; - int mp3count; - static III_psy_ratio masking_LR[2][2]; /*LR masking & energy */ - static III_psy_ratio masking_MS[2][2]; /*MS masking & energy */ - const III_psy_ratio (*masking)[2]; /*pointer to selected maskings */ - const sample_t *inbuf[2]; - - static FLOAT tot_ener[2][4]; - FLOAT ms_ener_ratio[2] = { .5, .5 }; - FLOAT pe[2][2] = { {0., 0.}, {0., 0.} }, pe_MS[2][2] = { { - 0., 0.}, { - 0., 0.}}; - FLOAT (*pe_use)[2]; - - int ch, gr; - - inbuf[0] = inbuf_l; - inbuf[1] = inbuf_r; - - if (gfc->lame_encode_frame_init == 0) { - /*first run? */ - lame_encode_frame_init(gfc, inbuf); - - } - - - /********************** padding *****************************/ - /* padding method as described in - * "MPEG-Layer3 / Bitstream Syntax and Decoding" - * by Martin Sieler, Ralph Sperschneider - * - * note: there is no padding for the very first frame - * - * Robert Hegemann 2000-06-22 - */ - gfc->ov_enc.padding = FALSE; - if ((gfc->sv_enc.slot_lag -= gfc->sv_enc.frac_SpF) < 0) { - gfc->sv_enc.slot_lag += cfg->samplerate_out; - gfc->ov_enc.padding = TRUE; - } - - - - /**************************************** - * Stage 1: psychoacoustic model * - ****************************************/ - - { - /* psychoacoustic model - * psy model has a 1 granule (576) delay that we must compensate for - * (mt 6/99). - */ - int ret; - const sample_t *bufp[2] = {0, 0}; /* address of beginning of left & right granule */ - int blocktype[2]; - - for (gr = 0; gr < cfg->mode_gr; gr++) { - - for (ch = 0; ch < cfg->channels_out; ch++) { - bufp[ch] = &inbuf[ch][576 + gr * 576 - FFTOFFSET]; - } - - ret = L3psycho_anal_vbr(gfc, bufp, gr, - masking_LR, masking_MS, - pe[gr], pe_MS[gr], tot_ener[gr], blocktype); - if (ret != 0) - return -4; - - if (cfg->mode == JOINT_STEREO) { - ms_ener_ratio[gr] = tot_ener[gr][2] + tot_ener[gr][3]; - if (ms_ener_ratio[gr] > 0) - ms_ener_ratio[gr] = tot_ener[gr][3] / ms_ener_ratio[gr]; - } - - /* block type flags */ - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info *const cod_info = &gfc->l3_side.tt[gr][ch]; - cod_info->block_type = blocktype[ch]; - cod_info->mixed_block_flag = 0; - } - } - } - - - /* auto-adjust of ATH, useful for low volume */ - adjust_ATH(gfc); - - - /**************************************** - * Stage 2: MDCT * - ****************************************/ - - /* polyphase filtering / mdct */ - mdct_sub48(gfc, inbuf[0], inbuf[1]); - - - /**************************************** - * Stage 3: MS/LR decision * - ****************************************/ - - /* Here will be selected MS or LR coding of the 2 stereo channels */ - gfc->ov_enc.mode_ext = MPG_MD_LR_LR; - - if (cfg->force_ms) { - gfc->ov_enc.mode_ext = MPG_MD_MS_LR; - } - else if (cfg->mode == JOINT_STEREO) { - /* ms_ratio = is scaled, for historical reasons, to look like - a ratio of side_channel / total. - 0 = signal is 100% mono - .5 = L & R uncorrelated - */ - - /* [0] and [1] are the results for the two granules in MPEG-1, - * in MPEG-2 it's only a faked averaging of the same value - * _prev is the value of the last granule of the previous frame - * _next is the value of the first granule of the next frame - */ - - FLOAT sum_pe_MS = 0; - FLOAT sum_pe_LR = 0; - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - sum_pe_MS += pe_MS[gr][ch]; - sum_pe_LR += pe[gr][ch]; - } - } - - /* based on PE: M/S coding would not use much more bits than L/R */ - if (sum_pe_MS <= 1.00 * sum_pe_LR) { - - gr_info const *const gi0 = &gfc->l3_side.tt[0][0]; - gr_info const *const gi1 = &gfc->l3_side.tt[cfg->mode_gr - 1][0]; - - if (gi0[0].block_type == gi0[1].block_type && gi1[0].block_type == gi1[1].block_type) { - - gfc->ov_enc.mode_ext = MPG_MD_MS_LR; - } - } - } - - /* bit and noise allocation */ - if (gfc->ov_enc.mode_ext == MPG_MD_MS_LR) { - masking = (const III_psy_ratio (*)[2])masking_MS; /* use MS masking */ - pe_use = pe_MS; - } - else { - masking = (const III_psy_ratio (*)[2])masking_LR; /* use LR masking */ - pe_use = pe; - } - - - /* copy data for MP3 frame analyzer */ - if (cfg->analysis && gfc->pinfo != NULL) { - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gfc->pinfo->ms_ratio[gr] = 0; - gfc->pinfo->ms_ener_ratio[gr] = ms_ener_ratio[gr]; - gfc->pinfo->blocktype[gr][ch] = gfc->l3_side.tt[gr][ch].block_type; - gfc->pinfo->pe[gr][ch] = pe_use[gr][ch]; - memcpy(gfc->pinfo->xr[gr][ch], &gfc->l3_side.tt[gr][ch].xr[0], sizeof(FLOAT) * 576); - /* in psymodel, LR and MS data was stored in pinfo. - switch to MS data: */ - if (gfc->ov_enc.mode_ext == MPG_MD_MS_LR) { - gfc->pinfo->ers[gr][ch] = gfc->pinfo->ers[gr][ch + 2]; - memcpy(gfc->pinfo->energy[gr][ch], gfc->pinfo->energy[gr][ch + 2], - sizeof(gfc->pinfo->energy[gr][ch])); - } - } - } - } - - - /**************************************** - * Stage 4: quantization loop * - ****************************************/ - - if (cfg->vbr == vbr_off || cfg->vbr == vbr_abr) { - static FLOAT const fircoef[9] = { - -0.0207887 * 5, -0.0378413 * 5, -0.0432472 * 5, -0.031183 * 5, - 7.79609e-18 * 5, 0.0467745 * 5, 0.10091 * 5, 0.151365 * 5, - 0.187098 * 5 - }; - - int i; - FLOAT f; - - for (i = 0; i < 18; i++) - gfc->sv_enc.pefirbuf[i] = gfc->sv_enc.pefirbuf[i + 1]; - - f = 0.0; - for (gr = 0; gr < cfg->mode_gr; gr++) - for (ch = 0; ch < cfg->channels_out; ch++) - f += pe_use[gr][ch]; - gfc->sv_enc.pefirbuf[18] = f; - - f = gfc->sv_enc.pefirbuf[9]; - for (i = 0; i < 9; i++) - f += (gfc->sv_enc.pefirbuf[i] + gfc->sv_enc.pefirbuf[18 - i]) * fircoef[i]; - - f = (670 * 5 * cfg->mode_gr * cfg->channels_out) / f; - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - pe_use[gr][ch] *= f; - } - } - } - gfc->iteration_loop(gfc, (const FLOAT (*)[2])pe_use, ms_ener_ratio, masking); - - - /**************************************** - * Stage 5: bitstream formatting * - ****************************************/ - - - /* write the frame to the bitstream */ - (void) format_bitstream(gfc); - - /* copy mp3 bit buffer into array */ - mp3count = copy_buffer(gfc, mp3buf, mp3buf_size, 1); - - - if (cfg->write_lame_tag) { - AddVbrFrame(gfc); - } - - if (cfg->analysis && gfc->pinfo != NULL) { - int framesize = 576 * cfg->mode_gr; - for (ch = 0; ch < cfg->channels_out; ch++) { - int j; - for (j = 0; j < FFTOFFSET; j++) - gfc->pinfo->pcmdata[ch][j] = gfc->pinfo->pcmdata[ch][j + framesize]; - for (j = FFTOFFSET; j < 1600; j++) { - gfc->pinfo->pcmdata[ch][j] = inbuf[ch][j - FFTOFFSET]; - } - } - gfc->sv_qnt.masking_lower = 1.0; - - set_frame_pinfo(gfc, masking); - } - - ++gfc->ov_enc.frame_number; - - updateStats(gfc); - - return mp3count; -} diff --git a/src/lib/dl/ext/lame/encoder.h b/src/lib/dl/ext/lame/encoder.h deleted file mode 100755 index b06a7c64..00000000 --- a/src/lib/dl/ext/lame/encoder.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * encoder.h include file - * - * Copyright (c) 2000 Mark Taylor - * - * 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_ENCODER_H -#define LAME_ENCODER_H - -/*********************************************************************** -* -* encoder and decoder delays -* -***********************************************************************/ - -/* - * layer III enc->dec delay: 1056 (1057?) (observed) - * layer II enc->dec delay: 480 (481?) (observed) - * - * polyphase 256-16 (dec or enc) = 240 - * mdct 256+32 (9*32) (dec or enc) = 288 - * total: 512+16 - * - * My guess is that delay of polyphase filterbank is actualy 240.5 - * (there are technical reasons for this, see postings in mp3encoder). - * So total Encode+Decode delay = ENCDELAY + 528 + 1 - */ - -/* - * ENCDELAY The encoder delay. - * - * Minimum allowed is MDCTDELAY (see below) - * - * The first 96 samples will be attenuated, so using a value less than 96 - * will result in corrupt data for the first 96-ENCDELAY samples. - * - * suggested: 576 - * set to 1160 to sync with FhG. - */ - -#define ENCDELAY 576 - - - -/* - * make sure there is at least one complete frame after the - * last frame containing real data - * - * Using a value of 288 would be sufficient for a - * a very sophisticated decoder that can decode granule-by-granule instead - * of frame by frame. But lets not assume this, and assume the decoder - * will not decode frame N unless it also has data for frame N+1 - * - */ -/*#define POSTDELAY 288*/ -#define POSTDELAY 1152 - - - -/* - * delay of the MDCT used in mdct.c - * original ISO routines had a delay of 528! - * Takehiro's routines: - */ - -#define MDCTDELAY 48 -#define FFTOFFSET (224+MDCTDELAY) - -/* - * Most decoders, including the one we use, have a delay of 528 samples. - */ - -#define DECDELAY 528 - - -/* number of subbands */ -#define SBLIMIT 32 - -/* parition bands bands */ -#define CBANDS 64 - -/* number of critical bands/scale factor bands where masking is computed*/ -#define SBPSY_l 21 -#define SBPSY_s 12 - -/* total number of scalefactor bands encoded */ -#define SBMAX_l 22 -#define SBMAX_s 13 -#define PSFB21 6 -#define PSFB12 6 - - - -/* FFT sizes */ -#define BLKSIZE 1024 -#define HBLKSIZE (BLKSIZE/2 + 1) -#define BLKSIZE_s 256 -#define HBLKSIZE_s (BLKSIZE_s/2 + 1) - - -/* #define switch_pe 1800 */ -#define NORM_TYPE 0 -#define START_TYPE 1 -#define SHORT_TYPE 2 -#define STOP_TYPE 3 - -/* - * Mode Extention: - * When we are in stereo mode, there are 4 possible methods to store these - * two channels. The stereo modes -m? are using a subset of them. - * - * -ms: MPG_MD_LR_LR - * -mj: MPG_MD_LR_LR and MPG_MD_MS_LR - * -mf: MPG_MD_MS_LR - * -mi: all - */ -#if 0 -#define MPG_MD_LR_LR 0 -#define MPG_MD_LR_I 1 -#define MPG_MD_MS_LR 2 -#define MPG_MD_MS_I 3 -#endif -enum MPEGChannelMode -{ MPG_MD_LR_LR = 0 -, MPG_MD_LR_I = 1 -, MPG_MD_MS_LR = 2 -, MPG_MD_MS_I = 3 -}; - -#ifndef lame_internal_flags_defined -#define lame_internal_flags_defined -struct lame_internal_flags; -typedef struct lame_internal_flags lame_internal_flags; -#endif - -int lame_encode_mp3_frame(lame_internal_flags * gfc, - sample_t const *inbuf_l, - sample_t const *inbuf_r, unsigned char *mp3buf, int mp3buf_size); - -#endif /* LAME_ENCODER_H */ diff --git a/src/lib/dl/ext/lame/fft.c b/src/lib/dl/ext/lame/fft.c deleted file mode 100755 index e8c59d9c..00000000 --- a/src/lib/dl/ext/lame/fft.c +++ /dev/null @@ -1,329 +0,0 @@ -/* -** FFT and FHT routines -** Copyright 1988, 1993; Ron Mayer -** Copyright (c) 1999-2000 Takehiro Tominaga -** -** fht(fz,n); -** Does a hartley transform of "n" points in the array "fz". -** -** NOTE: This routine uses at least 2 patented algorithms, and may be -** under the restrictions of a bunch of different organizations. -** Although I wrote it completely myself; it is kind of a derivative -** of a routine I once authored and released under the GPL, so it -** may fall under the free software foundation's restrictions; -** it was worked on as a Stanford Univ project, so they claim -** some rights to it; it was further optimized at work here, so -** I think this company claims parts of it. The patents are -** held by R. Bracewell (the FHT algorithm) and O. Buneman (the -** trig generator), both at Stanford Univ. -** If it were up to me, I'd say go do whatever you want with it; -** but it would be polite to give credit to the following people -** if you use this anywhere: -** Euler - probable inventor of the fourier transform. -** Gauss - probable inventor of the FFT. -** Hartley - probable inventor of the hartley transform. -** Buneman - for a really cool trig generator -** Mayer(me) - for authoring this particular version and -** including all the optimizations in one package. -** Thanks, -** Ron Mayer; mayer@acuson.com -** and added some optimization by -** Mather - idea of using lookup table -** Takehiro - some dirty hack for speed up -*/ - -/* $Id: fft.c,v 1.38 2009/04/20 21:48:00 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "fft.h" - -#include "vector/lame_intrin.h" - - - -#define TRI_SIZE (5-1) /* 1024 = 4**5 */ - -/* fft.c */ -static FLOAT window[BLKSIZE], window_s[BLKSIZE_s / 2]; - -static const FLOAT costab[TRI_SIZE * 2] = { - 9.238795325112867e-01, 3.826834323650898e-01, - 9.951847266721969e-01, 9.801714032956060e-02, - 9.996988186962042e-01, 2.454122852291229e-02, - 9.999811752826011e-01, 6.135884649154475e-03 -}; - -static void -fht(FLOAT * fz, int n) -{ - const FLOAT *tri = costab; - int k4; - FLOAT *fi, *gi; - FLOAT const *fn; - - n <<= 1; /* to get BLKSIZE, because of 3DNow! ASM routine */ - fn = fz + n; - k4 = 4; - do { - FLOAT s1, c1; - int i, k1, k2, k3, kx; - kx = k4 >> 1; - k1 = k4; - k2 = k4 << 1; - k3 = k2 + k1; - k4 = k2 << 1; - fi = fz; - gi = fi + kx; - do { - FLOAT f0, f1, f2, f3; - f1 = fi[0] - fi[k1]; - f0 = fi[0] + fi[k1]; - f3 = fi[k2] - fi[k3]; - f2 = fi[k2] + fi[k3]; - fi[k2] = f0 - f2; - fi[0] = f0 + f2; - fi[k3] = f1 - f3; - fi[k1] = f1 + f3; - f1 = gi[0] - gi[k1]; - f0 = gi[0] + gi[k1]; - f3 = SQRT2 * gi[k3]; - f2 = SQRT2 * gi[k2]; - gi[k2] = f0 - f2; - gi[0] = f0 + f2; - gi[k3] = f1 - f3; - gi[k1] = f1 + f3; - gi += k4; - fi += k4; - } while (fi < fn); - c1 = tri[0]; - s1 = tri[1]; - for (i = 1; i < kx; i++) { - FLOAT c2, s2; - c2 = 1 - (2 * s1) * s1; - s2 = (2 * s1) * c1; - fi = fz + i; - gi = fz + k1 - i; - do { - FLOAT a, b, g0, f0, f1, g1, f2, g2, f3, g3; - b = s2 * fi[k1] - c2 * gi[k1]; - a = c2 * fi[k1] + s2 * gi[k1]; - f1 = fi[0] - a; - f0 = fi[0] + a; - g1 = gi[0] - b; - g0 = gi[0] + b; - b = s2 * fi[k3] - c2 * gi[k3]; - a = c2 * fi[k3] + s2 * gi[k3]; - f3 = fi[k2] - a; - f2 = fi[k2] + a; - g3 = gi[k2] - b; - g2 = gi[k2] + b; - b = s1 * f2 - c1 * g3; - a = c1 * f2 + s1 * g3; - fi[k2] = f0 - a; - fi[0] = f0 + a; - gi[k3] = g1 - b; - gi[k1] = g1 + b; - b = c1 * g2 - s1 * f3; - a = s1 * g2 + c1 * f3; - gi[k2] = g0 - a; - gi[0] = g0 + a; - fi[k3] = f1 - b; - fi[k1] = f1 + b; - gi += k4; - fi += k4; - } while (fi < fn); - c2 = c1; - c1 = c2 * tri[0] - s1 * tri[1]; - s1 = c2 * tri[1] + s1 * tri[0]; - } - tri += 2; - } while (k4 < n); -} - - -static const unsigned char rv_tbl[] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe -}; - -#define ch01(index) (buffer[chn][index]) - -#define ml00(f) (window[i ] * f(i)) -#define ml10(f) (window[i + 0x200] * f(i + 0x200)) -#define ml20(f) (window[i + 0x100] * f(i + 0x100)) -#define ml30(f) (window[i + 0x300] * f(i + 0x300)) - -#define ml01(f) (window[i + 0x001] * f(i + 0x001)) -#define ml11(f) (window[i + 0x201] * f(i + 0x201)) -#define ml21(f) (window[i + 0x101] * f(i + 0x101)) -#define ml31(f) (window[i + 0x301] * f(i + 0x301)) - -#define ms00(f) (window_s[i ] * f(i + k)) -#define ms10(f) (window_s[0x7f - i] * f(i + k + 0x80)) -#define ms20(f) (window_s[i + 0x40] * f(i + k + 0x40)) -#define ms30(f) (window_s[0x3f - i] * f(i + k + 0xc0)) - -#define ms01(f) (window_s[i + 0x01] * f(i + k + 0x01)) -#define ms11(f) (window_s[0x7e - i] * f(i + k + 0x81)) -#define ms21(f) (window_s[i + 0x41] * f(i + k + 0x41)) -#define ms31(f) (window_s[0x3e - i] * f(i + k + 0xc1)) - - -void -fft_short(lame_internal_flags const *const gfc, - FLOAT x_real[3][BLKSIZE_s], int chn, const sample_t *const buffer[2]) -{ - int i; - int j; - int b; - - for (b = 0; b < 3; b++) { - FLOAT *x = &x_real[b][BLKSIZE_s / 2]; - short const k = (576 / 3) * (b + 1); - j = BLKSIZE_s / 8 - 1; - do { - FLOAT f0, f1, f2, f3, w; - - i = rv_tbl[j << 2]; - - f0 = ms00(ch01); - w = ms10(ch01); - f1 = f0 - w; - f0 = f0 + w; - f2 = ms20(ch01); - w = ms30(ch01); - f3 = f2 - w; - f2 = f2 + w; - - x -= 4; - x[0] = f0 + f2; - x[2] = f0 - f2; - x[1] = f1 + f3; - x[3] = f1 - f3; - - f0 = ms01(ch01); - w = ms11(ch01); - f1 = f0 - w; - f0 = f0 + w; - f2 = ms21(ch01); - w = ms31(ch01); - f3 = f2 - w; - f2 = f2 + w; - - x[BLKSIZE_s / 2 + 0] = f0 + f2; - x[BLKSIZE_s / 2 + 2] = f0 - f2; - x[BLKSIZE_s / 2 + 1] = f1 + f3; - x[BLKSIZE_s / 2 + 3] = f1 - f3; - } while (--j >= 0); - - gfc->fft_fht(x, BLKSIZE_s / 2); - /* BLKSIZE_s/2 because of 3DNow! ASM routine */ - } -} - -void -fft_long(lame_internal_flags const *const gfc, - FLOAT x[BLKSIZE], int chn, const sample_t *const buffer[2]) -{ - int i; - int jj = BLKSIZE / 8 - 1; - x += BLKSIZE / 2; - - do { - FLOAT f0, f1, f2, f3, w; - - i = rv_tbl[jj]; - f0 = ml00(ch01); - w = ml10(ch01); - f1 = f0 - w; - f0 = f0 + w; - f2 = ml20(ch01); - w = ml30(ch01); - f3 = f2 - w; - f2 = f2 + w; - - x -= 4; - x[0] = f0 + f2; - x[2] = f0 - f2; - x[1] = f1 + f3; - x[3] = f1 - f3; - - f0 = ml01(ch01); - w = ml11(ch01); - f1 = f0 - w; - f0 = f0 + w; - f2 = ml21(ch01); - w = ml31(ch01); - f3 = f2 - w; - f2 = f2 + w; - - x[BLKSIZE / 2 + 0] = f0 + f2; - x[BLKSIZE / 2 + 2] = f0 - f2; - x[BLKSIZE / 2 + 1] = f1 + f3; - x[BLKSIZE / 2 + 3] = f1 - f3; - } while (--jj >= 0); - - gfc->fft_fht(x, BLKSIZE / 2); - /* BLKSIZE/2 because of 3DNow! ASM routine */ -} - -#ifdef HAVE_NASM -extern void fht_3DN(FLOAT * fz, int n); -extern void fht_SSE(FLOAT * fz, int n); -#endif - -void -init_fft(lame_internal_flags * const gfc) -{ - int i; - - /* The type of window used here will make no real difference, but */ - /* in the interest of merging nspsytune stuff - switch to blackman window */ - for (i = 0; i < BLKSIZE; i++) - /* blackman window */ - window[i] = 0.42 - 0.5 * cos(2 * PI * (i + .5) / BLKSIZE) + - 0.08 * cos(4 * PI * (i + .5) / BLKSIZE); - - for (i = 0; i < BLKSIZE_s / 2; i++) - window_s[i] = 0.5 * (1.0 - cos(2.0 * PI * (i + 0.5) / BLKSIZE_s)); - - gfc->fft_fht = fht; -#ifdef HAVE_NASM - if (gfc->CPU_features.AMD_3DNow) { - gfc->fft_fht = fht_3DN; - } - else if (gfc->CPU_features.SSE) { - gfc->fft_fht = fht_SSE; - } - else { - gfc->fft_fht = fht; - } -#else -#ifdef HAVE_XMMINTRIN_H -#ifdef MIN_ARCH_SSE - gfc->fft_fht = fht_SSE2; -#endif -#endif -#endif -} diff --git a/src/lib/dl/ext/lame/fft.h b/src/lib/dl/ext/lame/fft.h deleted file mode 100755 index 258df887..00000000 --- a/src/lib/dl/ext/lame/fft.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Fast Fourier Transform include file - * - * Copyright (c) 2000 Mark Taylor - * - * 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_FFT_H -#define LAME_FFT_H - -void fft_long(lame_internal_flags const *const gfc, FLOAT x_real[BLKSIZE], - int chn, const sample_t *const data[2]); - -void fft_short(lame_internal_flags const *const gfc, FLOAT x_real[3][BLKSIZE_s], - int chn, const sample_t *const data[2]); - -void init_fft(lame_internal_flags * const gfc); - -#endif - -/* End of fft.h */ diff --git a/src/lib/dl/ext/lame/gain_analysis.c b/src/lib/dl/ext/lame/gain_analysis.c deleted file mode 100755 index 145458b4..00000000 --- a/src/lib/dl/ext/lame/gain_analysis.c +++ /dev/null @@ -1,518 +0,0 @@ -/* - * ReplayGainAnalysis - analyzes input samples and give the recommended dB change - * Copyright (C) 2001 David Robinson and Glen Sawyer - * Improvements and optimizations added by Frank Klemm, and by Marcel Muller - * - * 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 (mp3gain@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 ;) - * - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include "lame.h" -#include "machine.h" -#include "gain_analysis.h" - -/* 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 - -/*lint -save -e736 loss of precision */ -static const Float_t ABYule[9][2 * YULE_ORDER + 1] = { - {0.03857599435200, -3.84664617118067, -0.02160367184185, 7.81501653005538, -0.00123395316851, - -11.34170355132042, -0.00009291677959, 13.05504219327545, -0.01655260341619, - -12.28759895145294, 0.02161526843274, 9.48293806319790, -0.02074045215285, -5.87257861775999, - 0.00594298065125, 2.75465861874613, 0.00306428023191, -0.86984376593551, 0.00012025322027, - 0.13919314567432, 0.00288463683916}, - {0.05418656406430, -3.47845948550071, -0.02911007808948, 6.36317777566148, -0.00848709379851, - -8.54751527471874, -0.00851165645469, 9.47693607801280, -0.00834990904936, -8.81498681370155, - 0.02245293253339, 6.85401540936998, -0.02596338512915, -4.39470996079559, 0.01624864962975, - 2.19611684890774, -0.00240879051584, -0.75104302451432, 0.00674613682247, 0.13149317958808, - -0.00187763777362}, - {0.15457299681924, -2.37898834973084, -0.09331049056315, 2.84868151156327, -0.06247880153653, - -2.64577170229825, 0.02163541888798, 2.23697657451713, -0.05588393329856, -1.67148153367602, - 0.04781476674921, 1.00595954808547, 0.00222312597743, -0.45953458054983, 0.03174092540049, - 0.16378164858596, -0.01390589421898, -0.05032077717131, 0.00651420667831, 0.02347897407020, - -0.00881362733839}, - {0.30296907319327, -1.61273165137247, -0.22613988682123, 1.07977492259970, -0.08587323730772, - -0.25656257754070, 0.03282930172664, -0.16276719120440, -0.00915702933434, -0.22638893773906, - -0.02364141202522, 0.39120800788284, -0.00584456039913, -0.22138138954925, 0.06276101321749, - 0.04500235387352, -0.00000828086748, 0.02005851806501, 0.00205861885564, 0.00302439095741, - -0.02950134983287}, - {0.33642304856132, -1.49858979367799, -0.25572241425570, 0.87350271418188, -0.11828570177555, - 0.12205022308084, 0.11921148675203, -0.80774944671438, -0.07834489609479, 0.47854794562326, - -0.00469977914380, -0.12453458140019, -0.00589500224440, -0.04067510197014, 0.05724228140351, - 0.08333755284107, 0.00832043980773, -0.04237348025746, -0.01635381384540, 0.02977207319925, - -0.01760176568150}, - {0.44915256608450, -0.62820619233671, -0.14351757464547, 0.29661783706366, -0.22784394429749, - -0.37256372942400, -0.01419140100551, 0.00213767857124, 0.04078262797139, -0.42029820170918, - -0.12398163381748, 0.22199650564824, 0.04097565135648, 0.00613424350682, 0.10478503600251, - 0.06747620744683, -0.01863887810927, 0.05784820375801, -0.03193428438915, 0.03222754072173, - 0.00541907748707}, - {0.56619470757641, -1.04800335126349, -0.75464456939302, 0.29156311971249, 0.16242137742230, - -0.26806001042947, 0.16744243493672, 0.00819999645858, -0.18901604199609, 0.45054734505008, - 0.30931782841830, -0.33032403314006, -0.27562961986224, 0.06739368333110, 0.00647310677246, - -0.04784254229033, 0.08647503780351, 0.01639907836189, -0.03788984554840, 0.01807364323573, - -0.00588215443421}, - {0.58100494960553, -0.51035327095184, -0.53174909058578, -0.31863563325245, -0.14289799034253, - -0.20256413484477, 0.17520704835522, 0.14728154134330, 0.02377945217615, 0.38952639978999, - 0.15558449135573, -0.23313271880868, -0.25344790059353, -0.05246019024463, 0.01628462406333, - -0.02505961724053, 0.06920467763959, 0.02442357316099, -0.03721611395801, 0.01818801111503, - -0.00749618797172}, - {0.53648789255105, -0.25049871956020, -0.42163034350696, -0.43193942311114, -0.00275953611929, - -0.03424681017675, 0.04267842219415, -0.04678328784242, -0.10214864179676, 0.26408300200955, - 0.14590772289388, 0.15113130533216, -0.02459864859345, -0.17556493366449, -0.11202315195388, - -0.18823009262115, -0.04060034127000, 0.05477720428674, 0.04788665548180, 0.04704409688120, - -0.02217936801134} -}; - -static const Float_t ABButter[9][2 * BUTTER_ORDER + 1] = { - {0.98621192462708, -1.97223372919527, -1.97242384925416, 0.97261396931306, 0.98621192462708}, - {0.98500175787242, -1.96977855582618, -1.97000351574484, 0.97022847566350, 0.98500175787242}, - {0.97938932735214, -1.95835380975398, -1.95877865470428, 0.95920349965459, 0.97938932735214}, - {0.97531843204928, -1.95002759149878, -1.95063686409857, 0.95124613669835, 0.97531843204928}, - {0.97316523498161, -1.94561023566527, -1.94633046996323, 0.94705070426118, 0.97316523498161}, - {0.96454515552826, -1.92783286977036, -1.92909031105652, 0.93034775234268, 0.96454515552826}, - {0.96009142950541, -1.91858953033784, -1.92018285901082, 0.92177618768381, 0.96009142950541}, - {0.95856916599601, -1.91542108074780, -1.91713833199203, 0.91885558323625, 0.95856916599601}, - {0.94597685600279, -1.88903307939452, -1.89195371200558, 0.89487434461664, 0.94597685600279} -}; - -/*lint -restore */ - -#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 -filterYule(const Float_t * input, Float_t * output, size_t nSamples, const Float_t * const kernel) -{ - /*register double y; */ - - while (nSamples--) { - *output = 1e-10 /* 1e-10 is a hack to avoid slowdown because of denormals */ - + input[0] * kernel[0] - - output[-1] * kernel[1] - + input[-1] * kernel[2] - - output[-2] * kernel[3] - + input[-2] * kernel[4] - - output[-3] * kernel[5] - + input[-3] * kernel[6] - - output[-4] * kernel[7] - + input[-4] * kernel[8] - - output[-5] * kernel[9] - + input[-5] * kernel[10] - - output[-6] * kernel[11] - + input[-6] * kernel[12] - - output[-7] * kernel[13] - + input[-7] * kernel[14] - - output[-8] * kernel[15] - + input[-8] * kernel[16] - - output[-9] * kernel[17] - + input[-9] * kernel[18] - - output[-10] * kernel[19] - + input[-10] * kernel[20]; - ++output; - ++input; - /* *output++ = (Float_t)y; */ - } -} - -static void -filterButter(const Float_t * input, Float_t * output, size_t nSamples, const Float_t * const kernel) -{ /*register double y; */ - - while (nSamples--) { - *output = input[0] * kernel[0] - - output[-1] * kernel[1] - + input[-1] * kernel[2] - - output[-2] * kernel[3] - + input[-2] * kernel[4]; - ++output; - ++input; - /* *output++ = (Float_t)y; */ - } -} - - - -static int ResetSampleFrequency(replaygain_t * rgData, long samplefreq); - -/* returns a INIT_GAIN_ANALYSIS_OK if successful, INIT_GAIN_ANALYSIS_ERROR if not */ - -int -ResetSampleFrequency(replaygain_t * rgData, long samplefreq) -{ - int i; - - /* zero out initial values */ - for (i = 0; i < MAX_ORDER; i++) - rgData->linprebuf[i] = rgData->lstepbuf[i] - = rgData->loutbuf[i] - = rgData->rinprebuf[i] - = rgData->rstepbuf[i] - = rgData->routbuf[i] = 0.; - - switch ((int) (samplefreq)) { - case 48000: - rgData->freqindex = 0; - break; - case 44100: - rgData->freqindex = 1; - break; - case 32000: - rgData->freqindex = 2; - break; - case 24000: - rgData->freqindex = 3; - break; - case 22050: - rgData->freqindex = 4; - break; - case 16000: - rgData->freqindex = 5; - break; - case 12000: - rgData->freqindex = 6; - break; - case 11025: - rgData->freqindex = 7; - break; - case 8000: - rgData->freqindex = 8; - break; - default: - return INIT_GAIN_ANALYSIS_ERROR; - } - - rgData->sampleWindow = - (samplefreq * RMS_WINDOW_TIME_NUMERATOR + RMS_WINDOW_TIME_DENOMINATOR - - 1) / RMS_WINDOW_TIME_DENOMINATOR; - - rgData->lsum = 0.; - rgData->rsum = 0.; - rgData->totsamp = 0; - - memset(rgData->A, 0, sizeof(rgData->A)); - - return INIT_GAIN_ANALYSIS_OK; -} - -int -InitGainAnalysis(replaygain_t * rgData, long samplefreq) -{ - if (ResetSampleFrequency(rgData, samplefreq) != INIT_GAIN_ANALYSIS_OK) { - return INIT_GAIN_ANALYSIS_ERROR; - } - - rgData->linpre = rgData->linprebuf + MAX_ORDER; - rgData->rinpre = rgData->rinprebuf + MAX_ORDER; - rgData->lstep = rgData->lstepbuf + MAX_ORDER; - rgData->rstep = rgData->rstepbuf + MAX_ORDER; - rgData->lout = rgData->loutbuf + MAX_ORDER; - rgData->rout = rgData->routbuf + MAX_ORDER; - - memset(rgData->B, 0, sizeof(rgData->B)); - - return INIT_GAIN_ANALYSIS_OK; -} - -/* returns GAIN_ANALYSIS_OK if successful, GAIN_ANALYSIS_ERROR if not */ - -static inline double -fsqr(const double d) -{ - return d * d; -} - -int -AnalyzeSamples(replaygain_t * rgData, 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 = (long) num_samples; - - switch (num_channels) { - case 1: - right_samples = left_samples; - break; - case 2: - break; - default: - return GAIN_ANALYSIS_ERROR; - } - - if (num_samples < MAX_ORDER) { - memcpy(rgData->linprebuf + MAX_ORDER, left_samples, num_samples * sizeof(Float_t)); - memcpy(rgData->rinprebuf + MAX_ORDER, right_samples, num_samples * sizeof(Float_t)); - } - else { - memcpy(rgData->linprebuf + MAX_ORDER, left_samples, MAX_ORDER * sizeof(Float_t)); - memcpy(rgData->rinprebuf + MAX_ORDER, right_samples, MAX_ORDER * sizeof(Float_t)); - } - - while (batchsamples > 0) { - cursamples = batchsamples > rgData->sampleWindow - rgData->totsamp ? - rgData->sampleWindow - rgData->totsamp : batchsamples; - if (cursamplepos < MAX_ORDER) { - curleft = rgData->linpre + cursamplepos; - curright = rgData->rinpre + cursamplepos; - if (cursamples > MAX_ORDER - cursamplepos) - cursamples = MAX_ORDER - cursamplepos; - } - else { - curleft = left_samples + cursamplepos; - curright = right_samples + cursamplepos; - } - - YULE_FILTER(curleft, rgData->lstep + rgData->totsamp, cursamples, - ABYule[rgData->freqindex]); - YULE_FILTER(curright, rgData->rstep + rgData->totsamp, cursamples, - ABYule[rgData->freqindex]); - - BUTTER_FILTER(rgData->lstep + rgData->totsamp, rgData->lout + rgData->totsamp, cursamples, - ABButter[rgData->freqindex]); - BUTTER_FILTER(rgData->rstep + rgData->totsamp, rgData->rout + rgData->totsamp, cursamples, - ABButter[rgData->freqindex]); - - curleft = rgData->lout + rgData->totsamp; /* Get the squared values */ - curright = rgData->rout + rgData->totsamp; - - i = cursamples % 8; - while (i--) { - rgData->lsum += fsqr(*curleft++); - rgData->rsum += fsqr(*curright++); - } - i = cursamples / 8; - while (i--) { - rgData->lsum += fsqr(curleft[0]) - + fsqr(curleft[1]) - + fsqr(curleft[2]) - + fsqr(curleft[3]) - + fsqr(curleft[4]) - + fsqr(curleft[5]) - + fsqr(curleft[6]) - + fsqr(curleft[7]); - curleft += 8; - rgData->rsum += fsqr(curright[0]) - + fsqr(curright[1]) - + fsqr(curright[2]) - + fsqr(curright[3]) - + fsqr(curright[4]) - + fsqr(curright[5]) - + fsqr(curright[6]) - + fsqr(curright[7]); - curright += 8; - } - - batchsamples -= cursamples; - cursamplepos += cursamples; - rgData->totsamp += cursamples; - if (rgData->totsamp == rgData->sampleWindow) { /* Get the Root Mean Square (RMS) for this set of samples */ - double const val = - STEPS_per_dB * 10. * log10((rgData->lsum + rgData->rsum) / rgData->totsamp * 0.5 + - 1.e-37); - size_t ival = (val <= 0) ? 0 : (size_t) val; - if (ival >= sizeof(rgData->A) / sizeof(*(rgData->A))) - ival = sizeof(rgData->A) / sizeof(*(rgData->A)) - 1; - rgData->A[ival]++; - rgData->lsum = rgData->rsum = 0.; - memmove(rgData->loutbuf, rgData->loutbuf + rgData->totsamp, - MAX_ORDER * sizeof(Float_t)); - memmove(rgData->routbuf, rgData->routbuf + rgData->totsamp, - MAX_ORDER * sizeof(Float_t)); - memmove(rgData->lstepbuf, rgData->lstepbuf + rgData->totsamp, - MAX_ORDER * sizeof(Float_t)); - memmove(rgData->rstepbuf, rgData->rstepbuf + rgData->totsamp, - MAX_ORDER * sizeof(Float_t)); - rgData->totsamp = 0; - } - if (rgData->totsamp > rgData->sampleWindow) /* somehow I really screwed up: Error in programming! Contact author about totsamp > sampleWindow */ - return GAIN_ANALYSIS_ERROR; - } - if (num_samples < MAX_ORDER) { - memmove(rgData->linprebuf, rgData->linprebuf + num_samples, - (MAX_ORDER - num_samples) * sizeof(Float_t)); - memmove(rgData->rinprebuf, rgData->rinprebuf + num_samples, - (MAX_ORDER - num_samples) * sizeof(Float_t)); - memcpy(rgData->linprebuf + MAX_ORDER - num_samples, left_samples, - num_samples * sizeof(Float_t)); - memcpy(rgData->rinprebuf + MAX_ORDER - num_samples, right_samples, - num_samples * sizeof(Float_t)); - } - else { - memcpy(rgData->linprebuf, left_samples + num_samples - MAX_ORDER, - MAX_ORDER * sizeof(Float_t)); - memcpy(rgData->rinprebuf, right_samples + num_samples - MAX_ORDER, - MAX_ORDER * sizeof(Float_t)); - } - - return GAIN_ANALYSIS_OK; -} - - -static Float_t -analyzeResult(uint32_t const *Array, size_t len) -{ - uint32_t elems; - uint32_t upper; - uint32_t sum; - size_t i; - - elems = 0; - for (i = 0; i < len; i++) - elems += Array[i]; - if (elems == 0) - return GAIN_NOT_ENOUGH_SAMPLES; - - upper = (uint32_t) ceil(elems * (1. - RMS_PERCENTILE)); - sum = 0; - for (i = len; i-- > 0;) { - sum += Array[i]; - if (sum >= upper) { - break; - } - } - - return (Float_t) ((Float_t) PINK_REF - (Float_t) i / (Float_t) STEPS_per_dB); -} - - -Float_t -GetTitleGain(replaygain_t * rgData) -{ - Float_t retval; - unsigned int i; - - retval = analyzeResult(rgData->A, sizeof(rgData->A) / sizeof(*(rgData->A))); - - for (i = 0; i < sizeof(rgData->A) / sizeof(*(rgData->A)); i++) { - rgData->B[i] += rgData->A[i]; - rgData->A[i] = 0; - } - - for (i = 0; i < MAX_ORDER; i++) - rgData->linprebuf[i] = rgData->lstepbuf[i] - = rgData->loutbuf[i] - = rgData->rinprebuf[i] - = rgData->rstepbuf[i] - = rgData->routbuf[i] = 0.f; - - rgData->totsamp = 0; - rgData->lsum = rgData->rsum = 0.; - return retval; -} - -#if 0 -static Float_t GetAlbumGain(replaygain_t const* rgData); - -Float_t -GetAlbumGain(replaygain_t const* rgData) -{ - return analyzeResult(rgData->B, sizeof(rgData->B) / sizeof(*(rgData->B))); -} -#endif - -/* end of gain_analysis.c */ diff --git a/src/lib/dl/ext/lame/gain_analysis.h b/src/lib/dl/ext/lame/gain_analysis.h deleted file mode 100755 index a6b56ab3..00000000 --- a/src/lib/dl/ext/lame/gain_analysis.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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 (mp3gain@hotmail.com) 735 W 255 N, Orem, UT 84057-4505 USA - * -- blame him if you think this runs too slowly, or the coding is otherwise flawed - * - * 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 - -#ifdef HAVE_INTTYPES_H -# include -#else -# ifdef HAVE_STDINT_H -# include -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - - typedef sample_t Float_t; /* Type used for filtering */ - - -#define PINK_REF 64.82 /* 298640883795 */ /* calibration value for 89dB */ - - -#define YULE_ORDER 10 -#define BUTTER_ORDER 2 -#define YULE_FILTER filterYule -#define BUTTER_FILTER filterButter -#define RMS_PERCENTILE 0.95 /* percentile which is louder than the proposed level */ -#define MAX_SAMP_FREQ 48000L /* maximum allowed sample frequency [Hz] */ -#define RMS_WINDOW_TIME_NUMERATOR 1L -#define RMS_WINDOW_TIME_DENOMINATOR 20L /* numerator / denominator = 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) */ - - enum { GAIN_NOT_ENOUGH_SAMPLES = -24601, GAIN_ANALYSIS_ERROR = 0, GAIN_ANALYSIS_OK = - 1, INIT_GAIN_ANALYSIS_ERROR = 0, INIT_GAIN_ANALYSIS_OK = 1 - }; - - enum { MAX_ORDER = (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER) - , MAX_SAMPLES_PER_WINDOW = ((MAX_SAMP_FREQ * RMS_WINDOW_TIME_NUMERATOR) / RMS_WINDOW_TIME_DENOMINATOR + 1) /* max. Samples per Time slice */ - }; - - struct replaygain_data { - Float_t linprebuf[MAX_ORDER * 2]; - Float_t *linpre; /* left input samples, with pre-buffer */ - Float_t lstepbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; - Float_t *lstep; /* left "first step" (i.e. post first filter) samples */ - Float_t loutbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; - Float_t *lout; /* left "out" (i.e. post second filter) samples */ - Float_t rinprebuf[MAX_ORDER * 2]; - Float_t *rinpre; /* right input samples ... */ - Float_t rstepbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; - Float_t *rstep; - Float_t routbuf[MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; - Float_t *rout; - long sampleWindow; /* number of samples required to reach number of milliseconds required for RMS window */ - long totsamp; - double lsum; - double rsum; - int freqindex; - int first; - uint32_t A[STEPS_per_dB * MAX_dB]; - uint32_t B[STEPS_per_dB * MAX_dB]; - - }; -#ifndef replaygain_data_defined -#define replaygain_data_defined - typedef struct replaygain_data replaygain_t; -#endif - - - - - int InitGainAnalysis(replaygain_t * rgData, long samplefreq); - int AnalyzeSamples(replaygain_t * rgData, const Float_t * left_samples, - const Float_t * right_samples, size_t num_samples, int num_channels); - Float_t GetTitleGain(replaygain_t * rgData); - - -#ifdef __cplusplus -} -#endif -#endif /* GAIN_ANALYSIS_H */ diff --git a/src/lib/dl/ext/lame/get_audio.c b/src/lib/dl/ext/lame/get_audio.c deleted file mode 100755 index 8e841267..00000000 --- a/src/lib/dl/ext/lame/get_audio.c +++ /dev/null @@ -1,2218 +0,0 @@ -/* - * Get Audio routines source file - * - * Copyright (c) 1999 Albert L Faber - * 2008-2011 Robert Hegemann - * - * 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. - */ - -/* $Id: get_audio.c,v 1.152.2.1 2011/11/18 08:38:04 robert Exp $ */ - - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include - -#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 - -#ifdef HAVE_INTTYPES_H -# include -#else -# ifdef HAVE_STDINT_H -# include -# endif -#endif - -#define MAX_U_32_NUM 0xFFFFFFFF - - -#include - -#if defined(__riscos__) -# include -# include -#elif defined(_WIN32) -# include -# include -#else -# include -#endif - -#ifdef __sun__ -/* woraround for SunOS 4.x, it has SEEK_* defined here */ -#include -#endif - -#include "lame.h" -#include "main.h" -#include "get_audio.h" -#include "lametime.h" -#include "console.h" - -#ifdef WITH_DMALLOC -#include -#endif - -#ifndef STR -# define __STR(x) #x -# define STR(x) __STR(x) -#define __LOC__ __FILE__ "("STR(__LINE__)") : " -#endif - - -#define FLOAT_TO_UNSIGNED(f) ((unsigned long)(((long)((f) - 2147483648.0)) + 2147483647L + 1)) -#define UNSIGNED_TO_FLOAT(u) (((double)((long)((u) - 2147483647L - 1))) + 2147483648.0) - -static unsigned int uint32_high_low(unsigned char *bytes) -{ - uint32_t const hh = bytes[0]; - uint32_t const hl = bytes[1]; - uint32_t const lh = bytes[2]; - uint32_t const ll = bytes[3]; - return (hh << 24) | (hl << 16) | (lh << 8) | ll; -} - -static double -read_ieee_extended_high_low(FILE * fp) -{ - unsigned char bytes[10]; - memset(bytes, 0, 10); - fread(bytes, 1, 10, fp); - { - int32_t const s = (bytes[0] & 0x80); - int32_t const e_h = (bytes[0] & 0x7F); - int32_t const e_l = bytes[1]; - int32_t e = (e_h << 8) | e_l; - uint32_t const hm = uint32_high_low(bytes + 2); - uint32_t const lm = uint32_high_low(bytes + 6); - double result = 0; - if (e != 0 || hm != 0 || lm != 0) { - if (e == 0x7fff) { - result = HUGE_VAL; - } - else { - double mantissa_h = UNSIGNED_TO_FLOAT(hm); - double mantissa_l = UNSIGNED_TO_FLOAT(lm); - e -= 0x3fff; - e -= 31; - result = ldexp(mantissa_h, e); - e -= 32; - result += ldexp(mantissa_l, e); - } - } - return s ? -result : result; - } -} - - -static int -read_16_bits_low_high(FILE * fp) -{ - unsigned char bytes[2] = { 0, 0 }; - fread(bytes, 1, 2, fp); - { - int32_t const low = bytes[0]; - int32_t const high = (signed char) (bytes[1]); - return (high << 8) | low; - } -} - - -static int -read_32_bits_low_high(FILE * fp) -{ - unsigned char bytes[4] = { 0, 0, 0, 0 }; - fread(bytes, 1, 4, fp); - { - int32_t const low = bytes[0]; - int32_t const medl = bytes[1]; - int32_t const medh = bytes[2]; - int32_t const high = (signed char) (bytes[3]); - return (high << 24) | (medh << 16) | (medl << 8) | low; - } -} - -static int -read_16_bits_high_low(FILE * fp) -{ - unsigned char bytes[2] = { 0, 0 }; - fread(bytes, 1, 2, fp); - { - int32_t const low = bytes[1]; - int32_t const high = (signed char) (bytes[0]); - return (high << 8) | low; - } -} - -static int -read_32_bits_high_low(FILE * fp) -{ - unsigned char bytes[4] = { 0, 0, 0, 0 }; - fread(bytes, 1, 4, fp); - { - int32_t const low = bytes[3]; - int32_t const medl = bytes[2]; - int32_t const medh = bytes[1]; - int32_t const high = (signed char) (bytes[0]); - return (high << 24) | (medh << 16) | (medl << 8) | low; - } -} - -static void -write_16_bits_low_high(FILE * fp, int val) -{ - unsigned char bytes[2]; - bytes[0] = (val & 0xff); - bytes[1] = ((val >> 8) & 0xff); - fwrite(bytes, 1, 2, fp); -} - -static void -write_32_bits_low_high(FILE * fp, int val) -{ - unsigned char bytes[4]; - bytes[0] = (val & 0xff); - bytes[1] = ((val >> 8) & 0xff); - bytes[2] = ((val >> 16) & 0xff); - bytes[3] = ((val >> 24) & 0xff); - fwrite(bytes, 1, 4, fp); -} - -#ifdef LIBSNDFILE - -#include - - -#else - -typedef void SNDFILE; - -#endif /* ifdef LIBSNDFILE */ - - - -typedef struct blockAlign_struct { - unsigned long offset; - unsigned long blockSize; -} blockAlign; - -typedef struct IFF_AIFF_struct { - short numChannels; - unsigned long numSampleFrames; - short sampleSize; - double sampleRate; - unsigned long sampleType; - blockAlign blkAlgn; -} IFF_AIFF; - - - -struct PcmBuffer { - void *ch[2]; /* buffer for each channel */ - int w; /* sample width */ - int n; /* number samples allocated */ - int u; /* number samples used */ - int skip_start; /* number samples to ignore at the beginning */ - int skip_end; /* number samples to ignore at the end */ -}; - -typedef struct PcmBuffer PcmBuffer; - -static void -initPcmBuffer(PcmBuffer * b, int w) -{ - b->ch[0] = 0; - b->ch[1] = 0; - b->w = w; - b->n = 0; - b->u = 0; - b->skip_start = 0; - b->skip_end = 0; -} - -static void -freePcmBuffer(PcmBuffer * b) -{ - if (b != 0) { - free(b->ch[0]); - free(b->ch[1]); - b->ch[0] = 0; - b->ch[1] = 0; - b->n = 0; - b->u = 0; - } -} - -static int -addPcmBuffer(PcmBuffer * b, void *a0, void *a1, int read) -{ - int a_n; - - if (b == 0) { - return 0; - } - if (read < 0) { - return b->u - b->skip_end; - } - if (b->skip_start >= read) { - b->skip_start -= read; - return b->u - b->skip_end; - } - a_n = read - b->skip_start; - - if (b != 0 && a_n > 0) { - int const b_free = b->n - b->u; - int const a_need = b->w * a_n; - int const b_used = b->w * b->u; - if (b_free < a_need) { - b->n += a_n; - b->ch[0] = realloc(b->ch[0], b->w * b->n); - b->ch[1] = realloc(b->ch[1], b->w * b->n); - } - b->u += a_n; - if (b->ch[0] != 0 && a0 != 0) { - char *src = a0; - memcpy((char *) b->ch[0] + b_used, src + b->skip_start, a_need); - } - if (b->ch[1] != 0 && a1 != 0) { - char *src = a1; - memcpy((char *) b->ch[1] + b_used, src + b->skip_start, a_need); - } - } - b->skip_start = 0; - return b->u - b->skip_end; -} - -static int -takePcmBuffer(PcmBuffer * b, void *a0, void *a1, int a_n, int mm) -{ - if (a_n > mm) { - a_n = mm; - } - if (b != 0 && a_n > 0) { - int const a_take = b->w * a_n; - if (a0 != 0 && b->ch[0] != 0) { - memcpy(a0, b->ch[0], a_take); - } - if (a1 != 0 && b->ch[1] != 0) { - memcpy(a1, b->ch[1], a_take); - } - b->u -= a_n; - if (b->u < 0) { - b->u = 0; - return a_n; - } - if (b->ch[0] != 0) { - memmove(b->ch[0], (char *) b->ch[0] + a_take, b->w * b->u); - } - if (b->ch[1] != 0) { - memmove(b->ch[1], (char *) b->ch[1] + a_take, b->w * b->u); - } - } - return a_n; -} - -/* global data for get_audio.c. */ -typedef struct get_audio_global_data_struct { - int count_samples_carefully; - int pcmbitwidth; - int pcmswapbytes; - int pcm_is_unsigned_8bit; - int pcm_is_ieee_float; - unsigned int num_samples_read; - FILE *music_in; - SNDFILE *snd_file; - hip_t hip; - PcmBuffer pcm32; - PcmBuffer pcm16; - size_t in_id3v2_size; - unsigned char* in_id3v2_tag; -} get_audio_global_data; - -static get_audio_global_data global; - - - -#ifdef AMIGA_MPEGA -int lame_decode_initfile(const char *fullname, mp3data_struct * const mp3data); -#else -int lame_decode_initfile(FILE * fd, mp3data_struct * mp3data, int *enc_delay, int *enc_padding); -#endif - -/* read mp3 file until mpglib returns one frame of PCM data */ -static int lame_decode_fromfile(FILE * fd, short int pcm_l[], short int pcm_r[], - mp3data_struct * mp3data); - - -static int read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read); -static int read_samples_mp3(lame_t gfp, FILE * musicin, short int mpg123pcm[2][1152]); -#ifdef LIBSNDFILE -static SNDFILE *open_snd_file(lame_t gfp, char const *inPath); -#endif -static FILE *open_mpeg_file(lame_t gfp, char const *inPath, int *enc_delay, int *enc_padding); -static FILE *open_wave_file(lame_t gfp, char const *inPath); -static int close_input_file(FILE * musicin); - - -static size_t -min_size_t(size_t a, size_t b) -{ - if (a < b) { - return a; - } - return b; -} - -enum ByteOrder machine_byte_order(void); - -enum ByteOrder -machine_byte_order(void) -{ - long one = 1; - return !(*((char *) (&one))) ? ByteOrderBigEndian : ByteOrderLittleEndian; -} - - - -/* Replacement for forward fseek(,,SEEK_CUR), because fseek() fails on pipes */ - - -static int -fskip(FILE * fp, long offset, int whence) -{ -#ifndef PIPE_BUF - char buffer[4096]; -#else - char buffer[PIPE_BUF]; -#endif - -/* S_ISFIFO macro is defined on newer Linuxes */ -#ifndef S_ISFIFO -# ifdef _S_IFIFO - /* _S_IFIFO is defined on Win32 and Cygwin */ -# define S_ISFIFO(m) (((m)&_S_IFIFO) == _S_IFIFO) -# endif -#endif - -#ifdef S_ISFIFO - /* fseek is known to fail on pipes with several C-Library implementations - workaround: 1) test for pipe - 2) for pipes, only relatvie seeking is possible - 3) and only in forward direction! - else fallback to old code - */ - { - int const fd = fileno(fp); - struct stat file_stat; - - if (fstat(fd, &file_stat) == 0) { - if (S_ISFIFO(file_stat.st_mode)) { - if (whence != SEEK_CUR || offset < 0) { - return -1; - } - while (offset > 0) { - size_t const bytes_to_skip = min_size_t(sizeof(buffer), offset); - size_t const read = fread(buffer, 1, bytes_to_skip, fp); - if (read < 1) { - return -1; - } - offset -= read; - } - return 0; - } - } - } -#endif - if (0 == fseek(fp, offset, whence)) { - return 0; - } - - if (whence != SEEK_CUR || offset < 0) { - if (global_ui_config.silent < 10) { - error_printf - ("fskip problem: Mostly the return status of functions is not evaluate so it is more secure to polute .\n"); - } - return -1; - } - - while (offset > 0) { - size_t const bytes_to_skip = min_size_t(sizeof(buffer), offset); - size_t const read = fread(buffer, 1, bytes_to_skip, fp); - if (read < 1) { - return -1; - } - offset -= read; - } - - return 0; -} - - -static off_t -lame_get_file_size(FILE * fp) -{ - struct stat sb; - int fd = fileno(fp); - - if (0 == fstat(fd, &sb)) - return sb.st_size; - return (off_t) - 1; -} - - -FILE * -init_outfile(char const *outPath, int decode) -{ - FILE *outf; - - /* open the output file */ - if (0 == strcmp(outPath, "-")) { - outf = stdout; - lame_set_stream_binary_mode(outf); - } - else { - outf = lame_fopen(outPath, "w+b"); -#ifdef __riscos__ - /* Assign correct file type */ - if (outf != NULL) { - char *p, *out_path = strdup(outPath); - for (p = out_path; *p; p++) { /* ugly, ugly to modify a string */ - switch (*p) { - case '.': - *p = '/'; - break; - case '/': - *p = '.'; - break; - } - } - SetFiletype(out_path, decode ? 0xFB1 /*WAV*/ : 0x1AD /*AMPEG*/); - free(out_path); - } -#else - (void) decode; -#endif - } - return outf; -} - - -static void -setSkipStartAndEnd(lame_t gfp, int enc_delay, int enc_padding) -{ - int skip_start = 0, skip_end = 0; - - if (global_decoder.mp3_delay_set) - skip_start = global_decoder.mp3_delay; - - switch (global_reader.input_format) { - case sf_mp123: - break; - - case sf_mp3: - if (skip_start == 0) { - if (enc_delay > -1 || enc_padding > -1) { - if (enc_delay > -1) - skip_start = enc_delay + 528 + 1; - if (enc_padding > -1) - skip_end = enc_padding - (528 + 1); - } - else - skip_start = lame_get_encoder_delay(gfp) + 528 + 1; - } - else { - /* user specified a value of skip. just add for decoder */ - skip_start += 528 + 1; /* mp3 decoder has a 528 sample delay, plus user supplied "skip" */ - } - break; - case sf_mp2: - skip_start += 240 + 1; - break; - case sf_mp1: - skip_start += 240 + 1; - break; - case sf_raw: - skip_start += 0; /* other formats have no delay *//* is += 0 not better ??? */ - break; - case sf_wave: - skip_start += 0; /* other formats have no delay *//* is += 0 not better ??? */ - break; - case sf_aiff: - skip_start += 0; /* other formats have no delay *//* is += 0 not better ??? */ - break; - default: - skip_start += 0; /* other formats have no delay *//* is += 0 not better ??? */ - break; - } - skip_start = skip_start < 0 ? 0 : skip_start; - skip_end = skip_end < 0 ? 0 : skip_end; - global. pcm16.skip_start = global.pcm32.skip_start = skip_start; - global. pcm16.skip_end = global.pcm32.skip_end = skip_end; -} - - - -int -init_infile(lame_t gfp, char const *inPath) -{ - int enc_delay = 0, enc_padding = 0; - /* open the input file */ - global. count_samples_carefully = 0; - global. num_samples_read = 0; - global. pcmbitwidth = global_raw_pcm.in_bitwidth; - global. pcmswapbytes = global_reader.swapbytes; - global. pcm_is_unsigned_8bit = global_raw_pcm.in_signed == 1 ? 0 : 1; - global. pcm_is_ieee_float = 0; - global. hip = 0; - global. music_in = 0; - global. snd_file = 0; - global. in_id3v2_size = 0; - global. in_id3v2_tag = 0; - if (is_mpeg_file_format(global_reader.input_format)) { - global. music_in = open_mpeg_file(gfp, inPath, &enc_delay, &enc_padding); - } - else { -#ifdef LIBSNDFILE - if (strcmp(inPath, "-") != 0) { /* not for stdin */ - global. snd_file = open_snd_file(gfp, inPath); - } -#endif - if (global.snd_file == 0) { - global. music_in = open_wave_file(gfp, inPath); - } - } - initPcmBuffer(&global.pcm32, sizeof(int)); - initPcmBuffer(&global.pcm16, sizeof(short)); - setSkipStartAndEnd(gfp, enc_delay, enc_padding); - { - unsigned long n = lame_get_num_samples(gfp); - if (n != MAX_U_32_NUM) { - unsigned long const discard = global.pcm32.skip_start + global.pcm32.skip_end; - lame_set_num_samples(gfp, n > discard ? n - discard : 0); - } - } - return (global.snd_file != NULL || global.music_in != NULL) ? 1 : -1; -} - -int -samples_to_skip_at_start(void) -{ - return global.pcm32.skip_start; -} - -int -samples_to_skip_at_end(void) -{ - return global.pcm32.skip_end; -} - -void -close_infile(void) -{ - close_input_file(global.music_in); -#ifdef LIBSNDFILE - if (global.snd_file) { - if (sf_close(global.snd_file) != 0) { - if (global_ui_config.silent < 10) { - error_printf("Could not close sound file \n"); - } - } - global. snd_file = 0; - } -#endif - freePcmBuffer(&global.pcm32); - freePcmBuffer(&global.pcm16); - global. music_in = 0; - free(global.in_id3v2_tag); - global.in_id3v2_tag = 0; - global.in_id3v2_size = 0; -} - - -static int - get_audio_common(lame_t gfp, int buffer[2][1152], short buffer16[2][1152]); - -/************************************************************************ -* -* get_audio() -* -* PURPOSE: reads a frame of audio data from a file to the buffer, -* aligns the data for future processing, and separates the -* left and right channels -* -************************************************************************/ -int -get_audio(lame_t gfp, int buffer[2][1152]) -{ - int used = 0, read = 0; - do { - read = get_audio_common(gfp, buffer, NULL); - used = addPcmBuffer(&global.pcm32, buffer[0], buffer[1], read); - } while (used <= 0 && read > 0); - if (read < 0) { - return read; - } - if (global_reader.swap_channel == 0) - return takePcmBuffer(&global.pcm32, buffer[0], buffer[1], used, 1152); - else - return takePcmBuffer(&global.pcm32, buffer[1], buffer[0], used, 1152); -} - -/* - get_audio16 - behave as the original get_audio function, with a limited - 16 bit per sample output -*/ -int -get_audio16(lame_t gfp, short buffer[2][1152]) -{ - int used = 0, read = 0; - do { - read = get_audio_common(gfp, NULL, buffer); - used = addPcmBuffer(&global.pcm16, buffer[0], buffer[1], read); - } while (used <= 0 && read > 0); - if (read < 0) { - return read; - } - if (global_reader.swap_channel == 0) - return takePcmBuffer(&global.pcm16, buffer[0], buffer[1], used, 1152); - else - return takePcmBuffer(&global.pcm16, buffer[1], buffer[0], used, 1152); -} - -/************************************************************************ - get_audio_common - central functionality of get_audio* - in: gfp - buffer output to the int buffer or 16-bit buffer - out: buffer int output (if buffer != NULL) - buffer16 16-bit output (if buffer == NULL) -returns: samples read -note: either buffer or buffer16 must be allocated upon call -*/ -static int -get_audio_common(lame_t gfp, int buffer[2][1152], short buffer16[2][1152]) -{ -/* NTS: Do *NOT* allocate these on the stack. This causes crashes with Open Watcom's default small stack size. */ - static short buf_tmp16[2][1152]; - static int insamp[2 * 1152]; - - int num_channels = lame_get_num_channels(gfp); - int samples_read; - int framesize; - int samples_to_read; - unsigned int remaining, tmp_num_samples; - int i; - int *p; - - /* - * NOTE: LAME can now handle arbritray size input data packets, - * so there is no reason to read the input data in chuncks of - * size "framesize". EXCEPT: the LAME graphical frame analyzer - * will get out of sync if we read more than framesize worth of data. - */ - - samples_to_read = framesize = lame_get_framesize(gfp); - assert(framesize <= 1152); - - /* get num_samples */ - if (is_mpeg_file_format(global_reader.input_format)) { - tmp_num_samples = global_decoder.mp3input_data.nsamp; - } - else { - tmp_num_samples = lame_get_num_samples(gfp); - } - - /* if this flag has been set, then we are carefull to read - * exactly num_samples and no more. This is useful for .wav and .aiff - * files which have id3 or other tags at the end. Note that if you - * are using LIBSNDFILE, this is not necessary - */ - if (global.count_samples_carefully) { - if (global.num_samples_read < tmp_num_samples) { - remaining = tmp_num_samples - global.num_samples_read; - } - else { - remaining = 0; - } - if (remaining < (unsigned int) framesize && 0 != tmp_num_samples) - /* in case the input is a FIFO (at least it's reproducible with - a FIFO) tmp_num_samples may be 0 and therefore remaining - would be 0, but we need to read some samples, so don't - change samples_to_read to the wrong value in this case */ - samples_to_read = remaining; - } - - if (is_mpeg_file_format(global_reader.input_format)) { - if (buffer != NULL) - samples_read = read_samples_mp3(gfp, global.music_in, buf_tmp16); - else - samples_read = read_samples_mp3(gfp, global.music_in, buffer16); - if (samples_read < 0) { - return samples_read; - } - } - else { - if (global.snd_file) { -#ifdef LIBSNDFILE - samples_read = sf_read_int(global.snd_file, insamp, num_channels * samples_to_read); -#else - samples_read = 0; -#endif - } - else { - samples_read = - read_samples_pcm(global.music_in, insamp, num_channels * samples_to_read); - } - if (samples_read < 0) { - return samples_read; - } - p = insamp + samples_read; - samples_read /= num_channels; - if (buffer != NULL) { /* output to int buffer */ - if (num_channels == 2) { - for (i = samples_read; --i >= 0;) { - buffer[1][i] = *--p; - buffer[0][i] = *--p; - } - } - else if (num_channels == 1) { - memset(buffer[1], 0, samples_read * sizeof(int)); - for (i = samples_read; --i >= 0;) { - buffer[0][i] = *--p; - } - } - else - assert(0); - } - else { /* convert from int; output to 16-bit buffer */ - if (num_channels == 2) { - for (i = samples_read; --i >= 0;) { - buffer16[1][i] = *--p >> (8 * sizeof(int) - 16); - buffer16[0][i] = *--p >> (8 * sizeof(int) - 16); - } - } - else if (num_channels == 1) { - memset(buffer16[1], 0, samples_read * sizeof(short)); - for (i = samples_read; --i >= 0;) { - buffer16[0][i] = *--p >> (8 * sizeof(int) - 16); - } - } - else - assert(0); - } - } - - /* LAME mp3 output 16bit - convert to int, if necessary */ - if (is_mpeg_file_format(global_reader.input_format)) { - if (buffer != NULL) { - for (i = samples_read; --i >= 0;) - buffer[0][i] = buf_tmp16[0][i] << (8 * sizeof(int) - 16); - if (num_channels == 2) { - for (i = samples_read; --i >= 0;) - buffer[1][i] = buf_tmp16[1][i] << (8 * sizeof(int) - 16); - } - else if (num_channels == 1) { - memset(buffer[1], 0, samples_read * sizeof(int)); - } - else - assert(0); - } - } - - - /* if num_samples = MAX_U_32_NUM, then it is considered infinitely long. - Don't count the samples */ - if (tmp_num_samples != MAX_U_32_NUM) - global. num_samples_read += samples_read; - - return samples_read; -} - - - -static int -read_samples_mp3(lame_t gfp, FILE * musicin, short int mpg123pcm[2][1152]) -{ - int out; -#if defined(AMIGA_MPEGA) || defined(HAVE_MPGLIB) - int samplerate; - static const char type_name[] = "MP3 file"; - - out = lame_decode_fromfile(musicin, mpg123pcm[0], mpg123pcm[1], &global_decoder.mp3input_data); - /* - * out < 0: error, probably EOF - * out = 0: not possible with lame_decode_fromfile() ??? - * out > 0: number of output samples - */ - if (out < 0) { - memset(mpg123pcm, 0, sizeof(**mpg123pcm) * 2 * 1152); - return 0; - } - - if (lame_get_num_channels(gfp) != global_decoder.mp3input_data.stereo) { - if (global_ui_config.silent < 10) { - error_printf("Error: number of channels has changed in %s - not supported\n", - type_name); - } - out = -1; - } - samplerate = global_reader.input_samplerate; - if (samplerate == 0) { - samplerate = global_decoder.mp3input_data.samplerate; - } - if (lame_get_in_samplerate(gfp) != samplerate) { - if (global_ui_config.silent < 10) { - error_printf("Error: sample frequency has changed in %s - not supported\n", type_name); - } - out = -1; - } -#else - out = -1; -#endif - return out; -} - - -int -WriteWaveHeader(FILE * const fp, int pcmbytes, int freq, int channels, int bits) -{ - int bytes = (bits + 7) / 8; - - /* quick and dirty, but documented */ - fwrite("RIFF", 1, 4, fp); /* label */ - write_32_bits_low_high(fp, pcmbytes + 44 - 8); /* length in bytes without header */ - fwrite("WAVEfmt ", 2, 4, fp); /* 2 labels */ - write_32_bits_low_high(fp, 2 + 2 + 4 + 4 + 2 + 2); /* length of PCM format declaration area */ - write_16_bits_low_high(fp, 1); /* is PCM? */ - write_16_bits_low_high(fp, channels); /* number of channels */ - write_32_bits_low_high(fp, freq); /* sample frequency in [Hz] */ - write_32_bits_low_high(fp, freq * channels * bytes); /* bytes per second */ - write_16_bits_low_high(fp, channels * bytes); /* bytes per sample time */ - write_16_bits_low_high(fp, bits); /* bits per sample */ - fwrite("data", 1, 4, fp); /* label */ - write_32_bits_low_high(fp, pcmbytes); /* length in bytes of raw PCM data */ - - return ferror(fp) ? -1 : 0; -} - - - - -#if defined(LIBSNDFILE) - -extern SNDFILE *sf_wchar_open(wchar_t const *wpath, int mode, SF_INFO * sfinfo); - -static SNDFILE * -open_snd_file(lame_t gfp, char const *inPath) -{ - char const *lpszFileName = inPath; - SNDFILE *gs_pSndFileIn = NULL; - SF_INFO gs_wfInfo; - - { -#ifdef _WIN32 - wchar_t *file_name = utf8ToUnicode(lpszFileName); -#endif - /* Try to open the sound file */ - memset(&gs_wfInfo, 0, sizeof(gs_wfInfo)); -#ifdef _WIN32 - gs_pSndFileIn = sf_wchar_open(file_name, SFM_READ, &gs_wfInfo); -#else - gs_pSndFileIn = sf_open(lpszFileName, SFM_READ, &gs_wfInfo); -#endif - - if (gs_pSndFileIn == NULL) { - if (global_raw_pcm.in_signed == 0 && global_raw_pcm.in_bitwidth != 8) { - error_printf("Unsigned input only supported with bitwidth 8\n"); - exit(1); - } - /* set some defaults incase input is raw PCM */ - gs_wfInfo.seekable = (global_reader.input_format != sf_raw); /* if user specified -r, set to not seekable */ - gs_wfInfo.samplerate = lame_get_in_samplerate(gfp); - gs_wfInfo.channels = lame_get_num_channels(gfp); - gs_wfInfo.format = SF_FORMAT_RAW; - if ((global_raw_pcm.in_endian == ByteOrderLittleEndian) ^ (global_reader.swapbytes != - 0)) { - gs_wfInfo.format |= SF_ENDIAN_LITTLE; - } - else { - gs_wfInfo.format |= SF_ENDIAN_BIG; - } - switch (global_raw_pcm.in_bitwidth) { - case 8: - gs_wfInfo.format |= - global_raw_pcm.in_signed == 0 ? SF_FORMAT_PCM_U8 : SF_FORMAT_PCM_S8; - break; - case 16: - gs_wfInfo.format |= SF_FORMAT_PCM_16; - break; - case 24: - gs_wfInfo.format |= SF_FORMAT_PCM_24; - break; - case 32: - gs_wfInfo.format |= SF_FORMAT_PCM_32; - break; - default: - break; - } -#ifdef _WIN32 - gs_pSndFileIn = sf_wchar_open(file_name, SFM_READ, &gs_wfInfo); -#else - gs_pSndFileIn = sf_open(lpszFileName, SFM_READ, &gs_wfInfo); -#endif - } -#ifdef _WIN32 - free(file_name); -#endif - - /* Check result */ - if (gs_pSndFileIn == NULL) { - sf_perror(gs_pSndFileIn); - if (global_ui_config.silent < 10) { - error_printf("Could not open sound file \"%s\".\n", lpszFileName); - } - exit(1); - } - sf_command(gs_pSndFileIn, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE); - - if ((gs_wfInfo.format & SF_FORMAT_RAW) == SF_FORMAT_RAW) { - global_reader.input_format = sf_raw; - } - -#ifdef _DEBUG_SND_FILE - printf("\n\nSF_INFO structure\n"); - printf("samplerate :%d\n", gs_wfInfo.samplerate); - printf("samples :%d\n", gs_wfInfo.frames); - printf("channels :%d\n", gs_wfInfo.channels); - printf("format :"); - - /* new formats from sbellon@sbellon.de 1/2000 */ - - switch (gs_wfInfo.format & SF_FORMAT_TYPEMASK) { - case SF_FORMAT_WAV: - printf("Microsoft WAV format (big endian). "); - break; - case SF_FORMAT_AIFF: - printf("Apple/SGI AIFF format (little endian). "); - break; - case SF_FORMAT_AU: - printf("Sun/NeXT AU format (big endian). "); - break; - /* - case SF_FORMAT_AULE: - DEBUGF("DEC AU format (little endian). "); - break; - */ - case SF_FORMAT_RAW: - printf("RAW PCM data. "); - break; - case SF_FORMAT_PAF: - printf("Ensoniq PARIS file format. "); - break; - case SF_FORMAT_SVX: - printf("Amiga IFF / SVX8 / SV16 format. "); - break; - case SF_FORMAT_NIST: - printf("Sphere NIST format. "); - break; - default: - assert(0); - break; - } - - switch (gs_wfInfo.format & SF_FORMAT_SUBMASK) { - /* - case SF_FORMAT_PCM: - DEBUGF("PCM data in 8, 16, 24 or 32 bits."); - break; - */ - case SF_FORMAT_FLOAT: - printf("32 bit Intel x86 floats."); - break; - case SF_FORMAT_ULAW: - printf("U-Law encoded."); - break; - case SF_FORMAT_ALAW: - printf("A-Law encoded."); - break; - case SF_FORMAT_IMA_ADPCM: - printf("IMA ADPCM."); - break; - case SF_FORMAT_MS_ADPCM: - printf("Microsoft ADPCM."); - break; - /* - case SF_FORMAT_PCM_BE: - DEBUGF("Big endian PCM data."); - break; - case SF_FORMAT_PCM_LE: - DEBUGF("Little endian PCM data."); - break; - */ - case SF_FORMAT_PCM_S8: - printf("Signed 8 bit PCM."); - break; - case SF_FORMAT_PCM_U8: - printf("Unsigned 8 bit PCM."); - break; - case SF_FORMAT_PCM_16: - printf("Signed 16 bit PCM."); - break; - case SF_FORMAT_PCM_24: - printf("Signed 24 bit PCM."); - break; - case SF_FORMAT_PCM_32: - printf("Signed 32 bit PCM."); - break; - /* - case SF_FORMAT_SVX_FIB: - DEBUGF("SVX Fibonacci Delta encoding."); - break; - case SF_FORMAT_SVX_EXP: - DEBUGF("SVX Exponential Delta encoding."); - break; - */ - default: - assert(0); - break; - } - - printf("\n"); - printf("sections :%d\n", gs_wfInfo.sections); - printf("seekable :\n", gs_wfInfo.seekable); -#endif - /* Check result */ - if (gs_pSndFileIn == NULL) { - sf_perror(gs_pSndFileIn); - if (global_ui_config.silent < 10) { - error_printf("Could not open sound file \"%s\".\n", lpszFileName); - } - exit(1); - } - - - (void) lame_set_num_samples(gfp, gs_wfInfo.frames); - if (-1 == lame_set_num_channels(gfp, gs_wfInfo.channels)) { - if (global_ui_config.silent < 10) { - error_printf("Unsupported number of channels: %ud\n", gs_wfInfo.channels); - } - exit(1); - } - if (global_reader.input_samplerate == 0) { - (void) lame_set_in_samplerate(gfp, gs_wfInfo.samplerate); - } - else { - (void) lame_set_in_samplerate(gfp, global_reader.input_samplerate); - } - global. pcmbitwidth = 32; - } -#if 0 - if (lame_get_num_samples(gfp) == MAX_U_32_NUM) { - /* try to figure out num_samples */ - double const flen = lame_get_file_size(lpszFileName); - if (flen >= 0) { - /* try file size, assume 2 bytes per sample */ - lame_set_num_samples(gfp, flen / (2 * lame_get_num_channels(gfp))); - } - } -#endif - return gs_pSndFileIn; -} - -#endif /* defined(LIBSNDFILE) */ - - - -/************************************************************************ -unpack_read_samples - read and unpack signed low-to-high byte or unsigned - single byte input. (used for read_samples function) - Output integers are stored in the native byte order - (little or big endian). -jd - in: samples_to_read - bytes_per_sample - swap_order - set for high-to-low byte order input stream - i/o: pcm_in - out: sample_buffer (must be allocated up to samples_to_read upon call) -returns: number of samples read -*/ -static int -unpack_read_samples(const int samples_to_read, const int bytes_per_sample, - const int swap_order, int *sample_buffer, FILE * pcm_in) -{ - size_t samples_read; - int i; - int *op; /* output pointer */ - unsigned char *ip = (unsigned char *) sample_buffer; /* input pointer */ - const int b = sizeof(int) * 8; - -#define GA_URS_IFLOOP( ga_urs_bps ) \ - if( bytes_per_sample == ga_urs_bps ) \ - for( i = samples_read * bytes_per_sample; (i -= bytes_per_sample) >=0;) - - samples_read = fread(sample_buffer, bytes_per_sample, samples_to_read, pcm_in); - op = sample_buffer + samples_read; - - if (swap_order == 0) { - GA_URS_IFLOOP(1) - * --op = ip[i] << (b - 8); - GA_URS_IFLOOP(2) - * --op = ip[i] << (b - 16) | ip[i + 1] << (b - 8); - GA_URS_IFLOOP(3) - * --op = ip[i] << (b - 24) | ip[i + 1] << (b - 16) | ip[i + 2] << (b - 8); - GA_URS_IFLOOP(4) - * --op = - ip[i] << (b - 32) | ip[i + 1] << (b - 24) | ip[i + 2] << (b - 16) | ip[i + 3] << (b - - 8); - } - else { - GA_URS_IFLOOP(1) - * --op = (ip[i] ^ 0x80) << (b - 8) | 0x7f << (b - 16); /* convert from unsigned */ - GA_URS_IFLOOP(2) - * --op = ip[i] << (b - 8) | ip[i + 1] << (b - 16); - GA_URS_IFLOOP(3) - * --op = ip[i] << (b - 8) | ip[i + 1] << (b - 16) | ip[i + 2] << (b - 24); - GA_URS_IFLOOP(4) - * --op = - ip[i] << (b - 8) | ip[i + 1] << (b - 16) | ip[i + 2] << (b - 24) | ip[i + 3] << (b - - 32); - } -#undef GA_URS_IFLOOP - if (global.pcm_is_ieee_float) { - ieee754_float32_t const m_max = INT_MAX; - ieee754_float32_t const m_min = -(ieee754_float32_t) INT_MIN; - ieee754_float32_t *x = (ieee754_float32_t *) sample_buffer; - assert(sizeof(ieee754_float32_t) == sizeof(int)); - for (i = 0; i < samples_to_read; ++i) { - ieee754_float32_t const u = x[i]; - int v; - if (u >= 1) { - v = INT_MAX; - } - else if (u <= -1) { - v = INT_MIN; - } - else if (u >= 0) { - v = (int) (u * m_max + 0.5f); - } - else { - v = (int) (u * m_min - 0.5f); - } - sample_buffer[i] = v; - } - } - return (samples_read); -} - - - -/************************************************************************ -* -* read_samples() -* -* PURPOSE: reads the PCM samples from a file to the buffer -* -* SEMANTICS: -* Reads #samples_read# number of shorts from #musicin# filepointer -* into #sample_buffer[]#. Returns the number of samples read. -* -************************************************************************/ - -static int -read_samples_pcm(FILE * musicin, int sample_buffer[2304], int samples_to_read) -{ - int samples_read; - int bytes_per_sample = global.pcmbitwidth / 8; - int swap_byte_order; /* byte order of input stream */ - - switch (global.pcmbitwidth) { - case 32: - case 24: - case 16: - if (global_raw_pcm.in_signed == 0) { - if (global_ui_config.silent < 10) { - error_printf("Unsigned input only supported with bitwidth 8\n"); - } - return -1; - } - swap_byte_order = (global_raw_pcm.in_endian != ByteOrderLittleEndian) ? 1 : 0; - if (global.pcmswapbytes) { - swap_byte_order = !swap_byte_order; - } - break; - - case 8: - swap_byte_order = global.pcm_is_unsigned_8bit; - break; - - default: - if (global_ui_config.silent < 10) { - error_printf("Only 8, 16, 24 and 32 bit input files supported \n"); - } - return -1; - } - samples_read = unpack_read_samples(samples_to_read, bytes_per_sample, swap_byte_order, - sample_buffer, musicin); - if (ferror(musicin)) { - if (global_ui_config.silent < 10) { - error_printf("Error reading input file\n"); - } - return -1; - } - - return samples_read; -} - - - -/* AIFF Definitions */ - -static int const IFF_ID_FORM = 0x464f524d; /* "FORM" */ -static int const IFF_ID_AIFF = 0x41494646; /* "AIFF" */ -static int const IFF_ID_AIFC = 0x41494643; /* "AIFC" */ -static int const IFF_ID_COMM = 0x434f4d4d; /* "COMM" */ -static int const IFF_ID_SSND = 0x53534e44; /* "SSND" */ -static int const IFF_ID_MPEG = 0x4d504547; /* "MPEG" */ - -static int const IFF_ID_NONE = 0x4e4f4e45; /* "NONE" *//* AIFF-C data format */ -static int const IFF_ID_2CBE = 0x74776f73; /* "twos" *//* AIFF-C data format */ -static int const IFF_ID_2CLE = 0x736f7774; /* "sowt" *//* AIFF-C data format */ - -static int const WAV_ID_RIFF = 0x52494646; /* "RIFF" */ -static int const WAV_ID_WAVE = 0x57415645; /* "WAVE" */ -static int const WAV_ID_FMT = 0x666d7420; /* "fmt " */ -static int const WAV_ID_DATA = 0x64617461; /* "data" */ - -#ifndef WAVE_FORMAT_PCM -static short const WAVE_FORMAT_PCM = (short)0x0001U; -#endif -#ifndef WAVE_FORMAT_IEEE_FLOAT -static short const WAVE_FORMAT_IEEE_FLOAT = (short)0x0003U; -#endif -#ifndef WAVE_FORMAT_EXTENSIBLE -static short const WAVE_FORMAT_EXTENSIBLE = (short)0xFFFEU; -#endif - - -static long -make_even_number_of_bytes_in_length(long x) -{ - if ((x & 0x01) != 0) { - return x + 1; - } - return x; -} - - -/***************************************************************************** - * - * Read Microsoft Wave headers - * - * By the time we get here the first 32-bits of the file have already been - * read, and we're pretty sure that we're looking at a WAV file. - * - *****************************************************************************/ - -static int -parse_wave_header(lame_global_flags * gfp, FILE * sf) -{ - int format_tag = 0; - int channels = 0; - int block_align = 0; - int bits_per_sample = 0; - int samples_per_sec = 0; - int avg_bytes_per_sec = 0; - - - int is_wav = 0; - long data_length = 0, file_length, subSize = 0; - int loop_sanity = 0; - - file_length = read_32_bits_high_low(sf); - if (read_32_bits_high_low(sf) != WAV_ID_WAVE) - return -1; - - for (loop_sanity = 0; loop_sanity < 20; ++loop_sanity) { - int type = read_32_bits_high_low(sf); - - if (type == WAV_ID_FMT) { - subSize = read_32_bits_low_high(sf); - subSize = make_even_number_of_bytes_in_length(subSize); - if (subSize < 16) { - /*DEBUGF( - "'fmt' chunk too short (only %ld bytes)!", subSize); */ - return -1; - } - - format_tag = read_16_bits_low_high(sf); - subSize -= 2; - channels = read_16_bits_low_high(sf); - subSize -= 2; - samples_per_sec = read_32_bits_low_high(sf); - subSize -= 4; - avg_bytes_per_sec = read_32_bits_low_high(sf); - subSize -= 4; - block_align = read_16_bits_low_high(sf); - subSize -= 2; - bits_per_sample = read_16_bits_low_high(sf); - subSize -= 2; - - /* WAVE_FORMAT_EXTENSIBLE support */ - if ((subSize > 9) && (format_tag == WAVE_FORMAT_EXTENSIBLE)) { - read_16_bits_low_high(sf); /* cbSize */ - read_16_bits_low_high(sf); /* ValidBitsPerSample */ - read_32_bits_low_high(sf); /* ChannelMask */ - /* SubType coincident with format_tag for PCM int or float */ - format_tag = read_16_bits_low_high(sf); - subSize -= 10; - } - - /* DEBUGF(" skipping %d bytes\n", subSize); */ - - if (subSize > 0) { - if (fskip(sf, (long) subSize, SEEK_CUR) != 0) - return -1; - }; - - } - else if (type == WAV_ID_DATA) { - subSize = read_32_bits_low_high(sf); - data_length = subSize; - is_wav = 1; - /* We've found the audio data. Read no further! */ - break; - - } - else { - subSize = read_32_bits_low_high(sf); - subSize = make_even_number_of_bytes_in_length(subSize); - if (fskip(sf, (long) subSize, SEEK_CUR) != 0) { - return -1; - } - } - } - if (is_wav) { - if (format_tag != WAVE_FORMAT_PCM && format_tag != WAVE_FORMAT_IEEE_FLOAT) { - if (global_ui_config.silent < 10) { - error_printf("Unsupported data format: 0x%04X\n", format_tag); - } - return 0; /* oh no! non-supported format */ - } - - - /* make sure the header is sane */ - if (-1 == lame_set_num_channels(gfp, channels)) { - if (global_ui_config.silent < 10) { - error_printf("Unsupported number of channels: %u\n", channels); - } - return 0; - } - if (global_reader.input_samplerate == 0) { - (void) lame_set_in_samplerate(gfp, samples_per_sec); - } - else { - (void) lame_set_in_samplerate(gfp, global_reader.input_samplerate); - } - global. pcmbitwidth = bits_per_sample; - global. pcm_is_unsigned_8bit = 1; - global. pcm_is_ieee_float = (format_tag == WAVE_FORMAT_IEEE_FLOAT ? 1 : 0); - (void) lame_set_num_samples(gfp, data_length / (channels * ((bits_per_sample + 7) / 8))); - return 1; - } - return -1; -} - - - -/************************************************************************ -* aiff_check2 -* -* PURPOSE: Checks AIFF header information to make sure it is valid. -* returns 0 on success, 1 on errors -************************************************************************/ - -static int -aiff_check2(IFF_AIFF * const pcm_aiff_data) -{ - if (pcm_aiff_data->sampleType != (unsigned long) IFF_ID_SSND) { - if (global_ui_config.silent < 10) { - error_printf("ERROR: input sound data is not PCM\n"); - } - return 1; - } - switch (pcm_aiff_data->sampleSize) { - case 32: - case 24: - case 16: - case 8: - break; - default: - if (global_ui_config.silent < 10) { - error_printf("ERROR: input sound data is not 8, 16, 24 or 32 bits\n"); - } - return 1; - } - if (pcm_aiff_data->numChannels != 1 && pcm_aiff_data->numChannels != 2) { - if (global_ui_config.silent < 10) { - error_printf("ERROR: input sound data is not mono or stereo\n"); - } - return 1; - } - if (pcm_aiff_data->blkAlgn.blockSize != 0) { - if (global_ui_config.silent < 10) { - error_printf("ERROR: block size of input sound data is not 0 bytes\n"); - } - return 1; - } - /* A bug, since we correctly skip the offset earlier in the code. - if (pcm_aiff_data->blkAlgn.offset != 0) { - error_printf("Block offset is not 0 bytes in '%s'\n", file_name); - return 1; - } */ - - return 0; -} - - -/***************************************************************************** - * - * Read Audio Interchange File Format (AIFF) headers. - * - * By the time we get here the first 32 bits of the file have already been - * read, and we're pretty sure that we're looking at an AIFF file. - * - *****************************************************************************/ - -static int -parse_aiff_header(lame_global_flags * gfp, FILE * sf) -{ - long chunkSize = 0, subSize = 0, typeID = 0, dataType = IFF_ID_NONE; - IFF_AIFF aiff_info; - int seen_comm_chunk = 0, seen_ssnd_chunk = 0; - long pcm_data_pos = -1; - - memset(&aiff_info, 0, sizeof(aiff_info)); - chunkSize = read_32_bits_high_low(sf); - - typeID = read_32_bits_high_low(sf); - if ((typeID != IFF_ID_AIFF) && (typeID != IFF_ID_AIFC)) - return -1; - - while (chunkSize > 0) { - long ckSize; - int type = read_32_bits_high_low(sf); - chunkSize -= 4; - - /* DEBUGF( - "found chunk type %08x '%4.4s'\n", type, (char*)&type); */ - - /* don't use a switch here to make it easier to use 'break' for SSND */ - if (type == IFF_ID_COMM) { - seen_comm_chunk = seen_ssnd_chunk + 1; - subSize = read_32_bits_high_low(sf); - ckSize = make_even_number_of_bytes_in_length(subSize); - chunkSize -= ckSize; - - aiff_info.numChannels = (short) read_16_bits_high_low(sf); - ckSize -= 2; - aiff_info.numSampleFrames = read_32_bits_high_low(sf); - ckSize -= 4; - aiff_info.sampleSize = (short) read_16_bits_high_low(sf); - ckSize -= 2; - aiff_info.sampleRate = read_ieee_extended_high_low(sf); - ckSize -= 10; - if (typeID == IFF_ID_AIFC) { - dataType = read_32_bits_high_low(sf); - ckSize -= 4; - } - if (fskip(sf, ckSize, SEEK_CUR) != 0) - return -1; - } - else if (type == IFF_ID_SSND) { - seen_ssnd_chunk = 1; - subSize = read_32_bits_high_low(sf); - ckSize = make_even_number_of_bytes_in_length(subSize); - chunkSize -= ckSize; - - aiff_info.blkAlgn.offset = read_32_bits_high_low(sf); - ckSize -= 4; - aiff_info.blkAlgn.blockSize = read_32_bits_high_low(sf); - ckSize -= 4; - - aiff_info.sampleType = IFF_ID_SSND; - - if (seen_comm_chunk > 0) { - if (fskip(sf, (long) aiff_info.blkAlgn.offset, SEEK_CUR) != 0) - return -1; - /* We've found the audio data. Read no further! */ - break; - } - pcm_data_pos = ftell(sf); - if (pcm_data_pos >= 0) { - pcm_data_pos += aiff_info.blkAlgn.offset; - } - if (fskip(sf, ckSize, SEEK_CUR) != 0) - return -1; - } - else { - subSize = read_32_bits_high_low(sf); - ckSize = make_even_number_of_bytes_in_length(subSize); - chunkSize -= ckSize; - - if (fskip(sf, ckSize, SEEK_CUR) != 0) - return -1; - } - } - if (dataType == IFF_ID_2CLE) { - global. pcmswapbytes = global_reader.swapbytes; - } - else if (dataType == IFF_ID_2CBE) { - global. pcmswapbytes = !global_reader.swapbytes; - } - else if (dataType == IFF_ID_NONE) { - global. pcmswapbytes = !global_reader.swapbytes; - } - else { - return -1; - } - - /* DEBUGF("Parsed AIFF %d\n", is_aiff); */ - if (seen_comm_chunk && (seen_ssnd_chunk > 0 || aiff_info.numSampleFrames == 0)) { - /* make sure the header is sane */ - if (0 != aiff_check2(&aiff_info)) - return 0; - if (-1 == lame_set_num_channels(gfp, aiff_info.numChannels)) { - if (global_ui_config.silent < 10) { - error_printf("Unsupported number of channels: %u\n", aiff_info.numChannels); - } - return 0; - } - if (global_reader.input_samplerate == 0) { - (void) lame_set_in_samplerate(gfp, (int) aiff_info.sampleRate); - } - else { - (void) lame_set_in_samplerate(gfp, global_reader.input_samplerate); - } - (void) lame_set_num_samples(gfp, aiff_info.numSampleFrames); - global. pcmbitwidth = aiff_info.sampleSize; - global. pcm_is_unsigned_8bit = 0; - global. pcm_is_ieee_float = 0; /* FIXME: possible ??? */ - if (pcm_data_pos >= 0) { - if (fseek(sf, pcm_data_pos, SEEK_SET) != 0) { - if (global_ui_config.silent < 10) { - error_printf("Can't rewind stream to audio data position\n"); - } - return 0; - } - } - - return 1; - } - return -1; -} - - - -/************************************************************************ -* -* parse_file_header -* -* PURPOSE: Read the header from a bytestream. Try to determine whether -* it's a WAV file or AIFF without rewinding, since rewind -* doesn't work on pipes and there's a good chance we're reading -* from stdin (otherwise we'd probably be using libsndfile). -* -* When this function returns, the file offset will be positioned at the -* beginning of the sound data. -* -************************************************************************/ - -static int -parse_file_header(lame_global_flags * gfp, FILE * sf) -{ - - int type = read_32_bits_high_low(sf); - /* - DEBUGF( - "First word of input stream: %08x '%4.4s'\n", type, (char*) &type); - */ - global. count_samples_carefully = 0; - global. pcm_is_unsigned_8bit = global_raw_pcm.in_signed == 1 ? 0 : 1; - /*global_reader.input_format = sf_raw; commented out, because it is better to fail - here as to encode some hundreds of input files not supported by LAME - If you know you have RAW PCM data, use the -r switch - */ - - if (type == WAV_ID_RIFF) { - /* It's probably a WAV file */ - int const ret = parse_wave_header(gfp, sf); - if (ret > 0) { - global. count_samples_carefully = 1; - return sf_wave; - } - if (ret < 0) { - if (global_ui_config.silent < 10) { - error_printf("Warning: corrupt or unsupported WAVE format\n"); - } - } - } - else if (type == IFF_ID_FORM) { - /* It's probably an AIFF file */ - int const ret = parse_aiff_header(gfp, sf); - if (ret > 0) { - global. count_samples_carefully = 1; - return sf_aiff; - } - if (ret < 0) { - if (global_ui_config.silent < 10) { - error_printf("Warning: corrupt or unsupported AIFF format\n"); - } - } - } - else { - if (global_ui_config.silent < 10) { - error_printf("Warning: unsupported audio format\n"); - } - } - return sf_unknown; -} - - -static FILE * -open_wave_file(lame_t gfp, char const *inPath) -{ - FILE *musicin; - - /* set the defaults from info incase we cannot determine them from file */ - lame_set_num_samples(gfp, MAX_U_32_NUM); - - if (!strcmp(inPath, "-")) { - lame_set_stream_binary_mode(musicin = stdin); /* Read from standard input. */ - } - else { - if ((musicin = lame_fopen(inPath, "rb")) == NULL) { - if (global_ui_config.silent < 10) { - error_printf("Could not find \"%s\".\n", inPath); - } - exit(1); - } - } - - if (global_reader.input_format == sf_ogg) { - if (global_ui_config.silent < 10) { - error_printf("sorry, vorbis support in LAME is deprecated.\n"); - } - exit(1); - } - else if (global_reader.input_format == sf_raw) { - /* assume raw PCM */ - if (global_ui_config.silent < 9) { - console_printf("Assuming raw pcm input file"); - if (global_reader.swapbytes) - console_printf(" : Forcing byte-swapping\n"); - else - console_printf("\n"); - } - global. pcmswapbytes = global_reader.swapbytes; - } - else { - global_reader.input_format = parse_file_header(gfp, musicin); - } - if (global_reader.input_format == sf_unknown) { - exit(1); - } - - if (lame_get_num_samples(gfp) == MAX_U_32_NUM && musicin != stdin) { - double const flen = lame_get_file_size(musicin); /* try to figure out num_samples */ - if (flen >= 0) { - /* try file size, assume 2 bytes per sample */ - unsigned long fsize = (unsigned long) (flen / (2 * lame_get_num_channels(gfp))); - (void) lame_set_num_samples(gfp, fsize); - } - } - return musicin; -} - - - -static FILE * -open_mpeg_file(lame_t gfp, char const *inPath, int *enc_delay, int *enc_padding) -{ - FILE *musicin; - - /* set the defaults from info incase we cannot determine them from file */ - lame_set_num_samples(gfp, MAX_U_32_NUM); - - if (strcmp(inPath, "-") == 0) { - musicin = stdin; - lame_set_stream_binary_mode(musicin); /* Read from standard input. */ - } - else { - musicin = lame_fopen(inPath, "rb"); - if (musicin == NULL) { - if (global_ui_config.silent < 10) { - error_printf("Could not find \"%s\".\n", inPath); - } - return 0; - } - } -#ifdef AMIGA_MPEGA - if (-1 == lame_decode_initfile(inPath, &global_decoder.mp3input_data)) { - if (global_ui_config.silent < 10) { - error_printf("Error reading headers in mp3 input file %s.\n", inPath); - } - close_input_file(musicin); - return 0; - } -#endif -#ifdef HAVE_MPGLIB - if (-1 == lame_decode_initfile(musicin, &global_decoder.mp3input_data, enc_delay, enc_padding)) { - if (global_ui_config.silent < 10) { - error_printf("Error reading headers in mp3 input file %s.\n", inPath); - } - close_input_file(musicin); - return 0; - } -#endif - if (-1 == lame_set_num_channels(gfp, global_decoder.mp3input_data.stereo)) { - if (global_ui_config.silent < 10) { - error_printf("Unsupported number of channels: %ud\n", - global_decoder.mp3input_data.stereo); - } - close_input_file(musicin); - return 0; - } - if (global_reader.input_samplerate == 0) { - (void) lame_set_in_samplerate(gfp, global_decoder.mp3input_data.samplerate); - } - else { - (void) lame_set_in_samplerate(gfp, global_reader.input_samplerate); - } - (void) lame_set_num_samples(gfp, global_decoder.mp3input_data.nsamp); - - if (lame_get_num_samples(gfp) == MAX_U_32_NUM && musicin != stdin) { - double flen = lame_get_file_size(musicin); /* try to figure out num_samples */ - if (flen >= 0) { - /* try file size, assume 2 bytes per sample */ - if (global_decoder.mp3input_data.bitrate > 0) { - double totalseconds = - (flen * 8.0 / (1000.0 * global_decoder.mp3input_data.bitrate)); - unsigned long tmp_num_samples = - (unsigned long) (totalseconds * lame_get_in_samplerate(gfp)); - - (void) lame_set_num_samples(gfp, tmp_num_samples); - global_decoder.mp3input_data.nsamp = tmp_num_samples; - } - } - } - return musicin; -} - - -static int -close_input_file(FILE * musicin) -{ - int ret = 0; - - if (musicin != stdin && musicin != 0) { - ret = fclose(musicin); - } - if (ret != 0) { - if (global_ui_config.silent < 10) { - error_printf("Could not close audio input file\n"); - } - } - return ret; -} - - - -#if defined(HAVE_MPGLIB) -static int -check_aid(const unsigned char *header) -{ - return 0 == memcmp(header, "AiD\1", 4); -} - -/* - * Please check this and don't kill me if there's a bug - * This is a (nearly?) complete header analysis for a MPEG-1/2/2.5 Layer I, II or III - * data stream - */ - -static int -is_syncword_mp123(const void *const headerptr) -{ - const unsigned char *const p = headerptr; - static const char abl2[16] = { 0, 7, 7, 7, 0, 7, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8 }; - - if ((p[0] & 0xFF) != 0xFF) - return 0; /* first 8 bits must be '1' */ - if ((p[1] & 0xE0) != 0xE0) - return 0; /* next 3 bits are also */ - if ((p[1] & 0x18) == 0x08) - return 0; /* no MPEG-1, -2 or -2.5 */ - switch (p[1] & 0x06) { - default: - case 0x00: /* illegal Layer */ - return 0; - - case 0x02: /* Layer3 */ - if (global_reader.input_format != sf_mp3 && global_reader.input_format != sf_mp123) { - return 0; - } - global_reader.input_format = sf_mp3; - break; - - case 0x04: /* Layer2 */ - if (global_reader.input_format != sf_mp2 && global_reader.input_format != sf_mp123) { - return 0; - } - global_reader.input_format = sf_mp2; - break; - - case 0x06: /* Layer1 */ - if (global_reader.input_format != sf_mp1 && global_reader.input_format != sf_mp123) { - return 0; - } - global_reader.input_format = sf_mp1; - break; - } - if ((p[1] & 0x06) == 0x00) - return 0; /* no Layer I, II and III */ - if ((p[2] & 0xF0) == 0xF0) - return 0; /* bad bitrate */ - if ((p[2] & 0x0C) == 0x0C) - return 0; /* no sample frequency with (32,44.1,48)/(1,2,4) */ - if ((p[1] & 0x18) == 0x18 && (p[1] & 0x06) == 0x04 && abl2[p[2] >> 4] & (1 << (p[3] >> 6))) - return 0; - if ((p[3] & 3) == 2) - return 0; /* reserved enphasis mode */ - return 1; -} - -static size_t -lenOfId3v2Tag(unsigned char const* buf) -{ - unsigned int b0 = buf[0] & 127; - unsigned int b1 = buf[1] & 127; - unsigned int b2 = buf[2] & 127; - unsigned int b3 = buf[3] & 127; - return (((((b0 << 7) + b1) << 7) + b2) << 7) + b3; -} - -int -lame_decode_initfile(FILE * fd, mp3data_struct * mp3data, int *enc_delay, int *enc_padding) -{ - /* VBRTAGDATA pTagData; */ - /* int xing_header,len2,num_frames; */ - unsigned char buf[100]; - int ret; - size_t len; - int aid_header; - short int pcm_l[1152], pcm_r[1152]; - int freeformat = 0; - - memset(mp3data, 0, sizeof(mp3data_struct)); - if (global.hip) { - hip_decode_exit(global.hip); - } - global. hip = hip_decode_init(); - hip_set_msgf(global.hip, global_ui_config.silent < 10 ? &frontend_msgf : 0); - hip_set_errorf(global.hip, global_ui_config.silent < 10 ? &frontend_errorf : 0); - hip_set_debugf(global.hip, &frontend_debugf); - - len = 4; - if (fread(buf, 1, len, fd) != len) - return -1; /* failed */ - while (buf[0] == 'I' && buf[1] == 'D' && buf[2] == '3') { - len = 6; - if (fread(&buf[4], 1, len, fd) != len) - return -1; /* failed */ - len = lenOfId3v2Tag(&buf[6]); - if (global.in_id3v2_size < 1) { - global.in_id3v2_size = 10 + len; - global.in_id3v2_tag = malloc(global.in_id3v2_size); - if (global.in_id3v2_tag) { - memcpy(global.in_id3v2_tag, buf, 10); - if (fread(&global.in_id3v2_tag[10], 1, len, fd) != len) - return -1; /* failed */ - len = 0; /* copied, nothing to skip */ - } - else { - global.in_id3v2_size = 0; - } - } - fskip(fd, len, SEEK_CUR); - len = 4; - if (fread(&buf, 1, len, fd) != len) - return -1; /* failed */ - } - aid_header = check_aid(buf); - if (aid_header) { - if (fread(&buf, 1, 2, fd) != 2) - return -1; /* failed */ - aid_header = (unsigned char) buf[0] + 256 * (unsigned char) buf[1]; - if (global_ui_config.silent < 9) { - console_printf("Album ID found. length=%i \n", aid_header); - } - /* skip rest of AID, except for 6 bytes we have already read */ - fskip(fd, aid_header - 6, SEEK_CUR); - - /* read 4 more bytes to set up buffer for MP3 header check */ - if (fread(&buf, 1, len, fd) != len) - return -1; /* failed */ - } - len = 4; - while (!is_syncword_mp123(buf)) { - unsigned int i; - for (i = 0; i < len - 1; i++) - buf[i] = buf[i + 1]; - if (fread(buf + len - 1, 1, 1, fd) != 1) - return -1; /* failed */ - } - - if ((buf[2] & 0xf0) == 0) { - if (global_ui_config.silent < 9) { - console_printf("Input file is freeformat.\n"); - } - freeformat = 1; - } - /* now parse the current buffer looking for MP3 headers. */ - /* (as of 11/00: mpglib modified so that for the first frame where */ - /* headers are parsed, no data will be decoded. */ - /* However, for freeformat, we need to decode an entire frame, */ - /* so mp3data->bitrate will be 0 until we have decoded the first */ - /* frame. Cannot decode first frame here because we are not */ - /* yet prepared to handle the output. */ - ret = hip_decode1_headersB(global.hip, buf, len, pcm_l, pcm_r, mp3data, enc_delay, enc_padding); - if (-1 == ret) - return -1; - - /* repeat until we decode a valid mp3 header. */ - while (!mp3data->header_parsed) { - len = fread(buf, 1, sizeof(buf), fd); - if (len != sizeof(buf)) - return -1; - ret = - hip_decode1_headersB(global.hip, buf, len, pcm_l, pcm_r, mp3data, enc_delay, - enc_padding); - if (-1 == ret) - return -1; - } - - if (mp3data->bitrate == 0 && !freeformat) { - if (global_ui_config.silent < 10) { - error_printf("fail to sync...\n"); - } - return lame_decode_initfile(fd, mp3data, enc_delay, enc_padding); - } - - if (mp3data->totalframes > 0) { - /* mpglib found a Xing VBR header and computed nsamp & totalframes */ - } - else { - /* set as unknown. Later, we will take a guess based on file size - * ant bitrate */ - mp3data->nsamp = MAX_U_32_NUM; - } - - - /* - report_printf("ret = %i NEED_MORE=%i \n",ret,MP3_NEED_MORE); - report_printf("stereo = %i \n",mp.fr.stereo); - report_printf("samp = %i \n",freqs[mp.fr.sampling_frequency]); - report_printf("framesize = %i \n",framesize); - report_printf("bitrate = %i \n",mp3data->bitrate); - report_printf("num frames = %ui \n",num_frames); - report_printf("num samp = %ui \n",mp3data->nsamp); - report_printf("mode = %i \n",mp.fr.mode); - */ - - return 0; -} - -/* -For lame_decode_fromfile: return code - -1 error - n number of samples output. either 576 or 1152 depending on MP3 file. - - -For lame_decode1_headers(): return code - -1 error - 0 ok, but need more data before outputing any samples - n number of samples output. either 576 or 1152 depending on MP3 file. -*/ -static int -lame_decode_fromfile(FILE * fd, short pcm_l[], short pcm_r[], mp3data_struct * mp3data) -{ - int ret = 0; - size_t len = 0; - unsigned char buf[1024]; - - /* first see if we still have data buffered in the decoder: */ - ret = hip_decode1_headers(global.hip, buf, len, pcm_l, pcm_r, mp3data); - if (ret != 0) - return ret; - - - /* read until we get a valid output frame */ - for (;;) { - len = fread(buf, 1, 1024, fd); - if (len == 0) { - /* we are done reading the file, but check for buffered data */ - ret = hip_decode1_headers(global.hip, buf, len, pcm_l, pcm_r, mp3data); - if (ret <= 0) { - hip_decode_exit(global.hip); /* release mp3decoder memory */ - global. hip = 0; - return -1; /* done with file */ - } - break; - } - - ret = hip_decode1_headers(global.hip, buf, len, pcm_l, pcm_r, mp3data); - if (ret == -1) { - hip_decode_exit(global.hip); /* release mp3decoder memory */ - global. hip = 0; - return -1; - } - if (ret > 0) - break; - } - return ret; -} -#endif /* defined(HAVE_MPGLIB) */ - - -int -is_mpeg_file_format(int input_file_format) -{ - switch (input_file_format) { - case sf_mp1: - return 1; - case sf_mp2: - return 2; - case sf_mp3: - return 3; - case sf_mp123: - return -1; - default: - break; - } - return 0; -} - - -#define LOW__BYTE(x) (x & 0x00ff) -#define HIGH_BYTE(x) ((x >> 8) & 0x00ff) - -void -put_audio16(FILE * outf, short Buffer[2][1152], int iread, int nch) -{ - char data[2 * 1152 * 2]; - int i, m = 0; - - if (global_decoder.disable_wav_header && global_reader.swapbytes) { - if (nch == 1) { - for (i = 0; i < iread; i++) { - short x = Buffer[0][i]; - /* write 16 Bits High Low */ - data[m++] = HIGH_BYTE(x); - data[m++] = LOW__BYTE(x); - } - } - else { - for (i = 0; i < iread; i++) { - short x = Buffer[0][i], y = Buffer[1][i]; - /* write 16 Bits High Low */ - data[m++] = HIGH_BYTE(x); - data[m++] = LOW__BYTE(x); - /* write 16 Bits High Low */ - data[m++] = HIGH_BYTE(y); - data[m++] = LOW__BYTE(y); - } - } - } - else { - if (nch == 1) { - for (i = 0; i < iread; i++) { - short x = Buffer[0][i]; - /* write 16 Bits Low High */ - data[m++] = LOW__BYTE(x); - data[m++] = HIGH_BYTE(x); - } - } - else { - for (i = 0; i < iread; i++) { - short x = Buffer[0][i], y = Buffer[1][i]; - /* write 16 Bits Low High */ - data[m++] = LOW__BYTE(x); - data[m++] = HIGH_BYTE(x); - /* write 16 Bits Low High */ - data[m++] = LOW__BYTE(y); - data[m++] = HIGH_BYTE(y); - } - } - } - if (m > 0) { - fwrite(data, 1, m, outf); - } - if (global_writer.flush_write == 1) { - fflush(outf); - } -} - -hip_t -get_hip(void) -{ - return global.hip; -} - -size_t -sizeOfOldTag(lame_t gf) -{ - (void) gf; - return global.in_id3v2_size; -} - -unsigned char* -getOldTag(lame_t gf) -{ - (void) gf; - return global.in_id3v2_tag; -} - -/* end of get_audio.c */ diff --git a/src/lib/dl/ext/lame/get_audio.h b/src/lib/dl/ext/lame/get_audio.h deleted file mode 100755 index 028ca6be..00000000 --- a/src/lib/dl/ext/lame/get_audio.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Get Audio routines include file - * - * Copyright (c) 1999 Albert L Faber - * 2010 Robert Hegemann - * - * 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_GET_AUDIO_H -#define LAME_GET_AUDIO_H -#include "lame.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum sound_file_format_e { - sf_unknown, - sf_raw, - sf_wave, - sf_aiff, - sf_mp1, /* MPEG Layer 1, aka mpg */ - sf_mp2, /* MPEG Layer 2 */ - sf_mp3, /* MPEG Layer 3 */ - sf_mp123, /* MPEG Layer 1,2 or 3; whatever .mp3, .mp2, .mp1 or .mpg contains */ - sf_ogg -} sound_file_format; - -int is_mpeg_file_format( int input_format ); - -int init_infile(lame_t gfp, char const * inPath); -int samples_to_skip_at_start(void); -int samples_to_skip_at_end(void); -void close_infile(void); -int get_audio(lame_t gfp, int buffer[2][1152]); -int get_audio16(lame_t gfp, short buffer[2][1152]); -int get_audio_float(lame_t gfp, float buffer[2][1152]); -int get_audio_double(lame_t gfp, double buffer[2][1152]); -hip_t get_hip(void); - -FILE *init_outfile(char const *outPath, int decode); -int WriteWaveHeader(FILE * const fp, int pcmbytes, int freq, int channels, int bits); -void put_audio16(FILE* outf, short Buffer[2][1152], int iread, int nch); - -/* -struct AudioReader; -typedef struct AudioReader* AudioReader; - -AudioReader ar_open(lame_t gfp, char const* inPath); -int ar_samplesToSkipAtStart(AudioReader ar); -int ar_samplesToSkipAtEnd(AudioReader ar); -void ar_close(AudioReader ar); -int ar_readInt(AudioReader ar, lame_t gfp, int buffer[2][1152]); -int ar_readShort(AudioReader ar, lame_t gfp, short buffer[2][1152]); -int ar_readFloat(AudioReader ar, lame_t gfp, float buffer[2][1152]); - -struct AudioWriter; -typedef struct AudioWriter* AudioWriter; - -AudioWriter aw_open(lame_t gfp, char const* outPath, int pcmbystes, int freq, int channels, int bits); -int aw_writeWaveHeader(AudioWriter aw); -int aw_write(AudioWriter aw, short buffer[2][1152], int n); -int aw_write(AudioWriter aw, float buffer[2][1152], int n); - -*/ - -extern size_t sizeOfOldTag(lame_t gf); -extern unsigned char* getOldTag(lame_t gf); - -#ifdef _cplusplus -} -#endif - -#endif /* ifndef LAME_GET_AUDIO_H */ diff --git a/src/lib/dl/ext/lame/gpkplotting.c b/src/lib/dl/ext/lame/gpkplotting.c deleted file mode 100755 index d90877bc..00000000 --- a/src/lib/dl/ext/lame/gpkplotting.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - * GTK plotting routines source file - * - * Copyright (c) 1999 Mark Taylor - * - * 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. - */ - -/* $Id: gpkplotting.c,v 1.12 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "gpkplotting.h" - -#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 - -#ifdef WITH_DMALLOC -#include -#endif - -static gint num_plotwindows = 0; -static gint max_plotwindows = 10; -static GdkPixmap *pixmaps[10]; -static GtkWidget *pixmapboxes[10]; - - - - -/* compute a gdkcolor */ -void -setcolor(GtkWidget * widget, GdkColor * color, gint red, gint green, gint blue) -{ - - /* colors in GdkColor are taken from 0 to 65535, not 0 to 255. */ - color->red = red * (65535 / 255); - color->green = green * (65535 / 255); - color->blue = blue * (65535 / 255); - color->pixel = (gulong) (color->red * 65536 + color->green * 256 + color->blue); - /* find closest in colormap, if needed */ - gdk_color_alloc(gtk_widget_get_colormap(widget), color); -} - - -void -gpk_redraw(GdkPixmap * pixmap, GtkWidget * pixmapbox) -{ - /* redraw the entire pixmap */ - gdk_draw_pixmap(pixmapbox->window, - pixmapbox->style->fg_gc[GTK_WIDGET_STATE(pixmapbox)], - pixmap, 0, 0, 0, 0, pixmapbox->allocation.width, pixmapbox->allocation.height); -} - - -static GdkPixmap ** -findpixmap(GtkWidget * widget) -{ - int i; - for (i = 0; i < num_plotwindows && widget != pixmapboxes[i]; i++); - if (i >= num_plotwindows) { - g_print("findpixmap(): bad argument widget \n"); - return NULL; - } - return &pixmaps[i]; -} - -void -gpk_graph_draw(GtkWidget * widget, /* plot on this widged */ - int n, /* number of data points */ - gdouble * xcord, gdouble * ycord, /* data */ - gdouble xmn, gdouble ymn, /* coordinates of corners */ - gdouble xmx, gdouble ymx, int clear, /* clear old plot first */ - char *title, /* add a title (only if clear=1) */ - GdkColor * color) -{ - GdkPixmap **ppixmap; - GdkPoint *points; - int i; - gint16 width, height; - GdkFont *fixed_font; - GdkGC *gc; - - gc = gdk_gc_new(widget->window); - gdk_gc_set_foreground(gc, color); - - - - if ((ppixmap = findpixmap(widget))) { - width = widget->allocation.width; - height = widget->allocation.height; - - - if (clear) { - /* white background */ - gdk_draw_rectangle(*ppixmap, widget->style->white_gc, TRUE, 0, 0, width, height); - /* title */ -#ifdef _WIN32 - fixed_font = gdk_font_load("-misc-fixed-large-r-*-*-*-100-*-*-*-*-*-*"); -#else - fixed_font = gdk_font_load("-misc-fixed-medium-r-*-*-*-100-*-*-*-*-iso8859-1"); -#endif - - gdk_draw_text(*ppixmap, fixed_font, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - 0, 10, title, strlen(title)); - } - - - points = g_malloc(n * sizeof(GdkPoint)); - for (i = 0; i < n; i++) { - points[i].x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn)); - points[i].y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx)); - } - gdk_draw_lines(*ppixmap, gc, points, n); - g_free(points); - gpk_redraw(*ppixmap, widget); - } - gdk_gc_destroy(gc); -} - - - -void -gpk_rectangle_draw(GtkWidget * widget, /* plot on this widged */ - gdouble * xcord, gdouble * ycord, /* corners */ - gdouble xmn, gdouble ymn, /* coordinates of corners */ - gdouble xmx, gdouble ymx, GdkColor * color) -{ - GdkPixmap **ppixmap; - GdkPoint points[2]; - int i; - gint16 width, height; - GdkGC *gc; - - - gc = gdk_gc_new(widget->window); - gdk_gc_set_foreground(gc, color); - - - if ((ppixmap = findpixmap(widget))) { - width = widget->allocation.width; - height = widget->allocation.height; - - - for (i = 0; i < 2; i++) { - points[i].x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn)); - points[i].y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx)); - } - width = points[1].x - points[0].x + 1; - height = points[1].y - points[0].y + 1; - gdk_draw_rectangle(*ppixmap, gc, TRUE, points[0].x, points[0].y, width, height); - gpk_redraw(*ppixmap, widget); - } - gdk_gc_destroy(gc); -} - - - -void -gpk_bargraph_draw(GtkWidget * widget, /* plot on this widged */ - int n, /* number of data points */ - gdouble * xcord, gdouble * ycord, /* data */ - gdouble xmn, gdouble ymn, /* coordinates of corners */ - gdouble xmx, gdouble ymx, int clear, /* clear old plot first */ - char *title, /* add a title (only if clear=1) */ - int barwidth, /* bar width. 0=compute based on window size */ - GdkColor * color) -{ - GdkPixmap **ppixmap; - GdkPoint points[2]; - int i; - gint16 width, height, x, y, barheight; - GdkFont *fixed_font; - GdkGC *gc; - int titleSplit; - - - gc = gdk_gc_new(widget->window); - gdk_gc_set_foreground(gc, color); - - - if ((ppixmap = findpixmap(widget))) { - width = widget->allocation.width; - height = widget->allocation.height; - - - if (clear) { - /* white background */ - gdk_draw_rectangle(*ppixmap, widget->style->white_gc, TRUE, 0, 0, width, height); - /* title */ -#ifdef _WIN32 - fixed_font = gdk_font_load("-misc-fixed-large-r-*-*-*-100-*-*-*-*-*-*"); -#else - fixed_font = gdk_font_load("-misc-fixed-medium-r-*-*-*-100-*-*-*-*-iso8859-1"); -#endif - - titleSplit = strcspn(title, "\n"); - - if (titleSplit && (titleSplit != strlen(title))) { - gdk_draw_text(*ppixmap, fixed_font, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - 0, 10, title, titleSplit); - - gdk_draw_text(*ppixmap, fixed_font, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - 0, 22, title + titleSplit + 1, (strlen(title) - titleSplit) - 1); - - - } - else { - gdk_draw_text(*ppixmap, fixed_font, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - 0, 10, title, strlen(title)); - } - } - - - for (i = 0; i < n; i++) { - points[1].x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn)); - points[1].y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx)); - points[0].x = points[1].x; - points[0].y = height - 1; - - x = .5 + ((xcord[i] - xmn) * (width - 1) / (xmx - xmn)); - y = .5 + ((ycord[i] - ymx) * (height - 1) / (ymn - ymx)); - if (!barwidth) - barwidth = (width / (n + 1)) - 1; - barwidth = barwidth > 5 ? 5 : barwidth; - barwidth = barwidth < 1 ? 1 : barwidth; - barheight = height - 1 - y; - /* gdk_draw_lines(*ppixmap,gc,points,2); */ - gdk_draw_rectangle(*ppixmap, gc, TRUE, x, y, barwidth, barheight); - - } - gpk_redraw(*ppixmap, widget); - } - gdk_gc_destroy(gc); -} - - - - - -/* Create a new backing pixmap of the appropriate size */ -static gint -configure_event(GtkWidget * widget, GdkEventConfigure * event, gpointer data) -{ - GdkPixmap **ppixmap; - if ((ppixmap = findpixmap(widget))) { - if (*ppixmap) - gdk_pixmap_unref(*ppixmap); - *ppixmap = gdk_pixmap_new(widget->window, - widget->allocation.width, widget->allocation.height, -1); - gdk_draw_rectangle(*ppixmap, - widget->style->white_gc, - TRUE, 0, 0, widget->allocation.width, widget->allocation.height); - } - return TRUE; -} - - - -/* Redraw the screen from the backing pixmap */ -static gint -expose_event(GtkWidget * widget, GdkEventExpose * event, gpointer data) -{ - GdkPixmap **ppixmap; - if ((ppixmap = findpixmap(widget))) { - gdk_draw_pixmap(widget->window, - widget->style->fg_gc[GTK_WIDGET_STATE(widget)], - *ppixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, event->area.width, event->area.height); - } - - return FALSE; -} - - - - - -GtkWidget * -gpk_plot_new(int width, int height) -{ - GtkWidget *pixmapbox; - - pixmapbox = gtk_drawing_area_new(); - gtk_drawing_area_size(GTK_DRAWING_AREA(pixmapbox), width, height); - gtk_signal_connect(GTK_OBJECT(pixmapbox), "expose_event", (GtkSignalFunc) expose_event, NULL); - gtk_signal_connect(GTK_OBJECT(pixmapbox), "configure_event", - (GtkSignalFunc) configure_event, NULL); - gtk_widget_set_events(pixmapbox, GDK_EXPOSURE_MASK); - - if (num_plotwindows < max_plotwindows) { - pixmapboxes[num_plotwindows] = pixmapbox; - pixmaps[num_plotwindows] = NULL; - num_plotwindows++; - } - else { - g_print("gtk_plotarea_new(): exceeded maximum of 10 plotarea windows\n"); - } - - return pixmapbox; -} diff --git a/src/lib/dl/ext/lame/gpkplotting.h b/src/lib/dl/ext/lame/gpkplotting.h deleted file mode 100755 index 221b4222..00000000 --- a/src/lib/dl/ext/lame/gpkplotting.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * GTK plotting routines include file - * - * Copyright (c) 1999 Mark Taylor - * - * 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_GPKPLOTTING_H -#define LAME_GPKPLOTTING_H - -#include - -/* allocate a graphing widget */ -GtkWidget *gpk_plot_new(int width, int height); - -/* graph a function in the graphing widged */ -void gpk_graph_draw(GtkWidget * widget, - int n, gdouble * xcord, gdouble * ycord, - gdouble xmn, gdouble ymn, gdouble xmx, gdouble ymx, - int clear, char *title, GdkColor * color); - -/* draw a rectangle in the graphing widget */ -void gpk_rectangle_draw(GtkWidget * widget, /* plot on this widged */ - gdouble xcord[2], gdouble ycord[2], /* corners */ - gdouble xmn, gdouble ymn, /* coordinates of corners */ - gdouble xmx, gdouble ymx, GdkColor * color); /* color to use */ - -/* make a bar graph in the graphing widged */ -void gpk_bargraph_draw(GtkWidget * widget, - int n, gdouble * xcord, gdouble * ycord, - gdouble xmn, gdouble ymn, gdouble xmx, gdouble ymx, - int clear, char *title, int bwidth, GdkColor * color); - -/* set forground color */ -void setcolor(GtkWidget * widget, GdkColor * color, int red, int green, int blue); - -#endif diff --git a/src/lib/dl/ext/lame/gtkanal.c b/src/lib/dl/ext/lame/gtkanal.c deleted file mode 100755 index 0c925819..00000000 --- a/src/lib/dl/ext/lame/gtkanal.c +++ /dev/null @@ -1,1640 +0,0 @@ -/* - * GTK plotting routines source file - * - * Copyright (c) 1999 Mark Taylor - * - * 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. - */ - -/* $Id: gtkanal.c,v 1.49 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "main.h" -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "lame-analysis.h" -#include "get_audio.h" -#include "gtkanal.h" -#include "gpkplotting.h" -#include "lame_global_flags.h" - -/* this file should be removed. The few data items accessed in 'gfc' - should be made accessable by writing a lame_set_variable() function */ -#include "util.h" - -#include "console.h" - - -#ifdef _WIN32 -# include -# define msleep(t) Sleep(t) -#else -# include -# define msleep(t) usleep((t) * 1000) -#endif - - - - -/*! Stringify \a x. */ -#define STR(x) #x -/*! Stringify \a x, perform macro expansion. */ -#define XSTR(x) STR(x) - -#define MP3X_MAJOR_VERSION 0 /* Major version number */ -#define MP3X_MINOR_VERSION 82 /* Minor version number */ -#define MP3X_ALPHA_VERSION 0 /* Set number if this is an alpha version, otherwise zero */ -#define MP3X_BETA_VERSION 0 /* Set number if this is a beta version, otherwise zero */ - - -plotting_data *pinfo; -plotting_data *pplot; -plotting_data Pinfo[NUMPINFO]; - - -/* global variables for the state of the system */ -static gint idle_keepgoing; /* processing of frames is ON */ -static gint idle_count_max; /* number of frames to process before plotting */ -static gint idle_count; /* pause & plot when idle_count=idel_count_max */ -static gint idle_end = 0; /* process all frames, stop at last frame */ -static gint idle_back = 0; /* set when we are displaying the old data */ -static int mp3done = 0; /* last frame has been read */ -static GtkWidget *frameprogress; /* progress bar */ -static GtkWidget *framecounter; /* progress counter */ - -static int subblock_draw[3] = { 1, 1, 1 }; - -/* main window */ -GtkWidget *window; -/* Backing pixmap for drawing areas */ -GtkWidget *pcmbox; /* PCM data plotted here */ -GtkWidget *winbox; /* mpg123 synthesis data plotted here */ -GtkWidget *enerbox[2]; /* spectrum, gr=0,1 plotted here */ -GtkWidget *mdctbox[2]; /* mdct coefficients gr=0,1 plotted here */ -GtkWidget *sfbbox[2]; /* scalefactors gr=0,1 plotted here */ -GtkWidget *headerbox; /* mpg123 header info shown here */ - - -struct gtkinfostruct { - int filetype; /* input file type 0=WAV, 1=MP3 */ - int msflag; /* toggle between L&R vs M&S PCM data display */ - int chflag; /* toggle between L & R channels */ - int kbflag; /* toggle between wave # and barks */ - int flag123; /* show mpg123 frame info, OR ISO encoder frame info */ - double avebits; /* running average bits per frame */ - int approxbits; /* (approx) bits per frame */ - int maxbits; /* max bits per frame used so far */ - int totemph; /* total of frames with de-emphasis */ - int totms; /* total frames with ms_stereo */ - int totis; /* total frames with i_stereo */ - int totshort; /* total granules with short blocks */ - int totmix; /* total granules with mixed blocks */ - int totpreflag; /* total granules with preflag */ - int pupdate; /* plot while processing, or only when needed */ - int sfblines; /* plot scalefactor bands in MDCT plot */ - int difference; /* plot original - decoded instead of orig vs. decoded */ - int totalframes; -} gtkinfo; - - -static lame_global_flags *gfp; -lame_internal_flags *gfc; -hip_t hip; - -/********************************************************************** - * read one frame and encode it - **********************************************************************/ -int -gtkmakeframe(void) -{ - int iread = 0; - static int init = 0; - static int mpglag; - static short int Buffer[2][1152]; - short int mpg123pcm[2][1152]; - int ch, j; - int mp3count = 0; - int mp3out = 0; - int channels_out; - unsigned char mp3buffer[LAME_MAXMP3BUFFER]; - static int frameNum = 0; - int framesize = lame_get_framesize(gfp); - - channels_out = (lame_get_mode(gfp) == MONO) ? 1 : 2; - - pinfo->frameNum = frameNum; - pinfo->sampfreq = lame_get_out_samplerate(gfp); - pinfo->framesize = framesize; - pinfo->stereo = channels_out; - - /* If the analsys code is enabled, lame will writes data into gfc->pinfo, - * and mpg123 will write data into pinfo. Set these so - * the libraries put this data in the right place: */ - gfc->pinfo = pinfo; - hip_set_pinfo(hip, pinfo); - - if (is_mpeg_file_format(global_reader.input_format)) { - hip_set_pinfo(get_hip(), pplot); - iread = get_audio16(gfp, Buffer); - - - /* add a delay of framesize-DECDELAY, which will make the total delay - * exactly one frame, so we can sync MP3 output with WAV input */ - for (ch = 0; ch < channels_out; ch++) { - for (j = 0; j < framesize - DECDELAY; j++) - pinfo->pcmdata2[ch][j] = pinfo->pcmdata2[ch][j + framesize]; - for (j = 0; j < framesize; j++) /*rescale from int to short int */ - pinfo->pcmdata2[ch][j + framesize - DECDELAY] = Buffer[ch][j]; - } - - pinfo->frameNum123 = frameNum - 1; - ++frameNum; - - } - else { - - /* feed data to encoder until encoder produces some output */ - while (lame_get_frameNum(gfp) == pinfo->frameNum) { - - if (!init) { - init = 1; - mpglag = 1; - if (hip) { - hip_decode_exit(hip); - } - hip = hip_decode_init(); - hip_set_pinfo(hip, pinfo); - } - - iread = get_audio16(gfp, Buffer); - if (iread > framesize) { - /* NOTE: frame analyzer requires that we encode one frame - * for each pass through this loop. If lame_encode_buffer() - * is feed data too quickly, it will sometimes encode multiple frames - * breaking this loop. - */ - error_printf("Warning: get_audio is returning too much data.\n"); - } - if (iread <= 0) - break; /* eof */ - - mp3count = lame_encode_buffer(gfp, Buffer[0], Buffer[1], iread, - mp3buffer, sizeof(mp3buffer)); - - assert(!(mp3count > 0 && lame_get_frameNum(gfp) == pinfo->frameNum)); - /* not possible to produce mp3 data without encoding at least - * one frame of data which would increment frameNum */ - } - frameNum = lame_get_frameNum(gfp); /* use the internal MP3 frame counter */ - - - /* decode one frame of output */ - mp3out = hip_decode1(hip, mp3buffer, mp3count, mpg123pcm[0], mpg123pcm[1]); /* re-synthesis to pcm */ - /* mp3out = 0: need more data to decode */ - /* mp3out = -1: error. Lets assume 0 pcm output */ - /* mp3out = number of samples output */ - if (mp3out > 0) - assert(mp3out == pinfo->framesize); - if (mp3out != 0) { - /* decoded output is for frame pinfo->frameNum123 - * add a delay of framesize-DECDELAY, which will make the total delay - * exactly one frame */ - pinfo->frameNum123 = pinfo->frameNum - mpglag; - for (ch = 0; ch < pinfo->stereo; ch++) { - for (j = 0; j < pinfo->framesize - DECDELAY; j++) - pinfo->pcmdata2[ch][j] = pinfo->pcmdata2[ch][j + pinfo->framesize]; - for (j = 0; j < pinfo->framesize; j++) { - pinfo->pcmdata2[ch][j + pinfo->framesize - DECDELAY] = - (mp3out == -1) ? 0 : mpg123pcm[ch][j]; - } - } - } - else { - if (mpglag == MAXMPGLAG) { - error_printf("READ_AHEAD set too low - not enough frame buffering.\n" - "MP3x display of input and output PCM data out of sync.\n"); - error_flush(); - } - else - mpglag++; - pinfo->frameNum123 = -1; /* no frame output */ - } - } - return iread; -} - - -void -plot_frame(void) -{ - int i, j, n, ch, gr; - gdouble *xcord, *ycord; - gdouble xmx, xmn, ymx, ymn; - double *data, *data2, *data3; - char title2[80]; - char label[80], label2[80]; - char *title; - plotting_data *pplot1; - plotting_data *pplot2 = NULL; - - double en, samp; - /*int sampindex, version = 0;*/ - int barthick; - static int firstcall = 1; - static GdkColor *barcolor, *color, *grcolor[2]; - static GdkColor yellow, gray, cyan, magenta, orange, pink, red, green, blue, black, oncolor, - offcolor; - int blocktype[2][2]; - int headbits; - int mode_gr = 2; - - /* find the frame where mpg123 produced output coming from input frame - * pinfo. i.e.: out_frame + out_frame_lag = input_frame */ - for (i = 1; i <= MAXMPGLAG; i++) { - if ((pplot - i)->frameNum123 == pplot->frameNum) { - pplot2 = pplot - i; - break; - } - } - if (i > MAXMPGLAG) { - error_printf("input/output pcm syncing problem. should not happen!\n"); - pplot2 = pplot - 1; - } - - - /* however, the PCM data is delayed by 528 samples in the encoder filterbanks. - * We added another 1152-528 delay to this so the PCM data is *exactly* one - * frame behind the header & MDCT information */ - pplot1 = pplot2 + 1; /* back one frame for header info, MDCT */ - - /* allocate these GC's only once */ - if (firstcall) { - firstcall = 0; - /* grcolor[0] = &magenta; */ - grcolor[0] = &blue; - grcolor[1] = &green; - barcolor = &gray; - - setcolor(headerbox, &oncolor, 255, 0, 0); - setcolor(headerbox, &offcolor, 175, 175, 175); - setcolor(pcmbox, &red, 255, 0, 0); - setcolor(pcmbox, &pink, 255, 0, 255); - setcolor(pcmbox, &magenta, 255, 0, 100); - setcolor(pcmbox, &orange, 255, 127, 0); - setcolor(pcmbox, &cyan, 0, 255, 255); - setcolor(pcmbox, &green, 0, 255, 0); - setcolor(pcmbox, &blue, 0, 0, 255); - setcolor(pcmbox, &black, 0, 0, 0); - setcolor(pcmbox, &gray, 100, 100, 100); - setcolor(pcmbox, &yellow, 255, 255, 0); - - } - - /******************************************************************* - * frame header info - *******************************************************************/ - if (pplot1->sampfreq) - samp = pplot1->sampfreq; - else - samp = 1; - /*sampindex = SmpFrqIndex((long) samp, &version);*/ - - ch = gtkinfo.chflag; - - headbits = 32 + ((pplot1->stereo == 2) ? 256 : 136); - gtkinfo.approxbits = (pplot1->bitrate * 1000 * 1152.0 / samp) - headbits; - sprintf(title2, "%3.1fkHz %ikbs ", samp / 1000, pplot1->bitrate); - gtk_text_freeze(GTK_TEXT(headerbox)); - gtk_text_backward_delete(GTK_TEXT(headerbox), gtk_text_get_length(GTK_TEXT(headerbox))); - gtk_text_set_point(GTK_TEXT(headerbox), 0); - gtk_text_insert(GTK_TEXT(headerbox), NULL, &oncolor, NULL, title2, -1); - title = " mono "; - if (2 == pplot1->stereo) - title = pplot1->js ? " js " : " s "; - gtk_text_insert(GTK_TEXT(headerbox), NULL, &oncolor, NULL, title, -1); - color = pplot1->ms_stereo ? &oncolor : &offcolor; - gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "ms ", -1); - color = pplot1->i_stereo ? &oncolor : &offcolor; - gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "is ", -1); - - color = pplot1->crc ? &oncolor : &offcolor; - gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "crc ", -1); - color = pplot1->padding ? &oncolor : &offcolor; - gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "pad ", -1); - - color = pplot1->emph ? &oncolor : &offcolor; - gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, "em ", -1); - - sprintf(title2, "bv=%i,%i ", pplot1->big_values[0][ch], pplot1->big_values[1][ch]); - gtk_text_insert(GTK_TEXT(headerbox), NULL, &black, NULL, title2, -1); - - color = pplot1->scfsi[ch] ? &oncolor : &offcolor; - sprintf(title2, "scfsi=%i ", pplot1->scfsi[ch]); - gtk_text_insert(GTK_TEXT(headerbox), NULL, color, NULL, title2, -1); - if (gtkinfo.filetype) - sprintf(title2, " mdb=%i %i/NA", pplot1->maindata, pplot1->totbits); - else - sprintf(title2, " mdb=%i %i/%i", - pplot1->maindata, pplot1->totbits, pplot1->totbits + pplot->resvsize); - gtk_text_insert(GTK_TEXT(headerbox), NULL, &oncolor, NULL, title2, -1); - gtk_text_thaw(GTK_TEXT(headerbox)); - - - - /******************************************************************* - * block type - *******************************************************************/ - for (gr = 0; gr < mode_gr; gr++) - if (gtkinfo.flag123) - blocktype[gr][ch] = pplot1->mpg123blocktype[gr][ch]; - else - blocktype[gr][ch] = pplot->blocktype[gr][ch]; - - - /******************************************************************* - * draw the PCM data * - *******************************************************************/ - n = 1600; /* PCM frame + FFT window: 224 + 1152 + 224 */ - xcord = g_malloc(n * sizeof(gdouble)); - ycord = g_malloc(n * sizeof(gdouble)); - - - if (gtkinfo.msflag) - title = ch ? "Side Channel" : "Mid Channel"; - else - title = ch ? "Right Channel" : "Left Channel"; - - sprintf(title2, "%s mask_ratio=%3.2f %3.2f ener_ratio=%3.2f %3.2f", - title, - pplot->ms_ratio[0], pplot->ms_ratio[1], - pplot->ms_ener_ratio[0], pplot->ms_ener_ratio[1]); - - - ymn = -32767; - ymx = 32767; - xmn = 0; - xmx = 1600 - 1; - - /* 0 ... 224 draw in black, connecting to 224 pixel - * 1375 .. 1599 draw in black connecting to 1375 pixel - * 224 ... 1375 MP3 frame. draw in blue - */ - - /* draw the title */ - gpk_graph_draw(pcmbox, 0, xcord, ycord, xmn, ymn, xmx, ymx, 1, title2, &black); - - - /* draw some hash marks dividing the frames */ - ycord[0] = ymx * .8; - ycord[1] = ymn * .8; - for (gr = 0; gr <= 2; gr++) { - xcord[0] = 223.5 + gr * 576; - xcord[1] = 223.5 + gr * 576; - gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow); - } - for (gr = 0; gr < mode_gr; gr++) { - if (blocktype[gr][ch] == 2) - for (i = 1; i <= 2; i++) { - xcord[0] = 223.5 + gr * 576 + i * 192; - xcord[1] = 223.5 + gr * 576 + i * 192; - gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow); - } - } - /* bars representing FFT windows */ - xcord[0] = 0; - ycord[0] = ymn + 3000; - xcord[1] = 1024 - 1; - ycord[1] = ymn + 1000; - gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, grcolor[0]); - xcord[0] = 576; - ycord[0] = ymn + 2000; - xcord[1] = 576 + 1024 - 1; - ycord[1] = ymn; - gpk_rectangle_draw(pcmbox, xcord, ycord, xmn, ymn, xmx, ymx, grcolor[1]); - - - /* plot PCM data */ - for (i = 0; i < n; i++) { - xcord[i] = i; - if (gtkinfo.msflag) - ycord[i] = ch ? .5 * (pplot->pcmdata[0][i] - pplot->pcmdata[1][i]) : - .5 * (pplot->pcmdata[0][i] + pplot->pcmdata[1][i]); - else - ycord[i] = pplot->pcmdata[ch][i]; - } - - /* skip plot if we are doing an mp3 file */ - if (!gtkinfo.filetype) { - gpk_graph_draw(pcmbox, n, xcord, ycord, xmn, ymn, xmx, ymx, 0, title2, &black); - } - - - /*******************************************************************/ - /* draw the PCM re-synthesis data */ - /*******************************************************************/ - n = 1152; - /* - sprintf(title2,"Re-synthesis mask_ratio=%3.2f %3.2f ener_ratio=%3.2f %3.2f", - pplot->ms_ratio[0],pplot->ms_ratio[1], - pplot->ms_ener_ratio[0],pplot->ms_ener_ratio[1]); - */ - title = "Re-synthesis"; - if (gtkinfo.difference) - title = "Re-synthesis difference (amplified 20db)"; - - - ymn = -32767; - ymx = 32767; - xmn = 0; - xmx = 1600 - 1; - gpk_graph_draw(winbox, 0, xcord, ycord, xmn, ymn, xmx, ymx, 1, title, &black); - /* draw some hash marks dividing the frames */ - ycord[0] = ymx * .8; - ycord[1] = ymn * .8; - for (gr = 0; gr <= 2; gr++) { - xcord[0] = 223.5 + gr * 576; - xcord[1] = 223.5 + gr * 576; - gpk_rectangle_draw(winbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow); - } - for (gr = 0; gr < 2; gr++) { - if (blocktype[gr][ch] == 2) - for (i = 1; i <= 2; i++) { - xcord[0] = 223.5 + gr * 576 + i * 192; - xcord[1] = 223.5 + gr * 576 + i * 192; - gpk_rectangle_draw(winbox, xcord, ycord, xmn, ymn, xmx, ymx, &yellow); - } - } - - /* this piece of PCM data from previous frame */ - n = 224; - for (j = 1152 - n, i = 0; i < n; i++, j++) { - xcord[i] = i; - if (gtkinfo.msflag) - ycord[i] = ch ? .5 * (pplot1->pcmdata2[0][j] - - pplot1->pcmdata2[1][j]) : - .5 * (pplot1->pcmdata2[0][j] + pplot1->pcmdata2[1][j]); - else - ycord[i] = pplot1->pcmdata2[ch][j]; - } - - /* this piece of PCM data from current frame */ - n = 1152; - for (i = 0; i < n; i++) { - xcord[i + 224] = i + 224; - if (gtkinfo.msflag) - ycord[i + 224] = ch ? .5 * (pplot2->pcmdata2[0][i] - pplot2->pcmdata2[1][i]) : - .5 * (pplot2->pcmdata2[0][i] + pplot2->pcmdata2[1][i]); - else - ycord[i + 224] = pplot2->pcmdata2[ch][i]; - } - - n = 1152 + 224; - if (gtkinfo.difference) { - for (i = 0; i < n; i++) { - if (gtkinfo.msflag) - ycord[i] -= ch ? .5 * (pplot->pcmdata[0][i] - pplot->pcmdata[1][i]) : - .5 * (pplot->pcmdata[0][i] + pplot->pcmdata[1][i]); - else - ycord[i] -= pplot->pcmdata[ch][i]; - } - ycord[i] *= 100; - } - - - gpk_graph_draw(winbox, n, xcord, ycord, xmn, ymn, xmx, ymx, 0, title, &black); - - - - - - /*******************************************************************/ - /* draw the MDCT energy spectrum */ - /*******************************************************************/ - for (gr = 0; gr < mode_gr; gr++) { - int bits, bits2; - char *blockname = ""; - switch (blocktype[gr][ch]) { - case 0: - blockname = "normal"; - break; - case 1: - blockname = "start"; - break; - case 2: - blockname = "short"; - break; - case 3: - blockname = "end"; - break; - } - strcpy(label, blockname); - if (pplot1->mixed[gr][ch]) - strcat(label, "(mixed)"); - - - - - n = 576; - if (gtkinfo.flag123) { - data = pplot1->mpg123xr[gr][0]; - data2 = pplot1->mpg123xr[gr][1]; - } - else { - data = pplot->xr[gr][0]; - data2 = pplot->xr[gr][1]; - } - - - xmn = 0; - xmx = n - 1; - ymn = 0; - ymx = 11; - - /* draw title, erase old plot */ - if (gtkinfo.flag123) { - bits = pplot1->mainbits[gr][ch]; - bits2 = pplot1->sfbits[gr][ch]; - } - else { - bits = pplot->LAMEmainbits[gr][ch]; - bits2 = pplot->LAMEsfbits[gr][ch]; - } - sprintf(title2, "MDCT%1i(%s) bits=%i/%i ", gr, label, bits, bits2); - gpk_bargraph_draw(mdctbox[gr], 0, xcord, ycord, xmn, ymn, xmx, ymx, 1, title2, 0, barcolor); - - /* draw some hash marks showing scalefactor bands */ - if (gtkinfo.sfblines) { - int fac, nsfb, *scalefac; - if (blocktype[gr][ch] == SHORT_TYPE) { - nsfb = SBMAX_s; - i = nsfb - 7; - fac = 3; - scalefac = gfc->scalefac_band.s; - } - else { - nsfb = SBMAX_l; - i = nsfb - 10; - fac = 1; - scalefac = gfc->scalefac_band.l; - } - for (; i < nsfb; i++) { - ycord[0] = .8 * ymx; - ycord[1] = ymn; - xcord[0] = fac * scalefac[i]; - xcord[1] = xcord[0]; - gpk_rectangle_draw(mdctbox[gr], xcord, ycord, xmn, ymn, xmx, ymx, &yellow); - } - } - - - - ymn = 9e20; - ymx = -9e20; - for (i = 0; i < n; i++) { - double coeff; - xcord[i] = i; - if (gtkinfo.msflag) { - coeff = ch ? .5 * (data[i] - data2[i]) : .5 * (data[i] + data2[i]); - } - else { - coeff = ch ? data2[i] : data[i]; - } - if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3]) - coeff = 0; - ycord[i] = coeff * coeff * 1e10; - ycord[i] = log10(MAX(ycord[i], (double) 1)); - -#if 0 - if (ch == 0) - if (i == 26) - if (data[i] != 0) - console_printf("%i %i i=%i mdct: (db) %f %f \n", pplot->frameNum, gr, i, - 10 * log10(data[i] * data[i]), - 10 * log10(.33 * - (data[i - 1] * data[i - 1] + data[i] * data[i] + - data[i + 1] * data[i + 1])) - ); -#endif - - ymx = (ycord[i] > ymx) ? ycord[i] : ymx; - ymn = (ycord[i] < ymn) ? ycord[i] : ymn; - } - /* print the min/max - sprintf(title2,"MDCT%1i %5.2f %5.2f bits=%i",gr,ymn,ymx, - pplot1->mainbits[gr][ch]); - */ - if (gtkinfo.flag123) - bits = pplot1->mainbits[gr][ch]; - else - bits = pplot->LAMEmainbits[gr][ch]; - - - sprintf(title2, "MDCT%1i(%s) bits=%i ", gr, label, bits); - - xmn = 0; - xmx = n - 1; - ymn = 0; - ymx = 11; - gpk_bargraph_draw(mdctbox[gr], n, xcord, ycord, xmn, ymn, xmx, ymx, 0, title2, 0, barcolor); - } - - - - - /******************************************************************* - * draw the psy model energy spectrum (k space) - * l3psy.c computes pe, en, thm for THIS granule. - *******************************************************************/ - if (gtkinfo.kbflag) { - for (gr = 0; gr < mode_gr; gr++) { - n = HBLKSIZE; /* only show half the spectrum */ - - data = &pplot->energy[gr][ch][0]; - - ymn = 9e20; - ymx = -9e20; - for (i = 0; i < n; i++) { - xcord[i] = i + 1; - if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3]) - ycord[i] = 0; - else - ycord[i] = log10(MAX(data[i], (double) 1)); - ymx = (ycord[i] > ymx) ? ycord[i] : ymx; - ymn = (ycord[i] < ymn) ? ycord[i] : ymn; - } - for (en = 0, j = 0; j < BLKSIZE; j++) - en += pplot->energy[gr][ch][j]; - - sprintf(title2, "FFT%1i pe=%5.2fK en=%5.2e ", gr, pplot->pe[gr][ch] / 1000, en); - - ymn = 3; - ymx = 15; - xmn = 1; - xmx = n; - gpk_bargraph_draw(enerbox[gr], n, xcord, ycord, - xmn, ymn, xmx, ymx, 1, title2, 0, barcolor); - - } - } - else { - /******************************************************************* - * draw the psy model energy spectrum (scalefactor bands) - *******************************************************************/ - for (gr = 0; gr < mode_gr; gr++) { - - if (blocktype[gr][ch] == 2) { - n = 3 * SBMAX_s; - data = &pplot->en_s[gr][ch][0]; - data2 = &pplot->thr_s[gr][ch][0]; - data3 = &pplot->xfsf_s[gr][ch][0]; - } - else { - n = SBMAX_l; - data = &pplot->en[gr][ch][0]; - data2 = &pplot->thr[gr][ch][0]; - data3 = &pplot->xfsf[gr][ch][0]; - } - ymn = 9e20; - ymx = -9e20; - for (i = 0; i < n; i++) { - xcord[i] = i + 1; - if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3]) - ycord[i] = 0; - else - ycord[i] = log10(MAX(data[i], (double) 1)); - /* - ymx=(ycord[i] > ymx) ? ycord[i] : ymx; - ymn=(ycord[i] < ymn) ? ycord[i] : ymn; - */ - } - - - - /* en = max energy difference amoung the 3 short FFTs for this granule */ - en = pplot->ers[gr][ch]; - if (en > 999) - en = 999; - sprintf(title2, - "FFT%1i pe=%5.2fK/%3.1f \nnoise ovr_b:%i/max:%3.1f/ovr:%3.1f/tot:%3.1f/ssd:%i", - gr, pplot->pe[gr][ch] / 1000, en, pplot->over[gr][ch], pplot->max_noise[gr][ch], - pplot->over_noise[gr][ch], pplot->tot_noise[gr][ch], pplot->over_SSD[gr][ch]); - - barthick = 3; - if (blocktype[gr][ch] == SHORT_TYPE) - barthick = 2; - if (!(subblock_draw[0] && subblock_draw[1] && subblock_draw[2])) - barthick = 3; - - ymn = 3; - ymx = 15; - xmn = 1; - xmx = n + 1; /* a little extra because of the bar thickness */ - gpk_bargraph_draw(enerbox[gr], n, xcord, ycord, - xmn, ymn, xmx, ymx, 1, title2, barthick, barcolor); - - for (i = 0; i < n; i++) { - xcord[i] = i + 1 + .20; - if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3]) - ycord[i] = 0; - else - ycord[i] = log10(MAX(data2[i], (double) 1)); - } - - gpk_bargraph_draw(enerbox[gr], n, xcord, ycord, - xmn, ymn, xmx, ymx, 0, title2, barthick, grcolor[gr]); - - for (i = 0; i < n; i++) { - xcord[i] = i + 1 + .40; - if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3]) - ycord[i] = 0; - else - ycord[i] = log10(MAX(data3[i], (double) 1)); - } - gpk_bargraph_draw(enerbox[gr], n, xcord, ycord, - xmn, ymn, xmx, ymx, 0, title2, barthick, &red); - - } - } - - /******************************************************************* - * draw scalefactors - *******************************************************************/ - for (gr = 0; gr < mode_gr; gr++) { - int ggain; - if (blocktype[gr][ch] == 2) { - n = 3 * SBMAX_s; - if (gtkinfo.flag123) - data = pplot1->sfb_s[gr][ch]; - else - data = pplot->LAMEsfb_s[gr][ch]; - } - else { - n = SBMAX_l; - if (gtkinfo.flag123) - data = pplot1->sfb[gr][ch]; - else - data = pplot->LAMEsfb[gr][ch]; - } - - ymn = -1; - ymx = 10; - for (i = 0; i < n; i++) { - xcord[i] = i + 1; - if (blocktype[gr][ch] == SHORT_TYPE && !subblock_draw[i % 3]) - ycord[i] = 0; - else - ycord[i] = -data[i]; - - ymx = (ycord[i] > ymx - 2) ? ycord[i] + 2 : ymx; - ymn = (ycord[i] < ymn) ? ycord[i] - 1 : ymn; - } - - if (blocktype[gr][ch] == 2) { - sprintf(label2, - "SFB scale=%i preflag=%i %i%i%i", - pplot1->scalefac_scale[gr][ch], - pplot1->preflag[gr][ch], - pplot1->sub_gain[gr][ch][0], - pplot1->sub_gain[gr][ch][1], pplot1->sub_gain[gr][ch][2]); - } - else { - sprintf(label2, "SFB scale=%i preflag=%i", pplot1->scalefac_scale[gr][ch], - pplot1->preflag[gr][ch]); - } - - if (gtkinfo.flag123) - ggain = (pplot1->qss[gr][ch]); - else - ggain = (pplot->LAMEqss[gr][ch]); - - sprintf(title2, " ggain=%i", ggain); - strcat(label2, title2); - - xmn = 1; - xmx = n + 1; - gpk_bargraph_draw(sfbbox[gr], n, xcord, ycord, - xmn, ymn, xmx, ymx, 1, label2, 0, grcolor[gr]); - - ycord[0] = ycord[1] = 0; - xcord[0] = 1; - xcord[1] = n + 1; - gpk_rectangle_draw(sfbbox[gr], xcord, ycord, xmn, ymn, xmx, ymx, &yellow); - - - } - - -} - - - -static void -update_progress(void) -{ - char label[80]; - - int tf = lame_get_totalframes(gfp); - if (gtkinfo.totalframes > 0) - tf = gtkinfo.totalframes; - - sprintf(label, "Frame:%4i/%4i %6.2fs", pplot->frameNum, (int) tf - 1, pplot->frametime); - gtk_progress_set_value(GTK_PROGRESS(frameprogress), (gdouble) pplot->frameNum); - gtk_label_set_text(GTK_LABEL(framecounter), label); -} - - - -static void -analyze(void) -{ - if (idle_keepgoing) { - idle_count = 0; - idle_count_max = 0; - idle_keepgoing = 0; - idle_end = 0; - } - plot_frame(); - update_progress(); -} - -static void -plotclick(GtkWidget * widget, gpointer data) -{ - analyze(); -} - - - - -static int -frameadv1(GtkWidget * widget, gpointer data) -{ - int i; - if (idle_keepgoing) { - if (idle_back) { - /* frame displayed is the old frame. to advance, just swap in new frame */ - idle_back--; - pplot = &Pinfo[READ_AHEAD + idle_back]; - } - else { - /* advance the frame by reading in a new frame */ - pplot = &Pinfo[READ_AHEAD]; - if (mp3done) { - /* dont try to read any more frames, and quit if "finish MP3" was selected */ - /* if (idle_finish) gtk_main_quit(); */ - idle_count_max = 0; - idle_end = 0; - } - else { - /* read in the next frame */ - for (i = NUMPINFO - 1; i > 0; i--) - memcpy(&Pinfo[i], &Pinfo[i - 1], sizeof(plotting_data)); - pinfo = &Pinfo[0]; - pinfo->num_samples = gtkmakeframe(); - if (pinfo->num_samples == 0 && gtkinfo.totalframes == 0) - /* allow an extra frame to flush decoder buffers */ - gtkinfo.totalframes = pinfo->frameNum + 2; - - if (pinfo->sampfreq) - pinfo->frametime = (pinfo->frameNum) * 1152.0 / pinfo->sampfreq; - else - pinfo->frametime = 0; - - /* eof? - if (!pinfo->num_samples) if (idle_finish) gtk_main_quit(); - */ - - pinfo->totbits = 0; - { - int gr, ch; - for (gr = 0; gr < 2; gr++) - for (ch = 0; ch < 2; ch++) { - gtkinfo.totshort += (pinfo->mpg123blocktype[gr][ch] == 2); - gtkinfo.totmix += !(pinfo->mixed[gr][ch] == 0); - gtkinfo.totpreflag += (pinfo->preflag[gr][ch] == 1); - pinfo->totbits += pinfo->mainbits[gr][ch]; - } - } - if (pinfo->frameNum > 0) /* start averaging at second frame */ - gtkinfo.avebits = (gtkinfo.avebits * ((pinfo->frameNum) - 1) - + pinfo->totbits) / (pinfo->frameNum); - - gtkinfo.maxbits = MAX(gtkinfo.maxbits, pinfo->totbits); - gtkinfo.totemph += !(pinfo->emph == 0); - gtkinfo.totms += !(pinfo->ms_stereo == 0); - gtkinfo.totis += !(pinfo->i_stereo == 0); - - if (gtkinfo.totalframes > 0) - if (pplot->frameNum >= gtkinfo.totalframes - 1) - mp3done = 1; - } - } - - idle_count++; - if (gtkinfo.pupdate) - plot_frame(); - update_progress(); - if ((idle_count >= idle_count_max) && (!idle_end)) - analyze(); - } - else { - /*no processing to do, sleep in order to not monopolize CPU */ - msleep(10); - } - return 1; -} - - -static void -frameadv(GtkWidget * widget, gpointer data) -{ - int adv; - - if (!strcmp((char *) data, "-1")) { - /* ignore if we've already gone back as far as possible */ - if (pplot->frameNum == 0 || (idle_back == NUMBACK)) - return; - idle_back++; - pplot = &Pinfo[READ_AHEAD + idle_back]; - analyze(); - return; - } - - - adv = 1; - if (!strcmp((char *) data, "1")) - adv = 1; - if (!strcmp((char *) data, "10")) - adv = 10; - if (!strcmp((char *) data, "100")) - adv = 100; - if (!strcmp((char *) data, "finish")) - idle_end = 1; - - - if (idle_keepgoing) { - /* already running - que up additional frame advance requests */ - idle_count_max += adv; - } - else { - /* turn on idleing */ - idle_count_max = adv; - idle_count = 0; - idle_keepgoing = 1; - } -} - - - - -/* another callback */ -static void -delete_event(GtkWidget * widget, GdkEvent * event, gpointer data) -{ - /* set MP3 done flag in case the File/Quit menu item has been selected */ - mp3done = 1; - - gtk_main_quit(); -} - - - - - - - -static void -channel_option(GtkWidget * widget, gpointer data) -{ - long option; - option = (long) data; - switch (option) { - case 1: - gtkinfo.msflag = 0; - gtkinfo.chflag = 0; - break; - case 2: - gtkinfo.msflag = 0; - gtkinfo.chflag = 1; - break; - case 3: - gtkinfo.msflag = 1; - gtkinfo.chflag = 0; - break; - case 4: - gtkinfo.msflag = 1; - gtkinfo.chflag = 1; - } - analyze(); -} -static void -spec_option(GtkWidget * widget, gpointer data) -{ - long option; - option = (long) data; - switch (option) { - case 1: - gtkinfo.kbflag = 0; - break; - case 2: - gtkinfo.kbflag = 1; - break; - case 3: - gtkinfo.flag123 = 0; - break; - case 4: - gtkinfo.flag123 = 1; - break; - case 5: - gtkinfo.pupdate = 1; - break; - case 6: - gtkinfo.pupdate = 0; - break; - case 7: - gtkinfo.sfblines = !gtkinfo.sfblines; - break; - case 8: - gtkinfo.difference = !gtkinfo.difference; - break; - } - analyze(); -} - -static gint -key_press_event(GtkWidget * widget, GdkEventKey * event) -{ - /* is a switch() statement in lame forbidden? */ - if (event->keyval == '1') { - subblock_draw[0] = 1; - subblock_draw[1] = 0; - subblock_draw[2] = 0; - analyze(); - } - else if (event->keyval == '2') { - subblock_draw[0] = 0; - subblock_draw[1] = 1; - subblock_draw[2] = 0; - analyze(); - } - else if (event->keyval == '3') { - subblock_draw[0] = 0; - subblock_draw[1] = 0; - subblock_draw[2] = 1; - analyze(); - } - else if (event->keyval == '0') { - subblock_draw[0] = 1; - subblock_draw[1] = 1; - subblock_draw[2] = 1; - analyze(); - } - /* analyze(); */ /* dont redraw entire window for every key! */ - return 0; -} - - -/*! Get the mp3x version string. */ -/*! - \param void - \return a pointer to a string which describes the version of mp3x. -*/ -const char * -get_mp3x_version(void) -{ -#if MP3X_ALPHA_VERSION > 0 - static /*@observer@ */ const char *const str = - XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION) - " (alpha " XSTR(MP3X_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")"; -#elif MP3X_BETA_VERSION > 0 - static /*@observer@ */ const char *const str = - XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION) - " (beta " XSTR(MP3X_BETA_VERSION) ", " __DATE__ ")"; -#else - static /*@observer@ */ const char *const str = - XSTR(MP3X_MAJOR_VERSION) "." XSTR(MP3X_MINOR_VERSION); -#endif - - return str; -} - - -static void -text_window(GtkWidget * widget, gpointer data) -{ - long option; - GtkWidget *hbox, *vbox, *button, *box; - GtkWidget *textwindow, *vscrollbar; - char text[256]; - - option = (long) data; - - textwindow = gtk_window_new(GTK_WINDOW_DIALOG); - gtk_signal_connect_object(GTK_OBJECT(window), "delete_event", - GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(textwindow)); - - gtk_container_set_border_width(GTK_CONTAINER(textwindow), 0); - vbox = gtk_vbox_new(FALSE, 0); - hbox = gtk_hbox_new(FALSE, 0); - - button = gtk_button_new_with_label("close"); - gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(textwindow)); - - box = gtk_text_new(NULL, NULL); - gtk_text_set_editable(GTK_TEXT(box), FALSE); - vscrollbar = gtk_vscrollbar_new(GTK_TEXT(box)->vadj); - - - switch (option) { - case 0: - gtk_window_set_title(GTK_WINDOW(textwindow), "Documentation"); - gtk_widget_set_usize(box, 450, 500); - gtk_text_set_word_wrap(GTK_TEXT(box), TRUE); - /* text should be moved outside this function, may be in a separate file */ - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, - "Frame header information: " - "First the bitrate, sampling frequency and mono, stereo or jstereo " - "indicators are displayed . If the bitstream is jstereo, then mid/side " - "stereo or intensity stereo may be on (indicated in red). If " - "de-emphasis is used, this is also indicated in red. The mdb value is " - "main_data_begin. The encoded data starts this many bytes *before* the " - "frame header. A large value of mdb means the bitstream has saved some " - "bits into the reservoir, which it may allocate for some future frame. " - "The two numbers after mdb are the size (in bits) used to encode the " - "MDCT coefficients for this frame, followed byt the size of the bit " - "resevoir before encoding this frame. The maximum frame size and a " - "running average are given in the Stats pull down menu. A large " - "maximum frame size indicates the bitstream has made use of the bit " - "reservoir. \n\n", -1); - - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, - "PCM data (top graph): " - "The PCM data is plotted in black. The layer3 frame is divided into 2 " - "granules of 576 samples (marked with yellow vertical lines). In the " - "case of normal, start and stop blocks, the MDCT coefficients for each " - "granule are computed using a 1152 sample window centered over the " - "granule. In the case of short blocks, the granule is further divided " - "into 3 blocks of 192 samples (also marked with yellow vertical lines)." - "The MDCT coefficients for these blocks are computed using 384 sample " - "windows centered over the 192 sample window. (This info not available " - "when analyzing .mp3 files.) For the psycho-acoustic model, a windowed " - "FFT is computed for each granule. The range of these windows " - "is denoted by the blue and green bars.\n\n", -1); - - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, - "PCM re-synthesis data (second graph): " - "Same as the PCM window described above. The data displayed is the " - "result of encoding and then decoding the original sample. \n\n", -1); - - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, - "MDCT windows: " - "Shows the energy in the MDCT spectrum for granule 0 (left window) " - "and granule 1 (right window). The text also shows the blocktype " - "used, the number of bits used to encode the coefficients and the " - "number of extra bits allocated from the reservoir. The MDCT pull down " - "window will toggle between the original unquantized MDCT coefficients " - "and the compressed (quantized) coefficients.\n\n", -1); - - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, - "FFT window: " - "The gray bars show the energy in the FFT spectrum used by the " - "psycho-acoustic model. Granule 0 is in the left window, granule 1 in " - "the right window. The green and blue bars show how much distortion is " - "allowable, as computed by the psycho-acoustic model. The red bars show " - "the actual distortion after encoding. There is one FFT for each " - "granule, computed with a 1024 Hann window centered over the " - "appropriate granule. (the range of this 1024 sample window is shown " - "by the blue and green bars in the PCM data window). The Spectrum pull " - "down window will toggle between showing the energy in equally spaced " - "frequency domain and the scale factor bands used by layer3. Finally, " - "the perceptual entropy, total energy and number of scalefactor bands " - "with audible distortion is shown. (This info not available when " - "analyzing .mp3 files.)", -1); - - break; - case 1: - /* Set the about box information */ - gtk_window_set_title(GTK_WINDOW(textwindow), "About"); - gtk_widget_set_usize(box, 350, 260); - - sprintf(text, "LAME version %s \n%s\n\n", get_lame_version(), get_lame_url()); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - - sprintf(text, "psycho-acoustic model: GPSYCHO version %s\n", get_psy_version()); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - - sprintf(text, "frame analyzer: MP3x version %s\n\n", get_mp3x_version()); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, - "decoder: mpg123/mpglib .59q \nMichael Hipp (www.mpg123.de)\n\n", -1); - - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, - "Encoder, decoder & psy-models based on ISO\ndemonstration source. ", -1); - break; - - case 2: - gtk_window_set_title(GTK_WINDOW(textwindow), "Statistics"); - gtk_widget_set_usize(box, 350, 260); - sprintf(text, "frames processed so far: %i \n", Pinfo[0].frameNum + 1); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "granules processed so far: %i \n\n", 4 * (Pinfo[0].frameNum + 1)); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "mean bits/frame (approximate): %i\n", gtkinfo.approxbits); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "mean bits/frame (from LAME): %i\n", 4 * Pinfo[0].mean_bits); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "bitsize of largest frame: %i \n", gtkinfo.maxbits); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "average bits/frame: %3.1f \n\n", gtkinfo.avebits); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "ms_stereo frames: %i \n", gtkinfo.totms); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "i_stereo frames: %i \n", gtkinfo.totis); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "de-emphasis frames: %i \n", gtkinfo.totemph); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "short block granules: %i \n", gtkinfo.totshort); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "mixed block granules: %i \n", gtkinfo.totmix); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - sprintf(text, "preflag granules: %i \n", gtkinfo.totpreflag); - gtk_text_insert(GTK_TEXT(box), NULL, NULL, NULL, text, -1); - break; - } - - - - gtk_widget_show(vscrollbar); - gtk_widget_show(box); - gtk_widget_show(vbox); - gtk_widget_show(hbox); - gtk_widget_show(button); - - gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(hbox), vscrollbar, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); - gtk_box_pack_end(GTK_BOX(vbox), button, FALSE, TRUE, 0); - gtk_container_add(GTK_CONTAINER(textwindow), vbox); - gtk_widget_show(textwindow); - -} - - - - -/* #include */ - - -/* This is the GtkItemFactoryEntry structure used to generate new menus. - Item 1: The menu path. The letter after the underscore indicates an - accelerator key once the menu is open. - Item 2: The accelerator key for the entry - Item 3: The callback function. - Item 4: The callback action. This changes the parameters with - which the function is called. The default is 0. - Item 5: The item type, used to define what kind of an item it is. - Here are the possible values: - - NULL -> "" - "" -> "" - "" -> create a title item - "<Item>" -> create a simple item - "<CheckItem>" -> create a check item - "<ToggleItem>" -> create a toggle item - "<RadioItem>" -> create a radio item - <path> -> path of a radio item to link against - "<Separator>" -> create a separator - "<Branch>" -> create an item to hold sub items - "<LastBranch>" -> create a right justified branch -*/ - - -#define C(chr) "<control>" #chr -#define func(name) (GtkItemFactoryCallback) (name) - -static const GtkItemFactoryEntry menu_items[] = { - {"/_File", NULL, NULL, 0, "<Branch>"}, -#if 0 - {"/File/_New", C(N), func(print_hello), 0, NULL}, - {"/File/_Open", C(O), func(print_hello), 0, NULL}, - {"/File/_Save", C(S), func(print_hello), 0, NULL}, - {"/File/Save _As", NULL, NULL, 0, NULL}, - {"/File/sep1", NULL, NULL, 0, "<Separator>"}, - {"/File/Quit", C(Q), func(gtk_main_quit), 0, NULL}, -#endif - {"/File/_Quit", C(Q), func(delete_event), 0, NULL}, - - {"/_Plotting", NULL, NULL, 0, "<Branch>"}, - {"/Plotting/_While advancing", NULL, func(spec_option), 5, NULL}, - {"/Plotting/_After advancing", NULL, func(spec_option), 6, NULL}, - {"/Plotting/Toggle SFB lines", NULL, func(spec_option), 7, NULL}, - {"/Plotting/Toggle orig-diff", NULL, func(spec_option), 8, NULL}, - - {"/_Channel", NULL, NULL, 0, "<Branch>"}, - {"/Channel/show _Left", NULL, func(channel_option), 1, NULL}, - {"/Channel/show _Right", NULL, func(channel_option), 2, NULL}, - {"/Channel/show _Mid", NULL, func(channel_option), 3, NULL}, - {"/Channel/show _Side", NULL, func(channel_option), 4, NULL}, - - {"/_Spectrum", NULL, NULL, 0, "<Branch>"}, - {"/Spectrum/_Scalefactor bands", NULL, func(spec_option), 1, NULL}, - {"/Spectrum/_Wave number", NULL, func(spec_option), 2, NULL}, - - {"/_MDCT", NULL, NULL, 0, "<Branch>"}, - {"/MDCT/_Original", NULL, func(spec_option), 3, NULL}, - {"/MDCT/_Compressed", NULL, func(spec_option), 4, NULL}, - {"/MDCT/_Toggle SFB lines", NULL, func(spec_option), 7, NULL}, - - {"/_Stats", NULL, NULL, 0, "<Branch>"}, - {"/Stats/_Show", NULL, func(text_window), 2, NULL}, - - {"/_Help", NULL, NULL, 0, "<LastBranch>"}, - {"/_Help/_Documentation", NULL, func(text_window), 0, NULL}, - {"/_Help/_About", NULL, func(text_window), 1, NULL}, -}; - -#undef C -#undef func - - -static void -get_main_menu(GtkWidget * windows, GtkWidget ** menubar) -{ - unsigned int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); - GtkItemFactory *item_factory; - GtkAccelGroup *accel_group; - - accel_group = gtk_accel_group_new(); - - /* This function initializes the item factory. - Param 1: The type of menu - can be GTK_TYPE_MENU_BAR, GTK_TYPE_MENU, - or GTK_TYPE_OPTION_MENU. - Param 2: The path of the menu. - Param 3: A pointer to a gtk_accel_group. The item factory sets up - the accelerator table while generating menus. - */ - - item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); - - /* This function generates the menu items. Pass the item factory, - the number of items in the array, the array itself, and any - callback data for the the menu items. */ - gtk_item_factory_create_items(item_factory, nmenu_items, (GtkItemFactoryEntry *) menu_items, - NULL); - - /* Attach the new accelerator group to the window. */ - gtk_accel_group_attach(accel_group, GTK_OBJECT(windows)); - - if (menubar) - /* Finally, return the actual menu bar created by the item factory. */ - *menubar = gtk_item_factory_get_widget(item_factory, "<main>"); -} - - - - - - - - - - - - - - - - -int -gtkcontrol(lame_global_flags * gfp2, char *inPath) -{ - /* GtkWidget is the storage type for widgets */ - GtkWidget *button; - GtkAdjustment *adj; - GtkWidget *mbox; /* main box */ - GtkWidget *box1; /* frame control buttons go */ - GtkWidget *box2; /* frame counters */ - GtkWidget *box3; /* frame header info */ - GtkWidget *table; /* table for all the plotting areas */ - GtkWidget *menubar; - - gint tableops, graphx, graphy; - char frameinfo[80]; - - graphx = 600; /* minimum allowed size of pixmap */ - graphy = 95; - - gfp = gfp2; - gfc = gfp->internal_flags; - - /* set some global defaults/variables */ - gtkinfo.filetype = is_mpeg_file_format(global_reader.input_format) ? 1 : 0; - gtkinfo.msflag = 0; - gtkinfo.chflag = 0; - gtkinfo.kbflag = 0; - gtkinfo.flag123 = is_mpeg_file_format(global_reader.input_format) ? 1 : 0; /* MP3 file=use mpg123 output */ - gtkinfo.pupdate = 0; - gtkinfo.avebits = 0; - gtkinfo.maxbits = 0; - gtkinfo.approxbits = 0; - gtkinfo.totemph = 0; - gtkinfo.totms = 0; - gtkinfo.totis = 0; - gtkinfo.totshort = 0; - gtkinfo.totmix = 0; - gtkinfo.sfblines = 1; - gtkinfo.difference = 0; - gtkinfo.totalframes = 0; - - memset((char *) Pinfo, 0, sizeof(Pinfo)); - pplot = &Pinfo[READ_AHEAD]; - - strcpy(frameinfo, "MP3x: "); - strncat(frameinfo, inPath, 70); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(window), frameinfo); - gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(delete_event), NULL); - - gtk_signal_connect_object(GTK_OBJECT(window), "key_press_event", - GTK_SIGNAL_FUNC(key_press_event), GTK_OBJECT(window)); - - gtk_container_set_border_width(GTK_CONTAINER(window), 0); - - - mbox = gtk_vbox_new(FALSE, 0); - - - /* layout of mbox */ - box1 = gtk_hbox_new(FALSE, 0); - box2 = gtk_hbox_new(FALSE, 0); - box3 = gtk_hbox_new(FALSE, 0); - table = gtk_table_new(5, 2, FALSE); - tableops = GTK_FILL | GTK_EXPAND | GTK_SHRINK; - get_main_menu(window, &menubar); - - gtk_box_pack_start(GTK_BOX(mbox), menubar, FALSE, TRUE, 0); - gtk_box_pack_end(GTK_BOX(mbox), box1, FALSE, TRUE, 0); - gtk_box_pack_end(GTK_BOX(mbox), box2, FALSE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(mbox), box3, FALSE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(mbox), table, TRUE, TRUE, 0); - gtk_container_add(GTK_CONTAINER(window), mbox); - - - /*********************************************************************/ - /* stuff in box3 frame header info */ - /*********************************************************************/ - /* - headerbox = gtk_label_new(" "); - gtk_label_set_justify(GTK_LABEL(headerbox),GTK_JUSTIFY_LEFT); - */ - headerbox = gtk_text_new(NULL, NULL); - gtk_text_set_editable(GTK_TEXT(headerbox), FALSE); - gtk_widget_set_usize(headerbox, 200, 20); - gtk_widget_show(headerbox); - gtk_box_pack_start(GTK_BOX(box3), headerbox, TRUE, TRUE, 0); - - - - /*********************************************************************/ - /* stuff in box2 frame counters */ - /*********************************************************************/ - framecounter = gtk_label_new(""); - gtk_widget_show(framecounter); - gtk_box_pack_start(GTK_BOX(box2), framecounter, FALSE, TRUE, 0); - - adj = (GtkAdjustment *) gtk_adjustment_new(0, 0, (gint) lame_get_totalframes(gfp) - 1, 0, 0, 0); - frameprogress = gtk_progress_bar_new_with_adjustment(adj); - /* Set the format of the string that can be displayed in the - * trough of the progress bar: - * %p - percentage - * %v - value - * %l - lower range value - * %u - upper range value */ - gtk_progress_set_format_string(GTK_PROGRESS(frameprogress), "%p%%"); - gtk_progress_set_value(GTK_PROGRESS(frameprogress), (gdouble) 0); - gtk_progress_set_show_text(GTK_PROGRESS(frameprogress), TRUE); - gtk_widget_show(frameprogress); - gtk_box_pack_end(GTK_BOX(box2), frameprogress, FALSE, TRUE, 0); - - - - /*********************************************************************/ - /* stuff in box1 buttons along bottom */ - /*********************************************************************/ - button = gtk_button_new_with_label("-1"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "-1"); - gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = gtk_button_new_with_label("+1"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "1"); - gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = gtk_button_new_with_label("+10"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "10"); - gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = gtk_button_new_with_label("+100"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(frameadv), (gpointer) "100"); - gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = gtk_button_new_with_label("last frame"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(frameadv), (gpointer) "finish"); - gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = gtk_button_new_with_label("stop/plot"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(plotclick), NULL); - gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - - /*********************************************************************/ - /* stuff in table. all the plotting windows */ - /*********************************************************************/ - pcmbox = gpk_plot_new(graphx, graphy); - gtk_table_attach(GTK_TABLE(table), pcmbox, 0, 2, 0, 1, tableops, tableops, 2, 2); - gtk_widget_show(pcmbox); - - winbox = gpk_plot_new(graphy, graphy); - gtk_table_attach(GTK_TABLE(table), winbox, 0, 2, 1, 2, tableops, tableops, 2, 2); - gtk_widget_show(winbox); - - - mdctbox[0] = gpk_plot_new(graphy, graphy); - gtk_table_attach(GTK_TABLE(table), mdctbox[0], 0, 1, 2, 3, tableops, tableops, 2, 2); - gtk_widget_show(mdctbox[0]); - - mdctbox[1] = gpk_plot_new(graphy, graphy); - gtk_table_attach(GTK_TABLE(table), mdctbox[1], 1, 2, 2, 3, tableops, tableops, 2, 2); - gtk_widget_show(mdctbox[1]); - - enerbox[0] = gpk_plot_new(graphy, graphy); - gtk_table_attach(GTK_TABLE(table), enerbox[0], 0, 1, 3, 4, tableops, tableops, 2, 2); - gtk_widget_show(enerbox[0]); - - enerbox[1] = gpk_plot_new(graphy, graphy); - gtk_table_attach(GTK_TABLE(table), enerbox[1], 1, 2, 3, 4, tableops, tableops, 2, 2); - gtk_widget_show(enerbox[1]); - - sfbbox[0] = gpk_plot_new(graphy, graphy); - gtk_table_attach(GTK_TABLE(table), sfbbox[0], 0, 1, 4, 5, tableops, tableops, 2, 2); - gtk_widget_show(sfbbox[0]); - - sfbbox[1] = gpk_plot_new(graphy, graphy); - gtk_table_attach(GTK_TABLE(table), sfbbox[1], 1, 2, 4, 5, tableops, tableops, 2, 2); - gtk_widget_show(sfbbox[1]); - - - - - gtk_idle_add((GtkFunction) frameadv1, NULL); - gtk_widget_show(menubar); - gtk_widget_show(box2); - gtk_widget_show(box3); - gtk_widget_show(table); - gtk_widget_show(box1); - gtk_widget_show(mbox); - gtk_widget_show(window); /* show smallest allowed window */ - - /* make window bigger. */ - /* now the user will be able to shrink it, if desired */ - /* gtk_widget_set_usize(mbox,500,500); */ - /* gtk_widget_show (window); */ /* show smallest allowed window */ - - - - idle_keepgoing = 1; /* processing of frames is ON */ - idle_count_max = READ_AHEAD + 1; /* number of frames to process before plotting */ - idle_count = 0; /* pause & plot when idle_count=idle_count_max */ - - gtk_main(); - assert(mp3done); - return (0); -} diff --git a/src/lib/dl/ext/lame/gtkanal.h b/src/lib/dl/ext/lame/gtkanal.h deleted file mode 100755 index cf6854b5..00000000 --- a/src/lib/dl/ext/lame/gtkanal.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * - * 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_GTKCONTROL_H -#define LAME_GTKCONTROL_H - - -int gtkcontrol(lame_global_flags * gfp2, char *inPath); - -#endif diff --git a/src/lib/dl/ext/lame/huffman.h b/src/lib/dl/ext/lame/huffman.h deleted file mode 100755 index 7d73a74b..00000000 --- a/src/lib/dl/ext/lame/huffman.h +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - * - * 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 - */ - -/* *INDENT-OFF* */ - - -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 } -}; - - /* *INDENT-ON* */ diff --git a/src/lib/dl/ext/lame/id3tag.c b/src/lib/dl/ext/lame/id3tag.c deleted file mode 100755 index 8f64df4b..00000000 --- a/src/lib/dl/ext/lame/id3tag.c +++ /dev/null @@ -1,1850 +0,0 @@ -/* - * id3tag.c -- Write ID3 version 1 and 2 tags. - * - * Copyright (C) 2000 Don Melton - * Copyright (C) 2011 Robert Hegemann - * - * 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. - */ - -/* - * HISTORY: This source file is part of LAME (see http://www.mp3dev.org) - * and was originally adapted by Conrad Sanderson <c.sanderson@me.gu.edu.au> - * from mp3info by Ricardo Cerqueira <rmc@rccn.net> to write only ID3 version 1 - * tags. Don Melton <don@blivet.com> COMPLETELY rewrote it to support version - * 2 tags and be more conformant to other standards while remaining flexible. - * - * NOTE: See http://id3.org/ for more information about ID3 tag formats. - */ - -/* $Id: id3tag.c,v 1.75.2.1 2011/11/26 18:15:27 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef STDC_HEADERS -# include <stddef.h> -# include <stdlib.h> -# include <string.h> -# include <ctype.h> -#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)) -# endif -#endif - - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "id3tag.h" -#include "lame_global_flags.h" -#include "util.h" -#include "bitstream.h" - - -static const char *const genre_names[] = { - /* - * NOTE: The spelling of these genre names is identical to those found in - * Winamp and mp3info. - */ - "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 US", "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", "Fast 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 Cappella", "Euro-House", "Dance Hall", - "Goa", "Drum & Bass", "Club-House", "Hardcore", "Terror", "Indie", - "BritPop", "Negerpunk", "Polsk Punk", "Beat", "Christian Gangsta", - "Heavy Metal", "Black Metal", "Crossover", "Contemporary Christian", - "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", - "SynthPop" -}; - -#define GENRE_NAME_COUNT \ - ((int)(sizeof genre_names / sizeof (const char *const))) - -static const int genre_alpha_map[] = { - 123, 34, 74, 73, 99, 20, 40, 26, 145, 90, 116, 41, 135, 85, 96, 138, 89, 0, - 107, 132, 65, 88, 104, 102, 97, 136, 61, 141, 32, 1, 112, 128, 57, 140, 2, - 139, 58, 3, 125, 50, 22, 4, 55, 127, 122, 120, 98, 52, 48, 54, 124, 25, 84, - 80, 115, 81, 119, 5, 30, 36, 59, 126, 38, 49, 91, 6, 129, 79, 137, 7, 35, - 100, 131, 19, 33, 46, 47, 8, 29, 146, 63, 86, 71, 45, 142, 9, 77, 82, 64, - 133, 10, 66, 39, 11, 103, 12, 75, 134, 13, 53, 62, 109, 117, 23, 108, 92, - 67, 93, 43, 121, 15, 68, 14, 16, 76, 87, 118, 17, 78, 143, 114, 110, 69, 21, - 111, 95, 105, 42, 37, 24, 56, 44, 101, 83, 94, 106, 147, 113, 18, 51, 130, - 144, 60, 70, 31, 72, 27, 28 -}; - -#define GENRE_ALPHA_COUNT ((int)(sizeof genre_alpha_map / sizeof (int))) - -#define GENRE_INDEX_OTHER 12 - - -#define FRAME_ID(a, b, c, d) \ - ( ((unsigned long)(a) << 24) \ - | ((unsigned long)(b) << 16) \ - | ((unsigned long)(c) << 8) \ - | ((unsigned long)(d) << 0) ) - -typedef enum UsualStringIDs { ID_TITLE = FRAME_ID('T', 'I', 'T', '2') - , ID_ARTIST = FRAME_ID('T', 'P', 'E', '1') - , ID_ALBUM = FRAME_ID('T', 'A', 'L', 'B') - , ID_GENRE = FRAME_ID('T', 'C', 'O', 'N') - , ID_ENCODER = FRAME_ID('T', 'S', 'S', 'E') - , ID_PLAYLENGTH = FRAME_ID('T', 'L', 'E', 'N') - , ID_COMMENT = FRAME_ID('C', 'O', 'M', 'M') /* full text string */ -} UsualStringIDs; - -typedef enum NumericStringIDs { ID_DATE = FRAME_ID('T', 'D', 'A', 'T') /* "ddMM" */ - , ID_TIME = FRAME_ID('T', 'I', 'M', 'E') /* "hhmm" */ - , ID_TPOS = FRAME_ID('T', 'P', 'O', 'S') /* '0'-'9' and '/' allowed */ - , ID_TRACK = FRAME_ID('T', 'R', 'C', 'K') /* '0'-'9' and '/' allowed */ - , ID_YEAR = FRAME_ID('T', 'Y', 'E', 'R') /* "yyyy" */ -} NumericStringIDs; - -typedef enum MiscIDs { ID_TXXX = FRAME_ID('T', 'X', 'X', 'X') - , ID_WXXX = FRAME_ID('W', 'X', 'X', 'X') - , ID_SYLT = FRAME_ID('S', 'Y', 'L', 'T') - , ID_APIC = FRAME_ID('A', 'P', 'I', 'C') - , ID_GEOB = FRAME_ID('G', 'E', 'O', 'B') - , ID_PCNT = FRAME_ID('P', 'C', 'N', 'T') - , ID_AENC = FRAME_ID('A', 'E', 'N', 'C') - , ID_LINK = FRAME_ID('L', 'I', 'N', 'K') - , ID_ENCR = FRAME_ID('E', 'N', 'C', 'R') - , ID_GRID = FRAME_ID('G', 'R', 'I', 'D') - , ID_PRIV = FRAME_ID('P', 'R', 'I', 'V') - , ID_VSLT = FRAME_ID('V', 'S', 'L', 'T') /* full text string */ -} MiscIDs; - - -static int -frame_id_matches(int id, int mask) -{ - int result = 0, i, window = 0xff; - for (i = 0; i < 4; ++i, window <<= 8) { - int const mw = (mask & window); - int const iw = (id & window); - if (mw != 0 && mw != iw) { - result |= iw; - } - } - return result; -} - -static int -isFrameIdMatching(int id, int mask) -{ - return frame_id_matches(id, mask) == 0 ? 1 : 0; -} - -static int -test_tag_spec_flags(lame_internal_flags const *gfc, unsigned int tst) -{ - return (gfc->tag_spec.flags & tst) != 0u ? 1 : 0; -} - -#if 0 -static void -debug_tag_spec_flags(lame_internal_flags * gfc, const char* info) -{ - MSGF(gfc, "%s\n", info); - MSGF(gfc, "CHANGED_FLAG : %d\n", test_tag_spec_flags(gfc, CHANGED_FLAG )); - MSGF(gfc, "ADD_V2_FLAG : %d\n", test_tag_spec_flags(gfc, ADD_V2_FLAG )); - MSGF(gfc, "V1_ONLY_FLAG : %d\n", test_tag_spec_flags(gfc, V1_ONLY_FLAG )); - MSGF(gfc, "V2_ONLY_FLAG : %d\n", test_tag_spec_flags(gfc, V2_ONLY_FLAG )); - MSGF(gfc, "SPACE_V1_FLAG : %d\n", test_tag_spec_flags(gfc, SPACE_V1_FLAG)); - MSGF(gfc, "PAD_V2_FLAG : %d\n", test_tag_spec_flags(gfc, PAD_V2_FLAG )); -} -#endif - - - -static int -id3v2_add_ucs2(lame_internal_flags * gfc, uint32_t frame_id, char const *lang, - unsigned short const *desc, unsigned short const *text); -static int -id3v2_add_latin1(lame_internal_flags * gfc, uint32_t frame_id, char const *lang, char const *desc, - char const *text); - -static void -copyV1ToV2(lame_internal_flags * gfc, int frame_id, char const *s) -{ - unsigned int flags = gfc->tag_spec.flags; - id3v2_add_latin1(gfc, frame_id, 0, 0, s); - gfc->tag_spec.flags = flags; -#if 0 - debug_tag_spec_flags(gfc, "copyV1ToV2"); -#endif -} - - -static void -id3v2AddLameVersion(lame_internal_flags * gfc) -{ - char buffer[1024]; - const char *b = get_lame_os_bitness(); - const char *v = get_lame_version(); - const char *u = get_lame_url(); - const size_t lenb = strlen(b); - - if (lenb > 0) { - sprintf(buffer, "LAME %s version %s (%s)", b, v, u); - } - else { - sprintf(buffer, "LAME version %s (%s)", v, u); - } - copyV1ToV2(gfc, ID_ENCODER, buffer); -} - -static void -id3v2AddAudioDuration(lame_internal_flags * gfc, double ms) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - char buffer[1024]; - double const max_ulong = MAX_U_32_NUM; - unsigned long playlength_ms; - - ms *= 1000; - ms /= cfg->samplerate_in; - if (ms > max_ulong) { - playlength_ms = max_ulong; - } - else if (ms < 0) { - playlength_ms = 0; - } - else { - playlength_ms = ms; - } - sprintf(buffer, "%lu", playlength_ms); - copyV1ToV2(gfc, ID_PLAYLENGTH, buffer); -} - -void -id3tag_genre_list(void (*handler) (int, const char *, void *), void *cookie) -{ - if (handler) { - int i; - for (i = 0; i < GENRE_NAME_COUNT; ++i) { - if (i < GENRE_ALPHA_COUNT) { - int j = genre_alpha_map[i]; - handler(j, genre_names[j], cookie); - } - } - } -} - -#define GENRE_NUM_UNKNOWN 255 - - - -void -id3tag_init(lame_global_flags * gfp) -{ - lame_internal_flags *gfc = gfp->internal_flags; - free_id3tag(gfc); - memset(&gfc->tag_spec, 0, sizeof gfc->tag_spec); - gfc->tag_spec.genre_id3v1 = GENRE_NUM_UNKNOWN; - gfc->tag_spec.padding_size = 128; - id3v2AddLameVersion(gfc); -} - - - -void -id3tag_add_v2(lame_global_flags * gfp) -{ - lame_internal_flags *gfc = gfp->internal_flags; - gfc->tag_spec.flags &= ~V1_ONLY_FLAG; - gfc->tag_spec.flags |= ADD_V2_FLAG; -} - -void -id3tag_v1_only(lame_global_flags * gfp) -{ - lame_internal_flags *gfc = gfp->internal_flags; - gfc->tag_spec.flags &= ~(ADD_V2_FLAG | V2_ONLY_FLAG); - gfc->tag_spec.flags |= V1_ONLY_FLAG; -} - -void -id3tag_v2_only(lame_global_flags * gfp) -{ - lame_internal_flags *gfc = gfp->internal_flags; - gfc->tag_spec.flags &= ~V1_ONLY_FLAG; - gfc->tag_spec.flags |= V2_ONLY_FLAG; -} - -void -id3tag_space_v1(lame_global_flags * gfp) -{ - lame_internal_flags *gfc = gfp->internal_flags; - gfc->tag_spec.flags &= ~V2_ONLY_FLAG; - gfc->tag_spec.flags |= SPACE_V1_FLAG; -} - -void -id3tag_pad_v2(lame_global_flags * gfp) -{ - id3tag_set_pad(gfp, 128); -} - -void -id3tag_set_pad(lame_global_flags * gfp, size_t n) -{ - lame_internal_flags *gfc = gfp->internal_flags; - gfc->tag_spec.flags &= ~V1_ONLY_FLAG; - gfc->tag_spec.flags |= PAD_V2_FLAG; - gfc->tag_spec.flags |= ADD_V2_FLAG; - gfc->tag_spec.padding_size = n; -} - -static int -hasUcs2ByteOrderMarker(unsigned short bom) -{ - if (bom == 0xFFFEu || bom == 0xFEFFu) { - return 1; - } - return 0; -} - - -static unsigned short -swap_bytes(unsigned short w) -{ - return (0xff00u & (w << 8)) | (0x00ffu & (w >> 8)); -} - - -static unsigned short -toLittleEndian(unsigned short bom, unsigned short c) -{ - if (bom == 0xFFFEu) { - return swap_bytes(c); - } - return c; -} - -static unsigned short -fromLatin1Char(const unsigned short* s, unsigned short c) -{ - if (s[0] == 0xFFFEu) { - return swap_bytes(c); - } - return c; -} - - -static size_t -local_strdup(char **dst, const char *src) -{ - if (dst == 0) { - return 0; - } - free(*dst); - *dst = 0; - if (src != 0) { - size_t n; - for (n = 0; src[n] != 0; ++n) { /* calc src string length */ - } - if (n > 0) { /* string length without zero termination */ - assert(sizeof(*src) == sizeof(**dst)); - *dst = malloc((n + 1) * sizeof(**dst)); - if (*dst != 0) { - memcpy(*dst, src, n * sizeof(**dst)); - (*dst)[n] = 0; - return n; - } - } - } - return 0; -} - -static size_t -local_ucs2_strdup(unsigned short **dst, unsigned short const *src) -{ - if (dst == 0) { - return 0; - } - free(*dst); /* free old string pointer */ - *dst = 0; - if (src != 0) { - size_t n; - for (n = 0; src[n] != 0; ++n) { /* calc src string length */ - } - if (n > 0) { /* string length without zero termination */ - assert(sizeof(*src) >= 2); - assert(sizeof(*src) == sizeof(**dst)); - *dst = malloc((n + 1) * sizeof(**dst)); - if (*dst != 0) { - memcpy(*dst, src, n * sizeof(**dst)); - (*dst)[n] = 0; - return n; - } - } - } - return 0; -} - - -static size_t -local_ucs2_strlen(unsigned short const *s) -{ - size_t n = 0; - if (s != 0) { - while (*s++) { - ++n; - } - } - return n; -} - - -static size_t -local_ucs2_substr(unsigned short** dst, unsigned short const* src, size_t start, size_t end) -{ - size_t const len = 1 + 1 + ((start < end) ? (end - start) : 0); - size_t n = 0; - unsigned short *ptr = calloc(len, sizeof(ptr[0])); - *dst = ptr; - if (ptr == 0 || src == 0) { - return 0; - } - if (hasUcs2ByteOrderMarker(src[0])) { - ptr[n++] = src[0]; - if (start == 0) { - ++start; - } - } - while (start < end) { - ptr[n++] = src[start++]; - } - ptr[n] = 0; - return n; -} - -static int -local_ucs2_pos(unsigned short const* str, unsigned short c) -{ - int i; - for (i = 0; str != 0 && str[i] != 0; ++i) { - if (str[i] == c) { - return i; - } - } - return -1; -} - -static int -maybeLatin1(unsigned short const* text) -{ - if (text) { - unsigned short bom = *text++; - while (*text) { - unsigned short c = toLittleEndian(bom, *text++); - if (c > 0x00fe) return 0; - } - } - return 1; -} - -static int searchGenre(char const* genre); -static int sloppySearchGenre(char const* genre); - -static int -lookupGenre(char const* genre) -{ - char *str; - int num = strtol(genre, &str, 10); - /* is the input a string or a valid number? */ - if (*str) { - num = searchGenre(genre); - if (num == GENRE_NAME_COUNT) { - num = sloppySearchGenre(genre); - } - if (num == GENRE_NAME_COUNT) { - return -2; /* no common genre text found */ - } - } - else { - if ((num < 0) || (num >= GENRE_NAME_COUNT)) { - return -1; /* number unknown */ - } - } - return num; -} - -static unsigned char * -writeLoBytes(unsigned char *frame, unsigned short const *str, size_t n); - -static char* -local_strdup_utf16_to_latin1(unsigned short const* utf16) -{ - size_t len = local_ucs2_strlen(utf16); - unsigned char* latin1 = calloc(len+1, 1); - writeLoBytes(latin1, utf16, len); - return (char*)latin1; -} - - -static int -id3tag_set_genre_utf16(lame_t gfp, unsigned short const* text) -{ - lame_internal_flags* gfc = gfp->internal_flags; - int ret; - if (text == 0) { - return -3; - } - if (!hasUcs2ByteOrderMarker(text[0])) { - return -3; - } - if (maybeLatin1(text)) { - char* latin1 = local_strdup_utf16_to_latin1(text); - int num = lookupGenre(latin1); - free(latin1); - if (num == -1) return -1; /* number out of range */ - if (num >= 0) { /* common genre found */ - gfc->tag_spec.flags |= CHANGED_FLAG; - gfc->tag_spec.genre_id3v1 = num; - copyV1ToV2(gfc, ID_GENRE, genre_names[num]); - return 0; - } - } - ret = id3v2_add_ucs2(gfp->internal_flags, ID_GENRE, 0, 0, text); - if (ret == 0) { - gfc->tag_spec.flags |= CHANGED_FLAG; - gfc->tag_spec.genre_id3v1 = GENRE_INDEX_OTHER; - } - return ret; -} - -/* -Some existing options for ID3 tag can be specified by --tv option -as follows. ---tt <value>, --tv TIT2=value ---ta <value>, --tv TPE1=value ---tl <value>, --tv TALB=value ---ty <value>, --tv TYER=value ---tn <value>, --tv TRCK=value ---tg <value>, --tv TCON=value -(although some are not exactly same)*/ - -int -id3tag_set_albumart(lame_global_flags * gfp, const char *image, size_t size) -{ - int mimetype = 0; - unsigned char const *data = (unsigned char const *) image; - lame_internal_flags *gfc = gfp->internal_flags; - - /* determine MIME type from the actual image data */ - if (2 < size && data[0] == 0xFF && data[1] == 0xD8) { - mimetype = MIMETYPE_JPEG; - } - else if (4 < size && data[0] == 0x89 && strncmp((const char *) &data[1], "PNG", 3) == 0) { - mimetype = MIMETYPE_PNG; - } - else if (4 < size && strncmp((const char *) data, "GIF8", 4) == 0) { - mimetype = MIMETYPE_GIF; - } - else { - return -1; - } - if (gfc->tag_spec.albumart != 0) { - free(gfc->tag_spec.albumart); - gfc->tag_spec.albumart = 0; - gfc->tag_spec.albumart_size = 0; - gfc->tag_spec.albumart_mimetype = MIMETYPE_NONE; - } - if (size < 1) { - return 0; - } - gfc->tag_spec.albumart = malloc(size); - if (gfc->tag_spec.albumart != 0) { - memcpy(gfc->tag_spec.albumart, image, size); - gfc->tag_spec.albumart_size = size; - gfc->tag_spec.albumart_mimetype = mimetype; - gfc->tag_spec.flags |= CHANGED_FLAG; - id3tag_add_v2(gfp); - } - return 0; -} - -static unsigned char * -set_4_byte_value(unsigned char *bytes, uint32_t value) -{ - int i; - for (i = 3; i >= 0; --i) { - bytes[i] = value & 0xffUL; - value >>= 8; - } - return bytes + 4; -} - -static uint32_t -toID3v2TagId(char const *s) -{ - unsigned int i, x = 0; - if (s == 0) { - return 0; - } - for (i = 0; i < 4 && s[i] != 0; ++i) { - char const c = s[i]; - unsigned int const u = 0x0ff & c; - x <<= 8; - x |= u; - if (c < 'A' || 'Z' < c) { - if (c < '0' || '9' < c) { - return 0; - } - } - } - return x; -} - -static uint32_t -toID3v2TagId_ucs2(unsigned short const *s) -{ - unsigned int i, x = 0; - unsigned short bom = 0; - if (s == 0) { - return 0; - } - bom = s[0]; - if (hasUcs2ByteOrderMarker(bom)) { - ++s; - } - for (i = 0; i < 4 && s[i] != 0; ++i) { - unsigned short const c = toLittleEndian(bom, s[i]); - if (c < 'A' || 'Z' < c) { - if (c < '0' || '9' < c) { - return 0; - } - } - x <<= 8; - x |= c; - } - return x; -} - -#if 0 -static int -isNumericString(uint32_t frame_id) -{ - switch (frame_id) { - case ID_DATE: - case ID_TIME: - case ID_TPOS: - case ID_TRACK: - case ID_YEAR: - return 1; - } - return 0; -} -#endif - -static int -isMultiFrame(uint32_t frame_id) -{ - switch (frame_id) { - case ID_TXXX: - case ID_WXXX: - case ID_COMMENT: - case ID_SYLT: - case ID_APIC: - case ID_GEOB: - case ID_PCNT: - case ID_AENC: - case ID_LINK: - case ID_ENCR: - case ID_GRID: - case ID_PRIV: - return 1; - } - return 0; -} - -#if 0 -static int -isFullTextString(int frame_id) -{ - switch (frame_id) { - case ID_VSLT: - case ID_COMMENT: - return 1; - } - return 0; -} -#endif - -static FrameDataNode * -findNode(id3tag_spec const *tag, uint32_t frame_id, FrameDataNode const *last) -{ - FrameDataNode *node = last ? last->nxt : tag->v2_head; - while (node != 0) { - if (node->fid == frame_id) { - return node; - } - node = node->nxt; - } - return 0; -} - -static void -appendNode(id3tag_spec * tag, FrameDataNode * node) -{ - if (tag->v2_tail == 0 || tag->v2_head == 0) { - tag->v2_head = node; - tag->v2_tail = node; - } - else { - tag->v2_tail->nxt = node; - tag->v2_tail = node; - } -} - -static void -setLang(char *dst, char const *src) -{ - int i; - if (src == 0 || src[0] == 0) { - dst[0] = 'X'; - dst[1] = 'X'; - dst[2] = 'X'; - } - else { - for (i = 0; i < 3 && src && *src; ++i) { - dst[i] = src[i]; - } - for (; i < 3; ++i) { - dst[i] = ' '; - } - } -} - -static int -isSameLang(char const *l1, char const *l2) -{ - char d[3]; - int i; - setLang(d, l2); - for (i = 0; i < 3; ++i) { - char a = tolower(l1[i]); - char b = tolower(d[i]); - if (a < ' ') - a = ' '; - if (b < ' ') - b = ' '; - if (a != b) { - return 0; - } - } - return 1; -} - -static int -isSameDescriptor(FrameDataNode const *node, char const *dsc) -{ - size_t i; - if (node->dsc.enc == 1 && node->dsc.dim > 0) { - return 0; - } - for (i = 0; i < node->dsc.dim; ++i) { - if (!dsc || node->dsc.ptr.l[i] != dsc[i]) { - return 0; - } - } - return 1; -} - -static int -isSameDescriptorUcs2(FrameDataNode const *node, unsigned short const *dsc) -{ - size_t i; - if (node->dsc.enc != 1 && node->dsc.dim > 0) { - return 0; - } - for (i = 0; i < node->dsc.dim; ++i) { - if (!dsc || node->dsc.ptr.u[i] != dsc[i]) { - return 0; - } - } - return 1; -} - -static int -id3v2_add_ucs2(lame_internal_flags * gfc, uint32_t frame_id, char const *lang, - unsigned short const *desc, unsigned short const *text) -{ - if (gfc != 0) { - FrameDataNode *node = 0; - node = findNode(&gfc->tag_spec, frame_id, 0); - if (isMultiFrame(frame_id)) { - while (node) { - if (isSameLang(node->lng, lang)) { - if (isSameDescriptorUcs2(node, desc)) { - break; - } - } - node = findNode(&gfc->tag_spec, frame_id, node); - } - } - if (node == 0) { - node = calloc(1, sizeof(FrameDataNode)); - if (node == 0) { - return -254; /* memory problem */ - } - appendNode(&gfc->tag_spec, node); - } - node->fid = frame_id; - setLang(node->lng, lang); - node->dsc.dim = local_ucs2_strdup(&node->dsc.ptr.u, desc); - node->dsc.enc = 1; - node->txt.dim = local_ucs2_strdup(&node->txt.ptr.u, text); - node->txt.enc = 1; - gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG); - } - return 0; -} - -static int -id3v2_add_latin1(lame_internal_flags * gfc, uint32_t frame_id, char const *lang, char const *desc, - char const *text) -{ - if (gfc != 0) { - FrameDataNode *node = 0; - node = findNode(&gfc->tag_spec, frame_id, 0); - if (isMultiFrame(frame_id)) { - while (node) { - if (isSameLang(node->lng, lang)) { - if (isSameDescriptor(node, desc)) { - break; - } - } - node = findNode(&gfc->tag_spec, frame_id, node); - } - } - if (node == 0) { - node = calloc(1, sizeof(FrameDataNode)); - if (node == 0) { - return -254; /* memory problem */ - } - appendNode(&gfc->tag_spec, node); - } - node->fid = frame_id; - setLang(node->lng, lang); - node->dsc.dim = local_strdup(&node->dsc.ptr.l, desc); - node->dsc.enc = 0; - node->txt.dim = local_strdup(&node->txt.ptr.l, text); - node->txt.enc = 0; - gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG); - } - return 0; -} - - -static int -id3tag_set_userinfo_latin1(lame_internal_flags* gfc, uint32_t id, char const *fieldvalue) -{ - int rc; - char* dsc = 0, *val; - local_strdup(&dsc, fieldvalue); - val = dsc; - while (*val) { - if (*val == '=') { - *val++ = 0; - break; - } - ++val; - } - rc = id3v2_add_latin1(gfc, id, "XXX", dsc, val); - free(dsc); - return rc; -} - -static int -id3tag_set_userinfo_ucs2(lame_internal_flags* gfc, uint32_t id, unsigned short const *fieldvalue) -{ - int a, b, rc = -7; - unsigned short const separator = fromLatin1Char(fieldvalue,'='); - b = local_ucs2_strlen(fieldvalue); - a = local_ucs2_pos(fieldvalue, separator); - if (a >= 0 && a <= b) { - unsigned short* dsc = 0, *val = 0; - local_ucs2_substr(&dsc, fieldvalue, 0, a); - local_ucs2_substr(&val, fieldvalue, a+1, b); - rc = id3v2_add_ucs2(gfc, id, "XXX", dsc, val); - free(dsc); - free(val); - } - return rc; -} - -int -id3tag_set_textinfo_utf16(lame_global_flags * gfp, char const *id, unsigned short const *text) -{ - uint32_t const frame_id = toID3v2TagId(id); - if (frame_id == 0) { - return -1; - } - if (isFrameIdMatching(frame_id, FRAME_ID('T', 0, 0, 0)) - ||isFrameIdMatching(frame_id, FRAME_ID('W', 0, 0, 0))) { -#if 0 - if (isNumericString(frame_id)) { - return -2; /* must be Latin-1 encoded */ - } -#endif - if (text == 0) { - return 0; - } - if (!hasUcs2ByteOrderMarker(text[0])) { - return -3; /* BOM missing */ - } - if (gfp != 0) { - if (frame_id == ID_TXXX || frame_id == ID_WXXX) { - return id3tag_set_userinfo_ucs2(gfp->internal_flags, frame_id, text); - } - if (frame_id == ID_GENRE) { - return id3tag_set_genre_utf16(gfp, text); - } - return id3v2_add_ucs2(gfp->internal_flags, frame_id, 0, 0, text); - } - } - return -255; /* not supported by now */ -} - -extern int -id3tag_set_textinfo_ucs2(lame_global_flags * gfp, char const *id, unsigned short const *text); - -int -id3tag_set_textinfo_ucs2(lame_global_flags * gfp, char const *id, unsigned short const *text) -{ - return id3tag_set_textinfo_utf16(gfp, id, text); -} - -int -id3tag_set_textinfo_latin1(lame_global_flags * gfp, char const *id, char const *text) -{ - uint32_t const frame_id = toID3v2TagId(id); - if (frame_id == 0) { - return -1; - } - if (isFrameIdMatching(frame_id, FRAME_ID('T', 0, 0, 0)) - ||isFrameIdMatching(frame_id, FRAME_ID('W', 0, 0, 0))) { - if (text == 0) { - return 0; - } - if (gfp != 0) { - if (frame_id == ID_TXXX || frame_id == ID_WXXX) { - return id3tag_set_userinfo_latin1(gfp->internal_flags, frame_id, text); - } - return id3v2_add_latin1(gfp->internal_flags, frame_id, 0, 0, text); - } - } - return -255; /* not supported by now */ -} - - -int -id3tag_set_comment_latin1(lame_global_flags * gfp, char const *lang, char const *desc, - char const *text) -{ - if (gfp != 0) { - return id3v2_add_latin1(gfp->internal_flags, ID_COMMENT, lang, desc, text); - } - return -255; -} - - -int -id3tag_set_comment_utf16(lame_global_flags * gfp, char const *lang, unsigned short const *desc, - unsigned short const *text) -{ - if (gfp != 0) { - return id3v2_add_ucs2(gfp->internal_flags, ID_COMMENT, lang, desc, text); - } - return -255; -} - -extern int -id3tag_set_comment_ucs2(lame_global_flags * gfp, char const *lang, unsigned short const *desc, - unsigned short const *text); - - -int -id3tag_set_comment_ucs2(lame_global_flags * gfp, char const *lang, unsigned short const *desc, - unsigned short const *text) -{ - return id3tag_set_comment_utf16(gfp, lang, desc, text); -} - - -void -id3tag_set_title(lame_global_flags * gfp, const char *title) -{ - lame_internal_flags *gfc = gfp->internal_flags; - if (title && *title) { - local_strdup(&gfc->tag_spec.title, title); - gfc->tag_spec.flags |= CHANGED_FLAG; - copyV1ToV2(gfc, ID_TITLE, title); - } -} - -void -id3tag_set_artist(lame_global_flags * gfp, const char *artist) -{ - lame_internal_flags *gfc = gfp->internal_flags; - if (artist && *artist) { - local_strdup(&gfc->tag_spec.artist, artist); - gfc->tag_spec.flags |= CHANGED_FLAG; - copyV1ToV2(gfc, ID_ARTIST, artist); - } -} - -void -id3tag_set_album(lame_global_flags * gfp, const char *album) -{ - lame_internal_flags *gfc = gfp->internal_flags; - if (album && *album) { - local_strdup(&gfc->tag_spec.album, album); - gfc->tag_spec.flags |= CHANGED_FLAG; - copyV1ToV2(gfc, ID_ALBUM, album); - } -} - -void -id3tag_set_year(lame_global_flags * gfp, const char *year) -{ - lame_internal_flags *gfc = gfp->internal_flags; - if (year && *year) { - int num = atoi(year); - if (num < 0) { - num = 0; - } - /* limit a year to 4 digits so it fits in a version 1 tag */ - if (num > 9999) { - num = 9999; - } - if (num) { - gfc->tag_spec.year = num; - gfc->tag_spec.flags |= CHANGED_FLAG; - } - copyV1ToV2(gfc, ID_YEAR, year); - } -} - -void -id3tag_set_comment(lame_global_flags * gfp, const char *comment) -{ - lame_internal_flags *gfc = gfp->internal_flags; - if (comment && *comment) { - local_strdup(&gfc->tag_spec.comment, comment); - gfc->tag_spec.flags |= CHANGED_FLAG; - { - uint32_t const flags = gfc->tag_spec.flags; - id3v2_add_latin1(gfc, ID_COMMENT, "XXX", "", comment); - gfc->tag_spec.flags = flags; - } - } -} - -int -id3tag_set_track(lame_global_flags * gfp, const char *track) -{ - char const *trackcount; - lame_internal_flags *gfc = gfp->internal_flags; - int ret = 0; - - if (track && *track) { - int num = atoi(track); - /* check for valid ID3v1 track number range */ - if (num < 1 || num > 255) { - num = 0; - ret = -1; /* track number out of ID3v1 range, ignored for ID3v1 */ - gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG); - } - if (num) { - gfc->tag_spec.track_id3v1 = num; - gfc->tag_spec.flags |= CHANGED_FLAG; - } - /* Look for the total track count after a "/", same restrictions */ - trackcount = strchr(track, '/'); - if (trackcount && *trackcount) { - gfc->tag_spec.flags |= (CHANGED_FLAG | ADD_V2_FLAG); - } - copyV1ToV2(gfc, ID_TRACK, track); - } - return ret; -} - -/* would use real "strcasecmp" but it isn't portable */ -static int -local_strcasecmp(const char *s1, const char *s2) -{ - unsigned char c1; - unsigned char c2; - do { - c1 = tolower(*s1); - c2 = tolower(*s2); - if (!c1) { - break; - } - ++s1; - ++s2; - } while (c1 == c2); - return c1 - c2; -} - - -static -const char* nextUpperAlpha(const char* p, char x) -{ - char c; - for(c = toupper(*p); *p != 0; c = toupper(*++p)) { - if ('A' <= c && c <= 'Z') { - if (c != x) { - return p; - } - } - } - return p; -} - - -static int -sloppyCompared(const char* p, const char* q) -{ - char cp, cq; - p = nextUpperAlpha(p, 0); - q = nextUpperAlpha(q, 0); - cp = toupper(*p); - cq = toupper(*q); - while (cp == cq) { - if (cp == 0) { - return 1; - } - if (p[1] == '.') { /* some abbrevation */ - while (*q && *q++ != ' ') { - } - } - p = nextUpperAlpha(p, cp); - q = nextUpperAlpha(q, cq); - cp = toupper(*p); - cq = toupper(*q); - } - return 0; -} - - -static int -sloppySearchGenre(const char *genre) -{ - int i; - for (i = 0; i < GENRE_NAME_COUNT; ++i) { - if (sloppyCompared(genre, genre_names[i])) { - return i; - } - } - return GENRE_NAME_COUNT; -} - - -static int -searchGenre(const char* genre) -{ - int i; - for (i = 0; i < GENRE_NAME_COUNT; ++i) { - if (!local_strcasecmp(genre, genre_names[i])) { - return i; - } - } - return GENRE_NAME_COUNT; -} - - -int -id3tag_set_genre(lame_global_flags * gfp, const char *genre) -{ - lame_internal_flags *gfc = gfp->internal_flags; - int ret = 0; - if (genre && *genre) { - int const num = lookupGenre(genre); - if (num == -1) return num; - gfc->tag_spec.flags |= CHANGED_FLAG; - if (num >= 0) { - gfc->tag_spec.genre_id3v1 = num; - genre = genre_names[num]; - } - else { - gfc->tag_spec.genre_id3v1 = GENRE_INDEX_OTHER; - gfc->tag_spec.flags |= ADD_V2_FLAG; - } - copyV1ToV2(gfc, ID_GENRE, genre); - } - return ret; -} - - -static unsigned char * -set_frame_custom(unsigned char *frame, const char *fieldvalue) -{ - if (fieldvalue && *fieldvalue) { - const char *value = fieldvalue + 5; - size_t length = strlen(value); - *frame++ = *fieldvalue++; - *frame++ = *fieldvalue++; - *frame++ = *fieldvalue++; - *frame++ = *fieldvalue++; - frame = set_4_byte_value(frame, (unsigned long) (strlen(value) + 1)); - /* clear 2-byte header flags */ - *frame++ = 0; - *frame++ = 0; - /* clear 1 encoding descriptor byte to indicate ISO-8859-1 format */ - *frame++ = 0; - while (length--) { - *frame++ = *value++; - } - } - return frame; -} - -static size_t -sizeOfNode(FrameDataNode const *node) -{ - size_t n = 0; - if (node) { - n = 10; /* header size */ - n += 1; /* text encoding flag */ - switch (node->txt.enc) { - default: - case 0: - if (node->dsc.dim > 0) { - n += node->dsc.dim + 1; - } - n += node->txt.dim; - break; - case 1: - if (node->dsc.dim > 0) { - n += (node->dsc.dim+1) * 2; - } - n += node->txt.dim * 2; - break; - } - } - return n; -} - -static size_t -sizeOfCommentNode(FrameDataNode const *node) -{ - size_t n = 0; - if (node) { - n = 10; /* header size */ - n += 1; /* text encoding flag */ - n += 3; /* language */ - switch (node->dsc.enc) { - default: - case 0: - n += 1 + node->dsc.dim; - break; - case 1: - n += 2 + node->dsc.dim * 2; - break; - } - switch (node->txt.enc) { - default: - case 0: - n += node->txt.dim; - break; - case 1: - n += node->txt.dim * 2; - break; - } - } - return n; -} - -static size_t -sizeOfWxxxNode(FrameDataNode const *node) -{ - size_t n = 0; - if (node) { - n = 10; /* header size */ - if (node->dsc.dim > 0) { - n += 1; /* text encoding flag */ - switch (node->dsc.enc) { - default: - case 0: - n += 1 + node->dsc.dim; - break; - case 1: - n += 2 + node->dsc.dim * 2; - break; - } - } - switch (node->txt.enc) { - default: - case 0: - n += node->txt.dim; - break; - case 1: - n += node->txt.dim - 1; /* UCS2 -> Latin1, skip BOM */ - break; - } - } - return n; -} - -static unsigned char * -writeChars(unsigned char *frame, char const *str, size_t n) -{ - while (n--) { - *frame++ = *str++; - } - return frame; -} - -static unsigned char * -writeUcs2s(unsigned char *frame, unsigned short const *str, size_t n) -{ - if (n > 0) { - unsigned short const bom = *str; - while (n--) { - unsigned short const c = toLittleEndian(bom, *str++); - *frame++ = 0x00ffu & c; - *frame++ = 0x00ffu & (c >> 8); - } - } - return frame; -} - -static unsigned char * -writeLoBytes(unsigned char *frame, unsigned short const *str, size_t n) -{ - if (n > 0) { - unsigned short const bom = *str; - if (hasUcs2ByteOrderMarker(bom)) { - str++; n--; /* skip BOM */ - } - while (n--) { - unsigned short const c = toLittleEndian(bom, *str++); - if (c < 0x0020u || 0x00ffu < c) { - *frame++ = 0x0020; /* blank */ - } - else { - *frame++ = c; - } - } - } - return frame; -} - -static unsigned char * -set_frame_comment(unsigned char *frame, FrameDataNode const *node) -{ - size_t const n = sizeOfCommentNode(node); - if (n > 10) { - frame = set_4_byte_value(frame, node->fid); - frame = set_4_byte_value(frame, (uint32_t) (n - 10)); - /* clear 2-byte header flags */ - *frame++ = 0; - *frame++ = 0; - /* encoding descriptor byte */ - *frame++ = node->txt.enc == 1 ? 1 : 0; - /* 3 bytes language */ - *frame++ = node->lng[0]; - *frame++ = node->lng[1]; - *frame++ = node->lng[2]; - /* descriptor with zero byte(s) separator */ - if (node->dsc.enc != 1) { - frame = writeChars(frame, node->dsc.ptr.l, node->dsc.dim); - *frame++ = 0; - } - else { - frame = writeUcs2s(frame, node->dsc.ptr.u, node->dsc.dim); - *frame++ = 0; - *frame++ = 0; - } - /* comment full text */ - if (node->txt.enc != 1) { - frame = writeChars(frame, node->txt.ptr.l, node->txt.dim); - } - else { - frame = writeUcs2s(frame, node->txt.ptr.u, node->txt.dim); - } - } - return frame; -} - -static unsigned char * -set_frame_custom2(unsigned char *frame, FrameDataNode const *node) -{ - size_t const n = sizeOfNode(node); - if (n > 10) { - frame = set_4_byte_value(frame, node->fid); - frame = set_4_byte_value(frame, (unsigned long) (n - 10)); - /* clear 2-byte header flags */ - *frame++ = 0; - *frame++ = 0; - /* clear 1 encoding descriptor byte to indicate ISO-8859-1 format */ - *frame++ = node->txt.enc == 1 ? 1 : 0; - if (node->dsc.dim > 0) { - if (node->dsc.enc != 1) { - frame = writeChars(frame, node->dsc.ptr.l, node->dsc.dim); - *frame++ = 0; - } - else { - frame = writeUcs2s(frame, node->dsc.ptr.u, node->dsc.dim); - *frame++ = 0; - *frame++ = 0; - } - } - if (node->txt.enc != 1) { - frame = writeChars(frame, node->txt.ptr.l, node->txt.dim); - } - else { - frame = writeUcs2s(frame, node->txt.ptr.u, node->txt.dim); - } - } - return frame; -} - -static unsigned char * -set_frame_wxxx(unsigned char *frame, FrameDataNode const *node) -{ - size_t const n = sizeOfWxxxNode(node); - if (n > 10) { - frame = set_4_byte_value(frame, node->fid); - frame = set_4_byte_value(frame, (unsigned long) (n - 10)); - /* clear 2-byte header flags */ - *frame++ = 0; - *frame++ = 0; - if (node->dsc.dim > 0) { - /* clear 1 encoding descriptor byte to indicate ISO-8859-1 format */ - *frame++ = node->txt.enc == 1 ? 1 : 0; - if (node->dsc.enc != 1) { - frame = writeChars(frame, node->dsc.ptr.l, node->dsc.dim); - *frame++ = 0; - } - else { - frame = writeUcs2s(frame, node->dsc.ptr.u, node->dsc.dim); - *frame++ = 0; - *frame++ = 0; - } - } - if (node->txt.enc != 1) { - frame = writeChars(frame, node->txt.ptr.l, node->txt.dim); - } - else { - frame = writeLoBytes(frame, node->txt.ptr.u, node->txt.dim); - } - } - return frame; -} - -static unsigned char * -set_frame_apic(unsigned char *frame, const char *mimetype, const unsigned char *data, size_t size) -{ - /* ID3v2.3 standard APIC frame: - * <Header for 'Attached picture', ID: "APIC"> - * Text encoding $xx - * MIME type <text string> $00 - * Picture type $xx - * Description <text string according to encoding> $00 (00) - * Picture data <binary data> - */ - if (mimetype && data && size) { - frame = set_4_byte_value(frame, FRAME_ID('A', 'P', 'I', 'C')); - frame = set_4_byte_value(frame, (unsigned long) (4 + strlen(mimetype) + size)); - /* clear 2-byte header flags */ - *frame++ = 0; - *frame++ = 0; - /* clear 1 encoding descriptor byte to indicate ISO-8859-1 format */ - *frame++ = 0; - /* copy mime_type */ - while (*mimetype) { - *frame++ = *mimetype++; - } - *frame++ = 0; - /* set picture type to 0 */ - *frame++ = 0; - /* empty description field */ - *frame++ = 0; - /* copy the image data */ - while (size--) { - *frame++ = *data++; - } - } - return frame; -} - -int -id3tag_set_fieldvalue(lame_global_flags * gfp, const char *fieldvalue) -{ - lame_internal_flags *gfc = gfp->internal_flags; - if (fieldvalue && *fieldvalue) { - uint32_t const frame_id = toID3v2TagId(fieldvalue); - char **p = NULL; - if (strlen(fieldvalue) < 5 || fieldvalue[4] != '=') { - return -1; - } - if (frame_id != 0) { - if (id3tag_set_textinfo_latin1(gfp, fieldvalue, &fieldvalue[5])) { - p = (char **) realloc(gfc->tag_spec.values, - sizeof(char *) * (gfc->tag_spec.num_values + 1)); - if (!p) { - return -1; - } - gfc->tag_spec.values = (char **) p; - local_strdup(&gfc->tag_spec.values[gfc->tag_spec.num_values++], fieldvalue); - } - } - gfc->tag_spec.flags |= CHANGED_FLAG; - } - id3tag_add_v2(gfp); - return 0; -} - -int -id3tag_set_fieldvalue_utf16(lame_global_flags * gfp, const unsigned short *fieldvalue) -{ - if (fieldvalue && *fieldvalue) { - size_t dx = hasUcs2ByteOrderMarker(fieldvalue[0]); - unsigned short const separator = fromLatin1Char(fieldvalue, '='); - char fid[5] = {0,0,0,0,0}; - uint32_t const frame_id = toID3v2TagId_ucs2(fieldvalue); - if (local_ucs2_strlen(fieldvalue) < (5+dx) || fieldvalue[4+dx] != separator) { - return -1; - } - fid[0] = (frame_id >> 24) & 0x0ff; - fid[1] = (frame_id >> 16) & 0x0ff; - fid[2] = (frame_id >> 8) & 0x0ff; - fid[3] = frame_id & 0x0ff; - if (frame_id != 0) { - unsigned short* txt = 0; - int rc; - local_ucs2_substr(&txt, fieldvalue, dx+5, local_ucs2_strlen(fieldvalue)); - rc = id3tag_set_textinfo_ucs2(gfp, fid, txt); - free(txt); - return rc; - } - } - return -1; -} - -extern int -id3tag_set_fieldvalue_ucs2(lame_global_flags * gfp, const unsigned short *fieldvalue); - -int -id3tag_set_fieldvalue_ucs2(lame_global_flags * gfp, const unsigned short *fieldvalue) -{ - return id3tag_set_fieldvalue_utf16(gfp, fieldvalue); -} - -size_t -lame_get_id3v2_tag(lame_global_flags * gfp, unsigned char *buffer, size_t size) -{ - lame_internal_flags *gfc; - if (gfp == 0) { - return 0; - } - gfc = gfp->internal_flags; - if (gfc == 0) { - return 0; - } - if (test_tag_spec_flags(gfc, V1_ONLY_FLAG)) { - return 0; - } -#if 0 - debug_tag_spec_flags(gfc, "lame_get_id3v2_tag"); -#endif - { - int usev2 = test_tag_spec_flags(gfc, ADD_V2_FLAG | V2_ONLY_FLAG); - /* calculate length of four fields which may not fit in verion 1 tag */ - size_t title_length = gfc->tag_spec.title ? strlen(gfc->tag_spec.title) : 0; - size_t artist_length = gfc->tag_spec.artist ? strlen(gfc->tag_spec.artist) : 0; - size_t album_length = gfc->tag_spec.album ? strlen(gfc->tag_spec.album) : 0; - size_t comment_length = gfc->tag_spec.comment ? strlen(gfc->tag_spec.comment) : 0; - /* write tag if explicitly requested or if fields overflow */ - if ((title_length > 30) - || (artist_length > 30) - || (album_length > 30) - || (comment_length > 30) - || (gfc->tag_spec.track_id3v1 && (comment_length > 28))) { - usev2 = 1; - } - if (usev2) { - size_t tag_size; - unsigned char *p; - size_t adjusted_tag_size; - unsigned int i; - const char *albumart_mime = NULL; - static const char *mime_jpeg = "image/jpeg"; - static const char *mime_png = "image/png"; - static const char *mime_gif = "image/gif"; - - if (gfp->num_samples != MAX_U_32_NUM) { - id3v2AddAudioDuration(gfc, gfp->num_samples); - } - - /* calulate size of tag starting with 10-byte tag header */ - tag_size = 10; - for (i = 0; i < gfc->tag_spec.num_values; ++i) { - tag_size += 6 + strlen(gfc->tag_spec.values[i]); - } - if (gfc->tag_spec.albumart && gfc->tag_spec.albumart_size) { - switch (gfc->tag_spec.albumart_mimetype) { - case MIMETYPE_JPEG: - albumart_mime = mime_jpeg; - break; - case MIMETYPE_PNG: - albumart_mime = mime_png; - break; - case MIMETYPE_GIF: - albumart_mime = mime_gif; - break; - } - if (albumart_mime) { - tag_size += 10 + 4 + strlen(albumart_mime) + gfc->tag_spec.albumart_size; - } - } - { - id3tag_spec *tag = &gfc->tag_spec; - if (tag->v2_head != 0) { - FrameDataNode *node; - for (node = tag->v2_head; node != 0; node = node->nxt) { - if (node->fid == ID_COMMENT) { - tag_size += sizeOfCommentNode(node); - } - else if (isFrameIdMatching(node->fid, FRAME_ID('W',0,0,0))) { - tag_size += sizeOfWxxxNode(node); - } - else { - tag_size += sizeOfNode(node); - } - } - } - } - if (test_tag_spec_flags(gfc, PAD_V2_FLAG)) { - /* add some bytes of padding */ - tag_size += gfc->tag_spec.padding_size; - } - if (size < tag_size) { - return tag_size; - } - if (buffer == 0) { - return 0; - } - p = buffer; - /* set tag header starting with file identifier */ - *p++ = 'I'; - *p++ = 'D'; - *p++ = '3'; - /* set version number word */ - *p++ = 3; - *p++ = 0; - /* clear flags byte */ - *p++ = 0; - /* calculate and set tag size = total size - header size */ - adjusted_tag_size = tag_size - 10; - /* encode adjusted size into four bytes where most significant - * bit is clear in each byte, for 28-bit total */ - *p++ = (unsigned char) ((adjusted_tag_size >> 21) & 0x7fu); - *p++ = (unsigned char) ((adjusted_tag_size >> 14) & 0x7fu); - *p++ = (unsigned char) ((adjusted_tag_size >> 7) & 0x7fu); - *p++ = (unsigned char) (adjusted_tag_size & 0x7fu); - - /* - * NOTE: The remainder of the tag (frames and padding, if any) - * are not "unsynchronized" to prevent false MPEG audio headers - * from appearing in the bitstream. Why? Well, most players - * and utilities know how to skip the ID3 version 2 tag by now - * even if they don't read its contents, and it's actually - * very unlikely that such a false "sync" pattern would occur - * in just the simple text frames added here. - */ - - /* set each frame in tag */ - { - id3tag_spec *tag = &gfc->tag_spec; - if (tag->v2_head != 0) { - FrameDataNode *node; - for (node = tag->v2_head; node != 0; node = node->nxt) { - if (node->fid == ID_COMMENT) { - p = set_frame_comment(p, node); - } - else if (isFrameIdMatching(node->fid,FRAME_ID('W',0,0,0))) { - p = set_frame_wxxx(p, node); - } - else { - p = set_frame_custom2(p, node); - } - } - } - } - for (i = 0; i < gfc->tag_spec.num_values; ++i) { - p = set_frame_custom(p, gfc->tag_spec.values[i]); - } - if (albumart_mime) { - p = set_frame_apic(p, albumart_mime, gfc->tag_spec.albumart, - gfc->tag_spec.albumart_size); - } - /* clear any padding bytes */ - memset(p, 0, tag_size - (p - buffer)); - return tag_size; - } - } - return 0; -} - -int -id3tag_write_v2(lame_global_flags * gfp) -{ - lame_internal_flags *gfc = gfp->internal_flags; -#if 0 - debug_tag_spec_flags(gfc, "write v2"); -#endif - if (test_tag_spec_flags(gfc, V1_ONLY_FLAG)) { - return 0; - } - if (test_tag_spec_flags(gfc, CHANGED_FLAG)) { - unsigned char *tag = 0; - size_t tag_size, n; - - n = lame_get_id3v2_tag(gfp, 0, 0); - tag = malloc(n); - if (tag == 0) { - return -1; - } - tag_size = lame_get_id3v2_tag(gfp, tag, n); - if (tag_size > n) { - free(tag); - return -1; - } - else { - size_t i; - /* write tag directly into bitstream at current position */ - for (i = 0; i < tag_size; ++i) { - add_dummy_byte(gfc, tag[i], 1); - } - } - free(tag); - return (int) tag_size; /* ok, tag should not exceed 2GB */ - } - return 0; -} - -static unsigned char * -set_text_field(unsigned char *field, const char *text, size_t size, int pad) -{ - while (size--) { - if (text && *text) { - *field++ = *text++; - } - else { - *field++ = pad; - } - } - return field; -} - -size_t -lame_get_id3v1_tag(lame_global_flags * gfp, unsigned char *buffer, size_t size) -{ - size_t const tag_size = 128; - lame_internal_flags *gfc; - - if (gfp == 0) { - return 0; - } - if (size < tag_size) { - return tag_size; - } - gfc = gfp->internal_flags; - if (gfc == 0) { - return 0; - } - if (buffer == 0) { - return 0; - } - if (test_tag_spec_flags(gfc, V2_ONLY_FLAG)) { - return 0; - } - if (test_tag_spec_flags(gfc, CHANGED_FLAG)) { - unsigned char *p = buffer; - int pad = test_tag_spec_flags(gfc, SPACE_V1_FLAG) ? ' ' : 0; - char year[5]; - - /* set tag identifier */ - *p++ = 'T'; - *p++ = 'A'; - *p++ = 'G'; - /* set each field in tag */ - p = set_text_field(p, gfc->tag_spec.title, 30, pad); - p = set_text_field(p, gfc->tag_spec.artist, 30, pad); - p = set_text_field(p, gfc->tag_spec.album, 30, pad); - sprintf(year, "%d", gfc->tag_spec.year); - p = set_text_field(p, gfc->tag_spec.year ? year : NULL, 4, pad); - /* limit comment field to 28 bytes if a track is specified */ - p = set_text_field(p, gfc->tag_spec.comment, gfc->tag_spec.track_id3v1 ? 28 : 30, pad); - if (gfc->tag_spec.track_id3v1) { - /* clear the next byte to indicate a version 1.1 tag */ - *p++ = 0; - *p++ = gfc->tag_spec.track_id3v1; - } - *p++ = gfc->tag_spec.genre_id3v1; - return tag_size; - } - return 0; -} - -int -id3tag_write_v1(lame_global_flags * gfp) -{ - lame_internal_flags *const gfc = gfp->internal_flags; - size_t i, n, m; - unsigned char tag[128]; - - m = sizeof(tag); - n = lame_get_id3v1_tag(gfp, tag, m); - if (n > m) { - return 0; - } - /* write tag directly into bitstream at current position */ - for (i = 0; i < n; ++i) { - add_dummy_byte(gfc, tag[i], 1); - } - return (int) n; /* ok, tag has fixed size of 128 bytes, well below 2GB */ -} diff --git a/src/lib/dl/ext/lame/id3tag.h b/src/lib/dl/ext/lame/id3tag.h deleted file mode 100755 index cd389678..00000000 --- a/src/lib/dl/ext/lame/id3tag.h +++ /dev/null @@ -1,65 +0,0 @@ - -#ifndef LAME_ID3_H -#define LAME_ID3_H - - -#define CHANGED_FLAG (1U << 0) -#define ADD_V2_FLAG (1U << 1) -#define V1_ONLY_FLAG (1U << 2) -#define V2_ONLY_FLAG (1U << 3) -#define SPACE_V1_FLAG (1U << 4) -#define PAD_V2_FLAG (1U << 5) - -enum { - MIMETYPE_NONE = 0, - MIMETYPE_JPEG, - MIMETYPE_PNG, - MIMETYPE_GIF, -}; - -typedef struct FrameDataNode { - struct FrameDataNode *nxt; - uint32_t fid; /* Frame Identifier */ - char lng[4]; /* 3-character language descriptor */ - struct { - union { - char *l; /* ptr to Latin-1 chars */ - unsigned short *u; /* ptr to UCS-2 text */ - unsigned char *b; /* ptr to raw bytes */ - } ptr; - size_t dim; - int enc; /* 0:Latin-1, 1:UCS-2, 2:RAW */ - } dsc , txt; -} FrameDataNode; - - -typedef struct id3tag_spec { - /* private data members */ - unsigned int flags; - int year; - char *title; - char *artist; - char *album; - char *comment; - int track_id3v1; - int genre_id3v1; - unsigned char *albumart; - unsigned int albumart_size; - unsigned int padding_size; - int albumart_mimetype; - char **values; - unsigned int num_values; - FrameDataNode *v2_head, *v2_tail; -} id3tag_spec; - - -/* write tag into stream at current position */ -extern int id3tag_write_v2(lame_global_flags * gfp); -extern int id3tag_write_v1(lame_global_flags * gfp); -/* - * NOTE: A version 2 tag will NOT be added unless one of the text fields won't - * fit in a version 1 tag (e.g. the title string is longer than 30 characters), - * or the "id3tag_add_v2" or "id3tag_v2_only" functions are used. - */ - -#endif diff --git a/src/lib/dl/ext/lame/interface.c b/src/lib/dl/ext/lame/interface.c deleted file mode 100755 index 0a89e4bd..00000000 --- a/src/lib/dl/ext/lame/interface.c +++ /dev/null @@ -1,711 +0,0 @@ -/* - * interface.c - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - */ -/* $Id: interface.c,v 1.64 2010/03/22 14:30:19 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdlib.h> -#include <stdio.h> - -#include "common.h" -#include "interface.h" -#include "tabinit.h" -#include "layer3.h" -#include "lame.h" -#include "machine.h" -#include "vbrtag.h" -#include "decode_i386.h" - -#include "layer1.h" -#include "layer2.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -extern void lame_report_def(const char* format, va_list args); - -/* #define HIP_DEBUG */ - -int -InitMP3(PMPSTR mp) -{ - hip_init_tables_layer1(); - hip_init_tables_layer2(); - hip_init_tables_layer3(); - - 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; - mp->wordpointer = mp->bsspace[mp->bsnum] + 512; - mp->bitindex = 0; - mp->synth_bo = 1; - mp->sync_bitstream = 1; - - mp->report_dbg = &lame_report_def; - mp->report_err = &lame_report_def; - mp->report_msg = &lame_report_def; - - make_decode_tables(32767); - - return 1; -} - -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) { - lame_report_fnc(mp->report_err, "hip: addbuf() 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) { - lame_report_fnc(mp->report_err, "hip: 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; -} - - - - -static void -copy_mp(PMPSTR mp, int size, unsigned char *ptr) -{ - int len = 0; - - while (len < size && mp->tail) { - 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 -*/ -static 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 < bytes; ++i) { - while (pos >= buf->size) { - buf = buf->next; - if (!buf) - return -1; /* fatal error */ - pos = buf->pos; - } - ++pos; - } - /* now read header */ - for (i = 0; i < XING_HEADER_SIZE; ++i) { - while (pos >= buf->size) { - buf = buf->next; - 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; - - /* lame_report_fnc(mp->report_msg,"hip: delays: %i %i \n",mp->enc_delay,mp->enc_padding); */ - /* lame_report_fnc(mp->report_msg,"hip: Xing VBR header dectected. MP3 file has %i frames\n", pTagData.frames); */ - if (pTagData.headersize < 1) - return 1; - return pTagData.headersize; - } - return 0; -} - - - - - -static int -sync_buffer(PMPSTR mp, int free_match) -{ - /* traverse mp structure without modifying 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; - if (!buf) - return -1; - - pos = buf->pos; - for (i = 0; i < mp->bsize; i++) { - /* get 4 bytes */ - - b[0] = b[1]; - b[1] = b[2]; - b[2] = b[3]; - while (pos >= buf->size) { - buf = buf->next; - pos = buf->pos; - if (!buf) { - return -1; - /* not enough data to read 4 bytes */ - } - } - 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; -} - - -void -decode_reset(PMPSTR mp) -{ -#if 0 - remove_buf(mp); - /* start looking for next frame */ - /* mp->fsizeold = mp->framesize; */ - mp->fsizeold = -1; - mp->old_free_format = mp->free_format; - mp->framesize = 0; - mp->header_parsed = 0; - mp->side_parsed = 0; - mp->data_parsed = 0; - mp->sync_bitstream = 1; /* TODO check if this is right */ -#else - InitMP3(mp); /* Less error prone to just to reinitialise. */ -#endif -} - -int -audiodata_precedesframes(PMPSTR mp) -{ - if (mp->fr.lay == 3) - return layer3_audiodata_precedesframes(mp); - else - return 0; /* For Layer 1 & 2 the audio data starts at the frame that describes it, so no audio data precedes. */ -} - -static int -decodeMP3_clipchoice(PMPSTR mp, unsigned char *in, int isize, char *out, int *done, - int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *), - int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *)) -{ - int i, iret, bits, bytes; - - if (in && isize && 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 */ -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, "hip: not enough data to look for Xing header\n"); -#endif - return MP3_NEED_MORE; - } - - if (mp->vbr_header) { - /* do we have enough data to parse entire Xing header? */ - if (bytes + vbrbytes > mp->bsize) { - /* lame_report_fnc(mp->report_err,"hip: not enough data to parse entire Xing header\n"); */ - 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 */ -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, "hip: found xing header, skipping %i bytes\n", vbrbytes + bytes); -#endif - for (i = 0; i < vbrbytes + bytes; ++i) - read_buf_byte(mp); - /* now we need to find another syncword */ - /* just return and make user send in more data */ - - return MP3_NEED_MORE; - } - } - else { - /* match channels, samplerate, etc, when syncing */ - bytes = sync_buffer(mp, 1); - } - - /* buffer now synchronized */ - if (bytes < 0) { - /* lame_report_fnc(mp->report_err,"hip: need more bytes %d\n", bytes); */ - return MP3_NEED_MORE; - } - if (bytes > 0) { - /* 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; - lame_report_fnc(mp->report_err, "hip: bitstream problem, resyncing skipping %d bytes...\n", bytes); - mp->old_free_format = 0; -#if 1 - /* FIXME: correct ??? */ - mp->sync_bitstream = 1; -#endif - /* skip some bytes, buffer the rest */ - size = (int) (mp->wordpointer - (mp->bsspace[mp->bsnum] + 512)); - - if (size > MAXFRAMESIZE) { - /* wordpointer buffer is trashed. probably cant recover, but try anyway */ - lame_report_fnc(mp->report_err, "hip: wordpointer trashed. size=%i (%i) bytes=%i \n", - size, MAXFRAMESIZE, bytes); - size = 0; - mp->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, mp->wordpointer); - mp->fsizeold += bytes; - } - - read_head(mp); - decode_header(mp, &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 */ - mp->wordpointer = mp->bsspace[mp->bsnum] + 512; - mp->bitindex = 0; - - /* for very first header, never parse rest of data */ - if (mp->fsizeold == -1) { -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, "hip: not parsing the rest of the data of the first header\n"); -#endif - return MP3_NEED_MORE; - } - } /* end of header parsing block */ - - /* 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, mp->wordpointer); - - if (mp->fr.error_protection) - getbits(mp, 16); - bits = decode_layer3_sideinfo(mp); - /* 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; - - if (!mp->free_format) { - /* do not read more than framsize data */ - int framesize = mp->fr.framesize - mp->ssize; - if (mp->dsize > framesize) { - lame_report_fnc(mp->report_err, - "hip: error audio data exceeds framesize by %d bytes\n", - mp->dsize - framesize); - mp->dsize = framesize; - } - } -#ifdef HIP_DEBUG - lame_report_fnc(mp->report_dbg, - "hip: %d bits needed to parse layer III frame, number of bytes to read before decoding dsize = %d\n", - bits, mp->dsize); -#endif - - /* 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, mp->wordpointer); - - *done = 0; - - /*do_layer3(&mp->fr,(unsigned char *) out,done); */ - switch (mp->fr.lay) { - case 1: - if (mp->fr.error_protection) - getbits(mp, 16); - - decode_layer1_frame(mp, (unsigned char *) out, done); - break; - - case 2: - if (mp->fr.error_protection) - getbits(mp, 16); - - decode_layer2_frame(mp, (unsigned char *) out, done); - break; - - case 3: - decode_layer3_frame(mp, (unsigned char *) out, done, synth_1to1_mono_ptr, synth_1to1_ptr); - break; - default: - lame_report_fnc(mp->report_err, "hip: invalid layer %d\n", mp->fr.lay); - } - - mp->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; -#if 0 - lame_report_fnc(mp->report_dbg,"hip: freeformat bitstream: estimated bitrate=%ikbs \n", - 8*(4+mp->framesize)*freqs[mp->fr.sampling_frequency]/ - (1000*576*(2-mp->fr.lsf))); -#endif - } - } - - /* 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; -#if 1 - /* FIXME: while loop OK ??? */ - while (bytes > 512) { - read_buf_byte(mp); - bytes--; - mp->framesize--; - } -#endif - copy_mp(mp, bytes, mp->wordpointer); - mp->wordpointer += bytes; - - size = (int) (mp->wordpointer - (mp->bsspace[mp->bsnum] + 512)); - if (size > MAXFRAMESIZE) { - lame_report_fnc(mp->report_err, "hip: fatal error. MAXFRAMESIZE not large enough.\n"); - } - - } - - /* the above frame is completely 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; -} - -int -decodeMP3(PMPSTR mp, unsigned char *in, int isize, char *out, int osize, int *done) -{ - if (osize < 4608) { - lame_report_fnc(mp->report_err, "hip: Insufficient memory for decoding buffer %d\n", osize); - return MP3_ERR; - } - - /* passing pointers to the functions which clip the samples */ - return decodeMP3_clipchoice(mp, in, isize, out, done, synth_1to1_mono, synth_1to1); -} - -int -decodeMP3_unclipped(PMPSTR mp, unsigned char *in, int isize, char *out, int osize, int *done) -{ - /* we forbid input with more than 1152 samples per channel for output in unclipped mode */ - if (osize < (int) (1152 * 2 * sizeof(real))) { - lame_report_fnc(mp->report_err, "hip: out space too small for unclipped mode\n"); - return MP3_ERR; - } - - /* passing pointers to the functions which don't clip the samples */ - return decodeMP3_clipchoice(mp, in, isize, out, done, synth_1to1_mono_unclipped, - synth_1to1_unclipped); -} diff --git a/src/lib/dl/ext/lame/interface.h b/src/lib/dl/ext/lame/interface.h deleted file mode 100755 index f713b466..00000000 --- a/src/lib/dl/ext/lame/interface.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 INTERFACE_H_INCLUDED -#define INTERFACE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#include "common.h" - - int InitMP3(PMPSTR mp); - int decodeMP3(PMPSTR mp, unsigned char *inmemory, int inmemsize, char *outmemory, - int outmemsize, int *done); - void ExitMP3(PMPSTR mp); - -/* added decodeMP3_unclipped to support returning raw floating-point values of samples. The representation - of the floating-point numbers is defined in mpg123.h as #define real. It is 64-bit double by default. - No more than 1152 samples per channel are allowed. */ - int decodeMP3_unclipped(PMPSTR mp, unsigned char *inmemory, int inmemsize, char *outmemory, - int outmemsize, int *done); - -/* added remove_buf to support mpglib seeking */ - void remove_buf(PMPSTR mp); - -/* added audiodata_precedesframes to return the number of bitstream frames the audio data will precede the - current frame by for Layer 3 data. Aids seeking. - */ - int audiodata_precedesframes(PMPSTR mp); - -/* Resets decoding. Aids seeking. */ - void decode_reset(PMPSTR mp); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/lib/dl/ext/lame/l2tables.h b/src/lib/dl/ext/lame/l2tables.h deleted file mode 100755 index 6a3deace..00000000 --- a/src/lib/dl/ext/lame/l2tables.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - * - * 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/src/lib/dl/ext/lame/l3side.h b/src/lib/dl/ext/lame/l3side.h deleted file mode 100755 index 1878284d..00000000 --- a/src/lib/dl/ext/lame/l3side.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Layer 3 side include file - * - * Copyright (c) 1999 Mark Taylor - * - * 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_L3SIDE_H -#define LAME_L3SIDE_H - -/* max scalefactor band, max(SBMAX_l, SBMAX_s*3, (SBMAX_s-3)*3+8) */ -#define SFBMAX (SBMAX_s*3) - -/* Layer III side information. */ -typedef struct { - int l[1 + SBMAX_l]; - int s[1 + SBMAX_s]; - int psfb21[1 + PSFB21]; - int psfb12[1 + PSFB12]; -} scalefac_struct; - - -typedef struct { - FLOAT l[SBMAX_l]; - FLOAT s[SBMAX_s][3]; -} III_psy_xmin; - -typedef struct { - III_psy_xmin thm; - III_psy_xmin en; -} III_psy_ratio; - -typedef struct { - FLOAT xr[576]; - int l3_enc[576]; - int scalefac[SFBMAX]; - FLOAT xrpow_max; - - int part2_3_length; - int big_values; - int count1; - int global_gain; - int scalefac_compress; - int block_type; - int mixed_block_flag; - int table_select[3]; - int subblock_gain[3 + 1]; - int region0_count; - int region1_count; - int preflag; - int scalefac_scale; - int count1table_select; - - int part2_length; - int sfb_lmax; - int sfb_smin; - int psy_lmax; - int sfbmax; - int psymax; - int sfbdivide; - int width[SFBMAX]; - int window[SFBMAX]; - int count1bits; - /* added for LSF */ - const int *sfb_partition_table; - int slen[4]; - - int max_nonzero_coeff; -} gr_info; - -typedef struct { - gr_info tt[2][2]; - int main_data_begin; - int private_bits; - int resvDrain_pre; - int resvDrain_post; - int scfsi[2][4]; -} III_side_info_t; - -#endif diff --git a/src/lib/dl/ext/lame/lame-analysis.h b/src/lib/dl/ext/lame/lame-analysis.h deleted file mode 100755 index 5055a603..00000000 --- a/src/lib/dl/ext/lame/lame-analysis.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * GTK plotting routines source file - * - * Copyright (c) 1999 Mark Taylor - * - * 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_GTKANAL_H -#define LAME_GTKANAL_H - - -#define READ_AHEAD 40 /* number of frames to read ahead */ -#define MAXMPGLAG READ_AHEAD /* if the mpg123 lag becomes bigger than this - we have to stop */ -#define NUMBACK 6 /* number of frames we can back up */ -#define NUMPINFO (NUMBACK+READ_AHEAD+1) - - - -struct plotting_data { - int frameNum; /* current frame number */ - int frameNum123; - int num_samples; /* number of pcm samples read for this frame */ - double frametime; /* starting time of frame, in seconds */ - double pcmdata[2][1600]; - double pcmdata2[2][1152 + 1152 - DECDELAY]; - double xr[2][2][576]; - double mpg123xr[2][2][576]; - double ms_ratio[2]; - double ms_ener_ratio[2]; - - /* L,R, M and S values */ - double energy_save[4][BLKSIZE]; /* psymodel is one ahead */ - double energy[2][4][BLKSIZE]; - double pe[2][4]; - double thr[2][4][SBMAX_l]; - double en[2][4][SBMAX_l]; - double thr_s[2][4][3 * SBMAX_s]; - double en_s[2][4][3 * SBMAX_s]; - double ers_save[4]; /* psymodel is one ahead */ - double ers[2][4]; - - double sfb[2][2][SBMAX_l]; - double sfb_s[2][2][3 * SBMAX_s]; - double LAMEsfb[2][2][SBMAX_l]; - double LAMEsfb_s[2][2][3 * SBMAX_s]; - - int LAMEqss[2][2]; - int qss[2][2]; - int big_values[2][2]; - int sub_gain[2][2][3]; - - double xfsf[2][2][SBMAX_l]; - double xfsf_s[2][2][3 * SBMAX_s]; - - int over[2][2]; - double tot_noise[2][2]; - double max_noise[2][2]; - double over_noise[2][2]; - int over_SSD[2][2]; - int blocktype[2][2]; - int scalefac_scale[2][2]; - int preflag[2][2]; - int mpg123blocktype[2][2]; - int mixed[2][2]; - int mainbits[2][2]; - int sfbits[2][2]; - int LAMEmainbits[2][2]; - int LAMEsfbits[2][2]; - int framesize, stereo, js, ms_stereo, i_stereo, emph, bitrate, sampfreq, maindata; - int crc, padding; - int scfsi[2], mean_bits, resvsize; - int totbits; -}; -#ifndef plotting_data_defined -#define plotting_data_defined -typedef struct plotting_data plotting_data; -#endif -#if 0 -extern plotting_data *pinfo; -#endif -#endif diff --git a/src/lib/dl/ext/lame/lame.c b/src/lib/dl/ext/lame/lame.c deleted file mode 100755 index 35941ba7..00000000 --- a/src/lib/dl/ext/lame/lame.c +++ /dev/null @@ -1,2643 +0,0 @@ -/* -*- mode: C; mode: fold -*- */ -/* - * LAME MP3 encoding engine - * - * Copyright (c) 1999-2000 Mark Taylor - * Copyright (c) 2000-2005 Takehiro Tominaga - * Copyright (c) 2000-2011 Robert Hegemann - * Copyright (c) 2000-2005 Gabriel Bouvigne - * Copyright (c) 2000-2004 Alexander Leidinger - * - * 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. - */ - -/* $Id: lame.c,v 1.365 2011/10/18 21:51:20 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#include "lame.h" -#include "machine.h" - -#include "encoder.h" -#include "util.h" -#include "lame_global_flags.h" -#include "gain_analysis.h" -#include "bitstream.h" -#include "quantize_pvt.h" -#include "set_get.h" -#include "quantize.h" -#include "psymodel.h" -#include "version.h" -#include "vbrtag.h" -#include "tables.h" - - -#if defined(__FreeBSD__) && !defined(__alpha__) -#include <floatingpoint.h> -#endif -#ifdef __riscos__ -#include "asmstuff.h" -#endif - -#ifdef __sun__ -/* woraround for SunOS 4.x, it has SEEK_* defined here */ -#include <unistd.h> -#endif - - -#define LAME_DEFAULT_QUALITY 3 - - - -int -is_lame_global_flags_valid(const lame_global_flags * gfp) -{ - if (gfp == NULL) - return 0; - if (gfp->class_id != LAME_ID) - return 0; - return 1; -} - - -int -is_lame_internal_flags_valid(const lame_internal_flags * gfc) -{ - if (gfc == NULL) - return 0; - if (gfc->class_id != LAME_ID) - return 0; - return 1; -} - - - -static FLOAT -filter_coef(FLOAT x) -{ - if (x > 1.0) - return 0.0; - if (x <= 0.0) - return 1.0; - - return cos(PI / 2 * x); -} - -static void -lame_init_params_ppflt(lame_internal_flags * gfc) -{ - SessionConfig_t *const cfg = &gfc->cfg; - - /***************************************************************/ - /* compute info needed for polyphase filter (filter type==0, default) */ - /***************************************************************/ - - int band, maxband, minband; - FLOAT freq; - int lowpass_band = 32; - int highpass_band = -1; - - if (cfg->lowpass1 > 0) { - minband = 999; - for (band = 0; band <= 31; band++) { - freq = band / 31.0; - /* this band and above will be zeroed: */ - if (freq >= cfg->lowpass2) { - lowpass_band = Min(lowpass_band, band); - } - if (cfg->lowpass1 < freq && freq < cfg->lowpass2) { - minband = Min(minband, band); - } - } - - /* compute the *actual* transition band implemented by - * the polyphase filter */ - if (minband == 999) { - cfg->lowpass1 = (lowpass_band - .75) / 31.0; - } - else { - cfg->lowpass1 = (minband - .75) / 31.0; - } - cfg->lowpass2 = lowpass_band / 31.0; - } - - /* make sure highpass filter is within 90% of what the effective - * highpass frequency will be */ - if (cfg->highpass2 > 0) { - if (cfg->highpass2 < .9 * (.75 / 31.0)) { - cfg->highpass1 = 0; - cfg->highpass2 = 0; - MSGF(gfc, "Warning: highpass filter disabled. " "highpass frequency too small\n"); - } - } - - if (cfg->highpass2 > 0) { - maxband = -1; - for (band = 0; band <= 31; band++) { - freq = band / 31.0; - /* this band and below will be zereod */ - if (freq <= cfg->highpass1) { - highpass_band = Max(highpass_band, band); - } - if (cfg->highpass1 < freq && freq < cfg->highpass2) { - maxband = Max(maxband, band); - } - } - /* compute the *actual* transition band implemented by - * the polyphase filter */ - cfg->highpass1 = highpass_band / 31.0; - if (maxband == -1) { - cfg->highpass2 = (highpass_band + .75) / 31.0; - } - else { - cfg->highpass2 = (maxband + .75) / 31.0; - } - } - - for (band = 0; band < 32; band++) { - FLOAT fc1, fc2; - freq = band / 31.0f; - if (cfg->highpass2 > cfg->highpass1) { - fc1 = filter_coef((cfg->highpass2 - freq) / (cfg->highpass2 - cfg->highpass1 + 1e-20)); - } - else { - fc1 = 1.0f; - } - if (cfg->lowpass2 > cfg->lowpass1) { - fc2 = filter_coef((freq - cfg->lowpass1) / (cfg->lowpass2 - cfg->lowpass1 + 1e-20)); - } - else { - fc2 = 1.0f; - } - gfc->sv_enc.amp_filter[band] = fc1 * fc2; - } -} - - -static void -optimum_bandwidth(double *const lowerlimit, double *const upperlimit, const unsigned bitrate) -{ -/* - * Input: - * bitrate total bitrate in kbps - * - * Output: - * lowerlimit: best lowpass frequency limit for input filter in Hz - * upperlimit: best highpass frequency limit for input filter in Hz - */ - int table_index; - - typedef struct { - int bitrate; /* only indicative value */ - int lowpass; - } band_pass_t; - - static const band_pass_t freq_map[] = { - {8, 2000}, - {16, 3700}, - {24, 3900}, - {32, 5500}, - {40, 7000}, - {48, 7500}, - {56, 10000}, - {64, 11000}, - {80, 13500}, - {96, 15100}, - {112, 15600}, - {128, 17000}, - {160, 17500}, - {192, 18600}, - {224, 19400}, - {256, 19700}, - {320, 20500} - }; - - - table_index = nearestBitrateFullIndex(bitrate); - - (void) freq_map[table_index].bitrate; - *lowerlimit = freq_map[table_index].lowpass; - - -/* - * Now we try to choose a good high pass filtering frequency. - * This value is currently not used. - * For fu < 16 kHz: sqrt(fu*fl) = 560 Hz - * For fu = 18 kHz: no high pass filtering - * This gives: - * - * 2 kHz => 160 Hz - * 3 kHz => 107 Hz - * 4 kHz => 80 Hz - * 8 kHz => 40 Hz - * 16 kHz => 20 Hz - * 17 kHz => 10 Hz - * 18 kHz => 0 Hz - * - * These are ad hoc values and these can be optimized if a high pass is available. - */ -/* if (f_low <= 16000) - f_high = 16000. * 20. / f_low; - else if (f_low <= 18000) - f_high = 180. - 0.01 * f_low; - else - f_high = 0.;*/ - - /* - * When we sometimes have a good highpass filter, we can add the highpass - * frequency to the lowpass frequency - */ - - /*if (upperlimit != NULL) - *upperlimit = f_high;*/ - (void) upperlimit; -} - - -static int -optimum_samplefreq(int lowpassfreq, int input_samplefreq) -{ -/* - * Rules: - * - if possible, sfb21 should NOT be used - * - */ - int suggested_samplefreq = 44100; - - if (input_samplefreq >= 48000) - suggested_samplefreq = 48000; - else if (input_samplefreq >= 44100) - suggested_samplefreq = 44100; - else if (input_samplefreq >= 32000) - suggested_samplefreq = 32000; - else if (input_samplefreq >= 24000) - suggested_samplefreq = 24000; - else if (input_samplefreq >= 22050) - suggested_samplefreq = 22050; - else if (input_samplefreq >= 16000) - suggested_samplefreq = 16000; - else if (input_samplefreq >= 12000) - suggested_samplefreq = 12000; - else if (input_samplefreq >= 11025) - suggested_samplefreq = 11025; - else if (input_samplefreq >= 8000) - suggested_samplefreq = 8000; - - if (lowpassfreq == -1) - return suggested_samplefreq; - - if (lowpassfreq <= 15960) - suggested_samplefreq = 44100; - if (lowpassfreq <= 15250) - suggested_samplefreq = 32000; - if (lowpassfreq <= 11220) - suggested_samplefreq = 24000; - if (lowpassfreq <= 9970) - suggested_samplefreq = 22050; - if (lowpassfreq <= 7230) - suggested_samplefreq = 16000; - if (lowpassfreq <= 5420) - suggested_samplefreq = 12000; - if (lowpassfreq <= 4510) - suggested_samplefreq = 11025; - if (lowpassfreq <= 3970) - suggested_samplefreq = 8000; - - if (input_samplefreq < suggested_samplefreq) { - /* choose a valid MPEG sample frequency above the input sample frequency - to avoid SFB21/12 bitrate bloat - rh 061115 - */ - if (input_samplefreq > 44100) { - return 48000; - } - if (input_samplefreq > 32000) { - return 44100; - } - if (input_samplefreq > 24000) { - return 32000; - } - if (input_samplefreq > 22050) { - return 24000; - } - if (input_samplefreq > 16000) { - return 22050; - } - if (input_samplefreq > 12000) { - return 16000; - } - if (input_samplefreq > 11025) { - return 12000; - } - if (input_samplefreq > 8000) { - return 11025; - } - return 8000; - } - return suggested_samplefreq; -} - - - - - -/* set internal feature flags. USER should not access these since - * some combinations will produce strange results */ -static void -lame_init_qval(lame_global_flags * gfp) -{ - lame_internal_flags *const gfc = gfp->internal_flags; - SessionConfig_t *const cfg = &gfc->cfg; - - switch (gfp->quality) { - default: - case 9: /* no psymodel, no noise shaping */ - cfg->noise_shaping = 0; - cfg->noise_shaping_amp = 0; - cfg->noise_shaping_stop = 0; - cfg->use_best_huffman = 0; - cfg->full_outer_loop = 0; - break; - - case 8: - gfp->quality = 7; - /*lint --fallthrough */ - case 7: /* use psymodel (for short block and m/s switching), but no noise shapping */ - cfg->noise_shaping = 0; - cfg->noise_shaping_amp = 0; - cfg->noise_shaping_stop = 0; - cfg->use_best_huffman = 0; - cfg->full_outer_loop = 0; - if (gfp->VBR == vbr_mt || gfp->VBR == vbr_mtrh) { - cfg->full_outer_loop = -1; - } - break; - - case 6: - if (cfg->noise_shaping == 0) - cfg->noise_shaping = 1; - cfg->noise_shaping_amp = 0; - cfg->noise_shaping_stop = 0; - if (cfg->subblock_gain == -1) - cfg->subblock_gain = 1; - cfg->use_best_huffman = 0; - cfg->full_outer_loop = 0; - break; - - case 5: - if (cfg->noise_shaping == 0) - cfg->noise_shaping = 1; - cfg->noise_shaping_amp = 0; - cfg->noise_shaping_stop = 0; - if (cfg->subblock_gain == -1) - cfg->subblock_gain = 1; - cfg->use_best_huffman = 0; - cfg->full_outer_loop = 0; - break; - - case 4: - if (cfg->noise_shaping == 0) - cfg->noise_shaping = 1; - cfg->noise_shaping_amp = 0; - cfg->noise_shaping_stop = 0; - if (cfg->subblock_gain == -1) - cfg->subblock_gain = 1; - cfg->use_best_huffman = 1; - cfg->full_outer_loop = 0; - break; - - case 3: - if (cfg->noise_shaping == 0) - cfg->noise_shaping = 1; - cfg->noise_shaping_amp = 1; - cfg->noise_shaping_stop = 1; - if (cfg->subblock_gain == -1) - cfg->subblock_gain = 1; - cfg->use_best_huffman = 1; - cfg->full_outer_loop = 0; - break; - - case 2: - if (cfg->noise_shaping == 0) - cfg->noise_shaping = 1; - if (gfc->sv_qnt.substep_shaping == 0) - gfc->sv_qnt.substep_shaping = 2; - cfg->noise_shaping_amp = 1; - cfg->noise_shaping_stop = 1; - if (cfg->subblock_gain == -1) - cfg->subblock_gain = 1; - cfg->use_best_huffman = 1; /* inner loop */ - cfg->full_outer_loop = 0; - break; - - case 1: - if (cfg->noise_shaping == 0) - cfg->noise_shaping = 1; - if (gfc->sv_qnt.substep_shaping == 0) - gfc->sv_qnt.substep_shaping = 2; - cfg->noise_shaping_amp = 2; - cfg->noise_shaping_stop = 1; - if (cfg->subblock_gain == -1) - cfg->subblock_gain = 1; - cfg->use_best_huffman = 1; - cfg->full_outer_loop = 0; - break; - - case 0: - if (cfg->noise_shaping == 0) - cfg->noise_shaping = 1; - if (gfc->sv_qnt.substep_shaping == 0) - gfc->sv_qnt.substep_shaping = 2; - cfg->noise_shaping_amp = 2; - cfg->noise_shaping_stop = 1; - if (cfg->subblock_gain == -1) - cfg->subblock_gain = 1; - cfg->use_best_huffman = 1; /*type 2 disabled because of it slowness, - in favor of full outer loop search */ - cfg->full_outer_loop = 1; - break; - } - -} - - - -static double -linear_int(double a, double b, double m) -{ - return a + m * (b - a); -} - - - -/******************************************************************** - * initialize internal params based on data in gf - * (globalflags struct filled in by calling program) - * - * OUTLINE: - * - * We first have some complex code to determine bitrate, - * output samplerate and mode. It is complicated by the fact - * that we allow the user to set some or all of these parameters, - * and need to determine best possible values for the rest of them: - * - * 1. set some CPU related flags - * 2. check if we are mono->mono, stereo->mono or stereo->stereo - * 3. compute bitrate and output samplerate: - * user may have set compression ratio - * user may have set a bitrate - * user may have set a output samplerate - * 4. set some options which depend on output samplerate - * 5. compute the actual compression ratio - * 6. set mode based on compression ratio - * - * The remaining code is much simpler - it just sets options - * based on the mode & compression ratio: - * - * set allow_diff_short based on mode - * select lowpass filter based on compression ratio & mode - * set the bitrate index, and min/max bitrates for VBR modes - * disable VBR tag if it is not appropriate - * initialize the bitstream - * initialize scalefac_band data - * set sideinfo_len (based on channels, CRC, out_samplerate) - * write an id3v2 tag into the bitstream - * write VBR tag into the bitstream - * set mpeg1/2 flag - * estimate the number of frames (based on a lot of data) - * - * now we set more flags: - * nspsytune: - * see code - * VBR modes - * see code - * CBR/ABR - * see code - * - * Finally, we set the algorithm flags based on the gfp->quality value - * lame_init_qval(gfp); - * - ********************************************************************/ -int -lame_init_params(lame_global_flags * gfp) -{ - - int i; - int j; - lame_internal_flags *const gfc = gfp->internal_flags; - SessionConfig_t *const cfg = &gfc->cfg; - - gfc->class_id = 0; - - cfg->enforce_min_bitrate = gfp->VBR_hard_min; - cfg->analysis = gfp->analysis; - if (cfg->analysis) - gfp->write_lame_tag = 0; - - /* some file options not allowed if output is: not specified or stdout */ - if (gfc->pinfo != NULL) - gfp->write_lame_tag = 0; /* disable Xing VBR tag */ - - /* report functions */ - gfc->report_msg = gfp->report.msgf; - gfc->report_dbg = gfp->report.debugf; - gfc->report_err = gfp->report.errorf; - - if (gfp->asm_optimizations.amd3dnow) - gfc->CPU_features.AMD_3DNow = has_3DNow(); - else - gfc->CPU_features.AMD_3DNow = 0; - - if (gfp->asm_optimizations.mmx) - gfc->CPU_features.MMX = has_MMX(); - else - gfc->CPU_features.MMX = 0; - - if (gfp->asm_optimizations.sse) { - gfc->CPU_features.SSE = has_SSE(); - gfc->CPU_features.SSE2 = has_SSE2(); - } - else { - gfc->CPU_features.SSE = 0; - gfc->CPU_features.SSE2 = 0; - } - - - if (NULL == gfc->ATH) - gfc->ATH = calloc(1, sizeof(ATH_t)); - - if (NULL == gfc->ATH) - return -2; /* maybe error codes should be enumerated in lame.h ?? */ - - if (NULL == gfc->sv_rpg.rgdata) - gfc->sv_rpg.rgdata = calloc(1, sizeof(replaygain_t)); - if (NULL == gfc->sv_rpg.rgdata) { - freegfc(gfc); - gfp->internal_flags = NULL; - return -2; - } - - cfg->error_protection = gfp->error_protection; - cfg->copyright = gfp->copyright; - cfg->original = gfp->original; - cfg->extension = gfp->extension; - cfg->emphasis = gfp->emphasis; - - cfg->channels_in = gfp->num_channels; - if (cfg->channels_in == 1) - gfp->mode = MONO; - cfg->channels_out = (gfp->mode == MONO) ? 1 : 2; - if (gfp->mode == MONO) - gfp->force_ms = 0; /* don't allow forced mid/side stereo for mono output */ - cfg->force_ms = gfp->force_ms; - - if (gfp->VBR == vbr_off && gfp->VBR_mean_bitrate_kbps != 128 && gfp->brate == 0) - gfp->brate = gfp->VBR_mean_bitrate_kbps; - - switch (gfp->VBR) { - case vbr_off: - case vbr_mtrh: - case vbr_mt: - /* these modes can handle free format condition */ - break; - default: - gfp->free_format = 0; /* mode can't be mixed with free format */ - break; - } - - cfg->free_format = gfp->free_format; - - if (gfp->VBR == vbr_off && gfp->brate == 0) { - /* no bitrate or compression ratio specified, use 11.025 */ - if (EQ(gfp->compression_ratio, 0)) - gfp->compression_ratio = 11.025; /* rate to compress a CD down to exactly 128000 bps */ - } - - /* find bitrate if user specify a compression ratio */ - if (gfp->VBR == vbr_off && gfp->compression_ratio > 0) { - - if (gfp->samplerate_out == 0) - gfp->samplerate_out = map2MP3Frequency((int) (0.97 * gfp->samplerate_in)); /* round up with a margin of 3% */ - - /* choose a bitrate for the output samplerate which achieves - * specified compression ratio - */ - gfp->brate = gfp->samplerate_out * 16 * cfg->channels_out / (1.e3 * gfp->compression_ratio); - - /* we need the version for the bitrate table look up */ - cfg->samplerate_index = SmpFrqIndex(gfp->samplerate_out, &cfg->version); - - if (!cfg->free_format) /* for non Free Format find the nearest allowed bitrate */ - gfp->brate = FindNearestBitrate(gfp->brate, cfg->version, gfp->samplerate_out); - } - if (gfp->samplerate_out) { - if (gfp->samplerate_out < 16000) { - gfp->VBR_mean_bitrate_kbps = Max(gfp->VBR_mean_bitrate_kbps, 8); - gfp->VBR_mean_bitrate_kbps = Min(gfp->VBR_mean_bitrate_kbps, 64); - } - else if (gfp->samplerate_out < 32000) { - gfp->VBR_mean_bitrate_kbps = Max(gfp->VBR_mean_bitrate_kbps, 8); - gfp->VBR_mean_bitrate_kbps = Min(gfp->VBR_mean_bitrate_kbps, 160); - } - else { - gfp->VBR_mean_bitrate_kbps = Max(gfp->VBR_mean_bitrate_kbps, 32); - gfp->VBR_mean_bitrate_kbps = Min(gfp->VBR_mean_bitrate_kbps, 320); - } - } - /* WORK IN PROGRESS */ - /* mapping VBR scale to internal VBR quality settings */ - if (gfp->samplerate_out == 0 && (gfp->VBR == vbr_mt || gfp->VBR == vbr_mtrh)) { - float const qval = gfp->VBR_q + gfp->VBR_q_frac; - struct q_map { int sr_a; float qa, qb, ta, tb; int lp; }; - static struct q_map const m[9] - = { {48000, 0.0,6.5, 0.0,6.5, 23700} - , {44100, 0.0,6.5, 0.0,6.5, 21780} - , {32000, 6.5,8.0, 5.2,6.5, 15800} - , {24000, 8.0,8.5, 5.2,6.0, 11850} - , {22050, 8.5,9.01, 5.2,6.5, 10892} - , {16000, 9.01,9.4, 4.9,6.5, 7903} - , {12000, 9.4,9.6, 4.5,6.0, 5928} - , {11025, 9.6,9.9, 5.1,6.5, 5446} - , { 8000, 9.9,10., 4.9,6.5, 3952} - }; - for (i = 2; i < 9; ++i) { - if (gfp->samplerate_in == m[i].sr_a) { - if (qval < m[i].qa) { - double d = qval / m[i].qa; - d = d * m[i].ta; - gfp->VBR_q = (int)d; - gfp->VBR_q_frac = d - gfp->VBR_q; - } - } - if (gfp->samplerate_in >= m[i].sr_a) { - if (m[i].qa <= qval && qval < m[i].qb) { - float const q_ = m[i].qb-m[i].qa; - float const t_ = m[i].tb-m[i].ta; - double d = m[i].ta + t_ * (qval-m[i].qa) / q_; - gfp->VBR_q = (int)d; - gfp->VBR_q_frac = d - gfp->VBR_q; - gfp->samplerate_out = m[i].sr_a; - if (gfp->lowpassfreq == 0) { - gfp->lowpassfreq = -1; - } - break; - } - } - } - } - - /****************************************************************/ - /* if a filter has not been enabled, see if we should add one: */ - /****************************************************************/ - if (gfp->lowpassfreq == 0) { - double lowpass = 16000; - double highpass; - - switch (gfp->VBR) { - case vbr_off:{ - optimum_bandwidth(&lowpass, &highpass, gfp->brate); - break; - } - case vbr_abr:{ - optimum_bandwidth(&lowpass, &highpass, gfp->VBR_mean_bitrate_kbps); - break; - } - case vbr_rh:{ - int const x[11] = { - 19500, 19000, 18600, 18000, 17500, 16000, 15600, 14900, 12500, 10000, 3950 - }; - if (0 <= gfp->VBR_q && gfp->VBR_q <= 9) { - double a = x[gfp->VBR_q], b = x[gfp->VBR_q + 1], m = gfp->VBR_q_frac; - lowpass = linear_int(a, b, m); - } - else { - lowpass = 19500; - } - break; - } - case vbr_mtrh: - case vbr_mt:{ - int const x[11] = { - 24000, 19500, 18500, 18000, 17500, 17000, 16500, 15600, 15200, 7230, 3950 - }; - if (0 <= gfp->VBR_q && gfp->VBR_q <= 9) { - double a = x[gfp->VBR_q], b = x[gfp->VBR_q + 1], m = gfp->VBR_q_frac; - lowpass = linear_int(a, b, m); - } - else { - lowpass = 21500; - } - break; - } - default:{ - int const x[11] = { - 19500, 19000, 18500, 18000, 17500, 16500, 15500, 14500, 12500, 9500, 3950 - }; - if (0 <= gfp->VBR_q && gfp->VBR_q <= 9) { - double a = x[gfp->VBR_q], b = x[gfp->VBR_q + 1], m = gfp->VBR_q_frac; - lowpass = linear_int(a, b, m); - } - else { - lowpass = 19500; - } - } - } - - if (gfp->mode == MONO && (gfp->VBR == vbr_off || gfp->VBR == vbr_abr)) - lowpass *= 1.5; - - gfp->lowpassfreq = lowpass; - } - - if (gfp->samplerate_out == 0) { - if (2 * gfp->lowpassfreq > gfp->samplerate_in) { - gfp->lowpassfreq = gfp->samplerate_in / 2; - } - gfp->samplerate_out = optimum_samplefreq((int) gfp->lowpassfreq, gfp->samplerate_in); - } - if (gfp->VBR == vbr_mt || gfp->VBR == vbr_mtrh) { - gfp->lowpassfreq = Min(24000, gfp->lowpassfreq); - } - else { - gfp->lowpassfreq = Min(20500, gfp->lowpassfreq); - } - gfp->lowpassfreq = Min(gfp->samplerate_out / 2, gfp->lowpassfreq); - - if (gfp->VBR == vbr_off) { - gfp->compression_ratio = gfp->samplerate_out * 16 * cfg->channels_out / (1.e3 * gfp->brate); - } - if (gfp->VBR == vbr_abr) { - gfp->compression_ratio = - gfp->samplerate_out * 16 * cfg->channels_out / (1.e3 * gfp->VBR_mean_bitrate_kbps); - } - - /* do not compute ReplayGain values and do not find the peak sample - if we can't store them */ - if (!gfp->write_lame_tag) { - gfp->findReplayGain = 0; - gfp->decode_on_the_fly = 0; - cfg->findPeakSample = 0; - } - - cfg->findReplayGain = gfp->findReplayGain; - cfg->decode_on_the_fly = gfp->decode_on_the_fly; - - if (cfg->decode_on_the_fly) - cfg->findPeakSample = 1; - - if (cfg->findReplayGain) { - if (InitGainAnalysis(gfc->sv_rpg.rgdata, gfp->samplerate_out) == INIT_GAIN_ANALYSIS_ERROR) { - freegfc(gfc); - gfp->internal_flags = NULL; - return -6; - } - } - -#ifdef DECODE_ON_THE_FLY - if (cfg->decode_on_the_fly && !gfp->decode_only) { - if (gfc->hip) { - hip_decode_exit(gfc->hip); - } - gfc->hip = hip_decode_init(); - /* report functions */ - hip_set_errorf(gfc->hip, gfp->report.errorf); - hip_set_debugf(gfc->hip, gfp->report.debugf); - hip_set_msgf(gfc->hip, gfp->report.msgf); - } -#endif - - cfg->disable_reservoir = gfp->disable_reservoir; - cfg->lowpassfreq = gfp->lowpassfreq; - cfg->highpassfreq = gfp->highpassfreq; - cfg->samplerate_in = gfp->samplerate_in; - cfg->samplerate_out = gfp->samplerate_out; - cfg->mode_gr = cfg->samplerate_out <= 24000 ? 1 : 2; /* Number of granules per frame */ - gfc->ov_enc.encoder_delay = ENCDELAY; - - - /* - * sample freq bitrate compression ratio - * [kHz] [kbps/channel] for 16 bit input - * 44.1 56 12.6 - * 44.1 64 11.025 - * 44.1 80 8.82 - * 22.05 24 14.7 - * 22.05 32 11.025 - * 22.05 40 8.82 - * 16 16 16.0 - * 16 24 10.667 - * - */ - /* - * For VBR, take a guess at the compression_ratio. - * For example: - * - * VBR_q compression like - * - 4.4 320 kbps/44 kHz - * 0...1 5.5 256 kbps/44 kHz - * 2 7.3 192 kbps/44 kHz - * 4 8.8 160 kbps/44 kHz - * 6 11 128 kbps/44 kHz - * 9 14.7 96 kbps - * - * for lower bitrates, downsample with --resample - */ - - switch (gfp->VBR) { - case vbr_mt: - case vbr_rh: - case vbr_mtrh: - { - /*numbers are a bit strange, but they determine the lowpass value */ - FLOAT const cmp[] = { 5.7, 6.5, 7.3, 8.2, 10, 11.9, 13, 14, 15, 16.5 }; - gfp->compression_ratio = cmp[gfp->VBR_q]; - } - break; - case vbr_abr: - gfp->compression_ratio = - cfg->samplerate_out * 16 * cfg->channels_out / (1.e3 * gfp->VBR_mean_bitrate_kbps); - break; - default: - gfp->compression_ratio = cfg->samplerate_out * 16 * cfg->channels_out / (1.e3 * gfp->brate); - break; - } - - - /* mode = -1 (not set by user) or - * mode = MONO (because of only 1 input channel). - * If mode has not been set, then select J-STEREO - */ - if (gfp->mode == NOT_SET) { - gfp->mode = JOINT_STEREO; - } - - cfg->mode = gfp->mode; - - - /* apply user driven high pass filter */ - if (cfg->highpassfreq > 0) { - cfg->highpass1 = 2. * cfg->highpassfreq; - - if (gfp->highpasswidth >= 0) - cfg->highpass2 = 2. * (cfg->highpassfreq + gfp->highpasswidth); - else /* 0% above on default */ - cfg->highpass2 = (1 + 0.00) * 2. * cfg->highpassfreq; - - cfg->highpass1 /= cfg->samplerate_out; - cfg->highpass2 /= cfg->samplerate_out; - } - else { - cfg->highpass1 = 0; - cfg->highpass2 = 0; - } - /* apply user driven low pass filter */ - cfg->lowpass1 = 0; - cfg->lowpass2 = 0; - if (cfg->lowpassfreq > 0 && cfg->lowpassfreq < (cfg->samplerate_out / 2) ) { - cfg->lowpass2 = 2. * cfg->lowpassfreq; - if (gfp->lowpasswidth >= 0) { - cfg->lowpass1 = 2. * (cfg->lowpassfreq - gfp->lowpasswidth); - if (cfg->lowpass1 < 0) /* has to be >= 0 */ - cfg->lowpass1 = 0; - } - else { /* 0% below on default */ - cfg->lowpass1 = (1 - 0.00) * 2. * cfg->lowpassfreq; - } - cfg->lowpass1 /= cfg->samplerate_out; - cfg->lowpass2 /= cfg->samplerate_out; - } - - - - - /**********************************************************************/ - /* compute info needed for polyphase filter (filter type==0, default) */ - /**********************************************************************/ - lame_init_params_ppflt(gfc); - - - /******************************************************* - * samplerate and bitrate index - *******************************************************/ - cfg->samplerate_index = SmpFrqIndex(cfg->samplerate_out, &cfg->version); - if (cfg->samplerate_index < 0) { - freegfc(gfc); - gfp->internal_flags = NULL; - return -1; - } - - if (gfp->VBR == vbr_off) { - if (cfg->free_format) { - gfc->ov_enc.bitrate_index = 0; - } - else { - gfp->brate = FindNearestBitrate(gfp->brate, cfg->version, cfg->samplerate_out); - gfc->ov_enc.bitrate_index = BitrateIndex(gfp->brate, cfg->version, cfg->samplerate_out); - if (gfc->ov_enc.bitrate_index <= 0) { - freegfc(gfc); - gfp->internal_flags = NULL; - return -1; - } - } - } - else { - gfc->ov_enc.bitrate_index = 1; - } - - init_bit_stream_w(gfc); - - j = cfg->samplerate_index + (3 * cfg->version) + 6 * (cfg->samplerate_out < 16000); - for (i = 0; i < SBMAX_l + 1; i++) - gfc->scalefac_band.l[i] = sfBandIndex[j].l[i]; - - for (i = 0; i < PSFB21 + 1; i++) { - int const size = (gfc->scalefac_band.l[22] - gfc->scalefac_band.l[21]) / PSFB21; - int const start = gfc->scalefac_band.l[21] + i * size; - gfc->scalefac_band.psfb21[i] = start; - } - gfc->scalefac_band.psfb21[PSFB21] = 576; - - for (i = 0; i < SBMAX_s + 1; i++) - gfc->scalefac_band.s[i] = sfBandIndex[j].s[i]; - - for (i = 0; i < PSFB12 + 1; i++) { - int const size = (gfc->scalefac_band.s[13] - gfc->scalefac_band.s[12]) / PSFB12; - int const start = gfc->scalefac_band.s[12] + i * size; - gfc->scalefac_band.psfb12[i] = start; - } - gfc->scalefac_band.psfb12[PSFB12] = 192; - - /* determine the mean bitrate for main data */ - if (cfg->mode_gr == 2) /* MPEG 1 */ - cfg->sideinfo_len = (cfg->channels_out == 1) ? 4 + 17 : 4 + 32; - else /* MPEG 2 */ - cfg->sideinfo_len = (cfg->channels_out == 1) ? 4 + 9 : 4 + 17; - - if (cfg->error_protection) - cfg->sideinfo_len += 2; - - gfc->class_id = LAME_ID; - - { - int k; - - for (k = 0; k < 19; k++) - gfc->sv_enc.pefirbuf[k] = 700 * cfg->mode_gr * cfg->channels_out; - - if (gfp->ATHtype == -1) - gfp->ATHtype = 4; - } - - assert(gfp->VBR_q <= 9); - assert(gfp->VBR_q >= 0); - - switch (gfp->VBR) { - - case vbr_mt: - case vbr_mtrh:{ - if (gfp->strict_ISO < 0) { - gfp->strict_ISO = MDB_MAXIMUM; - } - if (gfp->useTemporal < 0) { - gfp->useTemporal = 0; /* off by default for this VBR mode */ - } - - (void) apply_preset(gfp, 500 - (gfp->VBR_q * 10), 0); - /* The newer VBR code supports only a limited - subset of quality levels: - 9-5=5 are the same, uses x^3/4 quantization - 4-0=0 are the same 5 plus best huffman divide code - */ - if (gfp->quality < 0) - gfp->quality = LAME_DEFAULT_QUALITY; - if (gfp->quality < 5) - gfp->quality = 0; - if (gfp->quality > 7) - gfp->quality = 7; - - /* sfb21 extra only with MPEG-1 at higher sampling rates - */ - if (gfp->experimentalY) - gfc->sv_qnt.sfb21_extra = 0; - else - gfc->sv_qnt.sfb21_extra = (cfg->samplerate_out > 44000); - - gfc->iteration_loop = VBR_new_iteration_loop; - break; - - } - case vbr_rh:{ - - (void) apply_preset(gfp, 500 - (gfp->VBR_q * 10), 0); - - /* sfb21 extra only with MPEG-1 at higher sampling rates - */ - if (gfp->experimentalY) - gfc->sv_qnt.sfb21_extra = 0; - else - gfc->sv_qnt.sfb21_extra = (cfg->samplerate_out > 44000); - - /* VBR needs at least the output of GPSYCHO, - * so we have to garantee that by setting a minimum - * quality level, actually level 6 does it. - * down to level 6 - */ - if (gfp->quality > 6) - gfp->quality = 6; - - - if (gfp->quality < 0) - gfp->quality = LAME_DEFAULT_QUALITY; - - gfc->iteration_loop = VBR_old_iteration_loop; - break; - } - - default: /* cbr/abr */ { - vbr_mode vbrmode; - - /* no sfb21 extra with CBR code - */ - gfc->sv_qnt.sfb21_extra = 0; - - if (gfp->quality < 0) - gfp->quality = LAME_DEFAULT_QUALITY; - - - vbrmode = gfp->VBR; - if (vbrmode == vbr_off) - (void) lame_set_VBR_mean_bitrate_kbps(gfp, gfp->brate); - /* second, set parameters depending on bitrate */ - (void) apply_preset(gfp, gfp->VBR_mean_bitrate_kbps, 0); - gfp->VBR = vbrmode; - - if (vbrmode == vbr_off) { - gfc->iteration_loop = CBR_iteration_loop; - } - else { - gfc->iteration_loop = ABR_iteration_loop; - } - break; - } - } - - /*initialize default values common for all modes */ - - gfc->sv_qnt.mask_adjust = gfp->maskingadjust; - gfc->sv_qnt.mask_adjust_short = gfp->maskingadjust_short; - - /* just another daily changing developer switch */ - if (gfp->tune) { - gfc->sv_qnt.mask_adjust += gfp->tune_value_a; - gfc->sv_qnt.mask_adjust_short += gfp->tune_value_a; - } - - - if (gfp->VBR != vbr_off) { /* choose a min/max bitrate for VBR */ - /* if the user didn't specify VBR_max_bitrate: */ - cfg->vbr_min_bitrate_index = 1; /* default: allow 8 kbps (MPEG-2) or 32 kbps (MPEG-1) */ - cfg->vbr_max_bitrate_index = 14; /* default: allow 160 kbps (MPEG-2) or 320 kbps (MPEG-1) */ - if (cfg->samplerate_out < 16000) - cfg->vbr_max_bitrate_index = 8; /* default: allow 64 kbps (MPEG-2.5) */ - if (gfp->VBR_min_bitrate_kbps) { - gfp->VBR_min_bitrate_kbps = - FindNearestBitrate(gfp->VBR_min_bitrate_kbps, cfg->version, cfg->samplerate_out); - cfg->vbr_min_bitrate_index = - BitrateIndex(gfp->VBR_min_bitrate_kbps, cfg->version, cfg->samplerate_out); - if (cfg->vbr_min_bitrate_index < 0) - return -1; - } - if (gfp->VBR_max_bitrate_kbps) { - gfp->VBR_max_bitrate_kbps = - FindNearestBitrate(gfp->VBR_max_bitrate_kbps, cfg->version, cfg->samplerate_out); - cfg->vbr_max_bitrate_index = - BitrateIndex(gfp->VBR_max_bitrate_kbps, cfg->version, cfg->samplerate_out); - if (cfg->vbr_max_bitrate_index < 0) - return -1; - } - gfp->VBR_min_bitrate_kbps = bitrate_table[cfg->version][cfg->vbr_min_bitrate_index]; - gfp->VBR_max_bitrate_kbps = bitrate_table[cfg->version][cfg->vbr_max_bitrate_index]; - gfp->VBR_mean_bitrate_kbps = - Min(bitrate_table[cfg->version][cfg->vbr_max_bitrate_index], - gfp->VBR_mean_bitrate_kbps); - gfp->VBR_mean_bitrate_kbps = - Max(bitrate_table[cfg->version][cfg->vbr_min_bitrate_index], - gfp->VBR_mean_bitrate_kbps); - } - - cfg->preset = gfp->preset; - cfg->write_lame_tag = gfp->write_lame_tag; - cfg->vbr = gfp->VBR; - gfc->sv_qnt.substep_shaping = gfp->substep_shaping; - cfg->noise_shaping = gfp->noise_shaping; - cfg->subblock_gain = gfp->subblock_gain; - cfg->use_best_huffman = gfp->use_best_huffman; - cfg->avg_bitrate = gfp->brate; - cfg->vbr_avg_bitrate_kbps = gfp->VBR_mean_bitrate_kbps; - cfg->compression_ratio = gfp->compression_ratio; - - /* initialize internal qval settings */ - lame_init_qval(gfp); - - - /* automatic ATH adjustment on - */ - if (gfp->athaa_type < 0) - gfc->ATH->use_adjust = 3; - else - gfc->ATH->use_adjust = gfp->athaa_type; - - - /* initialize internal adaptive ATH settings -jd */ - gfc->ATH->aa_sensitivity_p = pow(10.0, gfp->athaa_sensitivity / -10.0); - - - if (gfp->short_blocks == short_block_not_set) { - gfp->short_blocks = short_block_allowed; - } - - /*Note Jan/2003: Many hardware decoders cannot handle short blocks in regular - stereo mode unless they are coupled (same type in both channels) - it is a rare event (1 frame per min. or so) that LAME would use - uncoupled short blocks, so lets turn them off until we decide - how to handle this. No other encoders allow uncoupled short blocks, - even though it is in the standard. */ - /* rh 20040217: coupling makes no sense for mono and dual-mono streams - */ - if (gfp->short_blocks == short_block_allowed - && (cfg->mode == JOINT_STEREO || cfg->mode == STEREO)) { - gfp->short_blocks = short_block_coupled; - } - - cfg->short_blocks = gfp->short_blocks; - - - if (lame_get_quant_comp(gfp) < 0) - (void) lame_set_quant_comp(gfp, 1); - if (lame_get_quant_comp_short(gfp) < 0) - (void) lame_set_quant_comp_short(gfp, 0); - - if (lame_get_msfix(gfp) < 0) - lame_set_msfix(gfp, 0); - - /* select psychoacoustic model */ - (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 1); - - if (gfp->ATHtype < 0) - gfp->ATHtype = 4; - - if (gfp->ATHcurve < 0) - gfp->ATHcurve = 4; - - if (gfp->interChRatio < 0) - gfp->interChRatio = 0; - - if (gfp->useTemporal < 0) - gfp->useTemporal = 1; /* on by default */ - - - cfg->interChRatio = gfp->interChRatio; - cfg->msfix = gfp->msfix; - cfg->ATH_offset_db = 0-gfp->ATH_lower_db; - cfg->ATH_offset_factor = powf(10.f, cfg->ATH_offset_db * 0.1f); - cfg->ATHcurve = gfp->ATHcurve; - cfg->ATHtype = gfp->ATHtype; - cfg->ATHonly = gfp->ATHonly; - cfg->ATHshort = gfp->ATHshort; - cfg->noATH = gfp->noATH; - - cfg->quant_comp = gfp->quant_comp; - cfg->quant_comp_short = gfp->quant_comp_short; - - cfg->use_temporal_masking_effect = gfp->useTemporal; - cfg->use_safe_joint_stereo = gfp->exp_nspsytune & 2; - { - cfg->adjust_bass_db = (gfp->exp_nspsytune >> 2) & 63; - if (cfg->adjust_bass_db >= 32.f) - cfg->adjust_bass_db -= 64.f; - cfg->adjust_bass_db *= 0.25f; - - cfg->adjust_alto_db = (gfp->exp_nspsytune >> 8) & 63; - if (cfg->adjust_alto_db >= 32.f) - cfg->adjust_alto_db -= 64.f; - cfg->adjust_alto_db *= 0.25f; - - cfg->adjust_treble_db = (gfp->exp_nspsytune >> 14) & 63; - if (cfg->adjust_treble_db >= 32.f) - cfg->adjust_treble_db -= 64.f; - cfg->adjust_treble_db *= 0.25f; - - /* to be compatible with Naoki's original code, the next 6 bits - * define only the amount of changing treble for sfb21 */ - cfg->adjust_sfb21_db = (gfp->exp_nspsytune >> 20) & 63; - if (cfg->adjust_sfb21_db >= 32.f) - cfg->adjust_sfb21_db -= 64.f; - cfg->adjust_sfb21_db *= 0.25f; - cfg->adjust_sfb21_db += cfg->adjust_treble_db; - } - - /* Setting up the PCM input data transform matrix, to apply - * user defined re-scaling, and or two-to-one channel downmix. - */ - { - FLOAT m[2][2] = { {1.0f, 0.0f}, {0.0f, 1.0f} }; - - /* user selected scaling of the samples */ - m[0][0] *= gfp->scale; - m[0][1] *= gfp->scale; - m[1][0] *= gfp->scale; - m[1][1] *= gfp->scale; - /* user selected scaling of the channel 0 (left) samples */ - m[0][0] *= gfp->scale_left; - m[0][1] *= gfp->scale_left; - /* user selected scaling of the channel 1 (right) samples */ - m[1][0] *= gfp->scale_right; - m[1][1] *= gfp->scale_right; - /* Downsample to Mono if 2 channels in and 1 channel out */ - if (cfg->channels_in == 2 && cfg->channels_out == 1) { - m[0][0] = 0.5f * (m[0][0] + m[1][0]); - m[0][1] = 0.5f * (m[0][1] + m[1][1]); - m[1][0] = 0; - m[1][1] = 0; - } - cfg->pcm_transform[0][0] = m[0][0]; - cfg->pcm_transform[0][1] = m[0][1]; - cfg->pcm_transform[1][0] = m[1][0]; - cfg->pcm_transform[1][1] = m[1][1]; - } - - /* padding method as described in - * "MPEG-Layer3 / Bitstream Syntax and Decoding" - * by Martin Sieler, Ralph Sperschneider - * - * note: there is no padding for the very first frame - * - * Robert Hegemann 2000-06-22 - */ - gfc->sv_enc.slot_lag = gfc->sv_enc.frac_SpF = 0; - if (cfg->vbr == vbr_off) - gfc->sv_enc.slot_lag = gfc->sv_enc.frac_SpF - = ((cfg->version + 1) * 72000L * cfg->avg_bitrate) % cfg->samplerate_out; - - (void) lame_init_bitstream(gfp); - - iteration_init(gfc); - (void) psymodel_init(gfp); - - cfg->buffer_constraint = get_max_frame_buffer_size_by_constraint(cfg, gfp->strict_ISO); - return 0; -} - -static void -concatSep(char* dest, char const* sep, char const* str) -{ - if (*dest != 0) strcat(dest, sep); - strcat(dest, str); -} - -/* - * print_config - * - * Prints some selected information about the coding parameters via - * the macro command MSGF(), which is currently mapped to lame_errorf - * (reports via a error function?), which is a printf-like function - * for <stderr>. - */ - -void -lame_print_config(const lame_global_flags * gfp) -{ - lame_internal_flags const *const gfc = gfp->internal_flags; - SessionConfig_t const *const cfg = &gfc->cfg; - double const out_samplerate = cfg->samplerate_out; - double const in_samplerate = cfg->samplerate_in; - - MSGF(gfc, "LAME %s %s (%s)\n", get_lame_version(), get_lame_os_bitness(), get_lame_url()); - -#if (LAME_ALPHA_VERSION) - MSGF(gfc, "warning: alpha versions should be used for testing only\n"); -#endif - if (gfc->CPU_features.MMX - || gfc->CPU_features.AMD_3DNow || gfc->CPU_features.SSE || gfc->CPU_features.SSE2) { - char text[256] = { 0 }; - int fft_asm_used = 0; -#ifdef HAVE_NASM - if (gfc->CPU_features.AMD_3DNow) { - fft_asm_used = 1; - } - else if (gfc->CPU_features.SSE) { - fft_asm_used = 2; - } -#else -# if defined( HAVE_XMMINTRIN_H ) && defined( MIN_ARCH_SSE ) - { - fft_asm_used = 3; - } -# endif -#endif - if (gfc->CPU_features.MMX) { -#ifdef MMX_choose_table - concatSep(text, ", ", "MMX (ASM used)"); -#else - concatSep(text, ", ", "MMX"); -#endif - } - if (gfc->CPU_features.AMD_3DNow) { - concatSep(text, ", ", (fft_asm_used == 1) ? "3DNow! (ASM used)" : "3DNow!"); - } - if (gfc->CPU_features.SSE) { -#if defined(HAVE_XMMINTRIN_H) - concatSep(text, ", ", "SSE (ASM used)"); -#else - concatSep(text, ", ", (fft_asm_used == 2) ? "SSE (ASM used)" : "SSE"); -#endif - } - if (gfc->CPU_features.SSE2) { - concatSep(text, ", ", (fft_asm_used == 3) ? "SSE2 (ASM used)" : "SSE2"); - } - MSGF(gfc, "CPU features: %s\n", text); - } - - if (cfg->channels_in == 2 && cfg->channels_out == 1 /* mono */ ) { - MSGF(gfc, "Autoconverting from stereo to mono. Setting encoding to mono mode.\n"); - } - - if (isResamplingNecessary(cfg)) { - MSGF(gfc, "Resampling: input %g kHz output %g kHz\n", - 1.e-3 * in_samplerate, 1.e-3 * out_samplerate); - } - - if (cfg->highpass2 > 0.) - MSGF(gfc, - "Using polyphase highpass filter, transition band: %5.0f Hz - %5.0f Hz\n", - 0.5 * cfg->highpass1 * out_samplerate, 0.5 * cfg->highpass2 * out_samplerate); - if (0. < cfg->lowpass1 || 0. < cfg->lowpass2) { - MSGF(gfc, - "Using polyphase lowpass filter, transition band: %5.0f Hz - %5.0f Hz\n", - 0.5 * cfg->lowpass1 * out_samplerate, 0.5 * cfg->lowpass2 * out_samplerate); - } - else { - MSGF(gfc, "polyphase lowpass filter disabled\n"); - } - - if (cfg->free_format) { - MSGF(gfc, "Warning: many decoders cannot handle free format bitstreams\n"); - if (cfg->avg_bitrate > 320) { - MSGF(gfc, - "Warning: many decoders cannot handle free format bitrates >320 kbps (see documentation)\n"); - } - } -} - - -/** rh: - * some pretty printing is very welcome at this point! - * so, if someone is willing to do so, please do it! - * add more, if you see more... - */ -void -lame_print_internals(const lame_global_flags * gfp) -{ - lame_internal_flags const *const gfc = gfp->internal_flags; - SessionConfig_t const *const cfg = &gfc->cfg; - const char *pc = ""; - - /* compiler/processor optimizations, operational, etc. - */ - MSGF(gfc, "\nmisc:\n\n"); - - MSGF(gfc, "\tscaling: %g\n", gfp->scale); - MSGF(gfc, "\tch0 (left) scaling: %g\n", gfp->scale_left); - MSGF(gfc, "\tch1 (right) scaling: %g\n", gfp->scale_right); - switch (cfg->use_best_huffman) { - default: - pc = "normal"; - break; - case 1: - pc = "best (outside loop)"; - break; - case 2: - pc = "best (inside loop, slow)"; - break; - } - MSGF(gfc, "\thuffman search: %s\n", pc); - MSGF(gfc, "\texperimental Y=%d\n", gfp->experimentalY); - MSGF(gfc, "\t...\n"); - - /* everything controlling the stream format - */ - MSGF(gfc, "\nstream format:\n\n"); - switch (cfg->version) { - case 0: - pc = "2.5"; - break; - case 1: - pc = "1"; - break; - case 2: - pc = "2"; - break; - default: - pc = "?"; - break; - } - MSGF(gfc, "\tMPEG-%s Layer 3\n", pc); - switch (cfg->mode) { - case JOINT_STEREO: - pc = "joint stereo"; - break; - case STEREO: - pc = "stereo"; - break; - case DUAL_CHANNEL: - pc = "dual channel"; - break; - case MONO: - pc = "mono"; - break; - case NOT_SET: - pc = "not set (error)"; - break; - default: - pc = "unknown (error)"; - break; - } - MSGF(gfc, "\t%d channel - %s\n", cfg->channels_out, pc); - - switch (cfg->vbr) { - case vbr_off: - pc = "off"; - break; - default: - pc = "all"; - break; - } - MSGF(gfc, "\tpadding: %s\n", pc); - - if (vbr_default == cfg->vbr) - pc = "(default)"; - else if (cfg->free_format) - pc = "(free format)"; - else - pc = ""; - switch (cfg->vbr) { - case vbr_off: - MSGF(gfc, "\tconstant bitrate - CBR %s\n", pc); - break; - case vbr_abr: - MSGF(gfc, "\tvariable bitrate - ABR %s\n", pc); - break; - case vbr_rh: - MSGF(gfc, "\tvariable bitrate - VBR rh %s\n", pc); - break; - case vbr_mt: - MSGF(gfc, "\tvariable bitrate - VBR mt %s\n", pc); - break; - case vbr_mtrh: - MSGF(gfc, "\tvariable bitrate - VBR mtrh %s\n", pc); - break; - default: - MSGF(gfc, "\t ?? oops, some new one ?? \n"); - break; - } - if (cfg->write_lame_tag) - MSGF(gfc, "\tusing LAME Tag\n"); - MSGF(gfc, "\t...\n"); - - /* everything controlling psychoacoustic settings, like ATH, etc. - */ - MSGF(gfc, "\npsychoacoustic:\n\n"); - - switch (cfg->short_blocks) { - default: - case short_block_not_set: - pc = "?"; - break; - case short_block_allowed: - pc = "allowed"; - break; - case short_block_coupled: - pc = "channel coupled"; - break; - case short_block_dispensed: - pc = "dispensed"; - break; - case short_block_forced: - pc = "forced"; - break; - } - MSGF(gfc, "\tusing short blocks: %s\n", pc); - MSGF(gfc, "\tsubblock gain: %d\n", cfg->subblock_gain); - MSGF(gfc, "\tadjust masking: %g dB\n", gfc->sv_qnt.mask_adjust); - MSGF(gfc, "\tadjust masking short: %g dB\n", gfc->sv_qnt.mask_adjust_short); - MSGF(gfc, "\tquantization comparison: %d\n", cfg->quant_comp); - MSGF(gfc, "\t ^ comparison short blocks: %d\n", cfg->quant_comp_short); - MSGF(gfc, "\tnoise shaping: %d\n", cfg->noise_shaping); - MSGF(gfc, "\t ^ amplification: %d\n", cfg->noise_shaping_amp); - MSGF(gfc, "\t ^ stopping: %d\n", cfg->noise_shaping_stop); - - pc = "using"; - if (cfg->ATHshort) - pc = "the only masking for short blocks"; - if (cfg->ATHonly) - pc = "the only masking"; - if (cfg->noATH) - pc = "not used"; - MSGF(gfc, "\tATH: %s\n", pc); - MSGF(gfc, "\t ^ type: %d\n", cfg->ATHtype); - MSGF(gfc, "\t ^ shape: %g%s\n", cfg->ATHcurve, " (only for type 4)"); - MSGF(gfc, "\t ^ level adjustement: %g dB\n", cfg->ATH_offset_db); - MSGF(gfc, "\t ^ adjust type: %d\n", gfc->ATH->use_adjust); - MSGF(gfc, "\t ^ adjust sensitivity power: %f\n", gfc->ATH->aa_sensitivity_p); - - MSGF(gfc, "\texperimental psy tunings by Naoki Shibata\n"); - MSGF(gfc, "\t adjust masking bass=%g dB, alto=%g dB, treble=%g dB, sfb21=%g dB\n", - 10 * log10(gfc->sv_qnt.longfact[0]), - 10 * log10(gfc->sv_qnt.longfact[7]), - 10 * log10(gfc->sv_qnt.longfact[14]), 10 * log10(gfc->sv_qnt.longfact[21])); - - pc = cfg->use_temporal_masking_effect ? "yes" : "no"; - MSGF(gfc, "\tusing temporal masking effect: %s\n", pc); - MSGF(gfc, "\tinterchannel masking ratio: %g\n", cfg->interChRatio); - MSGF(gfc, "\t...\n"); - - /* that's all ? - */ - MSGF(gfc, "\n"); - return; -} - - -static void -save_gain_values(lame_internal_flags * gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - RpgStateVar_t const *const rsv = &gfc->sv_rpg; - RpgResult_t *const rov = &gfc->ov_rpg; - /* save the ReplayGain value */ - if (cfg->findReplayGain) { - FLOAT const RadioGain = (FLOAT) GetTitleGain(rsv->rgdata); - if (NEQ(RadioGain, GAIN_NOT_ENOUGH_SAMPLES)) { - rov->RadioGain = (int) floor(RadioGain * 10.0 + 0.5); /* round to nearest */ - } - else { - rov->RadioGain = 0; - } - } - - /* find the gain and scale change required for no clipping */ - if (cfg->findPeakSample) { - rov->noclipGainChange = (int) ceil(log10(rov->PeakSample / 32767.0) * 20.0 * 10.0); /* round up */ - - if (rov->noclipGainChange > 0) { /* clipping occurs */ - rov->noclipScale = floor((32767.0f / rov->PeakSample) * 100.0f) / 100.0f; /* round down */ - } - else /* no clipping */ - rov->noclipScale = -1.0f; - } -} - - - -static int -update_inbuffer_size(lame_internal_flags * gfc, const int nsamples) -{ - EncStateVar_t *const esv = &gfc->sv_enc; - if (esv->in_buffer_0 == 0 || esv->in_buffer_nsamples < nsamples) { - if (esv->in_buffer_0) { - free(esv->in_buffer_0); - } - if (esv->in_buffer_1) { - free(esv->in_buffer_1); - } - esv->in_buffer_0 = calloc(nsamples, sizeof(sample_t)); - esv->in_buffer_1 = calloc(nsamples, sizeof(sample_t)); - esv->in_buffer_nsamples = nsamples; - } - if (esv->in_buffer_0 == NULL || esv->in_buffer_1 == NULL) { - if (esv->in_buffer_0) { - free(esv->in_buffer_0); - } - if (esv->in_buffer_1) { - free(esv->in_buffer_1); - } - esv->in_buffer_0 = 0; - esv->in_buffer_1 = 0; - esv->in_buffer_nsamples = 0; - ERRORF(gfc, "Error: can't allocate in_buffer buffer\n"); - return -2; - } - return 0; -} - - -static int -calcNeeded(SessionConfig_t const * cfg) -{ - int mf_needed; - int pcm_samples_per_frame = 576 * cfg->mode_gr; - - /* some sanity checks */ -#if ENCDELAY < MDCTDELAY -# error ENCDELAY is less than MDCTDELAY, see encoder.h -#endif -#if FFTOFFSET > BLKSIZE -# error FFTOFFSET is greater than BLKSIZE, see encoder.h -#endif - - mf_needed = BLKSIZE + pcm_samples_per_frame - FFTOFFSET; /* amount needed for FFT */ - /*mf_needed = Max(mf_needed, 286 + 576 * (1 + gfc->mode_gr)); */ - mf_needed = Max(mf_needed, 512 + pcm_samples_per_frame - 32); - - assert(MFSIZE >= mf_needed); - - return mf_needed; -} - - -/* - * THE MAIN LAME ENCODING INTERFACE - * mt 3/00 - * - * input pcm data, output (maybe) mp3 frames. - * This routine handles all buffering, resampling and filtering for you. - * The required mp3buffer_size can be computed from num_samples, - * samplerate and encoding rate, but here is a worst case estimate: - * - * mp3buffer_size in bytes = 1.25*num_samples + 7200 - * - * return code = number of bytes output in mp3buffer. can be 0 - * - * NOTE: this routine uses LAME's internal PCM data representation, - * 'sample_t'. It should not be used by any application. - * applications should use lame_encode_buffer(), - * lame_encode_buffer_float() - * lame_encode_buffer_int() - * etc... depending on what type of data they are working with. -*/ -/* DEBUG ME:::::::::::: THIS CODE IS CAUSING STACK AND MEMORY CORRUPTION WHEN COMPILED WITH WATCOM C/C++ - * I HAVE SO FAR TRACED IT DOWN TO THIS FUNCTION CALL, SOMEWHERE BETWEEN fill_buffer - * AND lame_encode() CALLS. YOU KNOW IT HAPPENS WHEN DOSBox COMPLAINS ABOUT ILLEGAL - * MEMORY REFERENCES */ -static int -lame_encode_buffer_sample_t(lame_internal_flags * gfc, - int nsamples, unsigned char *mp3buf, const int mp3buf_size) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - int pcm_samples_per_frame = 576 * cfg->mode_gr; - int mp3size = 0, ret, i, ch, mf_needed; - int mp3out; - sample_t *mfbuf[2]; - sample_t *in_buffer[2]; - - esv->canary = 0x1234; - - if (gfc->class_id != LAME_ID) - return -3; - - if (nsamples == 0) - return 0; - - /* copy out any tags that may have been written into bitstream */ - mp3out = copy_buffer(gfc, mp3buf, mp3buf_size, 0); - if (mp3out < 0) - return mp3out; /* not enough buffer space */ - mp3buf += mp3out; - mp3size += mp3out; - - in_buffer[0] = esv->in_buffer_0; - in_buffer[1] = esv->in_buffer_1; - - mf_needed = calcNeeded(cfg); - - mfbuf[0] = esv->mfbuf[0]; - mfbuf[1] = esv->mfbuf[1]; -#if 0 - fprintf(stderr,"gfc %p esv %p mf %p-%p %p-%p\n",gfc,esv,mfbuf[0],&(esv->mfbuf[0]),mfbuf[1],&(esv->mfbuf[1])); -#endif - - while (nsamples > 0) { - sample_t const *in_buffer_ptr[2]; - int n_in = 0; /* number of input samples processed with fill_buffer */ - int n_out = 0; /* number of samples output with fill_buffer */ - /* n_in <> n_out if we are resampling */ - - in_buffer_ptr[0] = in_buffer[0]; - in_buffer_ptr[1] = in_buffer[1]; - /* copy in new samples into mfbuf, with resampling */ - fill_buffer(gfc, mfbuf, &in_buffer_ptr[0], nsamples, &n_in, &n_out); - -#if 0 - /* DEBUG */ - fprintf(stderr,"rem=%d in=%d out=%d mf_size=%d(0x%X) mf_need=%d mf_enc=%d sz=%d MFSIZE=%d\n",nsamples,n_in,n_out,esv->mf_size,esv->mf_size,mf_needed,esv->mf_samples_to_encode,esv->in_buffer_nsamples,MFSIZE); - fprintf(stderr," %p!=%p %p!=%p\n",esv->mfbuf[0],mfbuf[0],esv->mfbuf[1],mfbuf[1]); - if (esv->canary != 0x1234) { - fprintf(stderr,"Canary died, mfbuf[] overrun\n"); - abort(); - } - getch(); -#endif - - assert(esv->mf_size >= 0); - assert(esv->mf_size <= MFSIZE); - assert(n_in <= esv->in_buffer_nsamples); - assert(n_out >= 0); - assert(n_in >= 0); - - /* compute ReplayGain of resampled input if requested */ - if (cfg->findReplayGain && !cfg->decode_on_the_fly) - if (AnalyzeSamples - (gfc->sv_rpg.rgdata, &mfbuf[0][esv->mf_size], &mfbuf[1][esv->mf_size], n_out, - cfg->channels_out) == GAIN_ANALYSIS_ERROR) - return -6; - - - /* update in_buffer counters */ - nsamples -= n_in; - in_buffer[0] += n_in; - if (cfg->channels_out == 2) - in_buffer[1] += n_in; - - assert(in_buffer[0] >= esv->in_buffer_0 && in_buffer[0] <= (esv->in_buffer_0 + esv->in_buffer_nsamples)); - if (in_buffer[1] != NULL) - assert(in_buffer[1] >= esv->in_buffer_1 && in_buffer[1] <= (esv->in_buffer_1 + esv->in_buffer_nsamples)); - - /* update mfbuf[] counters */ - esv->mf_size += n_out; - assert(esv->mf_size >= 0); - assert(esv->mf_size <= MFSIZE); - - /* lame_encode_flush may have set gfc->mf_sample_to_encode to 0 - * so we have to reinitialize it here when that happened. - */ - if (esv->mf_samples_to_encode < 1) { - esv->mf_samples_to_encode = ENCDELAY + POSTDELAY; - } - esv->mf_samples_to_encode += n_out; - - if (esv->mf_size >= mf_needed) { - /* encode the frame. */ - /* mp3buf = pointer to current location in buffer */ - /* mp3buf_size = size of original mp3 output buffer */ - /* = 0 if we should not worry about the */ - /* buffer size because calling program is */ - /* to lazy to compute it */ - /* mp3size = size of data written to buffer so far */ - /* mp3buf_size-mp3size = amount of space avalable */ - - int buf_size = mp3buf_size - mp3size; - if (mp3buf_size == 0) - buf_size = 0; - - ret = lame_encode_mp3_frame(gfc, mfbuf[0], mfbuf[1], mp3buf, buf_size); - - if (ret < 0) - return ret; - mp3buf += ret; - mp3size += ret; - - /* shift out old samples */ - esv->mf_size -= pcm_samples_per_frame; - esv->mf_samples_to_encode -= pcm_samples_per_frame; - for (ch = 0; ch < cfg->channels_out; ch++) - for (i = 0; i < esv->mf_size; i++) - mfbuf[ch][i] = mfbuf[ch][i + pcm_samples_per_frame]; - } - } - assert(nsamples == 0); - - return mp3size; -} - -enum PCMSampleType -{ pcm_short_type -, pcm_int_type -, pcm_long_type -, pcm_float_type -, pcm_double_type -}; - -static void -lame_copy_inbuffer(lame_internal_flags* gfc, - void const* l, void const* r, int nsamples, - enum PCMSampleType pcm_type, int jump, FLOAT s) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - sample_t* ib0 = esv->in_buffer_0; - sample_t* ib1 = esv->in_buffer_1; - FLOAT m[2][2]; - - /* Apply user defined re-scaling */ - m[0][0] = s * cfg->pcm_transform[0][0]; - m[0][1] = s * cfg->pcm_transform[0][1]; - m[1][0] = s * cfg->pcm_transform[1][0]; - m[1][1] = s * cfg->pcm_transform[1][1]; - - /* make a copy of input buffer, changing type to sample_t */ -#define COPY_AND_TRANSFORM(T) \ -{ \ - T const *bl = l, *br = r; \ - int i; \ - for (i = 0; i < nsamples; i++) { \ - sample_t const xl = *bl; \ - sample_t const xr = *br; \ - sample_t const u = xl * m[0][0] + xr * m[0][1]; \ - sample_t const v = xl * m[1][0] + xr * m[1][1]; \ - ib0[i] = u; \ - ib1[i] = v; \ - bl += jump; \ - br += jump; \ - } \ -} - switch ( pcm_type ) { - case pcm_short_type: - COPY_AND_TRANSFORM(short int); - break; - case pcm_int_type: - COPY_AND_TRANSFORM(int); - break; - case pcm_long_type: - COPY_AND_TRANSFORM(long int); - break; - case pcm_float_type: - COPY_AND_TRANSFORM(float); - break; - case pcm_double_type: - COPY_AND_TRANSFORM(double); - break; - } -} - - -static int -lame_encode_buffer_template(lame_global_flags * gfp, - void const* buffer_l, void const* buffer_r, const int nsamples, - unsigned char *mp3buf, const int mp3buf_size, enum PCMSampleType pcm_type, int aa, FLOAT norm) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - SessionConfig_t const *const cfg = &gfc->cfg; - - if (nsamples == 0) - return 0; - - if (update_inbuffer_size(gfc, nsamples) != 0) { - return -2; - } - /* make a copy of input buffer, changing type to sample_t */ - if (cfg->channels_in > 1) { - if (buffer_l == 0 || buffer_r == 0) { - return 0; - } - lame_copy_inbuffer(gfc, buffer_l, buffer_r, nsamples, pcm_type, aa, norm); - } - else { - if (buffer_l == 0) { - return 0; - } - lame_copy_inbuffer(gfc, buffer_l, buffer_l, nsamples, pcm_type, aa, norm); - } - - return lame_encode_buffer_sample_t(gfc, nsamples, mp3buf, mp3buf_size); - } - } - return -3; -} - -int -lame_encode_buffer(lame_global_flags * gfp, - const short int pcm_l[], const short int pcm_r[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - return lame_encode_buffer_template(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_short_type, 1, 1.0); -} - - -int -lame_encode_buffer_float(lame_global_flags * gfp, - const float pcm_l[], const float pcm_r[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- 32768 for full scale */ - return lame_encode_buffer_template(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_float_type, 1, 1.0); -} - - -int -lame_encode_buffer_ieee_float(lame_t gfp, - const float pcm_l[], const float pcm_r[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- 1.0 for full scale */ - return lame_encode_buffer_template(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_float_type, 1, 32767.0); -} - - -int -lame_encode_buffer_interleaved_ieee_float(lame_t gfp, - const float pcm[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- 1.0 for full scale */ - return lame_encode_buffer_template(gfp, pcm, pcm+1, nsamples, mp3buf, mp3buf_size, pcm_float_type, 2, 32767.0); -} - - -int -lame_encode_buffer_ieee_double(lame_t gfp, - const double pcm_l[], const double pcm_r[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- 1.0 for full scale */ - return lame_encode_buffer_template(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_double_type, 1, 32767.0); -} - - -int -lame_encode_buffer_interleaved_ieee_double(lame_t gfp, - const double pcm[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- 1.0 for full scale */ - return lame_encode_buffer_template(gfp, pcm, pcm+1, nsamples, mp3buf, mp3buf_size, pcm_double_type, 2, 32767.0); -} - - -int -lame_encode_buffer_int(lame_global_flags * gfp, - const int pcm_l[], const int pcm_r[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- MAX_INT for full scale */ - FLOAT const norm = (1.0 / (1L << (8 * sizeof(int) - 16))); - return lame_encode_buffer_template(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_int_type, 1, norm); -} - - -int -lame_encode_buffer_long2(lame_global_flags * gfp, - const long pcm_l[], const long pcm_r[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- MAX_LONG for full scale */ - FLOAT const norm = (1.0 / (1L << (8 * sizeof(long) - 16))); - return lame_encode_buffer_template(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_long_type, 1, norm); -} - - -int -lame_encode_buffer_long(lame_global_flags * gfp, - const long pcm_l[], const long pcm_r[], const int nsamples, - unsigned char *mp3buf, const int mp3buf_size) -{ - /* input is assumed to be normalized to +/- 32768 for full scale */ - return lame_encode_buffer_template(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_long_type, 1, 1.0); -} - - - -int -lame_encode_buffer_interleaved(lame_global_flags * gfp, - short int pcm[], int nsamples, - unsigned char *mp3buf, int mp3buf_size) -{ - /* input is assumed to be normalized to +/- MAX_SHORT for full scale */ - return lame_encode_buffer_template(gfp, pcm, pcm+1, nsamples, mp3buf, mp3buf_size, pcm_short_type, 2, 1.0); -} - - - - -/***************************************************************** - Flush mp3 buffer, pad with ancillary data so last frame is complete. - Reset reservoir size to 0 - but keep all PCM samples and MDCT data in memory - This option is used to break a large file into several mp3 files - that when concatenated together will decode with no gaps - Because we set the reservoir=0, they will also decode seperately - with no errors. -*********************************************************************/ -int -lame_encode_flush_nogap(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size) -{ - int rc = -3; - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - flush_bitstream(gfc); - rc = copy_buffer(gfc, mp3buffer, mp3buffer_size, 1); - save_gain_values(gfc); - } - } - return rc; -} - - -/* called by lame_init_params. You can also call this after flush_nogap - if you want to write new id3v2 and Xing VBR tags into the bitstream */ -int -lame_init_bitstream(lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags *const gfc = gfp->internal_flags; - if (gfc != 0) { - gfc->ov_enc.frame_number = 0; - - if (gfp->write_id3tag_automatic) { - (void) id3tag_write_v2(gfp); - } - /* initialize histogram data optionally used by frontend */ - memset(gfc->ov_enc.bitrate_channelmode_hist, 0, - sizeof(gfc->ov_enc.bitrate_channelmode_hist)); - memset(gfc->ov_enc.bitrate_blocktype_hist, 0, - sizeof(gfc->ov_enc.bitrate_blocktype_hist)); - - gfc->ov_rpg.PeakSample = 0.0; - - /* Write initial VBR Header to bitstream and init VBR data */ - if (gfc->cfg.write_lame_tag) - (void) InitVbrTag(gfp); - - - return 0; - } - } - return -3; -} - - -/*****************************************************************/ -/* flush internal PCM sample buffers, then mp3 buffers */ -/* then write id3 v1 tags into bitstream. */ -/*****************************************************************/ - -int -lame_encode_flush(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size) -{ - lame_internal_flags *gfc; - SessionConfig_t const *cfg; - EncStateVar_t *esv; - short int buffer[2][1152]; - int imp3 = 0, mp3count, mp3buffer_size_remaining; - - /* we always add POSTDELAY=288 padding to make sure granule with real - * data can be complety decoded (because of 50% overlap with next granule */ - int end_padding; - int frames_left; - int samples_to_encode; - int pcm_samples_per_frame; - int mf_needed; - int is_resampling_necessary; - double resample_ratio = 1; - - if (!is_lame_global_flags_valid(gfp)) { - return -3; - } - gfc = gfp->internal_flags; - if (!is_lame_internal_flags_valid(gfc)) { - return -3; - } - cfg = &gfc->cfg; - esv = &gfc->sv_enc; - - /* Was flush already called? */ - if (esv->mf_samples_to_encode < 1) { - return 0; - } - pcm_samples_per_frame = 576 * cfg->mode_gr; - mf_needed = calcNeeded(cfg); - - samples_to_encode = esv->mf_samples_to_encode - POSTDELAY; - - memset(buffer, 0, sizeof(buffer)); - mp3count = 0; - - is_resampling_necessary = isResamplingNecessary(cfg); - if (is_resampling_necessary) { - resample_ratio = (double)cfg->samplerate_in / (double)cfg->samplerate_out; - /* delay due to resampling; needs to be fixed, if resampling code gets changed */ - samples_to_encode += 16. / resample_ratio; - } - end_padding = pcm_samples_per_frame - (samples_to_encode % pcm_samples_per_frame); - if (end_padding < 576) - end_padding += pcm_samples_per_frame; - gfc->ov_enc.encoder_padding = end_padding; - - frames_left = (samples_to_encode + end_padding) / pcm_samples_per_frame; - while (frames_left > 0 && imp3 >= 0) { - int const frame_num = gfc->ov_enc.frame_number; - int bunch = mf_needed - esv->mf_size; - - bunch *= resample_ratio; - if (bunch > 1152) bunch = 1152; - if (bunch < 1) bunch = 1; - - mp3buffer_size_remaining = mp3buffer_size - mp3count; - - /* if user specifed buffer size = 0, dont check size */ - if (mp3buffer_size == 0) - mp3buffer_size_remaining = 0; - - /* send in a frame of 0 padding until all internal sample buffers - * are flushed - */ - imp3 = lame_encode_buffer(gfp, buffer[0], buffer[1], bunch, - mp3buffer, mp3buffer_size_remaining); - - mp3buffer += imp3; - mp3count += imp3; - frames_left -= ((frame_num != gfc->ov_enc.frame_number) ? 1 : 0); - } - /* Set esv->mf_samples_to_encode to 0, so we may detect - * and break loops calling it more than once in a row. - */ - esv->mf_samples_to_encode = 0; - - if (imp3 < 0) { - /* some type of fatal error */ - return imp3; - } - - mp3buffer_size_remaining = mp3buffer_size - mp3count; - /* if user specifed buffer size = 0, dont check size */ - if (mp3buffer_size == 0) - mp3buffer_size_remaining = 0; - - /* mp3 related stuff. bit buffer might still contain some mp3 data */ - flush_bitstream(gfc); - imp3 = copy_buffer(gfc, mp3buffer, mp3buffer_size_remaining, 1); - save_gain_values(gfc); - if (imp3 < 0) { - /* some type of fatal error */ - return imp3; - } - mp3buffer += imp3; - mp3count += imp3; - mp3buffer_size_remaining = mp3buffer_size - mp3count; - /* if user specifed buffer size = 0, dont check size */ - if (mp3buffer_size == 0) - mp3buffer_size_remaining = 0; - - if (gfp->write_id3tag_automatic) { - /* write a id3 tag to the bitstream */ - (void) id3tag_write_v1(gfp); - - imp3 = copy_buffer(gfc, mp3buffer, mp3buffer_size_remaining, 0); - - if (imp3 < 0) { - return imp3; - } - mp3count += imp3; - } -#if 0 - { - int const ed = gfc->ov_enc.encoder_delay; - int const ep = gfc->ov_enc.encoder_padding; - int const ns = (gfc->ov_enc.frame_number * pcm_samples_per_frame) - (ed + ep); - double duration = ns; - duration /= cfg->samplerate_out; - MSGF(gfc, "frames=%d\n", gfc->ov_enc.frame_number); - MSGF(gfc, "pcm_samples_per_frame=%d\n", pcm_samples_per_frame); - MSGF(gfc, "encoder delay=%d\n", ed); - MSGF(gfc, "encoder padding=%d\n", ep); - MSGF(gfc, "sample count=%d (%g)\n", ns, cfg->samplerate_in * duration); - MSGF(gfc, "duration=%g sec\n", duration); - } -#endif - return mp3count; -} - -/*********************************************************************** - * - * lame_close () - * - * frees internal buffers - * - ***********************************************************************/ - -int -lame_close(lame_global_flags * gfp) -{ - int ret = 0; - if (gfp && gfp->class_id == LAME_ID) { - lame_internal_flags *const gfc = gfp->internal_flags; - gfp->class_id = 0; - if (NULL == gfc || gfc->class_id != LAME_ID) { - ret = -3; - } - if (NULL != gfc) { - gfc->class_id = 0; - /* this routine will free all malloc'd data in gfc, and then free gfc: */ - freegfc(gfc); - gfp->internal_flags = NULL; - } - if (gfp->lame_allocated_gfp) { - gfp->lame_allocated_gfp = 0; - free(gfp); - } - } - return ret; -} - -/*****************************************************************/ -/* flush internal mp3 buffers, and free internal buffers */ -/*****************************************************************/ -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -int CDECL -lame_encode_finish(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size); -#else -#endif - -int -lame_encode_finish(lame_global_flags * gfp, unsigned char *mp3buffer, int mp3buffer_size) -{ - int const ret = lame_encode_flush(gfp, mp3buffer, mp3buffer_size); - - (void) lame_close(gfp); - - return ret; -} - -/*****************************************************************/ -/* write VBR Xing header, and ID3 version 1 tag, if asked for */ -/*****************************************************************/ -void lame_mp3_tags_fid(lame_global_flags * gfp, FILE * fpStream); - -void -lame_mp3_tags_fid(lame_global_flags * gfp, FILE * fpStream) -{ - lame_internal_flags *gfc; - SessionConfig_t const *cfg; - if (!is_lame_global_flags_valid(gfp)) { - return; - } - gfc = gfp->internal_flags; - if (!is_lame_internal_flags_valid(gfc)) { - return; - } - cfg = &gfc->cfg; - if (!cfg->write_lame_tag) { - return; - } - /* Write Xing header again */ - if (fpStream && !fseek(fpStream, 0, SEEK_SET)) { - int rc = PutVbrTag(gfp, fpStream); - switch (rc) { - default: - /* OK */ - break; - - case -1: - ERRORF(gfc, "Error: could not update LAME tag.\n"); - break; - - case -2: - ERRORF(gfc, "Error: could not update LAME tag, file not seekable.\n"); - break; - - case -3: - ERRORF(gfc, "Error: could not update LAME tag, file not readable.\n"); - break; - } - } -} - - - -/* initialize mp3 encoder */ -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -static -#else -#endif -int -lame_init_old(lame_global_flags * gfp) -{ - lame_internal_flags *gfc; - SessionConfig_t *cfg; - - disable_FPE(); /* disable floating point exceptions */ - - memset(gfp, 0, sizeof(lame_global_flags)); - - gfp->class_id = LAME_ID; - - if (NULL == (gfc = gfp->internal_flags = calloc(1, sizeof(lame_internal_flags)))) - return -1; - - cfg = &gfc->cfg; - - /* Global flags. set defaults here for non-zero values */ - /* see lame.h for description */ - /* set integer values to -1 to mean that LAME will compute the - * best value, UNLESS the calling program as set it - * (and the value is no longer -1) - */ - gfp->strict_ISO = MDB_MAXIMUM; - - gfp->mode = NOT_SET; - gfp->original = 1; - gfp->samplerate_in = 44100; - gfp->num_channels = 2; - gfp->num_samples = MAX_U_32_NUM; - - gfp->write_lame_tag = 1; - gfp->quality = -1; - gfp->short_blocks = short_block_not_set; - gfp->subblock_gain = -1; - - gfp->lowpassfreq = 0; - gfp->highpassfreq = 0; - gfp->lowpasswidth = -1; - gfp->highpasswidth = -1; - - gfp->VBR = vbr_off; - gfp->VBR_q = 4; - gfp->ATHcurve = -1; - gfp->VBR_mean_bitrate_kbps = 128; - gfp->VBR_min_bitrate_kbps = 0; - gfp->VBR_max_bitrate_kbps = 0; - gfp->VBR_hard_min = 0; - cfg->vbr_min_bitrate_index = 1; /* not 0 ????? */ - cfg->vbr_max_bitrate_index = 13; /* not 14 ????? */ - - gfp->quant_comp = -1; - gfp->quant_comp_short = -1; - - gfp->msfix = -1; - - gfc->sv_qnt.OldValue[0] = 180; - gfc->sv_qnt.OldValue[1] = 180; - gfc->sv_qnt.CurrentStep[0] = 4; - gfc->sv_qnt.CurrentStep[1] = 4; - gfc->sv_qnt.masking_lower = 1; - - gfp->attackthre = -1; - gfp->attackthre_s = -1; - - gfp->scale = 1; - gfp->scale_left = 1; - gfp->scale_right = 1; - - gfp->athaa_type = -1; - gfp->ATHtype = -1; /* default = -1 = set in lame_init_params */ - /* 2 = equal loudness curve */ - gfp->athaa_sensitivity = 0.0; /* no offset */ - gfp->useTemporal = -1; - gfp->interChRatio = -1; - - /* The reason for - * int mf_samples_to_encode = ENCDELAY + POSTDELAY; - * ENCDELAY = internal encoder delay. And then we have to add POSTDELAY=288 - * because of the 50% MDCT overlap. A 576 MDCT granule decodes to - * 1152 samples. To synthesize the 576 samples centered under this granule - * we need the previous granule for the first 288 samples (no problem), and - * the next granule for the next 288 samples (not possible if this is last - * granule). So we need to pad with 288 samples to make sure we can - * encode the 576 samples we are interested in. - */ - gfc->sv_enc.mf_samples_to_encode = ENCDELAY + POSTDELAY; - gfc->ov_enc.encoder_padding = 0; - gfc->sv_enc.mf_size = ENCDELAY - MDCTDELAY; /* we pad input with this many 0's */ - - gfp->findReplayGain = 0; - gfp->decode_on_the_fly = 0; - - gfc->cfg.decode_on_the_fly = 0; - gfc->cfg.findReplayGain = 0; - gfc->cfg.findPeakSample = 0; - - gfc->ov_rpg.RadioGain = 0; - gfc->ov_rpg.noclipGainChange = 0; - gfc->ov_rpg.noclipScale = -1.0; - - gfp->asm_optimizations.mmx = 1; - gfp->asm_optimizations.amd3dnow = 1; - gfp->asm_optimizations.sse = 1; - - gfp->preset = 0; - - gfp->write_id3tag_automatic = 1; - - gfp->report.debugf = &lame_report_def; - gfp->report.errorf = &lame_report_def; - gfp->report.msgf = &lame_report_def; - return 0; -} - - -lame_global_flags * -lame_init(void) -{ - lame_global_flags *gfp; - int ret; - - init_log_table(); - - gfp = calloc(1, sizeof(lame_global_flags)); - if (gfp == NULL) - return NULL; - - ret = lame_init_old(gfp); - if (ret != 0) { - free(gfp); - return NULL; - } - - gfp->lame_allocated_gfp = 1; - return gfp; -} - - -/*********************************************************************** - * - * some simple statistics - * - * Robert Hegemann 2000-10-11 - * - ***********************************************************************/ - -/* histogram of used bitrate indexes: - * One has to weight them to calculate the average bitrate in kbps - * - * bitrate indices: - * there are 14 possible bitrate indices, 0 has the special meaning - * "free format" which is not possible to mix with VBR and 15 is forbidden - * anyway. - * - * stereo modes: - * 0: LR number of left-right encoded frames - * 1: LR-I number of left-right and intensity encoded frames - * 2: MS number of mid-side encoded frames - * 3: MS-I number of mid-side and intensity encoded frames - * - * 4: number of encoded frames - * - */ - -void -lame_bitrate_kbps(const lame_global_flags * gfp, int bitrate_kbps[14]) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - SessionConfig_t const *const cfg = &gfc->cfg; - int i; - if (cfg->free_format) { - for (i = 0; i < 14; i++) - bitrate_kbps[i] = -1; - bitrate_kbps[0] = cfg->avg_bitrate; - } - else { - for (i = 0; i < 14; i++) - bitrate_kbps[i] = bitrate_table[cfg->version][i + 1]; - } - } - } -} - - -void -lame_bitrate_hist(const lame_global_flags * gfp, int bitrate_count[14]) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t const *const eov = &gfc->ov_enc; - int i; - - if (cfg->free_format) { - for (i = 0; i < 14; i++) { - bitrate_count[i] = 0; - } - bitrate_count[0] = eov->bitrate_channelmode_hist[0][4]; - } - else { - for (i = 0; i < 14; i++) { - bitrate_count[i] = eov->bitrate_channelmode_hist[i + 1][4]; - } - } - } - } -} - - -void -lame_stereo_mode_hist(const lame_global_flags * gfp, int stmode_count[4]) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - EncResult_t const *const eov = &gfc->ov_enc; - int i; - - for (i = 0; i < 4; i++) { - stmode_count[i] = eov->bitrate_channelmode_hist[15][i]; - } - } - } -} - - - -void -lame_bitrate_stereo_mode_hist(const lame_global_flags * gfp, int bitrate_stmode_count[14][4]) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t const *const eov = &gfc->ov_enc; - int i; - int j; - - if (cfg->free_format) { - for (j = 0; j < 14; j++) - for (i = 0; i < 4; i++) { - bitrate_stmode_count[j][i] = 0; - } - for (i = 0; i < 4; i++) { - bitrate_stmode_count[0][i] = eov->bitrate_channelmode_hist[0][i]; - } - } - else { - for (j = 0; j < 14; j++) { - for (i = 0; i < 4; i++) { - bitrate_stmode_count[j][i] = eov->bitrate_channelmode_hist[j + 1][i]; - } - } - } - } - } -} - - -void -lame_block_type_hist(const lame_global_flags * gfp, int btype_count[6]) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - EncResult_t const *const eov = &gfc->ov_enc; - int i; - - for (i = 0; i < 6; ++i) { - btype_count[i] = eov->bitrate_blocktype_hist[15][i]; - } - } - } -} - - - -void -lame_bitrate_block_type_hist(const lame_global_flags * gfp, int bitrate_btype_count[14][6]) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t const *const eov = &gfc->ov_enc; - int i, j; - - if (cfg->free_format) { - for (j = 0; j < 14; ++j) { - for (i = 0; i < 6; ++i) { - bitrate_btype_count[j][i] = 0; - } - } - for (i = 0; i < 6; ++i) { - bitrate_btype_count[0][i] = eov->bitrate_blocktype_hist[0][i]; - } - } - else { - for (j = 0; j < 14; ++j) { - for (i = 0; i < 6; ++i) { - bitrate_btype_count[j][i] = eov->bitrate_blocktype_hist[j + 1][i]; - } - } - } - } - } -} - -/* end of lame.c */ diff --git a/src/lib/dl/ext/lame/lame.h b/src/lib/dl/ext/lame/lame.h deleted file mode 100755 index a694f3a8..00000000 --- a/src/lib/dl/ext/lame/lame.h +++ /dev/null @@ -1,1329 +0,0 @@ -/* - * Interface to MP3 LAME encoding engine - * - * Copyright (c) 1999 Mark Taylor - * - * 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. - */ - -/* $Id: lame.h,v 1.189 2011/10/02 14:52:20 robert Exp $ */ - -#ifndef LAME_LAME_H -#define LAME_LAME_H - -/* for size_t typedef */ -#include <stddef.h> -/* for va_list typedef */ -#include <stdarg.h> -/* for FILE typedef, TODO: remove when removing lame_mp3_tags_fid */ -#include <stdio.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -typedef void (*lame_report_function)(const char *format, va_list ap); - -#if defined(WIN32) || defined(_WIN32) -#undef CDECL -#define CDECL __cdecl -#else -#define CDECL -#endif - -#define DEPRECATED_OR_OBSOLETE_CODE_REMOVED 1 - -typedef enum vbr_mode_e { - vbr_off=0, - vbr_mt, /* obsolete, same as vbr_mtrh */ - vbr_rh, - vbr_abr, - vbr_mtrh, - vbr_max_indicator, /* Don't use this! It's used for sanity checks. */ - vbr_default=vbr_mtrh /* change this to change the default VBR mode of LAME */ -} vbr_mode; - - -/* MPEG modes */ -typedef enum MPEG_mode_e { - STEREO = 0, - JOINT_STEREO, - DUAL_CHANNEL, /* LAME doesn't supports this! */ - MONO, - NOT_SET, - MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ -} MPEG_mode; - -/* Padding types */ -typedef enum Padding_type_e { - PAD_NO = 0, - PAD_ALL, - PAD_ADJUST, - PAD_MAX_INDICATOR /* Don't use this! It's used for sanity checks. */ -} Padding_type; - - - -/*presets*/ -typedef enum preset_mode_e { - /*values from 8 to 320 should be reserved for abr bitrates*/ - /*for abr I'd suggest to directly use the targeted bitrate as a value*/ - ABR_8 = 8, - ABR_320 = 320, - - V9 = 410, /*Vx to match Lame and VBR_xx to match FhG*/ - VBR_10 = 410, - V8 = 420, - VBR_20 = 420, - V7 = 430, - VBR_30 = 430, - V6 = 440, - VBR_40 = 440, - V5 = 450, - VBR_50 = 450, - V4 = 460, - VBR_60 = 460, - V3 = 470, - VBR_70 = 470, - V2 = 480, - VBR_80 = 480, - V1 = 490, - VBR_90 = 490, - V0 = 500, - VBR_100 = 500, - - - - /*still there for compatibility*/ - R3MIX = 1000, - STANDARD = 1001, - EXTREME = 1002, - INSANE = 1003, - STANDARD_FAST = 1004, - EXTREME_FAST = 1005, - MEDIUM = 1006, - MEDIUM_FAST = 1007 -} preset_mode; - - -/*asm optimizations*/ -typedef enum asm_optimizations_e { - MMX = 1, - AMD_3DNOW = 2, - SSE = 3 -} asm_optimizations; - - -/* psychoacoustic model */ -typedef enum Psy_model_e { - PSY_GPSYCHO = 1, - PSY_NSPSYTUNE = 2 -} Psy_model; - - -/* buffer considerations */ -typedef enum buffer_constraint_e { - MDB_DEFAULT=0, - MDB_STRICT_ISO=1, - MDB_MAXIMUM=2 -} buffer_constraint; - - -struct lame_global_struct; -typedef struct lame_global_struct lame_global_flags; -typedef lame_global_flags *lame_t; - - - - -/*********************************************************************** - * - * The LAME API - * These functions should be called, in this order, for each - * MP3 file to be encoded. See the file "API" for more documentation - * - ***********************************************************************/ - - -/* - * REQUIRED: - * initialize the encoder. sets default for all encoder parameters, - * returns NULL if some malloc()'s failed - * otherwise returns pointer to structure needed for all future - * API calls. - */ -lame_global_flags * CDECL lame_init(void); -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* obsolete version */ -int CDECL lame_init_old(lame_global_flags *); -#endif - -/* - * OPTIONAL: - * set as needed to override defaults - */ - -/******************************************************************** - * input stream description - ***********************************************************************/ -/* number of samples. default = 2^32-1 */ -int CDECL lame_set_num_samples(lame_global_flags *, unsigned long); -unsigned long CDECL lame_get_num_samples(const lame_global_flags *); - -/* input sample rate in Hz. default = 44100hz */ -int CDECL lame_set_in_samplerate(lame_global_flags *, int); -int CDECL lame_get_in_samplerate(const lame_global_flags *); - -/* number of channels in input stream. default=2 */ -int CDECL lame_set_num_channels(lame_global_flags *, int); -int CDECL lame_get_num_channels(const lame_global_flags *); - -/* - scale the input by this amount before encoding. default=1 - (not used by decoding routines) -*/ -int CDECL lame_set_scale(lame_global_flags *, float); -float CDECL lame_get_scale(const lame_global_flags *); - -/* - scale the channel 0 (left) input by this amount before encoding. default=1 - (not used by decoding routines) -*/ -int CDECL lame_set_scale_left(lame_global_flags *, float); -float CDECL lame_get_scale_left(const lame_global_flags *); - -/* - scale the channel 1 (right) input by this amount before encoding. default=1 - (not used by decoding routines) -*/ -int CDECL lame_set_scale_right(lame_global_flags *, float); -float CDECL lame_get_scale_right(const lame_global_flags *); - -/* - output sample rate in Hz. default = 0, which means LAME picks best value - based on the amount of compression. MPEG only allows: - MPEG1 32, 44.1, 48khz - MPEG2 16, 22.05, 24 - MPEG2.5 8, 11.025, 12 - (not used by decoding routines) -*/ -int CDECL lame_set_out_samplerate(lame_global_flags *, int); -int CDECL lame_get_out_samplerate(const lame_global_flags *); - - -/******************************************************************** - * general control parameters - ***********************************************************************/ -/* 1=cause LAME to collect data for an MP3 frame analyzer. default=0 */ -int CDECL lame_set_analysis(lame_global_flags *, int); -int CDECL lame_get_analysis(const lame_global_flags *); - -/* - 1 = write a Xing VBR header frame. - default = 1 - this variable must have been added by a Hungarian notation Windows programmer :-) -*/ -int CDECL lame_set_bWriteVbrTag(lame_global_flags *, int); -int CDECL lame_get_bWriteVbrTag(const lame_global_flags *); - -/* 1=decode only. use lame/mpglib to convert mp3/ogg to wav. default=0 */ -int CDECL lame_set_decode_only(lame_global_flags *, int); -int CDECL lame_get_decode_only(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* 1=encode a Vorbis .ogg file. default=0 */ -/* DEPRECATED */ -int CDECL lame_set_ogg(lame_global_flags *, int); -int CDECL lame_get_ogg(const lame_global_flags *); -#endif - -/* - internal algorithm selection. True quality is determined by the bitrate - but this variable will effect quality by selecting expensive or cheap algorithms. - quality=0..9. 0=best (very slow). 9=worst. - recommended: 2 near-best quality, not too slow - 5 good quality, fast - 7 ok quality, really fast -*/ -int CDECL lame_set_quality(lame_global_flags *, int); -int CDECL lame_get_quality(const lame_global_flags *); - -/* - mode = 0,1,2,3 = stereo, jstereo, dual channel (not supported), mono - default: lame picks based on compression ration and input channels -*/ -int CDECL lame_set_mode(lame_global_flags *, MPEG_mode); -MPEG_mode CDECL lame_get_mode(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* - mode_automs. Use a M/S mode with a switching threshold based on - compression ratio - DEPRECATED -*/ -int CDECL lame_set_mode_automs(lame_global_flags *, int); -int CDECL lame_get_mode_automs(const lame_global_flags *); -#endif - -/* - force_ms. Force M/S for all frames. For testing only. - default = 0 (disabled) -*/ -int CDECL lame_set_force_ms(lame_global_flags *, int); -int CDECL lame_get_force_ms(const lame_global_flags *); - -/* use free_format? default = 0 (disabled) */ -int CDECL lame_set_free_format(lame_global_flags *, int); -int CDECL lame_get_free_format(const lame_global_flags *); - -/* perform ReplayGain analysis? default = 0 (disabled) */ -int CDECL lame_set_findReplayGain(lame_global_flags *, int); -int CDECL lame_get_findReplayGain(const lame_global_flags *); - -/* decode on the fly. Search for the peak sample. If the ReplayGain - * analysis is enabled then perform the analysis on the decoded data - * stream. default = 0 (disabled) - * NOTE: if this option is set the build-in decoder should not be used */ -int CDECL lame_set_decode_on_the_fly(lame_global_flags *, int); -int CDECL lame_get_decode_on_the_fly(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* DEPRECATED: now does the same as lame_set_findReplayGain() - default = 0 (disabled) */ -int CDECL lame_set_ReplayGain_input(lame_global_flags *, int); -int CDECL lame_get_ReplayGain_input(const lame_global_flags *); - -/* DEPRECATED: now does the same as - lame_set_decode_on_the_fly() && lame_set_findReplayGain() - default = 0 (disabled) */ -int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int); -int CDECL lame_get_ReplayGain_decode(const lame_global_flags *); - -/* DEPRECATED: now does the same as lame_set_decode_on_the_fly() - default = 0 (disabled) */ -int CDECL lame_set_findPeakSample(lame_global_flags *, int); -int CDECL lame_get_findPeakSample(const lame_global_flags *); -#endif - -/* counters for gapless encoding */ -int CDECL lame_set_nogap_total(lame_global_flags*, int); -int CDECL lame_get_nogap_total(const lame_global_flags*); - -int CDECL lame_set_nogap_currentindex(lame_global_flags* , int); -int CDECL lame_get_nogap_currentindex(const lame_global_flags*); - - -/* - * OPTIONAL: - * Set printf like error/debug/message reporting functions. - * The second argument has to be a pointer to a function which looks like - * void my_debugf(const char *format, va_list ap) - * { - * (void) vfprintf(stdout, format, ap); - * } - * If you use NULL as the value of the pointer in the set function, the - * lame buildin function will be used (prints to stderr). - * To quiet any output you have to replace the body of the example function - * with just "return;" and use it in the set function. - */ -int CDECL lame_set_errorf(lame_global_flags *, lame_report_function); -int CDECL lame_set_debugf(lame_global_flags *, lame_report_function); -int CDECL lame_set_msgf (lame_global_flags *, lame_report_function); - - - -/* set one of brate compression ratio. default is compression ratio of 11. */ -int CDECL lame_set_brate(lame_global_flags *, int); -int CDECL lame_get_brate(const lame_global_flags *); -int CDECL lame_set_compression_ratio(lame_global_flags *, float); -float CDECL lame_get_compression_ratio(const lame_global_flags *); - - -int CDECL lame_set_preset( lame_global_flags* gfp, int ); -int CDECL lame_set_asm_optimizations( lame_global_flags* gfp, int, int ); - - - -/******************************************************************** - * frame params - ***********************************************************************/ -/* mark as copyright. default=0 */ -int CDECL lame_set_copyright(lame_global_flags *, int); -int CDECL lame_get_copyright(const lame_global_flags *); - -/* mark as original. default=1 */ -int CDECL lame_set_original(lame_global_flags *, int); -int CDECL lame_get_original(const lame_global_flags *); - -/* error_protection. Use 2 bytes from each frame for CRC checksum. default=0 */ -int CDECL lame_set_error_protection(lame_global_flags *, int); -int CDECL lame_get_error_protection(const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) */ -int CDECL lame_set_padding_type(lame_global_flags *, Padding_type); -Padding_type CDECL lame_get_padding_type(const lame_global_flags *); -#endif - -/* MP3 'private extension' bit Meaningless. default=0 */ -int CDECL lame_set_extension(lame_global_flags *, int); -int CDECL lame_get_extension(const lame_global_flags *); - -/* enforce strict ISO compliance. default=0 */ -int CDECL lame_set_strict_ISO(lame_global_flags *, int); -int CDECL lame_get_strict_ISO(const lame_global_flags *); - - -/******************************************************************** - * quantization/noise shaping - ***********************************************************************/ - -/* disable the bit reservoir. For testing only. default=0 */ -int CDECL lame_set_disable_reservoir(lame_global_flags *, int); -int CDECL lame_get_disable_reservoir(const lame_global_flags *); - -/* select a different "best quantization" function. default=0 */ -int CDECL lame_set_quant_comp(lame_global_flags *, int); -int CDECL lame_get_quant_comp(const lame_global_flags *); -int CDECL lame_set_quant_comp_short(lame_global_flags *, int); -int CDECL lame_get_quant_comp_short(const lame_global_flags *); - -int CDECL lame_set_experimentalX(lame_global_flags *, int); /* compatibility*/ -int CDECL lame_get_experimentalX(const lame_global_flags *); - -/* another experimental option. for testing only */ -int CDECL lame_set_experimentalY(lame_global_flags *, int); -int CDECL lame_get_experimentalY(const lame_global_flags *); - -/* another experimental option. for testing only */ -int CDECL lame_set_experimentalZ(lame_global_flags *, int); -int CDECL lame_get_experimentalZ(const lame_global_flags *); - -/* Naoki's psycho acoustic model. default=0 */ -int CDECL lame_set_exp_nspsytune(lame_global_flags *, int); -int CDECL lame_get_exp_nspsytune(const lame_global_flags *); - -void CDECL lame_set_msfix(lame_global_flags *, double); -float CDECL lame_get_msfix(const lame_global_flags *); - - -/******************************************************************** - * VBR control - ***********************************************************************/ -/* Types of VBR. default = vbr_off = CBR */ -int CDECL lame_set_VBR(lame_global_flags *, vbr_mode); -vbr_mode CDECL lame_get_VBR(const lame_global_flags *); - -/* VBR quality level. 0=highest 9=lowest */ -int CDECL lame_set_VBR_q(lame_global_flags *, int); -int CDECL lame_get_VBR_q(const lame_global_flags *); - -/* VBR quality level. 0=highest 9=lowest, Range [0,...,10[ */ -int CDECL lame_set_VBR_quality(lame_global_flags *, float); -float CDECL lame_get_VBR_quality(const lame_global_flags *); - -/* Ignored except for VBR=vbr_abr (ABR mode) */ -int CDECL lame_set_VBR_mean_bitrate_kbps(lame_global_flags *, int); -int CDECL lame_get_VBR_mean_bitrate_kbps(const lame_global_flags *); - -int CDECL lame_set_VBR_min_bitrate_kbps(lame_global_flags *, int); -int CDECL lame_get_VBR_min_bitrate_kbps(const lame_global_flags *); - -int CDECL lame_set_VBR_max_bitrate_kbps(lame_global_flags *, int); -int CDECL lame_get_VBR_max_bitrate_kbps(const lame_global_flags *); - -/* - 1=strictly enforce VBR_min_bitrate. Normally it will be violated for - analog silence -*/ -int CDECL lame_set_VBR_hard_min(lame_global_flags *, int); -int CDECL lame_get_VBR_hard_min(const lame_global_flags *); - -/* for preset */ -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -int CDECL lame_set_preset_expopts(lame_global_flags *, int); -#endif - -/******************************************************************** - * Filtering control - ***********************************************************************/ -/* freq in Hz to apply lowpass. Default = 0 = lame chooses. -1 = disabled */ -int CDECL lame_set_lowpassfreq(lame_global_flags *, int); -int CDECL lame_get_lowpassfreq(const lame_global_flags *); -/* width of transition band, in Hz. Default = one polyphase filter band */ -int CDECL lame_set_lowpasswidth(lame_global_flags *, int); -int CDECL lame_get_lowpasswidth(const lame_global_flags *); - -/* freq in Hz to apply highpass. Default = 0 = lame chooses. -1 = disabled */ -int CDECL lame_set_highpassfreq(lame_global_flags *, int); -int CDECL lame_get_highpassfreq(const lame_global_flags *); -/* width of transition band, in Hz. Default = one polyphase filter band */ -int CDECL lame_set_highpasswidth(lame_global_flags *, int); -int CDECL lame_get_highpasswidth(const lame_global_flags *); - - -/******************************************************************** - * psycho acoustics and other arguments which you should not change - * unless you know what you are doing - ***********************************************************************/ - -/* only use ATH for masking */ -int CDECL lame_set_ATHonly(lame_global_flags *, int); -int CDECL lame_get_ATHonly(const lame_global_flags *); - -/* only use ATH for short blocks */ -int CDECL lame_set_ATHshort(lame_global_flags *, int); -int CDECL lame_get_ATHshort(const lame_global_flags *); - -/* disable ATH */ -int CDECL lame_set_noATH(lame_global_flags *, int); -int CDECL lame_get_noATH(const lame_global_flags *); - -/* select ATH formula */ -int CDECL lame_set_ATHtype(lame_global_flags *, int); -int CDECL lame_get_ATHtype(const lame_global_flags *); - -/* lower ATH by this many db */ -int CDECL lame_set_ATHlower(lame_global_flags *, float); -float CDECL lame_get_ATHlower(const lame_global_flags *); - -/* select ATH adaptive adjustment type */ -int CDECL lame_set_athaa_type( lame_global_flags *, int); -int CDECL lame_get_athaa_type( const lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* select the loudness approximation used by the ATH adaptive auto-leveling */ -int CDECL lame_set_athaa_loudapprox( lame_global_flags *, int); -int CDECL lame_get_athaa_loudapprox( const lame_global_flags *); -#endif - -/* adjust (in dB) the point below which adaptive ATH level adjustment occurs */ -int CDECL lame_set_athaa_sensitivity( lame_global_flags *, float); -float CDECL lame_get_athaa_sensitivity( const lame_global_flags* ); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* OBSOLETE: predictability limit (ISO tonality formula) */ -int CDECL lame_set_cwlimit(lame_global_flags *, int); -int CDECL lame_get_cwlimit(const lame_global_flags *); -#endif - -/* - allow blocktypes to differ between channels? - default: 0 for jstereo, 1 for stereo -*/ -int CDECL lame_set_allow_diff_short(lame_global_flags *, int); -int CDECL lame_get_allow_diff_short(const lame_global_flags *); - -/* use temporal masking effect (default = 1) */ -int CDECL lame_set_useTemporal(lame_global_flags *, int); -int CDECL lame_get_useTemporal(const lame_global_flags *); - -/* use temporal masking effect (default = 1) */ -int CDECL lame_set_interChRatio(lame_global_flags *, float); -float CDECL lame_get_interChRatio(const lame_global_flags *); - -/* disable short blocks */ -int CDECL lame_set_no_short_blocks(lame_global_flags *, int); -int CDECL lame_get_no_short_blocks(const lame_global_flags *); - -/* force short blocks */ -int CDECL lame_set_force_short_blocks(lame_global_flags *, int); -int CDECL lame_get_force_short_blocks(const lame_global_flags *); - -/* Input PCM is emphased PCM (for instance from one of the rarely - emphased CDs), it is STRONGLY not recommended to use this, because - psycho does not take it into account, and last but not least many decoders - ignore these bits */ -int CDECL lame_set_emphasis(lame_global_flags *, int); -int CDECL lame_get_emphasis(const lame_global_flags *); - - - -/************************************************************************/ -/* internal variables, cannot be set... */ -/* provided because they may be of use to calling application */ -/************************************************************************/ -/* version 0=MPEG-2 1=MPEG-1 (2=MPEG-2.5) */ -int CDECL lame_get_version(const lame_global_flags *); - -/* encoder delay */ -int CDECL lame_get_encoder_delay(const lame_global_flags *); - -/* - padding appended to the input to make sure decoder can fully decode - all input. Note that this value can only be calculated during the - call to lame_encoder_flush(). Before lame_encoder_flush() has - been called, the value of encoder_padding = 0. -*/ -int CDECL lame_get_encoder_padding(const lame_global_flags *); - -/* size of MPEG frame */ -int CDECL lame_get_framesize(const lame_global_flags *); - -/* number of PCM samples buffered, but not yet encoded to mp3 data. */ -int CDECL lame_get_mf_samples_to_encode( const lame_global_flags* gfp ); - -/* - size (bytes) of mp3 data buffered, but not yet encoded. - this is the number of bytes which would be output by a call to - lame_encode_flush_nogap. NOTE: lame_encode_flush() will return - more bytes than this because it will encode the reamining buffered - PCM samples before flushing the mp3 buffers. -*/ -int CDECL lame_get_size_mp3buffer( const lame_global_flags* gfp ); - -/* number of frames encoded so far */ -int CDECL lame_get_frameNum(const lame_global_flags *); - -/* - lame's estimate of the total number of frames to be encoded - only valid if calling program set num_samples -*/ -int CDECL lame_get_totalframes(const lame_global_flags *); - -/* RadioGain value. Multiplied by 10 and rounded to the nearest. */ -int CDECL lame_get_RadioGain(const lame_global_flags *); - -/* AudiophileGain value. Multipled by 10 and rounded to the nearest. */ -int CDECL lame_get_AudiophileGain(const lame_global_flags *); - -/* the peak sample */ -float CDECL lame_get_PeakSample(const lame_global_flags *); - -/* Gain change required for preventing clipping. The value is correct only if - peak sample searching was enabled. If negative then the waveform - already does not clip. The value is multiplied by 10 and rounded up. */ -int CDECL lame_get_noclipGainChange(const lame_global_flags *); - -/* user-specified scale factor required for preventing clipping. Value is - correct only if peak sample searching was enabled and no user-specified - scaling was performed. If negative then either the waveform already does - not clip or the value cannot be determined */ -float CDECL lame_get_noclipScale(const lame_global_flags *); - - - - - - - -/* - * REQUIRED: - * sets more internal configuration based on data provided above. - * returns -1 if something failed. - */ -int CDECL lame_init_params(lame_global_flags *); - - -/* - * OPTIONAL: - * get the version number, in a string. of the form: - * "3.63 (beta)" or just "3.63". - */ -const char* CDECL get_lame_version ( void ); -const char* CDECL get_lame_short_version ( void ); -const char* CDECL get_lame_very_short_version ( void ); -const char* CDECL get_psy_version ( void ); -const char* CDECL get_lame_url ( void ); -const char* CDECL get_lame_os_bitness ( void ); - -/* - * OPTIONAL: - * get the version numbers in numerical form. - */ -typedef struct { - /* generic LAME version */ - int major; - int minor; - int alpha; /* 0 if not an alpha version */ - int beta; /* 0 if not a beta version */ - - /* version of the psy model */ - int psy_major; - int psy_minor; - int psy_alpha; /* 0 if not an alpha version */ - int psy_beta; /* 0 if not a beta version */ - - /* compile time features */ - const char *features; /* Don't make assumptions about the contents! */ -} lame_version_t; -void CDECL get_lame_version_numerical(lame_version_t *); - - -/* - * OPTIONAL: - * print internal lame configuration to message handler - */ -void CDECL lame_print_config(const lame_global_flags* gfp); - -void CDECL lame_print_internals( const lame_global_flags *gfp); - - -/* - * input pcm data, output (maybe) mp3 frames. - * This routine handles all buffering, resampling and filtering for you. - * - * return code number of bytes output in mp3buf. Can be 0 - * -1: mp3buf was too small - * -2: malloc() problem - * -3: lame_init_params() not called - * -4: psycho acoustic problems - * - * The required mp3buf_size can be computed from num_samples, - * samplerate and encoding rate, but here is a worst case estimate: - * - * mp3buf_size in bytes = 1.25*num_samples + 7200 - * - * I think a tighter bound could be: (mt, March 2000) - * MPEG1: - * num_samples*(bitrate/8)/samplerate + 4*1152*(bitrate/8)/samplerate + 512 - * MPEG2: - * num_samples*(bitrate/8)/samplerate + 4*576*(bitrate/8)/samplerate + 256 - * - * but test first if you use that! - * - * set mp3buf_size = 0 and LAME will not check if mp3buf_size is - * large enough. - * - * NOTE: - * if gfp->num_channels=2, but gfp->mode = 3 (mono), the L & R channels - * will be averaged into the L channel before encoding only the L channel - * This will overwrite the data in buffer_l[] and buffer_r[]. - * -*/ -int CDECL lame_encode_buffer ( - lame_global_flags* gfp, /* global context handle */ - const short int buffer_l [], /* PCM data for left channel */ - const short int buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* - * as above, but input has L & R channel data interleaved. - * NOTE: - * num_samples = number of samples in the L (or R) - * channel, not the total number of samples in pcm[] - */ -int CDECL lame_encode_buffer_interleaved( - lame_global_flags* gfp, /* global context handlei */ - short int pcm[], /* PCM data for left and right - channel, interleaved */ - int num_samples, /* number of samples per channel, - _not_ number of samples in - pcm[] */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - int mp3buf_size ); /* number of valid octets in this - stream */ - - -/* as lame_encode_buffer, but for 'float's. - * !! NOTE: !! data must still be scaled to be in the same range as - * short int, +/- 32768 - */ -int CDECL lame_encode_buffer_float( - lame_global_flags* gfp, /* global context handle */ - const float pcm_l [], /* PCM data for left channel */ - const float pcm_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* as lame_encode_buffer, but for 'float's. - * !! NOTE: !! data must be scaled to +/- 1 full scale - */ -int CDECL lame_encode_buffer_ieee_float( - lame_t gfp, - const float pcm_l [], /* PCM data for left channel */ - const float pcm_r [], /* PCM data for right channel */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); -int CDECL lame_encode_buffer_interleaved_ieee_float( - lame_t gfp, - const float pcm[], /* PCM data for left and right - channel, interleaved */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); - -/* as lame_encode_buffer, but for 'double's. - * !! NOTE: !! data must be scaled to +/- 1 full scale - */ -int CDECL lame_encode_buffer_ieee_double( - lame_t gfp, - const double pcm_l [], /* PCM data for left channel */ - const double pcm_r [], /* PCM data for right channel */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); -int CDECL lame_encode_buffer_interleaved_ieee_double( - lame_t gfp, - const double pcm[], /* PCM data for left and right - channel, interleaved */ - const int nsamples, - unsigned char * mp3buf, - const int mp3buf_size); - -/* as lame_encode_buffer, but for long's - * !! NOTE: !! data must still be scaled to be in the same range as - * short int, +/- 32768 - * - * This scaling was a mistake (doesn't allow one to exploit full - * precision of type 'long'. Use lame_encode_buffer_long2() instead. - * - */ -int CDECL lame_encode_buffer_long( - lame_global_flags* gfp, /* global context handle */ - const long buffer_l [], /* PCM data for left channel */ - const long buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* Same as lame_encode_buffer_long(), but with correct scaling. - * !! NOTE: !! data must still be scaled to be in the same range as - * type 'long'. Data should be in the range: +/- 2^(8*size(long)-1) - * - */ -int CDECL lame_encode_buffer_long2( - lame_global_flags* gfp, /* global context handle */ - const long buffer_l [], /* PCM data for left channel */ - const long buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - -/* as lame_encode_buffer, but for int's - * !! NOTE: !! input should be scaled to the maximum range of 'int' - * If int is 4 bytes, then the values should range from - * +/- 2147483648. - * - * This routine does not (and cannot, without loosing precision) use - * the same scaling as the rest of the lame_encode_buffer() routines. - * - */ -int CDECL lame_encode_buffer_int( - lame_global_flags* gfp, /* global context handle */ - const int buffer_l [], /* PCM data for left channel */ - const int buffer_r [], /* PCM data for right channel */ - const int nsamples, /* number of samples per channel */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - const int mp3buf_size ); /* number of valid octets in this - stream */ - - - - - -/* - * REQUIRED: - * lame_encode_flush will flush the intenal PCM buffers, padding with - * 0's to make sure the final frame is complete, and then flush - * the internal MP3 buffers, and thus may return a - * final few mp3 frames. 'mp3buf' should be at least 7200 bytes long - * to hold all possible emitted data. - * - * will also write id3v1 tags (if any) into the bitstream - * - * return code = number of bytes output to mp3buf. Can be 0 - */ -int CDECL lame_encode_flush( - lame_global_flags * gfp, /* global context handle */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - int size); /* number of valid octets in this stream */ - -/* - * OPTIONAL: - * lame_encode_flush_nogap will flush the internal mp3 buffers and pad - * the last frame with ancillary data so it is a complete mp3 frame. - * - * 'mp3buf' should be at least 7200 bytes long - * to hold all possible emitted data. - * - * After a call to this routine, the outputed mp3 data is complete, but - * you may continue to encode new PCM samples and write future mp3 data - * to a different file. The two mp3 files will play back with no gaps - * if they are concatenated together. - * - * This routine will NOT write id3v1 tags into the bitstream. - * - * return code = number of bytes output to mp3buf. Can be 0 - */ -int CDECL lame_encode_flush_nogap( - lame_global_flags * gfp, /* global context handle */ - unsigned char* mp3buf, /* pointer to encoded MP3 stream */ - int size); /* number of valid octets in this stream */ - -/* - * OPTIONAL: - * Normally, this is called by lame_init_params(). It writes id3v2 and - * Xing headers into the front of the bitstream, and sets frame counters - * and bitrate histogram data to 0. You can also call this after - * lame_encode_flush_nogap(). - */ -int CDECL lame_init_bitstream( - lame_global_flags * gfp); /* global context handle */ - - - -/* - * OPTIONAL: some simple statistics - * a bitrate histogram to visualize the distribution of used frame sizes - * a stereo mode histogram to visualize the distribution of used stereo - * modes, useful in joint-stereo mode only - * 0: LR left-right encoded - * 1: LR-I left-right and intensity encoded (currently not supported) - * 2: MS mid-side encoded - * 3: MS-I mid-side and intensity encoded (currently not supported) - * - * attention: don't call them after lame_encode_finish - * suggested: lame_encode_flush -> lame_*_hist -> lame_close - */ - -void CDECL lame_bitrate_hist( - const lame_global_flags * gfp, - int bitrate_count[14] ); -void CDECL lame_bitrate_kbps( - const lame_global_flags * gfp, - int bitrate_kbps [14] ); -void CDECL lame_stereo_mode_hist( - const lame_global_flags * gfp, - int stereo_mode_count[4] ); - -void CDECL lame_bitrate_stereo_mode_hist ( - const lame_global_flags * gfp, - int bitrate_stmode_count[14][4] ); - -void CDECL lame_block_type_hist ( - const lame_global_flags * gfp, - int btype_count[6] ); - -void CDECL lame_bitrate_block_type_hist ( - const lame_global_flags * gfp, - int bitrate_btype_count[14][6] ); - -#if (DEPRECATED_OR_OBSOLETE_CODE_REMOVED && 0) -#else -/* - * OPTIONAL: - * lame_mp3_tags_fid will rewrite a Xing VBR tag to the mp3 file with file - * pointer fid. These calls perform forward and backwards seeks, so make - * sure fid is a real file. Make sure lame_encode_flush has been called, - * and all mp3 data has been written to the file before calling this - * function. - * NOTE: - * if VBR tags are turned off by the user, or turned off by LAME because - * the output is not a regular file, this call does nothing - * NOTE: - * LAME wants to read from the file to skip an optional ID3v2 tag, so - * make sure you opened the file for writing and reading. - * NOTE: - * You can call lame_get_lametag_frame instead, if you want to insert - * the lametag yourself. -*/ -void CDECL lame_mp3_tags_fid(lame_global_flags *, FILE* fid); -#endif - -/* - * OPTIONAL: - * lame_get_lametag_frame copies the final LAME-tag into 'buffer'. - * The function returns the number of bytes copied into buffer, or - * the required buffer size, if the provided buffer is too small. - * Function failed, if the return value is larger than 'size'! - * Make sure lame_encode flush has been called before calling this function. - * NOTE: - * if VBR tags are turned off by the user, or turned off by LAME, - * this call does nothing and returns 0. - * NOTE: - * LAME inserted an empty frame in the beginning of mp3 audio data, - * which you have to replace by the final LAME-tag frame after encoding. - * In case there is no ID3v2 tag, usually this frame will be the very first - * data in your mp3 file. If you put some other leading data into your - * file, you'll have to do some bookkeeping about where to write this buffer. - */ -size_t CDECL lame_get_lametag_frame( - const lame_global_flags *, unsigned char* buffer, size_t size); - -/* - * REQUIRED: - * final call to free all remaining buffers - */ -int CDECL lame_close (lame_global_flags *); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* - * OBSOLETE: - * lame_encode_finish combines lame_encode_flush() and lame_close() in - * one call. However, once this call is made, the statistics routines - * will no longer work because the data will have been cleared, and - * lame_mp3_tags_fid() cannot be called to add data to the VBR header - */ -int CDECL lame_encode_finish( - lame_global_flags* gfp, - unsigned char* mp3buf, - int size ); -#endif - - - - - - -/********************************************************************* - * - * decoding - * - * a simple interface to mpglib, part of mpg123, is also included if - * libmp3lame is compiled with HAVE_MPGLIB - * - *********************************************************************/ - -struct hip_global_struct; -typedef struct hip_global_struct hip_global_flags; -typedef hip_global_flags *hip_t; - - -typedef struct { - int header_parsed; /* 1 if header was parsed and following data was - computed */ - int stereo; /* number of channels */ - int samplerate; /* sample rate */ - int bitrate; /* bitrate */ - int mode; /* mp3 frame type */ - int mode_ext; /* mp3 frame type */ - int framesize; /* number of samples per mp3 frame */ - - /* this data is only computed if mpglib detects a Xing VBR header */ - unsigned long nsamp; /* number of samples in mp3 file. */ - int totalframes; /* total number of frames in mp3 file */ - - /* this data is not currently computed by the mpglib routines */ - int framenum; /* frames decoded counter */ -} mp3data_struct; - -/* required call to initialize decoder */ -hip_t CDECL hip_decode_init(void); - -/* cleanup call to exit decoder */ -int CDECL hip_decode_exit(hip_t gfp); - -/* HIP reporting functions */ -void CDECL hip_set_errorf(hip_t gfp, lame_report_function f); -void CDECL hip_set_debugf(hip_t gfp, lame_report_function f); -void CDECL hip_set_msgf (hip_t gfp, lame_report_function f); - -/********************************************************************* - * input 1 mp3 frame, output (maybe) pcm data. - * - * nout = hip_decode(hip, mp3buf,len,pcm_l,pcm_r); - * - * input: - * len : number of bytes of mp3 data in mp3buf - * mp3buf[len] : mp3 data to be decoded - * - * output: - * nout: -1 : decoding error - * 0 : need more data before we can complete the decode - * >0 : returned 'nout' samples worth of data in pcm_l,pcm_r - * pcm_l[nout] : left channel data - * pcm_r[nout] : right channel data - * - *********************************************************************/ -int CDECL hip_decode( hip_t gfp - , unsigned char * mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - ); - -/* same as hip_decode, and also returns mp3 header data */ -int CDECL hip_decode_headers( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - , mp3data_struct* mp3data - ); - -/* same as hip_decode, but returns at most one frame */ -int CDECL hip_decode1( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - ); - -/* same as hip_decode1, but returns at most one frame and mp3 header data */ -int CDECL hip_decode1_headers( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - , mp3data_struct* mp3data - ); - -/* same as hip_decode1_headers, but also returns enc_delay and enc_padding - from VBR Info tag, (-1 if no info tag was found) */ -int CDECL hip_decode1_headersB( hip_t gfp - , unsigned char* mp3buf - , size_t len - , short pcm_l[] - , short pcm_r[] - , mp3data_struct* mp3data - , int *enc_delay - , int *enc_padding - ); - - - -/* OBSOLETE: - * lame_decode... functions are there to keep old code working - * but it is strongly recommended to replace calls by hip_decode... - * function calls, see above. - */ -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -int CDECL lame_decode_init(void); -int CDECL lame_decode( - unsigned char * mp3buf, - int len, - short pcm_l[], - short pcm_r[] ); -int CDECL lame_decode_headers( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data ); -int CDECL lame_decode1( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[] ); -int CDECL lame_decode1_headers( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data ); -int CDECL lame_decode1_headersB( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data, - int *enc_delay, - int *enc_padding ); -int CDECL lame_decode_exit(void); - -#endif /* obsolete lame_decode API calls */ - - -/********************************************************************* - * - * id3tag stuff - * - *********************************************************************/ - -/* - * id3tag.h -- Interface to write ID3 version 1 and 2 tags. - * - * Copyright (C) 2000 Don Melton. - * - * 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. - */ - -/* utility to obtain alphabetically sorted list of genre names with numbers */ -void CDECL id3tag_genre_list( - void (*handler)(int, const char *, void *), - void* cookie); - -void CDECL id3tag_init (lame_t gfp); - -/* force addition of version 2 tag */ -void CDECL id3tag_add_v2 (lame_t gfp); - -/* add only a version 1 tag */ -void CDECL id3tag_v1_only (lame_t gfp); - -/* add only a version 2 tag */ -void CDECL id3tag_v2_only (lame_t gfp); - -/* pad version 1 tag with spaces instead of nulls */ -void CDECL id3tag_space_v1 (lame_t gfp); - -/* pad version 2 tag with extra 128 bytes */ -void CDECL id3tag_pad_v2 (lame_t gfp); - -/* pad version 2 tag with extra n bytes */ -void CDECL id3tag_set_pad (lame_t gfp, size_t n); - -void CDECL id3tag_set_title(lame_t gfp, const char* title); -void CDECL id3tag_set_artist(lame_t gfp, const char* artist); -void CDECL id3tag_set_album(lame_t gfp, const char* album); -void CDECL id3tag_set_year(lame_t gfp, const char* year); -void CDECL id3tag_set_comment(lame_t gfp, const char* comment); - -/* return -1 result if track number is out of ID3v1 range - and ignored for ID3v1 */ -int CDECL id3tag_set_track(lame_t gfp, const char* track); - -/* return non-zero result if genre name or number is invalid - result 0: OK - result -1: genre number out of range - result -2: no valid ID3v1 genre name, mapped to ID3v1 'Other' - but taken as-is for ID3v2 genre tag */ -int CDECL id3tag_set_genre(lame_t gfp, const char* genre); - -/* return non-zero result if field name is invalid */ -int CDECL id3tag_set_fieldvalue(lame_t gfp, const char* fieldvalue); - -/* return non-zero result if image type is invalid */ -int CDECL id3tag_set_albumart(lame_t gfp, const char* image, size_t size); - -/* lame_get_id3v1_tag copies ID3v1 tag into buffer. - * Function returns number of bytes copied into buffer, or number - * of bytes rquired if buffer 'size' is too small. - * Function fails, if returned value is larger than 'size'. - * NOTE: - * This functions does nothing, if user/LAME disabled ID3v1 tag. - */ -size_t CDECL lame_get_id3v1_tag(lame_t gfp, unsigned char* buffer, size_t size); - -/* lame_get_id3v2_tag copies ID3v2 tag into buffer. - * Function returns number of bytes copied into buffer, or number - * of bytes rquired if buffer 'size' is too small. - * Function fails, if returned value is larger than 'size'. - * NOTE: - * This functions does nothing, if user/LAME disabled ID3v2 tag. - */ -size_t CDECL lame_get_id3v2_tag(lame_t gfp, unsigned char* buffer, size_t size); - -/* normaly lame_init_param writes ID3v2 tags into the audio stream - * Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param - * to turn off this behaviour and get ID3v2 tag with above function - * write it yourself into your file. - */ -void CDECL lame_set_write_id3tag_automatic(lame_global_flags * gfp, int); -int CDECL lame_get_write_id3tag_automatic(lame_global_flags const* gfp); - -/* experimental */ -int CDECL id3tag_set_textinfo_latin1(lame_global_flags * gfp, char const *id, char const *text); - -/* experimental */ -int CDECL id3tag_set_comment_latin1(lame_global_flags * gfp, - char const *lang, char const *desc, char const *text); - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -#else -/* experimental */ -int CDECL id3tag_set_textinfo_ucs2(lame_global_flags * gfp, - char const *id, unsigned short const *text); - -/* experimental */ -int CDECL id3tag_set_comment_ucs2(lame_global_flags * gfp, - char const *lang, - unsigned short const *desc, unsigned short const *text); - -/* experimental */ -int CDECL id3tag_set_fieldvalue_ucs2(lame_t gfp, const unsigned short *fieldvalue); -#endif - -/* experimental */ -int CDECL id3tag_set_fieldvalue_utf16(lame_t gfp, const unsigned short *fieldvalue); - -/* experimental */ -int CDECL id3tag_set_textinfo_utf16(lame_global_flags * gfp, - char const *id, unsigned short const *text); - -/* experimental */ -int CDECL id3tag_set_comment_utf16(lame_global_flags * gfp, - char const *lang, - unsigned short const *desc, unsigned short const *text); - - -/*********************************************************************** -* -* list of valid bitrates [kbps] & sample frequencies [Hz]. -* first index: 0: MPEG-2 values (sample frequencies 16...24 kHz) -* 1: MPEG-1 values (sample frequencies 32...48 kHz) -* 2: MPEG-2.5 values (sample frequencies 8...12 kHz) -***********************************************************************/ - -extern const int bitrate_table [3][16]; -extern const int samplerate_table [3][ 4]; - -/* access functions for use in DLL, global vars are not exported */ -int CDECL lame_get_bitrate(int mpeg_version, int table_index); -int CDECL lame_get_samplerate(int mpeg_version, int table_index); - - -/* maximum size of albumart image (128KB), which affects LAME_MAXMP3BUFFER - as well since lame_encode_buffer() also returns ID3v2 tag data */ -#define LAME_MAXALBUMART (128 * 1024) - -/* maximum size of mp3buffer needed if you encode at most 1152 samples for - each call to lame_encode_buffer. see lame_encode_buffer() below - (LAME_MAXMP3BUFFER is now obsolete) */ -#define LAME_MAXMP3BUFFER (16384 + LAME_MAXALBUMART) - - -typedef enum { - LAME_OKAY = 0, - LAME_NOERROR = 0, - LAME_GENERICERROR = -1, - LAME_NOMEM = -10, - LAME_BADBITRATE = -11, - LAME_BADSAMPFREQ = -12, - LAME_INTERNALERROR = -13, - - FRONTEND_READERROR = -80, - FRONTEND_WRITEERROR = -81, - FRONTEND_FILETOOLARGE = -82 - -} lame_errorcodes_t; - -#if defined(__cplusplus) -} -#endif -#endif /* LAME_LAME_H */ - diff --git a/src/lib/dl/ext/lame/lame_global_flags.h b/src/lib/dl/ext/lame/lame_global_flags.h deleted file mode 100755 index ad9e677d..00000000 --- a/src/lib/dl/ext/lame/lame_global_flags.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef LAME_GLOBAL_FLAGS_H -#define LAME_GLOBAL_FLAGS_H - -#ifndef lame_internal_flags_defined -#define lame_internal_flags_defined -struct lame_internal_flags; -typedef struct lame_internal_flags lame_internal_flags; -#endif - - -typedef enum short_block_e { - short_block_not_set = -1, /* allow LAME to decide */ - short_block_allowed = 0, /* LAME may use them, even different block types for L/R */ - short_block_coupled, /* LAME may use them, but always same block types in L/R */ - short_block_dispensed, /* LAME will not use short blocks, long blocks only */ - short_block_forced /* LAME will not use long blocks, short blocks only */ -} short_block_t; - -/*********************************************************************** -* -* Control Parameters set by User. These parameters are here for -* backwards compatibility with the old, non-shared lib API. -* Please use the lame_set_variablename() functions below -* -* -***********************************************************************/ -struct lame_global_struct { - unsigned int class_id; - - /* input description */ - unsigned long num_samples; /* number of samples. default=2^32-1 */ - int num_channels; /* input number of channels. default=2 */ - int samplerate_in; /* input_samp_rate in Hz. default=44.1 kHz */ - int samplerate_out; /* output_samp_rate. - default: LAME picks best value - at least not used for MP3 decoding: - Remember 44.1 kHz MP3s and AC97 */ - float scale; /* scale input by this amount before encoding - at least not used for MP3 decoding */ - float scale_left; /* scale input of channel 0 (left) by this - amount before encoding */ - float scale_right; /* scale input of channel 1 (right) by this - amount before encoding */ - - /* general control params */ - int analysis; /* collect data for a MP3 frame analyzer? */ - int write_lame_tag; /* add Xing VBR tag? */ - int decode_only; /* use lame/mpglib to convert mp3 to wav */ - int quality; /* quality setting 0=best, 9=worst default=5 */ - MPEG_mode mode; /* see enum in lame.h - default = LAME picks best value */ - int force_ms; /* force M/S mode. requires mode=1 */ - int free_format; /* use free format? default=0 */ - int findReplayGain; /* find the RG value? default=0 */ - int decode_on_the_fly; /* decode on the fly? default=0 */ - int write_id3tag_automatic; /* 1 (default) writes ID3 tags, 0 not */ - - int nogap_total; - int nogap_current; - - int substep_shaping; - int noise_shaping; - int subblock_gain; /* 0 = no, 1 = yes */ - int use_best_huffman; /* 0 = no. 1=outside loop 2=inside loop(slow) */ - - /* - * set either brate>0 or compression_ratio>0, LAME will compute - * the value of the variable not set. - * Default is compression_ratio = 11.025 - */ - int brate; /* bitrate */ - float compression_ratio; /* sizeof(wav file)/sizeof(mp3 file) */ - - - /* frame params */ - int copyright; /* mark as copyright. default=0 */ - int original; /* mark as original. default=1 */ - int extension; /* the MP3 'private extension' bit. - Meaningless */ - int emphasis; /* Input PCM is emphased PCM (for - instance from one of the rarely - emphased CDs), it is STRONGLY not - recommended to use this, because - psycho does not take it into account, - and last but not least many decoders - don't care about these bits */ - int error_protection; /* use 2 bytes per frame for a CRC - checksum. default=0 */ - int strict_ISO; /* enforce ISO spec as much as possible */ - - int disable_reservoir; /* use bit reservoir? */ - - /* quantization/noise shaping */ - int quant_comp; - int quant_comp_short; - int experimentalY; - int experimentalZ; - int exp_nspsytune; - - int preset; - - /* VBR control */ - vbr_mode VBR; - float VBR_q_frac; /* Range [0,...,1[ */ - int VBR_q; /* Range [0,...,9] */ - int VBR_mean_bitrate_kbps; - int VBR_min_bitrate_kbps; - int VBR_max_bitrate_kbps; - int VBR_hard_min; /* strictly enforce VBR_min_bitrate - normaly, it will be violated for analog - silence */ - - - /* resampling and filtering */ - int lowpassfreq; /* freq in Hz. 0=lame choses. - -1=no filter */ - int highpassfreq; /* freq in Hz. 0=lame choses. - -1=no filter */ - int lowpasswidth; /* freq width of filter, in Hz - (default=15%) */ - int highpasswidth; /* freq width of filter, in Hz - (default=15%) */ - - - - /* - * psycho acoustics and other arguments which you should not change - * unless you know what you are doing - */ - float maskingadjust; - float maskingadjust_short; - int ATHonly; /* only use ATH */ - int ATHshort; /* only use ATH for short blocks */ - int noATH; /* disable ATH */ - int ATHtype; /* select ATH formula */ - float ATHcurve; /* change ATH formula 4 shape */ - float ATH_lower_db; /* lower ATH by this many db */ - int athaa_type; /* select ATH auto-adjust scheme */ - float athaa_sensitivity; /* dB, tune active region of auto-level */ - short_block_t short_blocks; - int useTemporal; /* use temporal masking effect */ - float interChRatio; - float msfix; /* Naoki's adjustment of Mid/Side maskings */ - - int tune; /* 0 off, 1 on */ - float tune_value_a; /* used to pass values for debugging and stuff */ - - float attackthre; /* attack threshold for L/R/M channel */ - float attackthre_s; /* attack threshold for S channel */ - - - struct { - void (*msgf) (const char *format, va_list ap); - void (*debugf) (const char *format, va_list ap); - void (*errorf) (const char *format, va_list ap); - } report; - - /************************************************************************/ - /* internal variables, do not set... */ - /* provided because they may be of use to calling application */ - /************************************************************************/ - - int lame_allocated_gfp; /* is this struct owned by calling - program or lame? */ - - - - /**************************************************************************/ - /* more internal variables are stored in this structure: */ - /**************************************************************************/ - lame_internal_flags *internal_flags; - - - struct { - int mmx; - int amd3dnow; - int sse; - - } asm_optimizations; -}; - -int is_lame_global_flags_valid(const lame_global_flags * gfp); - -#endif /* LAME_GLOBAL_FLAGS_H */ diff --git a/src/lib/dl/ext/lame/lame_main.c b/src/lib/dl/ext/lame/lame_main.c deleted file mode 100755 index a23452db..00000000 --- a/src/lib/dl/ext/lame/lame_main.c +++ /dev/null @@ -1,729 +0,0 @@ -/* - * Command line frontend program - * - * Copyright (c) 1999 Mark Taylor - * 2000 Takehiro TOMINAGA - * 2010-2011 Robert Hegemann - * - * 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. - */ - -/* $Id: lame_main.c,v 1.9.2.1 2011/11/18 08:38:04 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <stdio.h> - -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <string.h> -#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 - -#ifdef HAVE_FCNTL_H -# include <fcntl.h> -#endif - -#ifdef __sun__ -/* woraround for SunOS 4.x, it has SEEK_* defined here */ -#include <unistd.h> -#endif - -#if defined(_WIN32) -# include <windows.h> -#endif - - -/* - main.c is example code for how to use libmp3lame.a. To use this library, - you only need the library and lame.h. All other .h files are private - to the library. -*/ -#include "lame.h" - -#include "console.h" -#include "parse.h" -#include "main.h" -#include "get_audio.h" -#include "timestatus.h" - -/* PLL 14/04/2000 */ -#if macintosh -#include <console.h> -#endif - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - - - - -/************************************************************************ -* -* main -* -* PURPOSE: MPEG-1,2 Layer III encoder with GPSYCHO -* psychoacoustic model. -* -************************************************************************/ - - -static int -parse_args_from_string(lame_global_flags * const gfp, const char *p, char *inPath, char *outPath) -{ /* Quick & very Dirty */ - char *q; - char *f; - char *r[128]; - int c = 0; - int ret; - - if (p == NULL || *p == '\0') - return 0; - - f = q = malloc(strlen(p) + 1); - strcpy(q, p); - - r[c++] = "lhama"; - for (;;) { - r[c++] = q; - while (*q != ' ' && *q != '\0') - q++; - if (*q == '\0') - break; - *q++ = '\0'; - } - r[c] = NULL; - - ret = parse_args(gfp, c, r, inPath, outPath, NULL, NULL); - free(f); - return ret; -} - - - - - -static FILE * -init_files(lame_global_flags * gf, char const *inPath, char const *outPath) -{ - FILE *outf; - /* Mostly it is not useful to use the same input and output name. - This test is very easy and buggy and don't recognize different names - assigning the same file - */ - if (0 != strcmp("-", outPath) && 0 == strcmp(inPath, outPath)) { - error_printf("Input file and Output file are the same. Abort.\n"); - return NULL; - } - - /* open the wav/aiff/raw pcm or mp3 input file. This call will - * open the file, try to parse the headers and - * set gf.samplerate, gf.num_channels, gf.num_samples. - * if you want to do your own file input, skip this call and set - * samplerate, num_channels and num_samples yourself. - */ - if (init_infile(gf, inPath) < 0) { - error_printf("Can't init infile '%s'\n", inPath); - return NULL; - } - if ((outf = init_outfile(outPath, lame_get_decode_only(gf))) == NULL) { - error_printf("Can't init outfile '%s'\n", outPath); - return NULL; - } - - return outf; -} - - -static void -printInputFormat(lame_t gfp) -{ - int const v_main = 2 - lame_get_version(gfp); - char const *v_ex = lame_get_out_samplerate(gfp) < 16000 ? ".5" : ""; - switch (global_reader.input_format) { - case sf_mp123: /* FIXME: !!! */ - break; - case sf_mp3: - console_printf("MPEG-%u%s Layer %s", v_main, v_ex, "III"); - break; - case sf_mp2: - console_printf("MPEG-%u%s Layer %s", v_main, v_ex, "II"); - break; - case sf_mp1: - console_printf("MPEG-%u%s Layer %s", v_main, v_ex, "I"); - break; - case sf_raw: - console_printf("raw PCM data"); - break; - case sf_wave: - console_printf("Microsoft WAVE"); - break; - case sf_aiff: - console_printf("SGI/Apple AIFF"); - break; - default: - console_printf("unknown"); - break; - } -} - -/* the simple lame decoder */ -/* After calling lame_init(), lame_init_params() and - * init_infile(), call this routine to read the input MP3 file - * and output .wav data to the specified file pointer*/ -/* lame_decoder will ignore the first 528 samples, since these samples - * represent the mpglib delay (and are all 0). skip = number of additional - * samples to skip, to (for example) compensate for the encoder delay */ - -static int -lame_decoder(lame_t gfp, FILE * outf, char *inPath, char *outPath) -{ - short int Buffer[2][1152]; - int i, iread; - double wavsize; - int tmp_num_channels = lame_get_num_channels(gfp); - int skip_start = samples_to_skip_at_start(); - int skip_end = samples_to_skip_at_end(); - DecoderProgress dp = 0; - - if (!(tmp_num_channels >= 1 && tmp_num_channels <= 2)) { - error_printf("Internal error. Aborting."); - exit(-1); - } - - if (global_ui_config.silent < 9) { - console_printf("\rinput: %s%s(%g kHz, %i channel%s, ", - strcmp(inPath, "-") ? inPath : "<stdin>", - strlen(inPath) > 26 ? "\n\t" : " ", - lame_get_in_samplerate(gfp) / 1.e3, - tmp_num_channels, tmp_num_channels != 1 ? "s" : ""); - - printInputFormat(gfp); - - console_printf(")\noutput: %s%s(16 bit, Microsoft WAVE)\n", - strcmp(outPath, "-") ? outPath : "<stdout>", - strlen(outPath) > 45 ? "\n\t" : " "); - - if (skip_start > 0) - console_printf("skipping initial %i samples (encoder+decoder delay)\n", skip_start); - if (skip_end > 0) - console_printf("skipping final %i samples (encoder padding-decoder delay)\n", skip_end); - - switch (global_reader.input_format) { - case sf_mp3: - case sf_mp2: - case sf_mp1: - dp = decoder_progress_init(lame_get_num_samples(gfp), - global_decoder.mp3input_data.framesize); - break; - case sf_raw: - case sf_wave: - case sf_aiff: - default: - dp = decoder_progress_init(lame_get_num_samples(gfp), - lame_get_in_samplerate(gfp) < 32000 ? 576 : 1152); - break; - } - } - - if (0 == global_decoder.disable_wav_header) - WriteWaveHeader(outf, 0x7FFFFFFF, lame_get_in_samplerate(gfp), tmp_num_channels, 16); - /* unknown size, so write maximum 32 bit signed value */ - - wavsize = 0; - do { - iread = get_audio16(gfp, Buffer); /* read in 'iread' samples */ - if (iread >= 0) { - wavsize += iread; - if (dp != 0) { - decoder_progress(dp, &global_decoder.mp3input_data, iread); - } - put_audio16(outf, Buffer, iread, tmp_num_channels); - } - } while (iread > 0); - - i = (16 / 8) * tmp_num_channels; - assert(i > 0); - if (wavsize <= 0) { - if (global_ui_config.silent < 10) - error_printf("WAVE file contains 0 PCM samples\n"); - wavsize = 0; - } - else if (wavsize > 0xFFFFFFD0 / i) { - if (global_ui_config.silent < 10) - error_printf("Very huge WAVE file, can't set filesize accordingly\n"); - wavsize = 0xFFFFFFD0; - } - else { - wavsize *= i; - } - /* if outf is seekable, rewind and adjust length */ - if (!global_decoder.disable_wav_header && strcmp("-", outPath) - && !fseek(outf, 0l, SEEK_SET)) - WriteWaveHeader(outf, (int) wavsize, lame_get_in_samplerate(gfp), tmp_num_channels, 16); - fclose(outf); - close_infile(); - - if (dp != 0) - decoder_progress_finish(dp); - return 0; -} - - - -static void -print_trailing_info(lame_global_flags * gf) -{ - if (lame_get_findReplayGain(gf)) { - int RadioGain = lame_get_RadioGain(gf); - console_printf("ReplayGain: %s%.1fdB\n", RadioGain > 0 ? "+" : "", - ((float) RadioGain) / 10.0); - if (RadioGain > 0x1FE || RadioGain < -0x1FE) - error_printf - ("WARNING: ReplayGain exceeds the -51dB to +51dB range. Such a result is too\n" - " high to be stored in the header.\n"); - } - - /* if (the user requested printing info about clipping) and (decoding - on the fly has actually been performed) */ - if (global_ui_config.print_clipping_info && lame_get_decode_on_the_fly(gf)) { - float noclipGainChange = (float) lame_get_noclipGainChange(gf) / 10.0f; - float noclipScale = lame_get_noclipScale(gf); - - if (noclipGainChange > 0.0) { /* clipping occurs */ - console_printf - ("WARNING: clipping occurs at the current gain. Set your decoder to decrease\n" - " the gain by at least %.1fdB or encode again ", noclipGainChange); - - /* advice the user on the scale factor */ - if (noclipScale > 0) { - console_printf("using --scale %.2f\n", noclipScale); - console_printf(" or less (the value under --scale is approximate).\n"); - } - else { - /* the user specified his own scale factor. We could suggest - * the scale factor of (32767.0/gfp->PeakSample)*(gfp->scale) - * but it's usually very inaccurate. So we'd rather advice him to - * disable scaling first and see our suggestion on the scale factor then. */ - console_printf("using --scale <arg>\n" - " (For a suggestion on the optimal value of <arg> encode\n" - " with --scale 1 first)\n"); - } - - } - else { /* no clipping */ - if (noclipGainChange > -0.1) - console_printf - ("\nThe waveform does not clip and is less than 0.1dB away from full scale.\n"); - else - console_printf - ("\nThe waveform does not clip and is at least %.1fdB away from full scale.\n", - -noclipGainChange); - } - } - -} - - -static int -write_xing_frame(lame_global_flags * gf, FILE * outf, size_t offset) -{ - unsigned char mp3buffer[LAME_MAXMP3BUFFER]; - size_t imp3, owrite; - - imp3 = lame_get_lametag_frame(gf, mp3buffer, sizeof(mp3buffer)); - if (imp3 == 0) { - return 0; /* nothing to do */ - } - if (global_ui_config.silent <= 0) { - console_printf("Writing LAME Tag..."); - } - if (imp3 > sizeof(mp3buffer)) { - error_printf - ("Error writing LAME-tag frame: buffer too small: buffer size=%d frame size=%d\n", - sizeof(mp3buffer), imp3); - return -1; - } - if (fseek(outf, offset, SEEK_SET) != 0) { - error_printf("fatal error: can't update LAME-tag frame!\n"); - return -1; - } - owrite = (int) fwrite(mp3buffer, 1, imp3, outf); - if (owrite != imp3) { - error_printf("Error writing LAME-tag \n"); - return -1; - } - if (global_ui_config.silent <= 0) { - console_printf("done\n"); - } - return imp3; -} - - -static int -write_id3v1_tag(lame_t gf, FILE * outf) -{ - unsigned char mp3buffer[128]; - int imp3, owrite; - - imp3 = lame_get_id3v1_tag(gf, mp3buffer, sizeof(mp3buffer)); - if (imp3 <= 0) { - return 0; - } - if ((size_t) imp3 > sizeof(mp3buffer)) { - error_printf("Error writing ID3v1 tag: buffer too small: buffer size=%d ID3v1 size=%d\n", - sizeof(mp3buffer), imp3); - return 0; /* not critical */ - } - owrite = (int) fwrite(mp3buffer, 1, imp3, outf); - if (owrite != imp3) { - error_printf("Error writing ID3v1 tag \n"); - return 1; - } - return 0; -} - - -static int -lame_encoder_loop(lame_global_flags * gf, FILE * outf, int nogap, char *inPath, char *outPath) -{ - unsigned char mp3buffer[LAME_MAXMP3BUFFER]; - int Buffer[2][1152]; - int iread, imp3, owrite; - size_t id3v2_size; - - encoder_progress_begin(gf, inPath, outPath); - - id3v2_size = lame_get_id3v2_tag(gf, 0, 0); - if (id3v2_size > 0) { - unsigned char *id3v2tag = malloc(id3v2_size); - if (id3v2tag != 0) { - imp3 = lame_get_id3v2_tag(gf, id3v2tag, id3v2_size); - owrite = (int) fwrite(id3v2tag, 1, imp3, outf); - free(id3v2tag); - if (owrite != imp3) { - encoder_progress_end(gf); - error_printf("Error writing ID3v2 tag \n"); - return 1; - } - } - } - else { - unsigned char* id3v2tag = getOldTag(gf); - id3v2_size = sizeOfOldTag(gf); - if ( id3v2_size > 0 ) { - size_t owrite = fwrite(id3v2tag, 1, id3v2_size, outf); - if (owrite != id3v2_size) { - encoder_progress_end(gf); - error_printf("Error writing ID3v2 tag \n"); - return 1; - } - } - } - if (global_writer.flush_write == 1) { - fflush(outf); - } - - /* encode until we hit eof */ - do { - /* read in 'iread' samples */ - iread = get_audio(gf, Buffer); - - if (iread >= 0) { - encoder_progress(gf); - - /* encode */ - imp3 = 0; - imp3 = lame_encode_buffer_int(gf, Buffer[0], Buffer[1], iread, - mp3buffer, sizeof(mp3buffer)); - - /* was our output buffer big enough? */ - if (imp3 < 0) { - if (imp3 == -1) - error_printf("mp3 buffer is not big enough... \n"); - else - error_printf("mp3 internal error: error code=%i\n", imp3); - return 1; - } - owrite = (int) fwrite(mp3buffer, 1, imp3, outf); - if (owrite != imp3) { - error_printf("Error writing mp3 output \n"); - return 1; - } - } - if (global_writer.flush_write == 1) { - fflush(outf); - } - } while (iread > 0); - - if (nogap) - imp3 = lame_encode_flush_nogap(gf, mp3buffer, sizeof(mp3buffer)); /* may return one more mp3 frame */ - else - imp3 = lame_encode_flush(gf, mp3buffer, sizeof(mp3buffer)); /* may return one more mp3 frame */ - - if (imp3 < 0) { - if (imp3 == -1) - error_printf("mp3 buffer is not big enough... \n"); - else - error_printf("mp3 internal error: error code=%i\n", imp3); - return 1; - - } - - encoder_progress_end(gf); - - owrite = (int) fwrite(mp3buffer, 1, imp3, outf); - if (owrite != imp3) { - error_printf("Error writing mp3 output \n"); - return 1; - } - if (global_writer.flush_write == 1) { - fflush(outf); - } - imp3 = write_id3v1_tag(gf, outf); - if (global_writer.flush_write == 1) { - fflush(outf); - } - if (imp3) { - return 1; - } - write_xing_frame(gf, outf, id3v2_size); - if (global_writer.flush_write == 1) { - fflush(outf); - } - if (global_ui_config.silent <= 0) { - print_trailing_info(gf); - } - return 0; -} - - -static int -lame_encoder(lame_global_flags * gf, FILE * outf, int nogap, char *inPath, char *outPath) -{ - int ret; - - ret = lame_encoder_loop(gf, outf, nogap, inPath, outPath); - fclose(outf); /* close the output file */ - close_infile(); /* close the input file */ - return ret; -} - - -static void -parse_nogap_filenames(int nogapout, char const *inPath, char *outPath, char *outdir) -{ - char const *slasher; - size_t n; - - /* FIXME: replace strcpy by safer strncpy */ - strcpy(outPath, outdir); - if (!nogapout) { - strncpy(outPath, inPath, PATH_MAX + 1 - 4); - n = strlen(outPath); - /* nuke old extension, if one */ - if (outPath[n - 3] == 'w' - && outPath[n - 2] == 'a' && outPath[n - 1] == 'v' && outPath[n - 4] == '.') { - outPath[n - 3] = 'm'; - outPath[n - 2] = 'p'; - outPath[n - 1] = '3'; - } - else { - outPath[n + 0] = '.'; - outPath[n + 1] = 'm'; - outPath[n + 2] = 'p'; - outPath[n + 3] = '3'; - outPath[n + 4] = 0; - } - } - else { - slasher = inPath; - slasher += PATH_MAX + 1 - 4; - - /* backseek to last dir delemiter */ - while (*slasher != '/' && *slasher != '\\' && slasher != inPath && *slasher != ':') { - slasher--; - } - - /* skip one foward if needed */ - if (slasher != inPath - && (outPath[strlen(outPath) - 1] == '/' - || outPath[strlen(outPath) - 1] == '\\' || outPath[strlen(outPath) - 1] == ':')) - slasher++; - else if (slasher == inPath - && (outPath[strlen(outPath) - 1] != '/' - && - outPath[strlen(outPath) - 1] != '\\' && outPath[strlen(outPath) - 1] != ':')) - /* FIXME: replace strcat by safer strncat */ -#ifdef _WIN32 - strncat(outPath, "\\", PATH_MAX + 1 - 4); -#elif __OS2__ - strncat(outPath, "\\", PATH_MAX + 1 - 4); -#else - strncat(outPath, "/", PATH_MAX + 1 - 4); -#endif - - strncat(outPath, slasher, PATH_MAX + 1 - 4); - n = strlen(outPath); - /* nuke old extension */ - if (outPath[n - 3] == 'w' - && outPath[n - 2] == 'a' && outPath[n - 1] == 'v' && outPath[n - 4] == '.') { - outPath[n - 3] = 'm'; - outPath[n - 2] = 'p'; - outPath[n - 1] = '3'; - } - else { - outPath[n + 0] = '.'; - outPath[n + 1] = 'm'; - outPath[n + 2] = 'p'; - outPath[n + 3] = '3'; - outPath[n + 4] = 0; - } - } -} - - -int -lame_main(lame_t gf, int argc, char **argv) -{ - char inPath[PATH_MAX + 1]; - char outPath[PATH_MAX + 1]; - char nogapdir[PATH_MAX + 1]; - /* support for "nogap" encoding of up to 200 .wav files */ -#define MAX_NOGAP 200 - int nogapout = 0; - int max_nogap = MAX_NOGAP; - char nogap_inPath_[MAX_NOGAP][PATH_MAX + 1]; - char *nogap_inPath[MAX_NOGAP]; - - int ret; - int i; - FILE *outf; - - lame_set_msgf(gf, &frontend_msgf); - lame_set_errorf(gf, &frontend_errorf); - lame_set_debugf(gf, &frontend_debugf); - if (argc <= 1) { - usage(stderr, argv[0]); /* no command-line args, print usage, exit */ - return 1; - } - - memset(inPath, 0, sizeof(inPath)); - memset(nogap_inPath_, 0, sizeof(nogap_inPath_)); - for (i = 0; i < MAX_NOGAP; ++i) { - nogap_inPath[i] = &nogap_inPath_[i][0]; - } - - /* parse the command line arguments, setting various flags in the - * struct 'gf'. If you want to parse your own arguments, - * or call libmp3lame from a program which uses a GUI to set arguments, - * skip this call and set the values of interest in the gf struct. - * (see the file API and lame.h for documentation about these parameters) - */ - { - char *str = lame_getenv("LAMEOPT"); - parse_args_from_string(gf, str, inPath, outPath); - free(str); - } - ret = parse_args(gf, argc, argv, inPath, outPath, nogap_inPath, &max_nogap); - if (ret < 0) { - return ret == -2 ? 0 : 1; - } - if (global_ui_config.update_interval < 0.) - global_ui_config.update_interval = 2.; - - if (outPath[0] != '\0' && max_nogap > 0) { - strncpy(nogapdir, outPath, PATH_MAX + 1); - nogapout = 1; - } - - /* initialize input file. This also sets samplerate and as much - other data on the input file as available in the headers */ - if (max_nogap > 0) { - /* for nogap encoding of multiple input files, it is not possible to - * specify the output file name, only an optional output directory. */ - parse_nogap_filenames(nogapout, nogap_inPath[0], outPath, nogapdir); - outf = init_files(gf, nogap_inPath[0], outPath); - } - else { - outf = init_files(gf, inPath, outPath); - } - if (outf == NULL) { - return -1; - } - /* turn off automatic writing of ID3 tag data into mp3 stream - * we have to call it before 'lame_init_params', because that - * function would spit out ID3v2 tag data. - */ - lame_set_write_id3tag_automatic(gf, 0); - - /* Now that all the options are set, lame needs to analyze them and - * set some more internal options and check for problems - */ - ret = lame_init_params(gf); - if (ret < 0) { - if (ret == -1) { - display_bitrates(stderr); - } - error_printf("fatal error during initialization\n"); - return ret; - } - - if (global_ui_config.silent > 0) { - global_ui_config.brhist = 0; /* turn off VBR histogram */ - } - - if (lame_get_decode_only(gf)) { - /* decode an mp3 file to a .wav */ - ret = lame_decoder(gf, outf, inPath, outPath); - } - else if (max_nogap == 0) { - /* encode a single input file */ - ret = lame_encoder(gf, outf, 0, inPath, outPath); - } - else { - /* encode multiple input files using nogap option */ - for (i = 0; i < max_nogap; ++i) { - int use_flush_nogap = (i != (max_nogap - 1)); - if (i > 0) { - parse_nogap_filenames(nogapout, nogap_inPath[i], outPath, nogapdir); - /* note: if init_files changes anything, like - samplerate, num_channels, etc, we are screwed */ - outf = init_files(gf, nogap_inPath[i], outPath); - /* reinitialize bitstream for next encoding. this is normally done - * by lame_init_params(), but we cannot call that routine twice */ - lame_init_bitstream(gf); - } - lame_set_nogap_total(gf, max_nogap); - lame_set_nogap_currentindex(gf, i); - ret = lame_encoder(gf, outf, use_flush_nogap, nogap_inPath[i], outPath); - } - } - return ret; -} diff --git a/src/lib/dl/ext/lame/lameerror.h b/src/lib/dl/ext/lame/lameerror.h deleted file mode 100755 index 7d9216bc..00000000 --- a/src/lib/dl/ext/lame/lameerror.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * A collection of LAME Error Codes - * - * Please use the constants defined here instead of some arbitrary - * values. Currently the values starting at -10 to avoid intersection - * with the -1, -2, -3 and -4 used in the current code. - * - * May be this should be a part of the include/lame.h. - */ - -typedef enum { - LAME_OKAY = 0, - LAME_NOERROR = 0, - LAME_GENERICERROR = -1, - LAME_NOMEM = -10, - LAME_BADBITRATE = -11, - LAME_BADSAMPFREQ = -12, - LAME_INTERNALERROR = -13, - - FRONTEND_READERROR = -80, - FRONTEND_WRITEERROR = -81, - FRONTEND_FILETOOLARGE = -82, - -} lame_errorcodes_t; - -/* end of lameerror.h */ diff --git a/src/lib/dl/ext/lame/lametime.c b/src/lib/dl/ext/lame/lametime.c deleted file mode 100755 index f11d2e62..00000000 --- a/src/lib/dl/ext/lame/lametime.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Lame time routines source file - * - * Copyright (c) 2000 Mark Taylor - * - * 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. - */ - -/* $Id: lametime.c,v 1.21 2011/05/07 16:05:17 rbrito Exp $ */ - -/* - * name: GetCPUTime ( void ) - * - * description: returns CPU time used by the process - * input: none - * output: time in seconds - * known bugs: may not work in SMP and RPC - * conforming: ANSI C - * - * There is some old difficult to read code at the end of this file. - * Can someone integrate this into this function (if useful)? - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <stdio.h> -#include <time.h> - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -#include "lametime.h" - -#if !defined(CLOCKS_PER_SEC) -# warning Your system does not define CLOCKS_PER_SEC, guessing one... -# define CLOCKS_PER_SEC 1000000 -#endif - - -double -GetCPUTime(void) -{ - clock_t t; - -#if defined(_MSC_VER) || defined(__BORLANDC__) - t = clock(); -#else - t = clock(); -#endif - return t / (double) CLOCKS_PER_SEC; -} - - -/* - * name: GetRealTime ( void ) - * - * description: returns real (human) time elapsed relative to a fixed time (mostly 1970-01-01 00:00:00) - * input: none - * output: time in seconds - * known bugs: bad precision with time() - */ - -#if defined(__unix__) || defined(SVR4) || defined(BSD) - -# include <sys/time.h> -# include <unistd.h> - -double -GetRealTime(void) -{ /* conforming: SVr4, BSD 4.3 */ - struct timeval t; - - if (0 != gettimeofday(&t, NULL)) - assert(0); - return t.tv_sec + 1.e-6 * t.tv_usec; -} - -#elif defined(WIN16) || defined(WIN32) - -# include <stdio.h> -# include <sys/types.h> -# include <sys/timeb.h> - -double -GetRealTime(void) -{ /* conforming: Win 95, Win NT */ - struct timeb t; - - ftime(&t); - return t.time + 1.e-3 * t.millitm; -} - -#else - -double -GetRealTime(void) -{ /* conforming: SVr4, SVID, POSIX, X/OPEN, BSD 4.3 */ /* BUT NOT GUARANTEED BY ANSI */ - time_t t; - - t = time(NULL); - return (double) t; -} - -#endif - - -#if defined(_WIN32) || defined(__CYGWIN__) -# include <io.h> -# include <fcntl.h> -#else -# include <unistd.h> -#endif - -int -lame_set_stream_binary_mode(FILE * const fp) -{ -#if defined __EMX__ - _fsetmode(fp, "b"); -#elif defined __BORLANDC__ - setmode(_fileno(fp), O_BINARY); -#elif defined __CYGWIN__ - setmode(fileno(fp), _O_BINARY); -#elif defined _WIN32 - _setmode(_fileno(fp), _O_BINARY); -#else - (void) fp; /* doing nothing here, silencing the compiler only. */ -#endif - return 0; -} - - -/* End of lametime.c */ diff --git a/src/lib/dl/ext/lame/lametime.h b/src/lib/dl/ext/lame/lametime.h deleted file mode 100755 index fb4252f6..00000000 --- a/src/lib/dl/ext/lame/lametime.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Lame time routines include file - * - * Copyright (c) 2000 Mark Taylor - * - * 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_LAMETIME_H -#define LAME_LAMETIME_H - -#include <sys/types.h> -#include "lame.h" - -#if defined(__cplusplus) -extern "C" { -#endif - -extern double GetCPUTime(void); -extern double GetRealTime(void); - -extern int lame_set_stream_binary_mode(FILE * const fp); - -#if defined(__cplusplus) -} -#endif - -#endif /* LAME_LAMETIME_H */ diff --git a/src/lib/dl/ext/lame/layer1.c b/src/lib/dl/ext/lame/layer1.c deleted file mode 100755 index 770eec30..00000000 --- a/src/lib/dl/ext/lame/layer1.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * layer1.c: Mpeg Layer-1 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - */ - -/* $Id: layer1.c,v 1.30 2010/03/22 14:30:19 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include "common.h" -#include "decode_i386.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -#include "layer1.h" - -static int gd_are_hip_tables_layer1_initialized = 0; - -void -hip_init_tables_layer1(void) -{ - if (gd_are_hip_tables_layer1_initialized) { - return; - } - gd_are_hip_tables_layer1_initialized = 1; -} - -typedef struct sideinfo_layer_I_struct -{ - unsigned char allocation[SBLIMIT][2]; - unsigned char scalefactor[SBLIMIT][2]; -} sideinfo_layer_I; - -static void -I_step_one(PMPSTR mp, sideinfo_layer_I* si) -{ - struct frame *fr = &(mp->fr); - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : 32; - int i; - memset(si, 0, sizeof(*si)); - assert(fr->stereo == 1 || fr->stereo == 2); - - if (fr->stereo == 2) { - for (i = 0; i < jsbound; i++) { - unsigned char b0 = get_leq_8_bits(mp, 4); /* values 0-15 */ - unsigned char b1 = get_leq_8_bits(mp, 4); /* values 0-15 */ - si->allocation[i][0] = b0; - si->allocation[i][1] = b1; - } - for (i = jsbound; i < SBLIMIT; i++) { - unsigned char b = get_leq_8_bits(mp, 4); /* values 0-15 */ - si->allocation[i][0] = b; - si->allocation[i][1] = b; - } - for (i = 0; i < SBLIMIT; i++) { - unsigned char n0 = si->allocation[i][0]; - unsigned char n1 = si->allocation[i][1]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 6) : 0; /* values 0-63 */ - unsigned char b1 = n1 ? get_leq_8_bits(mp, 6) : 0; /* values 0-63 */ - si->scalefactor[i][0] = b0; - si->scalefactor[i][1] = b1; - } - } - else { - for (i = 0; i < SBLIMIT; i++) { - unsigned char b0 = get_leq_8_bits(mp, 4); /* values 0-15 */ - si->allocation[i][0] = b0; - } - for (i = 0; i < SBLIMIT; i++) { - unsigned char n0 = si->allocation[i][0]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 6) : 0; /* values 0-63 */ - si->scalefactor[i][0] = b0; - } - } -} - -static void -I_step_two(PMPSTR mp, sideinfo_layer_I *si, real fraction[2][SBLIMIT]) -{ - double r0, r1; - struct frame *fr = &(mp->fr); - int ds_limit = fr->down_sample_sblimit; - int i; - - assert(fr->stereo == 1 || fr->stereo == 2); - if (fr->stereo == 2) { - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : 32; - for (i = 0; i < jsbound; i++) { - unsigned char i0 = si->scalefactor[i][0]; - unsigned char i1 = si->scalefactor[i][1]; - unsigned char n0 = si->allocation[i][0]; - unsigned char n1 = si->allocation[i][1]; - assert( i0 < 64 ); - assert( i1 < 64 ); - assert( n0 < 16 ); - assert( n1 < 16 ); - if (n0 > 0) { - unsigned short v = get_leq_16_bits(mp, n0 + 1); /* 0-65535 */ - r0 = (((-1) << n0) + v + 1) * muls[n0 + 1][i0]; - } - else { - r0 = 0; - } - if (n1 > 0) { - unsigned short v = get_leq_16_bits(mp, n1 + 1); /* 0-65535 */ - r1 = (((-1) << n1) + v + 1) * muls[n1 + 1][i1]; - } - else { - r1 = 0; - } - fraction[0][i] = (real)r0; - fraction[1][i] = (real)r1; - } - for (i = jsbound; i < SBLIMIT; i++) { - unsigned char i0 = si->scalefactor[i][0]; - unsigned char i1 = si->scalefactor[i][1]; - unsigned char n = si->allocation[i][0]; - assert( i0 < 64 ); - assert( i1 < 64 ); - assert( n < 16 ); - if (n > 0) { - unsigned short v = get_leq_16_bits(mp, n + 1); /* 0-65535 */ - unsigned int w = (((-1) << n) + v + 1); - r0 = w * muls[n + 1][i0]; - r1 = w * muls[n + 1][i1]; - } - else { - r0 = r1 = 0; - } - fraction[0][i] = (real)r0; - fraction[1][i] = (real)r1; - } - for (i = ds_limit; i < SBLIMIT; i++) { - fraction[0][i] = 0.0; - fraction[1][i] = 0.0; - } - } - else { - for (i = 0; i < SBLIMIT; i++) { - unsigned char n = si->allocation[i][0]; - unsigned char j = si->scalefactor[i][0]; - assert( j < 64 ); - assert( n < 16 ); - if (n > 0) { - unsigned short v = get_leq_16_bits(mp, n + 1); - r0 = (((-1) << n) + v + 1) * muls[n + 1][j]; - } - else { - r0 = 0; - } - fraction[0][i] = (real)r0; - } - for (i = ds_limit; i < SBLIMIT; i++) { - fraction[0][i] = 0.0; - } - } -} - -int -decode_layer1_sideinfo(PMPSTR mp) -{ - (void) mp; - /* FIXME: extract side information and check values */ - return 0; -} - -int -decode_layer1_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point) -{ - real fraction[2][SBLIMIT]; /* FIXME: change real -> double ? */ - sideinfo_layer_I si; - struct frame *fr = &(mp->fr); - int single = fr->single; - int i, clip = 0; - - I_step_one(mp, &si); - - if (fr->stereo == 1 || single == 3) - single = 0; - - if (single >= 0) { - /* decoding one of possibly two channels */ - for (i = 0; i < SCALE_BLOCK; i++) { - I_step_two(mp, &si, fraction); - clip += synth_1to1_mono(mp, (real *) fraction[single], pcm_sample, pcm_point); - } - } - else { - for (i = 0; i < SCALE_BLOCK; i++) { - int p1 = *pcm_point; - I_step_two(mp, &si, fraction); - 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; -} diff --git a/src/lib/dl/ext/lame/layer1.h b/src/lib/dl/ext/lame/layer1.h deleted file mode 100755 index 308c4379..00000000 --- a/src/lib/dl/ext/lame/layer1.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 LAYER1_H_INCLUDED -#define LAYER1_H_INCLUDED - -void hip_init_tables_layer1(void); -int decode_layer1_sideinfo(PMPSTR mp); -int decode_layer1_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point); - -#endif diff --git a/src/lib/dl/ext/lame/layer2.c b/src/lib/dl/ext/lame/layer2.c deleted file mode 100755 index 442ccfea..00000000 --- a/src/lib/dl/ext/lame/layer2.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * layer2.c: Mpeg Layer-2 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - */ -/* $Id: layer2.c,v 1.32 2011/05/24 20:40:56 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "common.h" -#include "layer2.h" -#include "l2tables.h" -#include "decode_i386.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif -#include <assert.h> - -static int gd_are_hip_tables_layer2_initialized = 0; - -static unsigned char grp_3tab[32 * 3] = { 0, }; /* used: 27 */ -static unsigned char grp_5tab[128 * 3] = { 0, }; /* used: 125 */ -static unsigned char grp_9tab[1024 * 3] = { 0, }; /* used: 729 */ - - -void -hip_init_tables_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 unsigned char 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 unsigned char *itable, *tables[3] = { grp_3tab, grp_5tab, grp_9tab }; - - if (gd_are_hip_tables_layer2_initialized) { - return; - } - gd_are_hip_tables_layer2_initialized = 1; - - for (i = 0; i < 3; i++) { - itable = tables[i]; - len = tablen[i]; - for (j = 0; j < len; j++) - for (k = 0; k < len; k++) - for (l = 0; l < len; l++) { - *itable++ = base[i][l]; - *itable++ = base[i][k]; - *itable++ = base[i][j]; - } - } - - for (k = 0; k < 27; k++) { - double m = mulmul[k]; - table = muls[k]; - for (j = 3, i = 0; i < 63; i++, j--) - *table++ = (real) (m * pow(2.0, (double) j / 3.0)); - *table++ = 0.0; - } -} - - -static unsigned char* -grp_table_select(short d1, unsigned int idx) -{ - /* RH: it seems to be common, that idx is larger than the table's sizes. - is it OK to return a zero vector in this case? FIXME - /*/ - static unsigned char dummy_table[] = { 0,0,0 }; - unsigned int x; - switch (d1) { - case 3: - x = 3*3*3; - idx = idx < x ? idx : x; - return &grp_3tab[3 * idx]; - case 5: - x = 5*5*5; - idx = idx < x ? idx : x; - return &grp_5tab[3 * idx]; - case 9: - x = 9*9*9; - idx = idx < x ? idx : x; - return &grp_9tab[3 * idx]; - default: - /* fatal error */ - assert(0); - } - return &dummy_table[0]; -} - -typedef struct sideinfo_layer_II_struct -{ - unsigned char allocation[SBLIMIT][2]; - unsigned char scalefactor[SBLIMIT][2][3]; /* subband / channel / block */ -} sideinfo_layer_II; - - - -static void -II_step_one(PMPSTR mp, sideinfo_layer_II *si, struct frame *fr) -{ - int nch = fr->stereo; - int sblimit = fr->II_sblimit; - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : fr->II_sblimit; - struct al_table2 const *alloc1 = fr->alloc; - unsigned char scfsi[SBLIMIT][2]; - int i, ch; - - memset(si, 0, sizeof(*si)); - - if (nch == 2) { - for (i = 0; i < jsbound; ++i) { - short step = alloc1->bits; - unsigned char b0 = get_leq_8_bits(mp, step); - unsigned char b1 = get_leq_8_bits(mp, step); - alloc1 += (1 << step); - si->allocation[i][0] = b0; - si->allocation[i][1] = b1; - } - for (i = jsbound; i < sblimit; ++i) { - short step = alloc1->bits; - unsigned char b0 = get_leq_8_bits(mp, step); - alloc1 += (1 << step); - si->allocation[i][0] = b0; - si->allocation[i][1] = b0; - } - for (i = 0; i < sblimit; ++i) { - unsigned char n0 = si->allocation[i][0]; - unsigned char n1 = si->allocation[i][1]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 2) : 0; - unsigned char b1 = n1 ? get_leq_8_bits(mp, 2) : 0; - scfsi[i][0] = b0; - scfsi[i][1] = b1; - } - } - else { /* mono */ - for (i = 0; i < sblimit; ++i) { - short step = alloc1->bits; - unsigned char b0 = get_leq_8_bits(mp, step); - alloc1 += (1 << step); - si->allocation[i][0] = b0; - } - for (i = 0; i < sblimit; ++i) { - unsigned char n0 = si->allocation[i][0]; - unsigned char b0 = n0 ? get_leq_8_bits(mp, 2) : 0; - scfsi[i][0] = b0; - } - } - for (i = 0; i < sblimit; ++i) { - for (ch = 0; ch < nch; ++ch) { - unsigned char s0 = 0, s1 = 0, s2 = 0; - if (si->allocation[i][ch]) { - switch (scfsi[i][ch]) { - case 0: - s0 = get_leq_8_bits(mp, 6); - s1 = get_leq_8_bits(mp, 6); - s2 = get_leq_8_bits(mp, 6); - break; - case 1: - s0 = get_leq_8_bits(mp, 6); - s1 = s0; - s2 = get_leq_8_bits(mp, 6); - break; - case 2: - s0 = get_leq_8_bits(mp, 6); - s1 = s0; - s2 = s0; - break; - case 3: - s0 = get_leq_8_bits(mp, 6); - s1 = get_leq_8_bits(mp, 6); - s2 = s1; - break; - default: - assert(0); - } - } - si->scalefactor[i][ch][0] = s0; - si->scalefactor[i][ch][1] = s1; - si->scalefactor[i][ch][2] = s2; - } - } -} - -static void -II_step_two(PMPSTR mp, sideinfo_layer_II* si, struct frame *fr, int gr, real fraction[2][4][SBLIMIT]) -{ - struct al_table2 const *alloc1 = fr->alloc; - int sblimit = fr->II_sblimit; - int jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext << 2) + 4 : fr->II_sblimit; - int i, ch, nch = fr->stereo; - double cm, r0, r1, r2; - - for (i = 0; i < jsbound; ++i) { - short step = alloc1->bits; - for (ch = 0; ch < nch; ++ch) { - unsigned char ba = si->allocation[i][ch]; - if (ba) { - unsigned char x1 = si->scalefactor[i][ch][gr]; - struct al_table2 const *alloc2 = alloc1 + ba; - short k = alloc2->bits; - short d1 = alloc2->d; - assert( k <= 16 ); - k = (k <= 16) ? k : 16; - assert( x1 < 64 ); - x1 = (x1 < 64) ? x1 : 63; - if (d1 < 0) { - int v0 = getbits(mp, k); - int v1 = getbits(mp, k); - int v2 = getbits(mp, k); - cm = muls[k][x1]; - r0 = (v0 + d1) * cm; - r1 = (v1 + d1) * cm; - r2 = (v2 + d1) * cm; - } - else { - unsigned int idx = getbits(mp, k); - unsigned char *tab = grp_table_select(d1, idx); - unsigned char k0 = tab[0]; - unsigned char k1 = tab[1]; - unsigned char k2 = tab[2]; - r0 = muls[k0][x1]; - r1 = muls[k1][x1]; - r2 = muls[k2][x1]; - } - fraction[ch][0][i] = (real) r0; - fraction[ch][1][i] = (real) r1; - fraction[ch][2][i] = (real) r2; - } - else { - fraction[ch][0][i] = fraction[ch][1][i] = fraction[ch][2][i] = 0.0; - } - } - alloc1 += (1 << step); - } - - for (i = jsbound; i < sblimit; i++) { - short step = alloc1->bits; - unsigned char ba = si->allocation[i][0]; - if (ba) { - struct al_table2 const *alloc2 = alloc1 + ba; - short k = alloc2->bits; - short d1 = alloc2->d; - assert( k <= 16 ); - k = (k <= 16) ? k : 16; - if (d1 < 0) { - int v0 = getbits(mp, k); - int v1 = getbits(mp, k); - int v2 = getbits(mp, k); - for (ch = 0; ch < nch; ++ch) { - unsigned char x1 = si->scalefactor[i][ch][gr]; - assert( x1 < 64 ); - x1 = (x1 < 64) ? x1 : 63; - cm = muls[k][x1]; - r0 = (v0 + d1) * cm; - r1 = (v1 + d1) * cm; - r2 = (v2 + d1) * cm; - fraction[ch][0][i] = (real) r0; - fraction[ch][1][i] = (real) r1; - fraction[ch][2][i] = (real) r2; - } - } - else { - unsigned int idx = getbits(mp, k); - unsigned char *tab = grp_table_select(d1, idx); - unsigned char k0 = tab[0]; - unsigned char k1 = tab[1]; - unsigned char k2 = tab[2]; - for (ch = 0; ch < nch; ++ch) { - unsigned char x1 = si->scalefactor[i][ch][gr]; - assert( x1 < 64 ); - x1 = (x1 < 64) ? x1 : 63; - r0 = muls[k0][x1]; - r1 = muls[k1][x1]; - r2 = muls[k2][x1]; - fraction[ch][0][i] = (real) r0; - fraction[ch][1][i] = (real) r1; - fraction[ch][2][i] = (real) r2; - } - } - } - else { - fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] = 0.0; - fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = 0.0; - } - alloc1 += (1 << step); - } - if (sblimit > fr->down_sample_sblimit) { - sblimit = fr->down_sample_sblimit; - } - for (ch = 0; ch < nch; ++ch) { - for (i = sblimit; i < SBLIMIT; ++i) { - fraction[ch][0][i] = fraction[ch][1][i] = fraction[ch][2][i] = 0.0; - } - } -} - -static void -II_select_table(struct frame *fr) -{ - /* *INDENT-OFF* */ - static const int translate[3][2][16] = - { { { 0,2,2,2,2,2,2,0,0,0,1,1,1,1,1,0 } , - { 0,2,2,0,0,0,1,1,1,1,1,1,1,1,1,0 } } , - { { 0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0 } , - { 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0 } } , - { { 0,3,3,3,3,3,3,0,0,0,1,1,1,1,1,0 } , - { 0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,0 } } }; - /* *INDENT-ON* */ - - int table, sblim; - static const struct al_table2 *tables[5] = { alloc_0, alloc_1, alloc_2, alloc_3, alloc_4 }; - static const int sblims[5] = { 27, 30, 8, 12, 30 }; - - if (fr->lsf) - table = 4; - else - table = translate[fr->sampling_frequency][2 - fr->stereo][fr->bitrate_index]; - sblim = sblims[table]; - - fr->alloc = (struct al_table2 const *) tables[table]; - fr->II_sblimit = sblim; -} - - -int -decode_layer2_sideinfo(PMPSTR mp) -{ - (void) mp; - /* FIXME: extract side information and check values */ - return 0; -} - -int -decode_layer2_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point) -{ - real fraction[2][4][SBLIMIT]; /* pick_table clears unused subbands */ - sideinfo_layer_II si; - struct frame *fr = &(mp->fr); - int single = fr->single; - int i, j, clip = 0; - - II_select_table(fr); - II_step_one(mp, &si, fr); - - if (fr->stereo == 1 || single == 3) - single = 0; - - if (single >= 0) { - for (i = 0; i < SCALE_BLOCK; i++) { - II_step_two(mp, &si, fr, i >> 2, fraction); - for (j = 0; j < 3; j++) { - clip += synth_1to1_mono(mp, fraction[single][j], pcm_sample, pcm_point); - } - } - } - else { - for (i = 0; i < SCALE_BLOCK; i++) { - II_step_two(mp, &si, fr, i >> 2, fraction); - for (j = 0; j < 3; j++) { - 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; -} diff --git a/src/lib/dl/ext/lame/layer2.h b/src/lib/dl/ext/lame/layer2.h deleted file mode 100755 index fafc9a73..00000000 --- a/src/lib/dl/ext/lame/layer2.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 LAYER2_H_INCLUDED -#define LAYER2_H_INCLUDED - - -struct al_table2 { - short bits; - short d; -}; - - - -void hip_init_tables_layer2(void); -int decode_layer2_sideinfo(PMPSTR mp); -int decode_layer2_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point); - - -#endif diff --git a/src/lib/dl/ext/lame/layer3.c b/src/lib/dl/ext/lame/layer3.c deleted file mode 100755 index d1996acd..00000000 --- a/src/lib/dl/ext/lame/layer3.c +++ /dev/null @@ -1,1871 +0,0 @@ -/* - * layer3.c: Mpeg Layer-3 audio decoder - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - */ -/* $Id: layer3.c,v 1.63 2011/03/05 14:06:54 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdlib.h> -#include "common.h" -#include "huffman.h" -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "lame-analysis.h" -#include "decode_i386.h" -#include "layer3.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - - -static int gd_are_hip_tables_layer3_initialized = 0; - -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]; -}; - -static int longLimit[9][23]; -static int shortLimit[9][14]; - -/* *INDENT-OFF* */ - -static const struct bandInfoStruct bandInfo[9] = { - -/* MPEG 1.0 */ - { {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576}, - {4,4,4,4,4,4,6,6,8, 8,10,12,16,20,24,28,34,42,50,54, 76,158}, - {0,4*3,8*3,12*3,16*3,22*3,30*3,40*3,52*3,66*3, 84*3,106*3,136*3,192*3}, - {4,4,4,4,6,8,10,12,14,18,22,30,56} } , - - { {0,4,8,12,16,20,24,30,36,42,50,60,72, 88,106,128,156,190,230,276,330,384,576}, - {4,4,4,4,4,4,6,6,6, 8,10,12,16,18,22,28,34,40,46,54, 54,192}, - {0,4*3,8*3,12*3,16*3,22*3,28*3,38*3,50*3,64*3, 80*3,100*3,126*3,192*3}, - {4,4,4,4,6,6,10,12,14,16,20,26,66} } , - - { {0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576} , - {4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102, 26} , - {0,4*3,8*3,12*3,16*3,22*3,30*3,42*3,58*3,78*3,104*3,138*3,180*3,192*3} , - {4,4,4,4,6,8,12,16,20,26,34,42,12} } , - -/* MPEG 2.0 */ - { {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 } , - {0,4*3,8*3,12*3,18*3,24*3,32*3,42*3,56*3,74*3,100*3,132*3,174*3,192*3} , - {4,4,4,6,6,8,10,14,18,26,32,42,18 } } , - /* 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} } , -}; -/* *INDENT-ON* */ - -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(PMPSTR mp) -{ - unsigned char rval; - rval = *mp->wordpointer << mp->bitindex; - - mp->bitindex++; - mp->wordpointer += (mp->bitindex >> 3); - mp->bitindex &= 7; - - return rval >> 7; -} - - - - -/* - * init tables for layer-3 - */ -void -hip_init_tables_layer3(void) -{ - int i, j, k; - - if (gd_are_hip_tables_layer3_initialized) { - return; - } - gd_are_hip_tables_layer3_initialized = 1; - - 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 const len[4] = { 36, 36, 12, 36 }; - for (i = 0; i < len[j]; i += 2) - win1[j][i] = +win[j][i]; - for (i = 1; i < len[j]; i += 2) - win1[j][i] = -win[j][i]; - } - - for (i = 0; i < 16; i++) { - double t = tan((double) i * M_PI / 12.0); - tan1_1[i] = t / (1.0 + t); - tan2_1[i] = 1.0 / (1.0 + t); - tan1_2[i] = M_SQRT2 * t / (1.0 + t); - tan2_2[i] = M_SQRT2 / (1.0 + t); - - for (j = 0; j < 2; j++) { - double base = pow(2.0, -0.25 * (j + 1.0)); - double p1 = 1.0, p2 = 1.0; - if (i > 0) { - if (i & 1) - p1 = pow(base, (i + 1.0) * 0.5); - else - p2 = pow(base, i * 0.5); - } - pow1_1[j][i] = 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 const *bi = (struct bandInfoStruct const *) &bandInfo[j]; - int *mp; - int cb, lwin; - short const *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] > SBLIMIT) - longLimit[j][i] = SBLIMIT; - } - for (i = 0; i < 14; i++) { - shortLimit[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1; - if (shortLimit[j][i] > SBLIMIT) - shortLimit[j][i] = 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 - */ - -static void -III_get_side_info_1(PMPSTR mp, int stereo, - int ms_stereo, long sfreq, int single) -{ - int ch, gr; - int powdiff = (single == 3) ? 4 : 0; - - mp->sideinfo.main_data_begin = getbits(mp, 9); - if (stereo == 1) - mp->sideinfo.private_bits = getbits_fast(mp, 5); - else - mp->sideinfo.private_bits = getbits_fast(mp, 3); - - for (ch = 0; ch < stereo; ch++) { - mp->sideinfo.ch[ch].gr[0].scfsi = -1; - mp->sideinfo.ch[ch].gr[1].scfsi = getbits_fast(mp, 4); - } - - for (gr = 0; gr < 2; gr++) { - for (ch = 0; ch < stereo; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - - gr_infos->part2_3_length = getbits(mp, 12); - gr_infos->big_values = getbits_fast(mp, 9); - if (gr_infos->big_values > 288) { - lame_report_fnc(mp->report_err, "big_values too large! %i\n", gr_infos->big_values); - gr_infos->big_values = 288; - } - { - unsigned int qss = getbits_fast(mp, 8); - gr_infos->pow2gain = gainpow2 + 256 - qss + powdiff; - if (mp->pinfo != NULL) { - mp->pinfo->qss[gr][ch] = qss; - } - } - if (ms_stereo) - gr_infos->pow2gain += 2; - gr_infos->scalefac_compress = getbits_fast(mp, 4); -/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ - if (get1bit(mp)) { - int i; - gr_infos->block_type = getbits_fast(mp, 2); - gr_infos->mixed_block_flag = get1bit(mp); - gr_infos->table_select[0] = getbits_fast(mp, 5); - gr_infos->table_select[1] = getbits_fast(mp, 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(mp, 3) << 3); - gr_infos->full_gain[i] = gr_infos->pow2gain + sbg; - if (mp->pinfo != NULL) - mp->pinfo->sub_gain[gr][ch][i] = sbg / 8; - } - - if (gr_infos->block_type == 0) { - lame_report_fnc(mp->report_err, "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 { - unsigned int i, r0c, r1c, region0index, region1index; - for (i = 0; i < 3; i++) - gr_infos->table_select[i] = getbits_fast(mp, 5); - r0c = getbits_fast(mp, 4); - r1c = getbits_fast(mp, 3); - region0index = r0c+1; - if (region0index > 22) { - region0index = 22; - lame_report_fnc(mp->report_err, "region0index > 22\n"); - } - region1index = r0c+1 + r1c+1; - if (region1index > 22) { - region1index = 22; - lame_report_fnc(mp->report_err, "region1index > 22\n"); - } - gr_infos->region1start = bandInfo[sfreq].longIdx[region0index] >> 1; - gr_infos->region2start = bandInfo[sfreq].longIdx[region1index] >> 1; - gr_infos->block_type = 0; - gr_infos->mixed_block_flag = 0; - } - gr_infos->preflag = get1bit(mp); - gr_infos->scalefac_scale = get1bit(mp); - gr_infos->count1table_select = get1bit(mp); - } - } -} - -/* - * Side Info for MPEG 2.0 / LSF - */ -static void -III_get_side_info_2(PMPSTR mp, int stereo, int ms_stereo, long sfreq, int single) -{ - int ch; - int powdiff = (single == 3) ? 4 : 0; - - mp->sideinfo.main_data_begin = getbits(mp, 8); - - if (stereo == 1) - mp->sideinfo.private_bits = get1bit(mp); - else - mp->sideinfo.private_bits = getbits_fast(mp, 2); - - for (ch = 0; ch < stereo; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[0]); - unsigned int qss; - - gr_infos->part2_3_length = getbits(mp, 12); - gr_infos->big_values = getbits_fast(mp, 9); - if (gr_infos->big_values > 288) { - lame_report_fnc(mp->report_err, "big_values too large! %i\n", gr_infos->big_values); - gr_infos->big_values = 288; - } - qss = getbits_fast(mp, 8); - gr_infos->pow2gain = gainpow2 + 256 - qss + powdiff; - if (mp->pinfo != NULL) { - mp->pinfo->qss[0][ch] = qss; - } - - - if (ms_stereo) - gr_infos->pow2gain += 2; - gr_infos->scalefac_compress = getbits(mp, 9); -/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ - if (get1bit(mp)) { - int i; - gr_infos->block_type = getbits_fast(mp, 2); - gr_infos->mixed_block_flag = get1bit(mp); - gr_infos->table_select[0] = getbits_fast(mp, 5); - gr_infos->table_select[1] = getbits_fast(mp, 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(mp, 3) << 3); - gr_infos->full_gain[i] = gr_infos->pow2gain + sbg; - if (mp->pinfo != NULL) - mp->pinfo->sub_gain[0][ch][i] = sbg / 8; - - } - - if (gr_infos->block_type == 0) { - lame_report_fnc(mp->report_err, "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) { - if (sfreq == 8) - gr_infos->region1start = 36; - else - 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 { - unsigned int i, r0c, r1c, region0index, region1index; - for (i = 0; i < 3; i++) - gr_infos->table_select[i] = getbits_fast(mp, 5); - r0c = getbits_fast(mp, 4); - r1c = getbits_fast(mp, 3); - region0index = r0c+1; - if (region0index > 22) { - region0index = 22; - lame_report_fnc(mp->report_err, "region0index > 22\n"); - } - region1index = r0c+1 + r1c+1; - if (region1index > 22) { - region1index = 22; - lame_report_fnc(mp->report_err, "region1index > 22\n"); - } - gr_infos->region1start = bandInfo[sfreq].longIdx[region0index] >> 1; - gr_infos->region2start = bandInfo[sfreq].longIdx[region1index] >> 1; - gr_infos->block_type = 0; - gr_infos->mixed_block_flag = 0; - } - gr_infos->scalefac_scale = get1bit(mp); - gr_infos->count1table_select = get1bit(mp); - } -} - -/* - * read scalefactors - */ - -static int -III_get_scale_factors_1(PMPSTR mp, 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(mp, num0); - i = 9; - numbits -= num0; /* num0 * 17 + num1 * 18 */ - } - - for (; i; i--) - *scf++ = getbits_fast(mp, num0); - for (i = 18; i; i--) - *scf++ = getbits_fast(mp, 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(mp, num0); - for (i = 10; i; i--) - *scf++ = getbits_fast(mp, num1); - numbits = (num0 + num1) * 10 + num0; - } - else { - numbits = 0; - if (!(scfsi & 0x8)) { - for (i = 6; i; i--) - *scf++ = getbits_fast(mp, num0); - numbits += num0 * 6; - } - else { - scf += 6; - } - - if (!(scfsi & 0x4)) { - for (i = 5; i; i--) - *scf++ = getbits_fast(mp, num0); - numbits += num0 * 5; - } - else { - scf += 5; - } - - if (!(scfsi & 0x2)) { - for (i = 5; i; i--) - *scf++ = getbits_fast(mp, num1); - numbits += num1 * 5; - } - else { - scf += 5; - } - - if (!(scfsi & 0x1)) { - for (i = 5; i; i--) - *scf++ = getbits_fast(mp, num1); - numbits += num1 * 5; - } - else { - scf += 5; - } - } - - *scf++ = 0; /* no l[21] in original sources */ - } - return numbits; -} - - -static int -III_get_scale_factors_2(PMPSTR mp, int *scf, struct gr_info_s *gr_infos, int i_stereo) -{ - unsigned char const *pnt; - int i, j; - unsigned int slen; - int n = 0; - int numbits = 0; - - /* *INDENT-OFF* */ - 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} } }; - /* *INDENT-ON* */ - - 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 const *) 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(mp, num); - numbits += pnt[i] * num; - } - else { - for (j = 0; j < (int) (pnt[i]); j++) - *scf++ = 0; - } - } - - n = (n << 1) + 1; - for (i = 0; i < n; i++) - *scf++ = 0; - - return numbits; -} - -/* *INDENT-OFF* */ -static const int pretab1 [22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0}; /* char enough ? */ -static const int pretab2 [22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -/* *INDENT-ON* */ - -/* - * don't forget to apply the same changes to III_dequantize_sample_ms() !!! - */ -static int -III_dequantize_sample(PMPSTR mp, real xr[SBLIMIT][SSLIMIT], int *scf, - struct gr_info_s *gr_infos, int sfreq, int part2bits) -{ - int shift = 1 + gr_infos->scalefac_scale; - real *xrpnt = (real *) xr; - int l[3], l3; - int part2remain = gr_infos->part2_3_length - part2bits; - int *me; - - /* lame_report_fnc(mp->report_dbg,"part2remain = %d, gr_infos->part2_3_length = %d, part2bits = %d\n", - part2remain, gr_infos->part2_3_length, part2bits); */ - - { - 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; - } - } - } - /* MDH crash fix */ - { - int i; - for (i = 0; i < 3; i++) { - if (l[i] < 0) { - lame_report_fnc(mp->report_err, "hip: Bogus region length (%d)\n", l[i]); - l[i] = 0; - } - } - } - /* end MDH crash fix */ - - 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; - real v = 0.0; - 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 const *h = (struct newhuff const *) (ht + gr_infos->table_select[i]); - for (; lp; lp--, mc--) { - 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; - } - } - { - short const *val = (short const *) h->table; - while ((y = *val++) < 0) { - if (get1bit(mp)) - val -= y; - part2remain--; - } - x = y >> 4; - y &= 0xf; - } - if (x == 15) { - max[lwin] = cb; - part2remain -= h->linbits + 1; - x += getbits(mp, (int) h->linbits); - if (get1bit(mp)) - *xrpnt = -ispow[x] * v; - else - *xrpnt = ispow[x] * v; - } - else if (x) { - max[lwin] = cb; - if (get1bit(mp)) - *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(mp, (int) h->linbits); - if (get1bit(mp)) - *xrpnt = -ispow[y] * v; - else - *xrpnt = ispow[y] * v; - } - else if (y) { - max[lwin] = cb; - if (get1bit(mp)) - *xrpnt = -ispow[y] * v; - else - *xrpnt = ispow[y] * v; - part2remain--; - } - else - *xrpnt = 0.0; - xrpnt += step; - } - } - for (; l3 && (part2remain > 0); l3--) { - struct newhuff const *h = (struct newhuff const *) (htc + gr_infos->count1table_select); - short const *val = (short const *) h->table; - short a; - - while ((a = *val++) < 0) { - part2remain--; - if (part2remain < 0) { - part2remain++; - a = 0; - break; - } - if (get1bit(mp)) - 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(mp)) - *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 const *pretab = (int const *) (gr_infos->preflag ? pretab1 : pretab2); - int i, max = -1; - int cb = 0; - int *m = map[sfreq][2]; - real v = 0.0; - int mc = 0; - - /* - * long hash table values - */ - for (i = 0; i < 3; i++) { - int lp = l[i]; - struct newhuff const *h = (struct newhuff const *) (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++; - } - { - short const *val = (short const *) h->table; - while ((y = *val++) < 0) { - if (get1bit(mp)) - val -= y; - part2remain--; - } - x = y >> 4; - y &= 0xf; - } - if (x == 15) { - max = cb; - part2remain -= h->linbits + 1; - x += getbits(mp, (int) h->linbits); - if (get1bit(mp)) - *xrpnt++ = -ispow[x] * v; - else - *xrpnt++ = ispow[x] * v; - } - else if (x) { - max = cb; - if (get1bit(mp)) - *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(mp, (int) h->linbits); - if (get1bit(mp)) - *xrpnt++ = -ispow[y] * v; - else - *xrpnt++ = ispow[y] * v; - } - else if (y) { - max = cb; - if (get1bit(mp)) - *xrpnt++ = -ispow[y] * v; - else - *xrpnt++ = ispow[y] * v; - part2remain--; - } - else - *xrpnt++ = 0.0; - } - } - - /* - * short (count1table) values - */ - for (; l3 && (part2remain > 0); l3--) { - struct newhuff const *h = (struct newhuff const *) (htc + gr_infos->count1table_select); - short const *val = (short const *) h->table; - short a; - - while ((a = *val++) < 0) { - part2remain--; - if (part2remain < 0) { - part2remain++; - a = 0; - break; - } - if (get1bit(mp)) - 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(mp)) - *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(mp, 16); /* Dismiss stuffing Bits */ - part2remain -= 16; - } - if (part2remain > 0) - getbits(mp, part2remain); - else if (part2remain < 0) { - lame_report_fnc(mp->report_err, "hip: 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 const *bi = (struct bandInfoStruct const *) &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 */ - real bu = *--xr2, bd = *xr1; - *xr2 = (bu * (*cs)) - (bd * (*ca)); - *xr1++ = (bd * (*cs++)) + (bu * (*ca++)); - } - } - } -} - - -/* *INDENT-OFF* */ - -/* - 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) -{ - { - 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); } - - const real *c = COS9; - real *out2 = o2; - real *w = wintab; - real *out1 = o1; - 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,real *wi,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; - 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; - 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; - 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]; - } -} -/* *INDENT-ON* */ - -/* - * 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 (; sb < SBLIMIT; sb++, tspnt++) { - int i; - for (i = 0; i < SSLIMIT; i++) { - tspnt[i * SBLIMIT] = *rawout1++; - *rawout2++ = 0.0; - } - } -} - -/* - * main layer3 handler - */ - -int -layer3_audiodata_precedesframes(PMPSTR mp) -{ - int audioDataInFrame; - int framesToBacktrack; - - /* specific to Layer 3, since Layer 1 & 2 the audio data starts at the frame that describes it. */ - /* determine how many bytes and therefore bitstream frames the audio data precedes it's matching frame */ - /* lame_report_fnc(mp->report_err, "hip: main_data_begin = %d, mp->bsize %d, mp->fsizeold %d, mp->ssize %d\n", - sideinfo.main_data_begin, mp->bsize, mp->fsizeold, mp->ssize); */ - /* compute the number of frames to backtrack, 4 for the header, ssize already holds the CRC */ - /* TODO Erroneously assumes current frame is same as previous frame. */ - audioDataInFrame = mp->bsize - 4 - mp->ssize; - framesToBacktrack = (mp->sideinfo.main_data_begin + audioDataInFrame - 1) / audioDataInFrame; - /* lame_report_fnc(mp->report_err, "hip: audioDataInFrame %d framesToBacktrack %d\n", audioDataInFrame, framesToBacktrack); */ - return framesToBacktrack; -} - -int -decode_layer3_sideinfo(PMPSTR mp) -{ - struct frame *fr = &mp->fr; - int stereo = fr->stereo; - 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(mp, stereo, ms_stereo, sfreq, single); - } - else { - granules = 2; - III_get_side_info_1(mp, stereo, ms_stereo, sfreq, single); - } - - databits = 0; - for (gr = 0; gr < granules; ++gr) { - for (ch = 0; ch < stereo; ++ch) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - databits += gr_infos->part2_3_length; - } - } - return databits - 8 * mp->sideinfo.main_data_begin; -} - - - -int -decode_layer3_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point, - int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *), - int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *)) -{ - 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) mp->sideinfo.main_data_begin) == MP3_ERR) - return 0; - - 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; gr < granules; gr++) { - static real hybridIn[2][SBLIMIT][SSLIMIT]; - static real hybridOut[2][SSLIMIT][SBLIMIT]; - - { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[0].gr[gr]); - long part2bits; - - if (fr->lsf) - part2bits = III_get_scale_factors_2(mp, scalefacs[0], gr_infos, 0); - else { - part2bits = III_get_scale_factors_1(mp, scalefacs[0], gr_infos); - } - - if (mp->pinfo != NULL) { - int i; - mp->pinfo->sfbits[gr][0] = part2bits; - for (i = 0; i < 39; i++) - mp->pinfo->sfb_s[gr][0][i] = scalefacs[0][i]; - } - - /* lame_report_fnc(mp->report_err, "calling III dequantize sample 1 gr_infos->part2_3_length %d\n", gr_infos->part2_3_length); */ - if (III_dequantize_sample(mp, hybridIn[0], scalefacs[0], gr_infos, sfreq, part2bits)) - return clip; - } - if (stereo == 2) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[1].gr[gr]); - long part2bits; - if (fr->lsf) - part2bits = III_get_scale_factors_2(mp, scalefacs[1], gr_infos, i_stereo); - else { - part2bits = III_get_scale_factors_1(mp, scalefacs[1], gr_infos); - } - if (mp->pinfo != NULL) { - int i; - mp->pinfo->sfbits[gr][1] = part2bits; - for (i = 0; i < 39; i++) - mp->pinfo->sfb_s[gr][1][i] = scalefacs[1][i]; - } - - /* lame_report_fnc(mp->report_err, "calling III dequantize sample 2 gr_infos->part2_3_length %d\n", gr_infos->part2_3_length); */ - if (III_dequantize_sample(mp, hybridIn[1], scalefacs[1], gr_infos, sfreq, part2bits)) - return clip; - - if (ms_stereo) { - int i; - for (i = 0; i < SBLIMIT * SSLIMIT; i++) { - real tmp0, tmp1; - tmp0 = ((real *) hybridIn[0])[i]; - tmp1 = ((real *) hybridIn[1])[i]; - ((real *) hybridIn[1])[i] = tmp0 - tmp1; - ((real *) hybridIn[0])[i] = tmp0 + tmp1; - } - } - - if (i_stereo) - III_i_stereo(hybridIn, scalefacs[1], gr_infos, sfreq, ms_stereo, fr->lsf); - - if (ms_stereo || i_stereo || (single == 3)) { - if (gr_infos->maxb > mp->sideinfo.ch[0].gr[gr].maxb) - mp->sideinfo.ch[0].gr[gr].maxb = gr_infos->maxb; - else - gr_infos->maxb = mp->sideinfo.ch[0].gr[gr].maxb; - } - - switch (single) { - case 3: - { - int i; - 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: - { - int i; - real *in0 = (real *) hybridIn[0], *in1 = (real *) hybridIn[1]; - for (i = 0; i < (int) (SSLIMIT * gr_infos->maxb); i++) - *in0++ = *in1++; - } - break; - } - } - - if (mp->pinfo != NULL) { - int i, sb; - float ifqstep; - - mp->pinfo->bitrate = tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index]; - mp->pinfo->sampfreq = freqs[sfreq]; - mp->pinfo->emph = fr->emphasis; - mp->pinfo->crc = fr->error_protection; - mp->pinfo->padding = fr->padding; - mp->pinfo->stereo = fr->stereo; - mp->pinfo->js = (fr->mode == MPG_MD_JOINT_STEREO); - mp->pinfo->ms_stereo = ms_stereo; - mp->pinfo->i_stereo = i_stereo; - mp->pinfo->maindata = mp->sideinfo.main_data_begin; - - for (ch = 0; ch < stereo1; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - mp->pinfo->big_values[gr][ch] = gr_infos->big_values; - mp->pinfo->scalefac_scale[gr][ch] = gr_infos->scalefac_scale; - mp->pinfo->mixed[gr][ch] = gr_infos->mixed_block_flag; - mp->pinfo->mpg123blocktype[gr][ch] = gr_infos->block_type; - mp->pinfo->mainbits[gr][ch] = gr_infos->part2_3_length; - mp->pinfo->preflag[gr][ch] = gr_infos->preflag; - if (gr == 1) - mp->pinfo->scfsi[ch] = gr_infos->scfsi; - } - - - for (ch = 0; ch < stereo1; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - ifqstep = (mp->pinfo->scalefac_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 pinfo->sfb_s[] above */ - mp->pinfo->sfb_s[gr][ch][j] = - -ifqstep * mp->pinfo->sfb_s[gr][ch][j - gr_infos->mixed_block_flag]; - mp->pinfo->sfb_s[gr][ch][j] -= 2 * (mp->pinfo->sub_gain[gr][ch][i]); - } - mp->pinfo->sfb_s[gr][ch][3 * sb + i] = - -2 * (mp->pinfo->sub_gain[gr][ch][i]); - } - } - else { - for (sb = 0; sb < 21; sb++) { - /* scalefac was copied into pinfo->sfb[] above */ - mp->pinfo->sfb[gr][ch][sb] = mp->pinfo->sfb_s[gr][ch][sb]; - if (gr_infos->preflag) - mp->pinfo->sfb[gr][ch][sb] += pretab1[sb]; - mp->pinfo->sfb[gr][ch][sb] *= -ifqstep; - } - mp->pinfo->sfb[gr][ch][21] = 0; - } - } - - - - for (ch = 0; ch < stereo1; ch++) { - int j = 0; - for (sb = 0; sb < SBLIMIT; sb++) - for (ss = 0; ss < SSLIMIT; ss++, j++) - mp->pinfo->mpg123xr[gr][ch][j] = hybridIn[ch][sb][ss]; - } - } - - - for (ch = 0; ch < stereo1; ch++) { - struct gr_info_s *gr_infos = &(mp->sideinfo.ch[ch].gr[gr]); - III_antialias(hybridIn[ch], gr_infos); - III_hybrid(mp, hybridIn[ch], hybridOut[ch], ch, gr_infos); - } - - for (ss = 0; ss < SSLIMIT; ss++) { - if (single >= 0) { - clip += (*synth_1to1_mono_ptr) (mp, hybridOut[0][ss], pcm_sample, pcm_point); - } - else { - int p1 = *pcm_point; - clip += (*synth_1to1_ptr) (mp, hybridOut[0][ss], 0, pcm_sample, &p1); - clip += (*synth_1to1_ptr) (mp, hybridOut[1][ss], 1, pcm_sample, pcm_point); - } - } - } - - return clip; -} diff --git a/src/lib/dl/ext/lame/layer3.h b/src/lib/dl/ext/lame/layer3.h deleted file mode 100755 index 2e301920..00000000 --- a/src/lib/dl/ext/lame/layer3.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 LAYER3_H_INCLUDED -#define LAYER3_H_INCLUDED - -void hip_init_tables_layer3(void); -int decode_layer3_sideinfo(PMPSTR mp); -int decode_layer3_frame(PMPSTR mp, unsigned char *pcm_sample, int *pcm_point, - int (*synth_1to1_mono_ptr) (PMPSTR, real *, unsigned char *, int *), - int (*synth_1to1_ptr) (PMPSTR, real *, int, unsigned char *, int *)); -int layer3_audiodata_precedesframes(PMPSTR mp); - -#endif diff --git a/src/lib/dl/ext/lame/machine.h b/src/lib/dl/ext/lame/machine.h deleted file mode 100755 index 20b68fd7..00000000 --- a/src/lib/dl/ext/lame/machine.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Machine dependent defines/includes 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_MACHINE_H -#define LAME_MACHINE_H - -#include "version.h" - -#if (LAME_RELEASE_VERSION == 0) -#undef NDEBUG -#endif - -#include <stdio.h> -#include <assert.h> - -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <string.h> -#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 <math.h> -#endif -#include <limits.h> - -#include <ctype.h> - -#ifdef HAVE_ERRNO_H -# include <errno.h> -#endif -#ifdef HAVE_FCNTL_H -# include <fcntl.h> -#endif - -#if defined(macintosh) -# include <types.h> -# include <stat.h> -#else -# include <sys/types.h> -# include <sys/stat.h> -#endif - -#ifdef HAVE_INTTYPES_H -# include <inttypes.h> -#else -# ifdef HAVE_STDINT_H -# include <stdint.h> -# endif -#endif - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -/* - * 3 different types of pow() functions: - * - table lookup - * - pow() - * - exp() on some machines this is claimed to be faster than pow() - */ - -#define POW20(x) (assert(0 <= (x+Q_MAX2) && x < Q_MAX), pow20[x+Q_MAX2]) -/*#define POW20(x) pow(2.0,((double)(x)-210)*.25) */ -/*#define POW20(x) exp( ((double)(x)-210)*(.25*LOG2) ) */ - -#define IPOW20(x) (assert(0 <= x && x < Q_MAX), ipow20[x]) -/*#define IPOW20(x) exp( -((double)(x)-210)*.1875*LOG2 ) */ -/*#define IPOW20(x) pow(2.0,-((double)(x)-210)*.1875) */ - -/* in case this is used without configure */ -#ifndef inline -# define inline -#endif - -#if defined(_MSC_VER) -# undef inline -# define inline _inline -#elif defined(__SASC) || defined(__GNUC__) || defined(__ICC) || defined(__ECC) -/* if __GNUC__ we always want to inline, not only if the user requests it */ -# undef inline -# define inline __inline -#endif - -#if defined(_MSC_VER) -# pragma warning( disable : 4244 ) -/*# pragma warning( disable : 4305 ) */ -#endif - -/* - * FLOAT for variables which require at least 32 bits - * FLOAT8 for variables which require at least 64 bits - * - * On some machines, 64 bit will be faster than 32 bit. Also, some math - * routines require 64 bit float, so setting FLOAT=float will result in a - * lot of conversions. - */ - -#if ( defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__) ) -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -# include <float.h> -# define FLOAT_MAX FLT_MAX -#else -# ifndef FLOAT -typedef float FLOAT; -# ifdef FLT_MAX -# define FLOAT_MAX FLT_MAX -# else -# define FLOAT_MAX 1e37 /* approx */ -# endif -# endif -#endif - -#ifndef FLOAT8 -typedef double FLOAT8; -# ifdef DBL_MAX -# define FLOAT8_MAX DBL_MAX -# else -# define FLOAT8_MAX 1e99 /* approx */ -# endif -#else -# ifdef FLT_MAX -# define FLOAT8_MAX FLT_MAX -# else -# define FLOAT8_MAX 1e37 /* approx */ -# endif -#endif - -/* sample_t must be floating point, at least 32 bits */ -typedef FLOAT sample_t; - -#define dimension_of(array) (sizeof(array)/sizeof(array[0])) -#define beyond(array) (array+dimension_of(array)) - -#if 1 -#define EQ(a,b) (\ -(fabs(a) > fabs(b)) \ - ? (fabs((a)-(b)) <= (fabs(a) * 1e-6f)) \ - : (fabs((a)-(b)) <= (fabs(b) * 1e-6f))) -#else -#define EQ(a,b) (fabs((a)-(b))<1E-37) -#endif - -#define NEQ(a,b) (!EQ(a,b)) - -#endif - -#ifdef _MSC_VER -# if _MSC_VER < 1400 -# define fabsf fabs -# define powf pow -# define log10f log10 -# endif -#endif - -#ifdef TARGET_MSDOS -# define fabsf fabs -# define powf pow -# define log10f log10 -#endif - -/* end of machine.h */ diff --git a/src/lib/dl/ext/lame/main.c b/src/lib/dl/ext/lame/main.c deleted file mode 100755 index e073064d..00000000 --- a/src/lib/dl/ext/lame/main.c +++ /dev/null @@ -1,475 +0,0 @@ -/* - * Command line frontend program - * - * Copyright (c) 1999 Mark Taylor - * 2000 Takehiro TOMINAGA - * 2010-2011 Robert Hegemann - * - * 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. - */ - -/* $Id: main.c,v 1.127 2011/10/02 14:52:20 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <stdio.h> - -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <string.h> -#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 - -#ifdef HAVE_FCNTL_H -# include <fcntl.h> -#endif - -#ifdef __sun__ -/* woraround for SunOS 4.x, it has SEEK_* defined here */ -#include <unistd.h> -#endif - -#ifdef __OS2__ -#include <os2.h> -#define PRTYC_IDLE 1 -#define PRTYC_REGULAR 2 -#define PRTYD_MINIMUM -31 -#define PRTYD_MAXIMUM 31 -#endif - -#if defined(_WIN32) -# include <windows.h> -#endif - - -/* - main.c is example code for how to use libmp3lame.a. To use this library, - you only need the library and lame.h. All other .h files are private - to the library. -*/ -#include "lame.h" - -#include "console.h" -#include "main.h" - -/* PLL 14/04/2000 */ -#if macintosh -#include <console.h> -#endif - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - - -static int c_main(int argc, char *argv[]); -extern int lame_main(lame_t gf, int argc, char *argv[]); - - -/************************************************************************ -* -* main -* -* PURPOSE: MPEG-1,2 Layer III encoder with GPSYCHO -* psychoacoustic model. -* -************************************************************************/ - - -#if defined( _WIN32 ) && !defined(__MINGW32__) -static void -set_process_affinity() -{ -#if 0 - /* rh 061207 - the following fix seems to be a workaround for a problem in the - parent process calling LAME. It would be better to fix the broken - application => code disabled. - */ -#if defined(_WIN32) - /* set affinity back to all CPUs. Fix for EAC/lame on SMP systems from - "Todd Richmond" <todd.richmond@openwave.com> */ - typedef BOOL(WINAPI * SPAMFunc) (HANDLE, DWORD_PTR); - SPAMFunc func; - SYSTEM_INFO si; - - if ((func = (SPAMFunc) GetProcAddress(GetModuleHandleW(L"KERNEL32.DLL"), - "SetProcessAffinityMask")) != NULL) { - GetSystemInfo(&si); - func(GetCurrentProcess(), si.dwActiveProcessorMask); - } -#endif -#endif -} -#endif - -#if defined(WIN32) - -/** - * Long Filename support for the WIN32 platform - * - */ - -void -dosToLongFileName(char *fn) -{ - const int MSIZE = PATH_MAX + 1 - 4; /* we wanna add ".mp3" later */ - WIN32_FIND_DATAA lpFindFileData; - HANDLE h = FindFirstFileA(fn, &lpFindFileData); - if (h != INVALID_HANDLE_VALUE) { - int a; - char *q, *p; - FindClose(h); - for (a = 0; a < MSIZE; a++) { - if ('\0' == lpFindFileData.cFileName[a]) - break; - } - if (a >= MSIZE || a == 0) - return; - q = strrchr(fn, '\\'); - p = strrchr(fn, '/'); - if (p - q > 0) - q = p; - if (q == NULL) - q = strrchr(fn, ':'); - if (q == NULL) - strncpy(fn, lpFindFileData.cFileName, a); - else { - a += q - fn + 1; - if (a >= MSIZE) - return; - strncpy(++q, lpFindFileData.cFileName, MSIZE - a); - } - } -} - -BOOL -SetPriorityClassMacro(DWORD p) -{ - HANDLE op = GetCurrentProcess(); - return SetPriorityClass(op, p); -} - -void -setProcessPriority(int Priority) -{ - switch (Priority) { - case 0: - case 1: - SetPriorityClassMacro(IDLE_PRIORITY_CLASS); - console_printf("==> Priority set to Low.\n"); - break; - default: - case 2: - SetPriorityClassMacro(NORMAL_PRIORITY_CLASS); - console_printf("==> Priority set to Normal.\n"); - break; - case 3: - case 4: - SetPriorityClassMacro(HIGH_PRIORITY_CLASS); - console_printf("==> Priority set to High.\n"); - break; - } -} -#endif - - -#if defined(__OS2__) -/* OS/2 priority functions */ -static void -setProcessPriority(int Priority) -{ - int rc; - - switch (Priority) { - - case 0: - rc = DosSetPriority(0, /* Scope: only one process */ - PRTYC_IDLE, /* select priority class (idle, regular, etc) */ - 0, /* set delta */ - 0); /* Assume current process */ - console_printf("==> Priority set to 0 (Low priority).\n"); - break; - - case 1: - rc = DosSetPriority(0, /* Scope: only one process */ - PRTYC_IDLE, /* select priority class (idle, regular, etc) */ - PRTYD_MAXIMUM, /* set delta */ - 0); /* Assume current process */ - console_printf("==> Priority set to 1 (Medium priority).\n"); - break; - - case 2: - rc = DosSetPriority(0, /* Scope: only one process */ - PRTYC_REGULAR, /* select priority class (idle, regular, etc) */ - PRTYD_MINIMUM, /* set delta */ - 0); /* Assume current process */ - console_printf("==> Priority set to 2 (Regular priority).\n"); - break; - - case 3: - rc = DosSetPriority(0, /* Scope: only one process */ - PRTYC_REGULAR, /* select priority class (idle, regular, etc) */ - 0, /* set delta */ - 0); /* Assume current process */ - console_printf("==> Priority set to 3 (High priority).\n"); - break; - - case 4: - rc = DosSetPriority(0, /* Scope: only one process */ - PRTYC_REGULAR, /* select priority class (idle, regular, etc) */ - PRTYD_MAXIMUM, /* set delta */ - 0); /* Assume current process */ - console_printf("==> Priority set to 4 (Maximum priority). I hope you enjoy it :)\n"); - break; - - default: - console_printf("==> Invalid priority specified! Assuming idle priority.\n"); - } -} -#endif - - -/*********************************************************************** -* -* Message Output -* -***********************************************************************/ - - -#if defined( _WIN32 ) && !defined(__MINGW32__) -/* Idea for unicode support in LAME, work in progress - * - map UTF-16 to UTF-8 - * - advantage, the rest can be kept unchanged (mostly) - * - make sure, fprintf on console is in correct code page - * + normal text in source code is in ASCII anyway - * + ID3 tags and filenames coming from command line need attention - * - call wfopen with UTF-16 names where needed - * - * why not wchar_t all the way? - * well, that seems to be a big mess and not portable at all - */ -#include <wchar.h> -#include <mbstring.h> - -static wchar_t *mbsToUnicode(const char *mbstr, int code_page) -{ - int n = MultiByteToWideChar(code_page, 0, mbstr, -1, NULL, 0); - wchar_t* wstr = malloc( n*sizeof(wstr[0]) ); - if ( wstr !=0 ) { - n = MultiByteToWideChar(code_page, 0, mbstr, -1, wstr, n); - if ( n==0 ) { - free( wstr ); - wstr = 0; - } - } - return wstr; -} - -static char *unicodeToMbs(const wchar_t *wstr, int code_page) -{ - int n = 1+WideCharToMultiByte(code_page, 0, wstr, -1, 0, 0, 0, 0); - char* mbstr = malloc( n*sizeof(mbstr[0]) ); - if ( mbstr !=0 ) { - n = WideCharToMultiByte(code_page, 0, wstr, -1, mbstr, n, 0, 0); - if( n == 0 ){ - free( mbstr ); - mbstr = 0; - } - } - return mbstr; -} - -char* mbsToMbs(const char* str, int cp_from, int cp_to) -{ - wchar_t* wstr = mbsToUnicode(str, cp_from); - if ( wstr != 0 ) { - char* local8bit = unicodeToMbs(wstr, cp_to); - free( wstr ); - return local8bit; - } - return 0; -} - -enum { cp_utf8, cp_console, cp_actual }; - -wchar_t *utf8ToUnicode(const char *mbstr) -{ - return mbsToUnicode(mbstr, CP_UTF8); -} - -char *unicodeToUtf8(const wchar_t *wstr) -{ - return unicodeToMbs(wstr, CP_UTF8); -} - -char* utf8ToLocal8Bit(const char* str) -{ - return mbsToMbs(str, CP_UTF8, CP_ACP); -} - -char* utf8ToConsole8Bit(const char* str) -{ - return mbsToMbs(str, CP_UTF8, GetConsoleOutputCP()); -} - -char* local8BitToUtf8(const char* str) -{ - return mbsToMbs(str, CP_ACP, CP_UTF8); -} - -char* console8BitToUtf8(const char* str) -{ - return mbsToMbs(str, GetConsoleOutputCP(), CP_UTF8); -} - -char* utf8ToLatin1(char const* str) -{ - return mbsToMbs(str, CP_UTF8, 28591); /* Latin-1 is code page 28591 */ -} - -unsigned short* utf8ToUtf16(char const* mbstr) /* additional Byte-Order-Marker */ -{ - int n = MultiByteToWideChar(CP_UTF8, 0, mbstr, -1, NULL, 0); - wchar_t* wstr = malloc( (n+1)*sizeof(wstr[0]) ); - if ( wstr !=0 ) { - wstr[0] = 0xfeff; /* BOM */ - n = MultiByteToWideChar(CP_UTF8, 0, mbstr, -1, wstr+1, n); - if ( n==0 ) { - free( wstr ); - wstr = 0; - } - } - return wstr; -} - - - -int wmain(int argc, wchar_t* argv[]) -{ - char **utf8_argv; - int i, ret; - - utf8_argv = calloc(argc, sizeof(char*)); - for (i = 0; i < argc; ++i) { - utf8_argv[i] = unicodeToUtf8(argv[i]); - } - ret = c_main(argc, utf8_argv); - for (i = 0; i < argc; ++i) { - free( utf8_argv[i] ); - } - free( utf8_argv ); - return ret; -} - -FILE* lame_fopen(char const* file, char const* mode) -{ - FILE* fh = 0; - wchar_t* wfile = utf8ToUnicode(file); - wchar_t* wmode = utf8ToUnicode(mode); - if (wfile != 0 && wmode != 0) { - fh = _wfopen(wfile, wmode); - } - else { - fh = fopen(file, mode); - } - free(wfile); - free(wmode); - return fh; -} - -char* lame_getenv(char const* var) -{ - char* str = 0; - wchar_t* wvar = utf8ToUnicode(var); - wchar_t* wstr = 0; - if (wvar != 0) { - wstr = _wgetenv(wvar); - str = unicodeToUtf8(wstr); - } - free(wvar); - free(wstr); - return str; -} - -#else - -FILE* lame_fopen(char const* file, char const* mode) -{ - return fopen(file, mode); -} - -char* lame_getenv(char const* var) -{ - char* str = getenv(var); - if (str) { - return strdup(str); - } - return 0; -} - -int main(int argc, char *argv[]) -{ - return c_main(argc, argv); -} - -#endif - - - - -static int -c_main(int argc, char *argv[]) -{ - lame_t gf; - int ret; - -#if macintosh - argc = ccommand(&argv); -#endif -#ifdef __EMX__ - /* This gives wildcard expansion on Non-POSIX shells with OS/2 */ - _wildcard(&argc, &argv); -#endif -#if defined( _WIN32 ) && !defined(__MINGW32__) - set_process_affinity(); -#endif - - frontend_open_console(); - gf = lame_init(); /* initialize libmp3lame */ - if (NULL == gf) { - error_printf("fatal error during initialization\n"); - ret = 1; - } - else { - ret = lame_main(gf, argc, argv); - lame_close(gf); - } - frontend_close_console(); - return ret; -} diff --git a/src/lib/dl/ext/lame/main.h b/src/lib/dl/ext/lame/main.h deleted file mode 100755 index bff56a15..00000000 --- a/src/lib/dl/ext/lame/main.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Command line frontend program - * - * Copyright (c) 1999 Mark Taylor - * 2000 Takehiro TOMIANGA - * 2010-2011 Robert Hegemann - * - * 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 MAIN_H_INCLUDED -#define MAIN_H_INCLUDED - -#ifdef HAVE_LIMITS_H -# include <limits.h> -#endif - -#include "get_audio.h" - -#if defined(__cplusplus) -extern "C" { -#endif - -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif - - -/* GLOBAL VARIABLES used by parse.c and main.c. - instantiated in parce.c. ugly, ugly */ - -typedef struct ReaderConfig -{ - sound_file_format input_format; - int swapbytes; /* force byte swapping default=0 */ - int swap_channel; /* 0: no-op, 1: swaps input channels */ - int input_samplerate; -} ReaderConfig; - -typedef struct WriterConfig -{ - int flush_write; -} WriterConfig; - -typedef struct UiConfig -{ - int silent; /* Verbosity */ - int brhist; - int print_clipping_info; /* print info whether waveform clips */ - float update_interval; /* to use Frank's time status display */ -} UiConfig; - -typedef struct DecoderConfig -{ - int mp3_delay; /* to adjust the number of samples truncated during decode */ - int mp3_delay_set; /* user specified the value of the mp3 encoder delay to assume for decoding */ - int disable_wav_header; - mp3data_struct mp3input_data; -} DecoderConfig; - -typedef enum ByteOrder { ByteOrderLittleEndian, ByteOrderBigEndian } ByteOrder; - -typedef struct RawPCMConfig -{ - int in_bitwidth; - int in_signed; - ByteOrder in_endian; -} RawPCMConfig; - -extern ReaderConfig global_reader; -extern WriterConfig global_writer; -extern UiConfig global_ui_config; -extern DecoderConfig global_decoder; -extern RawPCMConfig global_raw_pcm; - - -extern FILE* lame_fopen(char const* file, char const* mode); -extern char* utf8ToConsole8Bit(const char* str); -extern char* utf8ToLocal8Bit(const char* str); -extern unsigned short* utf8ToUtf16(char const* str); -extern char* utf8ToLatin1(char const* str); -#ifdef _WIN32 -extern wchar_t* utf8ToUnicode(char const* str); -#endif - -extern void dosToLongFileName(char* filename); -extern void setProcessPriority(int priority); - -extern int lame_main(lame_t gf, int argc, char** argv); -extern char* lame_getenv(char const* var); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/src/lib/dl/ext/lame/mp3rtp.c b/src/lib/dl/ext/lame/mp3rtp.c deleted file mode 100755 index 61630573..00000000 --- a/src/lib/dl/ext/lame/mp3rtp.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * mp3rtp command line frontend program - * - * initially contributed by Felix von Leitner - * - * Copyright (c) 2000 Mark Taylor - * 2010 Robert Hegemann - * - * 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. - */ - -/* $Id: mp3rtp.c,v 1.36 2011/10/02 17:13:22 robert Exp $ */ - -/* Still under work ..., need a client for test, where can I get one? */ - -/* An audio player named Zinf (aka freeamp) can play rtp streams */ - -/* - * experimental translation: - * - * gcc -I..\include -I..\libmp3lame -o mp3rtp mp3rtp.c ../libmp3lame/libmp3lame.a lametime.c get_audio.c ieeefloat.c timestatus.c parse.c rtp.c -lm - * - * wavrec -t 14400 -s 44100 -S /proc/self/fd/1 | ./mp3rtp 10.1.1.42 -V2 -b128 -B256 - my_mp3file.mp3 - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif - -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <string.h> -#endif - -#include <time.h> - -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif - -#include "lame.h" -#include "main.h" -#include "parse.h" -#include "lametime.h" -#include "timestatus.h" -#include "get_audio.h" -#include "rtp.h" -#include "console.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -/* - * Encode (via LAME) to mp3 with RTP streaming of the output. - * - * Author: Felix von Leitner <leitner@vim.org> - * - * mp3rtp ip[:port[:ttl]] [lame encoding options] infile outfile - * - * examples: - * arecord -b 16 -s 22050 -w | ./mp3rtp 224.17.23.42:5004:2 -b 56 - /dev/null - * arecord -b 16 -s 44100 -w | ./mp3rtp 10.1.1.42 -V2 -b128 -B256 - my_mp3file.mp3 - * - */ - - -static unsigned int -maxvalue(int Buffer[2][1152]) -{ - int max = 0; - int i; - - for (i = 0; i < 1152; i++) { - if (abs(Buffer[0][i]) > max) - max = abs(Buffer[0][i]); - if (abs(Buffer[1][i]) > max) - max = abs(Buffer[1][i]); - } - return max >> 16; -} - -static void -levelmessage(unsigned int maxv, int* maxx, int* tmpx) -{ - char buff[] = "| . | . | . | . | . | . | . | . | . | . | \r"; - int tmp = *tmpx, max = *maxx; - - buff[tmp] = '+'; - tmp = (maxv * 61 + 16384) / (32767 + 16384 / 61); - if (tmp > sizeof(buff) - 2) - tmp = sizeof(buff) - 2; - if (max < tmp) - max = tmp; - buff[max] = 'x'; - buff[tmp] = '#'; - console_printf(buff); - console_flush(); - *maxx = max; - *tmpx = tmp; -} - - -/************************************************************************ -* -* main -* -* PURPOSE: MPEG-1,2 Layer III encoder with GPSYCHO -* psychoacoustic model. -* -************************************************************************/ - -int -lame_main(lame_t gf, int argc, char **argv) -{ - unsigned char mp3buffer[LAME_MAXMP3BUFFER]; - char inPath[PATH_MAX + 1]; - char outPath[PATH_MAX + 1]; - int Buffer[2][1152]; - - int maxx = 0, tmpx = 0; - int ret; - int wavsamples; - int mp3bytes; - FILE *outf; - - char ip[16]; - unsigned int port = 5004; - unsigned int ttl = 2; - char dummy; - - if (argc <= 2) { - console_printf("Encode (via LAME) to mp3 with RTP streaming of the output\n" - "\n" - " mp3rtp ip[:port[:ttl]] [lame encoding options] infile outfile\n" - "\n" - " examples:\n" - " arecord -b 16 -s 22050 -w | ./mp3rtp 224.17.23.42:5004:2 -b 56 - /dev/null\n" - " arecord -b 16 -s 44100 -w | ./mp3rtp 10.1.1.42 -V2 -b128 -B256 - my_mp3file.mp3\n" - "\n"); - return 1; - } - - switch (sscanf(argv[1], "%11[.0-9]:%u:%u%c", ip, &port, &ttl, &dummy)) { - case 1: - case 2: - case 3: - break; - default: - error_printf("Illegal destination selector '%s', must be ip[:port[:ttl]]\n", argv[1]); - return -1; - } - rtp_initialization(); - if (rtp_socket(ip, port, ttl)) { - rtp_deinitialization(); - error_printf("fatal error during initialization\n"); - return 1; - } - - lame_set_errorf(gf, &frontend_errorf); - lame_set_debugf(gf, &frontend_debugf); - lame_set_msgf(gf, &frontend_msgf); - - /* Remove the argumets that are rtp related, and then - * parse the command line arguments, setting various flags in the - * struct pointed to by 'gf'. If you want to parse your own arguments, - * or call libmp3lame from a program which uses a GUI to set arguments, - * skip this call and set the values of interest in the gf struct. - * (see lame.h for documentation about these parameters) - */ - - argv[1] = argv[0]; - parse_args(gf, argc - 1, argv + 1, inPath, outPath, NULL, NULL); - - /* open the output file. Filename parsed into gf.inPath */ - if (0 == strcmp(outPath, "-")) { - lame_set_stream_binary_mode(outf = stdout); - } - else { - if ((outf = lame_fopen(outPath, "wb+")) == NULL) { - rtp_deinitialization(); - error_printf("Could not create \"%s\".\n", outPath); - return 1; - } - } - - - /* open the wav/aiff/raw pcm or mp3 input file. This call will - * open the file with name gf.inFile, try to parse the headers and - * set gf.samplerate, gf.num_channels, gf.num_samples. - * if you want to do your own file input, skip this call and set - * these values yourself. - */ - if (init_infile(gf, inPath) < 0) { - error_printf("Can't init infile '%s'\n", inPath); - return 1; - } - - - /* Now that all the options are set, lame needs to analyze them and - * set some more options - */ - ret = lame_init_params(gf); - if (ret < 0) { - if (ret == -1) - display_bitrates(stderr); - rtp_deinitialization(); - error_printf("fatal error during initialization\n"); - return -1; - } - - lame_print_config(gf); /* print useful information about options being used */ - - if (global_ui_config.update_interval < 0.) - global_ui_config.update_interval = 2.; - - /* encode until we hit EOF */ - while ((wavsamples = get_audio(gf, Buffer)) > 0) { /* read in 'wavsamples' samples */ - levelmessage(maxvalue(Buffer), &maxx, &tmpx); - mp3bytes = lame_encode_buffer_int(gf, /* encode the frame */ - Buffer[0], Buffer[1], wavsamples, - mp3buffer, sizeof(mp3buffer)); - rtp_output(mp3buffer, mp3bytes); /* write MP3 output to RTP port */ - fwrite(mp3buffer, 1, mp3bytes, outf); /* write the MP3 output to file */ - } - - mp3bytes = lame_encode_flush(gf, /* may return one or more mp3 frame */ - mp3buffer, sizeof(mp3buffer)); - rtp_output(mp3buffer, mp3bytes); /* write MP3 output to RTP port */ - fwrite(mp3buffer, 1, mp3bytes, outf); /* write the MP3 output to file */ - - lame_mp3_tags_fid(gf, outf); /* add VBR tags to mp3 file */ - - rtp_deinitialization(); - fclose(outf); - close_infile(); /* close the sound input file */ - return 0; -} - -/* end of mp3rtp.c */ diff --git a/src/lib/dl/ext/lame/mp3x.c b/src/lib/dl/ext/lame/mp3x.c deleted file mode 100755 index e8472a9d..00000000 --- a/src/lib/dl/ext/lame/mp3x.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $Id: mp3x.c,v 1.28 2010/04/08 11:07:50 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdio.h> - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "lame-analysis.h" -#include <gtk/gtk.h> -#include "parse.h" -#include "get_audio.h" -#include "gtkanal.h" -#include "lametime.h" - -#include "main.h" -#include "console.h" - - -/************************************************************************ -* -* main -* -* PURPOSE: MPEG-1,2 Layer III encoder with GPSYCHO -* psychoacoustic model. -* -************************************************************************/ -int -lame_main(lame_t gf, int argc, char **argv) -{ - unsigned char mp3buffer[LAME_MAXMP3BUFFER]; - char outPath[PATH_MAX + 1]; - char inPath[PATH_MAX + 1]; - int ret; - - lame_set_errorf(gf, &frontend_errorf); - lame_set_debugf(gf, &frontend_debugf); - lame_set_msgf(gf, &frontend_msgf); - if (argc <= 1) { - usage(stderr, argv[0]); /* no command-line args */ - return -1; - } - ret = parse_args(gf, argc, argv, inPath, outPath, NULL, NULL); - if (ret < 0) { - return ret == -2 ? 0 : 1; - } - (void) lame_set_analysis(gf, 1); - - if (init_infile(gf, inPath) < 0) { - error_printf("Can't init infile '%s'\n", inPath); - return 1; - } - lame_init_params(gf); - lame_print_config(gf); - - gtk_init(&argc, &argv); - gtkcontrol(gf, inPath); - - lame_encode_flush(gf, mp3buffer, sizeof(mp3buffer)); - close_infile(); - return 0; -} diff --git a/src/lib/dl/ext/lame/mpg123.h b/src/lib/dl/ext/lame/mpg123.h deleted file mode 100755 index 6ac8b67c..00000000 --- a/src/lib/dl/ext/lame/mpg123.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 MPG123_H_INCLUDED -#define MPG123_H_INCLUDED - -#include <stdio.h> - -#ifdef STDC_HEADERS -# include <string.h> -#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 <signal.h> - - -#if defined(__riscos__) && defined(FPA10) -#include "ymath.h" -#else -#include <math.h> -#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 - -#undef REAL_IS_FLOAT -#define REAL_IS_FLOAT - -#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 2880 - -/* 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 single; /* single channel (monophonic) */ - int lsf; /* 0 = MPEG-1, 1 = MPEG-2/2.5 */ - int mpeg25; /* 1 = MPEG-2.5, 0 = MPEG-1/2 */ - int header_change; - int lay; /* Layer */ - int error_protection; /* 1 = CRC-16 code following header */ - int bitrate_index; - int sampling_frequency; /* sample rate of decompressed audio in Hz */ - int padding; - int extension; - int mode; - int mode_ext; - int copyright; - int original; - int emphasis; - int framesize; /* computed framesize */ - - /* AF: ADDED FOR LAYER1/LAYER2 */ - int II_sblimit; - struct al_table2 const *alloc; - int down_sample_sblimit; - int down_sample; - - -}; - -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/src/lib/dl/ext/lame/mpglib.h b/src/lib/dl/ext/lame/mpglib.h deleted file mode 100755 index 7ab4d5f4..00000000 --- a/src/lib/dl/ext/lame/mpglib.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 _MPGLIB_H_ -#define _MPGLIB_H_ - -#include "lame.h" - -#ifndef plotting_data_defined -#define plotting_data_defined -struct plotting_data; -typedef struct plotting_data plotting_data; -#endif - - -extern void lame_report_fnc(lame_report_function f, const char *format, ...); - -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; /* buffer linked list pointers, tail points to oldest buffer */ - 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 */ - /* header_parsed, side_parsed and data_parsed must be all set 1 - before the full frame has been parsed */ - int header_parsed; /* 1 = header of current frame has been parsed */ - int side_parsed; /* 1 = header of sideinfo of current frame has been 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; /* number of bytes used for side information, including 2 bytes for CRC-16 if present */ - int dsize; - int fsizeold; /* size of previous frame, -1 for first */ - int fsizeold_nopadding; - struct frame fr; /* holds the parameters decoded from the header */ - struct III_sideinfo sideinfo; - unsigned char bsspace[2][MAXFRAMESIZE + 1024]; /* bit stream space used ???? */ /* 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; /* 1 = bitstream is yet to be synchronized */ - - int bitindex; - unsigned char *wordpointer; - plotting_data *pinfo; - - lame_report_function report_msg; - lame_report_function report_dbg; - lame_report_function report_err; -} MPSTR, *PMPSTR; - - -#define MP3_ERR -1 -#define MP3_OK 0 -#define MP3_NEED_MORE 1 - - - -#endif /* _MPGLIB_H_ */ diff --git a/src/lib/dl/ext/lame/mpglib_interface.c b/src/lib/dl/ext/lame/mpglib_interface.c deleted file mode 100755 index 5b90211b..00000000 --- a/src/lib/dl/ext/lame/mpglib_interface.c +++ /dev/null @@ -1,476 +0,0 @@ -/* -*- mode: C; mode: fold -*- */ -/* - * LAME MP3 encoding engine - * - * Copyright (c) 1999-2000 Mark Taylor - * Copyright (c) 2003 Olcios - * Copyright (c) 2008 Robert Hegemann - * - * 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. - */ - -/* $Id: mpglib_interface.c,v 1.42 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifdef HAVE_MPGLIB -#define hip_global_struct mpstr_tag -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "interface.h" - -#include "util.h" - - - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -/* - * OBSOLETE: - * - kept to let it link - * - forward declaration to silence compiler - */ -int CDECL lame_decode_init(void); -int CDECL lame_decode( - unsigned char * mp3buf, - int len, - short pcm_l[], - short pcm_r[] ); -int CDECL lame_decode_headers( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data ); -int CDECL lame_decode1( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[] ); -int CDECL lame_decode1_headers( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data ); -int CDECL lame_decode1_headersB( - unsigned char* mp3buf, - int len, - short pcm_l[], - short pcm_r[], - mp3data_struct* mp3data, - int *enc_delay, - int *enc_padding ); -int CDECL lame_decode_exit(void); -#endif - - -static MPSTR mp; - -int -lame_decode_exit(void) -{ - ExitMP3(&mp); - return 0; -} - - -int -lame_decode_init(void) -{ - (void) InitMP3(&mp); - return 0; -} - - - - -/* copy mono samples */ -#define COPY_MONO(DST_TYPE, SRC_TYPE) \ - DST_TYPE *pcm_l = (DST_TYPE *)pcm_l_raw; \ - SRC_TYPE const *p_samples = (SRC_TYPE const *)p; \ - for (i = 0; i < processed_samples; i++) \ - *pcm_l++ = (DST_TYPE)(*p_samples++); - -/* copy stereo samples */ -#define COPY_STEREO(DST_TYPE, SRC_TYPE) \ - DST_TYPE *pcm_l = (DST_TYPE *)pcm_l_raw, *pcm_r = (DST_TYPE *)pcm_r_raw; \ - SRC_TYPE const *p_samples = (SRC_TYPE const *)p; \ - for (i = 0; i < processed_samples; i++) { \ - *pcm_l++ = (DST_TYPE)(*p_samples++); \ - *pcm_r++ = (DST_TYPE)(*p_samples++); \ - } - - - -/* - * For lame_decode: return code - * -1 error - * 0 ok, but need more data before outputing any samples - * n number of samples output. either 576 or 1152 depending on MP3 file. - */ - -static int -decode1_headersB_clipchoice(PMPSTR pmp, unsigned char *buffer, int len, - char pcm_l_raw[], char pcm_r_raw[], mp3data_struct * mp3data, - int *enc_delay, int *enc_padding, - char *p, size_t psize, int decoded_sample_size, - int (*decodeMP3_ptr) (PMPSTR, unsigned char *, int, char *, int, - int *)) -{ - static const int smpls[2][4] = { - /* Layer I II III */ - {0, 384, 1152, 1152}, /* MPEG-1 */ - {0, 384, 1152, 576} /* MPEG-2(.5) */ - }; - - int processed_bytes; - int processed_samples; /* processed samples per channel */ - int ret; - int i; - - mp3data->header_parsed = 0; - - ret = (*decodeMP3_ptr) (pmp, buffer, len, p, (int) psize, &processed_bytes); - /* three cases: - * 1. headers parsed, but data not complete - * pmp->header_parsed==1 - * pmp->framesize=0 - * pmp->fsizeold=size of last frame, or 0 if this is first frame - * - * 2. headers, data parsed, but ancillary data not complete - * pmp->header_parsed==1 - * pmp->framesize=size of frame - * pmp->fsizeold=size of last frame, or 0 if this is first frame - * - * 3. frame fully decoded: - * pmp->header_parsed==0 - * pmp->framesize=0 - * pmp->fsizeold=size of frame (which is now the last frame) - * - */ - if (pmp->header_parsed || pmp->fsizeold > 0 || pmp->framesize > 0) { - mp3data->header_parsed = 1; - mp3data->stereo = pmp->fr.stereo; - mp3data->samplerate = freqs[pmp->fr.sampling_frequency]; - mp3data->mode = pmp->fr.mode; - mp3data->mode_ext = pmp->fr.mode_ext; - mp3data->framesize = smpls[pmp->fr.lsf][pmp->fr.lay]; - - /* free format, we need the entire frame before we can determine - * the bitrate. If we haven't gotten the entire frame, bitrate=0 */ - if (pmp->fsizeold > 0) /* works for free format and fixed, no overrun, temporal results are < 400.e6 */ - mp3data->bitrate = 8 * (4 + pmp->fsizeold) * mp3data->samplerate / - (1.e3 * mp3data->framesize) + 0.5; - else if (pmp->framesize > 0) - mp3data->bitrate = 8 * (4 + pmp->framesize) * mp3data->samplerate / - (1.e3 * mp3data->framesize) + 0.5; - else - mp3data->bitrate = tabsel_123[pmp->fr.lsf][pmp->fr.lay - 1][pmp->fr.bitrate_index]; - - - - if (pmp->num_frames > 0) { - /* Xing VBR header found and num_frames was set */ - mp3data->totalframes = pmp->num_frames; - mp3data->nsamp = mp3data->framesize * pmp->num_frames; - *enc_delay = pmp->enc_delay; - *enc_padding = pmp->enc_padding; - } - } - - switch (ret) { - case MP3_OK: - switch (pmp->fr.stereo) { - case 1: - processed_samples = processed_bytes / decoded_sample_size; - if (decoded_sample_size == sizeof(short)) { - COPY_MONO(short, short) - } - else { - COPY_MONO(sample_t, FLOAT) - } - break; - case 2: - processed_samples = (processed_bytes / decoded_sample_size) >> 1; - if (decoded_sample_size == sizeof(short)) { - COPY_STEREO(short, short) - } - else { - COPY_STEREO(sample_t, FLOAT) - } - break; - default: - processed_samples = -1; - assert(0); - break; - } - break; - - case MP3_NEED_MORE: - processed_samples = 0; - break; - - case MP3_ERR: - processed_samples = -1; - break; - - default: - processed_samples = -1; - assert(0); - break; - } - - /*fprintf(stderr,"ok, more, err: %i %i %i\n", MP3_OK, MP3_NEED_MORE, MP3_ERR ); */ - /*fprintf(stderr,"ret = %i out=%i\n", ret, processed_samples ); */ - return processed_samples; -} - - -#define OUTSIZE_CLIPPED (4096*sizeof(short)) - -int -lame_decode1_headersB(unsigned char *buffer, - int len, - short pcm_l[], short pcm_r[], mp3data_struct * mp3data, - int *enc_delay, int *enc_padding) -{ - static char out[OUTSIZE_CLIPPED]; - - return decode1_headersB_clipchoice(&mp, buffer, len, (char *) pcm_l, (char *) pcm_r, mp3data, - enc_delay, enc_padding, out, OUTSIZE_CLIPPED, - sizeof(short), decodeMP3); -} - - - - - -/* - * For lame_decode: return code - * -1 error - * 0 ok, but need more data before outputing any samples - * n number of samples output. Will be at most one frame of - * MPEG data. - */ - -int -lame_decode1_headers(unsigned char *buffer, - int len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data) -{ - int enc_delay, enc_padding; - return lame_decode1_headersB(buffer, len, pcm_l, pcm_r, mp3data, &enc_delay, &enc_padding); -} - - -int -lame_decode1(unsigned char *buffer, int len, short pcm_l[], short pcm_r[]) -{ - mp3data_struct mp3data; - - return lame_decode1_headers(buffer, len, pcm_l, pcm_r, &mp3data); -} - - -/* - * For lame_decode: return code - * -1 error - * 0 ok, but need more data before outputing any samples - * n number of samples output. a multiple of 576 or 1152 depending on MP3 file. - */ - -int -lame_decode_headers(unsigned char *buffer, - int len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data) -{ - int ret; - int totsize = 0; /* number of decoded samples per channel */ - - for (;;) { - switch (ret = lame_decode1_headers(buffer, len, pcm_l + totsize, pcm_r + totsize, mp3data)) { - case -1: - return ret; - case 0: - return totsize; - default: - totsize += ret; - len = 0; /* future calls to decodeMP3 are just to flush buffers */ - break; - } - } -} - - -int -lame_decode(unsigned char *buffer, int len, short pcm_l[], short pcm_r[]) -{ - mp3data_struct mp3data; - - return lame_decode_headers(buffer, len, pcm_l, pcm_r, &mp3data); -} - - - - -hip_t hip_decode_init(void) -{ - hip_t hip = calloc(1, sizeof(hip_global_flags)); - InitMP3(hip); - return hip; -} - - -int hip_decode_exit(hip_t hip) -{ - if (hip) { - ExitMP3(hip); - free(hip); - } - return 0; -} - - -/* we forbid input with more than 1152 samples per channel for output in the unclipped mode */ -#define OUTSIZE_UNCLIPPED (1152*2*sizeof(FLOAT)) - -int -hip_decode1_unclipped(hip_t hip, unsigned char *buffer, size_t len, sample_t pcm_l[], sample_t pcm_r[]) -{ - static char out[OUTSIZE_UNCLIPPED]; - mp3data_struct mp3data; - int enc_delay, enc_padding; - - if (hip) { - return decode1_headersB_clipchoice(hip, buffer, len, (char *) pcm_l, (char *) pcm_r, &mp3data, - &enc_delay, &enc_padding, out, OUTSIZE_UNCLIPPED, - sizeof(FLOAT), decodeMP3_unclipped); - } - return 0; -} - -/* - * For hip_decode: return code - * -1 error - * 0 ok, but need more data before outputing any samples - * n number of samples output. Will be at most one frame of - * MPEG data. - */ - -int -hip_decode1_headers(hip_t hip, unsigned char *buffer, - size_t len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data) -{ - int enc_delay, enc_padding; - return hip_decode1_headersB(hip, buffer, len, pcm_l, pcm_r, mp3data, &enc_delay, &enc_padding); -} - - -int -hip_decode1(hip_t hip, unsigned char *buffer, size_t len, short pcm_l[], short pcm_r[]) -{ - mp3data_struct mp3data; - return hip_decode1_headers(hip, buffer, len, pcm_l, pcm_r, &mp3data); -} - - -/* - * For hip_decode: return code - * -1 error - * 0 ok, but need more data before outputing any samples - * n number of samples output. a multiple of 576 or 1152 depending on MP3 file. - */ - -int -hip_decode_headers(hip_t hip, unsigned char *buffer, - size_t len, short pcm_l[], short pcm_r[], mp3data_struct * mp3data) -{ - int ret; - int totsize = 0; /* number of decoded samples per channel */ - - for (;;) { - switch (ret = hip_decode1_headers(hip, buffer, len, pcm_l + totsize, pcm_r + totsize, mp3data)) { - case -1: - return ret; - case 0: - return totsize; - default: - totsize += ret; - len = 0; /* future calls to decodeMP3 are just to flush buffers */ - break; - } - } -} - - -int -hip_decode(hip_t hip, unsigned char *buffer, size_t len, short pcm_l[], short pcm_r[]) -{ - mp3data_struct mp3data; - return hip_decode_headers(hip, buffer, len, pcm_l, pcm_r, &mp3data); -} - - -int -hip_decode1_headersB(hip_t hip, unsigned char *buffer, - size_t len, - short pcm_l[], short pcm_r[], mp3data_struct * mp3data, - int *enc_delay, int *enc_padding) -{ - static char out[OUTSIZE_CLIPPED]; - if (hip) { - return decode1_headersB_clipchoice(hip, buffer, len, (char *) pcm_l, (char *) pcm_r, mp3data, - enc_delay, enc_padding, out, OUTSIZE_CLIPPED, - sizeof(short), decodeMP3); - } - return -1; -} - - -void hip_set_pinfo(hip_t hip, plotting_data* pinfo) -{ - if (hip) { - hip->pinfo = pinfo; - } -} - - - -void hip_set_errorf(hip_t hip, lame_report_function func) -{ - if (hip) { - hip->report_err = func; - } -} - -void hip_set_debugf(hip_t hip, lame_report_function func) -{ - if (hip) { - hip->report_dbg = func; - } -} - -void hip_set_msgf (hip_t hip, lame_report_function func) -{ - if (hip) { - hip->report_msg = func; - } -} - -#endif - -/* end of mpglib_interface.c */ diff --git a/src/lib/dl/ext/lame/newmdct.c b/src/lib/dl/ext/lame/newmdct.c deleted file mode 100755 index 596cac91..00000000 --- a/src/lib/dl/ext/lame/newmdct.c +++ /dev/null @@ -1,1039 +0,0 @@ -/* - * MP3 window subband -> subband filtering -> mdct routine - * - * Copyright (c) 1999-2000 Takehiro Tominaga - * - * - * 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. - */ - -/* - * Special Thanks to Patrick De Smet for your advices. - */ - -/* $Id: newmdct.c,v 1.39 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "newmdct.h" - - - -#ifndef USE_GOGO_SUBBAND -static const FLOAT enwindow[] = { - -4.77e-07 * 0.740951125354959 / 2.384e-06, 1.03951e-04 * 0.740951125354959 / 2.384e-06, - 9.53674e-04 * 0.740951125354959 / 2.384e-06, 2.841473e-03 * 0.740951125354959 / 2.384e-06, - 3.5758972e-02 * 0.740951125354959 / 2.384e-06, 3.401756e-03 * 0.740951125354959 / 2.384e-06, 9.83715e-04 * 0.740951125354959 / 2.384e-06, 9.9182e-05 * 0.740951125354959 / 2.384e-06, /* 15 */ - 1.2398e-05 * 0.740951125354959 / 2.384e-06, 1.91212e-04 * 0.740951125354959 / 2.384e-06, - 2.283096e-03 * 0.740951125354959 / 2.384e-06, 1.6994476e-02 * 0.740951125354959 / 2.384e-06, - -1.8756866e-02 * 0.740951125354959 / 2.384e-06, -2.630711e-03 * 0.740951125354959 / 2.384e-06, - -2.47478e-04 * 0.740951125354959 / 2.384e-06, -1.4782e-05 * 0.740951125354959 / 2.384e-06, - 9.063471690191471e-01, - 1.960342806591213e-01, - - - -4.77e-07 * 0.773010453362737 / 2.384e-06, 1.05858e-04 * 0.773010453362737 / 2.384e-06, - 9.30786e-04 * 0.773010453362737 / 2.384e-06, 2.521515e-03 * 0.773010453362737 / 2.384e-06, - 3.5694122e-02 * 0.773010453362737 / 2.384e-06, 3.643036e-03 * 0.773010453362737 / 2.384e-06, 9.91821e-04 * 0.773010453362737 / 2.384e-06, 9.6321e-05 * 0.773010453362737 / 2.384e-06, /* 14 */ - 1.1444e-05 * 0.773010453362737 / 2.384e-06, 1.65462e-04 * 0.773010453362737 / 2.384e-06, - 2.110004e-03 * 0.773010453362737 / 2.384e-06, 1.6112804e-02 * 0.773010453362737 / 2.384e-06, - -1.9634247e-02 * 0.773010453362737 / 2.384e-06, -2.803326e-03 * 0.773010453362737 / 2.384e-06, - -2.77042e-04 * 0.773010453362737 / 2.384e-06, -1.6689e-05 * 0.773010453362737 / 2.384e-06, - 8.206787908286602e-01, - 3.901806440322567e-01, - - - -4.77e-07 * 0.803207531480645 / 2.384e-06, 1.07288e-04 * 0.803207531480645 / 2.384e-06, - 9.02653e-04 * 0.803207531480645 / 2.384e-06, 2.174854e-03 * 0.803207531480645 / 2.384e-06, - 3.5586357e-02 * 0.803207531480645 / 2.384e-06, 3.858566e-03 * 0.803207531480645 / 2.384e-06, 9.95159e-04 * 0.803207531480645 / 2.384e-06, 9.3460e-05 * 0.803207531480645 / 2.384e-06, /* 13 */ - 1.0014e-05 * 0.803207531480645 / 2.384e-06, 1.40190e-04 * 0.803207531480645 / 2.384e-06, - 1.937389e-03 * 0.803207531480645 / 2.384e-06, 1.5233517e-02 * 0.803207531480645 / 2.384e-06, - -2.0506859e-02 * 0.803207531480645 / 2.384e-06, -2.974033e-03 * 0.803207531480645 / 2.384e-06, - -3.07560e-04 * 0.803207531480645 / 2.384e-06, -1.8120e-05 * 0.803207531480645 / 2.384e-06, - 7.416505462720353e-01, - 5.805693545089249e-01, - - - -4.77e-07 * 0.831469612302545 / 2.384e-06, 1.08242e-04 * 0.831469612302545 / 2.384e-06, - 8.68797e-04 * 0.831469612302545 / 2.384e-06, 1.800537e-03 * 0.831469612302545 / 2.384e-06, - 3.5435200e-02 * 0.831469612302545 / 2.384e-06, 4.049301e-03 * 0.831469612302545 / 2.384e-06, 9.94205e-04 * 0.831469612302545 / 2.384e-06, 9.0599e-05 * 0.831469612302545 / 2.384e-06, /* 12 */ - 9.060e-06 * 0.831469612302545 / 2.384e-06, 1.16348e-04 * 0.831469612302545 / 2.384e-06, - 1.766682e-03 * 0.831469612302545 / 2.384e-06, 1.4358521e-02 * 0.831469612302545 / 2.384e-06, - -2.1372318e-02 * 0.831469612302545 / 2.384e-06, -3.14188e-03 * 0.831469612302545 / 2.384e-06, - -3.39031e-04 * 0.831469612302545 / 2.384e-06, -1.9550e-05 * 0.831469612302545 / 2.384e-06, - 6.681786379192989e-01, - 7.653668647301797e-01, - - - -4.77e-07 * 0.857728610000272 / 2.384e-06, 1.08719e-04 * 0.857728610000272 / 2.384e-06, - 8.29220e-04 * 0.857728610000272 / 2.384e-06, 1.399517e-03 * 0.857728610000272 / 2.384e-06, - 3.5242081e-02 * 0.857728610000272 / 2.384e-06, 4.215240e-03 * 0.857728610000272 / 2.384e-06, 9.89437e-04 * 0.857728610000272 / 2.384e-06, 8.7261e-05 * 0.857728610000272 / 2.384e-06, /* 11 */ - 8.106e-06 * 0.857728610000272 / 2.384e-06, 9.3937e-05 * 0.857728610000272 / 2.384e-06, - 1.597881e-03 * 0.857728610000272 / 2.384e-06, 1.3489246e-02 * 0.857728610000272 / 2.384e-06, - -2.2228718e-02 * 0.857728610000272 / 2.384e-06, -3.306866e-03 * 0.857728610000272 / 2.384e-06, - -3.71456e-04 * 0.857728610000272 / 2.384e-06, -2.1458e-05 * 0.857728610000272 / 2.384e-06, - 5.993769336819237e-01, - 9.427934736519954e-01, - - - -4.77e-07 * 0.881921264348355 / 2.384e-06, 1.08719e-04 * 0.881921264348355 / 2.384e-06, - 7.8392e-04 * 0.881921264348355 / 2.384e-06, 9.71317e-04 * 0.881921264348355 / 2.384e-06, - 3.5007000e-02 * 0.881921264348355 / 2.384e-06, 4.357815e-03 * 0.881921264348355 / 2.384e-06, 9.80854e-04 * 0.881921264348355 / 2.384e-06, 8.3923e-05 * 0.881921264348355 / 2.384e-06, /* 10 */ - 7.629e-06 * 0.881921264348355 / 2.384e-06, 7.2956e-05 * 0.881921264348355 / 2.384e-06, - 1.432419e-03 * 0.881921264348355 / 2.384e-06, 1.2627602e-02 * 0.881921264348355 / 2.384e-06, - -2.3074150e-02 * 0.881921264348355 / 2.384e-06, -3.467083e-03 * 0.881921264348355 / 2.384e-06, - -4.04358e-04 * 0.881921264348355 / 2.384e-06, -2.3365e-05 * 0.881921264348355 / 2.384e-06, - 5.345111359507916e-01, - 1.111140466039205e+00, - - - -9.54e-07 * 0.903989293123443 / 2.384e-06, 1.08242e-04 * 0.903989293123443 / 2.384e-06, - 7.31945e-04 * 0.903989293123443 / 2.384e-06, 5.15938e-04 * 0.903989293123443 / 2.384e-06, - 3.4730434e-02 * 0.903989293123443 / 2.384e-06, 4.477024e-03 * 0.903989293123443 / 2.384e-06, 9.68933e-04 * 0.903989293123443 / 2.384e-06, 8.0585e-05 * 0.903989293123443 / 2.384e-06, /* 9 */ - 6.676e-06 * 0.903989293123443 / 2.384e-06, 5.2929e-05 * 0.903989293123443 / 2.384e-06, - 1.269817e-03 * 0.903989293123443 / 2.384e-06, 1.1775017e-02 * 0.903989293123443 / 2.384e-06, - -2.3907185e-02 * 0.903989293123443 / 2.384e-06, -3.622532e-03 * 0.903989293123443 / 2.384e-06, - -4.38213e-04 * 0.903989293123443 / 2.384e-06, -2.5272e-05 * 0.903989293123443 / 2.384e-06, - 4.729647758913199e-01, - 1.268786568327291e+00, - - - -9.54e-07 * 0.92387953251128675613 / 2.384e-06, - 1.06812e-04 * 0.92387953251128675613 / 2.384e-06, - 6.74248e-04 * 0.92387953251128675613 / 2.384e-06, - 3.3379e-05 * 0.92387953251128675613 / 2.384e-06, - 3.4412861e-02 * 0.92387953251128675613 / 2.384e-06, - 4.573822e-03 * 0.92387953251128675613 / 2.384e-06, - 9.54151e-04 * 0.92387953251128675613 / 2.384e-06, - 7.6771e-05 * 0.92387953251128675613 / 2.384e-06, - 6.199e-06 * 0.92387953251128675613 / 2.384e-06, 3.4332e-05 * 0.92387953251128675613 / 2.384e-06, - 1.111031e-03 * 0.92387953251128675613 / 2.384e-06, - 1.0933399e-02 * 0.92387953251128675613 / 2.384e-06, - -2.4725437e-02 * 0.92387953251128675613 / 2.384e-06, - -3.771782e-03 * 0.92387953251128675613 / 2.384e-06, - -4.72546e-04 * 0.92387953251128675613 / 2.384e-06, - -2.7657e-05 * 0.92387953251128675613 / 2.384e-06, - 4.1421356237309504879e-01, /* tan(PI/8) */ - 1.414213562373095e+00, - - - -9.54e-07 * 0.941544065183021 / 2.384e-06, 1.05381e-04 * 0.941544065183021 / 2.384e-06, - 6.10352e-04 * 0.941544065183021 / 2.384e-06, -4.75883e-04 * 0.941544065183021 / 2.384e-06, - 3.4055710e-02 * 0.941544065183021 / 2.384e-06, 4.649162e-03 * 0.941544065183021 / 2.384e-06, 9.35555e-04 * 0.941544065183021 / 2.384e-06, 7.3433e-05 * 0.941544065183021 / 2.384e-06, /* 7 */ - 5.245e-06 * 0.941544065183021 / 2.384e-06, 1.7166e-05 * 0.941544065183021 / 2.384e-06, - 9.56535e-04 * 0.941544065183021 / 2.384e-06, 1.0103703e-02 * 0.941544065183021 / 2.384e-06, - -2.5527000e-02 * 0.941544065183021 / 2.384e-06, -3.914356e-03 * 0.941544065183021 / 2.384e-06, - -5.07355e-04 * 0.941544065183021 / 2.384e-06, -3.0041e-05 * 0.941544065183021 / 2.384e-06, - 3.578057213145241e-01, - 1.546020906725474e+00, - - - -9.54e-07 * 0.956940335732209 / 2.384e-06, 1.02520e-04 * 0.956940335732209 / 2.384e-06, - 5.39303e-04 * 0.956940335732209 / 2.384e-06, -1.011848e-03 * 0.956940335732209 / 2.384e-06, - 3.3659935e-02 * 0.956940335732209 / 2.384e-06, 4.703045e-03 * 0.956940335732209 / 2.384e-06, 9.15051e-04 * 0.956940335732209 / 2.384e-06, 7.0095e-05 * 0.956940335732209 / 2.384e-06, /* 6 */ - 4.768e-06 * 0.956940335732209 / 2.384e-06, 9.54e-07 * 0.956940335732209 / 2.384e-06, - 8.06808e-04 * 0.956940335732209 / 2.384e-06, 9.287834e-03 * 0.956940335732209 / 2.384e-06, - -2.6310921e-02 * 0.956940335732209 / 2.384e-06, -4.048824e-03 * 0.956940335732209 / 2.384e-06, - -5.42164e-04 * 0.956940335732209 / 2.384e-06, -3.2425e-05 * 0.956940335732209 / 2.384e-06, - 3.033466836073424e-01, - 1.662939224605090e+00, - - - -1.431e-06 * 0.970031253194544 / 2.384e-06, 9.9182e-05 * 0.970031253194544 / 2.384e-06, - 4.62532e-04 * 0.970031253194544 / 2.384e-06, -1.573563e-03 * 0.970031253194544 / 2.384e-06, - 3.3225536e-02 * 0.970031253194544 / 2.384e-06, 4.737377e-03 * 0.970031253194544 / 2.384e-06, 8.91685e-04 * 0.970031253194544 / 2.384e-06, 6.6280e-05 * 0.970031253194544 / 2.384e-06, /* 5 */ - 4.292e-06 * 0.970031253194544 / 2.384e-06, -1.3828e-05 * 0.970031253194544 / 2.384e-06, - 6.61850e-04 * 0.970031253194544 / 2.384e-06, 8.487225e-03 * 0.970031253194544 / 2.384e-06, - -2.7073860e-02 * 0.970031253194544 / 2.384e-06, -4.174709e-03 * 0.970031253194544 / 2.384e-06, - -5.76973e-04 * 0.970031253194544 / 2.384e-06, -3.4809e-05 * 0.970031253194544 / 2.384e-06, - 2.504869601913055e-01, - 1.763842528696710e+00, - - - -1.431e-06 * 0.98078528040323 / 2.384e-06, 9.5367e-05 * 0.98078528040323 / 2.384e-06, - 3.78609e-04 * 0.98078528040323 / 2.384e-06, -2.161503e-03 * 0.98078528040323 / 2.384e-06, - 3.2754898e-02 * 0.98078528040323 / 2.384e-06, 4.752159e-03 * 0.98078528040323 / 2.384e-06, 8.66413e-04 * 0.98078528040323 / 2.384e-06, 6.2943e-05 * 0.98078528040323 / 2.384e-06, /* 4 */ - 3.815e-06 * 0.98078528040323 / 2.384e-06, -2.718e-05 * 0.98078528040323 / 2.384e-06, - 5.22137e-04 * 0.98078528040323 / 2.384e-06, 7.703304e-03 * 0.98078528040323 / 2.384e-06, - -2.7815342e-02 * 0.98078528040323 / 2.384e-06, -4.290581e-03 * 0.98078528040323 / 2.384e-06, - -6.11782e-04 * 0.98078528040323 / 2.384e-06, -3.7670e-05 * 0.98078528040323 / 2.384e-06, - 1.989123673796580e-01, - 1.847759065022573e+00, - - - -1.907e-06 * 0.989176509964781 / 2.384e-06, 9.0122e-05 * 0.989176509964781 / 2.384e-06, - 2.88486e-04 * 0.989176509964781 / 2.384e-06, -2.774239e-03 * 0.989176509964781 / 2.384e-06, - 3.2248020e-02 * 0.989176509964781 / 2.384e-06, 4.748821e-03 * 0.989176509964781 / 2.384e-06, 8.38757e-04 * 0.989176509964781 / 2.384e-06, 5.9605e-05 * 0.989176509964781 / 2.384e-06, /* 3 */ - 3.338e-06 * 0.989176509964781 / 2.384e-06, -3.9577e-05 * 0.989176509964781 / 2.384e-06, - 3.88145e-04 * 0.989176509964781 / 2.384e-06, 6.937027e-03 * 0.989176509964781 / 2.384e-06, - -2.8532982e-02 * 0.989176509964781 / 2.384e-06, -4.395962e-03 * 0.989176509964781 / 2.384e-06, - -6.46591e-04 * 0.989176509964781 / 2.384e-06, -4.0531e-05 * 0.989176509964781 / 2.384e-06, - 1.483359875383474e-01, - 1.913880671464418e+00, - - - -1.907e-06 * 0.995184726672197 / 2.384e-06, 8.4400e-05 * 0.995184726672197 / 2.384e-06, - 1.91689e-04 * 0.995184726672197 / 2.384e-06, -3.411293e-03 * 0.995184726672197 / 2.384e-06, - 3.1706810e-02 * 0.995184726672197 / 2.384e-06, 4.728317e-03 * 0.995184726672197 / 2.384e-06, - 8.09669e-04 * 0.995184726672197 / 2.384e-06, 5.579e-05 * 0.995184726672197 / 2.384e-06, - 3.338e-06 * 0.995184726672197 / 2.384e-06, -5.0545e-05 * 0.995184726672197 / 2.384e-06, - 2.59876e-04 * 0.995184726672197 / 2.384e-06, 6.189346e-03 * 0.995184726672197 / 2.384e-06, - -2.9224873e-02 * 0.995184726672197 / 2.384e-06, -4.489899e-03 * 0.995184726672197 / 2.384e-06, - -6.80923e-04 * 0.995184726672197 / 2.384e-06, -4.3392e-05 * 0.995184726672197 / 2.384e-06, - 9.849140335716425e-02, - 1.961570560806461e+00, - - - -2.384e-06 * 0.998795456205172 / 2.384e-06, 7.7724e-05 * 0.998795456205172 / 2.384e-06, - 8.8215e-05 * 0.998795456205172 / 2.384e-06, -4.072189e-03 * 0.998795456205172 / 2.384e-06, - 3.1132698e-02 * 0.998795456205172 / 2.384e-06, 4.691124e-03 * 0.998795456205172 / 2.384e-06, - 7.79152e-04 * 0.998795456205172 / 2.384e-06, 5.2929e-05 * 0.998795456205172 / 2.384e-06, - 2.861e-06 * 0.998795456205172 / 2.384e-06, -6.0558e-05 * 0.998795456205172 / 2.384e-06, - 1.37329e-04 * 0.998795456205172 / 2.384e-06, 5.462170e-03 * 0.998795456205172 / 2.384e-06, - -2.9890060e-02 * 0.998795456205172 / 2.384e-06, -4.570484e-03 * 0.998795456205172 / 2.384e-06, - -7.14302e-04 * 0.998795456205172 / 2.384e-06, -4.6253e-05 * 0.998795456205172 / 2.384e-06, - 4.912684976946725e-02, - 1.990369453344394e+00, - - - 3.5780907e-02 * SQRT2 * 0.5 / 2.384e-06, 1.7876148e-02 * SQRT2 * 0.5 / 2.384e-06, - 3.134727e-03 * SQRT2 * 0.5 / 2.384e-06, 2.457142e-03 * SQRT2 * 0.5 / 2.384e-06, - 9.71317e-04 * SQRT2 * 0.5 / 2.384e-06, 2.18868e-04 * SQRT2 * 0.5 / 2.384e-06, - 1.01566e-04 * SQRT2 * 0.5 / 2.384e-06, 1.3828e-05 * SQRT2 * 0.5 / 2.384e-06, - - 3.0526638e-02 / 2.384e-06, 4.638195e-03 / 2.384e-06, 7.47204e-04 / 2.384e-06, - 4.9591e-05 / 2.384e-06, - 4.756451e-03 / 2.384e-06, 2.1458e-05 / 2.384e-06, -6.9618e-05 / 2.384e-06, /* 2.384e-06/2.384e-06 */ -}; -#endif - - -#define NS 12 -#define NL 36 - -static const FLOAT win[4][NL] = { - { - 2.382191739347913e-13, - 6.423305872147834e-13, - 9.400849094049688e-13, - 1.122435026096556e-12, - 1.183840321267481e-12, - 1.122435026096556e-12, - 9.400849094049690e-13, - 6.423305872147839e-13, - 2.382191739347918e-13, - - 5.456116108943412e-12, - 4.878985199565852e-12, - 4.240448995017367e-12, - 3.559909094758252e-12, - 2.858043359288075e-12, - 2.156177623817898e-12, - 1.475637723558783e-12, - 8.371015190102974e-13, - 2.599706096327376e-13, - - -5.456116108943412e-12, - -4.878985199565852e-12, - -4.240448995017367e-12, - -3.559909094758252e-12, - -2.858043359288076e-12, - -2.156177623817898e-12, - -1.475637723558783e-12, - -8.371015190102975e-13, - -2.599706096327376e-13, - - -2.382191739347923e-13, - -6.423305872147843e-13, - -9.400849094049696e-13, - -1.122435026096556e-12, - -1.183840321267481e-12, - -1.122435026096556e-12, - -9.400849094049694e-13, - -6.423305872147840e-13, - -2.382191739347918e-13, - }, - { - 2.382191739347913e-13, - 6.423305872147834e-13, - 9.400849094049688e-13, - 1.122435026096556e-12, - 1.183840321267481e-12, - 1.122435026096556e-12, - 9.400849094049688e-13, - 6.423305872147841e-13, - 2.382191739347918e-13, - - 5.456116108943413e-12, - 4.878985199565852e-12, - 4.240448995017367e-12, - 3.559909094758253e-12, - 2.858043359288075e-12, - 2.156177623817898e-12, - 1.475637723558782e-12, - 8.371015190102975e-13, - 2.599706096327376e-13, - - -5.461314069809755e-12, - -4.921085770524055e-12, - -4.343405037091838e-12, - -3.732668368707687e-12, - -3.093523840190885e-12, - -2.430835727329465e-12, - -1.734679010007751e-12, - -9.748253656609281e-13, - -2.797435120168326e-13, - - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - -2.283748241799531e-13, - -4.037858874020686e-13, - -2.146547464825323e-13, - }, - { - 1.316524975873958e-01, /* win[SHORT_TYPE] */ - 4.142135623730950e-01, - 7.673269879789602e-01, - - 1.091308501069271e+00, /* tantab_l */ - 1.303225372841206e+00, - 1.569685577117490e+00, - 1.920982126971166e+00, - 2.414213562373094e+00, - 3.171594802363212e+00, - 4.510708503662055e+00, - 7.595754112725146e+00, - 2.290376554843115e+01, - - 0.98480775301220802032, /* cx */ - 0.64278760968653936292, - 0.34202014332566882393, - 0.93969262078590842791, - -0.17364817766693030343, - -0.76604444311897790243, - 0.86602540378443870761, - 0.500000000000000e+00, - - -5.144957554275265e-01, /* ca */ - -4.717319685649723e-01, - -3.133774542039019e-01, - -1.819131996109812e-01, - -9.457419252642064e-02, - -4.096558288530405e-02, - -1.419856857247115e-02, - -3.699974673760037e-03, - - 8.574929257125442e-01, /* cs */ - 8.817419973177052e-01, - 9.496286491027329e-01, - 9.833145924917901e-01, - 9.955178160675857e-01, - 9.991605581781475e-01, - 9.998991952444470e-01, - 9.999931550702802e-01, - }, - { - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - 0.000000000000000e+00, - 2.283748241799531e-13, - 4.037858874020686e-13, - 2.146547464825323e-13, - - 5.461314069809755e-12, - 4.921085770524055e-12, - 4.343405037091838e-12, - 3.732668368707687e-12, - 3.093523840190885e-12, - 2.430835727329466e-12, - 1.734679010007751e-12, - 9.748253656609281e-13, - 2.797435120168326e-13, - - -5.456116108943413e-12, - -4.878985199565852e-12, - -4.240448995017367e-12, - -3.559909094758253e-12, - -2.858043359288075e-12, - -2.156177623817898e-12, - -1.475637723558782e-12, - -8.371015190102975e-13, - -2.599706096327376e-13, - - -2.382191739347913e-13, - -6.423305872147834e-13, - -9.400849094049688e-13, - -1.122435026096556e-12, - -1.183840321267481e-12, - -1.122435026096556e-12, - -9.400849094049688e-13, - -6.423305872147841e-13, - -2.382191739347918e-13, - } -}; - -#define tantab_l (win[SHORT_TYPE]+3) -#define cx (win[SHORT_TYPE]+12) -#define ca (win[SHORT_TYPE]+20) -#define cs (win[SHORT_TYPE]+28) - -/************************************************************************ -* -* window_subband() -* -* PURPOSE: Overlapping window on PCM samples -* -* SEMANTICS: -* 32 16-bit pcm samples are scaled to fractional 2's complement and -* concatenated to the end of the window buffer #x#. The updated window -* buffer #x# is then windowed by the analysis window #c# to produce the -* windowed sample #z# -* -************************************************************************/ - -/* - * new IDCT routine written by Takehiro TOMINAGA - */ -static const int order[] = { - 0, 1, 16, 17, 8, 9, 24, 25, 4, 5, 20, 21, 12, 13, 28, 29, - 2, 3, 18, 19, 10, 11, 26, 27, 6, 7, 22, 23, 14, 15, 30, 31 -}; - - -/* returns sum_j=0^31 a[j]*cos(PI*j*(k+1/2)/32), 0<=k<32 */ -inline static void -window_subband(const sample_t * x1, FLOAT a[SBLIMIT]) -{ - int i; - FLOAT const *wp = enwindow + 10; - - const sample_t *x2 = &x1[238 - 14 - 286]; - - for (i = -15; i < 0; i++) { - FLOAT w, s, t; - - w = wp[-10]; - s = x2[-224] * w; - t = x1[224] * w; - w = wp[-9]; - s += x2[-160] * w; - t += x1[160] * w; - w = wp[-8]; - s += x2[-96] * w; - t += x1[96] * w; - w = wp[-7]; - s += x2[-32] * w; - t += x1[32] * w; - w = wp[-6]; - s += x2[32] * w; - t += x1[-32] * w; - w = wp[-5]; - s += x2[96] * w; - t += x1[-96] * w; - w = wp[-4]; - s += x2[160] * w; - t += x1[-160] * w; - w = wp[-3]; - s += x2[224] * w; - t += x1[-224] * w; - - w = wp[-2]; - s += x1[-256] * w; - t -= x2[256] * w; - w = wp[-1]; - s += x1[-192] * w; - t -= x2[192] * w; - w = wp[0]; - s += x1[-128] * w; - t -= x2[128] * w; - w = wp[1]; - s += x1[-64] * w; - t -= x2[64] * w; - w = wp[2]; - s += x1[0] * w; - t -= x2[0] * w; - w = wp[3]; - s += x1[64] * w; - t -= x2[-64] * w; - w = wp[4]; - s += x1[128] * w; - t -= x2[-128] * w; - w = wp[5]; - s += x1[192] * w; - t -= x2[-192] * w; - - /* - * this multiplyer could be removed, but it needs more 256 FLOAT data. - * thinking about the data cache performance, I think we should not - * use such a huge table. tt 2000/Oct/25 - */ - s *= wp[6]; - w = t - s; - a[30 + i * 2] = t + s; - a[31 + i * 2] = wp[7] * w; - wp += 18; - x1--; - x2++; - } - { - FLOAT s, t, u, v; - t = x1[-16] * wp[-10]; - s = x1[-32] * wp[-2]; - t += (x1[-48] - x1[16]) * wp[-9]; - s += x1[-96] * wp[-1]; - t += (x1[-80] + x1[48]) * wp[-8]; - s += x1[-160] * wp[0]; - t += (x1[-112] - x1[80]) * wp[-7]; - s += x1[-224] * wp[1]; - t += (x1[-144] + x1[112]) * wp[-6]; - s -= x1[32] * wp[2]; - t += (x1[-176] - x1[144]) * wp[-5]; - s -= x1[96] * wp[3]; - t += (x1[-208] + x1[176]) * wp[-4]; - s -= x1[160] * wp[4]; - t += (x1[-240] - x1[208]) * wp[-3]; - s -= x1[224]; - - u = s - t; - v = s + t; - - t = a[14]; - s = a[15] - t; - - a[31] = v + t; /* A0 */ - a[30] = u + s; /* A1 */ - a[15] = u - s; /* A2 */ - a[14] = v - t; /* A3 */ - } - { - FLOAT xr; - xr = a[28] - a[0]; - a[0] += a[28]; - a[28] = xr * wp[-2 * 18 + 7]; - xr = a[29] - a[1]; - a[1] += a[29]; - a[29] = xr * wp[-2 * 18 + 7]; - - xr = a[26] - a[2]; - a[2] += a[26]; - a[26] = xr * wp[-4 * 18 + 7]; - xr = a[27] - a[3]; - a[3] += a[27]; - a[27] = xr * wp[-4 * 18 + 7]; - - xr = a[24] - a[4]; - a[4] += a[24]; - a[24] = xr * wp[-6 * 18 + 7]; - xr = a[25] - a[5]; - a[5] += a[25]; - a[25] = xr * wp[-6 * 18 + 7]; - - xr = a[22] - a[6]; - a[6] += a[22]; - a[22] = xr * SQRT2; - xr = a[23] - a[7]; - a[7] += a[23]; - a[23] = xr * SQRT2 - a[7]; - a[7] -= a[6]; - a[22] -= a[7]; - a[23] -= a[22]; - - xr = a[6]; - a[6] = a[31] - xr; - a[31] = a[31] + xr; - xr = a[7]; - a[7] = a[30] - xr; - a[30] = a[30] + xr; - xr = a[22]; - a[22] = a[15] - xr; - a[15] = a[15] + xr; - xr = a[23]; - a[23] = a[14] - xr; - a[14] = a[14] + xr; - - xr = a[20] - a[8]; - a[8] += a[20]; - a[20] = xr * wp[-10 * 18 + 7]; - xr = a[21] - a[9]; - a[9] += a[21]; - a[21] = xr * wp[-10 * 18 + 7]; - - xr = a[18] - a[10]; - a[10] += a[18]; - a[18] = xr * wp[-12 * 18 + 7]; - xr = a[19] - a[11]; - a[11] += a[19]; - a[19] = xr * wp[-12 * 18 + 7]; - - xr = a[16] - a[12]; - a[12] += a[16]; - a[16] = xr * wp[-14 * 18 + 7]; - xr = a[17] - a[13]; - a[13] += a[17]; - a[17] = xr * wp[-14 * 18 + 7]; - - xr = -a[20] + a[24]; - a[20] += a[24]; - a[24] = xr * wp[-12 * 18 + 7]; - xr = -a[21] + a[25]; - a[21] += a[25]; - a[25] = xr * wp[-12 * 18 + 7]; - - xr = a[4] - a[8]; - a[4] += a[8]; - a[8] = xr * wp[-12 * 18 + 7]; - xr = a[5] - a[9]; - a[5] += a[9]; - a[9] = xr * wp[-12 * 18 + 7]; - - xr = a[0] - a[12]; - a[0] += a[12]; - a[12] = xr * wp[-4 * 18 + 7]; - xr = a[1] - a[13]; - a[1] += a[13]; - a[13] = xr * wp[-4 * 18 + 7]; - xr = a[16] - a[28]; - a[16] += a[28]; - a[28] = xr * wp[-4 * 18 + 7]; - xr = -a[17] + a[29]; - a[17] += a[29]; - a[29] = xr * wp[-4 * 18 + 7]; - - xr = SQRT2 * (a[2] - a[10]); - a[2] += a[10]; - a[10] = xr; - xr = SQRT2 * (a[3] - a[11]); - a[3] += a[11]; - a[11] = xr; - xr = SQRT2 * (-a[18] + a[26]); - a[18] += a[26]; - a[26] = xr - a[18]; - xr = SQRT2 * (-a[19] + a[27]); - a[19] += a[27]; - a[27] = xr - a[19]; - - xr = a[2]; - a[19] -= a[3]; - a[3] -= xr; - a[2] = a[31] - xr; - a[31] += xr; - xr = a[3]; - a[11] -= a[19]; - a[18] -= xr; - a[3] = a[30] - xr; - a[30] += xr; - xr = a[18]; - a[27] -= a[11]; - a[19] -= xr; - a[18] = a[15] - xr; - a[15] += xr; - - xr = a[19]; - a[10] -= xr; - a[19] = a[14] - xr; - a[14] += xr; - xr = a[10]; - a[11] -= xr; - a[10] = a[23] - xr; - a[23] += xr; - xr = a[11]; - a[26] -= xr; - a[11] = a[22] - xr; - a[22] += xr; - xr = a[26]; - a[27] -= xr; - a[26] = a[7] - xr; - a[7] += xr; - - xr = a[27]; - a[27] = a[6] - xr; - a[6] += xr; - - xr = SQRT2 * (a[0] - a[4]); - a[0] += a[4]; - a[4] = xr; - xr = SQRT2 * (a[1] - a[5]); - a[1] += a[5]; - a[5] = xr; - xr = SQRT2 * (a[16] - a[20]); - a[16] += a[20]; - a[20] = xr; - xr = SQRT2 * (a[17] - a[21]); - a[17] += a[21]; - a[21] = xr; - - xr = -SQRT2 * (a[8] - a[12]); - a[8] += a[12]; - a[12] = xr - a[8]; - xr = -SQRT2 * (a[9] - a[13]); - a[9] += a[13]; - a[13] = xr - a[9]; - xr = -SQRT2 * (a[25] - a[29]); - a[25] += a[29]; - a[29] = xr - a[25]; - xr = -SQRT2 * (a[24] + a[28]); - a[24] -= a[28]; - a[28] = xr - a[24]; - - xr = a[24] - a[16]; - a[24] = xr; - xr = a[20] - xr; - a[20] = xr; - xr = a[28] - xr; - a[28] = xr; - - xr = a[25] - a[17]; - a[25] = xr; - xr = a[21] - xr; - a[21] = xr; - xr = a[29] - xr; - a[29] = xr; - - xr = a[17] - a[1]; - a[17] = xr; - xr = a[9] - xr; - a[9] = xr; - xr = a[25] - xr; - a[25] = xr; - xr = a[5] - xr; - a[5] = xr; - xr = a[21] - xr; - a[21] = xr; - xr = a[13] - xr; - a[13] = xr; - xr = a[29] - xr; - a[29] = xr; - - xr = a[1] - a[0]; - a[1] = xr; - xr = a[16] - xr; - a[16] = xr; - xr = a[17] - xr; - a[17] = xr; - xr = a[8] - xr; - a[8] = xr; - xr = a[9] - xr; - a[9] = xr; - xr = a[24] - xr; - a[24] = xr; - xr = a[25] - xr; - a[25] = xr; - xr = a[4] - xr; - a[4] = xr; - xr = a[5] - xr; - a[5] = xr; - xr = a[20] - xr; - a[20] = xr; - xr = a[21] - xr; - a[21] = xr; - xr = a[12] - xr; - a[12] = xr; - xr = a[13] - xr; - a[13] = xr; - xr = a[28] - xr; - a[28] = xr; - xr = a[29] - xr; - a[29] = xr; - - xr = a[0]; - a[0] += a[31]; - a[31] -= xr; - xr = a[1]; - a[1] += a[30]; - a[30] -= xr; - xr = a[16]; - a[16] += a[15]; - a[15] -= xr; - xr = a[17]; - a[17] += a[14]; - a[14] -= xr; - xr = a[8]; - a[8] += a[23]; - a[23] -= xr; - xr = a[9]; - a[9] += a[22]; - a[22] -= xr; - xr = a[24]; - a[24] += a[7]; - a[7] -= xr; - xr = a[25]; - a[25] += a[6]; - a[6] -= xr; - xr = a[4]; - a[4] += a[27]; - a[27] -= xr; - xr = a[5]; - a[5] += a[26]; - a[26] -= xr; - xr = a[20]; - a[20] += a[11]; - a[11] -= xr; - xr = a[21]; - a[21] += a[10]; - a[10] -= xr; - xr = a[12]; - a[12] += a[19]; - a[19] -= xr; - xr = a[13]; - a[13] += a[18]; - a[18] -= xr; - xr = a[28]; - a[28] += a[3]; - a[3] -= xr; - xr = a[29]; - a[29] += a[2]; - a[2] -= xr; - } - -} - - -/*-------------------------------------------------------------------*/ -/* */ -/* Function: Calculation of the MDCT */ -/* In the case of long blocks (type 0,1,3) there are */ -/* 36 coefficents in the time domain and 18 in the frequency */ -/* domain. */ -/* In the case of short blocks (type 2) there are 3 */ -/* transformations with short length. This leads to 12 coefficents */ -/* in the time and 6 in the frequency domain. In this case the */ -/* results are stored side by side in the vector out[]. */ -/* */ -/* New layer3 */ -/* */ -/*-------------------------------------------------------------------*/ - -inline static void -mdct_short(FLOAT * inout) -{ - int l; - for (l = 0; l < 3; l++) { - FLOAT tc0, tc1, tc2, ts0, ts1, ts2; - - ts0 = inout[2 * 3] * win[SHORT_TYPE][0] - inout[5 * 3]; - tc0 = inout[0 * 3] * win[SHORT_TYPE][2] - inout[3 * 3]; - tc1 = ts0 + tc0; - tc2 = ts0 - tc0; - - ts0 = inout[5 * 3] * win[SHORT_TYPE][0] + inout[2 * 3]; - tc0 = inout[3 * 3] * win[SHORT_TYPE][2] + inout[0 * 3]; - ts1 = ts0 + tc0; - ts2 = -ts0 + tc0; - - tc0 = (inout[1 * 3] * win[SHORT_TYPE][1] - inout[4 * 3]) * 2.069978111953089e-11; /* tritab_s[1] */ - ts0 = (inout[4 * 3] * win[SHORT_TYPE][1] + inout[1 * 3]) * 2.069978111953089e-11; /* tritab_s[1] */ - - inout[3 * 0] = tc1 * 1.907525191737280e-11 /* tritab_s[2] */ + tc0; - inout[3 * 5] = -ts1 * 1.907525191737280e-11 /* tritab_s[0] */ + ts0; - - tc2 = tc2 * 0.86602540378443870761 * 1.907525191737281e-11 /* tritab_s[2] */ ; - ts1 = ts1 * 0.5 * 1.907525191737281e-11 + ts0; - inout[3 * 1] = tc2 - ts1; - inout[3 * 2] = tc2 + ts1; - - tc1 = tc1 * 0.5 * 1.907525191737281e-11 - tc0; - ts2 = ts2 * 0.86602540378443870761 * 1.907525191737281e-11 /* tritab_s[0] */ ; - inout[3 * 3] = tc1 + ts2; - inout[3 * 4] = tc1 - ts2; - - inout++; - } -} - -inline static void -mdct_long(FLOAT * out, FLOAT const *in) -{ - FLOAT ct, st; - { - FLOAT tc1, tc2, tc3, tc4, ts5, ts6, ts7, ts8; - /* 1,2, 5,6, 9,10, 13,14, 17 */ - tc1 = in[17] - in[9]; - tc3 = in[15] - in[11]; - tc4 = in[14] - in[12]; - ts5 = in[0] + in[8]; - ts6 = in[1] + in[7]; - ts7 = in[2] + in[6]; - ts8 = in[3] + in[5]; - - out[17] = (ts5 + ts7 - ts8) - (ts6 - in[4]); - st = (ts5 + ts7 - ts8) * cx[7] + (ts6 - in[4]); - ct = (tc1 - tc3 - tc4) * cx[6]; - out[5] = ct + st; - out[6] = ct - st; - - tc2 = (in[16] - in[10]) * cx[6]; - ts6 = ts6 * cx[7] + in[4]; - ct = tc1 * cx[0] + tc2 + tc3 * cx[1] + tc4 * cx[2]; - st = -ts5 * cx[4] + ts6 - ts7 * cx[5] + ts8 * cx[3]; - out[1] = ct + st; - out[2] = ct - st; - - ct = tc1 * cx[1] - tc2 - tc3 * cx[2] + tc4 * cx[0]; - st = -ts5 * cx[5] + ts6 - ts7 * cx[3] + ts8 * cx[4]; - out[9] = ct + st; - out[10] = ct - st; - - ct = tc1 * cx[2] - tc2 + tc3 * cx[0] - tc4 * cx[1]; - st = ts5 * cx[3] - ts6 + ts7 * cx[4] - ts8 * cx[5]; - out[13] = ct + st; - out[14] = ct - st; - } - { - FLOAT ts1, ts2, ts3, ts4, tc5, tc6, tc7, tc8; - - ts1 = in[8] - in[0]; - ts3 = in[6] - in[2]; - ts4 = in[5] - in[3]; - tc5 = in[17] + in[9]; - tc6 = in[16] + in[10]; - tc7 = in[15] + in[11]; - tc8 = in[14] + in[12]; - - out[0] = (tc5 + tc7 + tc8) + (tc6 + in[13]); - ct = (tc5 + tc7 + tc8) * cx[7] - (tc6 + in[13]); - st = (ts1 - ts3 + ts4) * cx[6]; - out[11] = ct + st; - out[12] = ct - st; - - ts2 = (in[7] - in[1]) * cx[6]; - tc6 = in[13] - tc6 * cx[7]; - ct = tc5 * cx[3] - tc6 + tc7 * cx[4] + tc8 * cx[5]; - st = ts1 * cx[2] + ts2 + ts3 * cx[0] + ts4 * cx[1]; - out[3] = ct + st; - out[4] = ct - st; - - ct = -tc5 * cx[5] + tc6 - tc7 * cx[3] - tc8 * cx[4]; - st = ts1 * cx[1] + ts2 - ts3 * cx[2] - ts4 * cx[0]; - out[7] = ct + st; - out[8] = ct - st; - - ct = -tc5 * cx[4] + tc6 - tc7 * cx[5] - tc8 * cx[3]; - st = ts1 * cx[0] - ts2 + ts3 * cx[1] - ts4 * cx[2]; - out[15] = ct + st; - out[16] = ct - st; - } -} - - -void -mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - int gr, k, ch; - const sample_t *wk; - - wk = w0 + 286; - /* thinking cache performance, ch->gr loop is better than gr->ch loop */ - for (ch = 0; ch < cfg->channels_out; ch++) { - for (gr = 0; gr < cfg->mode_gr; gr++) { - int band; - gr_info *const gi = &(gfc->l3_side.tt[gr][ch]); - FLOAT *mdct_enc = gi->xr; - FLOAT *samp = esv->sb_sample[ch][1 - gr][0]; - - for (k = 0; k < 18 / 2; k++) { - window_subband(wk, samp); - window_subband(wk + 32, samp + 32); - samp += 64; - wk += 64; - /* - * Compensate for inversion in the analysis filter - */ - for (band = 1; band < 32; band += 2) { - samp[band - 32] *= -1; - } - } - - /* - * Perform imdct of 18 previous subband samples - * + 18 current subband samples - */ - for (band = 0; band < 32; band++, mdct_enc += 18) { - int type = gi->block_type; - FLOAT const *const band0 = esv->sb_sample[ch][gr][0] + order[band]; - FLOAT *const band1 = esv->sb_sample[ch][1 - gr][0] + order[band]; - if (gi->mixed_block_flag && band < 2) - type = 0; - if (esv->amp_filter[band] < 1e-12) { - memset(mdct_enc, 0, 18 * sizeof(FLOAT)); - } - else { - if (esv->amp_filter[band] < 1.0) { - for (k = 0; k < 18; k++) - band1[k * 32] *= esv->amp_filter[band]; - } - if (type == SHORT_TYPE) { - for (k = -NS / 4; k < 0; k++) { - FLOAT const w = win[SHORT_TYPE][k + 3]; - mdct_enc[k * 3 + 9] = band0[(9 + k) * 32] * w - band0[(8 - k) * 32]; - mdct_enc[k * 3 + 18] = band0[(14 - k) * 32] * w + band0[(15 + k) * 32]; - mdct_enc[k * 3 + 10] = band0[(15 + k) * 32] * w - band0[(14 - k) * 32]; - mdct_enc[k * 3 + 19] = band1[(2 - k) * 32] * w + band1[(3 + k) * 32]; - mdct_enc[k * 3 + 11] = band1[(3 + k) * 32] * w - band1[(2 - k) * 32]; - mdct_enc[k * 3 + 20] = band1[(8 - k) * 32] * w + band1[(9 + k) * 32]; - } - mdct_short(mdct_enc); - } - else { - FLOAT work[18]; - for (k = -NL / 4; k < 0; k++) { - FLOAT a, b; - a = win[type][k + 27] * band1[(k + 9) * 32] - + win[type][k + 36] * band1[(8 - k) * 32]; - b = win[type][k + 9] * band0[(k + 9) * 32] - - win[type][k + 18] * band0[(8 - k) * 32]; - work[k + 9] = a - b * tantab_l[k + 9]; - work[k + 18] = a * tantab_l[k + 9] + b; - } - - mdct_long(mdct_enc, work); - } - } - /* - * Perform aliasing reduction butterfly - */ - if (type != SHORT_TYPE && band != 0) { - for (k = 7; k >= 0; --k) { - FLOAT bu, bd; - bu = mdct_enc[k] * ca[k] + mdct_enc[-1 - k] * cs[k]; - bd = mdct_enc[k] * cs[k] - mdct_enc[-1 - k] * ca[k]; - - mdct_enc[-1 - k] = bu; - mdct_enc[k] = bd; - } - } - } - } - wk = w1 + 286; - if (cfg->mode_gr == 1) { - memcpy(esv->sb_sample[ch][0], esv->sb_sample[ch][1], 576 * sizeof(FLOAT)); - } - } -} diff --git a/src/lib/dl/ext/lame/newmdct.h b/src/lib/dl/ext/lame/newmdct.h deleted file mode 100755 index 0b58a954..00000000 --- a/src/lib/dl/ext/lame/newmdct.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * New Modified DCT include file - * - * Copyright (c) 1999 Takehiro TOMINAGA - * - * 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_NEWMDCT_H -#define LAME_NEWMDCT_H - -void mdct_sub48(lame_internal_flags * gfc, const sample_t * w0, const sample_t * w1); - -#endif /* LAME_NEWMDCT_H */ diff --git a/src/lib/dl/ext/lame/parse.c b/src/lib/dl/ext/lame/parse.c deleted file mode 100755 index ea2ae199..00000000 --- a/src/lib/dl/ext/lame/parse.c +++ /dev/null @@ -1,2396 +0,0 @@ -/* - * Command line parsing related functions - * - * Copyright (c) 1999 Mark Taylor - * 2000-2011 Robert Hegemann - * - * 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. - */ - -/* $Id: parse.c,v 1.292 2011/11/01 16:59:57 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <ctype.h> - -#ifdef STDC_HEADERS -# include <stdio.h> -# include <stdlib.h> -# include <string.h> -#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 - - -#ifdef HAVE_LIMITS_H -# include <limits.h> -#endif - -#include "lame.h" - -#include "parse.h" -#include "main.h" -#include "get_audio.h" -#include "version.h" -#include "console.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - - -#ifdef HAVE_ICONV -#include <iconv.h> -#include <errno.h> -#endif - -#if defined _ALLOW_INTERNAL_OPTIONS -#define INTERNAL_OPTS 1 -#else -#define INTERNAL_OPTS 0 -#endif - -#if (INTERNAL_OPTS!=0) -#include "set_get.h" -#define DEV_HELP(a) a -#else -#define DEV_HELP(a) -#endif - -static int const lame_alpha_version_enabled = LAME_ALPHA_VERSION; -static int const internal_opts_enabled = INTERNAL_OPTS; - -/* GLOBAL VARIABLES. set by parse_args() */ -/* we need to clean this up */ - -ReaderConfig global_reader = { sf_unknown, 0, 0, 0 }; -WriterConfig global_writer = { 0 }; - -UiConfig global_ui_config = {0,0,0,0}; - -DecoderConfig global_decoder; - -RawPCMConfig global_raw_pcm = -{ /* in_bitwidth */ 16 -, /* in_signed */ -1 -, /* in_endian */ ByteOrderLittleEndian -}; - - - -/* possible text encodings */ -typedef enum TextEncoding -{ TENC_RAW /* bytes will be stored as-is into ID3 tags, which are Latin1 per definition */ -, TENC_LATIN1 /* text will be converted from local encoding to Latin1, as ID3 needs it */ -, TENC_UTF16 /* text will be converted from local encoding to Unicode, as ID3v2 wants it */ -} TextEncoding; - -#ifdef HAVE_ICONV -#define ID3TAGS_EXTENDED -/* search for Zero termination in multi-byte strings */ -static size_t -strlenMultiByte(char const* str, size_t w) -{ - size_t n = 0; - if (str != 0) { - size_t i, x = 0; - for (n = 0; ; ++n) { - x = 0; - for (i = 0; i < w; ++i) { - x += *str++ == 0 ? 1 : 0; - } - if (x == w) { - break; - } - } - } - return n; -} - - -static size_t -currCharCodeSize(void) -{ - size_t n = 1; - char dst[32]; - char* src = "A"; - char* env_lang = getenv("LANG"); - char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.'); - char* cur_code = xxx_code == NULL ? "" : xxx_code+1; - iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1"); - if (xiconv != (iconv_t)-1) { - for (n = 0; n < 32; ++n) { - char* i_ptr = src; - char* o_ptr = dst; - size_t srcln = 1; - size_t avail = n; - size_t rc = iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail); - if (rc != (size_t)-1) { - break; - } - } - iconv_close(xiconv); - } - return n; -} - -#if 0 -static -char* fromLatin1( char* src ) -{ - char* dst = 0; - if (src != 0) { - size_t const l = strlen(src); - size_t const n = l*4; - dst = calloc(n+4, 4); - if (dst != 0) { - char* env_lang = getenv("LANG"); - char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.'); - char* cur_code = xxx_code == NULL ? "" : xxx_code+1; - iconv_t xiconv = iconv_open(cur_code, "ISO_8859-1"); - if (xiconv != (iconv_t)-1) { - char* i_ptr = src; - char* o_ptr = dst; - size_t srcln = l; - size_t avail = n; - iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail); - iconv_close(xiconv); - } - } - } - return dst; -} - -static -char* fromUtf16( char* src ) -{ - char* dst = 0; - if (src != 0) { - size_t const l = strlenMultiByte(src, 2); - size_t const n = l*4; - dst = calloc(n+4, 4); - if (dst != 0) { - char* env_lang = getenv("LANG"); - char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.'); - char* cur_code = xxx_code == NULL ? "" : xxx_code+1; - iconv_t xiconv = iconv_open(cur_code, "UTF-16LE"); - if (xiconv != (iconv_t)-1) { - char* i_ptr = (char*)src; - char* o_ptr = dst; - size_t srcln = l*2; - size_t avail = n; - iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail); - iconv_close(xiconv); - } - } - } - return dst; -} -#endif - -static -char* toLatin1( char* src ) -{ - size_t w = currCharCodeSize(); - char* dst = 0; - if (src != 0) { - size_t const l = strlenMultiByte(src, w); - size_t const n = l*4; - dst = calloc(n+4, 4); - if (dst != 0) { - char* env_lang = getenv("LANG"); - char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.'); - char* cur_code = xxx_code == NULL ? "" : xxx_code+1; - iconv_t xiconv = iconv_open("ISO_8859-1//TRANSLIT", cur_code); - if (xiconv != (iconv_t)-1) { - char* i_ptr = (char*)src; - char* o_ptr = dst; - size_t srcln = l*w; - size_t avail = n; - iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail); - iconv_close(xiconv); - } - } - } - return dst; -} - - -static -char* toUtf16( char* src ) -{ - size_t w = currCharCodeSize(); - char* dst = 0; - if (src != 0) { - size_t const l = strlenMultiByte(src, w); - size_t const n = (l+1)*4; - dst = calloc(n+4, 4); - if (dst != 0) { - char* env_lang = getenv("LANG"); - char* xxx_code = env_lang == NULL ? NULL : strrchr(env_lang, '.'); - char* cur_code = xxx_code == NULL ? "" : xxx_code+1; - iconv_t xiconv = iconv_open("UTF-16LE//TRANSLIT", cur_code); - dst[0] = 0xff; - dst[1] = 0xfe; - if (xiconv != (iconv_t)-1) { - char* i_ptr = (char*)src; - char* o_ptr = &dst[2]; - size_t srcln = l*w; - size_t avail = n; - iconv(xiconv, &i_ptr, &srcln, &o_ptr, &avail); - iconv_close(xiconv); - } - } - } - return dst; -} -#endif - -#if defined( _WIN32 ) && !defined(__MINGW32__) -#define ID3TAGS_EXTENDED - -char* toLatin1(char const* s) -{ - return utf8ToLatin1(s); -} - -unsigned short* toUtf16(char const* s) -{ - return utf8ToUtf16(s); -} -#endif - - -static int -set_id3v2tag(lame_global_flags* gfp, int type, unsigned short const* str) -{ - switch (type) - { - case 'a': return id3tag_set_textinfo_utf16(gfp, "TPE1", str); - case 't': return id3tag_set_textinfo_utf16(gfp, "TIT2", str); - case 'l': return id3tag_set_textinfo_utf16(gfp, "TALB", str); - case 'g': return id3tag_set_textinfo_utf16(gfp, "TCON", str); - case 'c': return id3tag_set_comment_utf16(gfp, 0, 0, str); - case 'n': return id3tag_set_textinfo_utf16(gfp, "TRCK", str); - case 'y': return id3tag_set_textinfo_utf16(gfp, "TYER", str); - case 'v': return id3tag_set_fieldvalue_utf16(gfp, str); - } - return 0; -} - - -static int -set_id3tag(lame_global_flags* gfp, int type, char const* str) -{ - switch (type) - { - case 'a': return id3tag_set_artist(gfp, str), 0; - case 't': return id3tag_set_title(gfp, str), 0; - case 'l': return id3tag_set_album(gfp, str), 0; - case 'g': return id3tag_set_genre(gfp, str); - case 'c': return id3tag_set_comment(gfp, str), 0; - case 'n': return id3tag_set_track(gfp, str); - case 'y': return id3tag_set_year(gfp, str), 0; - case 'v': return id3tag_set_fieldvalue(gfp, str); - } - return 0; -} - -static int -id3_tag(lame_global_flags* gfp, int type, TextEncoding enc, char* str) -{ - void* x = 0; - int result; - if (enc == TENC_UTF16 && type != 'v' ) { - id3_tag(gfp, type, TENC_LATIN1, str); /* for id3v1 */ - } - switch (enc) - { - default: -#ifdef ID3TAGS_EXTENDED - case TENC_LATIN1: x = toLatin1(str); break; - case TENC_UTF16: x = toUtf16(str); break; -#else - case TENC_RAW: x = strdup(str); break; -#endif - } - switch (enc) - { - default: -#ifdef ID3TAGS_EXTENDED - case TENC_LATIN1: result = set_id3tag(gfp, type, x); break; - case TENC_UTF16: result = set_id3v2tag(gfp, type, x); break; -#else - case TENC_RAW: result = set_id3tag(gfp, type, x); break; -#endif - } - free(x); - return result; -} - - - - -/************************************************************************ -* -* license -* -* PURPOSE: Writes version and license to the file specified by fp -* -************************************************************************/ - -static int -lame_version_print(FILE * const fp) -{ - const char *b = get_lame_os_bitness(); - const char *v = get_lame_version(); - const char *u = get_lame_url(); - const size_t lenb = strlen(b); - const size_t lenv = strlen(v); - const size_t lenu = strlen(u); - const size_t lw = 80; /* line width of terminal in characters */ - const size_t sw = 16; /* static width of text */ - - if (lw >= lenb + lenv + lenu + sw || lw < lenu + 2) - /* text fits in 80 chars per line, or line even too small for url */ - if (lenb > 0) - fprintf(fp, "LAME %s version %s (%s)\n\n", b, v, u); - else - fprintf(fp, "LAME version %s (%s)\n\n", v, u); - else { - int const n_white_spaces = ((lenu+2) > lw ? 0 : lw-2-lenu); - /* text too long, wrap url into next line, right aligned */ - if (lenb > 0) - fprintf(fp, "LAME %s version %s\n%*s(%s)\n\n", b, v, n_white_spaces, "", u); - else - fprintf(fp, "LAME version %s\n%*s(%s)\n\n", v, n_white_spaces, "", u); - } - if (lame_alpha_version_enabled) - fprintf(fp, "warning: alpha versions should be used for testing only\n\n"); - - - return 0; -} - -static int -print_license(FILE * const fp) -{ /* print version & license */ - lame_version_print(fp); - fprintf(fp, - "Copyright (c) 1999-2011 by The LAME Project\n" - "Copyright (c) 1999,2000,2001 by Mark Taylor\n" - "Copyright (c) 1998 by Michael Cheng\n" - "Copyright (c) 1995,1996,1997 by Michael Hipp: mpglib\n" "\n"); - fprintf(fp, - "This library is free software; you can redistribute it and/or\n" - "modify it under the terms of the GNU Library General Public\n" - "License as published by the Free Software Foundation; either\n" - "version 2 of the License, or (at your option) any later version.\n" - "\n" - "This library is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" - "Library General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU Library General Public\n" - "License along with this program. If not, see\n" - "<http://www.gnu.org/licenses/>.\n"); - return 0; -} - - -/************************************************************************ -* -* usage -* -* PURPOSE: Writes command line syntax to the file specified by fp -* -************************************************************************/ - -int -usage(FILE * const fp, const char *ProgramName) -{ /* print general syntax */ - lame_version_print(fp); - fprintf(fp, - "usage: %s [options] <infile> [outfile]\n" - "\n" - " <infile> and/or <outfile> can be \"-\", which means stdin/stdout.\n" - "\n" - "Try:\n" - " \"%s --help\" for general usage information\n" - " or:\n" - " \"%s --preset help\" for information on suggested predefined settings\n" - " or:\n" - " \"%s --longhelp\"\n" - " or \"%s -?\" for a complete options list\n\n", - ProgramName, ProgramName, ProgramName, ProgramName, ProgramName); - return 0; -} - - -/************************************************************************ -* -* usage -* -* PURPOSE: Writes command line syntax to the file specified by fp -* but only the most important ones, to fit on a vt100 terminal -* -************************************************************************/ - -int -short_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName) -{ /* print short syntax help */ - lame_version_print(fp); - fprintf(fp, - "usage: %s [options] <infile> [outfile]\n" - "\n" - " <infile> and/or <outfile> can be \"-\", which means stdin/stdout.\n" - "\n" "RECOMMENDED:\n" " lame -V2 input.wav output.mp3\n" "\n", ProgramName); - fprintf(fp, - "OPTIONS:\n" - " -b bitrate set the bitrate, default 128 kbps\n" - " -h higher quality, but a little slower. Recommended.\n" - " -f fast mode (lower quality)\n" - " -V n quality setting for VBR. default n=%i\n" - " 0=high quality,bigger files. 9=smaller files\n", - lame_get_VBR_q(gfp)); - fprintf(fp, - " --preset type type must be \"medium\", \"standard\", \"extreme\", \"insane\",\n" - " or a value for an average desired bitrate and depending\n" - " on the value specified, appropriate quality settings will\n" - " be used.\n" - " \"--preset help\" gives more info on these\n" "\n"); - fprintf(fp, -#if defined(WIN32) - " --priority type sets the process priority\n" - " 0,1 = Low priority\n" - " 2 = normal priority\n" - " 3,4 = High priority\n" "\n" -#endif -#if defined(__OS2__) - " --priority type sets the process priority\n" - " 0 = Low priority\n" - " 1 = Medium priority\n" - " 2 = Regular priority\n" - " 3 = High priority\n" - " 4 = Maximum priority\n" "\n" -#endif - " --help id3 ID3 tagging related options\n" "\n" - DEV_HELP( - " --help dev developer options\n" "\n" - ) - " --longhelp full list of options\n" "\n" - " --license print License information\n\n" - ); - - return 0; -} - -/************************************************************************ -* -* usage -* -* PURPOSE: Writes command line syntax to the file specified by fp -* -************************************************************************/ - -static void -wait_for(FILE * const fp, int lessmode) -{ - if (lessmode) { - fflush(fp); - getchar(); - } - else { - fprintf(fp, "\n"); - } - fprintf(fp, "\n"); -} - -static void -help_id3tag(FILE * const fp) -{ - fprintf(fp, - " ID3 tag options:\n" - " --tt <title> audio/song title (max 30 chars for version 1 tag)\n" - " --ta <artist> audio/song artist (max 30 chars for version 1 tag)\n" - " --tl <album> audio/song album (max 30 chars for version 1 tag)\n" - " --ty <year> audio/song year of issue (1 to 9999)\n" - " --tc <comment> user-defined text (max 30 chars for v1 tag, 28 for v1.1)\n" - " --tn <track[/total]> audio/song track number and (optionally) the total\n" - " number of tracks on the original recording. (track\n" - " and total each 1 to 255. just the track number\n" - " creates v1.1 tag, providing a total forces v2.0).\n" - " --tg <genre> audio/song genre (name or number in list)\n" - " --ti <file> audio/song albumArt (jpeg/png/gif file, v2.3 tag)\n" - " --tv <id=value> user-defined frame specified by id and value (v2.3 tag)\n" - ); - fprintf(fp, - " --add-id3v2 force addition of version 2 tag\n" - " --id3v1-only add only a version 1 tag\n" - " --id3v2-only add only a version 2 tag\n" -#ifdef ID3TAGS_EXTENDED - " --id3v2-utf16 add following options in unicode text encoding\n" - " --id3v2-latin1 add following options in latin-1 text encoding\n" -#endif - " --space-id3v1 pad version 1 tag with spaces instead of nulls\n" - " --pad-id3v2 same as '--pad-id3v2-size 128'\n" - " --pad-id3v2-size <value> adds version 2 tag, pad with extra <value> bytes\n" - " --genre-list print alphabetically sorted ID3 genre list and exit\n" - " --ignore-tag-errors ignore errors in values passed for tags\n" "\n" - ); - fprintf(fp, - " Note: A version 2 tag will NOT be added unless one of the input fields\n" - " won't fit in a version 1 tag (e.g. the title string is longer than 30\n" - " characters), or the '--add-id3v2' or '--id3v2-only' options are used,\n" - " or output is redirected to stdout.\n" - ); -} - -static void -help_developer_switches(FILE * const fp) -{ - if ( !internal_opts_enabled ) { - fprintf(fp, - " Note: Almost all of the following switches aren't available in this build!\n\n" - ); - } - fprintf(fp, - " ATH related:\n" - " --noath turns ATH down to a flat noise floor\n" - " --athshort ignore GPSYCHO for short blocks, use ATH only\n" - " --athonly ignore GPSYCHO completely, use ATH only\n" - " --athtype n selects between different ATH types [0-4]\n" - " --athlower x lowers ATH by x dB\n" - ); - fprintf(fp, - " --athaa-type n ATH auto adjust: 0 'no' else 'loudness based'\n" -/** OBSOLETE " --athaa-loudapprox n n=1 total energy or n=2 equal loudness curve\n"*/ - " --athaa-sensitivity x activation offset in -/+ dB for ATH auto-adjustment\n" - "\n"); - fprintf(fp, - " PSY related:\n" - " --short use short blocks when appropriate\n" - " --noshort do not use short blocks\n" - " --allshort use only short blocks\n" - ); - fprintf(fp, - "(1) --temporal-masking x x=0 disables, x=1 enables temporal masking effect\n" - " --nssafejoint M/S switching criterion\n" - " --nsmsfix <arg> M/S switching tuning [effective 0-3.5]\n" - "(2) --interch x adjust inter-channel masking ratio\n" - " --ns-bass x adjust masking for sfbs 0 - 6 (long) 0 - 5 (short)\n" - " --ns-alto x adjust masking for sfbs 7 - 13 (long) 6 - 10 (short)\n" - " --ns-treble x adjust masking for sfbs 14 - 21 (long) 11 - 12 (short)\n" - ); - fprintf(fp, - " --ns-sfb21 x change ns-treble by x dB for sfb21\n" - " --shortthreshold x,y short block switching threshold,\n" - " x for L/R/M channel, y for S channel\n" - " -Z [n] always do calculate short block maskings\n" - " Noise Shaping related:\n" - "(1) --substep n use pseudo substep noise shaping method types 0-2\n" - "(1) -X n[,m] selects between different noise measurements\n" - " n for long block, m for short. if m is omitted, m = n\n" - " 1: CBR, ABR and VBR-old encoding modes only\n" - " 2: ignored\n" - ); -} - -int -long_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName, int lessmode) -{ /* print long syntax help */ - lame_version_print(fp); - fprintf(fp, - "usage: %s [options] <infile> [outfile]\n" - "\n" - " <infile> and/or <outfile> can be \"-\", which means stdin/stdout.\n" - "\n" "RECOMMENDED:\n" " lame -V2 input.wav output.mp3\n" "\n", ProgramName); - fprintf(fp, - "OPTIONS:\n" - " Input options:\n" - " --scale <arg> scale input (multiply PCM data) by <arg>\n" - " --scale-l <arg> scale channel 0 (left) input (multiply PCM data) by <arg>\n" - " --scale-r <arg> scale channel 1 (right) input (multiply PCM data) by <arg>\n" -#if (defined HAVE_MPGLIB || defined AMIGA_MPEGA) - " --mp1input input file is a MPEG Layer I file\n" - " --mp2input input file is a MPEG Layer II file\n" - " --mp3input input file is a MPEG Layer III file\n" -#endif - " --nogap <file1> <file2> <...>\n" - " gapless encoding for a set of contiguous files\n" - " --nogapout <dir>\n" - " output dir for gapless encoding (must precede --nogap)\n" - " --nogaptags allow the use of VBR tags in gapless encoding\n" - ); - fprintf(fp, - "\n" - " Input options for RAW PCM:\n" - " -r input is raw pcm\n" - " -x force byte-swapping of input\n" - " -s sfreq sampling frequency of input file (kHz) - default 44.1 kHz\n" - " --bitwidth w input bit width is w (default 16)\n" - " --signed input is signed (default)\n" - " --unsigned input is unsigned\n" - " --little-endian input is little-endian (default)\n" - " --big-endian input is big-endian\n" - ); - - wait_for(fp, lessmode); - fprintf(fp, - " Operational options:\n" - " -a downmix from stereo to mono file for mono encoding\n" - " -m <mode> (j)oint, (s)imple, (f)orce, (d)ual-mono, (m)ono (l)eft (r)ight\n" - " default is (j) or (s) depending on bitrate\n" - " joint = joins the best possible of MS and LR stereo\n" - " simple = force LR stereo on all frames\n" - " force = force MS stereo on all frames.\n" - " --preset type type must be \"medium\", \"standard\", \"extreme\", \"insane\",\n" - " or a value for an average desired bitrate and depending\n" - " on the value specified, appropriate quality settings will\n" - " be used.\n" - " \"--preset help\" gives more info on these\n" - " --comp <arg> choose bitrate to achieve a compression ratio of <arg>\n"); - fprintf(fp, " --replaygain-fast compute RG fast but slightly inaccurately (default)\n" -#ifdef DECODE_ON_THE_FLY - " --replaygain-accurate compute RG more accurately and find the peak sample\n" -#endif - " --noreplaygain disable ReplayGain analysis\n" -#ifdef DECODE_ON_THE_FLY - " --clipdetect enable --replaygain-accurate and print a message whether\n" - " clipping occurs and how far the waveform is from full scale\n" -#endif - ); - fprintf(fp, - " --flush flush output stream as soon as possible\n" - " --freeformat produce a free format bitstream\n" - " --decode input=mp3 file, output=wav\n" - " --swap-channel swap L/R channels\n" - " -t disable writing wav header when using --decode\n"); - - wait_for(fp, lessmode); - fprintf(fp, - " Verbosity:\n" - " --disptime <arg>print progress report every arg seconds\n" - " -S don't print progress report, VBR histograms\n" - " --nohist disable VBR histogram display\n" - " --quiet don't print anything on screen\n" - " --silent don't print anything on screen, but fatal errors\n" - " --brief print more useful information\n" - " --verbose print a lot of useful information\n" "\n"); - fprintf(fp, - " Noise shaping & psycho acoustic algorithms:\n" - " -q <arg> <arg> = 0...9. Default -q 5 \n" - " -q 0: Highest quality, very slow \n" - " -q 9: Poor quality, but fast \n" - " -h Same as -q 2. Recommended.\n" - " -f Same as -q 7. Fast, ok quality\n"); - - wait_for(fp, lessmode); - fprintf(fp, - " CBR (constant bitrate, the default) options:\n" - " -b <bitrate> set the bitrate in kbps, default 128 kbps\n" - " --cbr enforce use of constant bitrate\n" - "\n" - " ABR options:\n" - " --abr <bitrate> specify average bitrate desired (instead of quality)\n" "\n"); - fprintf(fp, - " VBR options:\n" - " -V n quality setting for VBR. default n=%i\n" - " 0=high quality,bigger files. 9=smaller files\n" - " -v the same as -V 4\n" - " --vbr-old use old variable bitrate (VBR) routine\n" - " --vbr-new use new variable bitrate (VBR) routine (default)\n" - " -Y lets LAME ignore noise in sfb21, like in CBR\n" - , - lame_get_VBR_q(gfp)); - fprintf(fp, - " -b <bitrate> specify minimum allowed bitrate, default 32 kbps\n" - " -B <bitrate> specify maximum allowed bitrate, default 320 kbps\n" - " -F strictly enforce the -b option, for use with players that\n" - " do not support low bitrate mp3\n" - " -t disable writing LAME Tag\n" - " -T enable and force writing LAME Tag\n"); - - wait_for(fp, lessmode); - DEV_HELP( - help_developer_switches(fp); - wait_for(fp, lessmode); - ) - - fprintf(fp, - " MP3 header/stream options:\n" - " -e <emp> de-emphasis n/5/c (obsolete)\n" - " -c mark as copyright\n" - " -o mark as non-original\n" - " -p error protection. adds 16 bit checksum to every frame\n" - " (the checksum is computed correctly)\n" - " --nores disable the bit reservoir\n" - " --strictly-enforce-ISO comply as much as possible to ISO MPEG spec\n"); - fprintf(fp, - " --buffer-constraint <constraint> available values for constraint:\n" - " default, strict, maximum\n" - "\n" - ); - fprintf(fp, - " Filter options:\n" - " --lowpass <freq> frequency(kHz), lowpass filter cutoff above freq\n" - " --lowpass-width <freq> frequency(kHz) - default 15%% of lowpass freq\n" - " --highpass <freq> frequency(kHz), highpass filter cutoff below freq\n" - " --highpass-width <freq> frequency(kHz) - default 15%% of highpass freq\n"); - fprintf(fp, - " --resample <sfreq> sampling frequency of output file(kHz)- default=automatic\n"); - - wait_for(fp, lessmode); - help_id3tag(fp); - fprintf(fp, -#if defined(WIN32) - "\n\nMS-Windows-specific options:\n" - " --priority <type> sets the process priority:\n" - " 0,1 = Low priority (IDLE_PRIORITY_CLASS)\n" - " 2 = normal priority (NORMAL_PRIORITY_CLASS, default)\n" - " 3,4 = High priority (HIGH_PRIORITY_CLASS))\n" - " Note: Calling '--priority' without a parameter will select priority 0.\n" -#endif -#if defined(__OS2__) - "\n\nOS/2-specific options:\n" - " --priority <type> sets the process priority:\n" - " 0 = Low priority (IDLE, delta = 0)\n" - " 1 = Medium priority (IDLE, delta = +31)\n" - " 2 = Regular priority (REGULAR, delta = -31)\n" - " 3 = High priority (REGULAR, delta = 0)\n" - " 4 = Maximum priority (REGULAR, delta = +31)\n" - " Note: Calling '--priority' without a parameter will select priority 0.\n" -#endif - "\nMisc:\n --license print License information\n\n" - ); - -#if defined(HAVE_NASM) - wait_for(fp, lessmode); - fprintf(fp, - " Platform specific:\n" - " --noasm <instructions> disable assembly optimizations for mmx/3dnow/sse\n"); - wait_for(fp, lessmode); -#endif - - display_bitrates(fp); - - return 0; -} - -static void -display_bitrate(FILE * const fp, const char *const version, const int d, const int indx) -{ - int i; - int nBitrates = 14; - if (d == 4) - nBitrates = 8; - - - fprintf(fp, - "\nMPEG-%-3s layer III sample frequencies (kHz): %2d %2d %g\n" - "bitrates (kbps):", version, 32 / d, 48 / d, 44.1 / d); - for (i = 1; i <= nBitrates; i++) - fprintf(fp, " %2i", lame_get_bitrate(indx, i)); - fprintf(fp, "\n"); -} - -int -display_bitrates(FILE * const fp) -{ - display_bitrate(fp, "1", 1, 1); - display_bitrate(fp, "2", 2, 0); - display_bitrate(fp, "2.5", 4, 0); - fprintf(fp, "\n"); - fflush(fp); - return 0; -} - - -/* note: for presets it would be better to externalize them in a file. - suggestion: lame --preset <file-name> ... - or: lame --preset my-setting ... and my-setting is defined in lame.ini - */ - -/* -Note from GB on 08/25/2002: -I am merging --presets and --alt-presets. Old presets are now aliases for -corresponding abr values from old alt-presets. This way we now have a -unified preset system, and I hope than more people will use the new tuned -presets instead of the old unmaintained ones. -*/ - - - -/************************************************************************ -* -* usage -* -* PURPOSE: Writes presetting info to #stdout# -* -************************************************************************/ - - -static void -presets_longinfo_dm(FILE * msgfp) -{ - fprintf(msgfp, - "\n" - "The --preset switches are aliases over LAME settings.\n" - "\n" "\n"); - fprintf(msgfp, - "To activate these presets:\n" - "\n" " For VBR modes (generally highest quality):\n" "\n"); - fprintf(msgfp, - " \"--preset medium\" This preset should provide near transparency\n" - " to most people on most music.\n" - "\n" - " \"--preset standard\" This preset should generally be transparent\n" - " to most people on most music and is already\n" - " quite high in quality.\n" "\n"); - fprintf(msgfp, - " \"--preset extreme\" If you have extremely good hearing and similar\n" - " equipment, this preset will generally provide\n" - " slightly higher quality than the \"standard\"\n" - " mode.\n" "\n"); - fprintf(msgfp, - " For CBR 320kbps (highest quality possible from the --preset switches):\n" - "\n" - " \"--preset insane\" This preset will usually be overkill for most\n" - " people and most situations, but if you must\n" - " have the absolute highest quality with no\n" - " regard to filesize, this is the way to go.\n" "\n"); - fprintf(msgfp, - " For ABR modes (high quality per given bitrate but not as high as VBR):\n" - "\n" - " \"--preset <kbps>\" Using this preset will usually give you good\n" - " quality at a specified bitrate. Depending on the\n" - " bitrate entered, this preset will determine the\n"); - fprintf(msgfp, - " optimal settings for that particular situation.\n" - " While this approach works, it is not nearly as\n" - " flexible as VBR, and usually will not attain the\n" - " same level of quality as VBR at higher bitrates.\n" "\n"); - fprintf(msgfp, - "The following options are also available for the corresponding profiles:\n" - "\n" - " standard\n" - " extreme\n" - " insane\n" - " <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n" - " simply specify a bitrate. For example:\n" - " \"--preset 185\" activates this\n" - " preset and uses 185 as an average kbps.\n" "\n"); - fprintf(msgfp, - " \"cbr\" - If you use the ABR mode (read above) with a significant\n" - " bitrate such as 80, 96, 112, 128, 160, 192, 224, 256, 320,\n" - " you can use the \"cbr\" option to force CBR mode encoding\n" - " instead of the standard abr mode. ABR does provide higher\n" - " quality but CBR may be useful in situations such as when\n" - " streaming an mp3 over the internet may be important.\n" "\n"); - fprintf(msgfp, - " For example:\n" - "\n" - " \"--preset standard <input file> <output file>\"\n" - " or \"--preset cbr 192 <input file> <output file>\"\n" - " or \"--preset 172 <input file> <output file>\"\n" - " or \"--preset extreme <input file> <output file>\"\n" "\n" "\n"); - fprintf(msgfp, - "A few aliases are also available for ABR mode:\n" - "phone => 16kbps/mono phon+/lw/mw-eu/sw => 24kbps/mono\n" - "mw-us => 40kbps/mono voice => 56kbps/mono\n" - "fm/radio/tape => 112kbps hifi => 160kbps\n" - "cd => 192kbps studio => 256kbps\n"); -} - - -static int -presets_set(lame_t gfp, int fast, int cbr, const char *preset_name, const char *ProgramName) -{ - int mono = 0; - - if ((strcmp(preset_name, "help") == 0) && (fast < 1) - && (cbr < 1)) { - lame_version_print(stdout); - presets_longinfo_dm(stdout); - return -1; - } - - /*aliases for compatibility with old presets */ - - if (strcmp(preset_name, "phone") == 0) { - preset_name = "16"; - mono = 1; - } - if ((strcmp(preset_name, "phon+") == 0) || - (strcmp(preset_name, "lw") == 0) || - (strcmp(preset_name, "mw-eu") == 0) || (strcmp(preset_name, "sw") == 0)) { - preset_name = "24"; - mono = 1; - } - if (strcmp(preset_name, "mw-us") == 0) { - preset_name = "40"; - mono = 1; - } - if (strcmp(preset_name, "voice") == 0) { - preset_name = "56"; - mono = 1; - } - if (strcmp(preset_name, "fm") == 0) { - preset_name = "112"; - } - if ((strcmp(preset_name, "radio") == 0) || (strcmp(preset_name, "tape") == 0)) { - preset_name = "112"; - } - if (strcmp(preset_name, "hifi") == 0) { - preset_name = "160"; - } - if (strcmp(preset_name, "cd") == 0) { - preset_name = "192"; - } - if (strcmp(preset_name, "studio") == 0) { - preset_name = "256"; - } - - if (strcmp(preset_name, "medium") == 0) { - lame_set_VBR_q(gfp, 4); - lame_set_VBR(gfp, vbr_default); - return 0; - } - - if (strcmp(preset_name, "standard") == 0) { - lame_set_VBR_q(gfp, 2); - lame_set_VBR(gfp, vbr_default); - return 0; - } - - else if (strcmp(preset_name, "extreme") == 0) { - lame_set_VBR_q(gfp, 0); - lame_set_VBR(gfp, vbr_default); - return 0; - } - - else if ((strcmp(preset_name, "insane") == 0) && (fast < 1)) { - - lame_set_preset(gfp, INSANE); - - return 0; - } - - /* Generic ABR Preset */ - if (((atoi(preset_name)) > 0) && (fast < 1)) { - if ((atoi(preset_name)) >= 8 && (atoi(preset_name)) <= 320) { - lame_set_preset(gfp, atoi(preset_name)); - - if (cbr == 1) - lame_set_VBR(gfp, vbr_off); - - if (mono == 1) { - lame_set_mode(gfp, MONO); - } - - return 0; - - } - else { - lame_version_print(Console_IO.Error_fp); - error_printf("Error: The bitrate specified is out of the valid range for this preset\n" - "\n" - "When using this mode you must enter a value between \"32\" and \"320\"\n" - "\n" "For further information try: \"%s --preset help\"\n", ProgramName); - return -1; - } - } - - lame_version_print(Console_IO.Error_fp); - error_printf("Error: You did not enter a valid profile and/or options with --preset\n" - "\n" - "Available profiles are:\n" - "\n" - " medium\n" - " standard\n" - " extreme\n" - " insane\n" - " <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n" - " simply specify a bitrate. For example:\n" - " \"--preset 185\" activates this\n" - " preset and uses 185 as an average kbps.\n" "\n"); - error_printf(" Some examples:\n" - "\n" - " or \"%s --preset standard <input file> <output file>\"\n" - " or \"%s --preset cbr 192 <input file> <output file>\"\n" - " or \"%s --preset 172 <input file> <output file>\"\n" - " or \"%s --preset extreme <input file> <output file>\"\n" - "\n" - "For further information try: \"%s --preset help\"\n", ProgramName, ProgramName, - ProgramName, ProgramName, ProgramName); - return -1; -} - -static void -genre_list_handler(int num, const char *name, void *cookie) -{ - (void) cookie; - console_printf("%3d %s\n", num, name); -} - - -/************************************************************************ -* -* parse_args -* -* PURPOSE: Sets encoding parameters to the specifications of the -* command line. Default settings are used for parameters -* not specified in the command line. -* -* If the input file is in WAVE or AIFF format, the sampling frequency is read -* from the AIFF header. -* -* The input and output filenames are read into #inpath# and #outpath#. -* -************************************************************************/ - -/* would use real "strcasecmp" but it isn't portable */ -static int -local_strcasecmp(const char *s1, const char *s2) -{ - unsigned char c1; - unsigned char c2; - - do { - c1 = (unsigned char) tolower(*s1); - c2 = (unsigned char) tolower(*s2); - if (!c1) { - break; - } - ++s1; - ++s2; - } while (c1 == c2); - return c1 - c2; -} - -static int -local_strncasecmp(const char *s1, const char *s2, int n) -{ - unsigned char c1 = 0; - unsigned char c2 = 0; - int cnt = 0; - - do { - if (cnt == n) { - break; - } - c1 = (unsigned char) tolower(*s1); - c2 = (unsigned char) tolower(*s2); - if (!c1) { - break; - } - ++s1; - ++s2; - ++cnt; - } while (c1 == c2); - return c1 - c2; -} - - - -/* LAME is a simple frontend which just uses the file extension */ -/* to determine the file type. Trying to analyze the file */ -/* contents is well beyond the scope of LAME and should not be added. */ -static int -filename_to_type(const char *FileName) -{ - size_t len = strlen(FileName); - - if (len < 4) - return sf_unknown; - - FileName += len - 4; - if (0 == local_strcasecmp(FileName, ".mpg")) - return sf_mp123; - if (0 == local_strcasecmp(FileName, ".mp1")) - return sf_mp123; - if (0 == local_strcasecmp(FileName, ".mp2")) - return sf_mp123; - if (0 == local_strcasecmp(FileName, ".mp3")) - return sf_mp123; - if (0 == local_strcasecmp(FileName, ".wav")) - return sf_wave; - if (0 == local_strcasecmp(FileName, ".aif")) - return sf_aiff; - if (0 == local_strcasecmp(FileName, ".raw")) - return sf_raw; - if (0 == local_strcasecmp(FileName, ".ogg")) - return sf_ogg; - return sf_unknown; -} - -static int -resample_rate(double freq) -{ - if (freq >= 1.e3) - freq *= 1.e-3; - - switch ((int) freq) { - case 8: - return 8000; - case 11: - return 11025; - case 12: - return 12000; - case 16: - return 16000; - case 22: - return 22050; - case 24: - return 24000; - case 32: - return 32000; - case 44: - return 44100; - case 48: - return 48000; - default: - error_printf("Illegal resample frequency: %.3f kHz\n", freq); - return 0; - } -} - -#ifdef _WIN32 -#define SLASH '\\' -#elif __OS2__ -#define SLASH '\\' -#else -#define SLASH '/' -#endif - -static -size_t scanPath(char const* s, char const** a, char const** b) -{ - char const* s1 = s; - char const* s2 = s; - if (s != 0) { - for (; *s; ++s) { - switch (*s) { - case SLASH: - case ':': - s2 = s; - break; - } - } - if (*s2 == ':') { - ++s2; - } - } - if (a) { - *a = s1; - } - if (b) { - *b = s2; - } - return s2-s1; -} - -static -size_t scanBasename(char const* s, char const** a, char const** b) -{ - char const* s1 = s; - char const* s2 = s; - if (s != 0) { - for (; *s; ++s) { - switch (*s) { - case SLASH: - case ':': - s1 = s2 = s; - break; - case '.': - s2 = s; - break; - } - } - if (s2 == s1) { - s2 = s; - } - if (*s1 == SLASH || *s1 == ':') { - ++s1; - } - } - if (a != 0) { - *a = s1; - } - if (b != 0) { - *b = s2; - } - return s2-s1; -} - -static -int isCommonSuffix(char const* s_ext) -{ - char* suffixes[] = - { ".WAV", ".RAW", ".MP1", ".MP2" - , ".MP3", ".MPG", ".MPA", ".CDA" - , ".OGG", ".AIF", ".AIFF", ".AU" - , ".SND", ".FLAC", ".WV", ".OFR" - , ".TAK", ".MP4", ".M4A", ".PCM" - }; - size_t i; - for (i = 0; i < sizeof(suffixes); ++i) { - if (local_strcasecmp(s_ext, suffixes[i]) == 0) { - return 1; - } - } - return 0; -} - - -static -int generateOutPath(lame_t gfp, char const* inPath, char const* outDir, char* outPath) -{ - size_t const max_path = PATH_MAX; - char const* s_ext = lame_get_decode_only(gfp) ? ".wav" : ".mp3"; -#if 1 - size_t i = 0; - int out_dir_used = 0; - - if (outDir != 0 && outDir[0] != 0) { - out_dir_used = 1; - while (*outDir) { - outPath[i++] = *outDir++; - if (i >= max_path) { - goto err_generateOutPath; - } - } - if (i > 0 && outPath[i-1] != SLASH) { - outPath[i++] = SLASH; - if (i >= max_path) { - goto err_generateOutPath; - } - } - outPath[i] = 0; - } - else { - char const* pa; - char const* pb; - size_t j, n = scanPath(inPath, &pa, &pb); - if (i+n >= max_path) { - goto err_generateOutPath; - } - for (j = 0; j < n; ++j) { - outPath[i++] = pa[j]; - } - if (n > 0) { - outPath[i++] = SLASH; - if (i >= max_path) { - goto err_generateOutPath; - } - } - outPath[i] = 0; - } - { - int replace_suffix = 0; - char const* na; - char const* nb; - size_t j, n = scanBasename(inPath, &na, &nb); - if (i+n >= max_path) { - goto err_generateOutPath; - } - for (j = 0; j < n; ++j) { - outPath[i++] = na[j]; - } - outPath[i] = 0; - if (isCommonSuffix(nb) == 1) { - replace_suffix = 1; - if (out_dir_used == 0) { - if (local_strcasecmp(nb, s_ext) == 0) { - replace_suffix = 0; - } - } - } - if (replace_suffix == 0) { - while (*nb) { - outPath[i++] = *nb++; - if (i >= max_path) { - goto err_generateOutPath; - } - } - outPath[i] = 0; - } - } - if (i+5 >= max_path) { - goto err_generateOutPath; - } - while (*s_ext) { - outPath[i++] = *s_ext++; - } - outPath[i] = 0; - return 0; -err_generateOutPath: - error_printf( "error: output file name too long" ); - return 1; -#else - strncpy(outPath, inPath, PATH_MAX + 1 - 4); - strncat(outPath, s_ext, 4); - return 0; -#endif -} - - -static int -set_id3_albumart(lame_t gfp, char const* file_name) -{ - int ret = -1; - FILE *fpi = 0; - char *albumart = 0; - - if (file_name == 0) { - return 0; - } - fpi = lame_fopen(file_name, "rb"); - if (!fpi) { - ret = 1; - } - else { - size_t size; - - fseek(fpi, 0, SEEK_END); - size = ftell(fpi); - fseek(fpi, 0, SEEK_SET); - albumart = (char *)malloc(size); - if (!albumart) { - ret = 2; - } - else { - if (fread(albumart, 1, size, fpi) != size) { - ret = 3; - } - else { - ret = id3tag_set_albumart(gfp, albumart, size) ? 4 : 0; - } - free(albumart); - } - fclose(fpi); - } - switch (ret) { - case 1: error_printf("Could not find: '%s'.\n", file_name); break; - case 2: error_printf("Insufficient memory for reading the albumart.\n"); break; - case 3: error_printf("Read error: '%s'.\n", file_name); break; - case 4: error_printf("Unsupported image: '%s'.\nSpecify JPEG/PNG/GIF image\n", file_name); break; - default: break; - } - return ret; -} - - -enum ID3TAG_MODE -{ ID3TAG_MODE_DEFAULT -, ID3TAG_MODE_V1_ONLY -, ID3TAG_MODE_V2_ONLY -}; - -/* Ugly, NOT final version */ - -#define T_IF(str) if ( 0 == local_strcasecmp (token,str) ) { -#define T_ELIF(str) } else if ( 0 == local_strcasecmp (token,str) ) { -#define T_ELIF_INTERNAL(str) } else if (internal_opts_enabled && (0 == local_strcasecmp (token,str)) ) { -#define T_ELIF2(str1,str2) } else if ( 0 == local_strcasecmp (token,str1) || 0 == local_strcasecmp (token,str2) ) { -#define T_ELSE } else { -#define T_END } - -int -parse_args(lame_global_flags * gfp, int argc, char **argv, - char *const inPath, char *const outPath, char **nogap_inPath, int *num_nogap) -{ - char outDir[1024] = ""; - int input_file = 0; /* set to 1 if we parse an input file name */ - int i; - int autoconvert = 0; - double val; - int nogap = 0; - int nogap_tags = 0; /* set to 1 to use VBR tags in NOGAP mode */ - const char *ProgramName = argv[0]; - int count_nogap = 0; - int noreplaygain = 0; /* is RG explicitly disabled by the user */ - int id3tag_mode = ID3TAG_MODE_DEFAULT; - int ignore_tag_errors = 0; /* Ignore errors in values passed for tags */ -#ifdef ID3TAGS_EXTENDED - enum TextEncoding id3_tenc = TENC_UTF16; -#else - enum TextEncoding id3_tenc = TENC_LATIN1; -#endif - - inPath[0] = '\0'; - outPath[0] = '\0'; - /* turn on display options. user settings may turn them off below */ - global_ui_config.silent = 0; - global_ui_config.brhist = 1; - global_decoder.mp3_delay = 0; - global_decoder.mp3_delay_set = 0; - global_decoder.disable_wav_header = 0; - global_ui_config.print_clipping_info = 0; - id3tag_init(gfp); - - /* process args */ - for (i = 0; ++i < argc;) { - char c; - char *token; - char *arg; - char *nextArg; - int argUsed; - - token = argv[i]; - if (*token++ == '-') { - argUsed = 0; - nextArg = i + 1 < argc ? argv[i + 1] : ""; - - if (!*token) { /* The user wants to use stdin and/or stdout. */ - input_file = 1; - if (inPath[0] == '\0') - strncpy(inPath, argv[i], PATH_MAX + 1); - else if (outPath[0] == '\0') - strncpy(outPath, argv[i], PATH_MAX + 1); - } - if (*token == '-') { /* GNU style */ - token++; - - T_IF("resample") - argUsed = 1; - (void) lame_set_out_samplerate(gfp, resample_rate(atof(nextArg))); - - T_ELIF("vbr-old") - lame_set_VBR(gfp, vbr_rh); - - T_ELIF("vbr-new") - lame_set_VBR(gfp, vbr_mt); - - T_ELIF("vbr-mtrh") - lame_set_VBR(gfp, vbr_mtrh); - - T_ELIF("cbr") - lame_set_VBR(gfp, vbr_off); - - T_ELIF("abr") - /* values larger than 8000 are bps (like Fraunhofer), so it's strange to get 320000 bps MP3 when specifying 8000 bps MP3 */ - int m = atoi(nextArg); - argUsed = 1; - if (m >= 8000) { - m = (m + 500) / 1000; - } - if (m > 320) { - m = 320; - } - if (m < 8) { - m = 8; - } - lame_set_VBR(gfp, vbr_abr); - lame_set_VBR_mean_bitrate_kbps(gfp, m); - - T_ELIF("r3mix") - lame_set_preset(gfp, R3MIX); - - T_ELIF("bitwidth") - argUsed = 1; - global_raw_pcm.in_bitwidth = atoi(nextArg); - - T_ELIF("signed") - global_raw_pcm.in_signed = 1; - - T_ELIF("unsigned") - global_raw_pcm.in_signed = 0; - - T_ELIF("little-endian") - global_raw_pcm.in_endian = ByteOrderLittleEndian; - - T_ELIF("big-endian") - global_raw_pcm.in_endian = ByteOrderBigEndian; - - T_ELIF("mp1input") - global_reader.input_format = sf_mp1; - - T_ELIF("mp2input") - global_reader.input_format = sf_mp2; - - T_ELIF("mp3input") - global_reader.input_format = sf_mp3; - - T_ELIF("ogginput") - error_printf("sorry, vorbis support in LAME is deprecated.\n"); - return -1; -#if INTERNAL_OPTS - T_ELIF_INTERNAL("noshort") - (void) lame_set_no_short_blocks(gfp, 1); - - T_ELIF_INTERNAL("short") - (void) lame_set_no_short_blocks(gfp, 0); - - T_ELIF_INTERNAL("allshort") - (void) lame_set_force_short_blocks(gfp, 1); -#endif - - T_ELIF("decode") - (void) lame_set_decode_only(gfp, 1); - - T_ELIF("flush") - global_writer.flush_write = 1; - - T_ELIF("decode-mp3delay") - global_decoder.mp3_delay = atoi(nextArg); - global_decoder.mp3_delay_set = 1; - argUsed = 1; - - T_ELIF("nores") - lame_set_disable_reservoir(gfp, 1); - - T_ELIF("strictly-enforce-ISO") - lame_set_strict_ISO(gfp, MDB_STRICT_ISO); - - T_ELIF("buffer-constraint") - argUsed = 1; - if (strcmp(nextArg, "default") == 0) - (void) lame_set_strict_ISO(gfp, MDB_DEFAULT); - else if (strcmp(nextArg, "strict") == 0) - (void) lame_set_strict_ISO(gfp, MDB_STRICT_ISO); - else if (strcmp(nextArg, "maximum") == 0) - (void) lame_set_strict_ISO(gfp, MDB_MAXIMUM); - else { - error_printf("unknown buffer constraint '%s'\n", nextArg); - return -1; - } - - T_ELIF("scale") - argUsed = 1; - (void) lame_set_scale(gfp, (float) atof(nextArg)); - - T_ELIF("scale-l") - argUsed = 1; - (void) lame_set_scale_left(gfp, (float) atof(nextArg)); - - T_ELIF("scale-r") - argUsed = 1; - (void) lame_set_scale_right(gfp, (float) atof(nextArg)); - - T_ELIF("noasm") - argUsed = 1; - if (!strcmp(nextArg, "mmx")) - (void) lame_set_asm_optimizations(gfp, MMX, 0); - if (!strcmp(nextArg, "3dnow")) - (void) lame_set_asm_optimizations(gfp, AMD_3DNOW, 0); - if (!strcmp(nextArg, "sse")) - (void) lame_set_asm_optimizations(gfp, SSE, 0); - - T_ELIF("freeformat") - lame_set_free_format(gfp, 1); - - T_ELIF("replaygain-fast") - lame_set_findReplayGain(gfp, 1); - -#ifdef DECODE_ON_THE_FLY - T_ELIF("replaygain-accurate") - lame_set_decode_on_the_fly(gfp, 1); - lame_set_findReplayGain(gfp, 1); -#endif - - T_ELIF("noreplaygain") - noreplaygain = 1; - lame_set_findReplayGain(gfp, 0); - - -#ifdef DECODE_ON_THE_FLY - T_ELIF("clipdetect") - global_ui_config.print_clipping_info = 1; - lame_set_decode_on_the_fly(gfp, 1); -#endif - - T_ELIF("nohist") - global_ui_config.brhist = 0; - -#if defined(__OS2__) || defined(WIN32) - T_ELIF("priority") - char *endptr; - int priority = (int) strtol(nextArg, &endptr, 10); - if (endptr != nextArg) { - argUsed = 1; - } - setProcessPriority(priority); -#endif - - /* options for ID3 tag */ -#ifdef ID3TAGS_EXTENDED - T_ELIF2("id3v2-utf16","id3v2-ucs2") /* id3v2-ucs2 for compatibility only */ - id3_tenc = TENC_UTF16; - id3tag_add_v2(gfp); - - T_ELIF("id3v2-latin1") - id3_tenc = TENC_LATIN1; - id3tag_add_v2(gfp); -#endif - - T_ELIF("tt") - argUsed = 1; - id3_tag(gfp, 't', id3_tenc, nextArg); - - T_ELIF("ta") - argUsed = 1; - id3_tag(gfp, 'a', id3_tenc, nextArg); - - T_ELIF("tl") - argUsed = 1; - id3_tag(gfp, 'l', id3_tenc, nextArg); - - T_ELIF("ty") - argUsed = 1; - id3_tag(gfp, 'y', id3_tenc, nextArg); - - T_ELIF("tc") - argUsed = 1; - id3_tag(gfp, 'c', id3_tenc, nextArg); - - T_ELIF("tn") - int ret = id3_tag(gfp, 'n', id3_tenc, nextArg); - argUsed = 1; - if (ret != 0) { - if (0 == ignore_tag_errors) { - if (id3tag_mode == ID3TAG_MODE_V1_ONLY) { - if (global_ui_config.silent < 9) { - error_printf("The track number has to be between 1 and 255 for ID3v1.\n"); - } - return -1; - } - else if (id3tag_mode == ID3TAG_MODE_V2_ONLY) { - /* track will be stored as-is in ID3v2 case, so no problem here */ - } - else { - if (global_ui_config.silent < 9) { - error_printf("The track number has to be between 1 and 255 for ID3v1, ignored for ID3v1.\n"); - } - } - } - } - - T_ELIF("tg") - int ret = id3_tag(gfp, 'g', id3_tenc, nextArg); - argUsed = 1; - if (ret != 0) { - if (0 == ignore_tag_errors) { - if (ret == -1) { - error_printf("Unknown ID3v1 genre number: '%s'.\n", nextArg); - return -1; - } - else if (ret == -2) { - if (id3tag_mode == ID3TAG_MODE_V1_ONLY) { - error_printf("Unknown ID3v1 genre: '%s'.\n", nextArg); - return -1; - } - else if (id3tag_mode == ID3TAG_MODE_V2_ONLY) { - /* genre will be stored as-is in ID3v2 case, so no problem here */ - } - else { - if (global_ui_config.silent < 9) { - error_printf("Unknown ID3v1 genre: '%s'. Setting ID3v1 genre to 'Other'\n", nextArg); - } - } - } - else { - if (global_ui_config.silent < 10) - error_printf("Internal error.\n"); - return -1; - } - } - } - - T_ELIF("tv") - argUsed = 1; - if (id3_tag(gfp, 'v', id3_tenc, nextArg)) { - if (global_ui_config.silent < 9) { - error_printf("Invalid field value: '%s'. Ignored\n", nextArg); - } - } - - T_ELIF("ti") - argUsed = 1; - if (set_id3_albumart(gfp, nextArg) != 0) { - if (! ignore_tag_errors) { - return -1; - } - } - - T_ELIF("ignore-tag-errors") - ignore_tag_errors = 1; - - T_ELIF("add-id3v2") - id3tag_add_v2(gfp); - - T_ELIF("id3v1-only") - id3tag_v1_only(gfp); - id3tag_mode = ID3TAG_MODE_V1_ONLY; - - T_ELIF("id3v2-only") - id3tag_v2_only(gfp); - id3tag_mode = ID3TAG_MODE_V2_ONLY; - - T_ELIF("space-id3v1") - id3tag_space_v1(gfp); - - T_ELIF("pad-id3v2") - id3tag_pad_v2(gfp); - - T_ELIF("pad-id3v2-size") - int n = atoi(nextArg); - n = n <= 128000 ? n : 128000; - n = n >= 0 ? n : 0; - id3tag_set_pad(gfp, n); - argUsed = 1; - - - T_ELIF("genre-list") - id3tag_genre_list(genre_list_handler, NULL); - return -2; - - - T_ELIF("lowpass") - val = atof(nextArg); - argUsed = 1; - if (val < 0) { - lame_set_lowpassfreq(gfp, -1); - } - else { - /* useful are 0.001 kHz...50 kHz, 50 Hz...50000 Hz */ - if (val < 0.001 || val > 50000.) { - error_printf("Must specify lowpass with --lowpass freq, freq >= 0.001 kHz\n"); - return -1; - } - lame_set_lowpassfreq(gfp, (int) (val * (val < 50. ? 1.e3 : 1.e0) + 0.5)); - } - - T_ELIF("lowpass-width") - val = atof(nextArg); - argUsed = 1; - /* useful are 0.001 kHz...16 kHz, 16 Hz...50000 Hz */ - if (val < 0.001 || val > 50000.) { - error_printf - ("Must specify lowpass width with --lowpass-width freq, freq >= 0.001 kHz\n"); - return -1; - } - lame_set_lowpasswidth(gfp, (int) (val * (val < 16. ? 1.e3 : 1.e0) + 0.5)); - - T_ELIF("highpass") - val = atof(nextArg); - argUsed = 1; - if (val < 0.0) { - lame_set_highpassfreq(gfp, -1); - } - else { - /* useful are 0.001 kHz...16 kHz, 16 Hz...50000 Hz */ - if (val < 0.001 || val > 50000.) { - error_printf("Must specify highpass with --highpass freq, freq >= 0.001 kHz\n"); - return -1; - } - lame_set_highpassfreq(gfp, (int) (val * (val < 16. ? 1.e3 : 1.e0) + 0.5)); - } - - T_ELIF("highpass-width") - val = atof(nextArg); - argUsed = 1; - /* useful are 0.001 kHz...16 kHz, 16 Hz...50000 Hz */ - if (val < 0.001 || val > 50000.) { - error_printf - ("Must specify highpass width with --highpass-width freq, freq >= 0.001 kHz\n"); - return -1; - } - lame_set_highpasswidth(gfp, (int) val); - - T_ELIF("comp") - argUsed = 1; - val = atof(nextArg); - if (val < 1.0) { - error_printf("Must specify compression ratio >= 1.0\n"); - return -1; - } - lame_set_compression_ratio(gfp, (float) val); -#if INTERNAL_OPTS - T_ELIF_INTERNAL("notemp") - (void) lame_set_useTemporal(gfp, 0); - - T_ELIF_INTERNAL("interch") - argUsed = 1; - (void) lame_set_interChRatio(gfp, (float) atof(nextArg)); - - T_ELIF_INTERNAL("temporal-masking") - argUsed = 1; - (void) lame_set_useTemporal(gfp, atoi(nextArg) ? 1 : 0); - - T_ELIF_INTERNAL("nspsytune") - ; - - T_ELIF_INTERNAL("nssafejoint") - lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); - - T_ELIF_INTERNAL("nsmsfix") - argUsed = 1; - (void) lame_set_msfix(gfp, atof(nextArg)); - - T_ELIF_INTERNAL("ns-bass") - argUsed = 1; - { - double d; - int k; - d = atof(nextArg); - k = (int) (d * 4); - if (k < -32) - k = -32; - if (k > 31) - k = 31; - if (k < 0) - k += 64; - lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 2)); - } - - T_ELIF_INTERNAL("ns-alto") - argUsed = 1; - { - double d; - int k; - d = atof(nextArg); - k = (int) (d * 4); - if (k < -32) - k = -32; - if (k > 31) - k = 31; - if (k < 0) - k += 64; - lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 8)); - } - - T_ELIF_INTERNAL("ns-treble") - argUsed = 1; - { - double d; - int k; - d = atof(nextArg); - k = (int) (d * 4); - if (k < -32) - k = -32; - if (k > 31) - k = 31; - if (k < 0) - k += 64; - lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 14)); - } - - T_ELIF_INTERNAL("ns-sfb21") - /* to be compatible with Naoki's original code, - * ns-sfb21 specifies how to change ns-treble for sfb21 */ - argUsed = 1; - { - double d; - int k; - d = atof(nextArg); - k = (int) (d * 4); - if (k < -32) - k = -32; - if (k > 31) - k = 31; - if (k < 0) - k += 64; - lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 20)); - } -#endif - /* some more GNU-ish options could be added - * brief => few messages on screen (name, status report) - * o/output file => specifies output filename - * O => stdout - * i/input file => specifies input filename - * I => stdin - */ - T_ELIF("quiet") - global_ui_config.silent = 10; /* on a scale from 1 to 10 be very silent */ - - T_ELIF("silent") - global_ui_config.silent = 9; - - T_ELIF("brief") - global_ui_config.silent = -5; /* print few info on screen */ - - T_ELIF("verbose") - global_ui_config.silent = -10; /* print a lot on screen */ - - T_ELIF2("version", "license") - print_license(stdout); - return -2; - - T_ELIF2("help", "usage") - if (0 == local_strncasecmp(nextArg, "id3", 3)) { - help_id3tag(stdout); - } - else if (0 == local_strncasecmp(nextArg, "dev", 3)) { - help_developer_switches(stdout); - } - else { - short_help(gfp, stdout, ProgramName); - } - return -2; - - T_ELIF("longhelp") - long_help(gfp, stdout, ProgramName, 0 /* lessmode=NO */ ); - return -2; - - T_ELIF("?") -#ifdef __unix__ - FILE *fp = popen("less -Mqc", "w"); - long_help(gfp, fp, ProgramName, 0 /* lessmode=NO */ ); - pclose(fp); -#else - long_help(gfp, stdout, ProgramName, 1 /* lessmode=YES */ ); -#endif - return -2; - - T_ELIF2("preset", "alt-preset") - argUsed = 1; - { - int fast = 0, cbr = 0; - - while ((strcmp(nextArg, "fast") == 0) || (strcmp(nextArg, "cbr") == 0)) { - - if ((strcmp(nextArg, "fast") == 0) && (fast < 1)) - fast = 1; - if ((strcmp(nextArg, "cbr") == 0) && (cbr < 1)) - cbr = 1; - - argUsed++; - nextArg = i + argUsed < argc ? argv[i + argUsed] : ""; - } - - if (presets_set(gfp, fast, cbr, nextArg, ProgramName) < 0) - return -1; - } - - T_ELIF("disptime") - argUsed = 1; - global_ui_config.update_interval = (float) atof(nextArg); - - T_ELIF("nogaptags") - nogap_tags = 1; - - T_ELIF("nogapout") - /* FIXME: replace strcpy by safer strncpy */ - strcpy(outPath, nextArg); - argUsed = 1; - - T_ELIF("out-dir") - /* FIXME: replace strcpy by safer strncpy */ - strcpy(outDir, nextArg); - argUsed = 1; - - T_ELIF("nogap") - nogap = 1; - - T_ELIF("swap-channel") - global_reader.swap_channel = 1; -#if INTERNAL_OPTS - T_ELIF_INTERNAL("tune") /*without helptext */ - argUsed = 1; - lame_set_tune(gfp, (float) atof(nextArg)); - - T_ELIF_INTERNAL("shortthreshold") { - float x, y; - int n = sscanf(nextArg, "%f,%f", &x, &y); - if (n == 1) { - y = x; - } - argUsed = 1; - (void) lame_set_short_threshold(gfp, x, y); - } - - T_ELIF_INTERNAL("maskingadjust") /*without helptext */ - argUsed = 1; - (void) lame_set_maskingadjust(gfp, (float) atof(nextArg)); - - T_ELIF_INTERNAL("maskingadjustshort") /*without helptext */ - argUsed = 1; - (void) lame_set_maskingadjust_short(gfp, (float) atof(nextArg)); - - T_ELIF_INTERNAL("athcurve") /*without helptext */ - argUsed = 1; - (void) lame_set_ATHcurve(gfp, (float) atof(nextArg)); - - T_ELIF_INTERNAL("no-preset-tune") /*without helptext */ - (void) lame_set_preset_notune(gfp, 0); - - T_ELIF_INTERNAL("substep") - argUsed = 1; - (void) lame_set_substep(gfp, atoi(nextArg)); - - T_ELIF_INTERNAL("sbgain") /*without helptext */ - argUsed = 1; - (void) lame_set_subblock_gain(gfp, atoi(nextArg)); - - T_ELIF_INTERNAL("sfscale") /*without helptext */ - (void) lame_set_sfscale(gfp, 1); - - T_ELIF_INTERNAL("noath") - (void) lame_set_noATH(gfp, 1); - - T_ELIF_INTERNAL("athonly") - (void) lame_set_ATHonly(gfp, 1); - - T_ELIF_INTERNAL("athshort") - (void) lame_set_ATHshort(gfp, 1); - - T_ELIF_INTERNAL("athlower") - argUsed = 1; - (void) lame_set_ATHlower(gfp, (float) atof(nextArg)); - - T_ELIF_INTERNAL("athtype") - argUsed = 1; - (void) lame_set_ATHtype(gfp, atoi(nextArg)); - - T_ELIF_INTERNAL("athaa-type") /* switch for developing, no DOCU */ - argUsed = 1; /* once was 1:Gaby, 2:Robert, 3:Jon, else:off */ - lame_set_athaa_type(gfp, atoi(nextArg)); /* now: 0:off else:Jon */ -#endif - T_ELIF ("athaa-sensitivity") - argUsed=1; - lame_set_athaa_sensitivity(gfp, (float) atof(nextArg)); - - T_ELIF_INTERNAL("debug-file") /* switch for developing, no DOCU */ - argUsed = 1; /* file name to print debug info into */ - { - set_debug_file(nextArg); - } - - T_ELSE { - error_printf("%s: unrecognized option --%s\n", ProgramName, token); - return -1; - } - T_END i += argUsed; - - } - else { - while ((c = *token++) != '\0') { - arg = *token ? token : nextArg; - switch (c) { - case 'm': - argUsed = 1; - - switch (*arg) { - case 's': - (void) lame_set_mode(gfp, STEREO); - break; - case 'd': - (void) lame_set_mode(gfp, DUAL_CHANNEL); - break; - case 'f': - lame_set_force_ms(gfp, 1); - /* FALLTHROUGH */ - case 'j': - (void) lame_set_mode(gfp, JOINT_STEREO); - break; - case 'm': - (void) lame_set_mode(gfp, MONO); - break; - case 'l': - (void) lame_set_mode(gfp, MONO); - (void) lame_set_scale_left(gfp, 2); - (void) lame_set_scale_right(gfp, 0); - break; - case 'r': - (void) lame_set_mode(gfp, MONO); - (void) lame_set_scale_left(gfp, 0); - (void) lame_set_scale_right(gfp, 2); - break; - case 'a': - (void) lame_set_mode(gfp, JOINT_STEREO); - break; - default: - error_printf("%s: -m mode must be s/d/j/f/m not %s\n", ProgramName, - arg); - return -1; - } - break; - - case 'V': - argUsed = 1; - /* to change VBR default look in lame.h */ - if (lame_get_VBR(gfp) == vbr_off) - lame_set_VBR(gfp, vbr_default); - lame_set_VBR_quality(gfp, (float)atof(arg)); - break; - case 'v': - /* to change VBR default look in lame.h */ - if (lame_get_VBR(gfp) == vbr_off) - lame_set_VBR(gfp, vbr_default); - break; - - case 'q': - argUsed = 1; - (void) lame_set_quality(gfp, atoi(arg)); - break; - case 'f': - (void) lame_set_quality(gfp, 7); - break; - case 'h': - (void) lame_set_quality(gfp, 2); - break; - - case 's': - argUsed = 1; - val = atof(arg); - val = (int) (val * (val <= 192 ? 1.e3 : 1.e0) + 0.5); - global_reader.input_samplerate = (int)val; - (void) lame_set_in_samplerate(gfp, (int)val); - break; - case 'b': - argUsed = 1; - lame_set_brate(gfp, atoi(arg)); - lame_set_VBR_min_bitrate_kbps(gfp, lame_get_brate(gfp)); - break; - case 'B': - argUsed = 1; - lame_set_VBR_max_bitrate_kbps(gfp, atoi(arg)); - break; - case 'F': - lame_set_VBR_hard_min(gfp, 1); - break; - case 't': /* dont write VBR tag */ - (void) lame_set_bWriteVbrTag(gfp, 0); - global_decoder.disable_wav_header = 1; - break; - case 'T': /* do write VBR tag */ - (void) lame_set_bWriteVbrTag(gfp, 1); - nogap_tags = 1; - global_decoder.disable_wav_header = 0; - break; - case 'r': /* force raw pcm input file */ -#if defined(LIBSNDFILE) - error_printf - ("WARNING: libsndfile may ignore -r and perform fseek's on the input.\n" - "Compile without libsndfile if this is a problem.\n"); -#endif - global_reader.input_format = sf_raw; - break; - case 'x': /* force byte swapping */ - global_reader.swapbytes = 1; - break; - case 'p': /* (jo) error_protection: add crc16 information to stream */ - lame_set_error_protection(gfp, 1); - break; - case 'a': /* autoconvert input file from stereo to mono - for mono mp3 encoding */ - autoconvert = 1; - (void) lame_set_mode(gfp, MONO); - break; - case 'd': /*(void) lame_set_allow_diff_short( gfp, 1 ); */ - case 'k': /*lame_set_lowpassfreq(gfp, -1); - lame_set_highpassfreq(gfp, -1); */ - error_printf("WARNING: -%c is obsolete.\n", c); - break; - case 'S': - global_ui_config.silent = 5; - break; - case 'X': - /* experimental switch -X: - the differnt types of quant compare are tough - to communicate to endusers, so they shouldn't - bother to toy around with them - */ - { - int x, y; - int n = sscanf(arg, "%d,%d", &x, &y); - if (n == 1) { - y = x; - } - argUsed = 1; - if (internal_opts_enabled) { - lame_set_quant_comp(gfp, x); - lame_set_quant_comp_short(gfp, y); - } - } - break; - case 'Y': - lame_set_experimentalY(gfp, 1); - break; - case 'Z': - /* experimental switch -Z: - */ - { - int n = 1; - argUsed = sscanf(arg, "%d", &n); - /*if (internal_opts_enabled)*/ - { - lame_set_experimentalZ(gfp, n); - } - } - break; - case 'e': - argUsed = 1; - - switch (*arg) { - case 'n': - lame_set_emphasis(gfp, 0); - break; - case '5': - lame_set_emphasis(gfp, 1); - break; - case 'c': - lame_set_emphasis(gfp, 3); - break; - default: - error_printf("%s: -e emp must be n/5/c not %s\n", ProgramName, arg); - return -1; - } - break; - case 'c': - lame_set_copyright(gfp, 1); - break; - case 'o': - lame_set_original(gfp, 0); - break; - - case '?': - long_help(gfp, stdout, ProgramName, 0 /* LESSMODE=NO */ ); - return -1; - - default: - error_printf("%s: unrecognized option -%c\n", ProgramName, c); - return -1; - } - if (argUsed) { - if (arg == token) - token = ""; /* no more from token */ - else - ++i; /* skip arg we used */ - arg = ""; - argUsed = 0; - } - } - } - } - else { - if (nogap) { - if ((num_nogap != NULL) && (count_nogap < *num_nogap)) { - strncpy(nogap_inPath[count_nogap++], argv[i], PATH_MAX + 1); - input_file = 1; - } - else { - /* sorry, calling program did not allocate enough space */ - error_printf - ("Error: 'nogap option'. Calling program does not allow nogap option, or\n" - "you have exceeded maximum number of input files for the nogap option\n"); - *num_nogap = -1; - return -1; - } - } - else { - /* normal options: inputfile [outputfile], and - either one can be a '-' for stdin/stdout */ - if (inPath[0] == '\0') { - strncpy(inPath, argv[i], PATH_MAX + 1); - input_file = 1; - } - else { - if (outPath[0] == '\0') - strncpy(outPath, argv[i], PATH_MAX + 1); - else { - error_printf("%s: excess arg %s\n", ProgramName, argv[i]); - return -1; - } - } - } - } - } /* loop over args */ - - if (!input_file) { - usage(Console_IO.Console_fp, ProgramName); - return -1; - } - - if (inPath[0] == '-') - global_ui_config.silent = (global_ui_config.silent <= 1 ? 1 : global_ui_config.silent); -#ifdef WIN32 - else - dosToLongFileName(inPath); -#endif - - if (outPath[0] == '\0' && count_nogap == 0) { - if (inPath[0] == '-') { - /* if input is stdin, default output is stdout */ - strcpy(outPath, "-"); - } - else { - if (generateOutPath(gfp, inPath, outDir, outPath) != 0) { - return -1; - } - } - } - - /* RG is enabled by default */ - if (!noreplaygain) - lame_set_findReplayGain(gfp, 1); - - /* disable VBR tags with nogap unless the VBR tags are forced */ - if (nogap && lame_get_bWriteVbrTag(gfp) && nogap_tags == 0) { - console_printf("Note: Disabling VBR Xing/Info tag since it interferes with --nogap\n"); - lame_set_bWriteVbrTag(gfp, 0); - } - - /* some file options not allowed with stdout */ - if (outPath[0] == '-') { - (void) lame_set_bWriteVbrTag(gfp, 0); /* turn off VBR tag */ - } - - /* if user did not explicitly specify input is mp3, check file name */ - if (global_reader.input_format == sf_unknown) - global_reader.input_format = filename_to_type(inPath); - -#if !(defined HAVE_MPGLIB || defined AMIGA_MPEGA) - if (is_mpeg_file_format(global_reader.input_format)) { - error_printf("Error: libmp3lame not compiled with mpg123 *decoding* support \n"); - return -1; - } -#endif - - /* default guess for number of channels */ - if (autoconvert) - (void) lame_set_num_channels(gfp, 2); - else if (MONO == lame_get_mode(gfp)) - (void) lame_set_num_channels(gfp, 1); - else - (void) lame_set_num_channels(gfp, 2); - - if (lame_get_free_format(gfp)) { - if (lame_get_brate(gfp) < 8 || lame_get_brate(gfp) > 640) { - error_printf("For free format, specify a bitrate between 8 and 640 kbps\n"); - error_printf("with the -b <bitrate> option\n"); - return -1; - } - } - if (num_nogap != NULL) - *num_nogap = count_nogap; - return 0; -} - - -/* end of parse.c */ diff --git a/src/lib/dl/ext/lame/parse.h b/src/lib/dl/ext/lame/parse.h deleted file mode 100755 index e75eeb8f..00000000 --- a/src/lib/dl/ext/lame/parse.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef PARSE_H_INCLUDED -#define PARSE_H_INCLUDED - -#if defined(__cplusplus) -extern "C" { -#endif - -int usage(FILE * const fp, const char *ProgramName); -int short_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName); -int long_help(const lame_global_flags * gfp, FILE * const fp, const char *ProgramName, - int lessmode); -int display_bitrates(FILE * const fp); - -int parse_args(lame_global_flags * gfp, int argc, char **argv, char *const inPath, - char *const outPath, char **nogap_inPath, int *max_nogap); - -void parse_close(); - -#if defined(__cplusplus) -} -#endif - -#endif -/* end of parse.h */ diff --git a/src/lib/dl/ext/lame/presets.c b/src/lib/dl/ext/lame/presets.c deleted file mode 100755 index 16f3a94f..00000000 --- a/src/lib/dl/ext/lame/presets.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * presets.c -- Apply presets - * - * Copyright (c) 2002-2008 Gabriel Bouvigne - * Copyright (c) 2007-2011 Robert Hegemann - * - * 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. - */ - - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "set_get.h" -#include "encoder.h" -#include "util.h" -#include "lame_global_flags.h" - -#define SET_OPTION(opt, val, def) if (enforce) \ - (void) lame_set_##opt(gfp, val); \ - else if (!(fabs(lame_get_##opt(gfp) - def) > 0)) \ - (void) lame_set_##opt(gfp, val); - -#define SET__OPTION(opt, val, def) if (enforce) \ - lame_set_##opt(gfp, val); \ - else if (!(fabs(lame_get_##opt(gfp) - def) > 0)) \ - lame_set_##opt(gfp, val); - -#undef Min -#undef Max - -static inline int -min_int(int a, int b) -{ - if (a < b) { - return a; - } - return b; -} - -static inline int -max_int(int a, int b) -{ - if (a > b) { - return a; - } - return b; -} - - - -typedef struct { - int vbr_q; - int quant_comp; - int quant_comp_s; - int expY; - FLOAT st_lrm; /*short threshold */ - FLOAT st_s; - FLOAT masking_adj; - FLOAT masking_adj_short; - FLOAT ath_lower; - FLOAT ath_curve; - FLOAT ath_sensitivity; - FLOAT interch; - int safejoint; - int sfb21mod; - FLOAT msfix; - FLOAT minval; - FLOAT ath_fixpoint; -} vbr_presets_t; - - /* *INDENT-OFF* */ - - /* Switch mappings for VBR mode VBR_RH */ - static const vbr_presets_t vbr_old_switch_map[] = { - /*vbr_q qcomp_l qcomp_s expY st_lrm st_s mask adj_l adj_s ath_lower ath_curve ath_sens interChR safejoint sfb21mod msfix */ - {0, 9, 9, 0, 5.20, 125.0, -4.2, -6.3, 4.8, 1, 0, 0, 2, 21, 0.97, 5, 100}, - {1, 9, 9, 0, 5.30, 125.0, -3.6, -5.6, 4.5, 1.5, 0, 0, 2, 21, 1.35, 5, 100}, - {2, 9, 9, 0, 5.60, 125.0, -2.2, -3.5, 2.8, 2, 0, 0, 2, 21, 1.49, 5, 100}, - {3, 9, 9, 1, 5.80, 130.0, -1.8, -2.8, 2.6, 3, -4, 0, 2, 20, 1.64, 5, 100}, - {4, 9, 9, 1, 6.00, 135.0, -0.7, -1.1, 1.1, 3.5, -8, 0, 2, 0, 1.79, 5, 100}, - {5, 9, 9, 1, 6.40, 140.0, 0.5, 0.4, -7.5, 4, -12, 0.0002, 0, 0, 1.95, 5, 100}, - {6, 9, 9, 1, 6.60, 145.0, 0.67, 0.65, -14.7, 6.5, -19, 0.0004, 0, 0, 2.30, 5, 100}, - {7, 9, 9, 1, 6.60, 145.0, 0.8, 0.75, -19.7, 8, -22, 0.0006, 0, 0, 2.70, 5, 100}, - {8, 9, 9, 1, 6.60, 145.0, 1.2, 1.15, -27.5, 10, -23, 0.0007, 0, 0, 0, 5, 100}, - {9, 9, 9, 1, 6.60, 145.0, 1.6, 1.6, -36, 11, -25, 0.0008, 0, 0, 0, 5, 100}, - {10, 9, 9, 1, 6.60, 145.0, 2.0, 2.0, -36, 12, -25, 0.0008, 0, 0, 0, 5, 100} - }; - - static const vbr_presets_t vbr_mt_psy_switch_map[] = { - /*vbr_q qcomp_l qcomp_s expY st_lrm st_s mask adj_l adj_s ath_lower ath_curve ath_sens --- safejoint sfb21mod msfix */ - {0, 9, 9, 0, 4.20, 25.0, -6.8, -6.8, 7.1, 1, 0, 0, 2, 31, 1.000, 5, 100}, - {1, 9, 9, 0, 4.20, 25.0, -4.8, -4.8, 5.4, 1.4, -1, 0, 2, 27, 1.122, 5, 98}, - {2, 9, 9, 0, 4.20, 25.0, -2.6, -2.6, 3.7, 2.0, -3, 0, 2, 23, 1.288, 5, 97}, - {3, 9, 9, 1, 4.20, 25.0, -1.6, -1.6, 2.0, 2.0, -5, 0, 2, 18, 1.479, 5, 96}, - {4, 9, 9, 1, 4.20, 25.0, -0.0, -0.0, 0.0, 2.0, -8, 0, 2, 12, 1.698, 5, 95}, - {5, 9, 9, 1, 4.20, 25.0, 1.3, 1.3, -6, 3.5, -11, 0, 2, 8, 1.950, 5, 94.2}, -#if 0 - {6, 9, 9, 1, 4.50, 100.0, 1.5, 1.5, -24.0, 6.0, -14, 0, 2, 4, 2.239, 3, 93.9}, - {7, 9, 9, 1, 4.80, 200.0, 1.7, 1.7, -28.0, 9.0, -20, 0, 2, 0, 2.570, 1, 93.6}, -#else - {6, 9, 9, 1, 4.50, 100.0, 2.2, 2.3, -12.0, 6.0, -14, 0, 2, 4, 2.239, 3, 93.9}, - {7, 9, 9, 1, 4.80, 200.0, 2.7, 2.7, -18.0, 9.0, -17, 0, 2, 0, 2.570, 1, 93.6}, -#endif - {8, 9, 9, 1, 5.30, 300.0, 2.8, 2.8, -21.0, 10.0, -23, 0.0002, 0, 0, 2.951, 0, 93.3}, - {9, 9, 9, 1, 6.60, 300.0, 2.8, 2.8, -23.0, 11.0, -25, 0.0006, 0, 0, 3.388, 0, 93.3}, - {10, 9, 9, 1, 25.00, 300.0, 2.8, 2.8, -25.0, 12.0, -27, 0.0025, 0, 0, 3.500, 0, 93.3} - }; - - /* *INDENT-ON* */ - -static vbr_presets_t const* -get_vbr_preset(int v) -{ - switch (v) { - case vbr_mtrh: - case vbr_mt: - return &vbr_mt_psy_switch_map[0]; - default: - return &vbr_old_switch_map[0]; - } -} - -#define NOOP(m) (void)p.m -#define LERP(m) (p.m = p.m + x * (q.m - p.m)) - -static void -apply_vbr_preset(lame_global_flags * gfp, int a, int enforce) -{ - vbr_presets_t const *vbr_preset = get_vbr_preset(lame_get_VBR(gfp)); - float x = gfp->VBR_q_frac; - vbr_presets_t p = vbr_preset[a]; - vbr_presets_t q = vbr_preset[a + 1]; - vbr_presets_t const *set = &p; - - NOOP(vbr_q); - NOOP(quant_comp); - NOOP(quant_comp_s); - NOOP(expY); - LERP(st_lrm); - LERP(st_s); - LERP(masking_adj); - LERP(masking_adj_short); - LERP(ath_lower); - LERP(ath_curve); - LERP(ath_sensitivity); - LERP(interch); - NOOP(safejoint); - LERP(sfb21mod); - LERP(msfix); - LERP(minval); - LERP(ath_fixpoint); - - (void) lame_set_VBR_q(gfp, set->vbr_q); - SET_OPTION(quant_comp, set->quant_comp, -1); - SET_OPTION(quant_comp_short, set->quant_comp_s, -1); - if (set->expY) { - (void) lame_set_experimentalY(gfp, set->expY); - } - SET_OPTION(short_threshold_lrm, set->st_lrm, -1); - SET_OPTION(short_threshold_s, set->st_s, -1); - SET_OPTION(maskingadjust, set->masking_adj, 0); - SET_OPTION(maskingadjust_short, set->masking_adj_short, 0); - if (lame_get_VBR(gfp) == vbr_mt || lame_get_VBR(gfp) == vbr_mtrh) { - lame_set_ATHtype(gfp, 5); - } - SET_OPTION(ATHlower, set->ath_lower, 0); - SET_OPTION(ATHcurve, set->ath_curve, -1); - SET_OPTION(athaa_sensitivity, set->ath_sensitivity, 0); - if (set->interch > 0) { - SET_OPTION(interChRatio, set->interch, -1); - } - - /* parameters for which there is no proper set/get interface */ - if (set->safejoint > 0) { - (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); - } - if (set->sfb21mod > 0) { - int const nsp = lame_get_exp_nspsytune(gfp); - int const val = (nsp >> 20) & 63; - if (val == 0) { - int const sf21mod = (set->sfb21mod << 20) | nsp; - (void) lame_set_exp_nspsytune(gfp, sf21mod); - } - } - SET__OPTION(msfix, set->msfix, -1); - - if (enforce == 0) { - gfp->VBR_q = a; - gfp->VBR_q_frac = x; - } - gfp->internal_flags->cfg.minval = set->minval; - gfp->internal_flags->cfg.ATHfixpoint = set->ath_fixpoint; -} - -static int -apply_abr_preset(lame_global_flags * gfp, int preset, int enforce) -{ - typedef struct { - int abr_kbps; - int quant_comp; - int quant_comp_s; - int safejoint; - FLOAT nsmsfix; - FLOAT st_lrm; /*short threshold */ - FLOAT st_s; - FLOAT scale; - FLOAT masking_adj; - FLOAT ath_lower; - FLOAT ath_curve; - FLOAT interch; - int sfscale; - } abr_presets_t; - - - /* *INDENT-OFF* */ - - /* - * Switch mappings for ABR mode - */ - const abr_presets_t abr_switch_map[] = { - /* kbps quant q_s safejoint nsmsfix st_lrm st_s scale msk ath_lwr ath_curve interch , sfscale */ - { 8, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -30.0, 11, 0.0012, 1}, /* 8, impossible to use in stereo */ - { 16, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -25.0, 11, 0.0010, 1}, /* 16 */ - { 24, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -20.0, 11, 0.0010, 1}, /* 24 */ - { 32, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -15.0, 11, 0.0010, 1}, /* 32 */ - { 40, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -10.0, 11, 0.0009, 1}, /* 40 */ - { 48, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -10.0, 11, 0.0009, 1}, /* 48 */ - { 56, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -6.0, 11, 0.0008, 1}, /* 56 */ - { 64, 9, 9, 0, 0, 6.60, 145, 0.95, 0, -2.0, 11, 0.0008, 1}, /* 64 */ - { 80, 9, 9, 0, 0, 6.60, 145, 0.95, 0, .0, 8, 0.0007, 1}, /* 80 */ - { 96, 9, 9, 0, 2.50, 6.60, 145, 0.95, 0, 1.0, 5.5, 0.0006, 1}, /* 96 */ - {112, 9, 9, 0, 2.25, 6.60, 145, 0.95, 0, 2.0, 4.5, 0.0005, 1}, /* 112 */ - {128, 9, 9, 0, 1.95, 6.40, 140, 0.95, 0, 3.0, 4, 0.0002, 1}, /* 128 */ - {160, 9, 9, 1, 1.79, 6.00, 135, 0.95, -2, 5.0, 3.5, 0, 1}, /* 160 */ - {192, 9, 9, 1, 1.49, 5.60, 125, 0.97, -4, 7.0, 3, 0, 0}, /* 192 */ - {224, 9, 9, 1, 1.25, 5.20, 125, 0.98, -6, 9.0, 2, 0, 0}, /* 224 */ - {256, 9, 9, 1, 0.97, 5.20, 125, 1.00, -8, 10.0, 1, 0, 0}, /* 256 */ - {320, 9, 9, 1, 0.90, 5.20, 125, 1.00, -10, 12.0, 0, 0, 0} /* 320 */ - }; - - /* *INDENT-ON* */ - - /* Variables for the ABR stuff */ - int r; - int actual_bitrate = preset; - - r = nearestBitrateFullIndex(preset); - - (void) lame_set_VBR(gfp, vbr_abr); - (void) lame_set_VBR_mean_bitrate_kbps(gfp, (actual_bitrate)); - (void) lame_set_VBR_mean_bitrate_kbps(gfp, min_int(lame_get_VBR_mean_bitrate_kbps(gfp), 320)); - (void) lame_set_VBR_mean_bitrate_kbps(gfp, max_int(lame_get_VBR_mean_bitrate_kbps(gfp), 8)); - (void) lame_set_brate(gfp, lame_get_VBR_mean_bitrate_kbps(gfp)); - - - /* parameters for which there is no proper set/get interface */ - if (abr_switch_map[r].safejoint > 0) - (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); /* safejoint */ - - if (abr_switch_map[r].sfscale > 0) - (void) lame_set_sfscale(gfp, 1); - - - SET_OPTION(quant_comp, abr_switch_map[r].quant_comp, -1); - SET_OPTION(quant_comp_short, abr_switch_map[r].quant_comp_s, -1); - - SET__OPTION(msfix, abr_switch_map[r].nsmsfix, -1); - - SET_OPTION(short_threshold_lrm, abr_switch_map[r].st_lrm, -1); - SET_OPTION(short_threshold_s, abr_switch_map[r].st_s, -1); - - /* ABR seems to have big problems with clipping, especially at low bitrates */ - /* so we compensate for that here by using a scale value depending on bitrate */ - lame_set_scale(gfp, lame_get_scale(gfp) * abr_switch_map[r].scale); - - SET_OPTION(maskingadjust, abr_switch_map[r].masking_adj, 0); - if (abr_switch_map[r].masking_adj > 0) { - SET_OPTION(maskingadjust_short, abr_switch_map[r].masking_adj * .9, 0); - } - else { - SET_OPTION(maskingadjust_short, abr_switch_map[r].masking_adj * 1.1, 0); - } - - - SET_OPTION(ATHlower, abr_switch_map[r].ath_lower, 0); - SET_OPTION(ATHcurve, abr_switch_map[r].ath_curve, -1); - - SET_OPTION(interChRatio, abr_switch_map[r].interch, -1); - - (void) abr_switch_map[r].abr_kbps; - - gfp->internal_flags->cfg.minval = 5. * (abr_switch_map[r].abr_kbps / 320.); - - return preset; -} - - - -int -apply_preset(lame_global_flags * gfp, int preset, int enforce) -{ - /*translate legacy presets */ - switch (preset) { - case R3MIX: - { - preset = V3; - (void) lame_set_VBR(gfp, vbr_mtrh); - break; - } - case MEDIUM: - case MEDIUM_FAST: - { - preset = V4; - (void) lame_set_VBR(gfp, vbr_mtrh); - break; - } - case STANDARD: - case STANDARD_FAST: - { - preset = V2; - (void) lame_set_VBR(gfp, vbr_mtrh); - break; - } - case EXTREME: - case EXTREME_FAST: - { - preset = V0; - (void) lame_set_VBR(gfp, vbr_mtrh); - break; - } - case INSANE: - { - preset = 320; - gfp->preset = preset; - (void) apply_abr_preset(gfp, preset, enforce); - lame_set_VBR(gfp, vbr_off); - return preset; - } - } - - gfp->preset = preset; - { - switch (preset) { - case V9: - apply_vbr_preset(gfp, 9, enforce); - return preset; - case V8: - apply_vbr_preset(gfp, 8, enforce); - return preset; - case V7: - apply_vbr_preset(gfp, 7, enforce); - return preset; - case V6: - apply_vbr_preset(gfp, 6, enforce); - return preset; - case V5: - apply_vbr_preset(gfp, 5, enforce); - return preset; - case V4: - apply_vbr_preset(gfp, 4, enforce); - return preset; - case V3: - apply_vbr_preset(gfp, 3, enforce); - return preset; - case V2: - apply_vbr_preset(gfp, 2, enforce); - return preset; - case V1: - apply_vbr_preset(gfp, 1, enforce); - return preset; - case V0: - apply_vbr_preset(gfp, 0, enforce); - return preset; - default: - break; - } - } - if (8 <= preset && preset <= 320) { - return apply_abr_preset(gfp, preset, enforce); - } - - gfp->preset = 0; /*no corresponding preset found */ - return preset; -} diff --git a/src/lib/dl/ext/lame/psymodel.c b/src/lib/dl/ext/lame/psymodel.c deleted file mode 100755 index 67593b74..00000000 --- a/src/lib/dl/ext/lame/psymodel.c +++ /dev/null @@ -1,2168 +0,0 @@ -/* - * psymodel.c - * - * Copyright (c) 1999-2000 Mark Taylor - * Copyright (c) 2001-2002 Naoki Shibata - * Copyright (c) 2000-2003 Takehiro Tominaga - * Copyright (c) 2000-2011 Robert Hegemann - * Copyright (c) 2000-2005 Gabriel Bouvigne - * Copyright (c) 2000-2005 Alexander Leidinger - * - * 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. - */ - -/* $Id: psymodel.c,v 1.209 2011/05/24 20:45:55 robert Exp $ */ - - -/* -PSYCHO ACOUSTICS - - -This routine computes the psycho acoustics, delayed by one granule. - -Input: buffer of PCM data (1024 samples). - -This window should be centered over the 576 sample granule window. -The routine will compute the psycho acoustics for -this granule, but return the psycho acoustics computed -for the *previous* granule. This is because the block -type of the previous granule can only be determined -after we have computed the psycho acoustics for the following -granule. - -Output: maskings and energies for each scalefactor band. -block type, PE, and some correlation measures. -The PE is used by CBR modes to determine if extra bits -from the bit reservoir should be used. The correlation -measures are used to determine mid/side or regular stereo. -*/ -/* -Notation: - -barks: a non-linear frequency scale. Mapping from frequency to - barks is given by freq2bark() - -scalefactor bands: The spectrum (frequencies) are broken into - SBMAX "scalefactor bands". Thes bands - are determined by the MPEG ISO spec. In - the noise shaping/quantization code, we allocate - bits among the partition bands to achieve the - best possible quality - -partition bands: The spectrum is also broken into about - 64 "partition bands". Each partition - band is about .34 barks wide. There are about 2-5 - partition bands for each scalefactor band. - -LAME computes all psycho acoustic information for each partition -band. Then at the end of the computations, this information -is mapped to scalefactor bands. The energy in each scalefactor -band is taken as the sum of the energy in all partition bands -which overlap the scalefactor band. The maskings can be computed -in the same way (and thus represent the average masking in that band) -or by taking the minmum value multiplied by the number of -partition bands used (which represents a minimum masking in that band). -*/ -/* -The general outline is as follows: - -1. compute the energy in each partition band -2. compute the tonality in each partition band -3. compute the strength of each partion band "masker" -4. compute the masking (via the spreading function applied to each masker) -5. Modifications for mid/side masking. - -Each partition band is considiered a "masker". The strength -of the i'th masker in band j is given by: - - s3(bark(i)-bark(j))*strength(i) - -The strength of the masker is a function of the energy and tonality. -The more tonal, the less masking. LAME uses a simple linear formula -(controlled by NMT and TMN) which says the strength is given by the -energy divided by a linear function of the tonality. -*/ -/* -s3() is the "spreading function". It is given by a formula -determined via listening tests. - -The total masking in the j'th partition band is the sum over -all maskings i. It is thus given by the convolution of -the strength with s3(), the "spreading function." - -masking(j) = sum_over_i s3(i-j)*strength(i) = s3 o strength - -where "o" = convolution operator. s3 is given by a formula determined -via listening tests. It is normalized so that s3 o 1 = 1. - -Note: instead of a simple convolution, LAME also has the -option of using "additive masking" - -The most critical part is step 2, computing the tonality of each -partition band. LAME has two tonality estimators. The first -is based on the ISO spec, and measures how predictiable the -signal is over time. The more predictable, the more tonal. -The second measure is based on looking at the spectrum of -a single granule. The more peaky the spectrum, the more -tonal. By most indications, the latter approach is better. - -Finally, in step 5, the maskings for the mid and side -channel are possibly increased. Under certain circumstances, -noise in the mid & side channels is assumed to also -be masked by strong maskers in the L or R channels. - - -Other data computed by the psy-model: - -ms_ratio side-channel / mid-channel masking ratio (for previous granule) -ms_ratio_next side-channel / mid-channel masking ratio for this granule - -percep_entropy[2] L and R values (prev granule) of PE - A measure of how - much pre-echo is in the previous granule -percep_entropy_MS[2] mid and side channel values (prev granule) of percep_entropy -energy[4] L,R,M,S energy in each channel, prev granule -blocktype_d[2] block type to use for previous granule -*/ - - - - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "psymodel.h" -#include "lame_global_flags.h" -#include "fft.h" -#include "lame-analysis.h" - - -#define NSFIRLEN 21 - -#ifdef M_LN10 -#define LN_TO_LOG10 (M_LN10/10) -#else -#define LN_TO_LOG10 0.2302585093 -#endif - - -/* - L3psycho_anal. Compute psycho acoustics. - - Data returned to the calling program must be delayed by one - granule. - - This is done in two places. - If we do not need to know the blocktype, the copying - can be done here at the top of the program: we copy the data for - the last granule (computed during the last call) before it is - overwritten with the new data. It looks like this: - - 0. static psymodel_data - 1. calling_program_data = psymodel_data - 2. compute psymodel_data - - For data which needs to know the blocktype, the copying must be - done at the end of this loop, and the old values must be saved: - - 0. static psymodel_data_old - 1. compute psymodel_data - 2. compute possible block type of this granule - 3. compute final block type of previous granule based on #2. - 4. calling_program_data = psymodel_data_old - 5. psymodel_data_old = psymodel_data -*/ - - - - - -/* psycho_loudness_approx - jd - 2001 mar 12 -in: energy - BLKSIZE/2 elements of frequency magnitudes ^ 2 - gfp - uses out_samplerate, ATHtype (also needed for ATHformula) -returns: loudness^2 approximation, a positive value roughly tuned for a value - of 1.0 for signals near clipping. -notes: When calibrated, feeding this function binary white noise at sample - values +32767 or -32768 should return values that approach 3. - ATHformula is used to approximate an equal loudness curve. -future: Data indicates that the shape of the equal loudness curve varies - with intensity. This function might be improved by using an equal - loudness curve shaped for typical playback levels (instead of the - ATH, that is shaped for the threshold). A flexible realization might - simply bend the existing ATH curve to achieve the desired shape. - However, the potential gain may not be enough to justify an effort. -*/ -static FLOAT -psycho_loudness_approx(FLOAT const *energy, FLOAT const *eql_w) -{ - int i; - FLOAT loudness_power; - - loudness_power = 0.0; - /* apply weights to power in freq. bands */ - for (i = 0; i < BLKSIZE / 2; ++i) - loudness_power += energy[i] * eql_w[i]; - loudness_power *= VO_SCALE; - - return loudness_power; -} - -/* mask_add optimization */ -/* init the limit values used to avoid computing log in mask_add when it is not necessary */ - -/* For example, with i = 10*log10(m2/m1)/10*16 (= log10(m2/m1)*16) - * - * abs(i)>8 is equivalent (as i is an integer) to - * abs(i)>=9 - * i>=9 || i<=-9 - * equivalent to (as i is the biggest integer smaller than log10(m2/m1)*16 - * or the smallest integer bigger than log10(m2/m1)*16 depending on the sign of log10(m2/m1)*16) - * log10(m2/m1)>=9/16 || log10(m2/m1)<=-9/16 - * exp10 is strictly increasing thus this is equivalent to - * m2/m1 >= 10^(9/16) || m2/m1<=10^(-9/16) which are comparisons to constants - */ - - -#define I1LIMIT 8 /* as in if(i>8) */ -#define I2LIMIT 23 /* as in if(i>24) -> changed 23 */ -#define MLIMIT 15 /* as in if(m<15) */ - -static FLOAT ma_max_i1; -static FLOAT ma_max_i2; -static FLOAT ma_max_m; - - /*This is the masking table: - According to tonality, values are going from 0dB (TMN) - to 9.3dB (NMT). - After additive masking computation, 8dB are added, so - final values are going from 8dB to 17.3dB - */ -static const FLOAT tab[] = { - 1.0 /*pow(10, -0) */ , - 0.79433 /*pow(10, -0.1) */ , - 0.63096 /*pow(10, -0.2) */ , - 0.63096 /*pow(10, -0.2) */ , - 0.63096 /*pow(10, -0.2) */ , - 0.63096 /*pow(10, -0.2) */ , - 0.63096 /*pow(10, -0.2) */ , - 0.25119 /*pow(10, -0.6) */ , - 0.11749 /*pow(10, -0.93) */ -}; - -static const int tab_mask_add_delta[] = { 2, 2, 2, 1, 1, 1, 0, 0, -1 }; -#define STATIC_ASSERT_EQUAL_DIMENSION(A,B) {extern char static_assert_##A[dimension_of(A) == dimension_of(B) ? 1 : -1];(void) static_assert_##A;} - -inline static int -mask_add_delta(int i) -{ - STATIC_ASSERT_EQUAL_DIMENSION(tab_mask_add_delta,tab); - assert(i < (int)dimension_of(tab)); - return tab_mask_add_delta[i]; -} - - -static void -init_mask_add_max_values(void) -{ - ma_max_i1 = pow(10, (I1LIMIT + 1) / 16.0); - ma_max_i2 = pow(10, (I2LIMIT + 1) / 16.0); - ma_max_m = pow(10, (MLIMIT) / 10.0); -} - - - - -/* addition of simultaneous masking Naoki Shibata 2000/7 */ -inline static FLOAT -vbrpsy_mask_add(FLOAT m1, FLOAT m2, int b, int delta) -{ - static const FLOAT table2[] = { - 1.33352 * 1.33352, 1.35879 * 1.35879, 1.38454 * 1.38454, 1.39497 * 1.39497, - 1.40548 * 1.40548, 1.3537 * 1.3537, 1.30382 * 1.30382, 1.22321 * 1.22321, - 1.14758 * 1.14758, - 1 - }; - - FLOAT ratio; - - if (m1 < 0) { - m1 = 0; - } - if (m2 < 0) { - m2 = 0; - } - if (m1 <= 0) { - return m2; - } - if (m2 <= 0) { - return m1; - } - if (m2 > m1) { - ratio = m2 / m1; - } - else { - ratio = m1 / m2; - } - if (abs(b) <= delta) { /* approximately, 1 bark = 3 partitions */ - /* originally 'if(i > 8)' */ - if (ratio >= ma_max_i1) { - return m1 + m2; - } - else { - int i = (int) (FAST_LOG10_X(ratio, 16.0f)); - return (m1 + m2) * table2[i]; - } - } - if (ratio < ma_max_i2) { - return m1 + m2; - } - if (m1 < m2) { - m1 = m2; - } - return m1; -} - - -/* short block threshold calculation (part 2) - - partition band bo_s[sfb] is at the transition from scalefactor - band sfb to the next one sfb+1; enn and thmm have to be split - between them -*/ -static void -convert_partition2scalefac(PsyConst_CB2SB_t const *const gd, FLOAT const *eb, FLOAT const *thr, - FLOAT enn_out[], FLOAT thm_out[]) -{ - static FLOAT enn, thmm; - int sb, b, n = gd->n_sb; - enn = thmm = 0.0f; - for (sb = b = 0; sb < n; ++b, ++sb) { - int const bo_sb = gd->bo[sb]; - int const npart = gd->npart; - int const b_lim = bo_sb < npart ? bo_sb : npart; - while (b < b_lim) { - assert(eb[b] >= 0); /* iff failed, it may indicate some index error elsewhere */ - assert(thr[b] >= 0); - enn += eb[b]; - thmm += thr[b]; - b++; - } - if (b >= npart) { - enn_out[sb] = enn; - thm_out[sb] = thmm; - ++sb; - break; - } - assert(eb[b] >= 0); /* iff failed, it may indicate some index error elsewhere */ - assert(thr[b] >= 0); - { - /* at transition sfb -> sfb+1 */ - FLOAT const w_curr = gd->bo_weight[sb]; - FLOAT const w_next = 1.0f - w_curr; - enn += w_curr * eb[b]; - thmm += w_curr * thr[b]; - enn_out[sb] = enn; - thm_out[sb] = thmm; - enn = w_next * eb[b]; - thmm = w_next * thr[b]; - } - } - /* zero initialize the rest */ - for (; sb < n; ++sb) { - enn_out[sb] = 0; - thm_out[sb] = 0; - } -} - -static void -convert_partition2scalefac_s(lame_internal_flags * gfc, FLOAT const *eb, FLOAT const *thr, int chn, - int sblock) -{ - PsyStateVar_t *const psv = &gfc->sv_psy; - PsyConst_CB2SB_t const *const gds = &gfc->cd_psy->s; - static FLOAT enn[SBMAX_s], thm[SBMAX_s]; - int sb; - convert_partition2scalefac(gds, eb, thr, enn, thm); - for (sb = 0; sb < SBMAX_s; ++sb) { - psv->en[chn].s[sb][sblock] = enn[sb]; - psv->thm[chn].s[sb][sblock] = thm[sb]; - } -} - -/* longblock threshold calculation (part 2) */ -static void -convert_partition2scalefac_l(lame_internal_flags * gfc, FLOAT const *eb, FLOAT const *thr, int chn) -{ - PsyStateVar_t *const psv = &gfc->sv_psy; - PsyConst_CB2SB_t const *const gdl = &gfc->cd_psy->l; - FLOAT *enn = &psv->en[chn].l[0]; - FLOAT *thm = &psv->thm[chn].l[0]; - convert_partition2scalefac(gdl, eb, thr, enn, thm); -} - -static void -convert_partition2scalefac_l_to_s(lame_internal_flags * gfc, FLOAT const *eb, FLOAT const *thr, - int chn) -{ - PsyStateVar_t *const psv = &gfc->sv_psy; - PsyConst_CB2SB_t const *const gds = &gfc->cd_psy->l_to_s; - static FLOAT enn[SBMAX_s], thm[SBMAX_s]; - int sb, sblock; - convert_partition2scalefac(gds, eb, thr, enn, thm); - for (sb = 0; sb < SBMAX_s; ++sb) { - FLOAT const scale = 1. / 64.f; - FLOAT const tmp_enn = enn[sb]; - FLOAT const tmp_thm = thm[sb] * scale; - for (sblock = 0; sblock < 3; ++sblock) { - psv->en[chn].s[sb][sblock] = tmp_enn; - psv->thm[chn].s[sb][sblock] = tmp_thm; - } - } -} - - - -static inline FLOAT -NS_INTERP(FLOAT x, FLOAT y, FLOAT r) -{ - /* was pow((x),(r))*pow((y),1-(r)) */ - if (r >= 1.0f) - return x; /* 99.7% of the time */ - if (r <= 0.0f) - return y; - if (y > 0.0f) - return powf(x / y, r) * y; /* rest of the time */ - return 0.0f; /* never happens */ -} - - - -static FLOAT -pecalc_s(III_psy_ratio const *mr, FLOAT masking_lower) -{ - FLOAT pe_s; - static const FLOAT regcoef_s[] = { - 11.8, /* these values are tuned only for 44.1kHz... */ - 13.6, - 17.2, - 32, - 46.5, - 51.3, - 57.5, - 67.1, - 71.5, - 84.6, - 97.6, - 130, -/* 255.8 */ - }; - unsigned int sb, sblock; - - pe_s = 1236.28f / 4; - for (sb = 0; sb < SBMAX_s - 1; sb++) { - for (sblock = 0; sblock < 3; sblock++) { - FLOAT const thm = mr->thm.s[sb][sblock]; - assert(sb < dimension_of(regcoef_s)); - if (thm > 0.0f) { - FLOAT const x = thm * masking_lower; - FLOAT const en = mr->en.s[sb][sblock]; - if (en > x) { - if (en > x * 1e10f) { - pe_s += regcoef_s[sb] * (10.0f * LOG10); - } - else { - assert(x > 0); - pe_s += regcoef_s[sb] * FAST_LOG10(en / x); - } - } - } - } - } - - return pe_s; -} - -static FLOAT -pecalc_l(III_psy_ratio const *mr, FLOAT masking_lower) -{ - FLOAT pe_l; - static const FLOAT regcoef_l[] = { - 6.8, /* these values are tuned only for 44.1kHz... */ - 5.8, - 5.8, - 6.4, - 6.5, - 9.9, - 12.1, - 14.4, - 15, - 18.9, - 21.6, - 26.9, - 34.2, - 40.2, - 46.8, - 56.5, - 60.7, - 73.9, - 85.7, - 93.4, - 126.1, -/* 241.3 */ - }; - unsigned int sb; - - pe_l = 1124.23f / 4; - for (sb = 0; sb < SBMAX_l - 1; sb++) { - FLOAT const thm = mr->thm.l[sb]; - assert(sb < dimension_of(regcoef_l)); - if (thm > 0.0f) { - FLOAT const x = thm * masking_lower; - FLOAT const en = mr->en.l[sb]; - if (en > x) { - if (en > x * 1e10f) { - pe_l += regcoef_l[sb] * (10.0f * LOG10); - } - else { - assert(x > 0); - pe_l += regcoef_l[sb] * FAST_LOG10(en / x); - } - } - } - } - - return pe_l; -} - - -static void -calc_energy(PsyConst_CB2SB_t const *l, FLOAT const *fftenergy, FLOAT * eb, FLOAT * max, FLOAT * avg) -{ - int b, j; - - for (b = j = 0; b < l->npart; ++b) { - FLOAT ebb = 0, m = 0; - int i; - for (i = 0; i < l->numlines[b]; ++i, ++j) { - FLOAT const el = fftenergy[j]; - assert(el >= 0); - ebb += el; - if (m < el) - m = el; - } - eb[b] = ebb; - max[b] = m; - avg[b] = ebb * l->rnumlines[b]; - assert(l->rnumlines[b] >= 0); - assert(ebb >= 0); - assert(eb[b] >= 0); - assert(max[b] >= 0); - assert(avg[b] >= 0); - } -} - - -static void -calc_mask_index_l(lame_internal_flags const *gfc, FLOAT const *max, - FLOAT const *avg, unsigned char *mask_idx) -{ - PsyConst_CB2SB_t const *const gdl = &gfc->cd_psy->l; - FLOAT m, a; - int b, k; - int const last_tab_entry = sizeof(tab) / sizeof(tab[0]) - 1; - b = 0; - a = avg[b] + avg[b + 1]; - assert(a >= 0); - if (a > 0.0f) { - m = max[b]; - if (m < max[b + 1]) - m = max[b + 1]; - assert((gdl->numlines[b] + gdl->numlines[b + 1] - 1) > 0); - a = 20.0f * (m * 2.0f - a) - / (a * (gdl->numlines[b] + gdl->numlines[b + 1] - 1)); - k = (int) a; - if (k > last_tab_entry) - k = last_tab_entry; - mask_idx[b] = k; - } - else { - mask_idx[b] = 0; - } - - for (b = 1; b < gdl->npart - 1; b++) { - a = avg[b - 1] + avg[b] + avg[b + 1]; - assert(a >= 0); - if (a > 0.0f) { - m = max[b - 1]; - if (m < max[b]) - m = max[b]; - if (m < max[b + 1]) - m = max[b + 1]; - assert((gdl->numlines[b - 1] + gdl->numlines[b] + gdl->numlines[b + 1] - 1) > 0); - a = 20.0f * (m * 3.0f - a) - / (a * (gdl->numlines[b - 1] + gdl->numlines[b] + gdl->numlines[b + 1] - 1)); - k = (int) a; - if (k > last_tab_entry) - k = last_tab_entry; - mask_idx[b] = k; - } - else { - mask_idx[b] = 0; - } - } - assert(b > 0); - assert(b == gdl->npart - 1); - - a = avg[b - 1] + avg[b]; - assert(a >= 0); - if (a > 0.0f) { - m = max[b - 1]; - if (m < max[b]) - m = max[b]; - assert((gdl->numlines[b - 1] + gdl->numlines[b] - 1) > 0); - a = 20.0f * (m * 2.0f - a) - / (a * (gdl->numlines[b - 1] + gdl->numlines[b] - 1)); - k = (int) a; - if (k > last_tab_entry) - k = last_tab_entry; - mask_idx[b] = k; - } - else { - mask_idx[b] = 0; - } - assert(b == (gdl->npart - 1)); -} - - -static void -vbrpsy_compute_fft_l(lame_internal_flags * gfc, const sample_t * const buffer[2], int chn, - int gr_out, FLOAT fftenergy[HBLKSIZE], FLOAT(*wsamp_l)[BLKSIZE]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - PsyStateVar_t *psv = &gfc->sv_psy; - plotting_data *plt = cfg->analysis ? gfc->pinfo : 0; - int j; - - if (chn < 2) { - fft_long(gfc, *wsamp_l, chn, buffer); - } - else if (chn == 2) { - FLOAT const sqrt2_half = SQRT2 * 0.5f; - /* FFT data for mid and side channel is derived from L & R */ - for (j = BLKSIZE - 1; j >= 0; --j) { - FLOAT const l = wsamp_l[0][j]; - FLOAT const r = wsamp_l[1][j]; - wsamp_l[0][j] = (l + r) * sqrt2_half; - wsamp_l[1][j] = (l - r) * sqrt2_half; - } - } - - /********************************************************************* - * compute energies - *********************************************************************/ - fftenergy[0] = wsamp_l[0][0]; - fftenergy[0] *= fftenergy[0]; - - for (j = BLKSIZE / 2 - 1; j >= 0; --j) { - FLOAT const re = (*wsamp_l)[BLKSIZE / 2 - j]; - FLOAT const im = (*wsamp_l)[BLKSIZE / 2 + j]; - fftenergy[BLKSIZE / 2 - j] = (re * re + im * im) * 0.5f; - } - /* total energy */ - { - FLOAT totalenergy = 0.0f; - for (j = 11; j < HBLKSIZE; j++) - totalenergy += fftenergy[j]; - - psv->tot_ener[chn] = totalenergy; - } - - if (plt) { - for (j = 0; j < HBLKSIZE; j++) { - plt->energy[gr_out][chn][j] = plt->energy_save[chn][j]; - plt->energy_save[chn][j] = fftenergy[j]; - } - } -} - - -static void -vbrpsy_compute_fft_s(lame_internal_flags const *gfc, const sample_t * const buffer[2], int chn, - int sblock, FLOAT(*fftenergy_s)[HBLKSIZE_s], FLOAT(*wsamp_s)[3][BLKSIZE_s]) -{ - int j; - - if (sblock == 0 && chn < 2) { - fft_short(gfc, *wsamp_s, chn, buffer); - } - if (chn == 2) { - FLOAT const sqrt2_half = SQRT2 * 0.5f; - /* FFT data for mid and side channel is derived from L & R */ - for (j = BLKSIZE_s - 1; j >= 0; --j) { - FLOAT const l = wsamp_s[0][sblock][j]; - FLOAT const r = wsamp_s[1][sblock][j]; - wsamp_s[0][sblock][j] = (l + r) * sqrt2_half; - wsamp_s[1][sblock][j] = (l - r) * sqrt2_half; - } - } - - /********************************************************************* - * compute energies - *********************************************************************/ - fftenergy_s[sblock][0] = (*wsamp_s)[sblock][0]; - fftenergy_s[sblock][0] *= fftenergy_s[sblock][0]; - for (j = BLKSIZE_s / 2 - 1; j >= 0; --j) { - FLOAT const re = (*wsamp_s)[sblock][BLKSIZE_s / 2 - j]; - FLOAT const im = (*wsamp_s)[sblock][BLKSIZE_s / 2 + j]; - fftenergy_s[sblock][BLKSIZE_s / 2 - j] = (re * re + im * im) * 0.5f; - } -} - - - /********************************************************************* - * compute loudness approximation (used for ATH auto-level adjustment) - *********************************************************************/ -static void -vbrpsy_compute_loudness_approximation_l(lame_internal_flags * gfc, int gr_out, int chn, - const FLOAT fftenergy[HBLKSIZE]) -{ - PsyStateVar_t *psv = &gfc->sv_psy; - if (chn < 2) { /*no loudness for mid/side ch */ - gfc->ov_psy.loudness_sq[gr_out][chn] = psv->loudness_sq_save[chn]; - psv->loudness_sq_save[chn] = psycho_loudness_approx(fftenergy, gfc->ATH->eql_w); - } -} - - - /********************************************************************** - * Apply HPF of fs/4 to the input signal. - * This is used for attack detection / handling. - **********************************************************************/ -static void -vbrpsy_attack_detection(lame_internal_flags * gfc, const sample_t * const buffer[2], int gr_out, - III_psy_ratio masking_ratio[2][2], III_psy_ratio masking_MS_ratio[2][2], - FLOAT energy[4], FLOAT sub_short_factor[4][3], int ns_attacks[4][4], - int uselongblock[2]) -{ - static FLOAT ns_hpfsmpl[2][576]; - SessionConfig_t const *const cfg = &gfc->cfg; - PsyStateVar_t *const psv = &gfc->sv_psy; - plotting_data *plt = cfg->analysis ? gfc->pinfo : 0; - int const n_chn_out = cfg->channels_out; - /* chn=2 and 3 = Mid and Side channels */ - int const n_chn_psy = (cfg->mode == JOINT_STEREO) ? 4 : n_chn_out; - int chn, i, j; - - memset(&ns_hpfsmpl[0][0], 0, sizeof(ns_hpfsmpl)); - /* Don't copy the input buffer into a temporary buffer */ - /* unroll the loop 2 times */ - for (chn = 0; chn < n_chn_out; chn++) { - static const FLOAT fircoef[] = { - -8.65163e-18 * 2, -0.00851586 * 2, -6.74764e-18 * 2, 0.0209036 * 2, - -3.36639e-17 * 2, -0.0438162 * 2, -1.54175e-17 * 2, 0.0931738 * 2, - -5.52212e-17 * 2, -0.313819 * 2 - }; - /* apply high pass filter of fs/4 */ - const sample_t *const firbuf = &buffer[chn][576 - 350 - NSFIRLEN + 192]; - assert(dimension_of(fircoef) == ((NSFIRLEN - 1) / 2)); - for (i = 0; i < 576; i++) { - static FLOAT sum1, sum2; - sum1 = firbuf[i + 10]; - sum2 = 0.0; - for (j = 0; j < ((NSFIRLEN - 1) / 2) - 1; j += 2) { - sum1 += fircoef[j] * (firbuf[i + j] + firbuf[i + NSFIRLEN - j]); - sum2 += fircoef[j + 1] * (firbuf[i + j + 1] + firbuf[i + NSFIRLEN - j - 1]); - } - ns_hpfsmpl[chn][i] = sum1 + sum2; - } - masking_ratio[gr_out][chn].en = psv->en[chn]; - masking_ratio[gr_out][chn].thm = psv->thm[chn]; - if (n_chn_psy > 2) { - /* MS maskings */ - /*percep_MS_entropy [chn-2] = gfc -> pe [chn]; */ - masking_MS_ratio[gr_out][chn].en = psv->en[chn + 2]; - masking_MS_ratio[gr_out][chn].thm = psv->thm[chn + 2]; - } - } - for (chn = 0; chn < n_chn_psy; chn++) { - static FLOAT attack_intensity[12]; - static FLOAT en_subshort[12]; - FLOAT en_short[4] = { 0, 0, 0, 0 }; - FLOAT const *pf = ns_hpfsmpl[chn & 1]; - int ns_uselongblock = 1; - - if (chn == 2) { - for (i = 0, j = 576; j > 0; ++i, --j) { - FLOAT const l = ns_hpfsmpl[0][i]; - FLOAT const r = ns_hpfsmpl[1][i]; - ns_hpfsmpl[0][i] = l + r; - ns_hpfsmpl[1][i] = l - r; - } - } - /*************************************************************** - * determine the block type (window type) - ***************************************************************/ - /* calculate energies of each sub-shortblocks */ - for (i = 0; i < 3; i++) { - en_subshort[i] = psv->last_en_subshort[chn][i + 6]; - assert(psv->last_en_subshort[chn][i + 4] > 0); - attack_intensity[i] = en_subshort[i] / psv->last_en_subshort[chn][i + 4]; - en_short[0] += en_subshort[i]; - } - - for (i = 0; i < 9; i++) { - FLOAT const *const pfe = pf + 576 / 9; - FLOAT p = 1.; - for (; pf < pfe; pf++) - if (p < fabs(*pf)) - p = fabs(*pf); - psv->last_en_subshort[chn][i] = en_subshort[i + 3] = p; - en_short[1 + i / 3] += p; - if (p > en_subshort[i + 3 - 2]) { - assert(en_subshort[i + 3 - 2] > 0); - p = p / en_subshort[i + 3 - 2]; - } - else if (en_subshort[i + 3 - 2] > p * 10.0f) { - assert(p > 0); - p = en_subshort[i + 3 - 2] / (p * 10.0f); - } - else { - p = 0.0; - } - attack_intensity[i + 3] = p; - } - - /* pulse like signal detection for fatboy.wav and so on */ - for (i = 0; i < 3; ++i) { - FLOAT const enn = - en_subshort[i * 3 + 3] + en_subshort[i * 3 + 4] + en_subshort[i * 3 + 5]; - FLOAT factor = 1.f; - if (en_subshort[i * 3 + 5] * 6 < enn) { - factor *= 0.5f; - if (en_subshort[i * 3 + 4] * 6 < enn) { - factor *= 0.5f; - } - } - sub_short_factor[chn][i] = factor; - } - - if (plt) { - FLOAT x = attack_intensity[0]; - for (i = 1; i < 12; i++) { - if (x < attack_intensity[i]) { - x = attack_intensity[i]; - } - } - plt->ers[gr_out][chn] = plt->ers_save[chn]; - plt->ers_save[chn] = x; - } - - /* compare energies between sub-shortblocks */ - { - FLOAT x = gfc->cd_psy->attack_threshold[chn]; - for (i = 0; i < 12; i++) { - if (ns_attacks[chn][i / 3] == 0) { - if (attack_intensity[i] > x) { - ns_attacks[chn][i / 3] = (i % 3) + 1; - } - } - } - } - /* should have energy change between short blocks, in order to avoid periodic signals */ - /* Good samples to show the effect are Trumpet test songs */ - /* GB: tuned (1) to avoid too many short blocks for test sample TRUMPET */ - /* RH: tuned (2) to let enough short blocks through for test sample FSOL and SNAPS */ - for (i = 1; i < 4; i++) { - FLOAT const u = en_short[i - 1]; - FLOAT const v = en_short[i]; - FLOAT const m = Max(u, v); - if (m < 40000) { /* (2) */ - if (u < 1.7f * v && v < 1.7f * u) { /* (1) */ - if (i == 1 && ns_attacks[chn][0] <= ns_attacks[chn][i]) { - ns_attacks[chn][0] = 0; - } - ns_attacks[chn][i] = 0; - } - } - } - - if (ns_attacks[chn][0] <= psv->last_attacks[chn]) { - ns_attacks[chn][0] = 0; - } - - if (psv->last_attacks[chn] == 3 || - ns_attacks[chn][0] + ns_attacks[chn][1] + ns_attacks[chn][2] + ns_attacks[chn][3]) { - ns_uselongblock = 0; - - if (ns_attacks[chn][1] && ns_attacks[chn][0]) { - ns_attacks[chn][1] = 0; - } - if (ns_attacks[chn][2] && ns_attacks[chn][1]) { - ns_attacks[chn][2] = 0; - } - if (ns_attacks[chn][3] && ns_attacks[chn][2]) { - ns_attacks[chn][3] = 0; - } - } - - if (chn < 2) { - uselongblock[chn] = ns_uselongblock; - } - else { - if (ns_uselongblock == 0) { - uselongblock[0] = uselongblock[1] = 0; - } - } - - /* there is a one granule delay. Copy maskings computed last call - * into masking_ratio to return to calling program. - */ - energy[chn] = psv->tot_ener[chn]; - } -} - - -static void -vbrpsy_skip_masking_s(lame_internal_flags * gfc, int chn, int sblock) -{ - if (sblock == 0) { - FLOAT *nbs2 = &gfc->sv_psy.nb_s2[chn][0]; - FLOAT *nbs1 = &gfc->sv_psy.nb_s1[chn][0]; - int const n = gfc->cd_psy->s.npart; - int b; - for (b = 0; b < n; b++) { - nbs2[b] = nbs1[b]; - } - } -} - - -static void -vbrpsy_calc_mask_index_s(lame_internal_flags const *gfc, FLOAT const *max, - FLOAT const *avg, unsigned char *mask_idx) -{ - PsyConst_CB2SB_t const *const gds = &gfc->cd_psy->s; - FLOAT m, a; - int b, k; - int const last_tab_entry = dimension_of(tab) - 1; - b = 0; - a = avg[b] + avg[b + 1]; - assert(a >= 0); - if (a > 0.0f) { - m = max[b]; - if (m < max[b + 1]) - m = max[b + 1]; - assert((gds->numlines[b] + gds->numlines[b + 1] - 1) > 0); - a = 20.0f * (m * 2.0f - a) - / (a * (gds->numlines[b] + gds->numlines[b + 1] - 1)); - k = (int) a; - if (k > last_tab_entry) - k = last_tab_entry; - mask_idx[b] = k; - } - else { - mask_idx[b] = 0; - } - - for (b = 1; b < gds->npart - 1; b++) { - a = avg[b - 1] + avg[b] + avg[b + 1]; - assert(b + 1 < gds->npart); - assert(a >= 0); - if (a > 0.0) { - m = max[b - 1]; - if (m < max[b]) - m = max[b]; - if (m < max[b + 1]) - m = max[b + 1]; - assert((gds->numlines[b - 1] + gds->numlines[b] + gds->numlines[b + 1] - 1) > 0); - a = 20.0f * (m * 3.0f - a) - / (a * (gds->numlines[b - 1] + gds->numlines[b] + gds->numlines[b + 1] - 1)); - k = (int) a; - if (k > last_tab_entry) - k = last_tab_entry; - mask_idx[b] = k; - } - else { - mask_idx[b] = 0; - } - } - assert(b > 0); - assert(b == gds->npart - 1); - - a = avg[b - 1] + avg[b]; - assert(a >= 0); - if (a > 0.0f) { - m = max[b - 1]; - if (m < max[b]) - m = max[b]; - assert((gds->numlines[b - 1] + gds->numlines[b] - 1) > 0); - a = 20.0f * (m * 2.0f - a) - / (a * (gds->numlines[b - 1] + gds->numlines[b] - 1)); - k = (int) a; - if (k > last_tab_entry) - k = last_tab_entry; - mask_idx[b] = k; - } - else { - mask_idx[b] = 0; - } - assert(b == (gds->npart - 1)); -} - - -static void -vbrpsy_compute_masking_s(lame_internal_flags * gfc, const FLOAT(*fftenergy_s)[HBLKSIZE_s], - FLOAT * eb, FLOAT * thr, int chn, int sblock) -{ - PsyStateVar_t *const psv = &gfc->sv_psy; - PsyConst_CB2SB_t const *const gds = &gfc->cd_psy->s; - static FLOAT max[CBANDS], avg[CBANDS]; - int i, j, b; - static unsigned char mask_idx_s[CBANDS]; - - memset(max, 0, sizeof(max)); - memset(avg, 0, sizeof(avg)); - - for (b = j = 0; b < gds->npart; ++b) { - FLOAT ebb = 0, m = 0; - int const n = gds->numlines[b]; - for (i = 0; i < n; ++i, ++j) { - FLOAT const el = fftenergy_s[sblock][j]; - ebb += el; - if (m < el) - m = el; - } - eb[b] = ebb; - assert(ebb >= 0); - max[b] = m; - assert(n > 0); - avg[b] = ebb * gds->rnumlines[b]; - assert(avg[b] >= 0); - } - assert(b == gds->npart); - assert(j == 129); - vbrpsy_calc_mask_index_s(gfc, max, avg, mask_idx_s); - for (j = b = 0; b < gds->npart; b++) { - int kk = gds->s3ind[b][0]; - int const last = gds->s3ind[b][1]; - int const delta = mask_add_delta(mask_idx_s[b]); - int dd, dd_n; - FLOAT x, ecb, avg_mask; - FLOAT const masking_lower = gds->masking_lower[b] * gfc->sv_qnt.masking_lower; - - dd = mask_idx_s[kk]; - dd_n = 1; - ecb = gds->s3[j] * eb[kk] * tab[mask_idx_s[kk]]; - ++j, ++kk; - while (kk <= last) { - dd += mask_idx_s[kk]; - dd_n += 1; - x = gds->s3[j] * eb[kk] * tab[mask_idx_s[kk]]; - ecb = vbrpsy_mask_add(ecb, x, kk - b, delta); - ++j, ++kk; - } - dd = (1 + 2 * dd) / (2 * dd_n); - avg_mask = tab[dd] * 0.5f; - ecb *= avg_mask; -#if 0 /* we can do PRE ECHO control now here, or do it later */ - if (psv->blocktype_old[chn & 0x01] == SHORT_TYPE) { - /* limit calculated threshold by even older granule */ - FLOAT const t1 = rpelev_s * psv->nb_s1[chn][b]; - FLOAT const t2 = rpelev2_s * psv->nb_s2[chn][b]; - FLOAT const tm = (t2 > 0) ? Min(ecb, t2) : ecb; - thr[b] = (t1 > 0) ? NS_INTERP(Min(tm, t1), ecb, 0.6) : ecb; - } - else { - /* limit calculated threshold by older granule */ - FLOAT const t1 = rpelev_s * psv->nb_s1[chn][b]; - thr[b] = (t1 > 0) ? NS_INTERP(Min(ecb, t1), ecb, 0.6) : ecb; - } -#else /* we do it later */ - thr[b] = ecb; -#endif - psv->nb_s2[chn][b] = psv->nb_s1[chn][b]; - psv->nb_s1[chn][b] = ecb; - { - /* if THR exceeds EB, the quantization routines will take the difference - * from other bands. in case of strong tonal samples (tonaltest.wav) - * this leads to heavy distortions. that's why we limit THR here. - */ - x = max[b]; - x *= gds->minval[b]; - x *= avg_mask; - if (thr[b] > x) { - thr[b] = x; - } - } - if (masking_lower > 1) { - thr[b] *= masking_lower; - } - if (thr[b] > eb[b]) { - thr[b] = eb[b]; - } - if (masking_lower < 1) { - thr[b] *= masking_lower; - } - - assert(thr[b] >= 0); - } - for (; b < CBANDS; ++b) { - eb[b] = 0; - thr[b] = 0; - } -} - - -static void -vbrpsy_compute_masking_l(lame_internal_flags * gfc, const FLOAT fftenergy[HBLKSIZE], - FLOAT eb_l[CBANDS], FLOAT thr[CBANDS], int chn) -{ - PsyStateVar_t *const psv = &gfc->sv_psy; - PsyConst_CB2SB_t const *const gdl = &gfc->cd_psy->l; - static FLOAT max[CBANDS], avg[CBANDS]; - static unsigned char mask_idx_l[CBANDS + 2]; - int k, b; - - /********************************************************************* - * Calculate the energy and the tonality of each partition. - *********************************************************************/ - calc_energy(gdl, fftenergy, eb_l, max, avg); - calc_mask_index_l(gfc, max, avg, mask_idx_l); - - /********************************************************************* - * convolve the partitioned energy and unpredictability - * with the spreading function, s3_l[b][k] - ********************************************************************/ - k = 0; - for (b = 0; b < gdl->npart; b++) { - FLOAT x, ecb, avg_mask, t; - FLOAT const masking_lower = gdl->masking_lower[b] * gfc->sv_qnt.masking_lower; - /* convolve the partitioned energy with the spreading function */ - int kk = gdl->s3ind[b][0]; - int const last = gdl->s3ind[b][1]; - int const delta = mask_add_delta(mask_idx_l[b]); - int dd = 0, dd_n = 0; - - dd = mask_idx_l[kk]; - dd_n += 1; - ecb = gdl->s3[k] * eb_l[kk] * tab[mask_idx_l[kk]]; - ++k, ++kk; - while (kk <= last) { - dd += mask_idx_l[kk]; - dd_n += 1; - x = gdl->s3[k] * eb_l[kk] * tab[mask_idx_l[kk]]; - t = vbrpsy_mask_add(ecb, x, kk - b, delta); -#if 0 - ecb += eb_l[kk]; - if (ecb > t) { - ecb = t; - } -#else - ecb = t; -#endif - ++k, ++kk; - } - dd = (1 + 2 * dd) / (2 * dd_n); - avg_mask = tab[dd] * 0.5f; - ecb *= avg_mask; - - /**** long block pre-echo control ****/ - /* dont use long block pre-echo control if previous granule was - * a short block. This is to avoid the situation: - * frame0: quiet (very low masking) - * frame1: surge (triggers short blocks) - * frame2: regular frame. looks like pre-echo when compared to - * frame0, but all pre-echo was in frame1. - */ - /* chn=0,1 L and R channels - chn=2,3 S and M channels. - */ - if (psv->blocktype_old[chn & 0x01] == SHORT_TYPE) { - FLOAT const ecb_limit = rpelev * psv->nb_l1[chn][b]; - if (ecb_limit > 0) { - thr[b] = Min(ecb, ecb_limit); - } - else { - /* Robert 071209: - Because we don't calculate long block psy when we know a granule - should be of short blocks, we don't have any clue how the granule - before would have looked like as a long block. So we have to guess - a little bit for this END_TYPE block. - Most of the time we get away with this sloppyness. (fingers crossed :) - The speed increase is worth it. - */ - thr[b] = Min(ecb, eb_l[b] * NS_PREECHO_ATT2); - } - } - else { - FLOAT ecb_limit_2 = rpelev2 * psv->nb_l2[chn][b]; - FLOAT ecb_limit_1 = rpelev * psv->nb_l1[chn][b]; - FLOAT ecb_limit; - if (ecb_limit_2 <= 0) { - ecb_limit_2 = ecb; - } - if (ecb_limit_1 <= 0) { - ecb_limit_1 = ecb; - } - if (psv->blocktype_old[chn & 0x01] == NORM_TYPE) { - ecb_limit = Min(ecb_limit_1, ecb_limit_2); - } - else { - ecb_limit = ecb_limit_1; - } - thr[b] = Min(ecb, ecb_limit); - } - psv->nb_l2[chn][b] = psv->nb_l1[chn][b]; - psv->nb_l1[chn][b] = ecb; - { - /* if THR exceeds EB, the quantization routines will take the difference - * from other bands. in case of strong tonal samples (tonaltest.wav) - * this leads to heavy distortions. that's why we limit THR here. - */ - x = max[b]; - x *= gdl->minval[b]; - x *= avg_mask; - if (thr[b] > x) { - thr[b] = x; - } - } - if (masking_lower > 1) { - thr[b] *= masking_lower; - } - if (thr[b] > eb_l[b]) { - thr[b] = eb_l[b]; - } - if (masking_lower < 1) { - thr[b] *= masking_lower; - } - assert(thr[b] >= 0); - } - for (; b < CBANDS; ++b) { - eb_l[b] = 0; - thr[b] = 0; - } -} - - -static void -vbrpsy_compute_block_type(SessionConfig_t const *cfg, int *uselongblock) -{ - int chn; - - if (cfg->short_blocks == short_block_coupled - /* force both channels to use the same block type */ - /* this is necessary if the frame is to be encoded in ms_stereo. */ - /* But even without ms_stereo, FhG does this */ - && !(uselongblock[0] && uselongblock[1])) - uselongblock[0] = uselongblock[1] = 0; - - for (chn = 0; chn < cfg->channels_out; chn++) { - /* disable short blocks */ - if (cfg->short_blocks == short_block_dispensed) { - uselongblock[chn] = 1; - } - if (cfg->short_blocks == short_block_forced) { - uselongblock[chn] = 0; - } - } -} - - -static void -vbrpsy_apply_block_type(PsyStateVar_t * psv, int nch, int const *uselongblock, int *blocktype_d) -{ - int chn; - - /* update the blocktype of the previous granule, since it depends on what - * happend in this granule */ - for (chn = 0; chn < nch; chn++) { - int blocktype = NORM_TYPE; - /* disable short blocks */ - - if (uselongblock[chn]) { - /* no attack : use long blocks */ - assert(psv->blocktype_old[chn] != START_TYPE); - if (psv->blocktype_old[chn] == SHORT_TYPE) - blocktype = STOP_TYPE; - } - else { - /* attack : use short blocks */ - blocktype = SHORT_TYPE; - if (psv->blocktype_old[chn] == NORM_TYPE) { - psv->blocktype_old[chn] = START_TYPE; - } - if (psv->blocktype_old[chn] == STOP_TYPE) - psv->blocktype_old[chn] = SHORT_TYPE; - } - - blocktype_d[chn] = psv->blocktype_old[chn]; /* value returned to calling program */ - psv->blocktype_old[chn] = blocktype; /* save for next call to l3psy_anal */ - } -} - - -/*************************************************************** - * compute M/S thresholds from Johnston & Ferreira 1992 ICASSP paper - ***************************************************************/ - -static void -vbrpsy_compute_MS_thresholds(const FLOAT eb[4][CBANDS], FLOAT thr[4][CBANDS], - const FLOAT cb_mld[CBANDS], const FLOAT ath_cb[CBANDS], FLOAT athlower, - FLOAT msfix, int n) -{ - FLOAT const msfix2 = msfix * 2.f; - FLOAT rside, rmid; - int b; - for (b = 0; b < n; ++b) { - FLOAT const ebM = eb[2][b]; - FLOAT const ebS = eb[3][b]; - FLOAT const thmL = thr[0][b]; - FLOAT const thmR = thr[1][b]; - FLOAT thmM = thr[2][b]; - FLOAT thmS = thr[3][b]; - - /* use this fix if L & R masking differs by 2db or less */ - /* if db = 10*log10(x2/x1) < 2 */ - /* if (x2 < 1.58*x1) { */ - if (thmL <= 1.58f * thmR && thmR <= 1.58f * thmL) { - FLOAT const mld_m = cb_mld[b] * ebS; - FLOAT const mld_s = cb_mld[b] * ebM; - FLOAT const tmp_m = Min(thmS, mld_m); - FLOAT const tmp_s = Min(thmM, mld_s); - rmid = Max(thmM, tmp_m); - rside = Max(thmS, tmp_s); - } - else { - rmid = thmM; - rside = thmS; - } - if (msfix > 0.f) { - /***************************************************************/ - /* Adjust M/S maskings if user set "msfix" */ - /***************************************************************/ - /* Naoki Shibata 2000 */ - FLOAT thmLR, thmMS; - FLOAT const ath = ath_cb[b] * athlower; - FLOAT const tmp_l = Max(thmL, ath); - FLOAT const tmp_r = Max(thmR, ath); - thmLR = Min(tmp_l, tmp_r); - thmM = Max(rmid, ath); - thmS = Max(rside, ath); - thmMS = thmM + thmS; - if (thmMS > 0.f && (thmLR * msfix2) < thmMS) { - FLOAT const f = thmLR * msfix2 / thmMS; - thmM *= f; - thmS *= f; - assert(thmMS > 0.f); - } - rmid = Min(thmM, rmid); - rside = Min(thmS, rside); - } - if (rmid > ebM) { - rmid = ebM; - } - if (rside > ebS) { - rside = ebS; - } - thr[2][b] = rmid; - thr[3][b] = rside; - } -} - - -/* - * NOTE: the bitrate reduction from the inter-channel masking effect is low - * compared to the chance of getting annyoing artefacts. L3psycho_anal_vbr does - * not use this feature. (Robert 071216) -*/ - -int -L3psycho_anal_vbr(lame_internal_flags * gfc, - const sample_t * const buffer[2], int gr_out, - III_psy_ratio masking_ratio[2][2], - III_psy_ratio masking_MS_ratio[2][2], - FLOAT percep_entropy[2], FLOAT percep_MS_entropy[2], - FLOAT energy[4], int blocktype_d[2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - PsyStateVar_t *const psv = &gfc->sv_psy; - PsyConst_CB2SB_t const *const gdl = &gfc->cd_psy->l; - PsyConst_CB2SB_t const *const gds = &gfc->cd_psy->s; - plotting_data *plt = cfg->analysis ? gfc->pinfo : 0; - - /* Jonathan C: Keep these variable OFF the stack, Watcom C doesn't give us much */ - static III_psy_xmin last_thm[4]; - - /* fft and energy calculation */ - static FLOAT(*wsamp_l)[BLKSIZE]; - static FLOAT(*wsamp_s)[3][BLKSIZE_s]; - static FLOAT fftenergy[HBLKSIZE]; - static FLOAT fftenergy_s[3][HBLKSIZE_s]; - static FLOAT wsamp_L[2][BLKSIZE]; - static FLOAT wsamp_S[2][3][BLKSIZE_s]; - static FLOAT eb[4][CBANDS], thr[4][CBANDS]; - - static FLOAT sub_short_factor[4][3]; - FLOAT thmm; - FLOAT const pcfact = 0.6f; - FLOAT const ath_factor = - (cfg->msfix > 0.f) ? (cfg->ATH_offset_factor * gfc->ATH->adjust_factor) : 1.f; - - const FLOAT(*const_eb)[CBANDS] = (const FLOAT(*)[CBANDS]) eb; - const FLOAT(*const_fftenergy_s)[HBLKSIZE_s] = (const FLOAT(*)[HBLKSIZE_s]) fftenergy_s; - - /* block type */ - int ns_attacks[4][4] = { {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} }; - static int uselongblock[2]; - - /* usual variables like loop indices, etc.. */ - int chn, sb, sblock; - - /* chn=2 and 3 = Mid and Side channels */ - int const n_chn_psy = (cfg->mode == JOINT_STEREO) ? 4 : cfg->channels_out; - - memcpy(&last_thm[0], &psv->thm[0], sizeof(last_thm)); - - vbrpsy_attack_detection(gfc, buffer, gr_out, masking_ratio, masking_MS_ratio, energy, - sub_short_factor, ns_attacks, uselongblock); - - vbrpsy_compute_block_type(cfg, uselongblock); - - /* LONG BLOCK CASE */ - { - for (chn = 0; chn < n_chn_psy; chn++) { - int const ch01 = chn & 0x01; - - wsamp_l = wsamp_L + ch01; - vbrpsy_compute_fft_l(gfc, buffer, chn, gr_out, fftenergy, wsamp_l); - vbrpsy_compute_loudness_approximation_l(gfc, gr_out, chn, fftenergy); - vbrpsy_compute_masking_l(gfc, fftenergy, eb[chn], thr[chn], chn); - } - if (cfg->mode == JOINT_STEREO) { - if ((uselongblock[0] + uselongblock[1]) == 2) { - vbrpsy_compute_MS_thresholds(const_eb, thr, gdl->mld_cb, gfc->ATH->cb_l, - ath_factor, cfg->msfix, gdl->npart); - } - } - /* TODO: apply adaptive ATH masking here ?? */ - for (chn = 0; chn < n_chn_psy; chn++) { - convert_partition2scalefac_l(gfc, eb[chn], thr[chn], chn); - convert_partition2scalefac_l_to_s(gfc, eb[chn], thr[chn], chn); - } - } - /* SHORT BLOCKS CASE */ - { - int const force_short_block_calc = gfc->cd_psy->force_short_block_calc; - for (sblock = 0; sblock < 3; sblock++) { - for (chn = 0; chn < n_chn_psy; ++chn) { - int const ch01 = chn & 0x01; - if (uselongblock[ch01] && !force_short_block_calc) { - vbrpsy_skip_masking_s(gfc, chn, sblock); - } - else { - /* compute masking thresholds for short blocks */ - wsamp_s = wsamp_S + ch01; - vbrpsy_compute_fft_s(gfc, buffer, chn, sblock, fftenergy_s, wsamp_s); - vbrpsy_compute_masking_s(gfc, const_fftenergy_s, eb[chn], thr[chn], chn, - sblock); - } - } - if (cfg->mode == JOINT_STEREO) { - if ((uselongblock[0] + uselongblock[1]) == 0) { - vbrpsy_compute_MS_thresholds(const_eb, thr, gds->mld_cb, gfc->ATH->cb_s, - ath_factor, cfg->msfix, gds->npart); - } - } - /* TODO: apply adaptive ATH masking here ?? */ - for (chn = 0; chn < n_chn_psy; ++chn) { - int const ch01 = chn & 0x01; - if (!uselongblock[ch01] || force_short_block_calc) { - convert_partition2scalefac_s(gfc, eb[chn], thr[chn], chn, sblock); - } - } - } - - /**** short block pre-echo control ****/ - for (chn = 0; chn < n_chn_psy; chn++) { - for (sb = 0; sb < SBMAX_s; sb++) { - FLOAT new_thmm[3], prev_thm, t1, t2; - for (sblock = 0; sblock < 3; sblock++) { - thmm = psv->thm[chn].s[sb][sblock]; - thmm *= NS_PREECHO_ATT0; - - t1 = t2 = thmm; - - if (sblock > 0) { - prev_thm = new_thmm[sblock - 1]; - } - else { - prev_thm = last_thm[chn].s[sb][2]; - } - if (ns_attacks[chn][sblock] >= 2 || ns_attacks[chn][sblock + 1] == 1) { - t1 = NS_INTERP(prev_thm, thmm, NS_PREECHO_ATT1 * pcfact); - } - thmm = Min(t1, thmm); - if (ns_attacks[chn][sblock] == 1) { - t2 = NS_INTERP(prev_thm, thmm, NS_PREECHO_ATT2 * pcfact); - } - else if ((sblock == 0 && psv->last_attacks[chn] == 3) - || (sblock > 0 && ns_attacks[chn][sblock - 1] == 3)) { /* 2nd preceeding block */ - switch (sblock) { - case 0: - prev_thm = last_thm[chn].s[sb][1]; - break; - case 1: - prev_thm = last_thm[chn].s[sb][2]; - break; - case 2: - prev_thm = new_thmm[0]; - break; - } - t2 = NS_INTERP(prev_thm, thmm, NS_PREECHO_ATT2 * pcfact); - } - - thmm = Min(t1, thmm); - thmm = Min(t2, thmm); - - /* pulse like signal detection for fatboy.wav and so on */ - thmm *= sub_short_factor[chn][sblock]; - - new_thmm[sblock] = thmm; - } - for (sblock = 0; sblock < 3; sblock++) { - psv->thm[chn].s[sb][sblock] = new_thmm[sblock]; - } - } - } - } - for (chn = 0; chn < n_chn_psy; chn++) { - psv->last_attacks[chn] = ns_attacks[chn][2]; - } - - - /*************************************************************** - * determine final block type - ***************************************************************/ - vbrpsy_apply_block_type(psv, cfg->channels_out, uselongblock, blocktype_d); - - /********************************************************************* - * compute the value of PE to return ... no delay and advance - *********************************************************************/ - for (chn = 0; chn < n_chn_psy; chn++) { - FLOAT *ppe; - int type; - III_psy_ratio const *mr; - - if (chn > 1) { - ppe = percep_MS_entropy - 2; - type = NORM_TYPE; - if (blocktype_d[0] == SHORT_TYPE || blocktype_d[1] == SHORT_TYPE) - type = SHORT_TYPE; - mr = &masking_MS_ratio[gr_out][chn - 2]; - } - else { - ppe = percep_entropy; - type = blocktype_d[chn]; - mr = &masking_ratio[gr_out][chn]; - } - if (type == SHORT_TYPE) { - ppe[chn] = pecalc_s(mr, gfc->sv_qnt.masking_lower); - } - else { - ppe[chn] = pecalc_l(mr, gfc->sv_qnt.masking_lower); - } - - if (plt) { - plt->pe[gr_out][chn] = ppe[chn]; - } - } - return 0; -} - - - - -/* - * The spreading function. Values returned in units of energy - */ -static FLOAT -s3_func(FLOAT bark) -{ - FLOAT tempx, x, tempy, temp; - tempx = bark; - if (tempx >= 0) - tempx *= 3; - else - tempx *= 1.5; - - if (tempx >= 0.5 && tempx <= 2.5) { - temp = tempx - 0.5; - x = 8.0 * (temp * temp - 2.0 * temp); - } - else - x = 0.0; - tempx += 0.474; - tempy = 15.811389 + 7.5 * tempx - 17.5 * sqrt(1.0 + tempx * tempx); - - if (tempy <= -60.0) - return 0.0; - - tempx = exp((x + tempy) * LN_TO_LOG10); - - /* Normalization. The spreading function should be normalized so that: - +inf - / - | s3 [ bark ] d(bark) = 1 - / - -inf - */ - tempx /= .6609193; - return tempx; -} - -#if 0 -static FLOAT -norm_s3_func(void) -{ - double lim_a = 0, lim_b = 0; - double x = 0, l, h; - for (x = 0; s3_func(x) > 1e-20; x -= 1); - l = x; - h = 0; - while (fabs(h - l) > 1e-12) { - x = (h + l) / 2; - if (s3_func(x) > 0) { - h = x; - } - else { - l = x; - } - } - lim_a = l; - for (x = 0; s3_func(x) > 1e-20; x += 1); - l = 0; - h = x; - while (fabs(h - l) > 1e-12) { - x = (h + l) / 2; - if (s3_func(x) > 0) { - l = x; - } - else { - h = x; - } - } - lim_b = h; - { - double sum = 0; - int const m = 1000; - int i; - for (i = 0; i <= m; ++i) { - double x = lim_a + i * (lim_b - lim_a) / m; - double y = s3_func(x); - sum += y; - } - { - double norm = (m + 1) / (sum * (lim_b - lim_a)); - /*printf( "norm = %lf\n",norm); */ - return norm; - } - } -} -#endif - -static FLOAT -stereo_demask(double f) -{ - /* setup stereo demasking thresholds */ - /* formula reverse enginerred from plot in paper */ - double arg = freq2bark(f); - arg = (Min(arg, 15.5) / 15.5); - - return pow(10.0, 1.25 * (1 - cos(PI * arg)) - 2.5); -} - -static void -init_numline(PsyConst_CB2SB_t * gd, FLOAT sfreq, int fft_size, - int mdct_size, int sbmax, int const *scalepos) -{ - static FLOAT b_frq[CBANDS + 1]; - FLOAT const mdct_freq_frac = sfreq / (2.0f * mdct_size); - FLOAT const deltafreq = fft_size / (2.0f * mdct_size); - static int partition[HBLKSIZE] = { 0 }; - int i, j, ni; - int sfb; - sfreq /= fft_size; - j = 0; - ni = 0; - /* compute numlines, the number of spectral lines in each partition band */ - /* each partition band should be about DELBARK wide. */ - for (i = 0; i < CBANDS; i++) { - FLOAT bark1; - int j2, nl; - bark1 = freq2bark(sfreq * j); - - b_frq[i] = sfreq * j; - - for (j2 = j; freq2bark(sfreq * j2) - bark1 < DELBARK && j2 <= fft_size / 2; j2++); - - nl = j2 - j; - gd->numlines[i] = nl; - gd->rnumlines[i] = (nl > 0) ? (1.0f / nl) : 0; - - ni = i + 1; - - while (j < j2) { - assert(j < HBLKSIZE); - partition[j++] = i; - } - if (j > fft_size / 2) { - j = fft_size / 2; - ++i; - break; - } - } - assert(i < CBANDS); - b_frq[i] = sfreq * j; - - gd->n_sb = sbmax; - gd->npart = ni; - - { - j = 0; - for (i = 0; i < gd->npart; i++) { - int const nl = gd->numlines[i]; - FLOAT const freq = sfreq * (j + nl / 2); - gd->mld_cb[i] = stereo_demask(freq); - j += nl; - } - for (; i < CBANDS; ++i) { - gd->mld_cb[i] = 1; - } - } - for (sfb = 0; sfb < sbmax; sfb++) { - int i1, i2, bo; - int start = scalepos[sfb]; - int end = scalepos[sfb + 1]; - - i1 = floor(.5 + deltafreq * (start - .5)); - if (i1 < 0) - i1 = 0; - i2 = floor(.5 + deltafreq * (end - .5)); - - if (i2 > fft_size / 2) - i2 = fft_size / 2; - - bo = partition[i2]; - gd->bm[sfb] = (partition[i1] + partition[i2]) / 2; - gd->bo[sfb] = bo; - - /* calculate how much of this band belongs to current scalefactor band */ - { - FLOAT const f_tmp = mdct_freq_frac * end; - FLOAT bo_w = (f_tmp - b_frq[bo]) / (b_frq[bo + 1] - b_frq[bo]); - if (bo_w < 0) { - bo_w = 0; - } - else { - if (bo_w > 1) { - bo_w = 1; - } - } - gd->bo_weight[sfb] = bo_w; - } - gd->mld[sfb] = stereo_demask(mdct_freq_frac * start); - } -} - -static void -compute_bark_values(PsyConst_CB2SB_t const *gd, FLOAT sfreq, int fft_size, - FLOAT * bval, FLOAT * bval_width) -{ - /* compute bark values of each critical band */ - int k, j = 0, ni = gd->npart; - sfreq /= fft_size; - for (k = 0; k < ni; k++) { - int const w = gd->numlines[k]; - FLOAT bark1, bark2; - - bark1 = freq2bark(sfreq * (j)); - bark2 = freq2bark(sfreq * (j + w - 1)); - bval[k] = .5 * (bark1 + bark2); - - bark1 = freq2bark(sfreq * (j - .5)); - bark2 = freq2bark(sfreq * (j + w - .5)); - bval_width[k] = bark2 - bark1; - j += w; - } -} - -static int -init_s3_values(FLOAT ** p, int (*s3ind)[2], int npart, - FLOAT const *bval, FLOAT const *bval_width, FLOAT const *norm) -{ - static FLOAT s3[CBANDS][CBANDS]; - /* The s3 array is not linear in the bark scale. - * bval[x] should be used to get the bark value. - */ - int i, j, k; - int numberOfNoneZero = 0; - - for (i=0;i < CBANDS;i++) { - for (j=0;j < CBANDS;j++) { - s3[i][j] = 0; - } - } - - /* s[i][j], the value of the spreading function, - * centered at band j (masker), for band i (maskee) - * - * i.e.: sum over j to spread into signal barkval=i - * NOTE: i and j are used opposite as in the ISO docs - */ - for (i = 0; i < npart; i++) { - for (j = 0; j < npart; j++) { - FLOAT v = s3_func(bval[i] - bval[j]) * bval_width[j]; - s3[i][j] = v * norm[i]; - } - } - for (i = 0; i < npart; i++) { - for (j = 0; j < npart; j++) { - if (s3[i][j] > 0.0f) - break; - } - s3ind[i][0] = j; - - for (j = npart - 1; j > 0; j--) { - if (s3[i][j] > 0.0f) - break; - } - s3ind[i][1] = j; - numberOfNoneZero += (s3ind[i][1] - s3ind[i][0] + 1); - } - if (numberOfNoneZero == 0) - return 0; - *p = malloc(sizeof(FLOAT) * numberOfNoneZero); - if (!*p) - return -1; - - k = 0; - for (i = 0; i < npart; i++) - for (j = s3ind[i][0]; j <= s3ind[i][1]; j++) - (*p)[k++] = s3[i][j]; - while (k < numberOfNoneZero) - (*p)[k++] = 0; - - assert(npart <= numberOfNoneZero); - assert(k <= numberOfNoneZero); - return 0; -} - -int -psymodel_init(lame_global_flags const *gfp) -{ - lame_internal_flags *const gfc = gfp->internal_flags; - SessionConfig_t *const cfg = &gfc->cfg; - PsyStateVar_t *const psv = &gfc->sv_psy; - PsyConst_t *gd; - int i, j, b, sb, k; - FLOAT bvl_a = 13, bvl_b = 24; - FLOAT snr_l_a = 0, snr_l_b = 0; - FLOAT snr_s_a = -8.25, snr_s_b = -4.5; - - static FLOAT bval[CBANDS]; - static FLOAT bval_width[CBANDS]; - static FLOAT norm[CBANDS]; - FLOAT const sfreq = cfg->samplerate_out; - - FLOAT xav = 10, xbv = 12; - FLOAT const minval_low = (0.f - cfg->minval); - - if (gfc->cd_psy != 0) { - return 0; - } - memset(norm, 0, sizeof(norm)); - - gd = calloc(1, sizeof(PsyConst_t)); - gfc->cd_psy = gd; - - gd->force_short_block_calc = gfp->experimentalZ; - - psv->blocktype_old[0] = psv->blocktype_old[1] = NORM_TYPE; /* the vbr header is long blocks */ - - for (i = 0; i < 4; ++i) { - for (j = 0; j < CBANDS; ++j) { - psv->nb_l1[i][j] = 1e20; - psv->nb_l2[i][j] = 1e20; - psv->nb_s1[i][j] = psv->nb_s2[i][j] = 1.0; - } - for (sb = 0; sb < SBMAX_l; sb++) { - psv->en[i].l[sb] = 1e20; - psv->thm[i].l[sb] = 1e20; - } - for (j = 0; j < 3; ++j) { - for (sb = 0; sb < SBMAX_s; sb++) { - psv->en[i].s[sb][j] = 1e20; - psv->thm[i].s[sb][j] = 1e20; - } - psv->last_attacks[i] = 0; - } - for (j = 0; j < 9; j++) - psv->last_en_subshort[i][j] = 10.; - } - - - /* init. for loudness approx. -jd 2001 mar 27 */ - psv->loudness_sq_save[0] = psv->loudness_sq_save[1] = 0.0; - - - - /************************************************************************* - * now compute the psychoacoustic model specific constants - ************************************************************************/ - /* compute numlines, bo, bm, bval, bval_width, mld */ - init_numline(&gd->l, sfreq, BLKSIZE, 576, SBMAX_l, gfc->scalefac_band.l); - assert(gd->l.npart < CBANDS); - compute_bark_values(&gd->l, sfreq, BLKSIZE, bval, bval_width); - - /* compute the spreading function */ - for (i = 0; i < gd->l.npart; i++) { - double snr = snr_l_a; - if (bval[i] >= bvl_a) { - snr = snr_l_b * (bval[i] - bvl_a) / (bvl_b - bvl_a) - + snr_l_a * (bvl_b - bval[i]) / (bvl_b - bvl_a); - } - norm[i] = pow(10.0, snr / 10.0); - } - i = init_s3_values(&gd->l.s3, gd->l.s3ind, gd->l.npart, bval, bval_width, norm); - if (i) - return i; - - /* compute long block specific values, ATH and MINVAL */ - j = 0; - for (i = 0; i < gd->l.npart; i++) { - double x; - - /* ATH */ - x = FLOAT_MAX; - for (k = 0; k < gd->l.numlines[i]; k++, j++) { - FLOAT const freq = sfreq * j / (1000.0 * BLKSIZE); - FLOAT level; - /* freq = Min(.1,freq); *//* ATH below 100 Hz constant, not further climbing */ - level = ATHformula(cfg, freq * 1000) - 20; /* scale to FFT units; returned value is in dB */ - level = pow(10., 0.1 * level); /* convert from dB -> energy */ - level *= gd->l.numlines[i]; - if (x > level) - x = level; - } - gfc->ATH->cb_l[i] = x; - - /* MINVAL. - For low freq, the strength of the masking is limited by minval - this is an ISO MPEG1 thing, dont know if it is really needed */ - /* FIXME: it does work to reduce low-freq problems in S53-Wind-Sax - and lead-voice samples, but introduces some 3 kbps bit bloat too. - TODO: Further refinement of the shape of this hack. - */ - x = 20.0 * (bval[i] / xav - 1.0); - if (x > 6) { - x = 30; - } - if (x < minval_low) { - x = minval_low; - } - if (cfg->samplerate_out < 44000) { - x = 30; - } - x -= 8.; - gd->l.minval[i] = pow(10.0, x / 10.) * gd->l.numlines[i]; - } - - /************************************************************************ - * do the same things for short blocks - ************************************************************************/ - init_numline(&gd->s, sfreq, BLKSIZE_s, 192, SBMAX_s, gfc->scalefac_band.s); - assert(gd->s.npart < CBANDS); - compute_bark_values(&gd->s, sfreq, BLKSIZE_s, bval, bval_width); - - /* SNR formula. short block is normalized by SNR. is it still right ? */ - j = 0; - for (i = 0; i < gd->s.npart; i++) { - double x; - double snr = snr_s_a; - if (bval[i] >= bvl_a) { - snr = snr_s_b * (bval[i] - bvl_a) / (bvl_b - bvl_a) - + snr_s_a * (bvl_b - bval[i]) / (bvl_b - bvl_a); - } - norm[i] = pow(10.0, snr / 10.0); - - /* ATH */ - x = FLOAT_MAX; - for (k = 0; k < gd->s.numlines[i]; k++, j++) { - FLOAT const freq = sfreq * j / (1000.0 * BLKSIZE_s); - FLOAT level; - /* freq = Min(.1,freq); *//* ATH below 100 Hz constant, not further climbing */ - level = ATHformula(cfg, freq * 1000) - 20; /* scale to FFT units; returned value is in dB */ - level = pow(10., 0.1 * level); /* convert from dB -> energy */ - level *= gd->s.numlines[i]; - if (x > level) - x = level; - } - gfc->ATH->cb_s[i] = x; - - /* MINVAL. - For low freq, the strength of the masking is limited by minval - this is an ISO MPEG1 thing, dont know if it is really needed */ - x = 7.0 * (bval[i] / xbv - 1.0); - if (bval[i] > xbv) { - x *= 1 + log(1 + x) * 3.1; - } - if (bval[i] < xbv) { - x *= 1 + log(1 - x) * 2.3; - } - if (x > 6) { - x = 30; - } - if (x < minval_low) { - x = minval_low; - } - if (cfg->samplerate_out < 44000) { - x = 30; - } - x -= 8; - gd->s.minval[i] = pow(10.0, x / 10) * gd->s.numlines[i]; - } - - i = init_s3_values(&gd->s.s3, gd->s.s3ind, gd->s.npart, bval, bval_width, norm); - if (i) - return i; - - - init_mask_add_max_values(); - init_fft(gfc); - - /* setup temporal masking */ - gd->decay = exp(-1.0 * LOG10 / (temporalmask_sustain_sec * sfreq / 192.0)); - - { - FLOAT msfix; - msfix = NS_MSFIX; - if (cfg->use_safe_joint_stereo) - msfix = 1.0; - if (fabs(cfg->msfix) > 0.0) - msfix = cfg->msfix; - cfg->msfix = msfix; - - /* spread only from npart_l bands. Normally, we use the spreading - * function to convolve from npart_l down to npart_l bands - */ - for (b = 0; b < gd->l.npart; b++) - if (gd->l.s3ind[b][1] > gd->l.npart - 1) - gd->l.s3ind[b][1] = gd->l.npart - 1; - } - - /* prepare for ATH auto adjustment: - * we want to decrease the ATH by 12 dB per second - */ -#define frame_duration (576. * cfg->mode_gr / sfreq) - gfc->ATH->decay = pow(10., -12. / 10. * frame_duration); - gfc->ATH->adjust_factor = 0.01; /* minimum, for leading low loudness */ - gfc->ATH->adjust_limit = 1.0; /* on lead, allow adjust up to maximum */ -#undef frame_duration - - assert(gd->l.bo[SBMAX_l - 1] <= gd->l.npart); - assert(gd->s.bo[SBMAX_s - 1] <= gd->s.npart); - - if (cfg->ATHtype != -1) { - /* compute equal loudness weights (eql_w) */ - FLOAT freq; - FLOAT const freq_inc = (FLOAT) cfg->samplerate_out / (FLOAT) (BLKSIZE); - FLOAT eql_balance = 0.0; - freq = 0.0; - for (i = 0; i < BLKSIZE / 2; ++i) { - /* convert ATH dB to relative power (not dB) */ - /* to determine eql_w */ - freq += freq_inc; - gfc->ATH->eql_w[i] = 1. / pow(10, ATHformula(cfg, freq) / 10); - eql_balance += gfc->ATH->eql_w[i]; - } - eql_balance = 1.0 / eql_balance; - for (i = BLKSIZE / 2; --i >= 0;) { /* scale weights */ - gfc->ATH->eql_w[i] *= eql_balance; - } - } - { - for (b = j = 0; b < gd->s.npart; ++b) { - for (i = 0; i < gd->s.numlines[b]; ++i) { - ++j; - } - } - assert(j == 129); - for (b = j = 0; b < gd->l.npart; ++b) { - for (i = 0; i < gd->l.numlines[b]; ++i) { - ++j; - } - } - assert(j == 513); - } - /* short block attack threshold */ - { - float x = gfp->attackthre; - float y = gfp->attackthre_s; - if (x < 0) { - x = NSATTACKTHRE; - } - if (y < 0) { - y = NSATTACKTHRE_S; - } - gd->attack_threshold[0] = gd->attack_threshold[1] = gd->attack_threshold[2] = x; - gd->attack_threshold[3] = y; - } - { - float sk_s = -10.f, sk_l = -4.7f; - static float const sk[] = - { -7.4, -7.4, -7.4, -9.5, -7.4, -6.1, -5.5, -4.7, -4.7, -4.7, -4.7 }; - if (gfp->VBR_q < 4) { - sk_l = sk_s = sk[0]; - } - else { - sk_l = sk_s = sk[gfp->VBR_q] + gfp->VBR_q_frac * (sk[gfp->VBR_q] - sk[gfp->VBR_q + 1]); - } - b = 0; - for (; b < gd->s.npart; b++) { - float m = (float) (gd->s.npart - b) / gd->s.npart; - gd->s.masking_lower[b] = powf(10.f, sk_s * m * 0.1f); - } - for (; b < CBANDS; ++b) { - gd->s.masking_lower[b] = 1.f; - } - b = 0; - for (; b < gd->l.npart; b++) { - float m = (float) (gd->l.npart - b) / gd->l.npart; - gd->l.masking_lower[b] = powf(10.f, sk_l * m * 0.1f); - } - for (; b < CBANDS; ++b) { - gd->l.masking_lower[b] = 1.f; - } - } - memcpy(&gd->l_to_s, &gd->l, sizeof(gd->l_to_s)); - init_numline(&gd->l_to_s, sfreq, BLKSIZE, 192, SBMAX_s, gfc->scalefac_band.s); - return 0; -} diff --git a/src/lib/dl/ext/lame/psymodel.h b/src/lib/dl/ext/lame/psymodel.h deleted file mode 100755 index f46083cd..00000000 --- a/src/lib/dl/ext/lame/psymodel.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * psymodel.h - * - * Copyright (c) 1999 Mark Taylor - * - * 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_PSYMODEL_H -#define LAME_PSYMODEL_H - - -int L3psycho_anal_ns(lame_internal_flags * gfc, - const sample_t *const buffer[2], int gr, - III_psy_ratio ratio[2][2], - III_psy_ratio MS_ratio[2][2], - FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]); - -int L3psycho_anal_vbr(lame_internal_flags * gfc, - const sample_t *const buffer[2], int gr, - III_psy_ratio ratio[2][2], - III_psy_ratio MS_ratio[2][2], - FLOAT pe[2], FLOAT pe_MS[2], FLOAT ener[2], int blocktype_d[2]); - - -int psymodel_init(lame_global_flags const* gfp); - - -#define rpelev 2 -#define rpelev2 16 -#define rpelev_s 2 -#define rpelev2_s 16 - -/* size of each partition band, in barks: */ -#define DELBARK .34 - - -/* tuned for output level (sensitive to energy scale) */ -#define VO_SCALE (1./( 14752*14752 )/(BLKSIZE/2)) - -#define temporalmask_sustain_sec 0.01 - -#define NS_PREECHO_ATT0 0.8 -#define NS_PREECHO_ATT1 0.6 -#define NS_PREECHO_ATT2 0.3 - -#define NS_MSFIX 3.5 -#define NSATTACKTHRE 4.4 -#define NSATTACKTHRE_S 25 - -#endif /* LAME_PSYMODEL_H */ diff --git a/src/lib/dl/ext/lame/quantize.c b/src/lib/dl/ext/lame/quantize.c deleted file mode 100755 index 9abe5584..00000000 --- a/src/lib/dl/ext/lame/quantize.c +++ /dev/null @@ -1,2035 +0,0 @@ -/* - * MP3 quantization - * - * Copyright (c) 1999-2000 Mark Taylor - * Copyright (c) 1999-2003 Takehiro Tominaga - * Copyright (c) 2000-2011 Robert Hegemann - * Copyright (c) 2001-2005 Gabriel Bouvigne - * - * 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. - */ - -/* $Id: quantize.c,v 1.216 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "quantize_pvt.h" -#include "reservoir.h" -#include "bitstream.h" -#include "vbrquantize.h" -#include "quantize.h" -#ifdef HAVE_XMMINTRIN_H -#include "vector/lame_intrin.h" -#endif - - - - -/* convert from L/R <-> Mid/Side */ -static void -ms_convert(III_side_info_t * l3_side, int gr) -{ - int i; - for (i = 0; i < 576; ++i) { - FLOAT l, r; - l = l3_side->tt[gr][0].xr[i]; - r = l3_side->tt[gr][1].xr[i]; - l3_side->tt[gr][0].xr[i] = (l + r) * (FLOAT) (SQRT2 * 0.5); - l3_side->tt[gr][1].xr[i] = (l - r) * (FLOAT) (SQRT2 * 0.5); - } -} - -/************************************************************************ - * - * init_outer_loop() - * mt 6/99 - * - * initializes cod_info, scalefac and xrpow - * - * returns 0 if all energies in xr are zero, else 1 - * - ************************************************************************/ - -static void -init_xrpow_core_c(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum) -{ - int i; - FLOAT tmp; - *sum = 0; - for (i = 0; i <= upper; ++i) { - tmp = fabs(cod_info->xr[i]); - *sum += tmp; - xrpow[i] = sqrt(tmp * sqrt(tmp)); - - if (xrpow[i] > cod_info->xrpow_max) - cod_info->xrpow_max = xrpow[i]; - } -} - - - - - -void -init_xrpow_core_init(lame_internal_flags * const gfc) -{ - gfc->init_xrpow_core = init_xrpow_core_c; - -#if defined(HAVE_XMMINTRIN_H) - if (gfc->CPU_features.SSE) - gfc->init_xrpow_core = init_xrpow_core_sse; -#endif -#ifndef HAVE_NASM -#ifdef MIN_ARCH_SSE - gfc->init_xrpow_core = init_xrpow_core_sse; -#endif -#endif -} - - - -static int -init_xrpow(lame_internal_flags * gfc, gr_info * const cod_info, FLOAT xrpow[576]) -{ - FLOAT sum = 0; - int i; - int const upper = cod_info->max_nonzero_coeff; - - assert(xrpow != NULL); - cod_info->xrpow_max = 0; - - /* check if there is some energy we have to quantize - * and calculate xrpow matching our fresh scalefactors - */ - assert(0 <= upper && upper <= 575); - memset(&(xrpow[upper]), 0, (576 - upper) * sizeof(xrpow[0])); - - - gfc->init_xrpow_core(cod_info, xrpow, upper, &sum); - - /* return 1 if we have something to quantize, else 0 - */ - if (sum > (FLOAT) 1E-20) { - int j = 0; - if (gfc->sv_qnt.substep_shaping & 2) - j = 1; - - for (i = 0; i < cod_info->psymax; i++) - gfc->sv_qnt.pseudohalf[i] = j; - - return 1; - } - - memset(&cod_info->l3_enc[0], 0, sizeof(int) * 576); - return 0; -} - - - - - -/* -Gabriel Bouvigne feb/apr 2003 -Analog silence detection in partitionned sfb21 -or sfb12 for short blocks - -From top to bottom of sfb, changes to 0 -coeffs which are below ath. It stops on the first -coeff higher than ath. -*/ -static void -psfb21_analogsilence(lame_internal_flags const *gfc, gr_info * const cod_info) -{ - ATH_t const *const ATH = gfc->ATH; - FLOAT *const xr = cod_info->xr; - - if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type, but not SHORT blocks */ - int gsfb; - int stop = 0; - for (gsfb = PSFB21 - 1; gsfb >= 0 && !stop; gsfb--) { - int const start = gfc->scalefac_band.psfb21[gsfb]; - int const end = gfc->scalefac_band.psfb21[gsfb + 1]; - int j; - FLOAT ath21; - ath21 = athAdjust(ATH->adjust_factor, ATH->psfb21[gsfb], ATH->floor, 0); - - if (gfc->sv_qnt.longfact[21] > 1e-12f) - ath21 *= gfc->sv_qnt.longfact[21]; - - for (j = end - 1; j >= start; j--) { - if (fabs(xr[j]) < ath21) - xr[j] = 0; - else { - stop = 1; - break; - } - } - } - } - else { - /*note: short blocks coeffs are reordered */ - int block; - for (block = 0; block < 3; block++) { - - int gsfb; - int stop = 0; - for (gsfb = PSFB12 - 1; gsfb >= 0 && !stop; gsfb--) { - int const start = gfc->scalefac_band.s[12] * 3 + - (gfc->scalefac_band.s[13] - gfc->scalefac_band.s[12]) * block + - (gfc->scalefac_band.psfb12[gsfb] - gfc->scalefac_band.psfb12[0]); - int const end = - start + (gfc->scalefac_band.psfb12[gsfb + 1] - gfc->scalefac_band.psfb12[gsfb]); - int j; - FLOAT ath12; - ath12 = athAdjust(ATH->adjust_factor, ATH->psfb12[gsfb], ATH->floor, 0); - - if (gfc->sv_qnt.shortfact[12] > 1e-12f) - ath12 *= gfc->sv_qnt.shortfact[12]; - - for (j = end - 1; j >= start; j--) { - if (fabs(xr[j]) < ath12) - xr[j] = 0; - else { - stop = 1; - break; - } - } - } - } - } - -} - - - - - -static void -init_outer_loop(lame_internal_flags const *gfc, gr_info * const cod_info) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int sfb, j; - /* initialize fresh cod_info - */ - cod_info->part2_3_length = 0; - cod_info->big_values = 0; - cod_info->count1 = 0; - cod_info->global_gain = 210; - cod_info->scalefac_compress = 0; - /* mixed_block_flag, block_type was set in psymodel.c */ - cod_info->table_select[0] = 0; - cod_info->table_select[1] = 0; - cod_info->table_select[2] = 0; - cod_info->subblock_gain[0] = 0; - cod_info->subblock_gain[1] = 0; - cod_info->subblock_gain[2] = 0; - cod_info->subblock_gain[3] = 0; /* this one is always 0 */ - cod_info->region0_count = 0; - cod_info->region1_count = 0; - cod_info->preflag = 0; - cod_info->scalefac_scale = 0; - cod_info->count1table_select = 0; - cod_info->part2_length = 0; - cod_info->sfb_lmax = SBPSY_l; - cod_info->sfb_smin = SBPSY_s; - cod_info->psy_lmax = gfc->sv_qnt.sfb21_extra ? SBMAX_l : SBPSY_l; - cod_info->psymax = cod_info->psy_lmax; - cod_info->sfbmax = cod_info->sfb_lmax; - cod_info->sfbdivide = 11; - for (sfb = 0; sfb < SBMAX_l; sfb++) { - cod_info->width[sfb] - = gfc->scalefac_band.l[sfb + 1] - gfc->scalefac_band.l[sfb]; - cod_info->window[sfb] = 3; /* which is always 0. */ - } - if (cod_info->block_type == SHORT_TYPE) { - FLOAT ixwork[576]; - FLOAT *ix; - - cod_info->sfb_smin = 0; - cod_info->sfb_lmax = 0; - if (cod_info->mixed_block_flag) { - /* - * MPEG-1: sfbs 0-7 long block, 3-12 short blocks - * MPEG-2(.5): sfbs 0-5 long block, 3-12 short blocks - */ - cod_info->sfb_smin = 3; - cod_info->sfb_lmax = cfg->mode_gr * 2 + 4; - } - cod_info->psymax - = cod_info->sfb_lmax - + 3 * ((gfc->sv_qnt.sfb21_extra ? SBMAX_s : SBPSY_s) - cod_info->sfb_smin); - cod_info->sfbmax = cod_info->sfb_lmax + 3 * (SBPSY_s - cod_info->sfb_smin); - cod_info->sfbdivide = cod_info->sfbmax - 18; - cod_info->psy_lmax = cod_info->sfb_lmax; - /* re-order the short blocks, for more efficient encoding below */ - /* By Takehiro TOMINAGA */ - /* - Within each scalefactor band, data is given for successive - time windows, beginning with window 0 and ending with window 2. - Within each window, the quantized values are then arranged in - order of increasing frequency... - */ - ix = &cod_info->xr[gfc->scalefac_band.l[cod_info->sfb_lmax]]; - memcpy(ixwork, cod_info->xr, 576 * sizeof(FLOAT)); - for (sfb = cod_info->sfb_smin; sfb < SBMAX_s; sfb++) { - int const start = gfc->scalefac_band.s[sfb]; - int const end = gfc->scalefac_band.s[sfb + 1]; - int window, l; - for (window = 0; window < 3; window++) { - for (l = start; l < end; l++) { - *ix++ = ixwork[3 * l + window]; - } - } - } - - j = cod_info->sfb_lmax; - for (sfb = cod_info->sfb_smin; sfb < SBMAX_s; sfb++) { - cod_info->width[j] = cod_info->width[j + 1] = cod_info->width[j + 2] - = gfc->scalefac_band.s[sfb + 1] - gfc->scalefac_band.s[sfb]; - cod_info->window[j] = 0; - cod_info->window[j + 1] = 1; - cod_info->window[j + 2] = 2; - j += 3; - } - } - - cod_info->count1bits = 0; - cod_info->sfb_partition_table = nr_of_sfb_block[0][0]; - cod_info->slen[0] = 0; - cod_info->slen[1] = 0; - cod_info->slen[2] = 0; - cod_info->slen[3] = 0; - - cod_info->max_nonzero_coeff = 575; - - /* fresh scalefactors are all zero - */ - memset(cod_info->scalefac, 0, sizeof(cod_info->scalefac)); - - if (cfg->vbr != vbr_mt && cfg->vbr != vbr_mtrh && cfg->vbr != vbr_abr && cfg->vbr != vbr_off) { - psfb21_analogsilence(gfc, cod_info); - } -} - - - -/************************************************************************ - * - * bin_search_StepSize() - * - * author/date?? - * - * binary step size search - * used by outer_loop to get a quantizer step size to start with - * - ************************************************************************/ - -typedef enum { - BINSEARCH_NONE, - BINSEARCH_UP, - BINSEARCH_DOWN -} binsearchDirection_t; - -static int -bin_search_StepSize(lame_internal_flags * const gfc, gr_info * const cod_info, - int desired_rate, const int ch, const FLOAT xrpow[576]) -{ - int nBits; - int CurrentStep = gfc->sv_qnt.CurrentStep[ch]; - int flag_GoneOver = 0; - int const start = gfc->sv_qnt.OldValue[ch]; - binsearchDirection_t Direction = BINSEARCH_NONE; - cod_info->global_gain = start; - desired_rate -= cod_info->part2_length; - - assert(CurrentStep); - for (;;) { - int step; - nBits = count_bits(gfc, xrpow, cod_info, 0); - - if (CurrentStep == 1 || nBits == desired_rate) - break; /* nothing to adjust anymore */ - - if (nBits > desired_rate) { - /* increase Quantize_StepSize */ - if (Direction == BINSEARCH_DOWN) - flag_GoneOver = 1; - - if (flag_GoneOver) - CurrentStep /= 2; - Direction = BINSEARCH_UP; - step = CurrentStep; - } - else { - /* decrease Quantize_StepSize */ - if (Direction == BINSEARCH_UP) - flag_GoneOver = 1; - - if (flag_GoneOver) - CurrentStep /= 2; - Direction = BINSEARCH_DOWN; - step = -CurrentStep; - } - cod_info->global_gain += step; - if (cod_info->global_gain < 0) { - cod_info->global_gain = 0; - flag_GoneOver = 1; - } - if (cod_info->global_gain > 255) { - cod_info->global_gain = 255; - flag_GoneOver = 1; - } - } - - assert(cod_info->global_gain >= 0); - assert(cod_info->global_gain < 256); - - while (nBits > desired_rate && cod_info->global_gain < 255) { - cod_info->global_gain++; - nBits = count_bits(gfc, xrpow, cod_info, 0); - } - gfc->sv_qnt.CurrentStep[ch] = (start - cod_info->global_gain >= 4) ? 4 : 2; - gfc->sv_qnt.OldValue[ch] = cod_info->global_gain; - cod_info->part2_3_length = nBits; - return nBits; -} - - - - -/************************************************************************ - * - * trancate_smallspectrums() - * - * Takehiro TOMINAGA 2002-07-21 - * - * trancate smaller nubmers into 0 as long as the noise threshold is allowed. - * - ************************************************************************/ -static int -floatcompare(const void *v1, const void *v2) -{ - const FLOAT *const a = v1, *const b = v2; - if (*a > *b) - return 1; - if (*a < *b) - return -1; - return 0; -} - -static void -trancate_smallspectrums(lame_internal_flags const *gfc, - gr_info * const gi, const FLOAT * const l3_xmin, FLOAT * const work) -{ - int sfb, j, width; - FLOAT distort[SFBMAX]; - calc_noise_result dummy; - - if ((!(gfc->sv_qnt.substep_shaping & 4) && gi->block_type == SHORT_TYPE) - || gfc->sv_qnt.substep_shaping & 0x80) - return; - (void) calc_noise(gi, l3_xmin, distort, &dummy, 0); - for (j = 0; j < 576; j++) { - FLOAT xr = 0.0; - if (gi->l3_enc[j] != 0) - xr = fabs(gi->xr[j]); - work[j] = xr; - } - - j = 0; - sfb = 8; - if (gi->block_type == SHORT_TYPE) - sfb = 6; - do { - FLOAT allowedNoise, trancateThreshold; - int nsame, start; - - width = gi->width[sfb]; - j += width; - if (distort[sfb] >= 1.0) - continue; - - qsort(&work[j - width], width, sizeof(FLOAT), floatcompare); - if (EQ(work[j - 1], 0.0)) - continue; /* all zero sfb */ - - allowedNoise = (1.0 - distort[sfb]) * l3_xmin[sfb]; - trancateThreshold = 0.0; - start = 0; - do { - FLOAT noise; - for (nsame = 1; start + nsame < width; nsame++) - if (NEQ(work[start + j - width], work[start + j + nsame - width])) - break; - - noise = work[start + j - width] * work[start + j - width] * nsame; - if (allowedNoise < noise) { - if (start != 0) - trancateThreshold = work[start + j - width - 1]; - break; - } - allowedNoise -= noise; - start += nsame; - } while (start < width); - if (EQ(trancateThreshold, 0.0)) - continue; - -/* printf("%e %e %e\n", */ -/* trancateThreshold/l3_xmin[sfb], */ -/* trancateThreshold/(l3_xmin[sfb]*start), */ -/* trancateThreshold/(l3_xmin[sfb]*(start+width)) */ -/* ); */ -/* if (trancateThreshold > 1000*l3_xmin[sfb]*start) */ -/* trancateThreshold = 1000*l3_xmin[sfb]*start; */ - - do { - if (fabs(gi->xr[j - width]) <= trancateThreshold) - gi->l3_enc[j - width] = 0; - } while (--width > 0); - } while (++sfb < gi->psymax); - - gi->part2_3_length = noquant_count_bits(gfc, gi, 0); -} - - -/************************************************************************* - * - * loop_break() - * - * author/date?? - * - * Function: Returns zero if there is a scalefac which has not been - * amplified. Otherwise it returns one. - * - *************************************************************************/ - -inline static int -loop_break(const gr_info * const cod_info) -{ - int sfb; - - for (sfb = 0; sfb < cod_info->sfbmax; sfb++) - if (cod_info->scalefac[sfb] - + cod_info->subblock_gain[cod_info->window[sfb]] == 0) - return 0; - - return 1; -} - - - - -/* mt 5/99: Function: Improved calc_noise for a single channel */ - -/************************************************************************* - * - * quant_compare() - * - * author/date?? - * - * several different codes to decide which quantization is better - * - *************************************************************************/ - -static double -penalties(double noise) -{ - return FAST_LOG10(0.368 + 0.632 * noise * noise * noise); -} - -static double -get_klemm_noise(const FLOAT * distort, const gr_info * const gi) -{ - int sfb; - double klemm_noise = 1E-37; - for (sfb = 0; sfb < gi->psymax; sfb++) - klemm_noise += penalties(distort[sfb]); - - return Max(1e-20, klemm_noise); -} - -inline static int -quant_compare(const int quant_comp, - const calc_noise_result * const best, - calc_noise_result * const calc, const gr_info * const gi, const FLOAT * distort) -{ - /* - noise is given in decibels (dB) relative to masking thesholds. - - over_noise: ??? (the previous comment is fully wrong) - tot_noise: ??? (the previous comment is fully wrong) - max_noise: max quantization noise - - */ - int better; - - switch (quant_comp) { - default: - case 9:{ - if (best->over_count > 0) { - /* there are distorted sfb */ - better = calc->over_SSD <= best->over_SSD; - if (calc->over_SSD == best->over_SSD) - better = calc->bits < best->bits; - } - else { - /* no distorted sfb */ - better = ((calc->max_noise < 0) && - ((calc->max_noise * 10 + calc->bits) <= - (best->max_noise * 10 + best->bits))); - } - break; - } - - case 0: - better = calc->over_count < best->over_count - || (calc->over_count == best->over_count && calc->over_noise < best->over_noise) - || (calc->over_count == best->over_count && - EQ(calc->over_noise, best->over_noise) && calc->tot_noise < best->tot_noise); - break; - - case 8: - calc->max_noise = get_klemm_noise(distort, gi); - /*lint --fallthrough */ - case 1: - better = calc->max_noise < best->max_noise; - break; - case 2: - better = calc->tot_noise < best->tot_noise; - break; - case 3: - better = (calc->tot_noise < best->tot_noise) - && (calc->max_noise < best->max_noise); - break; - case 4: - better = (calc->max_noise <= 0.0 && best->max_noise > 0.2) - || (calc->max_noise <= 0.0 && - best->max_noise < 0.0 && - best->max_noise > calc->max_noise - 0.2 && calc->tot_noise < best->tot_noise) - || (calc->max_noise <= 0.0 && - best->max_noise > 0.0 && - best->max_noise > calc->max_noise - 0.2 && - calc->tot_noise < best->tot_noise + best->over_noise) - || (calc->max_noise > 0.0 && - best->max_noise > -0.05 && - best->max_noise > calc->max_noise - 0.1 && - calc->tot_noise + calc->over_noise < best->tot_noise + best->over_noise) - || (calc->max_noise > 0.0 && - best->max_noise > -0.1 && - best->max_noise > calc->max_noise - 0.15 && - calc->tot_noise + calc->over_noise + calc->over_noise < - best->tot_noise + best->over_noise + best->over_noise); - break; - case 5: - better = calc->over_noise < best->over_noise - || (EQ(calc->over_noise, best->over_noise) && calc->tot_noise < best->tot_noise); - break; - case 6: - better = calc->over_noise < best->over_noise - || (EQ(calc->over_noise, best->over_noise) && - (calc->max_noise < best->max_noise - || (EQ(calc->max_noise, best->max_noise) && calc->tot_noise <= best->tot_noise) - )); - break; - case 7: - better = calc->over_count < best->over_count || calc->over_noise < best->over_noise; - break; - } - - - if (best->over_count == 0) { - /* - If no distorted bands, only use this quantization - if it is better, and if it uses less bits. - Unfortunately, part2_3_length is sometimes a poor - estimator of the final size at low bitrates. - */ - better = better && calc->bits < best->bits; - } - - - return better; -} - - - -/************************************************************************* - * - * amp_scalefac_bands() - * - * author/date?? - * - * Amplify the scalefactor bands that violate the masking threshold. - * See ISO 11172-3 Section C.1.5.4.3.5 - * - * distort[] = noise/masking - * distort[] > 1 ==> noise is not masked - * distort[] < 1 ==> noise is masked - * max_dist = maximum value of distort[] - * - * Three algorithms: - * noise_shaping_amp - * 0 Amplify all bands with distort[]>1. - * - * 1 Amplify all bands with distort[] >= max_dist^(.5); - * ( 50% in the db scale) - * - * 2 Amplify first band with distort[] >= max_dist; - * - * - * For algorithms 0 and 1, if max_dist < 1, then amplify all bands - * with distort[] >= .95*max_dist. This is to make sure we always - * amplify at least one band. - * - * - *************************************************************************/ -static void -amp_scalefac_bands(lame_internal_flags * gfc, - gr_info * const cod_info, FLOAT const *distort, FLOAT xrpow[576], int bRefine) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int j, sfb; - FLOAT ifqstep34, trigger; - int noise_shaping_amp; - - if (cod_info->scalefac_scale == 0) { - ifqstep34 = 1.29683955465100964055; /* 2**(.75*.5) */ - } - else { - ifqstep34 = 1.68179283050742922612; /* 2**(.75*1) */ - } - - /* compute maximum value of distort[] */ - trigger = 0; - for (sfb = 0; sfb < cod_info->sfbmax; sfb++) { - if (trigger < distort[sfb]) - trigger = distort[sfb]; - } - - noise_shaping_amp = cfg->noise_shaping_amp; - if (noise_shaping_amp == 3) { - if (bRefine == 1) - noise_shaping_amp = 2; - else - noise_shaping_amp = 1; - } - switch (noise_shaping_amp) { - case 2: - /* amplify exactly 1 band */ - break; - - case 1: - /* amplify bands within 50% of max (on db scale) */ - if (trigger > 1.0) - trigger = pow(trigger, .5); - else - trigger *= .95; - break; - - case 0: - default: - /* ISO algorithm. amplify all bands with distort>1 */ - if (trigger > 1.0) - trigger = 1.0; - else - trigger *= .95; - break; - } - - j = 0; - for (sfb = 0; sfb < cod_info->sfbmax; sfb++) { - int const width = cod_info->width[sfb]; - int l; - j += width; - if (distort[sfb] < trigger) - continue; - - if (gfc->sv_qnt.substep_shaping & 2) { - gfc->sv_qnt.pseudohalf[sfb] = !gfc->sv_qnt.pseudohalf[sfb]; - if (!gfc->sv_qnt.pseudohalf[sfb] && cfg->noise_shaping_amp == 2) - return; - } - cod_info->scalefac[sfb]++; - for (l = -width; l < 0; l++) { - xrpow[j + l] *= ifqstep34; - if (xrpow[j + l] > cod_info->xrpow_max) - cod_info->xrpow_max = xrpow[j + l]; - } - - if (cfg->noise_shaping_amp == 2) - return; - } -} - -/************************************************************************* - * - * inc_scalefac_scale() - * - * Takehiro Tominaga 2000-xx-xx - * - * turns on scalefac scale and adjusts scalefactors - * - *************************************************************************/ - -static void -inc_scalefac_scale(gr_info * const cod_info, FLOAT xrpow[576]) -{ - int l, j, sfb; - const FLOAT ifqstep34 = 1.29683955465100964055; - - j = 0; - for (sfb = 0; sfb < cod_info->sfbmax; sfb++) { - int const width = cod_info->width[sfb]; - int s = cod_info->scalefac[sfb]; - if (cod_info->preflag) - s += pretab[sfb]; - j += width; - if (s & 1) { - s++; - for (l = -width; l < 0; l++) { - xrpow[j + l] *= ifqstep34; - if (xrpow[j + l] > cod_info->xrpow_max) - cod_info->xrpow_max = xrpow[j + l]; - } - } - cod_info->scalefac[sfb] = s >> 1; - } - cod_info->preflag = 0; - cod_info->scalefac_scale = 1; -} - - - -/************************************************************************* - * - * inc_subblock_gain() - * - * Takehiro Tominaga 2000-xx-xx - * - * increases the subblock gain and adjusts scalefactors - * - *************************************************************************/ - -static int -inc_subblock_gain(const lame_internal_flags * const gfc, gr_info * const cod_info, FLOAT xrpow[576]) -{ - int sfb, window; - int *const scalefac = cod_info->scalefac; - - /* subbloc_gain can't do anything in the long block region */ - for (sfb = 0; sfb < cod_info->sfb_lmax; sfb++) { - if (scalefac[sfb] >= 16) - return 1; - } - - for (window = 0; window < 3; window++) { - int s1, s2, l, j; - s1 = s2 = 0; - - for (sfb = cod_info->sfb_lmax + window; sfb < cod_info->sfbdivide; sfb += 3) { - if (s1 < scalefac[sfb]) - s1 = scalefac[sfb]; - } - for (; sfb < cod_info->sfbmax; sfb += 3) { - if (s2 < scalefac[sfb]) - s2 = scalefac[sfb]; - } - - if (s1 < 16 && s2 < 8) - continue; - - if (cod_info->subblock_gain[window] >= 7) - return 1; - - /* even though there is no scalefactor for sfb12 - * subblock gain affects upper frequencies too, that's why - * we have to go up to SBMAX_s - */ - cod_info->subblock_gain[window]++; - j = gfc->scalefac_band.l[cod_info->sfb_lmax]; - for (sfb = cod_info->sfb_lmax + window; sfb < cod_info->sfbmax; sfb += 3) { - FLOAT amp; - int const width = cod_info->width[sfb]; - int s = scalefac[sfb]; - assert(s >= 0); - s = s - (4 >> cod_info->scalefac_scale); - if (s >= 0) { - scalefac[sfb] = s; - j += width * 3; - continue; - } - - scalefac[sfb] = 0; - { - int const gain = 210 + (s << (cod_info->scalefac_scale + 1)); - amp = IPOW20(gain); - } - j += width * (window + 1); - for (l = -width; l < 0; l++) { - xrpow[j + l] *= amp; - if (xrpow[j + l] > cod_info->xrpow_max) - cod_info->xrpow_max = xrpow[j + l]; - } - j += width * (3 - window - 1); - } - - { - FLOAT const amp = IPOW20(202); - j += cod_info->width[sfb] * (window + 1); - for (l = -cod_info->width[sfb]; l < 0; l++) { - xrpow[j + l] *= amp; - if (xrpow[j + l] > cod_info->xrpow_max) - cod_info->xrpow_max = xrpow[j + l]; - } - } - } - return 0; -} - - - -/******************************************************************** - * - * balance_noise() - * - * Takehiro Tominaga /date?? - * Robert Hegemann 2000-09-06: made a function of it - * - * amplifies scalefactor bands, - * - if all are already amplified returns 0 - * - if some bands are amplified too much: - * * try to increase scalefac_scale - * * if already scalefac_scale was set - * try on short blocks to increase subblock gain - * - ********************************************************************/ -inline static int -balance_noise(lame_internal_flags * gfc, - gr_info * const cod_info, FLOAT const *distort, FLOAT xrpow[576], int bRefine) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int status; - - amp_scalefac_bands(gfc, cod_info, distort, xrpow, bRefine); - - /* check to make sure we have not amplified too much - * loop_break returns 0 if there is an unamplified scalefac - * scale_bitcount returns 0 if no scalefactors are too large - */ - - status = loop_break(cod_info); - - if (status) - return 0; /* all bands amplified */ - - /* not all scalefactors have been amplified. so these - * scalefacs are possibly valid. encode them: - */ - status = scale_bitcount(gfc, cod_info); - - if (!status) - return 1; /* amplified some bands not exceeding limits */ - - /* some scalefactors are too large. - * lets try setting scalefac_scale=1 - */ - if (cfg->noise_shaping > 1) { - memset(&gfc->sv_qnt.pseudohalf[0], 0, sizeof(gfc->sv_qnt.pseudohalf)); - if (!cod_info->scalefac_scale) { - inc_scalefac_scale(cod_info, xrpow); - status = 0; - } - else { - if (cod_info->block_type == SHORT_TYPE && cfg->subblock_gain > 0) { - status = inc_subblock_gain(gfc, cod_info, xrpow) - || loop_break(cod_info); - } - } - } - - if (!status) { - status = scale_bitcount(gfc, cod_info); - } - return !status; -} - - - -/************************************************************************ - * - * outer_loop () - * - * Function: The outer iteration loop controls the masking conditions - * of all scalefactorbands. It computes the best scalefac and - * global gain. This module calls the inner iteration loop - * - * mt 5/99 completely rewritten to allow for bit reservoir control, - * mid/side channels with L/R or mid/side masking thresholds, - * and chooses best quantization instead of last quantization when - * no distortion free quantization can be found. - * - * added VBR support mt 5/99 - * - * some code shuffle rh 9/00 - ************************************************************************/ - -static int -outer_loop(lame_internal_flags * gfc, gr_info * const cod_info, const FLOAT * const l3_xmin, /* allowed distortion */ - FLOAT xrpow[576], /* coloured magnitudes of spectral */ - const int ch, const int targ_bits) -{ /* maximum allowed bits */ - SessionConfig_t const *const cfg = &gfc->cfg; - gr_info cod_info_w; - FLOAT save_xrpow[576]; - FLOAT distort[SFBMAX]; - calc_noise_result best_noise_info; - int huff_bits; - int better; - int age; - calc_noise_data prev_noise; - int best_part2_3_length = 9999999; - int bEndOfSearch = 0; - int bRefine = 0; - int best_ggain_pass1 = 0; - - (void) bin_search_StepSize(gfc, cod_info, targ_bits, ch, xrpow); - - if (!cfg->noise_shaping) - /* fast mode, no noise shaping, we are ready */ - return 100; /* default noise_info.over_count */ - - memset(&prev_noise, 0, sizeof(calc_noise_data)); - - - /* compute the distortion in this quantization */ - /* coefficients and thresholds both l/r (or both mid/side) */ - (void) calc_noise(cod_info, l3_xmin, distort, &best_noise_info, &prev_noise); - best_noise_info.bits = cod_info->part2_3_length; - - cod_info_w = *cod_info; - age = 0; - /* if (cfg->vbr == vbr_rh || cfg->vbr == vbr_mtrh) */ - memcpy(save_xrpow, xrpow, sizeof(FLOAT) * 576); - - while (!bEndOfSearch) { - /* BEGIN MAIN LOOP */ - do { - calc_noise_result noise_info; - int search_limit; - int maxggain = 255; - - /* When quantization with no distorted bands is found, - * allow up to X new unsuccesful tries in serial. This - * gives us more possibilities for different quant_compare modes. - * Much more than 3 makes not a big difference, it is only slower. - */ - - if (gfc->sv_qnt.substep_shaping & 2) { - search_limit = 20; - } - else { - search_limit = 3; - } - - - - /* Check if the last scalefactor band is distorted. - * in VBR mode we can't get rid of the distortion, so quit now - * and VBR mode will try again with more bits. - * (makes a 10% speed increase, the files I tested were - * binary identical, 2000/05/20 Robert Hegemann) - * distort[] > 1 means noise > allowed noise - */ - if (gfc->sv_qnt.sfb21_extra) { - if (distort[cod_info_w.sfbmax] > 1.0) - break; - if (cod_info_w.block_type == SHORT_TYPE - && (distort[cod_info_w.sfbmax + 1] > 1.0 - || distort[cod_info_w.sfbmax + 2] > 1.0)) - break; - } - - /* try a new scalefactor conbination on cod_info_w */ - if (balance_noise(gfc, &cod_info_w, distort, xrpow, bRefine) == 0) - break; - if (cod_info_w.scalefac_scale) - maxggain = 254; - - /* inner_loop starts with the initial quantization step computed above - * and slowly increases until the bits < huff_bits. - * Thus it is important not to start with too large of an inital - * quantization step. Too small is ok, but inner_loop will take longer - */ - huff_bits = targ_bits - cod_info_w.part2_length; - if (huff_bits <= 0) - break; - - /* increase quantizer stepsize until needed bits are below maximum - */ - while ((cod_info_w.part2_3_length - = count_bits(gfc, xrpow, &cod_info_w, &prev_noise)) > huff_bits - && cod_info_w.global_gain <= maxggain) - cod_info_w.global_gain++; - - if (cod_info_w.global_gain > maxggain) - break; - - if (best_noise_info.over_count == 0) { - - while ((cod_info_w.part2_3_length - = count_bits(gfc, xrpow, &cod_info_w, &prev_noise)) > best_part2_3_length - && cod_info_w.global_gain <= maxggain) - cod_info_w.global_gain++; - - if (cod_info_w.global_gain > maxggain) - break; - } - - /* compute the distortion in this quantization */ - (void) calc_noise(&cod_info_w, l3_xmin, distort, &noise_info, &prev_noise); - noise_info.bits = cod_info_w.part2_3_length; - - /* check if this quantization is better - * than our saved quantization */ - if (cod_info->block_type != SHORT_TYPE) /* NORM, START or STOP type */ - better = cfg->quant_comp; - else - better = cfg->quant_comp_short; - - - better = quant_compare(better, &best_noise_info, &noise_info, &cod_info_w, distort); - - - /* save data so we can restore this quantization later */ - if (better) { - best_part2_3_length = cod_info->part2_3_length; - best_noise_info = noise_info; - *cod_info = cod_info_w; - age = 0; - /* save data so we can restore this quantization later */ - /*if (cfg->vbr == vbr_rh || cfg->vbr == vbr_mtrh) */ { - /* store for later reuse */ - memcpy(save_xrpow, xrpow, sizeof(FLOAT) * 576); - } - } - else { - /* early stop? */ - if (cfg->full_outer_loop == 0) { - if (++age > search_limit && best_noise_info.over_count == 0) - break; - if ((cfg->noise_shaping_amp == 3) && bRefine && age > 30) - break; - if ((cfg->noise_shaping_amp == 3) && bRefine && - (cod_info_w.global_gain - best_ggain_pass1) > 15) - break; - } - } - } - while ((cod_info_w.global_gain + cod_info_w.scalefac_scale) < 255); - - if (cfg->noise_shaping_amp == 3) { - if (!bRefine) { - /* refine search */ - cod_info_w = *cod_info; - memcpy(xrpow, save_xrpow, sizeof(FLOAT) * 576); - age = 0; - best_ggain_pass1 = cod_info_w.global_gain; - - bRefine = 1; - } - else { - /* search already refined, stop */ - bEndOfSearch = 1; - } - - } - else { - bEndOfSearch = 1; - } - } - - assert((cod_info->global_gain + cod_info->scalefac_scale) <= 255); - /* finish up - */ - if (cfg->vbr == vbr_rh || cfg->vbr == vbr_mtrh || cfg->vbr == vbr_mt) - /* restore for reuse on next try */ - memcpy(xrpow, save_xrpow, sizeof(FLOAT) * 576); - /* do the 'substep shaping' - */ - else if (gfc->sv_qnt.substep_shaping & 1) - trancate_smallspectrums(gfc, cod_info, l3_xmin, xrpow); - - return best_noise_info.over_count; -} - - - - - -/************************************************************************ - * - * iteration_finish_one() - * - * Robert Hegemann 2000-09-06 - * - * update reservoir status after FINAL quantization/bitrate - * - ************************************************************************/ - -static void -iteration_finish_one(lame_internal_flags * gfc, int gr, int ch) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - III_side_info_t *const l3_side = &gfc->l3_side; - gr_info *const cod_info = &l3_side->tt[gr][ch]; - - /* try some better scalefac storage - */ - best_scalefac_store(gfc, gr, ch, l3_side); - - /* best huffman_divide may save some bits too - */ - if (cfg->use_best_huffman == 1) - best_huffman_divide(gfc, cod_info); - - /* update reservoir status after FINAL quantization/bitrate - */ - ResvAdjust(gfc, cod_info); -} - - - -/********************************************************************* - * - * VBR_encode_granule() - * - * 2000-09-04 Robert Hegemann - * - *********************************************************************/ - -static void -VBR_encode_granule(lame_internal_flags * gfc, gr_info * const cod_info, const FLOAT * const l3_xmin, /* allowed distortion of the scalefactor */ - FLOAT xrpow[576], /* coloured magnitudes of spectral values */ - const int ch, int min_bits, int max_bits) -{ - gr_info bst_cod_info; - FLOAT bst_xrpow[576]; - int const Max_bits = max_bits; - int real_bits = max_bits + 1; - int this_bits = (max_bits + min_bits) / 2; - int dbits, over, found = 0; - int const sfb21_extra = gfc->sv_qnt.sfb21_extra; - - assert(Max_bits <= MAX_BITS_PER_CHANNEL); - memset(bst_cod_info.l3_enc, 0, sizeof(bst_cod_info.l3_enc)); - - /* search within round about 40 bits of optimal - */ - do { - assert(this_bits >= min_bits); - assert(this_bits <= max_bits); - assert(min_bits <= max_bits); - - if (this_bits > Max_bits - 42) - gfc->sv_qnt.sfb21_extra = 0; - else - gfc->sv_qnt.sfb21_extra = sfb21_extra; - - over = outer_loop(gfc, cod_info, l3_xmin, xrpow, ch, this_bits); - - /* is quantization as good as we are looking for ? - * in this case: is no scalefactor band distorted? - */ - if (over <= 0) { - found = 1; - /* now we know it can be done with "real_bits" - * and maybe we can skip some iterations - */ - real_bits = cod_info->part2_3_length; - - /* store best quantization so far - */ - bst_cod_info = *cod_info; - memcpy(bst_xrpow, xrpow, sizeof(FLOAT) * 576); - - /* try with fewer bits - */ - max_bits = real_bits - 32; - dbits = max_bits - min_bits; - this_bits = (max_bits + min_bits) / 2; - } - else { - /* try with more bits - */ - min_bits = this_bits + 32; - dbits = max_bits - min_bits; - this_bits = (max_bits + min_bits) / 2; - - if (found) { - found = 2; - /* start again with best quantization so far - */ - *cod_info = bst_cod_info; - memcpy(xrpow, bst_xrpow, sizeof(FLOAT) * 576); - } - } - } while (dbits > 12); - - gfc->sv_qnt.sfb21_extra = sfb21_extra; - - /* found=0 => nothing found, use last one - * found=1 => we just found the best and left the loop - * found=2 => we restored a good one and have now l3_enc to restore too - */ - if (found == 2) { - memcpy(cod_info->l3_enc, bst_cod_info.l3_enc, sizeof(int) * 576); - } - assert(cod_info->part2_3_length <= Max_bits); - -} - - - -/************************************************************************ - * - * get_framebits() - * - * Robert Hegemann 2000-09-05 - * - * calculates - * * how many bits are available for analog silent granules - * * how many bits to use for the lowest allowed bitrate - * * how many bits each bitrate would provide - * - ************************************************************************/ - -static void -get_framebits(lame_internal_flags * gfc, int frameBits[15]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *const eov = &gfc->ov_enc; - int bitsPerFrame, i; - - /* always use at least this many bits per granule per channel - * unless we detect analog silence, see below - */ - eov->bitrate_index = cfg->vbr_min_bitrate_index; - bitsPerFrame = getframebits(gfc); - - /* bits for analog silence - */ - eov->bitrate_index = 1; - bitsPerFrame = getframebits(gfc); - - for (i = 1; i <= cfg->vbr_max_bitrate_index; i++) { - eov->bitrate_index = i; - frameBits[i] = ResvFrameBegin(gfc, &bitsPerFrame); - } -} - - - -/********************************************************************* - * - * VBR_prepare() - * - * 2000-09-04 Robert Hegemann - * - * * converts LR to MS coding when necessary - * * calculates allowed/adjusted quantization noise amounts - * * detects analog silent frames - * - * some remarks: - * - lower masking depending on Quality setting - * - quality control together with adjusted ATH MDCT scaling - * on lower quality setting allocate more noise from - * ATH masking, and on higher quality setting allocate - * less noise from ATH masking. - * - experiments show that going more than 2dB over GPSYCHO's - * limits ends up in very annoying artefacts - * - *********************************************************************/ - -/* RH: this one needs to be overhauled sometime */ - -static int -VBR_old_prepare(lame_internal_flags * gfc, - const FLOAT pe[2][2], FLOAT const ms_ener_ratio[2], - const III_psy_ratio ratio[2][2], - FLOAT l3_xmin[2][2][SFBMAX], - int frameBits[16], int min_bits[2][2], int max_bits[2][2], int bands[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *const eov = &gfc->ov_enc; - - FLOAT masking_lower_db, adjust = 0.0; - int gr, ch; - int analog_silence = 1; - int avg, mxb, bits = 0; - - eov->bitrate_index = cfg->vbr_max_bitrate_index; - avg = ResvFrameBegin(gfc, &avg) / cfg->mode_gr; - - get_framebits(gfc, frameBits); - - for (gr = 0; gr < cfg->mode_gr; gr++) { - mxb = on_pe(gfc, pe, max_bits[gr], avg, gr, 0); - if (gfc->ov_enc.mode_ext == MPG_MD_MS_LR) { - ms_convert(&gfc->l3_side, gr); - reduce_side(max_bits[gr], ms_ener_ratio[gr], avg, mxb); - } - for (ch = 0; ch < cfg->channels_out; ++ch) { - gr_info *const cod_info = &gfc->l3_side.tt[gr][ch]; - - if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type */ - adjust = 1.28 / (1 + exp(3.5 - pe[gr][ch] / 300.)) - 0.05; - masking_lower_db = gfc->sv_qnt.mask_adjust - adjust; - } - else { - adjust = 2.56 / (1 + exp(3.5 - pe[gr][ch] / 300.)) - 0.14; - masking_lower_db = gfc->sv_qnt.mask_adjust_short - adjust; - } - gfc->sv_qnt.masking_lower = pow(10.0, masking_lower_db * 0.1); - - init_outer_loop(gfc, cod_info); - bands[gr][ch] = calc_xmin(gfc, &ratio[gr][ch], cod_info, l3_xmin[gr][ch]); - if (bands[gr][ch]) - analog_silence = 0; - - min_bits[gr][ch] = 126; - - bits += max_bits[gr][ch]; - } - } - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - if (bits > frameBits[cfg->vbr_max_bitrate_index] && bits > 0) { - max_bits[gr][ch] *= frameBits[cfg->vbr_max_bitrate_index]; - max_bits[gr][ch] /= bits; - } - if (min_bits[gr][ch] > max_bits[gr][ch]) - min_bits[gr][ch] = max_bits[gr][ch]; - - } /* for ch */ - } /* for gr */ - - return analog_silence; -} - -static void -bitpressure_strategy(lame_internal_flags const *gfc, - FLOAT l3_xmin[2][2][SFBMAX], const int min_bits[2][2], int max_bits[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int gr, ch, sfb; - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info const *const gi = &gfc->l3_side.tt[gr][ch]; - FLOAT *pxmin = l3_xmin[gr][ch]; - for (sfb = 0; sfb < gi->psy_lmax; sfb++) - *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_l / SBMAX_l; - - if (gi->block_type == SHORT_TYPE) { - for (sfb = gi->sfb_smin; sfb < SBMAX_s; sfb++) { - *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_s / SBMAX_s; - *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_s / SBMAX_s; - *pxmin++ *= 1. + .029 * sfb * sfb / SBMAX_s / SBMAX_s; - } - } - max_bits[gr][ch] = Max(min_bits[gr][ch], 0.9 * max_bits[gr][ch]); - } - } -} - -/************************************************************************ - * - * VBR_iteration_loop() - * - * tries to find out how many bits are needed for each granule and channel - * to get an acceptable quantization. An appropriate bitrate will then be - * choosed for quantization. rh 8/99 - * - * Robert Hegemann 2000-09-06 rewrite - * - ************************************************************************/ - -void -VBR_old_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ener_ratio[2], const III_psy_ratio ratio[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *const eov = &gfc->ov_enc; - FLOAT l3_xmin[2][2][SFBMAX]; - - FLOAT xrpow[576]; - int bands[2][2]; - int frameBits[15]; - int used_bits; - int bits; - int min_bits[2][2], max_bits[2][2]; - int mean_bits; - int ch, gr, analog_silence; - III_side_info_t *const l3_side = &gfc->l3_side; - - analog_silence = VBR_old_prepare(gfc, pe, ms_ener_ratio, ratio, - l3_xmin, frameBits, min_bits, max_bits, bands); - - /*---------------------------------*/ - for (;;) { - - /* quantize granules with lowest possible number of bits - */ - - used_bits = 0; - - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - int ret; - gr_info *const cod_info = &l3_side->tt[gr][ch]; - - /* init_outer_loop sets up cod_info, scalefac and xrpow - */ - ret = init_xrpow(gfc, cod_info, xrpow); - if (ret == 0 || max_bits[gr][ch] == 0) { - /* xr contains no energy - * l3_enc, our encoding data, will be quantized to zero - */ - continue; /* with next channel */ - } - - VBR_encode_granule(gfc, cod_info, l3_xmin[gr][ch], xrpow, - ch, min_bits[gr][ch], max_bits[gr][ch]); - - /* do the 'substep shaping' - */ - if (gfc->sv_qnt.substep_shaping & 1) { - trancate_smallspectrums(gfc, &l3_side->tt[gr][ch], l3_xmin[gr][ch], xrpow); - } - - ret = cod_info->part2_3_length + cod_info->part2_length; - used_bits += ret; - } /* for ch */ - } /* for gr */ - - /* find lowest bitrate able to hold used bits - */ - if (analog_silence && !cfg->enforce_min_bitrate) - /* we detected analog silence and the user did not specify - * any hard framesize limit, so start with smallest possible frame - */ - eov->bitrate_index = 1; - else - eov->bitrate_index = cfg->vbr_min_bitrate_index; - - for (; eov->bitrate_index < cfg->vbr_max_bitrate_index; eov->bitrate_index++) { - if (used_bits <= frameBits[eov->bitrate_index]) - break; - } - bits = ResvFrameBegin(gfc, &mean_bits); - - if (used_bits <= bits) - break; - - bitpressure_strategy(gfc, l3_xmin, (const int (*)[2])min_bits, max_bits); - - } /* breaks adjusted */ - /*--------------------------------------*/ - - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - iteration_finish_one(gfc, gr, ch); - } /* for ch */ - } /* for gr */ - ResvFrameEnd(gfc, mean_bits); -} - - - -static int -VBR_new_prepare(lame_internal_flags * gfc, - const FLOAT pe[2][2], const III_psy_ratio ratio[2][2], - FLOAT l3_xmin[2][2][SFBMAX], int frameBits[16], int max_bits[2][2], - int* max_resv) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *const eov = &gfc->ov_enc; - - int gr, ch; - int analog_silence = 1; - int avg, bits = 0; - int maximum_framebits; - - if (!cfg->free_format) { - eov->bitrate_index = cfg->vbr_max_bitrate_index; - (void) ResvFrameBegin(gfc, &avg); - *max_resv = gfc->sv_enc.ResvMax; - - get_framebits(gfc, frameBits); - maximum_framebits = frameBits[cfg->vbr_max_bitrate_index]; - } - else { - eov->bitrate_index = 0; - maximum_framebits = ResvFrameBegin(gfc, &avg); - frameBits[0] = maximum_framebits; - *max_resv = gfc->sv_enc.ResvMax; - } - - for (gr = 0; gr < cfg->mode_gr; gr++) { - (void) on_pe(gfc, pe, max_bits[gr], avg, gr, 0); - if (gfc->ov_enc.mode_ext == MPG_MD_MS_LR) { - ms_convert(&gfc->l3_side, gr); - } - for (ch = 0; ch < cfg->channels_out; ++ch) { - gr_info *const cod_info = &gfc->l3_side.tt[gr][ch]; - - gfc->sv_qnt.masking_lower = pow(10.0, gfc->sv_qnt.mask_adjust * 0.1); - - init_outer_loop(gfc, cod_info); - if (0 != calc_xmin(gfc, &ratio[gr][ch], cod_info, l3_xmin[gr][ch])) - analog_silence = 0; - - bits += max_bits[gr][ch]; - } - } - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - if (bits > maximum_framebits && bits > 0) { - max_bits[gr][ch] *= maximum_framebits; - max_bits[gr][ch] /= bits; - } - - } /* for ch */ - } /* for gr */ - if (analog_silence) { - *max_resv = 0; - } - return analog_silence; -} - - - -void -VBR_new_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ener_ratio[2], const III_psy_ratio ratio[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *const eov = &gfc->ov_enc; - FLOAT l3_xmin[2][2][SFBMAX]; - - FLOAT xrpow[2][2][576]; - int frameBits[15]; - int used_bits; - int max_bits[2][2]; - int ch, gr, analog_silence, pad; - III_side_info_t *const l3_side = &gfc->l3_side; - - const FLOAT (*const_l3_xmin)[2][SFBMAX] = (const FLOAT (*)[2][SFBMAX])l3_xmin; - const FLOAT (*const_xrpow)[2][576] = (const FLOAT (*)[2][576])xrpow; - const int (*const_max_bits)[2] = (const int (*)[2])max_bits; - - (void) ms_ener_ratio; /* not used */ - - memset(xrpow, 0, sizeof(xrpow)); - - analog_silence = VBR_new_prepare(gfc, pe, ratio, l3_xmin, frameBits, max_bits, &pad); - - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info *const cod_info = &l3_side->tt[gr][ch]; - - /* init_outer_loop sets up cod_info, scalefac and xrpow - */ - if (0 == init_xrpow(gfc, cod_info, xrpow[gr][ch])) { - max_bits[gr][ch] = 0; /* silent granule needs no bits */ - } - } /* for ch */ - } /* for gr */ - - /* quantize granules with lowest possible number of bits - */ - - used_bits = VBR_encode_frame(gfc, const_xrpow, const_l3_xmin, const_max_bits); - - if (!cfg->free_format) { - int i, j; - - /* find lowest bitrate able to hold used bits - */ - if (analog_silence && !cfg->enforce_min_bitrate) { - /* we detected analog silence and the user did not specify - * any hard framesize limit, so start with smallest possible frame - */ - i = 1; - } - else { - i = cfg->vbr_min_bitrate_index; - } - - for (; i < cfg->vbr_max_bitrate_index; i++) { - if (used_bits <= frameBits[i]) - break; - } - if (i > cfg->vbr_max_bitrate_index) { - i = cfg->vbr_max_bitrate_index; - } - if (pad > 0) { - for (j = cfg->vbr_max_bitrate_index; j > i; --j) { - int const unused = frameBits[j] - used_bits; - if (unused <= pad) - break; - } - eov->bitrate_index = j; - } - else { - eov->bitrate_index = i; - } - } - else { -#if 0 - static int mmm = 0; - int fff = getFramesize_kbps(gfc, used_bits); - int hhh = getFramesize_kbps(gfc, MAX_BITS_PER_GRANULE * cfg->mode_gr); - if (mmm < fff) - mmm = fff; - printf("demand=%3d kbps max=%3d kbps limit=%3d kbps\n", fff, mmm, hhh); -#endif - eov->bitrate_index = 0; - } - if (used_bits <= frameBits[eov->bitrate_index]) { - /* update Reservoire status */ - int mean_bits, fullframebits; - fullframebits = ResvFrameBegin(gfc, &mean_bits); - assert(used_bits <= fullframebits); - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info const *const cod_info = &l3_side->tt[gr][ch]; - ResvAdjust(gfc, cod_info); - } - } - ResvFrameEnd(gfc, mean_bits); - } - else { - /* SHOULD NOT HAPPEN INTERNAL ERROR - */ - ERRORF(gfc, "INTERNAL ERROR IN VBR NEW CODE, please send bug report\n"); - exit(-1); - } -} - - - - - -/******************************************************************** - * - * calc_target_bits() - * - * calculates target bits for ABR encoding - * - * mt 2000/05/31 - * - ********************************************************************/ - -static void -calc_target_bits(lame_internal_flags * gfc, - const FLOAT pe[2][2], - FLOAT const ms_ener_ratio[2], - int targ_bits[2][2], int *analog_silence_bits, int *max_frame_bits) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *const eov = &gfc->ov_enc; - III_side_info_t const *const l3_side = &gfc->l3_side; - FLOAT res_factor; - int gr, ch, totbits, mean_bits; - int framesize = 576 * cfg->mode_gr; - - eov->bitrate_index = cfg->vbr_max_bitrate_index; - *max_frame_bits = ResvFrameBegin(gfc, &mean_bits); - - eov->bitrate_index = 1; - mean_bits = getframebits(gfc) - cfg->sideinfo_len * 8; - *analog_silence_bits = mean_bits / (cfg->mode_gr * cfg->channels_out); - - mean_bits = cfg->vbr_avg_bitrate_kbps * framesize * 1000; - if (gfc->sv_qnt.substep_shaping & 1) - mean_bits *= 1.09; - mean_bits /= cfg->samplerate_out; - mean_bits -= cfg->sideinfo_len * 8; - mean_bits /= (cfg->mode_gr * cfg->channels_out); - - /* - res_factor is the percentage of the target bitrate that should - be used on average. the remaining bits are added to the - bitreservoir and used for difficult to encode frames. - - Since we are tracking the average bitrate, we should adjust - res_factor "on the fly", increasing it if the average bitrate - is greater than the requested bitrate, and decreasing it - otherwise. Reasonable ranges are from .9 to 1.0 - - Until we get the above suggestion working, we use the following - tuning: - compression ratio res_factor - 5.5 (256kbps) 1.0 no need for bitreservoir - 11 (128kbps) .93 7% held for reservoir - - with linear interpolation for other values. - - */ - res_factor = .93 + .07 * (11.0 - cfg->compression_ratio) / (11.0 - 5.5); - if (res_factor < .90) - res_factor = .90; - if (res_factor > 1.00) - res_factor = 1.00; - - for (gr = 0; gr < cfg->mode_gr; gr++) { - int sum = 0; - for (ch = 0; ch < cfg->channels_out; ch++) { - targ_bits[gr][ch] = res_factor * mean_bits; - - if (pe[gr][ch] > 700) { - int add_bits = (pe[gr][ch] - 700) / 1.4; - - gr_info const *const cod_info = &l3_side->tt[gr][ch]; - targ_bits[gr][ch] = res_factor * mean_bits; - - /* short blocks use a little extra, no matter what the pe */ - if (cod_info->block_type == SHORT_TYPE) { - if (add_bits < mean_bits / 2) - add_bits = mean_bits / 2; - } - /* at most increase bits by 1.5*average */ - if (add_bits > mean_bits * 3 / 2) - add_bits = mean_bits * 3 / 2; - else if (add_bits < 0) - add_bits = 0; - - targ_bits[gr][ch] += add_bits; - } - if (targ_bits[gr][ch] > MAX_BITS_PER_CHANNEL) { - targ_bits[gr][ch] = MAX_BITS_PER_CHANNEL; - } - sum += targ_bits[gr][ch]; - } /* for ch */ - if (sum > MAX_BITS_PER_GRANULE) { - for (ch = 0; ch < cfg->channels_out; ++ch) { - targ_bits[gr][ch] *= MAX_BITS_PER_GRANULE; - targ_bits[gr][ch] /= sum; - } - } - } /* for gr */ - - if (gfc->ov_enc.mode_ext == MPG_MD_MS_LR) - for (gr = 0; gr < cfg->mode_gr; gr++) { - reduce_side(targ_bits[gr], ms_ener_ratio[gr], mean_bits * cfg->channels_out, - MAX_BITS_PER_GRANULE); - } - - /* sum target bits - */ - totbits = 0; - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - if (targ_bits[gr][ch] > MAX_BITS_PER_CHANNEL) - targ_bits[gr][ch] = MAX_BITS_PER_CHANNEL; - totbits += targ_bits[gr][ch]; - } - } - - /* repartion target bits if needed - */ - if (totbits > *max_frame_bits && totbits > 0) { - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - targ_bits[gr][ch] *= *max_frame_bits; - targ_bits[gr][ch] /= totbits; - } - } - } -} - - - - - - -/******************************************************************** - * - * ABR_iteration_loop() - * - * encode a frame with a disired average bitrate - * - * mt 2000/05/31 - * - ********************************************************************/ - -void -ABR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ener_ratio[2], const III_psy_ratio ratio[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t *const eov = &gfc->ov_enc; - FLOAT l3_xmin[SFBMAX]; - FLOAT xrpow[576]; - int targ_bits[2][2]; - int mean_bits, max_frame_bits; - int ch, gr, ath_over; - int analog_silence_bits; - gr_info *cod_info; - III_side_info_t *const l3_side = &gfc->l3_side; - - mean_bits = 0; - - calc_target_bits(gfc, pe, ms_ener_ratio, targ_bits, &analog_silence_bits, &max_frame_bits); - - /* encode granules - */ - for (gr = 0; gr < cfg->mode_gr; gr++) { - - if (gfc->ov_enc.mode_ext == MPG_MD_MS_LR) { - ms_convert(&gfc->l3_side, gr); - } - for (ch = 0; ch < cfg->channels_out; ch++) { - FLOAT adjust, masking_lower_db; - cod_info = &l3_side->tt[gr][ch]; - - if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type */ - /* adjust = 1.28/(1+exp(3.5-pe[gr][ch]/300.))-0.05; */ - adjust = 0; - masking_lower_db = gfc->sv_qnt.mask_adjust - adjust; - } - else { - /* adjust = 2.56/(1+exp(3.5-pe[gr][ch]/300.))-0.14; */ - adjust = 0; - masking_lower_db = gfc->sv_qnt.mask_adjust_short - adjust; - } - gfc->sv_qnt.masking_lower = pow(10.0, masking_lower_db * 0.1); - - - /* cod_info, scalefac and xrpow get initialized in init_outer_loop - */ - init_outer_loop(gfc, cod_info); - if (init_xrpow(gfc, cod_info, xrpow)) { - /* xr contains energy we will have to encode - * calculate the masking abilities - * find some good quantization in outer_loop - */ - ath_over = calc_xmin(gfc, &ratio[gr][ch], cod_info, l3_xmin); - if (0 == ath_over) /* analog silence */ - targ_bits[gr][ch] = analog_silence_bits; - - (void) outer_loop(gfc, cod_info, l3_xmin, xrpow, ch, targ_bits[gr][ch]); - } - iteration_finish_one(gfc, gr, ch); - } /* ch */ - } /* gr */ - - /* find a bitrate which can refill the resevoir to positive size. - */ - for (eov->bitrate_index = cfg->vbr_min_bitrate_index; - eov->bitrate_index <= cfg->vbr_max_bitrate_index; eov->bitrate_index++) { - if (ResvFrameBegin(gfc, &mean_bits) >= 0) - break; - } - assert(eov->bitrate_index <= cfg->vbr_max_bitrate_index); - - ResvFrameEnd(gfc, mean_bits); -} - - - - - - -/************************************************************************ - * - * CBR_iteration_loop() - * - * author/date?? - * - * encodes one frame of MP3 data with constant bitrate - * - ************************************************************************/ - -void -CBR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ener_ratio[2], const III_psy_ratio ratio[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - FLOAT l3_xmin[SFBMAX]; - FLOAT xrpow[576]; - int targ_bits[2]; - int mean_bits, max_bits; - int gr, ch; - III_side_info_t *const l3_side = &gfc->l3_side; - gr_info *cod_info; - - (void) ResvFrameBegin(gfc, &mean_bits); - - /* quantize! */ - for (gr = 0; gr < cfg->mode_gr; gr++) { - - /* calculate needed bits - */ - max_bits = on_pe(gfc, pe, targ_bits, mean_bits, gr, gr); - - if (gfc->ov_enc.mode_ext == MPG_MD_MS_LR) { - ms_convert(&gfc->l3_side, gr); - reduce_side(targ_bits, ms_ener_ratio[gr], mean_bits, max_bits); - } - - for (ch = 0; ch < cfg->channels_out; ch++) { - FLOAT adjust, masking_lower_db; - cod_info = &l3_side->tt[gr][ch]; - - if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type */ - /* adjust = 1.28/(1+exp(3.5-pe[gr][ch]/300.))-0.05; */ - adjust = 0; - masking_lower_db = gfc->sv_qnt.mask_adjust - adjust; - } - else { - /* adjust = 2.56/(1+exp(3.5-pe[gr][ch]/300.))-0.14; */ - adjust = 0; - masking_lower_db = gfc->sv_qnt.mask_adjust_short - adjust; - } - gfc->sv_qnt.masking_lower = pow(10.0, masking_lower_db * 0.1); - - /* init_outer_loop sets up cod_info, scalefac and xrpow - */ - init_outer_loop(gfc, cod_info); - if (init_xrpow(gfc, cod_info, xrpow)) { - /* xr contains energy we will have to encode - * calculate the masking abilities - * find some good quantization in outer_loop - */ - (void) calc_xmin(gfc, &ratio[gr][ch], cod_info, l3_xmin); - (void) outer_loop(gfc, cod_info, l3_xmin, xrpow, ch, targ_bits[ch]); - } - - iteration_finish_one(gfc, gr, ch); - assert(cod_info->part2_3_length <= MAX_BITS_PER_CHANNEL); - assert(cod_info->part2_3_length <= targ_bits[ch]); - } /* for ch */ - } /* for gr */ - - ResvFrameEnd(gfc, mean_bits); -} diff --git a/src/lib/dl/ext/lame/quantize.h b/src/lib/dl/ext/lame/quantize.h deleted file mode 100755 index 56edcc70..00000000 --- a/src/lib/dl/ext/lame/quantize.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * MP3 quantization - * - * Copyright (c) 1999 Mark Taylor - * - * 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_QUANTIZE_H -#define LAME_QUANTIZE_H - -void CBR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); - -void VBR_old_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); - -void VBR_new_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); - -void ABR_iteration_loop(lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); - - -#endif /* LAME_QUANTIZE_H */ diff --git a/src/lib/dl/ext/lame/quantize_pvt.c b/src/lib/dl/ext/lame/quantize_pvt.c deleted file mode 100755 index 8624bb90..00000000 --- a/src/lib/dl/ext/lame/quantize_pvt.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* - * quantize_pvt source file - * - * Copyright (c) 1999-2002 Takehiro Tominaga - * Copyright (c) 2000-2011 Robert Hegemann - * Copyright (c) 2001 Naoki Shibata - * Copyright (c) 2002-2005 Gabriel Bouvigne - * - * 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. - */ - -/* $Id: quantize_pvt.c,v 1.169 2011/05/24 20:45:55 robert Exp $ */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "quantize_pvt.h" -#include "reservoir.h" -#include "lame-analysis.h" -#include <float.h> - - -#define NSATHSCALE 100 /* Assuming dynamic range=96dB, this value should be 92 */ - -/* - The following table is used to implement the scalefactor - partitioning for MPEG2 as described in section - 2.4.3.2 of the IS. The indexing corresponds to the - way the tables are presented in the IS: - - [table_number][row_in_table][column of nr_of_sfb] -*/ -const int nr_of_sfb_block[6][3][4] = { - { - {6, 5, 5, 5}, - {9, 9, 9, 9}, - {6, 9, 9, 9} - }, - { - {6, 5, 7, 3}, - {9, 9, 12, 6}, - {6, 9, 12, 6} - }, - { - {11, 10, 0, 0}, - {18, 18, 0, 0}, - {15, 18, 0, 0} - }, - { - {7, 7, 7, 0}, - {12, 12, 12, 0}, - {6, 15, 12, 0} - }, - { - {6, 6, 6, 3}, - {12, 9, 9, 6}, - {6, 12, 9, 6} - }, - { - {8, 8, 5, 0}, - {15, 12, 9, 0}, - {6, 18, 9, 0} - } -}; - - -/* Table B.6: layer3 preemphasis */ -const int pretab[SBMAX_l] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 -}; - -/* - Here are MPEG1 Table B.8 and MPEG2 Table B.1 - -- Layer III scalefactor bands. - Index into this using a method such as: - idx = fr_ps->header->sampling_frequency - + (fr_ps->header->version * 3) -*/ - - -const scalefac_struct sfBandIndex[9] = { - { /* Table B.2.b: 22.05 kHz */ - {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, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* Table B.2.c: 24 kHz */ /* docs: 332. mpg123(broken): 330 */ - {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 332, 394, 464, - 540, 576}, - {0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192} - , {0, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* Table B.2.a: 16 kHz */ - {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, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* Table B.8.b: 44.1 kHz */ - {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, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* Table B.8.c: 48 kHz */ - {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, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* Table B.8.a: 32 kHz */ - {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} - , {0, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* MPEG-2.5 11.025 kHz */ - {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, - 522, 576}, - {0 / 3, 12 / 3, 24 / 3, 36 / 3, 54 / 3, 78 / 3, 108 / 3, 144 / 3, 186 / 3, 240 / 3, 312 / 3, - 402 / 3, 522 / 3, 576 / 3} - , {0, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* MPEG-2.5 12 kHz */ - {0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, - 522, 576}, - {0 / 3, 12 / 3, 24 / 3, 36 / 3, 54 / 3, 78 / 3, 108 / 3, 144 / 3, 186 / 3, 240 / 3, 312 / 3, - 402 / 3, 522 / 3, 576 / 3} - , {0, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - }, - { /* MPEG-2.5 8 kHz */ - {0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570, - 572, 574, 576}, - {0 / 3, 24 / 3, 48 / 3, 72 / 3, 108 / 3, 156 / 3, 216 / 3, 288 / 3, 372 / 3, 480 / 3, 486 / 3, - 492 / 3, 498 / 3, 576 / 3} - , {0, 0, 0, 0, 0, 0, 0} /* sfb21 pseudo sub bands */ - , {0, 0, 0, 0, 0, 0, 0} /* sfb12 pseudo sub bands */ - } -}; - - - -FLOAT pow20[Q_MAX + Q_MAX2 + 1]; -FLOAT ipow20[Q_MAX]; -FLOAT pow43[PRECALC_SIZE]; -/* initialized in first call to iteration_init */ -#ifdef TAKEHIRO_IEEE754_HACK -FLOAT adj43asm[PRECALC_SIZE]; -#else -FLOAT adj43[PRECALC_SIZE]; -#endif - -/* -compute the ATH for each scalefactor band -cd range: 0..96db - -Input: 3.3kHz signal 32767 amplitude (3.3kHz is where ATH is smallest = -5db) -longblocks: sfb=12 en0/bw=-11db max_en0 = 1.3db -shortblocks: sfb=5 -9db 0db - -Input: 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 (repeated) -longblocks: amp=1 sfb=12 en0/bw=-103 db max_en0 = -92db - amp=32767 sfb=12 -12 db -1.4db - -Input: 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 (repeated) -shortblocks: amp=1 sfb=5 en0/bw= -99 -86 - amp=32767 sfb=5 -9 db 4db - - -MAX energy of largest wave at 3.3kHz = 1db -AVE energy of largest wave at 3.3kHz = -11db -Let's take AVE: -11db = maximum signal in sfb=12. -Dynamic range of CD: 96db. Therefor energy of smallest audible wave -in sfb=12 = -11 - 96 = -107db = ATH at 3.3kHz. - -ATH formula for this wave: -5db. To adjust to LAME scaling, we need -ATH = ATH_formula - 103 (db) -ATH = ATH * 2.5e-10 (ener) - -*/ - -static FLOAT -ATHmdct(SessionConfig_t const *cfg, FLOAT f) -{ - FLOAT ath; - - ath = ATHformula(cfg, f); - - if (cfg->ATHfixpoint > 0) { - ath -= cfg->ATHfixpoint; - } - else { - ath -= NSATHSCALE; - } - ath += cfg->ATH_offset_db; - - /* modify the MDCT scaling for the ATH and convert to energy */ - ath = powf(10.0f, ath * 0.1f); - return ath; -} - -static void -compute_ath(lame_internal_flags const* gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - FLOAT *const ATH_l = gfc->ATH->l; - FLOAT *const ATH_psfb21 = gfc->ATH->psfb21; - FLOAT *const ATH_s = gfc->ATH->s; - FLOAT *const ATH_psfb12 = gfc->ATH->psfb12; - int sfb, i, start, end; - FLOAT ATH_f; - FLOAT const samp_freq = cfg->samplerate_out; - - for (sfb = 0; sfb < SBMAX_l; sfb++) { - start = gfc->scalefac_band.l[sfb]; - end = gfc->scalefac_band.l[sfb + 1]; - ATH_l[sfb] = FLOAT_MAX; - for (i = start; i < end; i++) { - FLOAT const freq = i * samp_freq / (2 * 576); - ATH_f = ATHmdct(cfg, freq); /* freq in kHz */ - ATH_l[sfb] = Min(ATH_l[sfb], ATH_f); - } - } - - for (sfb = 0; sfb < PSFB21; sfb++) { - start = gfc->scalefac_band.psfb21[sfb]; - end = gfc->scalefac_band.psfb21[sfb + 1]; - ATH_psfb21[sfb] = FLOAT_MAX; - for (i = start; i < end; i++) { - FLOAT const freq = i * samp_freq / (2 * 576); - ATH_f = ATHmdct(cfg, freq); /* freq in kHz */ - ATH_psfb21[sfb] = Min(ATH_psfb21[sfb], ATH_f); - } - } - - for (sfb = 0; sfb < SBMAX_s; sfb++) { - start = gfc->scalefac_band.s[sfb]; - end = gfc->scalefac_band.s[sfb + 1]; - ATH_s[sfb] = FLOAT_MAX; - for (i = start; i < end; i++) { - FLOAT const freq = i * samp_freq / (2 * 192); - ATH_f = ATHmdct(cfg, freq); /* freq in kHz */ - ATH_s[sfb] = Min(ATH_s[sfb], ATH_f); - } - ATH_s[sfb] *= (gfc->scalefac_band.s[sfb + 1] - gfc->scalefac_band.s[sfb]); - } - - for (sfb = 0; sfb < PSFB12; sfb++) { - start = gfc->scalefac_band.psfb12[sfb]; - end = gfc->scalefac_band.psfb12[sfb + 1]; - ATH_psfb12[sfb] = FLOAT_MAX; - for (i = start; i < end; i++) { - FLOAT const freq = i * samp_freq / (2 * 192); - ATH_f = ATHmdct(cfg, freq); /* freq in kHz */ - ATH_psfb12[sfb] = Min(ATH_psfb12[sfb], ATH_f); - } - /*not sure about the following */ - ATH_psfb12[sfb] *= (gfc->scalefac_band.s[13] - gfc->scalefac_band.s[12]); - } - - - /* no-ATH mode: - * reduce ATH to -200 dB - */ - - if (cfg->noATH) { - for (sfb = 0; sfb < SBMAX_l; sfb++) { - ATH_l[sfb] = 1E-20; - } - for (sfb = 0; sfb < PSFB21; sfb++) { - ATH_psfb21[sfb] = 1E-20; - } - for (sfb = 0; sfb < SBMAX_s; sfb++) { - ATH_s[sfb] = 1E-20; - } - for (sfb = 0; sfb < PSFB12; sfb++) { - ATH_psfb12[sfb] = 1E-20; - } - } - - /* work in progress, don't rely on it too much - */ - gfc->ATH->floor = 10. * log10(ATHmdct(cfg, -1.)); - - /* - { FLOAT g=10000, t=1e30, x; - for ( f = 100; f < 10000; f++ ) { - x = ATHmdct( cfg, f ); - if ( t > x ) t = x, g = f; - } - printf("min=%g\n", g); - } */ -} - - -static float const payload_long[2][4] = -{ {-0.000f, -0.000f, -0.000f, +0.000f} -, {-0.500f, -0.250f, -0.025f, +0.500f} -}; -static float const payload_short[2][4] = -{ {-0.000f, -0.000f, -0.000f, +0.000f} -, {-2.000f, -1.000f, -0.050f, +0.500f} -}; - -/************************************************************************/ -/* initialization for iteration_loop */ -/************************************************************************/ -void -iteration_init(lame_internal_flags * gfc) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - III_side_info_t *const l3_side = &gfc->l3_side; - FLOAT adjust, db; - int i, sel; - - if (gfc->iteration_init_init == 0) { - gfc->iteration_init_init = 1; - - l3_side->main_data_begin = 0; - compute_ath(gfc); - - pow43[0] = 0.0; - for (i = 1; i < PRECALC_SIZE; i++) - pow43[i] = pow((FLOAT) i, 4.0 / 3.0); - -#ifdef TAKEHIRO_IEEE754_HACK - adj43asm[0] = 0.0; - for (i = 1; i < PRECALC_SIZE; i++) - adj43asm[i] = i - 0.5 - pow(0.5 * (pow43[i - 1] + pow43[i]), 0.75); -#else - for (i = 0; i < PRECALC_SIZE - 1; i++) - adj43[i] = (i + 1) - pow(0.5 * (pow43[i] + pow43[i + 1]), 0.75); - adj43[i] = 0.5; -#endif - for (i = 0; i < Q_MAX; i++) - ipow20[i] = pow(2.0, (double) (i - 210) * -0.1875); - for (i = 0; i <= Q_MAX + Q_MAX2; i++) - pow20[i] = pow(2.0, (double) (i - 210 - Q_MAX2) * 0.25); - - huffman_init(gfc); - init_xrpow_core_init(gfc); - - sel = 1;/* RH: all modes like vbr-new (cfg->vbr == vbr_mt || cfg->vbr == vbr_mtrh) ? 1 : 0;*/ - - /* long */ - db = cfg->adjust_bass_db + payload_long[sel][0]; - adjust = powf(10.f, db * 0.1f); - for (i = 0; i <= 6; ++i) { - gfc->sv_qnt.longfact[i] = adjust; - } - db = cfg->adjust_alto_db + payload_long[sel][1]; - adjust = powf(10.f, db * 0.1f); - for (; i <= 13; ++i) { - gfc->sv_qnt.longfact[i] = adjust; - } - db = cfg->adjust_treble_db + payload_long[sel][2]; - adjust = powf(10.f, db * 0.1f); - for (; i <= 20; ++i) { - gfc->sv_qnt.longfact[i] = adjust; - } - db = cfg->adjust_sfb21_db + payload_long[sel][3]; - adjust = powf(10.f, db * 0.1f); - for (; i < SBMAX_l; ++i) { - gfc->sv_qnt.longfact[i] = adjust; - } - - /* short */ - db = cfg->adjust_bass_db + payload_short[sel][0]; - adjust = powf(10.f, db * 0.1f); - for (i = 0; i <= 2; ++i) { - gfc->sv_qnt.shortfact[i] = adjust; - } - db = cfg->adjust_alto_db + payload_short[sel][1]; - adjust = powf(10.f, db * 0.1f); - for (; i <= 6; ++i) { - gfc->sv_qnt.shortfact[i] = adjust; - } - db = cfg->adjust_treble_db + payload_short[sel][2]; - adjust = powf(10.f, db * 0.1f); - for (; i <= 11; ++i) { - gfc->sv_qnt.shortfact[i] = adjust; - } - db = cfg->adjust_sfb21_db + payload_short[sel][3]; - adjust = powf(10.f, db * 0.1f); - for (; i < SBMAX_s; ++i) { - gfc->sv_qnt.shortfact[i] = adjust; - } - } -} - - - - - -/************************************************************************ - * allocate bits among 2 channels based on PE - * mt 6/99 - * bugfixes rh 8/01: often allocated more than the allowed 4095 bits - ************************************************************************/ -int -on_pe(lame_internal_flags * gfc, const FLOAT pe[][2], int targ_bits[2], int mean_bits, int gr, int cbr) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int extra_bits = 0, tbits, bits; - int add_bits[2] = {0, 0}; - int max_bits; /* maximum allowed bits for this granule */ - int ch; - - /* allocate targ_bits for granule */ - ResvMaxBits(gfc, mean_bits, &tbits, &extra_bits, cbr); - max_bits = tbits + extra_bits; - if (max_bits > MAX_BITS_PER_GRANULE) /* hard limit per granule */ - max_bits = MAX_BITS_PER_GRANULE; - - for (bits = 0, ch = 0; ch < cfg->channels_out; ++ch) { - /****************************************************************** - * allocate bits for each channel - ******************************************************************/ - targ_bits[ch] = Min(MAX_BITS_PER_CHANNEL, tbits / cfg->channels_out); - - add_bits[ch] = targ_bits[ch] * pe[gr][ch] / 700.0 - targ_bits[ch]; - - /* at most increase bits by 1.5*average */ - if (add_bits[ch] > mean_bits * 3 / 4) - add_bits[ch] = mean_bits * 3 / 4; - if (add_bits[ch] < 0) - add_bits[ch] = 0; - - if (add_bits[ch] + targ_bits[ch] > MAX_BITS_PER_CHANNEL) - add_bits[ch] = Max(0, MAX_BITS_PER_CHANNEL - targ_bits[ch]); - - bits += add_bits[ch]; - } - if (bits > extra_bits && bits > 0) { - for (ch = 0; ch < cfg->channels_out; ++ch) { - add_bits[ch] = extra_bits * add_bits[ch] / bits; - } - } - - for (ch = 0; ch < cfg->channels_out; ++ch) { - targ_bits[ch] += add_bits[ch]; - extra_bits -= add_bits[ch]; - } - - for (bits = 0, ch = 0; ch < cfg->channels_out; ++ch) { - bits += targ_bits[ch]; - } - if (bits > MAX_BITS_PER_GRANULE) { - int sum = 0; - for (ch = 0; ch < cfg->channels_out; ++ch) { - targ_bits[ch] *= MAX_BITS_PER_GRANULE; - targ_bits[ch] /= bits; - sum += targ_bits[ch]; - } - assert(sum <= MAX_BITS_PER_GRANULE); - } - - return max_bits; -} - - - - -void -reduce_side(int targ_bits[2], FLOAT ms_ener_ratio, int mean_bits, int max_bits) -{ - int move_bits; - FLOAT fac; - - assert(max_bits <= MAX_BITS_PER_GRANULE); - assert(targ_bits[0] + targ_bits[1] <= MAX_BITS_PER_GRANULE); - - /* ms_ener_ratio = 0: allocate 66/33 mid/side fac=.33 - * ms_ener_ratio =.5: allocate 50/50 mid/side fac= 0 */ - /* 75/25 split is fac=.5 */ - /* float fac = .50*(.5-ms_ener_ratio[gr])/.5; */ - fac = .33 * (.5 - ms_ener_ratio) / .5; - if (fac < 0) - fac = 0; - if (fac > .5) - fac = .5; - - /* number of bits to move from side channel to mid channel */ - /* move_bits = fac*targ_bits[1]; */ - move_bits = fac * .5 * (targ_bits[0] + targ_bits[1]); - - if (move_bits > MAX_BITS_PER_CHANNEL - targ_bits[0]) { - move_bits = MAX_BITS_PER_CHANNEL - targ_bits[0]; - } - if (move_bits < 0) - move_bits = 0; - - if (targ_bits[1] >= 125) { - /* dont reduce side channel below 125 bits */ - if (targ_bits[1] - move_bits > 125) { - - /* if mid channel already has 2x more than average, dont bother */ - /* mean_bits = bits per granule (for both channels) */ - if (targ_bits[0] < mean_bits) - targ_bits[0] += move_bits; - targ_bits[1] -= move_bits; - } - else { - targ_bits[0] += targ_bits[1] - 125; - targ_bits[1] = 125; - } - } - - move_bits = targ_bits[0] + targ_bits[1]; - if (move_bits > max_bits) { - targ_bits[0] = (max_bits * targ_bits[0]) / move_bits; - targ_bits[1] = (max_bits * targ_bits[1]) / move_bits; - } - assert(targ_bits[0] <= MAX_BITS_PER_CHANNEL); - assert(targ_bits[1] <= MAX_BITS_PER_CHANNEL); - assert(targ_bits[0] + targ_bits[1] <= MAX_BITS_PER_GRANULE); -} - - -/** - * Robert Hegemann 2001-04-27: - * this adjusts the ATH, keeping the original noise floor - * affects the higher frequencies more than the lower ones - */ - -FLOAT -athAdjust(FLOAT a, FLOAT x, FLOAT athFloor, float ATHfixpoint) -{ - /* work in progress - */ - FLOAT const o = 90.30873362f; - FLOAT const p = (ATHfixpoint < 1.f) ? 94.82444863f : ATHfixpoint; - FLOAT u = FAST_LOG10_X(x, 10.0f); - FLOAT const v = a * a; - FLOAT w = 0.0f; - u -= athFloor; /* undo scaling */ - if (v > 1E-20f) - w = 1.f + FAST_LOG10_X(v, 10.0f / o); - if (w < 0) - w = 0.f; - u *= w; - u += athFloor + o - p; /* redo scaling */ - - return powf(10.f, 0.1f * u); -} - - - -/*************************************************************************/ -/* calc_xmin */ -/*************************************************************************/ - -/* - Calculate the allowed distortion for each scalefactor band, - as determined by the psychoacoustic model. - xmin(sb) = ratio(sb) * en(sb) / bw(sb) - - returns number of sfb's with energy > ATH -*/ - -int -calc_xmin(lame_internal_flags const *gfc, - III_psy_ratio const *const ratio, gr_info * const cod_info, FLOAT * pxmin) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int sfb, gsfb, j = 0, ath_over = 0, k; - ATH_t const *const ATH = gfc->ATH; - const FLOAT *const xr = cod_info->xr; - int max_nonzero; - - for (gsfb = 0; gsfb < cod_info->psy_lmax; gsfb++) { - FLOAT en0, xmin; - FLOAT rh1, rh2, rh3; - int width, l; - - xmin = athAdjust(ATH->adjust_factor, ATH->l[gsfb], ATH->floor, cfg->ATHfixpoint); - xmin *= gfc->sv_qnt.longfact[gsfb]; - - width = cod_info->width[gsfb]; - rh1 = xmin / width; -#ifdef DBL_EPSILON - rh2 = DBL_EPSILON; -#else - rh2 = 2.2204460492503131e-016; -#endif - en0 = 0.0; - for (l = 0; l < width; ++l) { - FLOAT const xa = xr[j++]; - FLOAT const x2 = xa * xa; - en0 += x2; - rh2 += (x2 < rh1) ? x2 : rh1; - } - if (en0 > xmin) - ath_over++; - - if (en0 < xmin) { - rh3 = en0; - } - else if (rh2 < xmin) { - rh3 = xmin; - } - else { - rh3 = rh2; - } - xmin = rh3; - { - FLOAT const e = ratio->en.l[gsfb]; - if (e > 1e-12f) { - FLOAT x; - x = en0 * ratio->thm.l[gsfb] / e; - x *= gfc->sv_qnt.longfact[gsfb]; - if (xmin < x) - xmin = x; - } - } - *pxmin++ = xmin; - } /* end of long block loop */ - - - - - /*use this function to determine the highest non-zero coeff */ - max_nonzero = 575; - if (cod_info->block_type != SHORT_TYPE) { /* NORM, START or STOP type, but not SHORT */ - k = 576; - while (k-- && fabs(xr[k]) < 1e-12f) { - max_nonzero = k; - } - } - cod_info->max_nonzero_coeff = max_nonzero; - - - - for (sfb = cod_info->sfb_smin; gsfb < cod_info->psymax; sfb++, gsfb += 3) { - int width, b, l; - FLOAT tmpATH; - - tmpATH = athAdjust(ATH->adjust_factor, ATH->s[sfb], ATH->floor, cfg->ATHfixpoint); - tmpATH *= gfc->sv_qnt.shortfact[sfb]; - - width = cod_info->width[gsfb]; - for (b = 0; b < 3; b++) { - FLOAT en0 = 0.0, xmin = tmpATH; - FLOAT rh1, rh2, rh3; - - rh1 = tmpATH / width; -#ifdef DBL_EPSILON - rh2 = DBL_EPSILON; -#else - rh2 = 2.2204460492503131e-016; -#endif - for (l = 0; l < width; ++l) { - FLOAT const xa = xr[j++]; - FLOAT const x2 = xa * xa; - en0 += x2; - rh2 += (x2 < rh1) ? x2 : rh1; - } - if (en0 > tmpATH) - ath_over++; - - if (en0 < tmpATH) { - rh3 = en0; - } - else if (rh2 < tmpATH) { - rh3 = tmpATH; - } - else { - rh3 = rh2; - } - xmin = rh3; - { - FLOAT const e = ratio->en.s[sfb][b]; - if (e > 1e-12f) { - FLOAT x; - x = en0 * ratio->thm.s[sfb][b] / e; - x *= gfc->sv_qnt.shortfact[sfb]; - if (xmin < x) - xmin = x; - } - } - *pxmin++ = xmin; - } /* b */ - if (cfg->use_temporal_masking_effect) { - if (pxmin[-3] > pxmin[-3 + 1]) - pxmin[-3 + 1] += (pxmin[-3] - pxmin[-3 + 1]) * gfc->cd_psy->decay; - if (pxmin[-3 + 1] > pxmin[-3 + 2]) - pxmin[-3 + 2] += (pxmin[-3 + 1] - pxmin[-3 + 2]) * gfc->cd_psy->decay; - } - } /* end of short block sfb loop */ - - return ath_over; -} - - -static FLOAT -calc_noise_core_c(const gr_info * const cod_info, int *startline, int l, FLOAT step) -{ - FLOAT noise = 0; - int j = *startline; - const int *const ix = cod_info->l3_enc; - - if (j > cod_info->count1) { - while (l--) { - FLOAT temp; - temp = cod_info->xr[j]; - j++; - noise += temp * temp; - temp = cod_info->xr[j]; - j++; - noise += temp * temp; - } - } - else if (j > cod_info->big_values) { - FLOAT ix01[2]; - ix01[0] = 0; - ix01[1] = step; - while (l--) { - FLOAT temp; - temp = fabs(cod_info->xr[j]) - ix01[ix[j]]; - j++; - noise += temp * temp; - temp = fabs(cod_info->xr[j]) - ix01[ix[j]]; - j++; - noise += temp * temp; - } - } - else { - while (l--) { - FLOAT temp; - temp = fabs(cod_info->xr[j]) - pow43[ix[j]] * step; - j++; - noise += temp * temp; - temp = fabs(cod_info->xr[j]) - pow43[ix[j]] * step; - j++; - noise += temp * temp; - } - } - - *startline = j; - return noise; -} - - -/*************************************************************************/ -/* calc_noise */ -/*************************************************************************/ - -/* -oo dB => -1.00 */ -/* - 6 dB => -0.97 */ -/* - 3 dB => -0.80 */ -/* - 2 dB => -0.64 */ -/* - 1 dB => -0.38 */ -/* 0 dB => 0.00 */ -/* + 1 dB => +0.49 */ -/* + 2 dB => +1.06 */ -/* + 3 dB => +1.68 */ -/* + 6 dB => +3.69 */ -/* +10 dB => +6.45 */ - -int -calc_noise(gr_info const *const cod_info, - FLOAT const *l3_xmin, - FLOAT * distort, calc_noise_result * const res, calc_noise_data * prev_noise) -{ - int sfb, l, over = 0; - FLOAT over_noise_db = 0; - FLOAT tot_noise_db = 0; /* 0 dB relative to masking */ - FLOAT max_noise = -20.0; /* -200 dB relative to masking */ - int j = 0; - const int *scalefac = cod_info->scalefac; - - res->over_SSD = 0; - - - for (sfb = 0; sfb < cod_info->psymax; sfb++) { - int const s = - cod_info->global_gain - (((*scalefac++) + (cod_info->preflag ? pretab[sfb] : 0)) - << (cod_info->scalefac_scale + 1)) - - cod_info->subblock_gain[cod_info->window[sfb]] * 8; - FLOAT noise = 0.0; - - if (prev_noise && (prev_noise->step[sfb] == s)) { - - /* use previously computed values */ - noise = prev_noise->noise[sfb]; - j += cod_info->width[sfb]; - *distort++ = noise / *l3_xmin++; - - noise = prev_noise->noise_log[sfb]; - - } - else { - FLOAT const step = POW20(s); - l = cod_info->width[sfb] >> 1; - - if ((j + cod_info->width[sfb]) > cod_info->max_nonzero_coeff) { - int usefullsize; - usefullsize = cod_info->max_nonzero_coeff - j + 1; - - if (usefullsize > 0) - l = usefullsize >> 1; - else - l = 0; - } - - noise = calc_noise_core_c(cod_info, &j, l, step); - - - if (prev_noise) { - /* save noise values */ - prev_noise->step[sfb] = s; - prev_noise->noise[sfb] = noise; - } - - noise = *distort++ = noise / *l3_xmin++; - - /* multiplying here is adding in dB, but can overflow */ - noise = FAST_LOG10(Max(noise, 1E-20)); - - if (prev_noise) { - /* save noise values */ - prev_noise->noise_log[sfb] = noise; - } - } - - if (prev_noise) { - /* save noise values */ - prev_noise->global_gain = cod_info->global_gain;; - } - - - /*tot_noise *= Max(noise, 1E-20); */ - tot_noise_db += noise; - - if (noise > 0.0) { - int tmp; - - tmp = Max((int) (noise * 10 + .5), 1); - res->over_SSD += tmp * tmp; - - over++; - /* multiplying here is adding in dB -but can overflow */ - /*over_noise *= noise; */ - over_noise_db += noise; - } - max_noise = Max(max_noise, noise); - - } - - res->over_count = over; - res->tot_noise = tot_noise_db; - res->over_noise = over_noise_db; - res->max_noise = max_noise; - - return over; -} - - - - - - - - -/************************************************************************ - * - * set_pinfo() - * - * updates plotting data - * - * Mark Taylor 2000-??-?? - * - * Robert Hegemann: moved noise/distortion calc into it - * - ************************************************************************/ - -static void -set_pinfo(lame_internal_flags const *gfc, - gr_info * const cod_info, const III_psy_ratio * const ratio, const int gr, const int ch) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int sfb, sfb2; - int j, i, l, start, end, bw; - FLOAT en0, en1; - FLOAT const ifqstep = (cod_info->scalefac_scale == 0) ? .5 : 1.0; - int const *const scalefac = cod_info->scalefac; - - FLOAT l3_xmin[SFBMAX], xfsf[SFBMAX]; - calc_noise_result noise; - - (void) calc_xmin(gfc, ratio, cod_info, l3_xmin); - (void) calc_noise(cod_info, l3_xmin, xfsf, &noise, 0); - - j = 0; - sfb2 = cod_info->sfb_lmax; - if (cod_info->block_type != SHORT_TYPE && !cod_info->mixed_block_flag) - sfb2 = 22; - for (sfb = 0; sfb < sfb2; sfb++) { - start = gfc->scalefac_band.l[sfb]; - end = gfc->scalefac_band.l[sfb + 1]; - bw = end - start; - for (en0 = 0.0; j < end; j++) - en0 += cod_info->xr[j] * cod_info->xr[j]; - en0 /= bw; - /* convert to MDCT units */ - en1 = 1e15; /* scaling so it shows up on FFT plot */ - gfc->pinfo->en[gr][ch][sfb] = en1 * en0; - gfc->pinfo->xfsf[gr][ch][sfb] = en1 * l3_xmin[sfb] * xfsf[sfb] / bw; - - if (ratio->en.l[sfb] > 0 && !cfg->ATHonly) - en0 = en0 / ratio->en.l[sfb]; - else - en0 = 0.0; - - gfc->pinfo->thr[gr][ch][sfb] = en1 * Max(en0 * ratio->thm.l[sfb], gfc->ATH->l[sfb]); - - /* there is no scalefactor bands >= SBPSY_l */ - gfc->pinfo->LAMEsfb[gr][ch][sfb] = 0; - if (cod_info->preflag && sfb >= 11) - gfc->pinfo->LAMEsfb[gr][ch][sfb] = -ifqstep * pretab[sfb]; - - if (sfb < SBPSY_l) { - assert(scalefac[sfb] >= 0); /* scfsi should be decoded by caller side */ - gfc->pinfo->LAMEsfb[gr][ch][sfb] -= ifqstep * scalefac[sfb]; - } - } /* for sfb */ - - if (cod_info->block_type == SHORT_TYPE) { - sfb2 = sfb; - for (sfb = cod_info->sfb_smin; sfb < SBMAX_s; sfb++) { - start = gfc->scalefac_band.s[sfb]; - end = gfc->scalefac_band.s[sfb + 1]; - bw = end - start; - for (i = 0; i < 3; i++) { - for (en0 = 0.0, l = start; l < end; l++) { - en0 += cod_info->xr[j] * cod_info->xr[j]; - j++; - } - en0 = Max(en0 / bw, 1e-20); - /* convert to MDCT units */ - en1 = 1e15; /* scaling so it shows up on FFT plot */ - - gfc->pinfo->en_s[gr][ch][3 * sfb + i] = en1 * en0; - gfc->pinfo->xfsf_s[gr][ch][3 * sfb + i] = en1 * l3_xmin[sfb2] * xfsf[sfb2] / bw; - if (ratio->en.s[sfb][i] > 0) - en0 = en0 / ratio->en.s[sfb][i]; - else - en0 = 0.0; - if (cfg->ATHonly || cfg->ATHshort) - en0 = 0; - - gfc->pinfo->thr_s[gr][ch][3 * sfb + i] = - en1 * Max(en0 * ratio->thm.s[sfb][i], gfc->ATH->s[sfb]); - - /* there is no scalefactor bands >= SBPSY_s */ - gfc->pinfo->LAMEsfb_s[gr][ch][3 * sfb + i] - = -2.0 * cod_info->subblock_gain[i]; - if (sfb < SBPSY_s) { - gfc->pinfo->LAMEsfb_s[gr][ch][3 * sfb + i] -= ifqstep * scalefac[sfb2]; - } - sfb2++; - } - } - } /* block type short */ - gfc->pinfo->LAMEqss[gr][ch] = cod_info->global_gain; - gfc->pinfo->LAMEmainbits[gr][ch] = cod_info->part2_3_length + cod_info->part2_length; - gfc->pinfo->LAMEsfbits[gr][ch] = cod_info->part2_length; - - gfc->pinfo->over[gr][ch] = noise.over_count; - gfc->pinfo->max_noise[gr][ch] = noise.max_noise * 10.0; - gfc->pinfo->over_noise[gr][ch] = noise.over_noise * 10.0; - gfc->pinfo->tot_noise[gr][ch] = noise.tot_noise * 10.0; - gfc->pinfo->over_SSD[gr][ch] = noise.over_SSD; -} - - -/************************************************************************ - * - * set_frame_pinfo() - * - * updates plotting data for a whole frame - * - * Robert Hegemann 2000-10-21 - * - ************************************************************************/ - -void -set_frame_pinfo(lame_internal_flags * gfc, const III_psy_ratio ratio[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int ch; - int gr; - - /* for every granule and channel patch l3_enc and set info - */ - for (gr = 0; gr < cfg->mode_gr; gr++) { - for (ch = 0; ch < cfg->channels_out; ch++) { - gr_info *const cod_info = &gfc->l3_side.tt[gr][ch]; - int scalefac_sav[SFBMAX]; - memcpy(scalefac_sav, cod_info->scalefac, sizeof(scalefac_sav)); - - /* reconstruct the scalefactors in case SCFSI was used - */ - if (gr == 1) { - int sfb; - for (sfb = 0; sfb < cod_info->sfb_lmax; sfb++) { - if (cod_info->scalefac[sfb] < 0) /* scfsi */ - cod_info->scalefac[sfb] = gfc->l3_side.tt[0][ch].scalefac[sfb]; - } - } - - set_pinfo(gfc, cod_info, &ratio[gr][ch], gr, ch); - memcpy(cod_info->scalefac, scalefac_sav, sizeof(scalefac_sav)); - } /* for ch */ - } /* for gr */ -} diff --git a/src/lib/dl/ext/lame/quantize_pvt.h b/src/lib/dl/ext/lame/quantize_pvt.h deleted file mode 100755 index b8333e7e..00000000 --- a/src/lib/dl/ext/lame/quantize_pvt.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * quantize_pvt include file - * - * Copyright (c) 1999 Takehiro TOMINAGA - * - * 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_QUANTIZE_PVT_H -#define LAME_QUANTIZE_PVT_H - -#define IXMAX_VAL 8206 /* ix always <= 8191+15. see count_bits() */ - -/* buggy Winamp decoder cannot handle values > 8191 */ -/* #define IXMAX_VAL 8191 */ - -#define PRECALC_SIZE (IXMAX_VAL+2) - - -extern const int nr_of_sfb_block[6][3][4]; -extern const int pretab[SBMAX_l]; -extern const int slen1_tab[16]; -extern const int slen2_tab[16]; - -extern const scalefac_struct sfBandIndex[9]; - -extern FLOAT pow43[PRECALC_SIZE]; -#ifdef TAKEHIRO_IEEE754_HACK -extern FLOAT adj43asm[PRECALC_SIZE]; -#else -extern FLOAT adj43[PRECALC_SIZE]; -#endif - -#define Q_MAX (256+1) -#define Q_MAX2 116 /* minimum possible number of - -cod_info->global_gain - + ((scalefac[] + (cod_info->preflag ? pretab[sfb] : 0)) - << (cod_info->scalefac_scale + 1)) - + cod_info->subblock_gain[cod_info->window[sfb]] * 8; - - for long block, 0+((15+3)<<2) = 18*4 = 72 - for short block, 0+(15<<2)+7*8 = 15*4+56 = 116 - */ - -extern FLOAT pow20[Q_MAX + Q_MAX2 + 1]; -extern FLOAT ipow20[Q_MAX]; - -typedef struct calc_noise_result_t { - FLOAT over_noise; /* sum of quantization noise > masking */ - FLOAT tot_noise; /* sum of all quantization noise */ - FLOAT max_noise; /* max quantization noise */ - int over_count; /* number of quantization noise > masking */ - int over_SSD; /* SSD-like cost of distorted bands */ - int bits; -} calc_noise_result; - - -/** -* allows re-use of previously -* computed noise values -*/ -typedef struct calc_noise_data_t { - int global_gain; - int sfb_count1; - int step[39]; - FLOAT noise[39]; - FLOAT noise_log[39]; -} calc_noise_data; - - -int on_pe(lame_internal_flags * gfc, const FLOAT pe[2][2], - int targ_bits[2], int mean_bits, int gr, int cbr); - -void reduce_side(int targ_bits[2], FLOAT ms_ener_ratio, int mean_bits, int max_bits); - - -void iteration_init(lame_internal_flags * gfc); - - -int calc_xmin(lame_internal_flags const *gfc, - III_psy_ratio const *const ratio, gr_info * const cod_info, FLOAT * l3_xmin); - -int calc_noise(const gr_info * const cod_info, - const FLOAT * l3_xmin, - FLOAT * distort, calc_noise_result * const res, calc_noise_data * prev_noise); - -void set_frame_pinfo(lame_internal_flags * gfc, const III_psy_ratio ratio[2][2]); - - - - -/* takehiro.c */ - -int count_bits(lame_internal_flags const *const gfc, const FLOAT * const xr, - gr_info * const cod_info, calc_noise_data * prev_noise); -int noquant_count_bits(lame_internal_flags const *const gfc, - gr_info * const cod_info, calc_noise_data * prev_noise); - - -void best_huffman_divide(const lame_internal_flags * const gfc, gr_info * const cod_info); - -void best_scalefac_store(const lame_internal_flags * gfc, const int gr, const int ch, - III_side_info_t * const l3_side); - -int scale_bitcount(const lame_internal_flags * gfc, gr_info * cod_info); - -void huffman_init(lame_internal_flags * const gfc); - -void init_xrpow_core_init(lame_internal_flags * const gfc); - -FLOAT athAdjust(FLOAT a, FLOAT x, FLOAT athFloor, float ATHfixpoint); - -#define LARGE_BITS 100000 - -#endif /* LAME_QUANTIZE_PVT_H */ diff --git a/src/lib/dl/ext/lame/reservoir.c b/src/lib/dl/ext/lame/reservoir.c deleted file mode 100755 index 4fdaa8d3..00000000 --- a/src/lib/dl/ext/lame/reservoir.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * bit reservoir source file - * - * Copyright (c) 1999-2000 Mark Taylor - * - * 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. - */ - -/* $Id: reservoir.c,v 1.45 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "reservoir.h" - -#include "bitstream.h" -#include "lame-analysis.h" -#include "lame_global_flags.h" - - -/* - ResvFrameBegin: - Called (repeatedly) at the beginning of a frame. Updates the maximum - size of the reservoir, and checks to make sure main_data_begin - was set properly by the formatter -*/ - -/* - * Background information: - * - * This is the original text from the ISO standard. Because of - * sooo many bugs and irritations correcting comments are added - * in brackets []. A '^W' means you should remove the last word. - * - * 1) The following rule can be used to calculate the maximum - * number of bits used for one granule [^W frame]: - * At the highest possible bitrate of Layer III (320 kbps - * per stereo signal [^W^W^W], 48 kHz) the frames must be of - * [^W^W^W are designed to have] constant length, i.e. - * one buffer [^W^W the frame] length is: - * - * 320 kbps * 1152/48 kHz = 7680 bit = 960 byte - * - * This value is used as the maximum buffer per channel [^W^W] at - * lower bitrates [than 320 kbps]. At 64 kbps mono or 128 kbps - * stereo the main granule length is 64 kbps * 576/48 kHz = 768 bit - * [per granule and channel] at 48 kHz sampling frequency. - * This means that there is a maximum deviation (short time buffer - * [= reservoir]) of 7680 - 2*2*768 = 4608 bits is allowed at 64 kbps. - * The actual deviation is equal to the number of bytes [with the - * meaning of octets] denoted by the main_data_end offset pointer. - * The actual maximum deviation is (2^9-1)*8 bit = 4088 bits - * [for MPEG-1 and (2^8-1)*8 bit for MPEG-2, both are hard limits]. - * ... The xchange of buffer bits between the left and right channel - * is allowed without restrictions [exception: dual channel]. - * Because of the [constructed] constraint on the buffer size - * main_data_end is always set to 0 in the case of bit_rate_index==14, - * i.e. data rate 320 kbps per stereo signal [^W^W^W]. In this case - * all data are allocated between adjacent header [^W sync] words - * [, i.e. there is no buffering at all]. - */ - -int -ResvFrameBegin(lame_internal_flags * gfc, int *mean_bits) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - int fullFrameBits; - int resvLimit; - int maxmp3buf; - III_side_info_t *const l3_side = &gfc->l3_side; - int frameLength; - int meanBits; - - frameLength = getframebits(gfc); - meanBits = (frameLength - cfg->sideinfo_len * 8) / cfg->mode_gr; - -/* - * Meaning of the variables: - * resvLimit: (0, 8, ..., 8*255 (MPEG-2), 8*511 (MPEG-1)) - * Number of bits can be stored in previous frame(s) due to - * counter size constaints - * maxmp3buf: ( ??? ... 8*1951 (MPEG-1 and 2), 8*2047 (MPEG-2.5)) - * Number of bits allowed to encode one frame (you can take 8*511 bit - * from the bit reservoir and at most 8*1440 bit from the current - * frame (320 kbps, 32 kHz), so 8*1951 bit is the largest possible - * value for MPEG-1 and -2) - * - * maximum allowed granule/channel size times 4 = 8*2047 bits., - * so this is the absolute maximum supported by the format. - * - * - * fullFrameBits: maximum number of bits available for encoding - * the current frame. - * - * mean_bits: target number of bits per granule. - * - * frameLength: - * - * gfc->ResvMax: maximum allowed reservoir - * - * gfc->ResvSize: current reservoir size - * - * l3_side->resvDrain_pre: - * ancillary data to be added to previous frame: - * (only usefull in VBR modes if it is possible to have - * maxmp3buf < fullFrameBits)). Currently disabled, - * see #define NEW_DRAIN - * 2010-02-13: RH now enabled, it seems to be needed for CBR too, - * as there exists one example, where the FhG decoder - * can't decode a -b320 CBR file anymore. - * - * l3_side->resvDrain_post: - * ancillary data to be added to this frame: - * - */ - - /* main_data_begin has 9 bits in MPEG-1, 8 bits MPEG-2 */ - resvLimit = (8 * 256) * cfg->mode_gr - 8; - - /* maximum allowed frame size. dont use more than this number of - bits, even if the frame has the space for them: */ - maxmp3buf = cfg->buffer_constraint; - esv->ResvMax = maxmp3buf - frameLength; - if (esv->ResvMax > resvLimit) - esv->ResvMax = resvLimit; - if (esv->ResvMax < 0 || cfg->disable_reservoir) - esv->ResvMax = 0; - - fullFrameBits = meanBits * cfg->mode_gr + Min(esv->ResvSize, esv->ResvMax); - - if (fullFrameBits > maxmp3buf) - fullFrameBits = maxmp3buf; - - assert(0 == esv->ResvMax % 8); - assert(esv->ResvMax >= 0); - - l3_side->resvDrain_pre = 0; - - if (gfc->pinfo != NULL) { - gfc->pinfo->mean_bits = meanBits / 2; /* expected bits per channel per granule [is this also right for mono/stereo, MPEG-1/2 ?] */ - gfc->pinfo->resvsize = esv->ResvSize; - } - *mean_bits = meanBits; - return fullFrameBits; -} - - -/* - ResvMaxBits - returns targ_bits: target number of bits to use for 1 granule - extra_bits: amount extra available from reservoir - Mark Taylor 4/99 -*/ -void -ResvMaxBits(lame_internal_flags * gfc, int mean_bits, int *targ_bits, int *extra_bits, int cbr) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - int add_bits, targBits, extraBits; - int ResvSize = esv->ResvSize, ResvMax = esv->ResvMax; - - /* conpensate the saved bits used in the 1st granule */ - if (cbr) - ResvSize += mean_bits; - - if (gfc->sv_qnt.substep_shaping & 1) - ResvMax *= 0.9; - - targBits = mean_bits; - - /* extra bits if the reservoir is almost full */ - if (ResvSize * 10 > ResvMax * 9) { - add_bits = ResvSize - (ResvMax * 9) / 10; - targBits += add_bits; - gfc->sv_qnt.substep_shaping |= 0x80; - } - else { - add_bits = 0; - gfc->sv_qnt.substep_shaping &= 0x7f; - /* build up reservoir. this builds the reservoir a little slower - * than FhG. It could simple be mean_bits/15, but this was rigged - * to always produce 100 (the old value) at 128kbs */ - /* *targ_bits -= (int) (mean_bits/15.2); */ - if (!cfg->disable_reservoir && !(gfc->sv_qnt.substep_shaping & 1)) - targBits -= .1 * mean_bits; - } - - - /* amount from the reservoir we are allowed to use. ISO says 6/10 */ - extraBits = (ResvSize < (esv->ResvMax * 6) / 10 ? ResvSize : (esv->ResvMax * 6) / 10); - extraBits -= add_bits; - - if (extraBits < 0) - extraBits = 0; - - *targ_bits = targBits; - *extra_bits = extraBits; -} - -/* - ResvAdjust: - Called after a granule's bit allocation. Readjusts the size of - the reservoir to reflect the granule's usage. -*/ -void -ResvAdjust(lame_internal_flags * gfc, gr_info const *gi) -{ - gfc->sv_enc.ResvSize -= gi->part2_3_length + gi->part2_length; -} - - -/* - ResvFrameEnd: - Called after all granules in a frame have been allocated. Makes sure - that the reservoir size is within limits, possibly by adding stuffing - bits. -*/ -void -ResvFrameEnd(lame_internal_flags * gfc, int mean_bits) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *const esv = &gfc->sv_enc; - III_side_info_t *const l3_side = &gfc->l3_side; - int stuffingBits; - int over_bits; - - esv->ResvSize += mean_bits * cfg->mode_gr; - stuffingBits = 0; - l3_side->resvDrain_post = 0; - l3_side->resvDrain_pre = 0; - - /* we must be byte aligned */ - if ((over_bits = esv->ResvSize % 8) != 0) - stuffingBits += over_bits; - - - over_bits = (esv->ResvSize - stuffingBits) - esv->ResvMax; - if (over_bits > 0) { - assert(0 == over_bits % 8); - assert(over_bits >= 0); - stuffingBits += over_bits; - } - - - /* NOTE: enabling the NEW_DRAIN code fixes some problems with FhG decoder - shipped with MS Windows operating systems. Using this, it is even - possible to use Gabriel's lax buffer consideration again, which - assumes, any decoder should have a buffer large enough - for a 320 kbps frame at 32 kHz sample rate. - - old drain code: - lame -b320 BlackBird.wav ---> does not play with GraphEdit.exe using FhG decoder V1.5 Build 50 - - new drain code: - lame -b320 BlackBird.wav ---> plays fine with GraphEdit.exe using FhG decoder V1.5 Build 50 - - Robert Hegemann, 2010-02-13. - */ - /* drain as many bits as possible into previous frame ancillary data - * In particular, in VBR mode ResvMax may have changed, and we have - * to make sure main_data_begin does not create a reservoir bigger - * than ResvMax mt 4/00*/ - { - int mdb_bytes = Min(l3_side->main_data_begin * 8, stuffingBits) / 8; - l3_side->resvDrain_pre += 8 * mdb_bytes; - stuffingBits -= 8 * mdb_bytes; - esv->ResvSize -= 8 * mdb_bytes; - l3_side->main_data_begin -= mdb_bytes; - } - /* drain the rest into this frames ancillary data */ - l3_side->resvDrain_post += stuffingBits; - esv->ResvSize -= stuffingBits; -} diff --git a/src/lib/dl/ext/lame/reservoir.h b/src/lib/dl/ext/lame/reservoir.h deleted file mode 100755 index 7c585936..00000000 --- a/src/lib/dl/ext/lame/reservoir.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * bit reservoir include file - * - * Copyright (c) 1999 Mark Taylor - * - * 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_RESERVOIR_H -#define LAME_RESERVOIR_H - -int ResvFrameBegin(lame_internal_flags * gfc, int *mean_bits); -void ResvMaxBits(lame_internal_flags * gfc, int mean_bits, int *targ_bits, int *max_bits, - int cbr); -void ResvAdjust(lame_internal_flags * gfc, gr_info const *gi); -void ResvFrameEnd(lame_internal_flags * gfc, int mean_bits); - -#endif /* LAME_RESERVOIR_H */ diff --git a/src/lib/dl/ext/lame/rtp.c b/src/lib/dl/ext/lame/rtp.c deleted file mode 100755 index 39718c88..00000000 --- a/src/lib/dl/ext/lame/rtp.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * rtp socket communication functions - * - * initially contributed by Felix von Leitner - * - * Copyright (c) 2000 Mark Taylor - * 2010 Robert Hegemann - * - * 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. - */ - -/* $Id: rtp.c,v 1.24 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#ifdef HAVE_STDINT_H -# include <stdint.h> -#endif - -struct rtpbits { - int sequence:16; /* sequence number: random */ - int pt:7; /* payload type: 14 for MPEG audio */ - int m:1; /* marker: 0 */ - int cc:4; /* number of CSRC identifiers: 0 */ - int x:1; /* number of extension headers: 0 */ - int p:1; /* is there padding appended: 0 */ - int v:2; /* version: 2 */ -}; - -struct rtpheader { /* in network byte order */ - struct rtpbits b; - int timestamp; /* start: random */ - int ssrc; /* random */ - int iAudioHeader; /* =0?! */ -}; - - -#if !defined( _WIN32 ) && !defined(__MINGW32__) - -#ifdef STDC_HEADERS -# include <stdio.h> -# include <stdarg.h> -# include <stdlib.h> -# include <string.h> -#else -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif - -#include <sys/types.h> -#include <sys/socket.h> -#ifdef __int8_t_defined -#undef uint8_t -#undef uint16_t -#undef uint32_t -#undef uint64_t -#endif -#include <netinet/in.h> -#include <arpa/inet.h> - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -#include "rtp.h" -#include "console.h" - -typedef int SOCKET; - -struct rtpheader RTPheader; -SOCKET rtpsocket; - - -/* create a sender socket. */ -int -rtp_socket(char const *address, unsigned int port, unsigned int TTL) -{ - int iRet, iLoop = 1; - struct sockaddr_in sin; - unsigned char cTtl = TTL; - char cLoop = 0; - unsigned int tempaddr; - - int iSocket = socket(AF_INET, SOCK_DGRAM, 0); - if (iSocket < 0) { - error_printf("socket() failed.\n"); - return 1; - } - - memset(&sin, 0, sizeof(sin)); - tempaddr = inet_addr(address); - sin.sin_family = AF_INET; - sin.sin_port = htons(port); - sin.sin_addr.s_addr = tempaddr; - - iRet = setsockopt(iSocket, SOL_SOCKET, SO_REUSEADDR, &iLoop, sizeof(int)); - if (iRet < 0) { - error_printf("setsockopt SO_REUSEADDR failed\n"); - return 1; - } - - if ((ntohl(tempaddr) >> 28) == 0xe) { - /* only set multicast parameters for multicast destination IPs */ - iRet = setsockopt(iSocket, IPPROTO_IP, IP_MULTICAST_TTL, &cTtl, sizeof(char)); - if (iRet < 0) { - error_printf("setsockopt IP_MULTICAST_TTL failed. multicast in kernel?\n"); - return 1; - } - - cLoop = 1; /* !? */ - iRet = setsockopt(iSocket, IPPROTO_IP, IP_MULTICAST_LOOP, &cLoop, sizeof(char)); - if (iRet < 0) { - error_printf("setsockopt IP_MULTICAST_LOOP failed. multicast in kernel?\n"); - return 1; - } - } - iRet = connect(iSocket, (struct sockaddr *) &sin, sizeof(struct sockaddr_in)); - if (iRet < 0) { - error_printf("connect IP_MULTICAST_LOOP failed. multicast in kernel?\n"); - return 1; - } - - rtpsocket = iSocket; - - return 0; -} - - -static void -rtp_initialization_extra(void) -{ -} - -static void -rtp_close_extra(void) -{ -} - -#else - -#include <Winsock2.h> -#ifndef IP_MULTICAST_TTL -#define IP_MULTICAST_TTL 3 -#endif -#include <stdio.h> -#include <stdarg.h> - -#include "rtp.h" -#include "console.h" - - -struct rtpheader RTPheader; -SOCKET rtpsocket; - -static char * -last_error_message(int err_code) -{ - char *msg; - void *p_msg_buf; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, - (void *) 0, - (DWORD) err_code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) & p_msg_buf, 0, NULL); - msg = strdup(p_msg_buf); - LocalFree(p_msg_buf); - return msg; -} - -static int -print_socket_error(int error) -{ - char *err_txt = last_error_message(error); - error_printf("error %d\n%s\n", error, err_txt); - free(err_txt); - return error; -} - -static int -on_socket_error(SOCKET s) -{ - int error = WSAGetLastError(); - print_socket_error(error); - if (s != INVALID_SOCKET) { - closesocket(s); - } - return error; -} - -/* create a sender socket. */ -int -rtp_socket(char const *address, unsigned int port, unsigned int TTL) -{ - char const True = 1; - char const *c = ""; - int error; - UINT ip; - PHOSTENT host; - SOCKET s; - SOCKADDR_IN source, dest; - - source.sin_family = AF_INET; - source.sin_addr.s_addr = htonl(INADDR_ANY); - source.sin_port = htons(0); - - dest.sin_family = AF_INET; - dest.sin_addr.s_addr = inet_addr(address); - - if (!strcmp(address, "255.255.255.255")) { - } - else if (dest.sin_addr.s_addr == INADDR_NONE) { - host = gethostbyname(address); - - if (host) { - dest.sin_addr = *(PIN_ADDR) host->h_addr; - } - else { - error_printf("Unknown host %s\r\n", address); - return 1; - } - } - - dest.sin_port = htons((u_short) port); - - ip = ntohl(dest.sin_addr.s_addr); - - if (IN_CLASSA(ip)) - c = "class A"; - if (IN_CLASSB(ip)) - c = "class B"; - if (IN_CLASSC(ip)) - c = "class C"; - if (IN_CLASSD(ip)) - c = "class D"; - if (ip == INADDR_LOOPBACK) - c = "loopback"; - if (ip == INADDR_BROADCAST) - c = "broadcast"; - - s = socket(AF_INET, SOCK_DGRAM, PF_UNSPEC); - if (s == INVALID_SOCKET) { - error_printf("socket () "); - return on_socket_error(s); - } - error = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &True, sizeof(True)); - error = bind(s, (struct sockaddr *) &source, sizeof(source)); - if (error == SOCKET_ERROR) { - error_printf("bind () "); - return on_socket_error(s); - } - if (ip == INADDR_BROADCAST) { - error_printf("broadcast %s:%u %s\r\n", inet_ntoa(dest.sin_addr), ntohs(dest.sin_port), c); - error = setsockopt(s, SOL_SOCKET, SO_BROADCAST, &True, sizeof(True)); - if (error == SOCKET_ERROR) { - error_printf("setsockopt (%u, SOL_SOCKET, SO_BROADCAST, ...) ", s); - return on_socket_error(s); - } - } - if (IN_CLASSD(ip)) { - error_printf("multicast %s:%u %s\r\n", inet_ntoa(dest.sin_addr), ntohs(dest.sin_port), c); - error = setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, (const char *) &TTL, sizeof(TTL)); - if (error == SOCKET_ERROR) { - error_printf("setsockopt (%u, IPPROTO_IP, IP_MULTICAST_TTL, ...) ", s); - return on_socket_error(s); - } - } - error = connect(s, (PSOCKADDR) & dest, sizeof(SOCKADDR_IN)); - if (error == SOCKET_ERROR) { - error_printf("connect: "); - return on_socket_error(s); - } - rtpsocket = s; - return 0; -} - -static void -rtp_initialization_extra(void) -{ - WSADATA wsaData; - int rc = WSAStartup(MAKEWORD(2, 2), &wsaData); - if (rc != 0) { - print_socket_error(rc); - } -} - -static void -rtp_close_extra(void) -{ - WSACleanup(); -} - -#endif - - -static int -rtp_send(unsigned char const *data, int len) -{ - SOCKET s = rtpsocket; - struct rtpheader *foo = &RTPheader; - char *buffer = malloc(len + sizeof(struct rtpheader)); - int *cast = (int *) foo; - int *outcast = (int *) buffer; - int count, size; - - outcast[0] = htonl(cast[0]); - outcast[1] = htonl(cast[1]); - outcast[2] = htonl(cast[2]); - outcast[3] = htonl(cast[3]); - memmove(buffer + sizeof(struct rtpheader), data, len); - size = len + sizeof(*foo); - count = send(s, buffer, size, 0); - free(buffer); - - return count != size; -} - -void -rtp_output(unsigned char const *mp3buffer, int mp3size) -{ - rtp_send(mp3buffer, mp3size); - RTPheader.timestamp += 5; - RTPheader.b.sequence++; -} - -void -rtp_initialization(void) -{ - struct rtpheader *foo = &RTPheader; - foo->b.v = 2; - foo->b.p = 0; - foo->b.x = 0; - foo->b.cc = 0; - foo->b.m = 0; - foo->b.pt = 14; /* MPEG Audio */ - foo->b.sequence = rand() & 65535; - foo->timestamp = rand(); - foo->ssrc = rand(); - foo->iAudioHeader = 0; - rtp_initialization_extra(); -} - -void -rtp_deinitialization(void) -{ - rtp_close_extra(); -} diff --git a/src/lib/dl/ext/lame/rtp.h b/src/lib/dl/ext/lame/rtp.h deleted file mode 100755 index 9100feb1..00000000 --- a/src/lib/dl/ext/lame/rtp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * rtp socket communication include file - * - * initially contributed by Felix von Leitner - * - * Copyright (c) 2000 Mark Taylor - * 2010 Robert Hegemann - * - * 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_RTP_H -#define LAME_RTP_H - -#if defined(__cplusplus) -extern "C" { -#endif - - struct RtpStruct; - typedef struct RtpStruct *RtpHandle; - - void rtp_initialization(void); - void rtp_deinitialization(void); - int rtp_socket( /*RtpHandle rtp, */ char const *Address, unsigned int port, - unsigned int TTL); - void rtp_output( /*RtpHandle rtp, */ unsigned char const *mp3buffer, int mp3size); - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/src/lib/dl/ext/lame/set_get.c b/src/lib/dl/ext/lame/set_get.c deleted file mode 100755 index 2c61f48f..00000000 --- a/src/lib/dl/ext/lame/set_get.c +++ /dev/null @@ -1,2277 +0,0 @@ -/* -*- mode: C; mode: fold -*- */ -/* - * set/get functions for lame_global_flags - * - * Copyright (c) 2001-2005 Alexander Leidinger - * - * 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. - */ - -/* $Id: set_get.c,v 1.98 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "bitstream.h" /* because of compute_flushbits */ - -#include "set_get.h" -#include "lame_global_flags.h" - -/* - * input stream description - */ - - -/* number of samples */ -/* it's unlikely for this function to return an error */ -int -lame_set_num_samples(lame_global_flags * gfp, unsigned long num_samples) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 2^32-1 */ - gfp->num_samples = num_samples; - return 0; - } - return -1; -} - -unsigned long -lame_get_num_samples(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->num_samples; - } - return 0; -} - - -/* input samplerate */ -int -lame_set_in_samplerate(lame_global_flags * gfp, int in_samplerate) -{ - if (is_lame_global_flags_valid(gfp)) { - /* input sample rate in Hz, default = 44100 Hz */ - gfp->samplerate_in = in_samplerate; - return 0; - } - return -1; -} - -int -lame_get_in_samplerate(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->samplerate_in; - } - return 0; -} - - -/* number of channels in input stream */ -int -lame_set_num_channels(lame_global_flags * gfp, int num_channels) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 2 */ - if (2 < num_channels || 0 == num_channels) { - return -1; /* we don't support more than 2 channels */ - } - gfp->num_channels = num_channels; - return 0; - } - return -1; -} - -int -lame_get_num_channels(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->num_channels; - } - return 0; -} - - -/* scale the input by this amount before encoding (not used for decoding) */ -int -lame_set_scale(lame_global_flags * gfp, float scale) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 1 */ - gfp->scale = scale; - return 0; - } - return -1; -} - -float -lame_get_scale(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->scale; - } - return 0; -} - - -/* scale the channel 0 (left) input by this amount before - encoding (not used for decoding) */ -int -lame_set_scale_left(lame_global_flags * gfp, float scale) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 1 */ - gfp->scale_left = scale; - return 0; - } - return -1; -} - -float -lame_get_scale_left(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->scale_left; - } - return 0; -} - - -/* scale the channel 1 (right) input by this amount before - encoding (not used for decoding) */ -int -lame_set_scale_right(lame_global_flags * gfp, float scale) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 1 */ - gfp->scale_right = scale; - return 0; - } - return -1; -} - -float -lame_get_scale_right(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->scale_right; - } - return 0; -} - - -/* output sample rate in Hz */ -int -lame_set_out_samplerate(lame_global_flags * gfp, int out_samplerate) -{ - if (is_lame_global_flags_valid(gfp)) { - /* - * default = 0: LAME picks best value based on the amount - * of compression - * MPEG only allows: - * MPEG1 32, 44.1, 48khz - * MPEG2 16, 22.05, 24 - * MPEG2.5 8, 11.025, 12 - * - * (not used by decoding routines) - */ - gfp->samplerate_out = out_samplerate; - return 0; - } - return -1; -} - -int -lame_get_out_samplerate(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->samplerate_out; - } - return 0; -} - - - - -/* - * general control parameters - */ - -/* collect data for an MP3 frame analzyer */ -int -lame_set_analysis(lame_global_flags * gfp, int analysis) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > analysis || 1 < analysis) - return -1; - gfp->analysis = analysis; - return 0; - } - return -1; -} - -int -lame_get_analysis(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->analysis && 1 >= gfp->analysis); - return gfp->analysis; - } - return 0; -} - - -/* write a Xing VBR header frame */ -int -lame_set_bWriteVbrTag(lame_global_flags * gfp, int bWriteVbrTag) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 1 (on) for VBR/ABR modes, 0 (off) for CBR mode */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > bWriteVbrTag || 1 < bWriteVbrTag) - return -1; - gfp->write_lame_tag = bWriteVbrTag; - return 0; - } - return -1; -} - -int -lame_get_bWriteVbrTag(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->write_lame_tag && 1 >= gfp->write_lame_tag); - return gfp->write_lame_tag; - } - return 0; -} - - - -/* decode only, use lame/mpglib to convert mp3 to wav */ -int -lame_set_decode_only(lame_global_flags * gfp, int decode_only) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > decode_only || 1 < decode_only) - return -1; - gfp->decode_only = decode_only; - return 0; - } - return -1; -} - -int -lame_get_decode_only(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->decode_only && 1 >= gfp->decode_only); - return gfp->decode_only; - } - return 0; -} - - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -/* 1=encode a Vorbis .ogg file. default=0 */ -/* DEPRECATED */ -int CDECL lame_set_ogg(lame_global_flags *, int); -int CDECL lame_get_ogg(const lame_global_flags *); -#else -#endif - -/* encode a Vorbis .ogg file */ -/* DEPRECATED */ -int -lame_set_ogg(lame_global_flags * gfp, int ogg) -{ - (void) gfp; - (void) ogg; - return -1; -} - -int -lame_get_ogg(const lame_global_flags * gfp) -{ - (void) gfp; - return 0; -} - - -/* - * Internal algorithm selection. - * True quality is determined by the bitrate but this variable will effect - * quality by selecting expensive or cheap algorithms. - * quality=0..9. 0=best (very slow). 9=worst. - * recommended: 3 near-best quality, not too slow - * 5 good quality, fast - * 7 ok quality, really fast - */ -int -lame_set_quality(lame_global_flags * gfp, int quality) -{ - if (is_lame_global_flags_valid(gfp)) { - if (quality < 0) { - gfp->quality = 0; - } - else if (quality > 9) { - gfp->quality = 9; - } - else { - gfp->quality = quality; - } - return 0; - } - return -1; -} - -int -lame_get_quality(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->quality; - } - return 0; -} - - -/* mode = STEREO, JOINT_STEREO, DUAL_CHANNEL (not supported), MONO */ -int -lame_set_mode(lame_global_flags * gfp, MPEG_mode mode) -{ - if (is_lame_global_flags_valid(gfp)) { - int mpg_mode = mode; - /* default: lame chooses based on compression ratio and input channels */ - if (mpg_mode < 0 || MAX_INDICATOR <= mpg_mode) - return -1; /* Unknown MPEG mode! */ - gfp->mode = mode; - return 0; - } - return -1; -} - -MPEG_mode -lame_get_mode(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(gfp->mode < MAX_INDICATOR); - return gfp->mode; - } - return NOT_SET; -} - - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -/* - mode_automs. Use a M/S mode with a switching threshold based on - compression ratio - DEPRECATED -*/ -int CDECL lame_set_mode_automs(lame_global_flags *, int); -int CDECL lame_get_mode_automs(const lame_global_flags *); -#else -#endif - -/* Us a M/S mode with a switching threshold based on compression ratio */ -/* DEPRECATED */ -int -lame_set_mode_automs(lame_global_flags * gfp, int mode_automs) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > mode_automs || 1 < mode_automs) - return -1; - lame_set_mode(gfp, JOINT_STEREO); - return 0; - } - return -1; -} - -int -lame_get_mode_automs(const lame_global_flags * gfp) -{ - (void) gfp; - return 1; -} - - -/* - * Force M/S for all frames. For testing only. - * Requires mode = 1. - */ -int -lame_set_force_ms(lame_global_flags * gfp, int force_ms) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > force_ms || 1 < force_ms) - return -1; - gfp->force_ms = force_ms; - return 0; - } - return -1; -} - -int -lame_get_force_ms(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->force_ms && 1 >= gfp->force_ms); - return gfp->force_ms; - } - return 0; -} - - -/* Use free_format. */ -int -lame_set_free_format(lame_global_flags * gfp, int free_format) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > free_format || 1 < free_format) - return -1; - gfp->free_format = free_format; - return 0; - } - return -1; -} - -int -lame_get_free_format(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->free_format && 1 >= gfp->free_format); - return gfp->free_format; - } - return 0; -} - - - -/* Perform ReplayGain analysis */ -int -lame_set_findReplayGain(lame_global_flags * gfp, int findReplayGain) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > findReplayGain || 1 < findReplayGain) - return -1; - gfp->findReplayGain = findReplayGain; - return 0; - } - return -1; -} - -int -lame_get_findReplayGain(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->findReplayGain && 1 >= gfp->findReplayGain); - return gfp->findReplayGain; - } - return 0; -} - - -/* Decode on the fly. Find the peak sample. If ReplayGain analysis is - enabled then perform it on the decoded data. */ -int -lame_set_decode_on_the_fly(lame_global_flags * gfp, int decode_on_the_fly) -{ - if (is_lame_global_flags_valid(gfp)) { -#ifndef DECODE_ON_THE_FLY - return -1; -#else - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > decode_on_the_fly || 1 < decode_on_the_fly) - return -1; - - gfp->decode_on_the_fly = decode_on_the_fly; - - return 0; -#endif - } - return -1; -} - -int -lame_get_decode_on_the_fly(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->decode_on_the_fly && 1 >= gfp->decode_on_the_fly); - return gfp->decode_on_the_fly; - } - return 0; -} - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -/* DEPRECATED: now does the same as lame_set_findReplayGain() - default = 0 (disabled) */ -int CDECL lame_set_ReplayGain_input(lame_global_flags *, int); -int CDECL lame_get_ReplayGain_input(const lame_global_flags *); - -/* DEPRECATED: now does the same as - lame_set_decode_on_the_fly() && lame_set_findReplayGain() - default = 0 (disabled) */ -int CDECL lame_set_ReplayGain_decode(lame_global_flags *, int); -int CDECL lame_get_ReplayGain_decode(const lame_global_flags *); - -/* DEPRECATED: now does the same as lame_set_decode_on_the_fly() - default = 0 (disabled) */ -int CDECL lame_set_findPeakSample(lame_global_flags *, int); -int CDECL lame_get_findPeakSample(const lame_global_flags *); -#else -#endif - -/* DEPRECATED. same as lame_set_decode_on_the_fly() */ -int -lame_set_findPeakSample(lame_global_flags * gfp, int arg) -{ - return lame_set_decode_on_the_fly(gfp, arg); -} - -int -lame_get_findPeakSample(const lame_global_flags * gfp) -{ - return lame_get_decode_on_the_fly(gfp); -} - -/* DEPRECATED. same as lame_set_findReplayGain() */ -int -lame_set_ReplayGain_input(lame_global_flags * gfp, int arg) -{ - return lame_set_findReplayGain(gfp, arg); -} - -int -lame_get_ReplayGain_input(const lame_global_flags * gfp) -{ - return lame_get_findReplayGain(gfp); -} - -/* DEPRECATED. same as lame_set_decode_on_the_fly() && - lame_set_findReplayGain() */ -int -lame_set_ReplayGain_decode(lame_global_flags * gfp, int arg) -{ - if (lame_set_decode_on_the_fly(gfp, arg) < 0 || lame_set_findReplayGain(gfp, arg) < 0) - return -1; - else - return 0; -} - -int -lame_get_ReplayGain_decode(const lame_global_flags * gfp) -{ - if (lame_get_decode_on_the_fly(gfp) > 0 && lame_get_findReplayGain(gfp) > 0) - return 1; - else - return 0; -} - - -/* set and get some gapless encoding flags */ - -int -lame_set_nogap_total(lame_global_flags * gfp, int the_nogap_total) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->nogap_total = the_nogap_total; - return 0; - } - return -1; -} - -int -lame_get_nogap_total(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->nogap_total; - } - return 0; -} - -int -lame_set_nogap_currentindex(lame_global_flags * gfp, int the_nogap_index) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->nogap_current = the_nogap_index; - return 0; - } - return -1; -} - -int -lame_get_nogap_currentindex(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->nogap_current; - } - return 0; -} - - -/* message handlers */ -int -lame_set_errorf(lame_global_flags * gfp, void (*func) (const char *, va_list)) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->report.errorf = func; - return 0; - } - return -1; -} - -int -lame_set_debugf(lame_global_flags * gfp, void (*func) (const char *, va_list)) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->report.debugf = func; - return 0; - } - return -1; -} - -int -lame_set_msgf(lame_global_flags * gfp, void (*func) (const char *, va_list)) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->report.msgf = func; - return 0; - } - return -1; -} - - -/* - * Set one of - * - brate - * - compression ratio. - * - * Default is compression ratio of 11. - */ -int -lame_set_brate(lame_global_flags * gfp, int brate) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->brate = brate; - if (brate > 320) { - gfp->disable_reservoir = 1; - } - return 0; - } - return -1; -} - -int -lame_get_brate(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->brate; - } - return 0; -} - -int -lame_set_compression_ratio(lame_global_flags * gfp, float compression_ratio) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->compression_ratio = compression_ratio; - return 0; - } - return -1; -} - -float -lame_get_compression_ratio(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->compression_ratio; - } - return 0; -} - - - - -/* - * frame parameters - */ - -/* Mark as copyright protected. */ -int -lame_set_copyright(lame_global_flags * gfp, int copyright) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > copyright || 1 < copyright) - return -1; - gfp->copyright = copyright; - return 0; - } - return -1; -} - -int -lame_get_copyright(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->copyright && 1 >= gfp->copyright); - return gfp->copyright; - } - return 0; -} - - -/* Mark as original. */ -int -lame_set_original(lame_global_flags * gfp, int original) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 1 (enabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > original || 1 < original) - return -1; - gfp->original = original; - return 0; - } - return -1; -} - -int -lame_get_original(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->original && 1 >= gfp->original); - return gfp->original; - } - return 0; -} - - -/* - * error_protection. - * Use 2 bytes from each frame for CRC checksum. - */ -int -lame_set_error_protection(lame_global_flags * gfp, int error_protection) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > error_protection || 1 < error_protection) - return -1; - gfp->error_protection = error_protection; - return 0; - } - return -1; -} - -int -lame_get_error_protection(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->error_protection && 1 >= gfp->error_protection); - return gfp->error_protection; - } - return 0; -} - - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -/* padding_type. 0=pad no frames 1=pad all frames 2=adjust padding(default) */ -int CDECL lame_set_padding_type(lame_global_flags *, Padding_type); -Padding_type CDECL lame_get_padding_type(const lame_global_flags *); -#else -#endif - -/* - * padding_type. - * PAD_NO = pad no frames - * PAD_ALL = pad all frames - * PAD_ADJUST = adjust padding - */ -int -lame_set_padding_type(lame_global_flags * gfp, Padding_type padding_type) -{ - (void) gfp; - (void) padding_type; - return 0; -} - -Padding_type -lame_get_padding_type(const lame_global_flags * gfp) -{ - (void) gfp; - return PAD_ADJUST; -} - - -/* MP3 'private extension' bit. Meaningless. */ -int -lame_set_extension(lame_global_flags * gfp, int extension) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > extension || 1 < extension) - return -1; - gfp->extension = extension; - return 0; - } - return -1; -} - -int -lame_get_extension(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->extension && 1 >= gfp->extension); - return gfp->extension; - } - return 0; -} - - -/* Enforce strict ISO compliance. */ -int -lame_set_strict_ISO(lame_global_flags * gfp, int val) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (val < MDB_DEFAULT || MDB_MAXIMUM < val) - return -1; - gfp->strict_ISO = val; - return 0; - } - return -1; -} - -int -lame_get_strict_ISO(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->strict_ISO; - } - return 0; -} - - - - -/******************************************************************** - * quantization/noise shaping - ***********************************************************************/ - -/* Disable the bit reservoir. For testing only. */ -int -lame_set_disable_reservoir(lame_global_flags * gfp, int disable_reservoir) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > disable_reservoir || 1 < disable_reservoir) - return -1; - gfp->disable_reservoir = disable_reservoir; - return 0; - } - return -1; -} - -int -lame_get_disable_reservoir(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->disable_reservoir && 1 >= gfp->disable_reservoir); - return gfp->disable_reservoir; - } - return 0; -} - - - - -int -lame_set_experimentalX(lame_global_flags * gfp, int experimentalX) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_set_quant_comp(gfp, experimentalX); - lame_set_quant_comp_short(gfp, experimentalX); - return 0; - } - return -1; -} - -int -lame_get_experimentalX(const lame_global_flags * gfp) -{ - return lame_get_quant_comp(gfp); -} - - -/* Select a different "best quantization" function. default = 0 */ -int -lame_set_quant_comp(lame_global_flags * gfp, int quant_type) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->quant_comp = quant_type; - return 0; - } - return -1; -} - -int -lame_get_quant_comp(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->quant_comp; - } - return 0; -} - - -/* Select a different "best quantization" function. default = 0 */ -int -lame_set_quant_comp_short(lame_global_flags * gfp, int quant_type) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->quant_comp_short = quant_type; - return 0; - } - return -1; -} - -int -lame_get_quant_comp_short(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->quant_comp_short; - } - return 0; -} - - -/* Another experimental option. For testing only. */ -int -lame_set_experimentalY(lame_global_flags * gfp, int experimentalY) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->experimentalY = experimentalY; - return 0; - } - return -1; -} - -int -lame_get_experimentalY(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->experimentalY; - } - return 0; -} - - -int -lame_set_experimentalZ(lame_global_flags * gfp, int experimentalZ) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->experimentalZ = experimentalZ; - return 0; - } - return -1; -} - -int -lame_get_experimentalZ(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->experimentalZ; - } - return 0; -} - - -/* Naoki's psycho acoustic model. */ -int -lame_set_exp_nspsytune(lame_global_flags * gfp, int exp_nspsytune) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - gfp->exp_nspsytune = exp_nspsytune; - return 0; - } - return -1; -} - -int -lame_get_exp_nspsytune(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->exp_nspsytune; - } - return 0; -} - - - - -/******************************************************************** - * VBR control - ***********************************************************************/ - -/* Types of VBR. default = vbr_off = CBR */ -int -lame_set_VBR(lame_global_flags * gfp, vbr_mode VBR) -{ - if (is_lame_global_flags_valid(gfp)) { - int vbr_q = VBR; - if (0 > vbr_q || vbr_max_indicator <= vbr_q) - return -1; /* Unknown VBR mode! */ - gfp->VBR = VBR; - return 0; - } - return -1; -} - -vbr_mode -lame_get_VBR(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(gfp->VBR < vbr_max_indicator); - return gfp->VBR; - } - return vbr_off; -} - - -/* - * VBR quality level. - * 0 = highest - * 9 = lowest - */ -int -lame_set_VBR_q(lame_global_flags * gfp, int VBR_q) -{ - if (is_lame_global_flags_valid(gfp)) { - int ret = 0; - - if (0 > VBR_q) { - ret = -1; /* Unknown VBR quality level! */ - VBR_q = 0; - } - if (9 < VBR_q) { - ret = -1; - VBR_q = 9; - } - gfp->VBR_q = VBR_q; - gfp->VBR_q_frac = 0; - return ret; - } - return -1; -} - -int -lame_get_VBR_q(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->VBR_q && 10 > gfp->VBR_q); - return gfp->VBR_q; - } - return 0; -} - -int -lame_set_VBR_quality(lame_global_flags * gfp, float VBR_q) -{ - if (is_lame_global_flags_valid(gfp)) { - int ret = 0; - - if (0 > VBR_q) { - ret = -1; /* Unknown VBR quality level! */ - VBR_q = 0; - } - if (9.999 < VBR_q) { - ret = -1; - VBR_q = 9.999; - } - - gfp->VBR_q = (int) VBR_q; - gfp->VBR_q_frac = VBR_q - gfp->VBR_q; - - return ret; - } - return -1; -} - -float -lame_get_VBR_quality(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->VBR_q + gfp->VBR_q_frac; - } - return 0; -} - - -/* Ignored except for VBR = vbr_abr (ABR mode) */ -int -lame_set_VBR_mean_bitrate_kbps(lame_global_flags * gfp, int VBR_mean_bitrate_kbps) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->VBR_mean_bitrate_kbps = VBR_mean_bitrate_kbps; - return 0; - } - return -1; -} - -int -lame_get_VBR_mean_bitrate_kbps(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->VBR_mean_bitrate_kbps; - } - return 0; -} - -int -lame_set_VBR_min_bitrate_kbps(lame_global_flags * gfp, int VBR_min_bitrate_kbps) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->VBR_min_bitrate_kbps = VBR_min_bitrate_kbps; - return 0; - } - return -1; -} - -int -lame_get_VBR_min_bitrate_kbps(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->VBR_min_bitrate_kbps; - } - return 0; -} - -int -lame_set_VBR_max_bitrate_kbps(lame_global_flags * gfp, int VBR_max_bitrate_kbps) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->VBR_max_bitrate_kbps = VBR_max_bitrate_kbps; - return 0; - } - return -1; -} - -int -lame_get_VBR_max_bitrate_kbps(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->VBR_max_bitrate_kbps; - } - return 0; -} - - -/* - * Strictly enforce VBR_min_bitrate. - * Normally it will be violated for analog silence. - */ -int -lame_set_VBR_hard_min(lame_global_flags * gfp, int VBR_hard_min) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 (disabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > VBR_hard_min || 1 < VBR_hard_min) - return -1; - - gfp->VBR_hard_min = VBR_hard_min; - - return 0; - } - return -1; -} - -int -lame_get_VBR_hard_min(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->VBR_hard_min && 1 >= gfp->VBR_hard_min); - return gfp->VBR_hard_min; - } - return 0; -} - - -/******************************************************************** - * Filtering control - ***********************************************************************/ - -/* - * Freqency in Hz to apply lowpass. - * 0 = default = lame chooses - * -1 = disabled - */ -int -lame_set_lowpassfreq(lame_global_flags * gfp, int lowpassfreq) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->lowpassfreq = lowpassfreq; - return 0; - } - return -1; -} - -int -lame_get_lowpassfreq(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->lowpassfreq; - } - return 0; -} - - -/* - * Width of transition band (in Hz). - * default = one polyphase filter band - */ -int -lame_set_lowpasswidth(lame_global_flags * gfp, int lowpasswidth) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->lowpasswidth = lowpasswidth; - return 0; - } - return -1; -} - -int -lame_get_lowpasswidth(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->lowpasswidth; - } - return 0; -} - - -/* - * Frequency in Hz to apply highpass. - * 0 = default = lame chooses - * -1 = disabled - */ -int -lame_set_highpassfreq(lame_global_flags * gfp, int highpassfreq) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->highpassfreq = highpassfreq; - return 0; - } - return -1; -} - -int -lame_get_highpassfreq(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->highpassfreq; - } - return 0; -} - - -/* - * Width of transition band (in Hz). - * default = one polyphase filter band - */ -int -lame_set_highpasswidth(lame_global_flags * gfp, int highpasswidth) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->highpasswidth = highpasswidth; - return 0; - } - return -1; -} - -int -lame_get_highpasswidth(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->highpasswidth; - } - return 0; -} - - - - -/* - * psycho acoustics and other arguments which you should not change - * unless you know what you are doing - */ - - -/* Adjust masking values. */ -int -lame_set_maskingadjust(lame_global_flags * gfp, float adjust) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->maskingadjust = adjust; - return 0; - } - return -1; -} - -float -lame_get_maskingadjust(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->maskingadjust; - } - return 0; -} - -int -lame_set_maskingadjust_short(lame_global_flags * gfp, float adjust) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->maskingadjust_short = adjust; - return 0; - } - return -1; -} - -float -lame_get_maskingadjust_short(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->maskingadjust_short; - } - return 0; -} - -/* Only use ATH for masking. */ -int -lame_set_ATHonly(lame_global_flags * gfp, int ATHonly) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->ATHonly = ATHonly; - return 0; - } - return -1; -} - -int -lame_get_ATHonly(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->ATHonly; - } - return 0; -} - - -/* Only use ATH for short blocks. */ -int -lame_set_ATHshort(lame_global_flags * gfp, int ATHshort) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->ATHshort = ATHshort; - return 0; - } - return -1; -} - -int -lame_get_ATHshort(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->ATHshort; - } - return 0; -} - - -/* Disable ATH. */ -int -lame_set_noATH(lame_global_flags * gfp, int noATH) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->noATH = noATH; - return 0; - } - return -1; -} - -int -lame_get_noATH(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->noATH; - } - return 0; -} - - -/* Select ATH formula. */ -int -lame_set_ATHtype(lame_global_flags * gfp, int ATHtype) -{ - if (is_lame_global_flags_valid(gfp)) { - /* XXX: ATHtype should be converted to an enum. */ - gfp->ATHtype = ATHtype; - return 0; - } - return -1; -} - -int -lame_get_ATHtype(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->ATHtype; - } - return 0; -} - - -/* Select ATH formula 4 shape. */ -int -lame_set_ATHcurve(lame_global_flags * gfp, float ATHcurve) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->ATHcurve = ATHcurve; - return 0; - } - return -1; -} - -float -lame_get_ATHcurve(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->ATHcurve; - } - return 0; -} - - -/* Lower ATH by this many db. */ -int -lame_set_ATHlower(lame_global_flags * gfp, float ATHlower) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->ATH_lower_db = ATHlower; - return 0; - } - return -1; -} - -float -lame_get_ATHlower(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->ATH_lower_db; - } - return 0; -} - - -/* Select ATH adaptive adjustment scheme. */ -int -lame_set_athaa_type(lame_global_flags * gfp, int athaa_type) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->athaa_type = athaa_type; - return 0; - } - return -1; -} - -int -lame_get_athaa_type(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->athaa_type; - } - return 0; -} - - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -int CDECL lame_set_athaa_loudapprox(lame_global_flags * gfp, int athaa_loudapprox); -int CDECL lame_get_athaa_loudapprox(const lame_global_flags * gfp); -#else -#endif - -/* Select the loudness approximation used by the ATH adaptive auto-leveling. */ -int -lame_set_athaa_loudapprox(lame_global_flags * gfp, int athaa_loudapprox) -{ - (void) gfp; - (void) athaa_loudapprox; - return 0; -} - -int -lame_get_athaa_loudapprox(const lame_global_flags * gfp) -{ - (void) gfp; - /* obsolete, the type known under number 2 is the only survival */ - return 2; -} - - -/* Adjust (in dB) the point below which adaptive ATH level adjustment occurs. */ -int -lame_set_athaa_sensitivity(lame_global_flags * gfp, float athaa_sensitivity) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->athaa_sensitivity = athaa_sensitivity; - return 0; - } - return -1; -} - -float -lame_get_athaa_sensitivity(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->athaa_sensitivity; - } - return 0; -} - - -/* Predictability limit (ISO tonality formula) */ -int lame_set_cwlimit(lame_global_flags * gfp, int cwlimit); -int lame_get_cwlimit(const lame_global_flags * gfp); - -int -lame_set_cwlimit(lame_global_flags * gfp, int cwlimit) -{ - (void) gfp; - (void) cwlimit; - return 0; -} - -int -lame_get_cwlimit(const lame_global_flags * gfp) -{ - (void) gfp; - return 0; -} - - - -/* - * Allow blocktypes to differ between channels. - * default: - * 0 for jstereo => block types coupled - * 1 for stereo => block types may differ - */ -int -lame_set_allow_diff_short(lame_global_flags * gfp, int allow_diff_short) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->short_blocks = allow_diff_short ? short_block_allowed : short_block_coupled; - return 0; - } - return -1; -} - -int -lame_get_allow_diff_short(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - if (gfp->short_blocks == short_block_allowed) - return 1; /* short blocks allowed to differ */ - else - return 0; /* not set, dispensed, forced or coupled */ - } - return 0; -} - - -/* Use temporal masking effect */ -int -lame_set_useTemporal(lame_global_flags * gfp, int useTemporal) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 1 (enabled) */ - - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 <= useTemporal && useTemporal <= 1) { - gfp->useTemporal = useTemporal; - return 0; - } - } - return -1; -} - -int -lame_get_useTemporal(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->useTemporal && 1 >= gfp->useTemporal); - return gfp->useTemporal; - } - return 0; -} - - -/* Use inter-channel masking effect */ -int -lame_set_interChRatio(lame_global_flags * gfp, float ratio) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0.0 (no inter-channel maskin) */ - if (0 <= ratio && ratio <= 1.0) { - gfp->interChRatio = ratio; - return 0; - } - } - return -1; -} - -float -lame_get_interChRatio(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert((0 <= gfp->interChRatio && gfp->interChRatio <= 1.0) || EQ(gfp->interChRatio, -1)); - return gfp->interChRatio; - } - return 0; -} - - -/* Use pseudo substep shaping method */ -int -lame_set_substep(lame_global_flags * gfp, int method) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0.0 (no substep noise shaping) */ - if (0 <= method && method <= 7) { - gfp->substep_shaping = method; - return 0; - } - } - return -1; -} - -int -lame_get_substep(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->substep_shaping && gfp->substep_shaping <= 7); - return gfp->substep_shaping; - } - return 0; -} - -/* scalefactors scale */ -int -lame_set_sfscale(lame_global_flags * gfp, int val) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->noise_shaping = (val != 0) ? 2 : 1; - return 0; - } - return -1; -} - -int -lame_get_sfscale(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return (gfp->noise_shaping == 2) ? 1 : 0; - } - return 0; -} - -/* subblock gain */ -int -lame_set_subblock_gain(lame_global_flags * gfp, int sbgain) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->subblock_gain = sbgain; - return 0; - } - return -1; -} - -int -lame_get_subblock_gain(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->subblock_gain; - } - return 0; -} - - -/* Disable short blocks. */ -int -lame_set_no_short_blocks(lame_global_flags * gfp, int no_short_blocks) -{ - if (is_lame_global_flags_valid(gfp)) { - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 <= no_short_blocks && no_short_blocks <= 1) { - gfp->short_blocks = no_short_blocks ? short_block_dispensed : short_block_allowed; - return 0; - } - } - return -1; -} - -int -lame_get_no_short_blocks(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - switch (gfp->short_blocks) { - default: - case short_block_not_set: - return -1; - case short_block_dispensed: - return 1; - case short_block_allowed: - case short_block_coupled: - case short_block_forced: - return 0; - } - } - return -1; -} - - -/* Force short blocks. */ -int -lame_set_force_short_blocks(lame_global_flags * gfp, int short_blocks) -{ - if (is_lame_global_flags_valid(gfp)) { - /* enforce disable/enable meaning, if we need more than two values - we need to switch to an enum to have an apropriate representation - of the possible meanings of the value */ - if (0 > short_blocks || 1 < short_blocks) - return -1; - - if (short_blocks == 1) - gfp->short_blocks = short_block_forced; - else if (gfp->short_blocks == short_block_forced) - gfp->short_blocks = short_block_allowed; - - return 0; - } - return -1; -} - -int -lame_get_force_short_blocks(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - switch (gfp->short_blocks) { - default: - case short_block_not_set: - return -1; - case short_block_dispensed: - case short_block_allowed: - case short_block_coupled: - return 0; - case short_block_forced: - return 1; - } - } - return -1; -} - -int -lame_set_short_threshold_lrm(lame_global_flags * gfp, float lrm) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->attackthre = lrm; - return 0; - } - return -1; -} - -float -lame_get_short_threshold_lrm(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->attackthre; - } - return 0; -} - -int -lame_set_short_threshold_s(lame_global_flags * gfp, float s) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->attackthre_s = s; - return 0; - } - return -1; -} - -float -lame_get_short_threshold_s(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->attackthre_s; - } - return 0; -} - -int -lame_set_short_threshold(lame_global_flags * gfp, float lrm, float s) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_set_short_threshold_lrm(gfp, lrm); - lame_set_short_threshold_s(gfp, s); - return 0; - } - return -1; -} - - -/* - * Input PCM is emphased PCM - * (for instance from one of the rarely emphased CDs). - * - * It is STRONGLY not recommended to use this, because psycho does not - * take it into account, and last but not least many decoders - * ignore these bits - */ -int -lame_set_emphasis(lame_global_flags * gfp, int emphasis) -{ - if (is_lame_global_flags_valid(gfp)) { - /* XXX: emphasis should be converted to an enum */ - if (0 <= emphasis && emphasis < 4) { - gfp->emphasis = emphasis; - return 0; - } - } - return -1; -} - -int -lame_get_emphasis(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - assert(0 <= gfp->emphasis && gfp->emphasis < 4); - return gfp->emphasis; - } - return 0; -} - - - - -/***************************************************************/ -/* internal variables, cannot be set... */ -/* provided because they may be of use to calling application */ -/***************************************************************/ - -/* MPEG version. - * 0 = MPEG-2 - * 1 = MPEG-1 - * (2 = MPEG-2.5) - */ -int -lame_get_version(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->cfg.version; - } - } - return 0; -} - - -/* Encoder delay. */ -int -lame_get_encoder_delay(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->ov_enc.encoder_delay; - } - } - return 0; -} - -/* padding added to the end of the input */ -int -lame_get_encoder_padding(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->ov_enc.encoder_padding; - } - } - return 0; -} - - -/* Size of MPEG frame. */ -int -lame_get_framesize(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - SessionConfig_t const *const cfg = &gfc->cfg; - return 576 * cfg->mode_gr; - } - } - return 0; -} - - -/* Number of frames encoded so far. */ -int -lame_get_frameNum(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->ov_enc.frame_number; - } - } - return 0; -} - -int -lame_get_mf_samples_to_encode(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->sv_enc.mf_samples_to_encode; - } - } - return 0; -} - -int CDECL -lame_get_size_mp3buffer(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - int size; - compute_flushbits(gfc, &size); - return size; - } - } - return 0; -} - -int -lame_get_RadioGain(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->ov_rpg.RadioGain; - } - } - return 0; -} - -int -lame_get_AudiophileGain(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return 0; - } - } - return 0; -} - -float -lame_get_PeakSample(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return (float) gfc->ov_rpg.PeakSample; - } - } - return 0; -} - -int -lame_get_noclipGainChange(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->ov_rpg.noclipGainChange; - } - } - return 0; -} - -float -lame_get_noclipScale(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - return gfc->ov_rpg.noclipScale; - } - } - return 0; -} - - -/* - * LAME's estimate of the total number of frames to be encoded. - * Only valid if calling program set num_samples. - */ -int -lame_get_totalframes(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - lame_internal_flags const *const gfc = gfp->internal_flags; - if (is_lame_internal_flags_valid(gfc)) { - SessionConfig_t const *const cfg = &gfc->cfg; - unsigned long const pcm_samples_per_frame = 576 * cfg->mode_gr; - unsigned long pcm_samples_to_encode = gfp->num_samples; - unsigned long end_padding = 0; - - /* estimate based on user set num_samples: */ - if (pcm_samples_to_encode == (0ul-1ul)) { - return 0; - } - if (gfp->samplerate_in != gfp->samplerate_out && gfp->samplerate_in > 0) { - double const q = (double)gfp->samplerate_out / gfp->samplerate_in; - pcm_samples_to_encode *= q; - } - pcm_samples_to_encode += 576; - end_padding = pcm_samples_per_frame - (pcm_samples_to_encode % pcm_samples_per_frame); - if (end_padding < 576) { - end_padding += pcm_samples_per_frame; - } - pcm_samples_to_encode += end_padding; - /* check to see if we underestimated totalframes */ - /* if (totalframes < gfp->frameNum) */ - /* totalframes = gfp->frameNum; */ - return pcm_samples_to_encode / pcm_samples_per_frame; - } - } - return 0; -} - - - - - -int -lame_set_preset(lame_global_flags * gfp, int preset) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->preset = preset; - return apply_preset(gfp, preset, 1); - } - return -1; -} - - - -int -lame_set_asm_optimizations(lame_global_flags * gfp, int optim, int mode) -{ - if (is_lame_global_flags_valid(gfp)) { - mode = (mode == 1 ? 1 : 0); - switch (optim) { - case MMX:{ - gfp->asm_optimizations.mmx = mode; - return optim; - } - case AMD_3DNOW:{ - gfp->asm_optimizations.amd3dnow = mode; - return optim; - } - case SSE:{ - gfp->asm_optimizations.sse = mode; - return optim; - } - default: - return optim; - } - } - return -1; -} - - -void -lame_set_write_id3tag_automatic(lame_global_flags * gfp, int v) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->write_id3tag_automatic = v; - } -} - - -int -lame_get_write_id3tag_automatic(lame_global_flags const *gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->write_id3tag_automatic; - } - return 1; -} - - -/* - -UNDOCUMENTED, experimental settings. These routines are not prototyped -in lame.h. You should not use them, they are experimental and may -change. - -*/ - - -/* - * just another daily changing developer switch - */ -void CDECL lame_set_tune(lame_global_flags *, float); - -void -lame_set_tune(lame_global_flags * gfp, float val) -{ - if (is_lame_global_flags_valid(gfp)) { - gfp->tune_value_a = val; - gfp->tune = 1; - } -} - -/* Custom msfix hack */ -void -lame_set_msfix(lame_global_flags * gfp, double msfix) -{ - if (is_lame_global_flags_valid(gfp)) { - /* default = 0 */ - gfp->msfix = msfix; - } -} - -float -lame_get_msfix(const lame_global_flags * gfp) -{ - if (is_lame_global_flags_valid(gfp)) { - return gfp->msfix; - } - return 0; -} - -#if DEPRECATED_OR_OBSOLETE_CODE_REMOVED -int CDECL lame_set_preset_expopts(lame_global_flags *, int); -#else -#endif - -int -lame_set_preset_expopts(lame_global_flags * gfp, int preset_expopts) -{ - (void) gfp; - (void) preset_expopts; - return 0; -} - - -int -lame_set_preset_notune(lame_global_flags * gfp, int preset_notune) -{ - (void) gfp; - (void) preset_notune; - return 0; -} diff --git a/src/lib/dl/ext/lame/set_get.h b/src/lib/dl/ext/lame/set_get.h deleted file mode 100755 index 37e4bcdb..00000000 --- a/src/lib/dl/ext/lame/set_get.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * set_get.h -- Internal set/get definitions - * - * Copyright (C) 2003 Gabriel Bouvigne / Lame project - * - * 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 __SET_GET_H__ -#define __SET_GET_H__ - -#include <lame.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -/* select psychoacoustic model */ - -/* manage short blocks */ - int CDECL lame_set_short_threshold(lame_global_flags *, float, float); - int CDECL lame_set_short_threshold_lrm(lame_global_flags *, float); - float CDECL lame_get_short_threshold_lrm(const lame_global_flags *); - int CDECL lame_set_short_threshold_s(lame_global_flags *, float); - float CDECL lame_get_short_threshold_s(const lame_global_flags *); - - - int CDECL lame_set_maskingadjust(lame_global_flags *, float); - float CDECL lame_get_maskingadjust(const lame_global_flags *); - - int CDECL lame_set_maskingadjust_short(lame_global_flags *, float); - float CDECL lame_get_maskingadjust_short(const lame_global_flags *); - -/* select ATH formula 4 shape */ - int CDECL lame_set_ATHcurve(lame_global_flags *, float); - float CDECL lame_get_ATHcurve(const lame_global_flags *); - - int CDECL lame_set_preset_notune(lame_global_flags *, int); - -/* substep shaping method */ - int CDECL lame_set_substep(lame_global_flags *, int); - int CDECL lame_get_substep(const lame_global_flags *); - -/* scalefactors scale */ - int CDECL lame_set_sfscale(lame_global_flags *, int); - int CDECL lame_get_sfscale(const lame_global_flags *); - -/* subblock gain */ - int CDECL lame_set_subblock_gain(lame_global_flags *, int); - int CDECL lame_get_subblock_gain(const lame_global_flags *); - - - -/*presets*/ - int apply_preset(lame_global_flags *, int preset, int enforce); - - void CDECL lame_set_tune(lame_t, float); /* FOR INTERNAL USE ONLY */ - void CDECL lame_set_msfix(lame_t gfp, double msfix); - - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/src/lib/dl/ext/lame/tabinit.c b/src/lib/dl/ext/lame/tabinit.c deleted file mode 100755 index 813e4ff0..00000000 --- a/src/lib/dl/ext/lame/tabinit.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * tabinit.c - * - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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. - */ -/* $Id: tabinit.c,v 1.16 2010/03/22 14:30:19 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdlib.h> -#include "tabinit.h" -#include "mpg123.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -real decwin[512 + 32]; -static real cos64[16], cos32[8], cos16[4], cos8[2], cos4[1]; -real *pnts[] = { cos64, cos32, cos16, cos8, cos4 }; - -/* *INDENT-OFF* */ - -static 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 -}; -/* *INDENT-ON* */ - -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 < kr; k++) - costab[k] = (real) (1.0 / (2.0 * cos(M_PI * ((double) k * 2.0 + 1.0) / (double) divv))); - } - - table = decwin; - scaleval = -scaleval; - for (i = 0, j = 0; i < 256; i++, j++, table += 32) { - if (table < decwin + 512 + 16) - table[16] = table[0] = (real) (dewin[j] * scaleval); - if (i % 32 == 31) - table -= 1023; - if (i % 64 == 63) - scaleval = -scaleval; - } - - for ( /* i=256 */ ; i < 512; i++, j--, table += 32) { - if (table < decwin + 512 + 16) - table[16] = table[0] = (real) (dewin[j] * scaleval); - if (i % 32 == 31) - table -= 1023; - if (i % 64 == 63) - scaleval = -scaleval; - } -} diff --git a/src/lib/dl/ext/lame/tabinit.h b/src/lib/dl/ext/lame/tabinit.h deleted file mode 100755 index 76f4c42a..00000000 --- a/src/lib/dl/ext/lame/tabinit.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 1999-2010 The L.A.M.E. project - * - * Initially written by Michael Hipp, see also AUTHORS and README. - * - * 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 MPGLIB_TABINIT_H_INCLUDED -#define MPGLIB_TABINIT_H_INCLUDED - -#include "mpg123.h" - -extern real decwin[512 + 32]; -extern real *pnts[5]; - -void make_decode_tables(long scale); - -#endif diff --git a/src/lib/dl/ext/lame/tables.c b/src/lib/dl/ext/lame/tables.c deleted file mode 100755 index a0230999..00000000 --- a/src/lib/dl/ext/lame/tables.c +++ /dev/null @@ -1,564 +0,0 @@ -/* - * MPEG layer 3 tables source file - * - * Copyright (c) 1999 Albert 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. - */ - -/* $Id: tables.c,v 1.29 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "machine.h" - -#include "lame.h" -#include "tables.h" - - -static const uint16_t t1HB[] = { - 1, 1, - 1, 0 -}; - -static const uint16_t t2HB[] = { - 1, 2, 1, - 3, 1, 1, - 3, 2, 0 -}; - -static const uint16_t t3HB[] = { - 3, 2, 1, - 1, 1, 1, - 3, 2, 0 -}; - -static const uint16_t t5HB[] = { - 1, 2, 6, 5, - 3, 1, 4, 4, - 7, 5, 7, 1, - 6, 1, 1, 0 -}; - -static const uint16_t t6HB[] = { - 7, 3, 5, 1, - 6, 2, 3, 2, - 5, 4, 4, 1, - 3, 3, 2, 0 -}; - -static const uint16_t t7HB[] = { - 1, 2, 10, 19, 16, 10, - 3, 3, 7, 10, 5, 3, - 11, 4, 13, 17, 8, 4, - 12, 11, 18, 15, 11, 2, - 7, 6, 9, 14, 3, 1, - 6, 4, 5, 3, 2, 0 -}; - -static const uint16_t t8HB[] = { - 3, 4, 6, 18, 12, 5, - 5, 1, 2, 16, 9, 3, - 7, 3, 5, 14, 7, 3, - 19, 17, 15, 13, 10, 4, - 13, 5, 8, 11, 5, 1, - 12, 4, 4, 1, 1, 0 -}; - -static const uint16_t t9HB[] = { - 7, 5, 9, 14, 15, 7, - 6, 4, 5, 5, 6, 7, - 7, 6, 8, 8, 8, 5, - 15, 6, 9, 10, 5, 1, - 11, 7, 9, 6, 4, 1, - 14, 4, 6, 2, 6, 0 -}; - -static const uint16_t t10HB[] = { - 1, 2, 10, 23, 35, 30, 12, 17, - 3, 3, 8, 12, 18, 21, 12, 7, - 11, 9, 15, 21, 32, 40, 19, 6, - 14, 13, 22, 34, 46, 23, 18, 7, - 20, 19, 33, 47, 27, 22, 9, 3, - 31, 22, 41, 26, 21, 20, 5, 3, - 14, 13, 10, 11, 16, 6, 5, 1, - 9, 8, 7, 8, 4, 4, 2, 0 -}; - -static const uint16_t t11HB[] = { - 3, 4, 10, 24, 34, 33, 21, 15, - 5, 3, 4, 10, 32, 17, 11, 10, - 11, 7, 13, 18, 30, 31, 20, 5, - 25, 11, 19, 59, 27, 18, 12, 5, - 35, 33, 31, 58, 30, 16, 7, 5, - 28, 26, 32, 19, 17, 15, 8, 14, - 14, 12, 9, 13, 14, 9, 4, 1, - 11, 4, 6, 6, 6, 3, 2, 0 -}; - -static const uint16_t t12HB[] = { - 9, 6, 16, 33, 41, 39, 38, 26, - 7, 5, 6, 9, 23, 16, 26, 11, - 17, 7, 11, 14, 21, 30, 10, 7, - 17, 10, 15, 12, 18, 28, 14, 5, - 32, 13, 22, 19, 18, 16, 9, 5, - 40, 17, 31, 29, 17, 13, 4, 2, - 27, 12, 11, 15, 10, 7, 4, 1, - 27, 12, 8, 12, 6, 3, 1, 0 -}; - -static const uint16_t t13HB[] = { - 1, 5, 14, 21, 34, 51, 46, 71, 42, 52, 68, 52, 67, 44, 43, 19, - 3, 4, 12, 19, 31, 26, 44, 33, 31, 24, 32, 24, 31, 35, 22, 14, - 15, 13, 23, 36, 59, 49, 77, 65, 29, 40, 30, 40, 27, 33, 42, 16, - 22, 20, 37, 61, 56, 79, 73, 64, 43, 76, 56, 37, 26, 31, 25, 14, - 35, 16, 60, 57, 97, 75, 114, 91, 54, 73, 55, 41, 48, 53, 23, 24, - 58, 27, 50, 96, 76, 70, 93, 84, 77, 58, 79, 29, 74, 49, 41, 17, - 47, 45, 78, 74, 115, 94, 90, 79, 69, 83, 71, 50, 59, 38, 36, 15, - 72, 34, 56, 95, 92, 85, 91, 90, 86, 73, 77, 65, 51, 44, 43, 42, - 43, 20, 30, 44, 55, 78, 72, 87, 78, 61, 46, 54, 37, 30, 20, 16, - 53, 25, 41, 37, 44, 59, 54, 81, 66, 76, 57, 54, 37, 18, 39, 11, - 35, 33, 31, 57, 42, 82, 72, 80, 47, 58, 55, 21, 22, 26, 38, 22, - 53, 25, 23, 38, 70, 60, 51, 36, 55, 26, 34, 23, 27, 14, 9, 7, - 34, 32, 28, 39, 49, 75, 30, 52, 48, 40, 52, 28, 18, 17, 9, 5, - 45, 21, 34, 64, 56, 50, 49, 45, 31, 19, 12, 15, 10, 7, 6, 3, - 48, 23, 20, 39, 36, 35, 53, 21, 16, 23, 13, 10, 6, 1, 4, 2, - 16, 15, 17, 27, 25, 20, 29, 11, 17, 12, 16, 8, 1, 1, 0, 1 -}; - -static const uint16_t t15HB[] = { - 7, 12, 18, 53, 47, 76, 124, 108, 89, 123, 108, 119, 107, 81, 122, 63, - 13, 5, 16, 27, 46, 36, 61, 51, 42, 70, 52, 83, 65, 41, 59, 36, - 19, 17, 15, 24, 41, 34, 59, 48, 40, 64, 50, 78, 62, 80, 56, 33, - 29, 28, 25, 43, 39, 63, 55, 93, 76, 59, 93, 72, 54, 75, 50, 29, - 52, 22, 42, 40, 67, 57, 95, 79, 72, 57, 89, 69, 49, 66, 46, 27, - 77, 37, 35, 66, 58, 52, 91, 74, 62, 48, 79, 63, 90, 62, 40, 38, - 125, 32, 60, 56, 50, 92, 78, 65, 55, 87, 71, 51, 73, 51, 70, 30, - 109, 53, 49, 94, 88, 75, 66, 122, 91, 73, 56, 42, 64, 44, 21, 25, - 90, 43, 41, 77, 73, 63, 56, 92, 77, 66, 47, 67, 48, 53, 36, 20, - 71, 34, 67, 60, 58, 49, 88, 76, 67, 106, 71, 54, 38, 39, 23, 15, - 109, 53, 51, 47, 90, 82, 58, 57, 48, 72, 57, 41, 23, 27, 62, 9, - 86, 42, 40, 37, 70, 64, 52, 43, 70, 55, 42, 25, 29, 18, 11, 11, - 118, 68, 30, 55, 50, 46, 74, 65, 49, 39, 24, 16, 22, 13, 14, 7, - 91, 44, 39, 38, 34, 63, 52, 45, 31, 52, 28, 19, 14, 8, 9, 3, - 123, 60, 58, 53, 47, 43, 32, 22, 37, 24, 17, 12, 15, 10, 2, 1, - 71, 37, 34, 30, 28, 20, 17, 26, 21, 16, 10, 6, 8, 6, 2, 0 -}; - -static const uint16_t t16HB[] = { - 1, 5, 14, 44, 74, 63, 110, 93, 172, 149, 138, 242, 225, 195, 376, 17, - 3, 4, 12, 20, 35, 62, 53, 47, 83, 75, 68, 119, 201, 107, 207, 9, - 15, 13, 23, 38, 67, 58, 103, 90, 161, 72, 127, 117, 110, 209, 206, 16, - 45, 21, 39, 69, 64, 114, 99, 87, 158, 140, 252, 212, 199, 387, 365, 26, - 75, 36, 68, 65, 115, 101, 179, 164, 155, 264, 246, 226, 395, 382, 362, 9, - 66, 30, 59, 56, 102, 185, 173, 265, 142, 253, 232, 400, 388, 378, 445, 16, - 111, 54, 52, 100, 184, 178, 160, 133, 257, 244, 228, 217, 385, 366, 715, 10, - 98, 48, 91, 88, 165, 157, 148, 261, 248, 407, 397, 372, 380, 889, 884, 8, - 85, 84, 81, 159, 156, 143, 260, 249, 427, 401, 392, 383, 727, 713, 708, 7, - 154, 76, 73, 141, 131, 256, 245, 426, 406, 394, 384, 735, 359, 710, 352, 11, - 139, 129, 67, 125, 247, 233, 229, 219, 393, 743, 737, 720, 885, 882, 439, 4, - 243, 120, 118, 115, 227, 223, 396, 746, 742, 736, 721, 712, 706, 223, 436, 6, - 202, 224, 222, 218, 216, 389, 386, 381, 364, 888, 443, 707, 440, 437, 1728, 4, - 747, 211, 210, 208, 370, 379, 734, 723, 714, 1735, 883, 877, 876, 3459, 865, 2, - 377, 369, 102, 187, 726, 722, 358, 711, 709, 866, 1734, 871, 3458, 870, 434, 0, - 12, 10, 7, 11, 10, 17, 11, 9, 13, 12, 10, 7, 5, 3, 1, 3 -}; - -static const uint16_t t24HB[] = { - 15, 13, 46, 80, 146, 262, 248, 434, 426, 669, 653, 649, 621, 517, 1032, 88, - 14, 12, 21, 38, 71, 130, 122, 216, 209, 198, 327, 345, 319, 297, 279, 42, - 47, 22, 41, 74, 68, 128, 120, 221, 207, 194, 182, 340, 315, 295, 541, 18, - 81, 39, 75, 70, 134, 125, 116, 220, 204, 190, 178, 325, 311, 293, 271, 16, - 147, 72, 69, 135, 127, 118, 112, 210, 200, 188, 352, 323, 306, 285, 540, 14, - 263, 66, 129, 126, 119, 114, 214, 202, 192, 180, 341, 317, 301, 281, 262, 12, - 249, 123, 121, 117, 113, 215, 206, 195, 185, 347, 330, 308, 291, 272, 520, 10, - 435, 115, 111, 109, 211, 203, 196, 187, 353, 332, 313, 298, 283, 531, 381, 17, - 427, 212, 208, 205, 201, 193, 186, 177, 169, 320, 303, 286, 268, 514, 377, 16, - 335, 199, 197, 191, 189, 181, 174, 333, 321, 305, 289, 275, 521, 379, 371, 11, - 668, 184, 183, 179, 175, 344, 331, 314, 304, 290, 277, 530, 383, 373, 366, 10, - 652, 346, 171, 168, 164, 318, 309, 299, 287, 276, 263, 513, 375, 368, 362, 6, - 648, 322, 316, 312, 307, 302, 292, 284, 269, 261, 512, 376, 370, 364, 359, 4, - 620, 300, 296, 294, 288, 282, 273, 266, 515, 380, 374, 369, 365, 361, 357, 2, - 1033, 280, 278, 274, 267, 264, 259, 382, 378, 372, 367, 363, 360, 358, 356, 0, - 43, 20, 19, 17, 15, 13, 11, 9, 7, 6, 4, 7, 5, 3, 1, 3 -}; - -static const uint16_t t32HB[] = { - 1 << 0, 5 << 1, 4 << 1, 5 << 2, 6 << 1, 5 << 2, 4 << 2, 4 << 3, - 7 << 1, 3 << 2, 6 << 2, 0 << 3, 7 << 2, 2 << 3, 3 << 3, 1 << 4 -}; - -static const uint16_t t33HB[] = { - 15 << 0, 14 << 1, 13 << 1, 12 << 2, 11 << 1, 10 << 2, 9 << 2, 8 << 3, - 7 << 1, 6 << 2, 5 << 2, 4 << 3, 3 << 2, 2 << 3, 1 << 3, 0 << 4 -}; - - -const uint8_t t1l[] = { - 1, 4, - 3, 5 -}; - -static const uint8_t t2l[] = { - 1, 4, 7, - 4, 5, 7, - 6, 7, 8 -}; - -static const uint8_t t3l[] = { - 2, 3, 7, - 4, 4, 7, - 6, 7, 8 -}; - -static const uint8_t t5l[] = { - 1, 4, 7, 8, - 4, 5, 8, 9, - 7, 8, 9, 10, - 8, 8, 9, 10 -}; - -static const uint8_t t6l[] = { - 3, 4, 6, 8, - 4, 4, 6, 7, - 5, 6, 7, 8, - 7, 7, 8, 9 -}; - -static const uint8_t t7l[] = { - 1, 4, 7, 9, 9, 10, - 4, 6, 8, 9, 9, 10, - 7, 7, 9, 10, 10, 11, - 8, 9, 10, 11, 11, 11, - 8, 9, 10, 11, 11, 12, - 9, 10, 11, 12, 12, 12 -}; - -static const uint8_t t8l[] = { - 2, 4, 7, 9, 9, 10, - 4, 4, 6, 10, 10, 10, - 7, 6, 8, 10, 10, 11, - 9, 10, 10, 11, 11, 12, - 9, 9, 10, 11, 12, 12, - 10, 10, 11, 11, 13, 13 -}; - -static const uint8_t t9l[] = { - 3, 4, 6, 7, 9, 10, - 4, 5, 6, 7, 8, 10, - 5, 6, 7, 8, 9, 10, - 7, 7, 8, 9, 9, 10, - 8, 8, 9, 9, 10, 11, - 9, 9, 10, 10, 11, 11 -}; - -static const uint8_t t10l[] = { - 1, 4, 7, 9, 10, 10, 10, 11, - 4, 6, 8, 9, 10, 11, 10, 10, - 7, 8, 9, 10, 11, 12, 11, 11, - 8, 9, 10, 11, 12, 12, 11, 12, - 9, 10, 11, 12, 12, 12, 12, 12, - 10, 11, 12, 12, 13, 13, 12, 13, - 9, 10, 11, 12, 12, 12, 13, 13, - 10, 10, 11, 12, 12, 13, 13, 13 -}; - -static const uint8_t t11l[] = { - 2, 4, 6, 8, 9, 10, 9, 10, - 4, 5, 6, 8, 10, 10, 9, 10, - 6, 7, 8, 9, 10, 11, 10, 10, - 8, 8, 9, 11, 10, 12, 10, 11, - 9, 10, 10, 11, 11, 12, 11, 12, - 9, 10, 11, 12, 12, 13, 12, 13, - 9, 9, 9, 10, 11, 12, 12, 12, - 9, 9, 10, 11, 12, 12, 12, 12 -}; - -static const uint8_t t12l[] = { - 4, 4, 6, 8, 9, 10, 10, 10, - 4, 5, 6, 7, 9, 9, 10, 10, - 6, 6, 7, 8, 9, 10, 9, 10, - 7, 7, 8, 8, 9, 10, 10, 10, - 8, 8, 9, 9, 10, 10, 10, 11, - 9, 9, 10, 10, 10, 11, 10, 11, - 9, 9, 9, 10, 10, 11, 11, 12, - 10, 10, 10, 11, 11, 11, 11, 12 -}; - -static const uint8_t t13l[] = { - 1, 5, 7, 8, 9, 10, 10, 11, 10, 11, 12, 12, 13, 13, 14, 14, - 4, 6, 8, 9, 10, 10, 11, 11, 11, 11, 12, 12, 13, 14, 14, 14, - 7, 8, 9, 10, 11, 11, 12, 12, 11, 12, 12, 13, 13, 14, 15, 15, - 8, 9, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 15, 15, - 9, 9, 11, 11, 12, 12, 13, 13, 12, 13, 13, 14, 14, 15, 15, 16, - 10, 10, 11, 12, 12, 12, 13, 13, 13, 13, 14, 13, 15, 15, 16, 16, - 10, 11, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, - 11, 11, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 18, 18, - 10, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 15, 15, 16, 17, 17, - 11, 11, 12, 12, 13, 13, 13, 15, 14, 15, 15, 16, 16, 16, 18, 17, - 11, 12, 12, 13, 13, 14, 14, 15, 14, 15, 16, 15, 16, 17, 18, 19, - 12, 12, 12, 13, 14, 14, 14, 14, 15, 15, 15, 16, 17, 17, 17, 18, - 12, 13, 13, 14, 14, 15, 14, 15, 16, 16, 17, 17, 17, 18, 18, 18, - 13, 13, 14, 15, 15, 15, 16, 16, 16, 16, 16, 17, 18, 17, 18, 18, - 14, 14, 14, 15, 15, 15, 17, 16, 16, 19, 17, 17, 17, 19, 18, 18, - 13, 14, 15, 16, 16, 16, 17, 16, 17, 17, 18, 18, 21, 20, 21, 18 -}; - -static const uint8_t t15l[] = { - 3, 5, 6, 8, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 14, - 5, 5, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, - 6, 7, 7, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, - 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, - 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, - 9, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 14, - 10, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, - 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 14, - 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, - 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, - 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 15, 14, - 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, - 12, 12, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 15, 15, - 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, - 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 14, 15, - 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15 -}; - -static const uint8_t t16_5l[] = { - 1, 5, 7, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 11, - 4, 6, 8, 9, 10, 11, 11, 11, 12, 12, 12, 13, 14, 13, 14, 11, - 7, 8, 9, 10, 11, 11, 12, 12, 13, 12, 13, 13, 13, 14, 14, 12, - 9, 9, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 13, - 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 12, - 10, 10, 11, 11, 12, 13, 13, 14, 13, 14, 14, 15, 15, 15, 16, 13, - 11, 11, 11, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 13, - 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 17, 17, 13, - 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 13, - 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 15, 16, 15, 14, - 12, 13, 12, 13, 14, 14, 14, 14, 15, 16, 16, 16, 17, 17, 16, 13, - 13, 13, 13, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 14, - 13, 14, 14, 14, 14, 15, 15, 15, 15, 17, 16, 16, 16, 16, 18, 14, - 15, 14, 14, 14, 15, 15, 16, 16, 16, 18, 17, 17, 17, 19, 17, 14, - 14, 15, 13, 14, 16, 16, 15, 16, 16, 17, 18, 17, 19, 17, 16, 14, - 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 12 -}; - -static const uint8_t t16l[] = { - 1, 5, 7, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 10, - 4, 6, 8, 9, 10, 11, 11, 11, 12, 12, 12, 13, 14, 13, 14, 10, - 7, 8, 9, 10, 11, 11, 12, 12, 13, 12, 13, 13, 13, 14, 14, 11, - 9, 9, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 12, - 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 11, - 10, 10, 11, 11, 12, 13, 13, 14, 13, 14, 14, 15, 15, 15, 16, 12, - 11, 11, 11, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 12, - 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 17, 17, 12, - 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 12, - 12, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 15, 16, 15, 13, - 12, 13, 12, 13, 14, 14, 14, 14, 15, 16, 16, 16, 17, 17, 16, 12, - 13, 13, 13, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 13, - 13, 14, 14, 14, 14, 15, 15, 15, 15, 17, 16, 16, 16, 16, 18, 13, - 15, 14, 14, 14, 15, 15, 16, 16, 16, 18, 17, 17, 17, 19, 17, 13, - 14, 15, 13, 14, 16, 16, 15, 16, 16, 17, 18, 17, 19, 17, 16, 13, - 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 10 -}; - -static const uint8_t t24l[] = { - 4, 5, 7, 8, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 13, 10, - 5, 6, 7, 8, 9, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 10, - 7, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 12, 12, 12, 13, 9, - 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 9, - 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 9, - 10, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 9, - 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 9, - 11, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 10, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 10, - 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 10, - 12, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 10, - 12, 12, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 10, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 10, - 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 10, - 13, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 10, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 6 -}; - -const uint8_t t32l[] = { - 1 + 0, 4 + 1, 4 + 1, 5 + 2, 4 + 1, 6 + 2, 5 + 2, 6 + 3, - 4 + 1, 5 + 2, 5 + 2, 6 + 3, 5 + 2, 6 + 3, 6 + 3, 6 + 4 -}; - -const uint8_t t33l[] = { - 4 + 0, 4 + 1, 4 + 1, 4 + 2, 4 + 1, 4 + 2, 4 + 2, 4 + 3, - 4 + 1, 4 + 2, 4 + 2, 4 + 3, 4 + 2, 4 + 3, 4 + 3, 4 + 4 -}; - - -const struct huffcodetab ht[HTN] = { - /* xlen, linmax, table, hlen */ - {0, 0, NULL, NULL}, - {2, 0, t1HB, t1l}, - {3, 0, t2HB, t2l}, - {3, 0, t3HB, t3l}, - {0, 0, NULL, NULL}, /* Apparently not used */ - {4, 0, t5HB, t5l}, - {4, 0, t6HB, t6l}, - {6, 0, t7HB, t7l}, - {6, 0, t8HB, t8l}, - {6, 0, t9HB, t9l}, - {8, 0, t10HB, t10l}, - {8, 0, t11HB, t11l}, - {8, 0, t12HB, t12l}, - {16, 0, t13HB, t13l}, - {0, 0, NULL, t16_5l}, /* Apparently not used */ - {16, 0, t15HB, t15l}, - - {1, 1, t16HB, t16l}, - {2, 3, t16HB, t16l}, - {3, 7, t16HB, t16l}, - {4, 15, t16HB, t16l}, - {6, 63, t16HB, t16l}, - {8, 255, t16HB, t16l}, - {10, 1023, t16HB, t16l}, - {13, 8191, t16HB, t16l}, - - {4, 15, t24HB, t24l}, - {5, 31, t24HB, t24l}, - {6, 63, t24HB, t24l}, - {7, 127, t24HB, t24l}, - {8, 255, t24HB, t24l}, - {9, 511, t24HB, t24l}, - {11, 2047, t24HB, t24l}, - {13, 8191, t24HB, t24l}, - - {0, 0, t32HB, t32l}, - {0, 0, t33HB, t33l}, -}; - - - - - -/* for (i = 0; i < 16*16; i++) { - * largetbl[i] = ((ht[16].hlen[i]) << 16) + ht[24].hlen[i]; - * } - */ -const uint32_t largetbl[16 * 16] = { - 0x010004, 0x050005, 0x070007, 0x090008, 0x0a0009, 0x0a000a, 0x0b000a, 0x0b000b, - 0x0c000b, 0x0c000c, 0x0c000c, 0x0d000c, 0x0d000c, 0x0d000c, 0x0e000d, 0x0a000a, - 0x040005, 0x060006, 0x080007, 0x090008, 0x0a0009, 0x0b000a, 0x0b000a, 0x0b000b, - 0x0c000b, 0x0c000b, 0x0c000c, 0x0d000c, 0x0e000c, 0x0d000c, 0x0e000c, 0x0a000a, - 0x070007, 0x080007, 0x090008, 0x0a0009, 0x0b0009, 0x0b000a, 0x0c000a, 0x0c000b, - 0x0d000b, 0x0c000b, 0x0d000b, 0x0d000c, 0x0d000c, 0x0e000c, 0x0e000d, 0x0b0009, - 0x090008, 0x090008, 0x0a0009, 0x0b0009, 0x0b000a, 0x0c000a, 0x0c000a, 0x0c000b, - 0x0d000b, 0x0d000b, 0x0e000b, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x0c0009, - 0x0a0009, 0x0a0009, 0x0b0009, 0x0b000a, 0x0c000a, 0x0c000a, 0x0d000a, 0x0d000b, - 0x0d000b, 0x0e000b, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x0f000d, 0x0b0009, - 0x0a000a, 0x0a0009, 0x0b000a, 0x0b000a, 0x0c000a, 0x0d000a, 0x0d000b, 0x0e000b, - 0x0d000b, 0x0e000b, 0x0e000c, 0x0f000c, 0x0f000c, 0x0f000c, 0x10000c, 0x0c0009, - 0x0b000a, 0x0b000a, 0x0b000a, 0x0c000a, 0x0d000a, 0x0d000b, 0x0d000b, 0x0d000b, - 0x0e000b, 0x0e000c, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x10000d, 0x0c0009, - 0x0b000b, 0x0b000a, 0x0c000a, 0x0c000a, 0x0d000b, 0x0d000b, 0x0d000b, 0x0e000b, - 0x0e000c, 0x0f000c, 0x0f000c, 0x0f000c, 0x0f000c, 0x11000d, 0x11000d, 0x0c000a, - 0x0b000b, 0x0c000b, 0x0c000b, 0x0d000b, 0x0d000b, 0x0d000b, 0x0e000b, 0x0e000b, - 0x0f000b, 0x0f000c, 0x0f000c, 0x0f000c, 0x10000c, 0x10000d, 0x10000d, 0x0c000a, - 0x0c000b, 0x0c000b, 0x0c000b, 0x0d000b, 0x0d000b, 0x0e000b, 0x0e000b, 0x0f000c, - 0x0f000c, 0x0f000c, 0x0f000c, 0x10000c, 0x0f000d, 0x10000d, 0x0f000d, 0x0d000a, - 0x0c000c, 0x0d000b, 0x0c000b, 0x0d000b, 0x0e000b, 0x0e000c, 0x0e000c, 0x0e000c, - 0x0f000c, 0x10000c, 0x10000c, 0x10000d, 0x11000d, 0x11000d, 0x10000d, 0x0c000a, - 0x0d000c, 0x0d000c, 0x0d000b, 0x0d000b, 0x0e000b, 0x0e000c, 0x0f000c, 0x10000c, - 0x10000c, 0x10000c, 0x10000c, 0x10000d, 0x10000d, 0x0f000d, 0x10000d, 0x0d000a, - 0x0d000c, 0x0e000c, 0x0e000c, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x0f000c, - 0x0f000c, 0x11000c, 0x10000d, 0x10000d, 0x10000d, 0x10000d, 0x12000d, 0x0d000a, - 0x0f000c, 0x0e000c, 0x0e000c, 0x0e000c, 0x0f000c, 0x0f000c, 0x10000c, 0x10000c, - 0x10000d, 0x12000d, 0x11000d, 0x11000d, 0x11000d, 0x13000d, 0x11000d, 0x0d000a, - 0x0e000d, 0x0f000c, 0x0d000c, 0x0e000c, 0x10000c, 0x10000c, 0x0f000c, 0x10000d, - 0x10000d, 0x11000d, 0x12000d, 0x11000d, 0x13000d, 0x11000d, 0x10000d, 0x0d000a, - 0x0a0009, 0x0a0009, 0x0a0009, 0x0b0009, 0x0b0009, 0x0c0009, 0x0c0009, 0x0c0009, - 0x0d0009, 0x0d0009, 0x0d0009, 0x0d000a, 0x0d000a, 0x0d000a, 0x0d000a, 0x0a0006 -}; - -/* for (i = 0; i < 3*3; i++) { - * table23[i] = ((ht[2].hlen[i]) << 16) + ht[3].hlen[i]; - * } - */ -const uint32_t table23[3 * 3] = { - 0x010002, 0x040003, 0x070007, - 0x040004, 0x050004, 0x070007, - 0x060006, 0x070007, 0x080008 -}; - -/* for (i = 0; i < 4*4; i++) { - * table56[i] = ((ht[5].hlen[i]) << 16) + ht[6].hlen[i]; - * } - */ -const uint32_t table56[4 * 4] = { - 0x010003, 0x040004, 0x070006, 0x080008, 0x040004, 0x050004, 0x080006, 0x090007, - 0x070005, 0x080006, 0x090007, 0x0a0008, 0x080007, 0x080007, 0x090008, 0x0a0009 -}; - - - -/* - * 0: MPEG-2 LSF - * 1: MPEG-1 - * 2: MPEG-2.5 LSF FhG extention (1995-07-11 shn) - */ - -typedef enum { - MPEG_2 = 0, - MPEG_1 = 1, - MPEG_25 = 2 -} MPEG_t; - -const int bitrate_table[3][16] = { - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1}, /* MPEG 2 */ - {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1}, /* MPEG 1 */ - {0, 8, 16, 24, 32, 40, 48, 56, 64, -1, -1, -1, -1, -1, -1, -1}, /* MPEG 2.5 */ -}; - -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 */ -}; - -int -lame_get_bitrate(int mpeg_version, int table_index) -{ - if (0 <= mpeg_version && mpeg_version <= 2) { - if (0 <= table_index && table_index <= 15) { - return bitrate_table[mpeg_version][table_index]; - } - } - return -1; -} - -int -lame_get_samplerate(int mpeg_version, int table_index) -{ - if (0 <= mpeg_version && mpeg_version <= 2) { - if (0 <= table_index && table_index <= 3) { - return samplerate_table[mpeg_version][table_index]; - } - } - return -1; -} - - -/* This is the scfsi_band table from 2.4.2.7 of the IS */ -const int scfsi_band[5] = { 0, 6, 11, 16, 21 }; - -/* end of tables.c */ diff --git a/src/lib/dl/ext/lame/tables.h b/src/lib/dl/ext/lame/tables.h deleted file mode 100755 index 0dd7deb2..00000000 --- a/src/lib/dl/ext/lame/tables.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * MPEG layer 3 tables include file - * - * Copyright (c) 1999 Albert 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_TABLES_H -#define LAME_TABLES_H - -#if 0 -typedef struct { - unsigned char no; - unsigned char width; - unsigned char minval_2; - float quiet_thr; - float norm; - float bark; -} type1_t; - -typedef struct { - unsigned char no; - unsigned char width; - float quiet_thr; - float norm; - float SNR; - float bark; -} type2_t; - -typedef struct { - unsigned int no:5; - unsigned int cbw:3; - unsigned int bu:6; - unsigned int bo:6; - unsigned int w1_576:10; - unsigned int w2_576:10; -} type34_t; - -typedef struct { - size_t len1; - const type1_t *const tab1; - size_t len2; - const type2_t *const tab2; - size_t len3; - const type34_t *const tab3; - size_t len4; - const type34_t *const tab4; -} type5_t; - -extern const type5_t table5[6]; - -#endif - -#define HTN 34 - -struct huffcodetab { - const unsigned int xlen; /* max. x-index+ */ - const unsigned int linmax; /* max number to be stored in linbits */ - const uint16_t *table; /* pointer to array[xlen][ylen] */ - const uint8_t *hlen; /* pointer to array[xlen][ylen] */ -}; - -extern const struct huffcodetab ht[HTN]; - /* global memory block */ - /* array of all huffcodtable headers */ - /* 0..31 Huffman code table 0..31 */ - /* 32,33 count1-tables */ - -extern const uint8_t t32l[]; -extern const uint8_t t33l[]; - -extern const uint32_t largetbl[16 * 16]; -extern const uint32_t table23[3 * 3]; -extern const uint32_t table56[4 * 4]; - -extern const int scfsi_band[5]; - -extern const int bitrate_table [3][16]; -extern const int samplerate_table [3][ 4]; - -#endif /* LAME_TABLES_H */ diff --git a/src/lib/dl/ext/lame/takehiro.c b/src/lib/dl/ext/lame/takehiro.c deleted file mode 100755 index 9781feb2..00000000 --- a/src/lib/dl/ext/lame/takehiro.c +++ /dev/null @@ -1,1375 +0,0 @@ -/* - * MP3 huffman table selecting and bit counting - * - * Copyright (c) 1999-2005 Takehiro TOMINAGA - * Copyright (c) 2002-2005 Gabriel Bouvigne - * - * 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. - */ - -/* $Id: takehiro.c,v 1.79 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "quantize_pvt.h" -#include "tables.h" - - -static const struct { - const int region0_count; - const int region1_count; -} subdv_table[23] = { - { - 0, 0}, /* 0 bands */ - { - 0, 0}, /* 1 bands */ - { - 0, 0}, /* 2 bands */ - { - 0, 0}, /* 3 bands */ - { - 0, 0}, /* 4 bands */ - { - 0, 1}, /* 5 bands */ - { - 1, 1}, /* 6 bands */ - { - 1, 1}, /* 7 bands */ - { - 1, 2}, /* 8 bands */ - { - 2, 2}, /* 9 bands */ - { - 2, 3}, /* 10 bands */ - { - 2, 3}, /* 11 bands */ - { - 3, 4}, /* 12 bands */ - { - 3, 4}, /* 13 bands */ - { - 3, 4}, /* 14 bands */ - { - 4, 5}, /* 15 bands */ - { - 4, 5}, /* 16 bands */ - { - 4, 6}, /* 17 bands */ - { - 5, 6}, /* 18 bands */ - { - 5, 6}, /* 19 bands */ - { - 5, 7}, /* 20 bands */ - { - 6, 7}, /* 21 bands */ - { - 6, 7}, /* 22 bands */ -}; - - - - - -/********************************************************************* - * nonlinear quantization of xr - * More accurate formula than the ISO formula. Takes into account - * the fact that we are quantizing xr -> ix, but we want ix^4/3 to be - * as close as possible to x^4/3. (taking the nearest int would mean - * ix is as close as possible to xr, which is different.) - * - * From Segher Boessenkool <segher@eastsite.nl> 11/1999 - * - * 09/2000: ASM code removed in favor of IEEE754 hack by Takehiro - * Tominaga. If you need the ASM code, check CVS circa Aug 2000. - * - * 01/2004: Optimizations by Gabriel Bouvigne - *********************************************************************/ - - - - - -static void -quantize_lines_xrpow_01(unsigned int l, FLOAT istep, const FLOAT * xr, int *ix) -{ - const FLOAT compareval0 = (1.0f - 0.4054f) / istep; - unsigned int i; - - assert(l > 0); - assert(l % 2 == 0); - for (i = 0; i < l; i += 2) { - FLOAT const xr_0 = xr[i+0]; - FLOAT const xr_1 = xr[i+1]; - int const ix_0 = (compareval0 > xr_0) ? 0 : 1; - int const ix_1 = (compareval0 > xr_1) ? 0 : 1; - ix[i+0] = ix_0; - ix[i+1] = ix_1; - } -} - - - -#ifdef TAKEHIRO_IEEE754_HACK - -typedef union { - float f; - int i; -} fi_union; - -#define MAGIC_FLOAT (65536*(128)) -#define MAGIC_INT 0x4b000000 - - -static void -quantize_lines_xrpow(unsigned int l, FLOAT istep, const FLOAT * xp, int *pi) -{ - fi_union *fi; - unsigned int remaining; - - assert(l > 0); - - fi = (fi_union *) pi; - - l = l >> 1; - remaining = l % 2; - l = l >> 1; - while (l--) { - double x0 = istep * xp[0]; - double x1 = istep * xp[1]; - double x2 = istep * xp[2]; - double x3 = istep * xp[3]; - - x0 += MAGIC_FLOAT; - fi[0].f = x0; - x1 += MAGIC_FLOAT; - fi[1].f = x1; - x2 += MAGIC_FLOAT; - fi[2].f = x2; - x3 += MAGIC_FLOAT; - fi[3].f = x3; - - fi[0].f = x0 + adj43asm[fi[0].i - MAGIC_INT]; - fi[1].f = x1 + adj43asm[fi[1].i - MAGIC_INT]; - fi[2].f = x2 + adj43asm[fi[2].i - MAGIC_INT]; - fi[3].f = x3 + adj43asm[fi[3].i - MAGIC_INT]; - - fi[0].i -= MAGIC_INT; - fi[1].i -= MAGIC_INT; - fi[2].i -= MAGIC_INT; - fi[3].i -= MAGIC_INT; - fi += 4; - xp += 4; - }; - if (remaining) { - double x0 = istep * xp[0]; - double x1 = istep * xp[1]; - - x0 += MAGIC_FLOAT; - fi[0].f = x0; - x1 += MAGIC_FLOAT; - fi[1].f = x1; - - fi[0].f = x0 + adj43asm[fi[0].i - MAGIC_INT]; - fi[1].f = x1 + adj43asm[fi[1].i - MAGIC_INT]; - - fi[0].i -= MAGIC_INT; - fi[1].i -= MAGIC_INT; - } - -} - - -#else - -/********************************************************************* - * XRPOW_FTOI is a macro to convert floats to ints. - * if XRPOW_FTOI(x) = nearest_int(x), then QUANTFAC(x)=adj43asm[x] - * ROUNDFAC= -0.0946 - * - * if XRPOW_FTOI(x) = floor(x), then QUANTFAC(x)=asj43[x] - * ROUNDFAC=0.4054 - * - * Note: using floor() or (int) is extremely slow. On machines where - * the TAKEHIRO_IEEE754_HACK code above does not work, it is worthwile - * to write some ASM for XRPOW_FTOI(). - *********************************************************************/ -#define XRPOW_FTOI(src,dest) ((dest) = (int)(src)) -#define QUANTFAC(rx) adj43[rx] -#define ROUNDFAC 0.4054 - - -static void -quantize_lines_xrpow(unsigned int l, FLOAT istep, const FLOAT * xr, int *ix) -{ - unsigned int remaining; - - assert(l > 0); - - l = l >> 1; - remaining = l % 2; - l = l >> 1; - while (l--) { - FLOAT x0, x1, x2, x3; - int rx0, rx1, rx2, rx3; - - x0 = *xr++ * istep; - x1 = *xr++ * istep; - XRPOW_FTOI(x0, rx0); - x2 = *xr++ * istep; - XRPOW_FTOI(x1, rx1); - x3 = *xr++ * istep; - XRPOW_FTOI(x2, rx2); - x0 += QUANTFAC(rx0); - XRPOW_FTOI(x3, rx3); - x1 += QUANTFAC(rx1); - XRPOW_FTOI(x0, *ix++); - x2 += QUANTFAC(rx2); - XRPOW_FTOI(x1, *ix++); - x3 += QUANTFAC(rx3); - XRPOW_FTOI(x2, *ix++); - XRPOW_FTOI(x3, *ix++); - }; - if (remaining) { - FLOAT x0, x1; - int rx0, rx1; - - x0 = *xr++ * istep; - x1 = *xr++ * istep; - XRPOW_FTOI(x0, rx0); - XRPOW_FTOI(x1, rx1); - x0 += QUANTFAC(rx0); - x1 += QUANTFAC(rx1); - XRPOW_FTOI(x0, *ix++); - XRPOW_FTOI(x1, *ix++); - } - -} - - - -#endif - - - -/********************************************************************* - * Quantization function - * This function will select which lines to quantize and call the - * proper quantization function - *********************************************************************/ - -static void -quantize_xrpow(const FLOAT * xp, int *pi, FLOAT istep, gr_info const *const cod_info, - calc_noise_data const *prev_noise) -{ - /* quantize on xr^(3/4) instead of xr */ - int sfb; - int sfbmax; - int j = 0; - int prev_data_use; - int *iData; - int accumulate = 0; - int accumulate01 = 0; - int *acc_iData; - const FLOAT *acc_xp; - - iData = pi; - acc_xp = xp; - acc_iData = iData; - - - /* Reusing previously computed data does not seems to work if global gain - is changed. Finding why it behaves this way would allow to use a cache of - previously computed values (let's 10 cached values per sfb) that would - probably provide a noticeable speedup */ - prev_data_use = (prev_noise && (cod_info->global_gain == prev_noise->global_gain)); - - if (cod_info->block_type == SHORT_TYPE) - sfbmax = 38; - else - sfbmax = 21; - - for (sfb = 0; sfb <= sfbmax; sfb++) { - int step = -1; - - if (prev_data_use || cod_info->block_type == NORM_TYPE) { - step = - cod_info->global_gain - - ((cod_info->scalefac[sfb] + (cod_info->preflag ? pretab[sfb] : 0)) - << (cod_info->scalefac_scale + 1)) - - cod_info->subblock_gain[cod_info->window[sfb]] * 8; - } - assert(cod_info->width[sfb] >= 0); - if (prev_data_use && (prev_noise->step[sfb] == step)) { - /* do not recompute this part, - but compute accumulated lines */ - if (accumulate) { - quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData); - accumulate = 0; - } - if (accumulate01) { - quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData); - accumulate01 = 0; - } - } - else { /*should compute this part */ - int l; - l = cod_info->width[sfb]; - - if ((j + cod_info->width[sfb]) > cod_info->max_nonzero_coeff) { - /*do not compute upper zero part */ - int usefullsize; - usefullsize = cod_info->max_nonzero_coeff - j + 1; - memset(&pi[cod_info->max_nonzero_coeff], 0, - sizeof(int) * (576 - cod_info->max_nonzero_coeff)); - l = usefullsize; - - if (l < 0) { - l = 0; - } - - /* no need to compute higher sfb values */ - sfb = sfbmax + 1; - } - - /*accumulate lines to quantize */ - if (!accumulate && !accumulate01) { - acc_iData = iData; - acc_xp = xp; - } - if (prev_noise && - prev_noise->sfb_count1 > 0 && - sfb >= prev_noise->sfb_count1 && - prev_noise->step[sfb] > 0 && step >= prev_noise->step[sfb]) { - - if (accumulate) { - quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData); - accumulate = 0; - acc_iData = iData; - acc_xp = xp; - } - accumulate01 += l; - } - else { - if (accumulate01) { - quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData); - accumulate01 = 0; - acc_iData = iData; - acc_xp = xp; - } - accumulate += l; - } - - if (l <= 0) { - /* rh: 20040215 - * may happen due to "prev_data_use" optimization - */ - if (accumulate01) { - quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData); - accumulate01 = 0; - } - if (accumulate) { - quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData); - accumulate = 0; - } - - break; /* ends for-loop */ - } - } - if (sfb <= sfbmax) { - iData += cod_info->width[sfb]; - xp += cod_info->width[sfb]; - j += cod_info->width[sfb]; - } - } - if (accumulate) { /*last data part */ - quantize_lines_xrpow(accumulate, istep, acc_xp, acc_iData); - accumulate = 0; - } - if (accumulate01) { /*last data part */ - quantize_lines_xrpow_01(accumulate01, istep, acc_xp, acc_iData); - accumulate01 = 0; - } - -} - - - - -/*************************************************************************/ -/* ix_max */ -/*************************************************************************/ - -static int -ix_max(const int *ix, const int *end) -{ - int max1 = 0, max2 = 0; - - do { - int const x1 = *ix++; - int const x2 = *ix++; - if (max1 < x1) - max1 = x1; - - if (max2 < x2) - max2 = x2; - } while (ix < end); - if (max1 < max2) - max1 = max2; - return max1; -} - - - - - - - - -static int -count_bit_ESC(const int *ix, const int *const end, int t1, const int t2, unsigned int *const s) -{ - /* ESC-table is used */ - unsigned int const linbits = ht[t1].xlen * 65536u + ht[t2].xlen; - unsigned int sum = 0, sum2; - - do { - unsigned int x = *ix++; - unsigned int y = *ix++; - - if (x >= 15u) { - x = 15u; - sum += linbits; - } - if (y >= 15u) { - y = 15u; - sum += linbits; - } - x <<= 4u; - x += y; - sum += largetbl[x]; - } while (ix < end); - - sum2 = sum & 0xffffu; - sum >>= 16u; - - if (sum > sum2) { - sum = sum2; - t1 = t2; - } - - *s += sum; - return t1; -} - - -static int -count_bit_noESC(const int *ix, const int *end, int mx, unsigned int *s) -{ - /* No ESC-words */ - unsigned int sum1 = 0; - const uint8_t *const hlen1 = ht[1].hlen; - (void) mx; - - do { - unsigned int const x0 = *ix++; - unsigned int const x1 = *ix++; - sum1 += hlen1[ x0+x0 + x1 ]; - } while (ix < end); - - *s += sum1; - return 1; -} - - -static const int huf_tbl_noESC[] = { - 1, 2, 5, 7, 7, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13 -}; - - -static int -count_bit_noESC_from2(const int *ix, const int *end, int max, unsigned int *s) -{ - int t1 = huf_tbl_noESC[max - 1]; - /* No ESC-words */ - const unsigned int xlen = ht[t1].xlen; - uint32_t const* table = (t1 == 2) ? &table23[0] : &table56[0]; - unsigned int sum = 0, sum2; - - do { - unsigned int const x0 = *ix++; - unsigned int const x1 = *ix++; - sum += table[ x0 * xlen + x1 ]; - } while (ix < end); - - sum2 = sum & 0xffffu; - sum >>= 16u; - - if (sum > sum2) { - sum = sum2; - t1++; - } - - *s += sum; - return t1; -} - - -inline static int -count_bit_noESC_from3(const int *ix, const int *end, int max, unsigned int * s) -{ - int t1 = huf_tbl_noESC[max - 1]; - /* No ESC-words */ - unsigned int sum1 = 0; - unsigned int sum2 = 0; - unsigned int sum3 = 0; - const unsigned int xlen = ht[t1].xlen; - const uint8_t *const hlen1 = ht[t1].hlen; - const uint8_t *const hlen2 = ht[t1 + 1].hlen; - const uint8_t *const hlen3 = ht[t1 + 2].hlen; - int t; - - do { - unsigned int x0 = *ix++; - unsigned int x1 = *ix++; - unsigned int x = x0 * xlen + x1; - sum1 += hlen1[x]; - sum2 += hlen2[x]; - sum3 += hlen3[x]; - } while (ix < end); - - t = t1; - if (sum1 > sum2) { - sum1 = sum2; - t++; - } - if (sum1 > sum3) { - sum1 = sum3; - t = t1 + 2; - } - *s += sum1; - - return t; -} - - -/*************************************************************************/ -/* choose table */ -/*************************************************************************/ - -/* - Choose the Huffman table that will encode ix[begin..end] with - the fewest bits. - - Note: This code contains knowledge about the sizes and characteristics - of the Huffman tables as defined in the IS (Table B.7), and will not work - with any arbitrary tables. -*/ -static int count_bit_null(const int* ix, const int* end, int max, unsigned int* s) -{ - (void) ix; - (void) end; - (void) max; - (void) s; - return 0; -} - -typedef int (*count_fnc)(const int* ix, const int* end, int max, unsigned int* s); - -static count_fnc count_fncs[] = -{ &count_bit_null -, &count_bit_noESC -, &count_bit_noESC_from2 -, &count_bit_noESC_from2 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -, &count_bit_noESC_from3 -}; - -static int -choose_table_nonMMX(const int *ix, const int *const end, int *const _s) -{ - unsigned int* s = (unsigned int*)_s; - unsigned int max; - int choice, choice2; - max = ix_max(ix, end); - - if (max <= 15) { - return count_fncs[max](ix, end, max, s); - } - /* try tables with linbits */ - if (max > IXMAX_VAL) { - *s = LARGE_BITS; - return -1; - } - max -= 15u; - for (choice2 = 24; choice2 < 32; choice2++) { - if (ht[choice2].linmax >= max) { - break; - } - } - - for (choice = choice2 - 8; choice < 24; choice++) { - if (ht[choice].linmax >= max) { - break; - } - } - return count_bit_ESC(ix, end, choice, choice2, s); -} - - - -/*************************************************************************/ -/* count_bit */ -/*************************************************************************/ -int -noquant_count_bits(lame_internal_flags const *const gfc, - gr_info * const gi, calc_noise_data * prev_noise) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int bits = 0; - int i, a1, a2; - int const *const ix = gi->l3_enc; - - i = Min(576, ((gi->max_nonzero_coeff + 2) >> 1) << 1); - - if (prev_noise) - prev_noise->sfb_count1 = 0; - - /* Determine count1 region */ - for (; i > 1; i -= 2) - if (ix[i - 1] | ix[i - 2]) - break; - gi->count1 = i; - - /* Determines the number of bits to encode the quadruples. */ - a1 = a2 = 0; - for (; i > 3; i -= 4) { - int x4 = ix[i-4]; - int x3 = ix[i-3]; - int x2 = ix[i-2]; - int x1 = ix[i-1]; - int p; - /* hack to check if all values <= 1 */ - if ((unsigned int) (x4 | x3 | x2 | x1) > 1) - break; - - p = ((x4 * 2 + x3) * 2 + x2) * 2 + x1; - a1 += t32l[p]; - a2 += t33l[p]; - } - - bits = a1; - gi->count1table_select = 0; - if (a1 > a2) { - bits = a2; - gi->count1table_select = 1; - } - - gi->count1bits = bits; - gi->big_values = i; - if (i == 0) - return bits; - - if (gi->block_type == SHORT_TYPE) { - a1 = 3 * gfc->scalefac_band.s[3]; - if (a1 > gi->big_values) - a1 = gi->big_values; - a2 = gi->big_values; - - } - else if (gi->block_type == NORM_TYPE) { - assert(i <= 576); /* bv_scf has 576 entries (0..575) */ - a1 = gi->region0_count = gfc->sv_qnt.bv_scf[i - 2]; - a2 = gi->region1_count = gfc->sv_qnt.bv_scf[i - 1]; - - assert(a1 + a2 + 2 < SBPSY_l); - a2 = gfc->scalefac_band.l[a1 + a2 + 2]; - a1 = gfc->scalefac_band.l[a1 + 1]; - if (a2 < i) - gi->table_select[2] = gfc->choose_table(ix + a2, ix + i, &bits); - - } - else { - gi->region0_count = 7; - /*gi->region1_count = SBPSY_l - 7 - 1; */ - gi->region1_count = SBMAX_l - 1 - 7 - 1; - a1 = gfc->scalefac_band.l[7 + 1]; - a2 = i; - if (a1 > a2) { - a1 = a2; - } - } - - - /* have to allow for the case when bigvalues < region0 < region1 */ - /* (and region0, region1 are ignored) */ - a1 = Min(a1, i); - a2 = Min(a2, i); - - assert(a1 >= 0); - assert(a2 >= 0); - - /* Count the number of bits necessary to code the bigvalues region. */ - if (0 < a1) - gi->table_select[0] = gfc->choose_table(ix, ix + a1, &bits); - if (a1 < a2) - gi->table_select[1] = gfc->choose_table(ix + a1, ix + a2, &bits); - if (cfg->use_best_huffman == 2) { - gi->part2_3_length = bits; - best_huffman_divide(gfc, gi); - bits = gi->part2_3_length; - } - - - if (prev_noise) { - if (gi->block_type == NORM_TYPE) { - int sfb = 0; - while (gfc->scalefac_band.l[sfb] < gi->big_values) { - sfb++; - } - prev_noise->sfb_count1 = sfb; - } - } - - return bits; -} - -int -count_bits(lame_internal_flags const *const gfc, - const FLOAT * const xr, gr_info * const gi, calc_noise_data * prev_noise) -{ - int *const ix = gi->l3_enc; - - /* since quantize_xrpow uses table lookup, we need to check this first: */ - FLOAT const w = (IXMAX_VAL) / IPOW20(gi->global_gain); - - if (gi->xrpow_max > w) - return LARGE_BITS; - - quantize_xrpow(xr, ix, IPOW20(gi->global_gain), gi, prev_noise); - - if (gfc->sv_qnt.substep_shaping & 2) { - int sfb, j = 0; - /* 0.634521682242439 = 0.5946*2**(.5*0.1875) */ - int const gain = gi->global_gain + gi->scalefac_scale; - const FLOAT roundfac = 0.634521682242439 / IPOW20(gain); - for (sfb = 0; sfb < gi->sfbmax; sfb++) { - int const width = gi->width[sfb]; - assert(width >= 0); - if (!gfc->sv_qnt.pseudohalf[sfb]) { - j += width; - } - else { - int k; - for (k = j, j += width; k < j; ++k) { - ix[k] = (xr[k] >= roundfac) ? ix[k] : 0; - } - } - } - } - return noquant_count_bits(gfc, gi, prev_noise); -} - -/*********************************************************************** - re-calculate the best scalefac_compress using scfsi - the saved bits are kept in the bit reservoir. - **********************************************************************/ - - -inline static void -recalc_divide_init(const lame_internal_flags * const gfc, - gr_info const *cod_info, - int const *const ix, int r01_bits[], int r01_div[], int r0_tbl[], int r1_tbl[]) -{ - int r0, r1, bigv, r0t, r1t, bits; - - bigv = cod_info->big_values; - - for (r0 = 0; r0 <= 7 + 15; r0++) { - r01_bits[r0] = LARGE_BITS; - } - - for (r0 = 0; r0 < 16; r0++) { - int const a1 = gfc->scalefac_band.l[r0 + 1]; - int r0bits; - if (a1 >= bigv) - break; - r0bits = 0; - r0t = gfc->choose_table(ix, ix + a1, &r0bits); - - for (r1 = 0; r1 < 8; r1++) { - int const a2 = gfc->scalefac_band.l[r0 + r1 + 2]; - if (a2 >= bigv) - break; - - bits = r0bits; - r1t = gfc->choose_table(ix + a1, ix + a2, &bits); - if (r01_bits[r0 + r1] > bits) { - r01_bits[r0 + r1] = bits; - r01_div[r0 + r1] = r0; - r0_tbl[r0 + r1] = r0t; - r1_tbl[r0 + r1] = r1t; - } - } - } -} - -inline static void -recalc_divide_sub(const lame_internal_flags * const gfc, - const gr_info * cod_info2, - gr_info * const gi, - const int *const ix, - const int r01_bits[], const int r01_div[], const int r0_tbl[], const int r1_tbl[]) -{ - int bits, r2, a2, bigv, r2t; - - bigv = cod_info2->big_values; - - for (r2 = 2; r2 < SBMAX_l + 1; r2++) { - a2 = gfc->scalefac_band.l[r2]; - if (a2 >= bigv) - break; - - bits = r01_bits[r2 - 2] + cod_info2->count1bits; - if (gi->part2_3_length <= bits) - break; - - r2t = gfc->choose_table(ix + a2, ix + bigv, &bits); - if (gi->part2_3_length <= bits) - continue; - - memcpy(gi, cod_info2, sizeof(gr_info)); - gi->part2_3_length = bits; - gi->region0_count = r01_div[r2 - 2]; - gi->region1_count = r2 - 2 - r01_div[r2 - 2]; - gi->table_select[0] = r0_tbl[r2 - 2]; - gi->table_select[1] = r1_tbl[r2 - 2]; - gi->table_select[2] = r2t; - } -} - - - - -void -best_huffman_divide(const lame_internal_flags * const gfc, gr_info * const gi) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int i, a1, a2; - gr_info cod_info2; - int const *const ix = gi->l3_enc; - - int r01_bits[7 + 15 + 1]; - int r01_div[7 + 15 + 1]; - int r0_tbl[7 + 15 + 1]; - int r1_tbl[7 + 15 + 1]; - - - /* SHORT BLOCK stuff fails for MPEG2 */ - if (gi->block_type == SHORT_TYPE && cfg->mode_gr == 1) - return; - - - memcpy(&cod_info2, gi, sizeof(gr_info)); - if (gi->block_type == NORM_TYPE) { - recalc_divide_init(gfc, gi, ix, r01_bits, r01_div, r0_tbl, r1_tbl); - recalc_divide_sub(gfc, &cod_info2, gi, ix, r01_bits, r01_div, r0_tbl, r1_tbl); - } - - i = cod_info2.big_values; - if (i == 0 || (unsigned int) (ix[i - 2] | ix[i - 1]) > 1) - return; - - i = gi->count1 + 2; - if (i > 576) - return; - - /* Determines the number of bits to encode the quadruples. */ - memcpy(&cod_info2, gi, sizeof(gr_info)); - cod_info2.count1 = i; - a1 = a2 = 0; - - assert(i <= 576); - - for (; i > cod_info2.big_values; i -= 4) { - int const p = ((ix[i - 4] * 2 + ix[i - 3]) * 2 + ix[i - 2]) * 2 + ix[i - 1]; - a1 += t32l[p]; - a2 += t33l[p]; - } - cod_info2.big_values = i; - - cod_info2.count1table_select = 0; - if (a1 > a2) { - a1 = a2; - cod_info2.count1table_select = 1; - } - - cod_info2.count1bits = a1; - - if (cod_info2.block_type == NORM_TYPE) - recalc_divide_sub(gfc, &cod_info2, gi, ix, r01_bits, r01_div, r0_tbl, r1_tbl); - else { - /* Count the number of bits necessary to code the bigvalues region. */ - cod_info2.part2_3_length = a1; - a1 = gfc->scalefac_band.l[7 + 1]; - if (a1 > i) { - a1 = i; - } - if (a1 > 0) - cod_info2.table_select[0] = - gfc->choose_table(ix, ix + a1, (int *) &cod_info2.part2_3_length); - if (i > a1) - cod_info2.table_select[1] = - gfc->choose_table(ix + a1, ix + i, (int *) &cod_info2.part2_3_length); - if (gi->part2_3_length > cod_info2.part2_3_length) - memcpy(gi, &cod_info2, sizeof(gr_info)); - } -} - -static const int slen1_n[16] = { 1, 1, 1, 1, 8, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16 }; -static const int slen2_n[16] = { 1, 2, 4, 8, 1, 2, 4, 8, 2, 4, 8, 2, 4, 8, 4, 8 }; -const int slen1_tab[16] = { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }; -const int slen2_tab[16] = { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 }; - -static void -scfsi_calc(int ch, III_side_info_t * l3_side) -{ - unsigned int i; - int s1, s2, c1, c2; - int sfb; - gr_info *const gi = &l3_side->tt[1][ch]; - gr_info const *const g0 = &l3_side->tt[0][ch]; - - for (i = 0; i < (sizeof(scfsi_band) / sizeof(int)) - 1; i++) { - for (sfb = scfsi_band[i]; sfb < scfsi_band[i + 1]; sfb++) { - if (g0->scalefac[sfb] != gi->scalefac[sfb] - && gi->scalefac[sfb] >= 0) - break; - } - if (sfb == scfsi_band[i + 1]) { - for (sfb = scfsi_band[i]; sfb < scfsi_band[i + 1]; sfb++) { - gi->scalefac[sfb] = -1; - } - l3_side->scfsi[ch][i] = 1; - } - } - - s1 = c1 = 0; - for (sfb = 0; sfb < 11; sfb++) { - if (gi->scalefac[sfb] == -1) - continue; - c1++; - if (s1 < gi->scalefac[sfb]) - s1 = gi->scalefac[sfb]; - } - - s2 = c2 = 0; - for (; sfb < SBPSY_l; sfb++) { - if (gi->scalefac[sfb] == -1) - continue; - c2++; - if (s2 < gi->scalefac[sfb]) - s2 = gi->scalefac[sfb]; - } - - for (i = 0; i < 16; i++) { - if (s1 < slen1_n[i] && s2 < slen2_n[i]) { - int const c = slen1_tab[i] * c1 + slen2_tab[i] * c2; - if (gi->part2_length > c) { - gi->part2_length = c; - gi->scalefac_compress = (int)i; - } - } - } -} - -/* -Find the optimal way to store the scalefactors. -Only call this routine after final scalefactors have been -chosen and the channel/granule will not be re-encoded. - */ -void -best_scalefac_store(const lame_internal_flags * gfc, - const int gr, const int ch, III_side_info_t * const l3_side) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - /* use scalefac_scale if we can */ - gr_info *const gi = &l3_side->tt[gr][ch]; - int sfb, i, j, l; - int recalc = 0; - - /* remove scalefacs from bands with ix=0. This idea comes - * from the AAC ISO docs. added mt 3/00 */ - /* check if l3_enc=0 */ - j = 0; - for (sfb = 0; sfb < gi->sfbmax; sfb++) { - int const width = gi->width[sfb]; - assert(width >= 0); - for (l = j, j += width; l < j; ++l) { - if (gi->l3_enc[l] != 0) - break; - } - if (l == j) - gi->scalefac[sfb] = recalc = -2; /* anything goes. */ - /* only best_scalefac_store and calc_scfsi - * know--and only they should know--about the magic number -2. - */ - } - - if (!gi->scalefac_scale && !gi->preflag) { - int s = 0; - for (sfb = 0; sfb < gi->sfbmax; sfb++) - if (gi->scalefac[sfb] > 0) - s |= gi->scalefac[sfb]; - - if (!(s & 1) && s != 0) { - for (sfb = 0; sfb < gi->sfbmax; sfb++) - if (gi->scalefac[sfb] > 0) - gi->scalefac[sfb] >>= 1; - - gi->scalefac_scale = recalc = 1; - } - } - - if (!gi->preflag && gi->block_type != SHORT_TYPE && cfg->mode_gr == 2) { - for (sfb = 11; sfb < SBPSY_l; sfb++) - if (gi->scalefac[sfb] < pretab[sfb] && gi->scalefac[sfb] != -2) - break; - if (sfb == SBPSY_l) { - for (sfb = 11; sfb < SBPSY_l; sfb++) - if (gi->scalefac[sfb] > 0) - gi->scalefac[sfb] -= pretab[sfb]; - - gi->preflag = recalc = 1; - } - } - - for (i = 0; i < 4; i++) - l3_side->scfsi[ch][i] = 0; - - if (cfg->mode_gr == 2 && gr == 1 - && l3_side->tt[0][ch].block_type != SHORT_TYPE - && l3_side->tt[1][ch].block_type != SHORT_TYPE) { - scfsi_calc(ch, l3_side); - recalc = 0; - } - for (sfb = 0; sfb < gi->sfbmax; sfb++) { - if (gi->scalefac[sfb] == -2) { - gi->scalefac[sfb] = 0; /* if anything goes, then 0 is a good choice */ - } - } - if (recalc) { - (void) scale_bitcount(gfc, gi); - } -} - - -#ifndef NDEBUG -static int -all_scalefactors_not_negative(int const *scalefac, int n) -{ - int i; - for (i = 0; i < n; ++i) { - if (scalefac[i] < 0) - return 0; - } - return 1; -} -#endif - - -/* number of bits used to encode scalefacs */ - -/* 18*slen1_tab[i] + 18*slen2_tab[i] */ -static const int scale_short[16] = { - 0, 18, 36, 54, 54, 36, 54, 72, 54, 72, 90, 72, 90, 108, 108, 126 -}; - -/* 17*slen1_tab[i] + 18*slen2_tab[i] */ -static const int scale_mixed[16] = { - 0, 18, 36, 54, 51, 35, 53, 71, 52, 70, 88, 69, 87, 105, 104, 122 -}; - -/* 11*slen1_tab[i] + 10*slen2_tab[i] */ -static const int scale_long[16] = { - 0, 10, 20, 30, 33, 21, 31, 41, 32, 42, 52, 43, 53, 63, 64, 74 -}; - - -/*************************************************************************/ -/* scale_bitcount */ -/*************************************************************************/ - -/* Also calculates the number of bits necessary to code the scalefactors. */ - -static int -mpeg1_scale_bitcount(const lame_internal_flags * gfc, gr_info * const cod_info) -{ - int k, sfb, max_slen1 = 0, max_slen2 = 0; - - /* maximum values */ - const int *tab; - int *const scalefac = cod_info->scalefac; - - (void) gfc; - assert(all_scalefactors_not_negative(scalefac, cod_info->sfbmax)); - - if (cod_info->block_type == SHORT_TYPE) { - tab = scale_short; - if (cod_info->mixed_block_flag) - tab = scale_mixed; - } - else { /* block_type == 1,2,or 3 */ - tab = scale_long; - if (!cod_info->preflag) { - for (sfb = 11; sfb < SBPSY_l; sfb++) - if (scalefac[sfb] < pretab[sfb]) - break; - - if (sfb == SBPSY_l) { - cod_info->preflag = 1; - for (sfb = 11; sfb < SBPSY_l; sfb++) - scalefac[sfb] -= pretab[sfb]; - } - } - } - - for (sfb = 0; sfb < cod_info->sfbdivide; sfb++) - if (max_slen1 < scalefac[sfb]) - max_slen1 = scalefac[sfb]; - - for (; sfb < cod_info->sfbmax; sfb++) - if (max_slen2 < scalefac[sfb]) - max_slen2 = scalefac[sfb]; - - /* from Takehiro TOMINAGA <tominaga@isoternet.org> 10/99 - * loop over *all* posible values of scalefac_compress to find the - * one which uses the smallest number of bits. ISO would stop - * at first valid index */ - cod_info->part2_length = LARGE_BITS; - for (k = 0; k < 16; k++) { - if (max_slen1 < slen1_n[k] && max_slen2 < slen2_n[k] - && cod_info->part2_length > tab[k]) { - cod_info->part2_length = tab[k]; - cod_info->scalefac_compress = k; - } - } - return cod_info->part2_length == LARGE_BITS; -} - - - -/* - table of largest scalefactor values for MPEG2 -*/ -static const int max_range_sfac_tab[6][4] = { - {15, 15, 7, 7}, - {15, 15, 7, 0}, - {7, 3, 0, 0}, - {15, 31, 31, 0}, - {7, 7, 7, 0}, - {3, 3, 0, 0} -}; - - - - -/*************************************************************************/ -/* scale_bitcount_lsf */ -/*************************************************************************/ - -/* Also counts the number of bits to encode the scalefacs but for MPEG 2 */ -/* Lower sampling frequencies (24, 22.05 and 16 kHz.) */ - -/* This is reverse-engineered from section 2.4.3.2 of the MPEG2 IS, */ -/* "Audio Decoding Layer III" */ - -static int -mpeg2_scale_bitcount(const lame_internal_flags * gfc, gr_info * const cod_info) -{ - int table_number, row_in_table, partition, nr_sfb, window, over; - int i, sfb, max_sfac[4]; - const int *partition_table; - int const *const scalefac = cod_info->scalefac; - - /* - Set partition table. Note that should try to use table one, - but do not yet... - */ - if (cod_info->preflag) - table_number = 2; - else - table_number = 0; - - for (i = 0; i < 4; i++) - max_sfac[i] = 0; - - if (cod_info->block_type == SHORT_TYPE) { - row_in_table = 1; - partition_table = &nr_of_sfb_block[table_number][row_in_table][0]; - for (sfb = 0, partition = 0; partition < 4; partition++) { - nr_sfb = partition_table[partition] / 3; - for (i = 0; i < nr_sfb; i++, sfb++) - for (window = 0; window < 3; window++) - if (scalefac[sfb * 3 + window] > max_sfac[partition]) - max_sfac[partition] = scalefac[sfb * 3 + window]; - } - } - else { - row_in_table = 0; - partition_table = &nr_of_sfb_block[table_number][row_in_table][0]; - for (sfb = 0, partition = 0; partition < 4; partition++) { - nr_sfb = partition_table[partition]; - for (i = 0; i < nr_sfb; i++, sfb++) - if (scalefac[sfb] > max_sfac[partition]) - max_sfac[partition] = scalefac[sfb]; - } - } - - for (over = 0, partition = 0; partition < 4; partition++) { - if (max_sfac[partition] > max_range_sfac_tab[table_number][partition]) - over++; - } - if (!over) { - /* - Since no bands have been over-amplified, we can set scalefac_compress - and slen[] for the formatter - */ - static const int log2tab[] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 }; - - int slen1, slen2, slen3, slen4; - - cod_info->sfb_partition_table = nr_of_sfb_block[table_number][row_in_table]; - for (partition = 0; partition < 4; partition++) - cod_info->slen[partition] = log2tab[max_sfac[partition]]; - - /* set scalefac_compress */ - slen1 = cod_info->slen[0]; - slen2 = cod_info->slen[1]; - slen3 = cod_info->slen[2]; - slen4 = cod_info->slen[3]; - - switch (table_number) { - case 0: - cod_info->scalefac_compress = (((slen1 * 5) + slen2) << 4) - + (slen3 << 2) - + slen4; - break; - - case 1: - cod_info->scalefac_compress = 400 + (((slen1 * 5) + slen2) << 2) - + slen3; - break; - - case 2: - cod_info->scalefac_compress = 500 + (slen1 * 3) + slen2; - break; - - default: - ERRORF(gfc, "intensity stereo not implemented yet\n"); - break; - } - } -#ifdef DEBUG - if (over) - ERRORF(gfc, "---WARNING !! Amplification of some bands over limits\n"); -#endif - if (!over) { - assert(cod_info->sfb_partition_table); - cod_info->part2_length = 0; - for (partition = 0; partition < 4; partition++) - cod_info->part2_length += - cod_info->slen[partition] * cod_info->sfb_partition_table[partition]; - } - return over; -} - - -int -scale_bitcount(const lame_internal_flags * gfc, gr_info * cod_info) -{ - if (gfc->cfg.mode_gr == 2) { - return mpeg1_scale_bitcount(gfc, cod_info); - } - else { - return mpeg2_scale_bitcount(gfc, cod_info); - } -} - - -#ifdef MMX_choose_table -extern int choose_table_MMX(const int *ix, const int *const end, int *const s); -#endif - -void -huffman_init(lame_internal_flags * const gfc) -{ - int i; - - gfc->choose_table = choose_table_nonMMX; - -#ifdef MMX_choose_table - if (gfc->CPU_features.MMX) { - gfc->choose_table = choose_table_MMX; - } -#endif - - for (i = 2; i <= 576; i += 2) { - int scfb_anz = 0, bv_index; - while (gfc->scalefac_band.l[++scfb_anz] < i); - - bv_index = subdv_table[scfb_anz].region0_count; - while (gfc->scalefac_band.l[bv_index + 1] > i) - bv_index--; - - if (bv_index < 0) { - /* this is an indication that everything is going to - be encoded as region0: bigvalues < region0 < region1 - so lets set region0, region1 to some value larger - than bigvalues */ - bv_index = subdv_table[scfb_anz].region0_count; - } - - gfc->sv_qnt.bv_scf[i - 2] = bv_index; - - bv_index = subdv_table[scfb_anz].region1_count; - while (gfc->scalefac_band.l[bv_index + gfc->sv_qnt.bv_scf[i - 2] + 2] > i) - bv_index--; - - if (bv_index < 0) { - bv_index = subdv_table[scfb_anz].region1_count; - } - - gfc->sv_qnt.bv_scf[i - 1] = bv_index; - } -} diff --git a/src/lib/dl/ext/lame/timestatus.c b/src/lib/dl/ext/lame/timestatus.c deleted file mode 100755 index ddfb6255..00000000 --- a/src/lib/dl/ext/lame/timestatus.c +++ /dev/null @@ -1,438 +0,0 @@ -/* - * time status related function source file - * - * Copyright (c) 1999 Mark Taylor - * 2010 Robert Hegemann - * - * 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. - */ - -/* $Id: timestatus.c,v 1.60 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#if 1 -# define SPEED_CHAR "x" /* character x */ -# define SPEED_MULT 1. -#else -# define SPEED_CHAR "%%" -# define SPEED_MULT 100. -#endif - -#include <assert.h> -#include <time.h> -#include <string.h> -#include <stdlib.h> - -#include "lame.h" -#include "main.h" -#include "lametime.h" -#include "timestatus.h" -#include "brhist.h" -#include "console.h" - -#ifdef WITH_DMALLOC -#include <dmalloc.h> -#endif - -typedef struct time_status_struct { - double last_time; /* result of last call to clock */ - double elapsed_time; /* total time */ - double estimated_time; /* estimated total duration time [s] */ - double speed_index; /* speed relative to realtime coding [100%] */ -} timestatus_t; - -static struct EncoderProgress { - timestatus_t real_time; - timestatus_t proc_time; - double last_time; - int last_frame_num; - int time_status_init; -} global_encoder_progress; - - -/* - * Calculates from the input (see below) the following values: - * - total estimated time - * - a speed index - */ - -static void -ts_calc_times(timestatus_t * const tstime, /* tstime->elapsed_time: elapsed time */ - const int sample_freq, /* sample frequency [Hz/kHz] */ - const int frameNum, /* Number of the current Frame */ - const int totalframes, /* total umber of Frames */ - const int framesize) -{ /* Size of a frame [bps/kbps] */ - assert(sample_freq >= 8000 && sample_freq <= 48000); - - if (frameNum > 0 && tstime->elapsed_time > 0) { - tstime->estimated_time = tstime->elapsed_time * totalframes / frameNum; - tstime->speed_index = framesize * frameNum / (sample_freq * tstime->elapsed_time); - } - else { - tstime->estimated_time = 0.; - tstime->speed_index = 0.; - } -} - -/* Decomposes a given number of seconds into a easy to read hh:mm:ss format - * padded with an additional character - */ - -static void -ts_time_decompose(const double x, const char padded_char) -{ - const unsigned long time_in_sec = (unsigned long)x; - const unsigned long hour = time_in_sec / 3600; - const unsigned int min = time_in_sec / 60 % 60; - const unsigned int sec = time_in_sec % 60; - - if (hour == 0) - console_printf(" %2u:%02u%c", min, sec, padded_char); - else if (hour < 100) - console_printf("%2lu:%02u:%02u%c", hour, min, sec, padded_char); - else - console_printf("%6lu h%c", hour, padded_char); -} - -static void -timestatus(const lame_global_flags * const gfp) -{ - timestatus_t* real_time = &global_encoder_progress.real_time; - timestatus_t* proc_time = &global_encoder_progress.proc_time; - int percent; - double tmx, delta; - int samp_rate = lame_get_out_samplerate(gfp) - , frameNum = lame_get_frameNum(gfp) - , totalframes = lame_get_totalframes(gfp) - , framesize = lame_get_framesize(gfp) - ; - - if (totalframes < frameNum) { - totalframes = frameNum; - } - if (global_encoder_progress.time_status_init == 0) { - real_time->last_time = GetRealTime(); - proc_time->last_time = GetCPUTime(); - real_time->elapsed_time = 0; - proc_time->elapsed_time = 0; - } - - /* we need rollover protection for GetCPUTime, and maybe GetRealTime(): */ - tmx = GetRealTime(); - delta = tmx - real_time->last_time; - if (delta < 0) - delta = 0; /* ignore, clock has rolled over */ - real_time->elapsed_time += delta; - real_time->last_time = tmx; - - - tmx = GetCPUTime(); - delta = tmx - proc_time->last_time; - if (delta < 0) - delta = 0; /* ignore, clock has rolled over */ - proc_time->elapsed_time += delta; - proc_time->last_time = tmx; - - if (global_encoder_progress.time_status_init == 0) { - console_printf("\r" - " Frame | CPU time/estim | REAL time/estim | play/CPU | ETA \n" - " 0/ ( 0%%)| 0:00/ : | 0:00/ : | " - SPEED_CHAR "| : \r" - /* , Console_IO.str_clreoln, Console_IO.str_clreoln */ ); - global_encoder_progress.time_status_init = 1; - return; - } - - ts_calc_times(real_time, samp_rate, frameNum, totalframes, framesize); - ts_calc_times(proc_time, samp_rate, frameNum, totalframes, framesize); - - if (frameNum < totalframes) { - percent = (int) (100. * frameNum / totalframes + 0.5); - } - else { - percent = 100; - } - - console_printf("\r%6i/%-6i", frameNum, totalframes); - console_printf(percent < 100 ? " (%2d%%)|" : "(%3.3d%%)|", percent); - ts_time_decompose(proc_time->elapsed_time, '/'); - ts_time_decompose(proc_time->estimated_time, '|'); - ts_time_decompose(real_time->elapsed_time, '/'); - ts_time_decompose(real_time->estimated_time, '|'); - console_printf(proc_time->speed_index <= 1. ? - "%9.4f" SPEED_CHAR "|" : "%#9.5g" SPEED_CHAR "|", - SPEED_MULT * proc_time->speed_index); - ts_time_decompose((real_time->estimated_time - real_time->elapsed_time), ' '); -} - -static void -timestatus_finish(void) -{ - console_printf("\n"); -} - - -static void -brhist_init_package(lame_global_flags const* gf) -{ - if (global_ui_config.brhist) { - if (brhist_init(gf, lame_get_VBR_min_bitrate_kbps(gf), lame_get_VBR_max_bitrate_kbps(gf))) { - /* fail to initialize */ - global_ui_config.brhist = 0; - } - } - else { - brhist_init(gf, 128, 128); /* Dirty hack */ - } -} - - -void -encoder_progress_begin( lame_global_flags const* gf - , char const* inPath - , char const* outPath - ) -{ - brhist_init_package(gf); - global_encoder_progress.time_status_init = 0; - global_encoder_progress.last_time = 0; - global_encoder_progress.last_frame_num = 0; - if (global_ui_config.silent < 9) { - char* i_file = 0; - char* o_file = 0; -#if defined( _WIN32 ) && !defined(__MINGW32__) - inPath = i_file = utf8ToLocal8Bit(inPath); - outPath = o_file = utf8ToConsole8Bit(outPath); -#endif - lame_print_config(gf); /* print useful information about options being used */ - - console_printf("Encoding %s%s to %s\n", - strcmp(inPath, "-") ? inPath : "<stdin>", - strlen(inPath) + strlen(outPath) < 66 ? "" : "\n ", - strcmp(outPath, "-") ? outPath : "<stdout>"); - - free(i_file); - free(o_file); - - console_printf("Encoding as %g kHz ", 1.e-3 * lame_get_out_samplerate(gf)); - - { - static const char *mode_names[2][4] = { - {"stereo", "j-stereo", "dual-ch", "single-ch"}, - {"stereo", "force-ms", "dual-ch", "single-ch"} - }; - switch (lame_get_VBR(gf)) { - case vbr_rh: - console_printf("%s MPEG-%u%s Layer III VBR(q=%g) qval=%i\n", - mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)], - 2 - lame_get_version(gf), - lame_get_out_samplerate(gf) < 16000 ? ".5" : "", - lame_get_VBR_quality(gf), - lame_get_quality(gf)); - break; - case vbr_mt: - case vbr_mtrh: - console_printf("%s MPEG-%u%s Layer III VBR(q=%g)\n", - mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)], - 2 - lame_get_version(gf), - lame_get_out_samplerate(gf) < 16000 ? ".5" : "", - lame_get_VBR_quality(gf)); - break; - case vbr_abr: - console_printf("%s MPEG-%u%s Layer III (%gx) average %d kbps qval=%i\n", - mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)], - 2 - lame_get_version(gf), - lame_get_out_samplerate(gf) < 16000 ? ".5" : "", - 0.1 * (int) (10. * lame_get_compression_ratio(gf) + 0.5), - lame_get_VBR_mean_bitrate_kbps(gf), - lame_get_quality(gf)); - break; - default: - console_printf("%s MPEG-%u%s Layer III (%gx) %3d kbps qval=%i\n", - mode_names[lame_get_force_ms(gf)][lame_get_mode(gf)], - 2 - lame_get_version(gf), - lame_get_out_samplerate(gf) < 16000 ? ".5" : "", - 0.1 * (int) (10. * lame_get_compression_ratio(gf) + 0.5), - lame_get_brate(gf), - lame_get_quality(gf)); - break; - } - } - - if (global_ui_config.silent <= -10) { - lame_print_internals(gf); - } - } -} - -void -encoder_progress( lame_global_flags const* gf ) -{ - if (global_ui_config.silent <= 0) { - int const frames = lame_get_frameNum(gf); - int const frames_diff = frames - global_encoder_progress.last_frame_num; - if (global_ui_config.update_interval <= 0) { /* most likely --disptime x not used */ - if (frames_diff < 100 && frames_diff != 0) { /* true, most of the time */ - return; - } - global_encoder_progress.last_frame_num = (frames/100)*100; - } - else { - if (frames != 0 && frames != 9) { - double const act = GetRealTime(); - double const dif = act - global_encoder_progress.last_time; - if (dif >= 0 && dif < global_ui_config.update_interval) { - return; - } - } - global_encoder_progress.last_time = GetRealTime(); /* from now! disp_time seconds */ - } - if (global_ui_config.brhist) { - brhist_jump_back(); - } - timestatus(gf); - if (global_ui_config.brhist) { - brhist_disp(gf); - } - console_flush(); - } -} - -void -encoder_progress_end( lame_global_flags const* gf ) -{ - if (global_ui_config.silent <= 0) { - if (global_ui_config.brhist) { - brhist_jump_back(); - } - timestatus(gf); - if (global_ui_config.brhist) { - brhist_disp(gf); - } - timestatus_finish(); - } -} - - -/* these functions are used in get_audio.c */ -static struct DecoderProgress { - int last_mode_ext; - int frames_total; - int frame_ctr; - int framesize; - unsigned long samples; -} global_decoder_progress; - -static -unsigned long calcEndPadding(unsigned long samples, int pcm_samples_per_frame) -{ - unsigned long end_padding; - samples += 576; - end_padding = pcm_samples_per_frame - (samples % pcm_samples_per_frame); - if (end_padding < 576) - end_padding += pcm_samples_per_frame; - return end_padding; -} - -static -unsigned long calcNumBlocks(unsigned long samples, int pcm_samples_per_frame) -{ - unsigned long end_padding; - samples += 576; - end_padding = pcm_samples_per_frame - (samples % pcm_samples_per_frame); - if (end_padding < 576) - end_padding += pcm_samples_per_frame; - return (samples + end_padding) / pcm_samples_per_frame; -} - -DecoderProgress -decoder_progress_init(unsigned long n, int framesize) -{ - DecoderProgress dp = &global_decoder_progress; - dp->last_mode_ext =0; - dp->frames_total = 0; - dp->frame_ctr = 0; - dp->framesize = framesize; - dp->samples = 0; - if (n != (0ul-1ul)) { - if (framesize == 576 || framesize == 1152) { - dp->frames_total = calcNumBlocks(n, framesize); - dp->samples = 576 + calcEndPadding(n, framesize); - } - else if (framesize > 0) { - dp->frames_total = n / framesize; - } - else { - dp->frames_total = n; - } - } - return dp; -} - -static void -addSamples(DecoderProgress dp, int iread) -{ - dp->samples += iread; - dp->frame_ctr += dp->samples / dp->framesize; - dp->samples %= dp->framesize; - if (dp->frames_total < dp->frame_ctr) { - dp->frames_total = dp->frame_ctr; - } -} - -void -decoder_progress(DecoderProgress dp, const mp3data_struct * mp3data, int iread) -{ - addSamples(dp, iread); - - console_printf("\rFrame#%6i/%-6i %3i kbps", - dp->frame_ctr, dp->frames_total, mp3data->bitrate); - - /* Programmed with a single frame hold delay */ - /* Attention: static data */ - - /* MP2 Playback is still buggy. */ - /* "'00' subbands 4-31 in intensity_stereo, bound==4" */ - /* is this really intensity_stereo or is it MS stereo? */ - - if (mp3data->mode == JOINT_STEREO) { - int curr = mp3data->mode_ext; - int last = dp->last_mode_ext; - console_printf(" %s %c", - curr & 2 ? last & 2 ? " MS " : "LMSR" : last & 2 ? "LMSR" : "L R", - curr & 1 ? last & 1 ? 'I' : 'i' : last & 1 ? 'i' : ' '); - dp->last_mode_ext = curr; - } - else { - console_printf(" "); - dp->last_mode_ext = 0; - } -/* console_printf ("%s", Console_IO.str_clreoln ); */ - console_printf(" \b\b\b\b\b\b\b\b"); - console_flush(); -} - -void -decoder_progress_finish(DecoderProgress dp) -{ - (void) dp; - console_printf("\n"); -} diff --git a/src/lib/dl/ext/lame/timestatus.h b/src/lib/dl/ext/lame/timestatus.h deleted file mode 100755 index f5d343ba..00000000 --- a/src/lib/dl/ext/lame/timestatus.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * time status related function include file - * - * Copyright (c) 1999 Mark Taylor - * - * 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_TIMESTATUS_H -#define LAME_TIMESTATUS_H - -#if defined(__cplusplus) -extern "C" { -#endif - -void encoder_progress_begin( lame_global_flags const* gfp - , char const* inpath - , char const* outpath ); -void encoder_progress( lame_global_flags const* gfp ); -void encoder_progress_end(lame_global_flags const* gfp); - -struct DecoderProgress; -typedef struct DecoderProgress* DecoderProgress; - -DecoderProgress decoder_progress_init(unsigned long n, int framesize); -void decoder_progress(DecoderProgress dp, const mp3data_struct *, int iread); -void decoder_progress_finish(DecoderProgress dp); - -#if defined(__cplusplus) -} -#endif - -#endif /* LAME_TIMESTATUS_H */ diff --git a/src/lib/dl/ext/lame/util.c b/src/lib/dl/ext/lame/util.c deleted file mode 100755 index 6ba3256e..00000000 --- a/src/lib/dl/ext/lame/util.c +++ /dev/null @@ -1,990 +0,0 @@ -/* - * lame utility library source file - * - * Copyright (c) 1999 Albert L Faber - * Copyright (c) 2000-2005 Alexander Leidinger - * - * 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. - */ - -/* $Id: util.c,v 1.154 2011/10/18 21:51:20 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "tables.h" - -#define PRECOMPUTE -#if defined(__FreeBSD__) && !defined(__alpha__) -# include <machine/floatingpoint.h> -#endif - - -/*********************************************************************** -* -* Global Function Definitions -* -***********************************************************************/ -/*empty and close mallocs in gfc */ - -void -free_id3tag(lame_internal_flags * const gfc) -{ - if (gfc->tag_spec.title != 0) { - free(gfc->tag_spec.title); - gfc->tag_spec.title = 0; - } - if (gfc->tag_spec.artist != 0) { - free(gfc->tag_spec.artist); - gfc->tag_spec.artist = 0; - } - if (gfc->tag_spec.album != 0) { - free(gfc->tag_spec.album); - gfc->tag_spec.album = 0; - } - if (gfc->tag_spec.comment != 0) { - free(gfc->tag_spec.comment); - gfc->tag_spec.comment = 0; - } - - if (gfc->tag_spec.albumart != 0) { - free(gfc->tag_spec.albumart); - gfc->tag_spec.albumart = 0; - gfc->tag_spec.albumart_size = 0; - gfc->tag_spec.albumart_mimetype = MIMETYPE_NONE; - } - if (gfc->tag_spec.values != 0) { - unsigned int i; - for (i = 0; i < gfc->tag_spec.num_values; ++i) { - free(gfc->tag_spec.values[i]); - } - free(gfc->tag_spec.values); - gfc->tag_spec.values = 0; - gfc->tag_spec.num_values = 0; - } - if (gfc->tag_spec.v2_head != 0) { - FrameDataNode *node = gfc->tag_spec.v2_head; - do { - void *p = node->dsc.ptr.b; - void *q = node->txt.ptr.b; - void *r = node; - node = node->nxt; - free(p); - free(q); - free(r); - } while (node != 0); - gfc->tag_spec.v2_head = 0; - gfc->tag_spec.v2_tail = 0; - } -} - - -static void -free_global_data(lame_internal_flags * gfc) -{ - if (gfc && gfc->cd_psy) { - if (gfc->cd_psy->l.s3) { - /* XXX allocated in psymodel_init() */ - free(gfc->cd_psy->l.s3); - } - if (gfc->cd_psy->s.s3) { - /* XXX allocated in psymodel_init() */ - free(gfc->cd_psy->s.s3); - } - free(gfc->cd_psy); - gfc->cd_psy = 0; - } -} - - -void -freegfc(lame_internal_flags * const gfc) -{ /* bit stream structure */ - int i; - - - for (i = 0; i <= 2 * BPC; i++) - if (gfc->sv_enc.blackfilt[i] != NULL) { - free(gfc->sv_enc.blackfilt[i]); - gfc->sv_enc.blackfilt[i] = NULL; - } - if (gfc->sv_enc.inbuf_old[0]) { - free(gfc->sv_enc.inbuf_old[0]); - gfc->sv_enc.inbuf_old[0] = NULL; - } - if (gfc->sv_enc.inbuf_old[1]) { - free(gfc->sv_enc.inbuf_old[1]); - gfc->sv_enc.inbuf_old[1] = NULL; - } - - if (gfc->bs.buf != NULL) { - free(gfc->bs.buf); - gfc->bs.buf = NULL; - } - - if (gfc->VBR_seek_table.bag) { - free(gfc->VBR_seek_table.bag); - gfc->VBR_seek_table.bag = NULL; - gfc->VBR_seek_table.size = 0; - } - if (gfc->ATH) { - free(gfc->ATH); - } - if (gfc->sv_rpg.rgdata) { - free(gfc->sv_rpg.rgdata); - } - if (gfc->sv_enc.in_buffer_0) { - free(gfc->sv_enc.in_buffer_0); - } - if (gfc->sv_enc.in_buffer_1) { - free(gfc->sv_enc.in_buffer_1); - } - free_id3tag(gfc); - -#ifdef DECODE_ON_THE_FLY - if (gfc->hip) { - hip_decode_exit(gfc->hip); - gfc->hip = 0; - } -#endif - - free_global_data(gfc); - - free(gfc); -} - -/*those ATH formulas are returning -their minimum value for input = -1*/ - -static FLOAT -ATHformula_GB(FLOAT f, FLOAT value, FLOAT f_min, FLOAT f_max) -{ - /* from Painter & Spanias - modified by Gabriel Bouvigne to better fit the reality - ath = 3.640 * pow(f,-0.8) - - 6.800 * exp(-0.6*pow(f-3.4,2.0)) - + 6.000 * exp(-0.15*pow(f-8.7,2.0)) - + 0.6* 0.001 * pow(f,4.0); - - - In the past LAME was using the Painter &Spanias formula. - But we had some recurrent problems with HF content. - We measured real ATH values, and found the older formula - to be inacurate in the higher part. So we made this new - formula and this solved most of HF problematic testcases. - The tradeoff is that in VBR mode it increases a lot the - bitrate. */ - - -/*this curve can be udjusted according to the VBR scale: -it adjusts from something close to Painter & Spanias -on V9 up to Bouvigne's formula for V0. This way the VBR -bitrate is more balanced according to the -V value.*/ - - FLOAT ath; - - /* the following Hack allows to ask for the lowest value */ - if (f < -.3) - f = 3410; - - f /= 1000; /* convert to khz */ - f = Max(f_min, f); - f = Min(f_max, f); - - ath = 3.640 * pow(f, -0.8) - - 6.800 * exp(-0.6 * pow(f - 3.4, 2.0)) - + 6.000 * exp(-0.15 * pow(f - 8.7, 2.0)) - + (0.6 + 0.04 * value) * 0.001 * pow(f, 4.0); - return ath; -} - - - -FLOAT -ATHformula(SessionConfig_t const *cfg, FLOAT f) -{ - FLOAT ath; - switch (cfg->ATHtype) { - case 0: - ath = ATHformula_GB(f, 9, 0.1f, 24.0f); - break; - case 1: - ath = ATHformula_GB(f, -1, 0.1f, 24.0f); /*over sensitive, should probably be removed */ - break; - case 2: - ath = ATHformula_GB(f, 0, 0.1f, 24.0f); - break; - case 3: - ath = ATHformula_GB(f, 1, 0.1f, 24.0f) + 6; /*modification of GB formula by Roel */ - break; - case 4: - ath = ATHformula_GB(f, cfg->ATHcurve, 0.1f, 24.0f); - break; - case 5: - ath = ATHformula_GB(f, cfg->ATHcurve, 3.41f, 16.1f); - break; - default: - ath = ATHformula_GB(f, 0, 0.1f, 24.0f); - break; - } - return ath; -} - -/* see for example "Zwicker: Psychoakustik, 1982; ISBN 3-540-11401-7 */ -FLOAT -freq2bark(FLOAT freq) -{ - /* input: freq in hz output: barks */ - if (freq < 0) - freq = 0; - freq = freq * 0.001; - return 13.0 * atan(.76 * freq) + 3.5 * atan(freq * freq / (7.5 * 7.5)); -} - -#if 0 -extern FLOAT freq2cbw(FLOAT freq); - -/* see for example "Zwicker: Psychoakustik, 1982; ISBN 3-540-11401-7 */ -FLOAT -freq2cbw(FLOAT freq) -{ - /* input: freq in hz output: critical band width */ - freq = freq * 0.001; - return 25 + 75 * pow(1 + 1.4 * (freq * freq), 0.69); -} - -#endif - - - - -#define ABS(A) (((A)>0) ? (A) : -(A)) - -int -FindNearestBitrate(int bRate, /* legal rates from 8 to 320 */ - int version, int samplerate) -{ /* MPEG-1 or MPEG-2 LSF */ - int bitrate; - int i; - - if (samplerate < 16000) - version = 2; - - bitrate = bitrate_table[version][1]; - - for (i = 2; i <= 14; i++) { - if (bitrate_table[version][i] > 0) { - if (ABS(bitrate_table[version][i] - bRate) < ABS(bitrate - bRate)) - bitrate = bitrate_table[version][i]; - } - } - return bitrate; -} - - - - - -#ifndef Min -#define Min(A, B) ((A) < (B) ? (A) : (B)) -#endif -#ifndef Max -#define Max(A, B) ((A) > (B) ? (A) : (B)) -#endif - - -/* Used to find table index when - * we need bitrate-based values - * determined using tables - * - * bitrate in kbps - * - * Gabriel Bouvigne 2002-11-03 - */ -int -nearestBitrateFullIndex(uint16_t bitrate) -{ - /* borrowed from DM abr presets */ - - const int full_bitrate_table[] = - { 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 }; - - - int lower_range = 0, lower_range_kbps = 0, upper_range = 0, upper_range_kbps = 0; - - - int b; - - - /* We assume specified bitrate will be 320kbps */ - upper_range_kbps = full_bitrate_table[16]; - upper_range = 16; - lower_range_kbps = full_bitrate_table[16]; - lower_range = 16; - - /* Determine which significant bitrates the value specified falls between, - * if loop ends without breaking then we were correct above that the value was 320 - */ - for (b = 0; b < 16; b++) { - if ((Max(bitrate, full_bitrate_table[b + 1])) != bitrate) { - upper_range_kbps = full_bitrate_table[b + 1]; - upper_range = b + 1; - lower_range_kbps = full_bitrate_table[b]; - lower_range = (b); - break; /* We found upper range */ - } - } - - /* Determine which range the value specified is closer to */ - if ((upper_range_kbps - bitrate) > (bitrate - lower_range_kbps)) { - return lower_range; - } - return upper_range; -} - - - - - -/* map frequency to a valid MP3 sample frequency - * - * Robert Hegemann 2000-07-01 - */ -int -map2MP3Frequency(int freq) -{ - if (freq <= 8000) - return 8000; - if (freq <= 11025) - return 11025; - if (freq <= 12000) - return 12000; - if (freq <= 16000) - return 16000; - if (freq <= 22050) - return 22050; - if (freq <= 24000) - return 24000; - if (freq <= 32000) - return 32000; - if (freq <= 44100) - return 44100; - - return 48000; -} - -int -BitrateIndex(int bRate, /* legal rates from 32 to 448 kbps */ - int version, /* MPEG-1 or MPEG-2/2.5 LSF */ - int samplerate) -{ /* convert bitrate in kbps to index */ - int i; - if (samplerate < 16000) - version = 2; - for (i = 0; i <= 14; i++) { - if (bitrate_table[version][i] > 0) { - if (bitrate_table[version][i] == bRate) { - return i; - } - } - } - return -1; -} - -/* convert samp freq in Hz to index */ - -int -SmpFrqIndex(int sample_freq, int *const version) -{ - switch (sample_freq) { - case 44100: - *version = 1; - return 0; - case 48000: - *version = 1; - return 1; - case 32000: - *version = 1; - return 2; - case 22050: - *version = 0; - return 0; - case 24000: - *version = 0; - return 1; - case 16000: - *version = 0; - return 2; - case 11025: - *version = 0; - return 0; - case 12000: - *version = 0; - return 1; - case 8000: - *version = 0; - return 2; - default: - *version = 0; - return -1; - } -} - - -/***************************************************************************** -* -* End of bit_stream.c package -* -*****************************************************************************/ - - - - - - - - - - -/* resampling via FIR filter, blackman window */ -inline static FLOAT -blackman(FLOAT x, FLOAT fcn, int l) -{ - /* This algorithm from: - SIGNAL PROCESSING ALGORITHMS IN FORTRAN AND C - S.D. Stearns and R.A. David, Prentice-Hall, 1992 - */ - FLOAT bkwn, x2; - FLOAT const wcn = (PI * fcn); - - x /= l; - if (x < 0) - x = 0; - if (x > 1) - x = 1; - x2 = x - .5; - - bkwn = 0.42 - 0.5 * cos(2 * x * PI) + 0.08 * cos(4 * x * PI); - if (fabs(x2) < 1e-9) - return wcn / PI; - else - return (bkwn * sin(l * wcn * x2) / (PI * l * x2)); - - -} - - - - -/* gcd - greatest common divisor */ -/* Joint work of Euclid and M. Hendry */ - -static int -gcd(int i, int j) -{ - /* assert ( i > 0 && j > 0 ); */ - return j ? gcd(j, i % j) : i; -} - - - -static int -fill_buffer_resample(lame_internal_flags * gfc, - sample_t * outbuf, - int desired_len, sample_t const *inbuf, int len, int *num_used, int ch) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncStateVar_t *esv = &gfc->sv_enc; - double resample_ratio = (double)cfg->samplerate_in / (double)cfg->samplerate_out; - int BLACKSIZE; - FLOAT offset, xvalue; - int i, j = 0, k; - int filter_l; - FLOAT fcn, intratio; - FLOAT *inbuf_old; - int bpc; /* number of convolution functions to pre-compute */ - bpc = cfg->samplerate_out / gcd(cfg->samplerate_out, cfg->samplerate_in); - if (bpc > BPC) - bpc = BPC; - - intratio = (fabs(resample_ratio - floor(.5 + resample_ratio)) < .0001); - fcn = 1.00 / resample_ratio; - if (fcn > 1.00) - fcn = 1.00; - filter_l = 31; /* must be odd */ - filter_l += intratio; /* unless resample_ratio=int, it must be even */ - - - BLACKSIZE = filter_l + 1; /* size of data needed for FIR */ - - if (gfc->fill_buffer_resample_init == 0) { - esv->inbuf_old[0] = calloc(BLACKSIZE, sizeof(esv->inbuf_old[0][0])); - esv->inbuf_old[1] = calloc(BLACKSIZE, sizeof(esv->inbuf_old[0][0])); - for (i = 0; i <= 2 * bpc; ++i) - esv->blackfilt[i] = calloc(BLACKSIZE, sizeof(esv->blackfilt[0][0])); - - esv->itime[0] = 0; - esv->itime[1] = 0; - - /* precompute blackman filter coefficients */ - for (j = 0; j <= 2 * bpc; j++) { - FLOAT sum = 0.; - offset = (j - bpc) / (2. * bpc); - for (i = 0; i <= filter_l; i++) - sum += esv->blackfilt[j][i] = blackman(i - offset, fcn, filter_l); - for (i = 0; i <= filter_l; i++) - esv->blackfilt[j][i] /= sum; - } - gfc->fill_buffer_resample_init = 1; - } - - inbuf_old = esv->inbuf_old[ch]; - - /* time of j'th element in inbuf = itime + j/ifreq; */ - /* time of k'th element in outbuf = j/ofreq */ - for (k = 0; k < desired_len; k++) { - double time0 = k * resample_ratio; /* time of k'th output sample */ - int joff; - - j = floor(time0 - esv->itime[ch]); - - /* check if we need more input data */ - if ((filter_l + j - filter_l / 2) >= len) - break; - - /* blackman filter. by default, window centered at j+.5(filter_l%2) */ - /* but we want a window centered at time0. */ - offset = (time0 - esv->itime[ch] - (j + .5 * (filter_l % 2))); - assert(fabs(offset) <= .501); - - /* find the closest precomputed window for this offset: */ - joff = floor((offset * 2 * bpc) + bpc + .5); - - xvalue = 0.; - for (i = 0; i <= filter_l; ++i) { - int const j2 = i + j - filter_l / 2; - sample_t y; - assert(j2 < len); - assert(j2 + BLACKSIZE >= 0); - y = (j2 < 0) ? inbuf_old[BLACKSIZE + j2] : inbuf[j2]; -#ifdef PRECOMPUTE - xvalue += y * esv->blackfilt[joff][i]; -#else - xvalue += y * blackman(i - offset, fcn, filter_l); /* very slow! */ -#endif - } - outbuf[k] = xvalue; - } - - - /* k = number of samples added to outbuf */ - /* last k sample used data from [j-filter_l/2,j+filter_l-filter_l/2] */ - - /* how many samples of input data were used: */ - *num_used = Min(len, filter_l + j - filter_l / 2); - - /* adjust our input time counter. Incriment by the number of samples used, - * then normalize so that next output sample is at time 0, next - * input buffer is at time itime[ch] */ - esv->itime[ch] += *num_used - k * resample_ratio; - - /* save the last BLACKSIZE samples into the inbuf_old buffer */ - if (*num_used >= BLACKSIZE) { - for (i = 0; i < BLACKSIZE; i++) - inbuf_old[i] = inbuf[*num_used + i - BLACKSIZE]; - } - else { - /* shift in *num_used samples into inbuf_old */ - int const n_shift = BLACKSIZE - *num_used; /* number of samples to shift */ - - /* shift n_shift samples by *num_used, to make room for the - * num_used new samples */ - for (i = 0; i < n_shift; ++i) - inbuf_old[i] = inbuf_old[i + *num_used]; - - /* shift in the *num_used samples */ - for (j = 0; i < BLACKSIZE; ++i, ++j) - inbuf_old[i] = inbuf[j]; - - assert(j == *num_used); - } - return k; /* return the number samples created at the new samplerate */ -} - -int -isResamplingNecessary(SessionConfig_t const* cfg) -{ - int const l = cfg->samplerate_out * 0.9995f; - int const h = cfg->samplerate_out * 1.0005f; - return (cfg->samplerate_in < l) || (h < cfg->samplerate_in) ? 1 : 0; -} - -/* copy in new samples from in_buffer into mfbuf, with resampling - if necessary. n_in = number of samples from the input buffer that - were used. n_out = number of samples copied into mfbuf */ - -void -fill_buffer(lame_internal_flags * gfc, - sample_t * const mfbuf[2], sample_t const * const in_buffer[2], int nsamples, int *n_in, int *n_out) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int mf_size = gfc->sv_enc.mf_size; - int framesize = 576 * cfg->mode_gr; - int nout, ch = 0; - int nch = cfg->channels_out; - - /* copy in new samples into mfbuf, with resampling if necessary */ - if (isResamplingNecessary(cfg)) { - do { - nout = - fill_buffer_resample(gfc, mfbuf[ch]+mf_size, - framesize, in_buffer[ch], nsamples, n_in, ch); - } while (++ch < nch); - *n_out = nout; - } - else { - nout = Min(framesize, nsamples); - do { - memcpy(mfbuf[ch]+mf_size,in_buffer[ch],sizeof(sample_t) * nout); - } while (++ch < nch); - *n_out = nout; - *n_in = nout; - } -} - - - - - - - -/*********************************************************************** -* -* Message Output -* -***********************************************************************/ - -void -lame_report_def(const char *format, va_list args) -{ - (void) vfprintf(stderr, format, args); - fflush(stderr); /* an debug function should flush immediately */ -} - -void -lame_report_fnc(lame_report_function print_f, const char *format, ...) -{ - if (print_f) { - va_list args; - va_start(args, format); - print_f(format, args); - va_end(args); - } -} - - -void -lame_debugf(const lame_internal_flags* gfc, const char *format, ...) -{ - if (gfc && gfc->report_dbg) { - va_list args; - va_start(args, format); - gfc->report_dbg(format, args); - va_end(args); - } -} - - -void -lame_msgf(const lame_internal_flags* gfc, const char *format, ...) -{ - if (gfc && gfc->report_msg) { - va_list args; - va_start(args, format); - gfc->report_msg(format, args); - va_end(args); - } -} - - -void -lame_errorf(const lame_internal_flags* gfc, const char *format, ...) -{ - if (gfc && gfc->report_err) { - va_list args; - va_start(args, format); - gfc->report_err(format, args); - va_end(args); - } -} - - - -/*********************************************************************** - * - * routines to detect CPU specific features like 3DNow, MMX, SSE - * - * donated by Frank Klemm - * added Robert Hegemann 2000-10-10 - * - ***********************************************************************/ - -#ifdef HAVE_NASM -extern int has_MMX_nasm(void); -extern int has_3DNow_nasm(void); -extern int has_SSE_nasm(void); -extern int has_SSE2_nasm(void); -#endif - -int -has_MMX(void) -{ -#ifdef HAVE_NASM - return has_MMX_nasm(); -#else - return 0; /* don't know, assume not */ -#endif -} - -int -has_3DNow(void) -{ -#ifdef HAVE_NASM - return has_3DNow_nasm(); -#else - return 0; /* don't know, assume not */ -#endif -} - -int -has_SSE(void) -{ -#ifdef HAVE_NASM - return has_SSE_nasm(); -#else -#if defined( _M_X64 ) || defined( MIN_ARCH_SSE ) - return 1; -#else - return 0; /* don't know, assume not */ -#endif -#endif -} - -int -has_SSE2(void) -{ -#ifdef HAVE_NASM - return has_SSE2_nasm(); -#else -#if defined( _M_X64 ) || defined( MIN_ARCH_SSE ) - return 1; -#else - return 0; /* don't know, assume not */ -#endif -#endif -} - -void -disable_FPE(void) -{ -/* extremly system dependent stuff, move to a lib to make the code readable */ -/*==========================================================================*/ - - - - /* - * Disable floating point exceptions - */ - - - - -#if defined(__FreeBSD__) && !defined(__alpha__) - { - /* seet floating point mask to the Linux default */ - fp_except_t mask; - mask = fpgetmask(); - /* if bit is set, we get SIGFPE on that error! */ - fpsetmask(mask & ~(FP_X_INV | FP_X_DZ)); - /* DEBUGF("FreeBSD mask is 0x%x\n",mask); */ - } -#endif - -#if defined(__riscos__) && !defined(ABORTFP) - /* Disable FPE's under RISC OS */ - /* if bit is set, we disable trapping that error! */ - /* _FPE_IVO : invalid operation */ - /* _FPE_DVZ : divide by zero */ - /* _FPE_OFL : overflow */ - /* _FPE_UFL : underflow */ - /* _FPE_INX : inexact */ - DisableFPETraps(_FPE_IVO | _FPE_DVZ | _FPE_OFL); -#endif - - /* - * Debugging stuff - * The default is to ignore FPE's, unless compiled with -DABORTFP - * so add code below to ENABLE FPE's. - */ - -#if defined(ABORTFP) -#if defined(_MSC_VER) - { -#if 0 - /* rh 061207 - the following fix seems to be a workaround for a problem in the - parent process calling LAME. It would be better to fix the broken - application => code disabled. - */ - - /* set affinity to a single CPU. Fix for EAC/lame on SMP systems from - "Todd Richmond" <todd.richmond@openwave.com> */ - SYSTEM_INFO si; - GetSystemInfo(&si); - SetProcessAffinityMask(GetCurrentProcess(), si.dwActiveProcessorMask); -#endif -#include <float.h> - unsigned int mask; - mask = _controlfp(0, 0); - mask &= ~(_EM_OVERFLOW | _EM_UNDERFLOW | _EM_ZERODIVIDE | _EM_INVALID); - mask = _controlfp(mask, _MCW_EM); - } -#elif defined(__CYGWIN__) -# define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw)) -# define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw)) - -# define _EM_INEXACT 0x00000020 /* inexact (precision) */ -# define _EM_UNDERFLOW 0x00000010 /* underflow */ -# define _EM_OVERFLOW 0x00000008 /* overflow */ -# define _EM_ZERODIVIDE 0x00000004 /* zero divide */ -# define _EM_INVALID 0x00000001 /* invalid */ - { - unsigned int mask; - _FPU_GETCW(mask); - /* Set the FPU control word to abort on most FPEs */ - mask &= ~(_EM_OVERFLOW | _EM_ZERODIVIDE | _EM_INVALID); - _FPU_SETCW(mask); - } -# elif defined(__linux__) - { - -# include <fpu_control.h> -# ifndef _FPU_GETCW -# define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw)) -# endif -# ifndef _FPU_SETCW -# define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw)) -# endif - - /* - * Set the Linux mask to abort on most FPE's - * if bit is set, we _mask_ SIGFPE on that error! - * mask &= ~( _FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM | _FPU_MASK_UM ); - */ - - unsigned int mask; - _FPU_GETCW(mask); - mask &= ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM); - _FPU_SETCW(mask); - } -#endif -#endif /* ABORTFP */ -} - - - - - -#ifdef USE_FAST_LOG -/*********************************************************************** - * - * Fast Log Approximation for log2, used to approximate every other log - * (log10 and log) - * maximum absolute error for log10 is around 10-6 - * maximum *relative* error can be high when x is almost 1 because error/log10(x) tends toward x/e - * - * use it if typical RESULT values are > 1e-5 (for example if x>1.00001 or x<0.99999) - * or if the relative precision in the domain around 1 is not important (result in 1 is exact and 0) - * - ***********************************************************************/ - - -#define LOG2_SIZE (512) -#define LOG2_SIZE_L2 (9) - -static ieee754_float32_t log_table[LOG2_SIZE + 1]; - - - -void -init_log_table(void) -{ - int j; - static int init = 0; - - /* Range for log2(x) over [1,2[ is [0,1[ */ - assert((1 << LOG2_SIZE_L2) == LOG2_SIZE); - - if (!init) { - for (j = 0; j < LOG2_SIZE + 1; j++) - log_table[j] = log(1.0f + j / (ieee754_float32_t) LOG2_SIZE) / log(2.0f); - } - init = 1; -} - - - -ieee754_float32_t -fast_log2(ieee754_float32_t x) -{ - ieee754_float32_t log2val, partial; - union { - ieee754_float32_t f; - int i; - } fi; - int mantisse; - fi.f = x; - mantisse = fi.i & 0x7fffff; - log2val = ((fi.i >> 23) & 0xFF) - 0x7f; - partial = (mantisse & ((1 << (23 - LOG2_SIZE_L2)) - 1)); - partial *= 1.0f / ((1 << (23 - LOG2_SIZE_L2))); - - - mantisse >>= (23 - LOG2_SIZE_L2); - - /* log2val += log_table[mantisse]; without interpolation the results are not good */ - log2val += log_table[mantisse] * (1.0f - partial) + log_table[mantisse + 1] * partial; - - return log2val; -} - -#else /* Don't use FAST_LOG */ - - -void -init_log_table(void) -{ -} - - -#endif - -/* end of util.c */ diff --git a/src/lib/dl/ext/lame/util.h b/src/lib/dl/ext/lame/util.h deleted file mode 100755 index 865dbbe7..00000000 --- a/src/lib/dl/ext/lame/util.h +++ /dev/null @@ -1,618 +0,0 @@ -/* - * lame utility library include file - * - * Copyright (c) 1999 Albert L Faber - * Copyright (c) 2008 Robert Hegemann - * - * 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_UTIL_H -#define LAME_UTIL_H - -#include "l3side.h" -#include "id3tag.h" -#include "lame_global_flags.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*********************************************************************** -* -* Global Definitions -* -***********************************************************************/ - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -#ifdef UINT_MAX -# define MAX_U_32_NUM UINT_MAX -#else -# define MAX_U_32_NUM 0xFFFFFFFF -#endif - -#ifndef PI -# ifdef M_PI -# define PI M_PI -# else -# define PI 3.14159265358979323846 -# endif -#endif - - -#ifdef M_LN2 -# define LOG2 M_LN2 -#else -# define LOG2 0.69314718055994530942 -#endif - -#ifdef M_LN10 -# define LOG10 M_LN10 -#else -# define LOG10 2.30258509299404568402 -#endif - - -#ifdef M_SQRT2 -# define SQRT2 M_SQRT2 -#else -# define SQRT2 1.41421356237309504880 -#endif - - -#define CRC16_POLYNOMIAL 0x8005 - -#define MAX_BITS_PER_CHANNEL 4095 -#define MAX_BITS_PER_GRANULE 7680 - -/* "bit_stream.h" Definitions */ -#define BUFFER_SIZE LAME_MAXMP3BUFFER - -#define Min(A, B) ((A) < (B) ? (A) : (B)) -#define Max(A, B) ((A) > (B) ? (A) : (B)) - -/* log/log10 approximations */ -#ifdef USE_FAST_LOG -#define FAST_LOG10(x) (fast_log2(x)*(LOG2/LOG10)) -#define FAST_LOG(x) (fast_log2(x)*LOG2) -#define FAST_LOG10_X(x,y) (fast_log2(x)*(LOG2/LOG10*(y))) -#define FAST_LOG_X(x,y) (fast_log2(x)*(LOG2*(y))) -#else -#define FAST_LOG10(x) log10(x) -#define FAST_LOG(x) log(x) -#define FAST_LOG10_X(x,y) (log10(x)*(y)) -#define FAST_LOG_X(x,y) (log(x)*(y)) -#endif - - - struct replaygain_data; -#ifndef replaygain_data_defined -#define replaygain_data_defined - typedef struct replaygain_data replaygain_t; -#endif - struct plotting_data; -#ifndef plotting_data_defined -#define plotting_data_defined - typedef struct plotting_data plotting_data; -#endif - -/*********************************************************************** -* -* Global Type Definitions -* -***********************************************************************/ - - typedef struct { - void *aligned; /* pointer to ie. 128 bit aligned memory */ - void *pointer; /* to use with malloc/free */ - } aligned_pointer_t; - - typedef void (*iteration_loop_t) (lame_internal_flags * gfc, const FLOAT pe[2][2], - const FLOAT ms_ratio[2], const III_psy_ratio ratio[2][2]); - - - /* "bit_stream.h" Type Definitions */ - - typedef struct bit_stream_struc { - unsigned char *buf; /* bit stream buffer */ - int buf_size; /* size of buffer (in number of bytes) */ - int totbit; /* bit counter of bit stream */ - int buf_byte_idx; /* pointer to top byte in buffer */ - int buf_bit_idx; /* pointer to top bit of top byte in buffer */ - - /* format of file in rd mode (BINARY/ASCII) */ - } Bit_stream_struc; - - - - typedef struct { - int sum; /* what we have seen so far */ - int seen; /* how many frames we have seen in this chunk */ - int want; /* how many frames we want to collect into one chunk */ - int pos; /* actual position in our bag */ - int size; /* size of our bag */ - int *bag; /* pointer to our bag */ - unsigned int nVbrNumFrames; - unsigned long nBytesWritten; - /* VBR tag data */ - unsigned int TotalFrameSize; - } VBR_seek_info_t; - - - /** - * ATH related stuff, if something new ATH related has to be added, - * please plugg it here into the ATH_t struct - */ - typedef struct { - int use_adjust; /* method for the auto adjustment */ - FLOAT aa_sensitivity_p; /* factor for tuning the (sample power) - point below which adaptive threshold - of hearing adjustment occurs */ - FLOAT adjust_factor; /* lowering based on peak volume, 1 = no lowering */ - FLOAT adjust_limit; /* limit for dynamic ATH adjust */ - FLOAT decay; /* determined to lower x dB each second */ - FLOAT floor; /* lowest ATH value */ - FLOAT l[SBMAX_l]; /* ATH for sfbs in long blocks */ - FLOAT s[SBMAX_s]; /* ATH for sfbs in short blocks */ - FLOAT psfb21[PSFB21]; /* ATH for partitionned sfb21 in long blocks */ - FLOAT psfb12[PSFB12]; /* ATH for partitionned sfb12 in short blocks */ - FLOAT cb_l[CBANDS]; /* ATH for long block convolution bands */ - FLOAT cb_s[CBANDS]; /* ATH for short block convolution bands */ - FLOAT eql_w[BLKSIZE / 2]; /* equal loudness weights (based on ATH) */ - } ATH_t; - - /** - * PSY Model related stuff - */ - - typedef struct { - FLOAT masking_lower[CBANDS]; - FLOAT minval[CBANDS]; - FLOAT rnumlines[CBANDS]; - FLOAT mld_cb[CBANDS]; - FLOAT mld[Max(SBMAX_l,SBMAX_s)]; - FLOAT bo_weight[Max(SBMAX_l,SBMAX_s)]; /* band weight long scalefactor bands, at transition */ - FLOAT attack_threshold; /* short block tuning */ - int s3ind[CBANDS][2]; - int numlines[CBANDS]; - int bm[Max(SBMAX_l,SBMAX_s)]; - int bo[Max(SBMAX_l,SBMAX_s)]; - int npart; - int n_sb; /* SBMAX_l or SBMAX_s */ - FLOAT *s3; - } PsyConst_CB2SB_t; - - - /** - * global data constants - */ - typedef struct { - PsyConst_CB2SB_t l; - PsyConst_CB2SB_t s; - PsyConst_CB2SB_t l_to_s; - FLOAT attack_threshold[4]; - FLOAT decay; - int force_short_block_calc; - } PsyConst_t; - - - typedef struct { - - FLOAT nb_l1[4][CBANDS], nb_l2[4][CBANDS]; - FLOAT nb_s1[4][CBANDS], nb_s2[4][CBANDS]; - - III_psy_xmin thm[4]; - III_psy_xmin en[4]; - - /* loudness calculation (for adaptive threshold of hearing) */ - FLOAT loudness_sq_save[2]; /* account for granule delay of L3psycho_anal */ - - FLOAT tot_ener[4]; - - FLOAT last_en_subshort[4][9]; - int last_attacks[4]; - - int blocktype_old[2]; - } PsyStateVar_t; - - - typedef struct { - /* loudness calculation (for adaptive threshold of hearing) */ - FLOAT loudness_sq[2][2]; /* loudness^2 approx. per granule and channel */ - } PsyResult_t; - - - /* variables used by encoder.c */ - typedef struct { - /* variables for newmdct.c */ - FLOAT sb_sample[2][2][18][SBLIMIT]; - FLOAT amp_filter[32]; - - /* variables used by util.c */ - /* BPC = maximum number of filter convolution windows to precompute */ -#define BPC 320 - double itime[2]; /* float precision seems to be not enough */ - sample_t *inbuf_old[2]; - sample_t *blackfilt[2 * BPC + 1]; - - FLOAT pefirbuf[19]; - - /* used for padding */ - int frac_SpF; - int slot_lag; - - /* variables for bitstream.c */ - /* mpeg1: buffer=511 bytes smallest frame: 96-38(sideinfo)=58 - * max number of frames in reservoir: 8 - * mpeg2: buffer=255 bytes. smallest frame: 24-23bytes=1 - * with VBR, if you are encoding all silence, it is possible to - * have 8kbs/24khz frames with 1byte of data each, which means we need - * to buffer up to 255 headers! */ - /* also, max_header_buf has to be a power of two */ -#define MAX_HEADER_BUF 256 -#define MAX_HEADER_LEN 40 /* max size of header is 38 */ - struct { - int write_timing; - int ptr; - char buf[MAX_HEADER_LEN]; - } header[MAX_HEADER_BUF]; - - int h_ptr; - int w_ptr; - int ancillary_flag; - - /* variables for reservoir.c */ - int ResvSize; /* in bits */ - int ResvMax; /* in bits */ - - int in_buffer_nsamples; - sample_t *in_buffer_0; - sample_t *in_buffer_1; - -#ifndef MFSIZE -# define MFSIZE ( 3*1152 + ENCDELAY - MDCTDELAY ) -#endif - sample_t mfbuf[2][MFSIZE]; - - int canary; /* DEBUG: some part of the encoding process is overrunning mfbuf[] */ - - int mf_samples_to_encode; - int mf_size; - - } EncStateVar_t; - - - typedef struct { - /* simple statistics */ - int bitrate_channelmode_hist[16][4 + 1]; - int bitrate_blocktype_hist[16][4 + 1 + 1]; /*norm/start/short/stop/mixed(short)/sum */ - - int bitrate_index; - int frame_number; /* number of frames encoded */ - int padding; /* padding for the current frame? */ - int mode_ext; - int encoder_delay; - int encoder_padding; /* number of samples of padding appended to input */ - } EncResult_t; - - - /* variables used by quantize.c */ - typedef struct { - /* variables for nspsytune */ - FLOAT longfact[SBMAX_l]; - FLOAT shortfact[SBMAX_s]; - FLOAT masking_lower; - FLOAT mask_adjust; /* the dbQ stuff */ - FLOAT mask_adjust_short; /* the dbQ stuff */ - int OldValue[2]; - int CurrentStep[2]; - int pseudohalf[SFBMAX]; - int sfb21_extra; /* will be set in lame_init_params */ - int substep_shaping; /* 0 = no substep - 1 = use substep shaping at last step(VBR only) - (not implemented yet) - 2 = use substep inside loop - 3 = use substep inside loop and last step - */ - - - char bv_scf[576]; - } QntStateVar_t; - - - typedef struct { - replaygain_t *rgdata; - /* ReplayGain */ - } RpgStateVar_t; - - - typedef struct { - FLOAT noclipScale; /* user-specified scale factor required for preventing clipping */ - sample_t PeakSample; - int RadioGain; - int noclipGainChange; /* gain change required for preventing clipping */ - } RpgResult_t; - - - typedef struct { - int version; /* 0=MPEG-2/2.5 1=MPEG-1 */ - int samplerate_index; - int sideinfo_len; - - int noise_shaping; /* 0 = none - 1 = ISO AAC model - 2 = allow scalefac_select=1 - */ - - int subblock_gain; /* 0 = no, 1 = yes */ - int use_best_huffman; /* 0 = no. 1=outside loop 2=inside loop(slow) */ - int noise_shaping_amp; /* 0 = ISO model: amplify all distorted bands - 1 = amplify within 50% of max (on db scale) - 2 = amplify only most distorted band - 3 = method 1 and refine with method 2 - */ - - int noise_shaping_stop; /* 0 = stop at over=0, all scalefacs amplified or - a scalefac has reached max value - 1 = stop when all scalefacs amplified or - a scalefac has reached max value - 2 = stop when all scalefacs amplified - */ - - - int full_outer_loop; /* 0 = stop early after 0 distortion found. 1 = full search */ - - int lowpassfreq; - int highpassfreq; - int samplerate_in; /* input_samp_rate in Hz. default=44.1 kHz */ - int samplerate_out; /* output_samp_rate. */ - int channels_in; /* number of channels in the input data stream (PCM or decoded PCM) */ - int channels_out; /* number of channels in the output data stream (not used for decoding) */ - int mode_gr; /* granules per frame */ - int force_ms; /* force M/S mode. requires mode=1 */ - - int quant_comp; - int quant_comp_short; - - int use_temporal_masking_effect; - int use_safe_joint_stereo; - - int preset; - - vbr_mode vbr; - int vbr_avg_bitrate_kbps; - int vbr_min_bitrate_index; /* min bitrate index */ - int vbr_max_bitrate_index; /* max bitrate index */ - int avg_bitrate; - int enforce_min_bitrate; /* strictly enforce VBR_min_bitrate normaly, it will be violated for analog silence */ - - int findReplayGain; /* find the RG value? default=0 */ - int findPeakSample; - int decode_on_the_fly; /* decode on the fly? default=0 */ - int analysis; - int disable_reservoir; - int buffer_constraint; /* enforce ISO spec as much as possible */ - int free_format; - int write_lame_tag; /* add Xing VBR tag? */ - - int error_protection; /* use 2 bytes per frame for a CRC checksum. default=0 */ - int copyright; /* mark as copyright. default=0 */ - int original; /* mark as original. default=1 */ - int extension; /* the MP3 'private extension' bit. Meaningless */ - int emphasis; /* Input PCM is emphased PCM (for - instance from one of the rarely - emphased CDs), it is STRONGLY not - recommended to use this, because - psycho does not take it into account, - and last but not least many decoders - don't care about these bits */ - - - MPEG_mode mode; - short_block_t short_blocks; - - float interChRatio; - float msfix; /* Naoki's adjustment of Mid/Side maskings */ - float ATH_offset_db;/* add to ATH this many db */ - float ATH_offset_factor;/* change ATH by this factor, derived from ATH_offset_db */ - float ATHcurve; /* change ATH formula 4 shape */ - int ATHtype; - int ATHonly; /* only use ATH */ - int ATHshort; /* only use ATH for short blocks */ - int noATH; /* disable ATH */ - - float ATHfixpoint; - - float adjust_alto_db; - float adjust_bass_db; - float adjust_treble_db; - float adjust_sfb21_db; - - float compression_ratio; /* sizeof(wav file)/sizeof(mp3 file) */ - - /* lowpass and highpass filter control */ - FLOAT lowpass1, lowpass2; /* normalized frequency bounds of passband */ - FLOAT highpass1, highpass2; /* normalized frequency bounds of passband */ - - /* scale input by this amount before encoding at least not used for MP3 decoding */ - FLOAT pcm_transform[2][2]; - - FLOAT minval; - } SessionConfig_t; - - - struct lame_internal_flags { - - /******************************************************************** - * internal variables NOT set by calling program, and should not be * - * modified by the calling program * - ********************************************************************/ - - /* - * Some remarks to the Class_ID field: - * The Class ID is an Identifier for a pointer to this struct. - * It is very unlikely that a pointer to lame_global_flags has the same 32 bits - * in it's structure (large and other special properties, for instance prime). - * - * To test that the structure is right and initialized, use: - * if ( gfc -> Class_ID == LAME_ID ) ... - * Other remark: - * If you set a flag to 0 for uninit data and 1 for init data, the right test - * should be "if (flag == 1)" and NOT "if (flag)". Unintended modification - * of this element will be otherwise misinterpreted as an init. - */ -# define LAME_ID 0xFFF88E3B - unsigned long class_id; - - int lame_encode_frame_init; - int iteration_init_init; - int fill_buffer_resample_init; - - SessionConfig_t cfg; - - /* variables used by lame.c */ - Bit_stream_struc bs; - III_side_info_t l3_side; - - scalefac_struct scalefac_band; - - PsyStateVar_t sv_psy; /* DATA FROM PSYMODEL.C */ - PsyResult_t ov_psy; - EncStateVar_t sv_enc; /* DATA FROM ENCODER.C */ - EncResult_t ov_enc; - QntStateVar_t sv_qnt; /* DATA FROM QUANTIZE.C */ - - RpgStateVar_t sv_rpg; - RpgResult_t ov_rpg; - - /* optional ID3 tags, used in id3tag.c */ - struct id3tag_spec tag_spec; - uint16_t nMusicCRC; - - uint16_t _unused; - - /* CPU features */ - struct { - unsigned int MMX:1; /* Pentium MMX, Pentium II...IV, K6, K6-2, - K6-III, Athlon */ - unsigned int AMD_3DNow:1; /* K6-2, K6-III, Athlon */ - unsigned int SSE:1; /* Pentium III, Pentium 4 */ - unsigned int SSE2:1; /* Pentium 4, K8 */ - unsigned int _unused:28; - } CPU_features; - - - VBR_seek_info_t VBR_seek_table; /* used for Xing VBR header */ - - ATH_t *ATH; /* all ATH related stuff */ - - PsyConst_t *cd_psy; - - /* used by the frame analyzer */ - plotting_data *pinfo; - hip_t hip; - - iteration_loop_t iteration_loop; - - /* functions to replace with CPU feature optimized versions in takehiro.c */ - int (*choose_table) (const int *ix, const int *const end, int *const s); - void (*fft_fht) (FLOAT *, int); - void (*init_xrpow_core) (gr_info * const cod_info, FLOAT xrpow[576], int upper, - FLOAT * sum); - - lame_report_function report_msg; - lame_report_function report_dbg; - lame_report_function report_err; - }; - -#ifndef lame_internal_flags_defined -#define lame_internal_flags_defined - typedef struct lame_internal_flags lame_internal_flags; -#endif - - -/*********************************************************************** -* -* Global Function Prototype Declarations -* -***********************************************************************/ - void freegfc(lame_internal_flags * const gfc); - void free_id3tag(lame_internal_flags * const gfc); - extern int BitrateIndex(int, int, int); - extern int FindNearestBitrate(int, int, int); - extern int map2MP3Frequency(int freq); - extern int SmpFrqIndex(int, int *const); - extern int nearestBitrateFullIndex(uint16_t brate); - extern FLOAT ATHformula(SessionConfig_t const *cfg, FLOAT freq); - extern FLOAT freq2bark(FLOAT freq); - void disable_FPE(void); - -/* log/log10 approximations */ - extern void init_log_table(void); - extern ieee754_float32_t fast_log2(ieee754_float32_t x); - - int isResamplingNecessary(SessionConfig_t const* cfg); - - void fill_buffer(lame_internal_flags * gfc, - sample_t *const mfbuf[2], - sample_t const *const in_buffer[2], int nsamples, int *n_in, int *n_out); - -/* same as lame_decode1 (look in lame.h), but returns - unclipped raw floating-point samples. It is declared - here, not in lame.h, because it returns LAME's - internal type sample_t. No more than 1152 samples - per channel are allowed. */ - int hip_decode1_unclipped(hip_t hip, unsigned char *mp3buf, - size_t len, sample_t pcm_l[], sample_t pcm_r[]); - - - extern int has_MMX(void); - extern int has_3DNow(void); - extern int has_SSE(void); - extern int has_SSE2(void); - - - -/*********************************************************************** -* -* Macros about Message Printing and Exit -* -***********************************************************************/ - - extern void lame_report_def(const char* format, va_list args); - extern void lame_report_fnc(lame_report_function print_f, const char *, ...); - extern void lame_errorf(const lame_internal_flags * gfc, const char *, ...); - extern void lame_debugf(const lame_internal_flags * gfc, const char *, ...); - extern void lame_msgf(const lame_internal_flags * gfc, const char *, ...); -#define DEBUGF lame_debugf -#define ERRORF lame_errorf -#define MSGF lame_msgf - - int is_lame_internal_flags_valid(const lame_internal_flags * gfp); - - extern void hip_set_pinfo(hip_t hip, plotting_data* pinfo); - -#ifdef __cplusplus -} -#endif -#endif /* LAME_UTIL_H */ diff --git a/src/lib/dl/ext/lame/vbrquantize.c b/src/lib/dl/ext/lame/vbrquantize.c deleted file mode 100755 index b40ba645..00000000 --- a/src/lib/dl/ext/lame/vbrquantize.c +++ /dev/null @@ -1,1607 +0,0 @@ -/* - * MP3 quantization - * - * Copyright (c) 1999-2000 Mark Taylor - * Copyright (c) 2000-2011 Robert Hegemann - * - * 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. - */ - -/* $Id: vbrquantize.c,v 1.141 2011/05/07 16:05:17 rbrito Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "vbrquantize.h" -#include "quantize_pvt.h" - - - - -struct algo_s; -typedef struct algo_s algo_t; - -typedef void (*alloc_sf_f) (const algo_t *, const int *, const int *, int); -typedef uint8_t (*find_sf_f) (const FLOAT *, const FLOAT *, FLOAT, unsigned int, uint8_t); - -struct algo_s { - alloc_sf_f alloc; - find_sf_f find; - const FLOAT *xr34orig; - lame_internal_flags *gfc; - gr_info *cod_info; - int mingain_l; - int mingain_s[3]; -}; - - - -/* Remarks on optimizing compilers: - * - * the MSVC compiler may get into aliasing problems when accessing - * memory through the fi_union. declaring it volatile does the trick here - * - * the calc_sfb_noise_* functions are not inlined because the intel compiler - * optimized executeables won't work as expected anymore - */ - -#ifdef _MSC_VER -# if _MSC_VER < 1400 -# define VOLATILE volatile -# else -# define VOLATILE -# ifndef FORCEINLINE -# define FORCEINLINE __forceinline -# endif -# endif -#else -# define VOLATILE -#endif - -#ifndef FORCEINLINE -#define FORCEINLINE -#endif - -typedef VOLATILE union { - float f; - int i; -} fi_union; - - - -#ifdef TAKEHIRO_IEEE754_HACK -#define DOUBLEX double -#else -#define DOUBLEX FLOAT -#endif - -#define MAGIC_FLOAT_def (65536*(128)) -#define MAGIC_INT_def 0x4b000000 - -#ifdef TAKEHIRO_IEEE754_HACK -#else -/********************************************************************* - * XRPOW_FTOI is a macro to convert floats to ints. - * if XRPOW_FTOI(x) = nearest_int(x), then QUANTFAC(x)=adj43asm[x] - * ROUNDFAC= -0.0946 - * - * if XRPOW_FTOI(x) = floor(x), then QUANTFAC(x)=asj43[x] - * ROUNDFAC=0.4054 - *********************************************************************/ -# define QUANTFAC(rx) adj43[rx] -# define ROUNDFAC_def 0.4054f -# define XRPOW_FTOI(src,dest) ((dest) = (int)(src)) -#endif - -static int const MAGIC_INT = MAGIC_INT_def; -#ifndef TAKEHIRO_IEEE754_HACK -static DOUBLEX const ROUNDFAC = ROUNDFAC_def; -#endif -static DOUBLEX const MAGIC_FLOAT = MAGIC_FLOAT_def; - - -FORCEINLINE static float -vec_max_c(const float * xr34, unsigned int bw) -{ - float xfsf = 0; - unsigned int i = bw >> 2u; - unsigned int const remaining = (bw & 0x03u); - - while (i-- > 0) { - if (xfsf < xr34[0]) { - xfsf = xr34[0]; - } - if (xfsf < xr34[1]) { - xfsf = xr34[1]; - } - if (xfsf < xr34[2]) { - xfsf = xr34[2]; - } - if (xfsf < xr34[3]) { - xfsf = xr34[3]; - } - xr34 += 4; - } - switch( remaining ) { - case 3: if (xfsf < xr34[2]) xfsf = xr34[2]; - case 2: if (xfsf < xr34[1]) xfsf = xr34[1]; - case 1: if (xfsf < xr34[0]) xfsf = xr34[0]; - default: break; - } - return xfsf; -} - -FORCEINLINE static float -vec_sum_sq_c(const float * xr, unsigned int bw) -{ - float sum = 0.0f; - unsigned int i = bw >> 2u; - unsigned int const remaining = bw & 0x03u; - while (i-- > 0) { - sum += xr[0] * xr[0]; - sum += xr[1] * xr[1]; - sum += xr[2] * xr[2]; - sum += xr[3] * xr[3]; - xr += 4; - } - switch( remaining ) { - case 3: sum += xr[2] * xr[2]; - case 2: sum += xr[1] * xr[1]; - case 1: sum += xr[0] * xr[0]; - default: break; - } - return sum; -} - - -FORCEINLINE static uint8_t -find_lowest_scalefac(const FLOAT xr34) -{ - uint8_t sf_ok = 255; - uint8_t sf = 128, delsf = 64; - uint8_t i; - FLOAT const ixmax_val = IXMAX_VAL; - for (i = 0; i < 8; ++i) { - FLOAT const xfsf = ipow20[sf] * xr34; - if (xfsf <= ixmax_val) { - sf_ok = sf; - sf -= delsf; - } - else { - sf += delsf; - } - delsf >>= 1; - } - return sf_ok; -} - - -FORCEINLINE static int -below_noise_floor(FLOAT sum, FLOAT l3xmin) -{ - FLOAT const d = -1E-20; - return (l3xmin - sum) >= d ? 1 : 0; -} - - -FORCEINLINE static void -k_34_4(DOUBLEX x[4], int l3[4]) -{ -#ifdef TAKEHIRO_IEEE754_HACK - fi_union fi[4]; - - assert(x[0] <= IXMAX_VAL && x[1] <= IXMAX_VAL && x[2] <= IXMAX_VAL && x[3] <= IXMAX_VAL); - x[0] += MAGIC_FLOAT; - fi[0].f = x[0]; - x[1] += MAGIC_FLOAT; - fi[1].f = x[1]; - x[2] += MAGIC_FLOAT; - fi[2].f = x[2]; - x[3] += MAGIC_FLOAT; - fi[3].f = x[3]; - fi[0].f = x[0] + adj43asm[fi[0].i - MAGIC_INT]; - fi[1].f = x[1] + adj43asm[fi[1].i - MAGIC_INT]; - fi[2].f = x[2] + adj43asm[fi[2].i - MAGIC_INT]; - fi[3].f = x[3] + adj43asm[fi[3].i - MAGIC_INT]; - l3[0] = fi[0].i - MAGIC_INT; - l3[1] = fi[1].i - MAGIC_INT; - l3[2] = fi[2].i - MAGIC_INT; - l3[3] = fi[3].i - MAGIC_INT; -#else - assert(x[0] <= IXMAX_VAL && x[1] <= IXMAX_VAL && x[2] <= IXMAX_VAL && x[3] <= IXMAX_VAL); - XRPOW_FTOI(x[0], l3[0]); - XRPOW_FTOI(x[1], l3[1]); - XRPOW_FTOI(x[2], l3[2]); - XRPOW_FTOI(x[3], l3[3]); - x[0] += QUANTFAC(l3[0]); - x[1] += QUANTFAC(l3[1]); - x[2] += QUANTFAC(l3[2]); - x[3] += QUANTFAC(l3[3]); - XRPOW_FTOI(x[0], l3[0]); - XRPOW_FTOI(x[1], l3[1]); - XRPOW_FTOI(x[2], l3[2]); - XRPOW_FTOI(x[3], l3[3]); -#endif -} - - - - - -/* do call the calc_sfb_noise_* functions only with sf values - * for which holds: sfpow34*xr34 <= IXMAX_VAL - */ - -static FLOAT -calc_sfb_noise_x34(const FLOAT * xr, const FLOAT * xr34, unsigned int bw, uint8_t sf) -{ - DOUBLEX x[4]; - int l3[4]; - const FLOAT sfpow = pow20[sf + Q_MAX2]; /*pow(2.0,sf/4.0); */ - const FLOAT sfpow34 = ipow20[sf]; /*pow(sfpow,-3.0/4.0); */ - - FLOAT xfsf = 0; - unsigned int i = bw >> 2u; - unsigned int const remaining = (bw & 0x03u); - - while (i-- > 0) { - x[0] = sfpow34 * xr34[0]; - x[1] = sfpow34 * xr34[1]; - x[2] = sfpow34 * xr34[2]; - x[3] = sfpow34 * xr34[3]; - - k_34_4(x, l3); - - x[0] = fabsf(xr[0]) - sfpow * pow43[l3[0]]; - x[1] = fabsf(xr[1]) - sfpow * pow43[l3[1]]; - x[2] = fabsf(xr[2]) - sfpow * pow43[l3[2]]; - x[3] = fabsf(xr[3]) - sfpow * pow43[l3[3]]; - xfsf += (x[0] * x[0] + x[1] * x[1]) + (x[2] * x[2] + x[3] * x[3]); - - xr += 4; - xr34 += 4; - } - if (remaining) { - x[0] = x[1] = x[2] = x[3] = 0; - switch( remaining ) { - case 3: x[2] = sfpow34 * xr34[2]; - case 2: x[1] = sfpow34 * xr34[1]; - case 1: x[0] = sfpow34 * xr34[0]; - } - - k_34_4(x, l3); - x[0] = x[1] = x[2] = x[3] = 0; - - switch( remaining ) { - case 3: x[2] = fabsf(xr[2]) - sfpow * pow43[l3[2]]; - case 2: x[1] = fabsf(xr[1]) - sfpow * pow43[l3[1]]; - case 1: x[0] = fabsf(xr[0]) - sfpow * pow43[l3[0]]; - } - xfsf += (x[0] * x[0] + x[1] * x[1]) + (x[2] * x[2] + x[3] * x[3]); - } - return xfsf; -} - - - -struct calc_noise_cache { - int valid; - FLOAT value; -}; - -typedef struct calc_noise_cache calc_noise_cache_t; - - -static uint8_t -tri_calc_sfb_noise_x34(const FLOAT * xr, const FLOAT * xr34, FLOAT l3_xmin, unsigned int bw, - uint8_t sf, calc_noise_cache_t * did_it) -{ - if (did_it[sf].valid == 0) { - did_it[sf].valid = 1; - did_it[sf].value = calc_sfb_noise_x34(xr, xr34, bw, sf); - } - if (l3_xmin < did_it[sf].value) { - return 1; - } - if (sf < 255) { - uint8_t const sf_x = sf + 1; - if (did_it[sf_x].valid == 0) { - did_it[sf_x].valid = 1; - did_it[sf_x].value = calc_sfb_noise_x34(xr, xr34, bw, sf_x); - } - if (l3_xmin < did_it[sf_x].value) { - return 1; - } - } - if (sf > 0) { - uint8_t const sf_x = sf - 1; - if (did_it[sf_x].valid == 0) { - did_it[sf_x].valid = 1; - did_it[sf_x].value = calc_sfb_noise_x34(xr, xr34, bw, sf_x); - } - if (l3_xmin < did_it[sf_x].value) { - return 1; - } - } - return 0; -} - - -/** - * Robert Hegemann 2001-05-01 - * calculates quantization step size determined by allowed masking - */ -static int -calc_scalefac(FLOAT l3_xmin, int bw) -{ - FLOAT const c = 5.799142446; /* 10 * 10^(2/3) * log10(4/3) */ - return 210 + (int) (c * log10f(l3_xmin / bw) - .5f); -} - -static uint8_t -guess_scalefac_x34(const FLOAT * xr, const FLOAT * xr34, FLOAT l3_xmin, unsigned int bw, uint8_t sf_min) -{ - int const guess = calc_scalefac(l3_xmin, bw); - if (guess < sf_min) return sf_min; - if (guess >= 255) return 255; - (void) xr; - (void) xr34; - return guess; -} - - -/* the find_scalefac* routines calculate - * a quantization step size which would - * introduce as much noise as is allowed. - * The larger the step size the more - * quantization noise we'll get. The - * scalefactors are there to lower the - * global step size, allowing limited - * differences in quantization step sizes - * per band (shaping the noise). - */ - -static uint8_t -find_scalefac_x34(const FLOAT * xr, const FLOAT * xr34, FLOAT l3_xmin, unsigned int bw, - uint8_t sf_min) -{ - calc_noise_cache_t did_it[256]; - uint8_t sf = 128, sf_ok = 255, delsf = 128, seen_good_one = 0, i; - memset(did_it, 0, sizeof(did_it)); - for (i = 0; i < 8; ++i) { - delsf >>= 1; - if (sf <= sf_min) { - sf += delsf; - } - else { - uint8_t const bad = tri_calc_sfb_noise_x34(xr, xr34, l3_xmin, bw, sf, did_it); - if (bad) { /* distortion. try a smaller scalefactor */ - sf -= delsf; - } - else { - sf_ok = sf; - sf += delsf; - seen_good_one = 1; - } - } - } - /* returning a scalefac without distortion, if possible - */ - if (seen_good_one > 0) { - sf = sf_ok; - } - if (sf <= sf_min) { - sf = sf_min; - } - return sf; -} - - - -/*********************************************************************** - * - * calc_short_block_vbr_sf() - * calc_long_block_vbr_sf() - * - * Mark Taylor 2000-??-?? - * Robert Hegemann 2000-10-25 made functions of it - * - ***********************************************************************/ - -/* a variation for vbr-mtrh */ -static int -block_sf(algo_t * that, const FLOAT l3_xmin[SFBMAX], int vbrsf[SFBMAX], int vbrsfmin[SFBMAX]) -{ - FLOAT max_xr34; - const FLOAT *const xr = &that->cod_info->xr[0]; - const FLOAT *const xr34_orig = &that->xr34orig[0]; - const int *const width = &that->cod_info->width[0]; - unsigned int const max_nonzero_coeff = (unsigned int) that->cod_info->max_nonzero_coeff; - uint8_t maxsf = 0; - int sfb = 0; - unsigned int j = 0, i = 0; - int const psymax = that->cod_info->psymax; - - assert(that->cod_info->max_nonzero_coeff >= 0); - - that->mingain_l = 0; - that->mingain_s[0] = 0; - that->mingain_s[1] = 0; - that->mingain_s[2] = 0; - while (j <= max_nonzero_coeff) { - unsigned int const w = (unsigned int) width[sfb]; - unsigned int const m = (unsigned int) (max_nonzero_coeff - j + 1); - unsigned int l = w; - uint8_t m1, m2; - if (l > m) { - l = m; - } - max_xr34 = vec_max_c(&xr34_orig[j], l); - - m1 = find_lowest_scalefac(max_xr34); - vbrsfmin[sfb] = m1; - if (that->mingain_l < m1) { - that->mingain_l = m1; - } - if (that->mingain_s[i] < m1) { - that->mingain_s[i] = m1; - } - if (++i > 2) { - i = 0; - } - if (sfb < psymax && w > 2) { /* mpeg2.5 at 8 kHz doesn't use all scalefactors, unused have width 2 */ - float sum_sq = vec_sum_sq_c(&xr[j], l); - if (below_noise_floor(sum_sq, l3_xmin[sfb]) == 0) { - m2 = that->find(&xr[j], &xr34_orig[j], l3_xmin[sfb], l, m1); -#if 0 - if (0) { - /** Robert Hegemann 2007-09-29: - * It seems here is some more potential for speed improvements. - * Current find method does 11-18 quantization calculations. - * Using a "good guess" may help to reduce this amount. - */ - uint8_t guess = calc_scalefac(l3_xmin[sfb], l); - DEBUGF(that->gfc, "sfb=%3d guess=%3d found=%3d diff=%3d\n", sfb, guess, m2, - m2 - guess); - } -#endif - if (maxsf < m2) { - maxsf = m2; - } - } - else { - m2 = 255; - maxsf = 255; - } - } - else { - if (maxsf < m1) { - maxsf = m1; - } - m2 = maxsf; - } - vbrsf[sfb] = m2; - ++sfb; - j += w; - } - for (; sfb < SFBMAX; ++sfb) { - vbrsf[sfb] = maxsf; - vbrsfmin[sfb] = 0; - } - return maxsf; -} - - - -/*********************************************************************** - * - * quantize xr34 based on scalefactors - * - * block_xr34 - * - * Mark Taylor 2000-??-?? - * Robert Hegemann 2000-10-20 made functions of them - * - ***********************************************************************/ - -static void -quantize_x34(const algo_t * that) -{ - DOUBLEX x[4]; - const FLOAT *xr34_orig = that->xr34orig; - gr_info *const cod_info = that->cod_info; - int const ifqstep = (cod_info->scalefac_scale == 0) ? 2 : 4; - int *l3 = cod_info->l3_enc; - unsigned int j = 0, sfb = 0; - unsigned int const max_nonzero_coeff = (unsigned int) cod_info->max_nonzero_coeff; - - assert(cod_info->max_nonzero_coeff >= 0); - assert(cod_info->max_nonzero_coeff < 576); - - while (j <= max_nonzero_coeff) { - int const s = - (cod_info->scalefac[sfb] + (cod_info->preflag ? pretab[sfb] : 0)) * ifqstep - + cod_info->subblock_gain[cod_info->window[sfb]] * 8; - uint8_t const sfac = (uint8_t) (cod_info->global_gain - s); - FLOAT const sfpow34 = ipow20[sfac]; - unsigned int const w = (unsigned int) cod_info->width[sfb]; - unsigned int const m = (unsigned int) (max_nonzero_coeff - j + 1); - unsigned int i, remaining; - - assert((cod_info->global_gain - s) >= 0); - assert(cod_info->width[sfb] >= 0); - j += w; - ++sfb; - - i = (w <= m) ? w : m; - remaining = (i & 0x03u); - i >>= 2u; - - while (i-- > 0) { - x[0] = sfpow34 * xr34_orig[0]; - x[1] = sfpow34 * xr34_orig[1]; - x[2] = sfpow34 * xr34_orig[2]; - x[3] = sfpow34 * xr34_orig[3]; - - k_34_4(x, l3); - - l3 += 4; - xr34_orig += 4; - } - if (remaining) { - int tmp_l3[4]; - x[0] = x[1] = x[2] = x[3] = 0; - switch( remaining ) { - case 3: x[2] = sfpow34 * xr34_orig[2]; - case 2: x[1] = sfpow34 * xr34_orig[1]; - case 1: x[0] = sfpow34 * xr34_orig[0]; - } - - k_34_4(x, tmp_l3); - - switch( remaining ) { - case 3: l3[2] = tmp_l3[2]; - case 2: l3[1] = tmp_l3[1]; - case 1: l3[0] = tmp_l3[0]; - } - - l3 += remaining; - xr34_orig += remaining; - } - } -} - - - -static const uint8_t max_range_short[SBMAX_s * 3] = { - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 0, 0 -}; - -static const uint8_t max_range_long[SBMAX_l] = { - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0 -}; - -static const uint8_t max_range_long_lsf_pretab[SBMAX_l] = { - 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - - - -/* - sfb=0..5 scalefac < 16 - sfb>5 scalefac < 8 - - ifqstep = ( cod_info->scalefac_scale == 0 ) ? 2 : 4; - ol_sf = (cod_info->global_gain-210.0); - ol_sf -= 8*cod_info->subblock_gain[i]; - ol_sf -= ifqstep*scalefac[gr][ch].s[sfb][i]; -*/ - -static void -set_subblock_gain(gr_info * cod_info, const int mingain_s[3], int sf[]) -{ - const int maxrange1 = 15, maxrange2 = 7; - const int ifqstepShift = (cod_info->scalefac_scale == 0) ? 1 : 2; - int *const sbg = cod_info->subblock_gain; - unsigned int const psymax = (unsigned int) cod_info->psymax; - unsigned int psydiv = 18; - int sbg0, sbg1, sbg2; - unsigned int sfb, i; - int min_sbg = 7; - - if (psydiv > psymax) { - psydiv = psymax; - } - for (i = 0; i < 3; ++i) { - int maxsf1 = 0, maxsf2 = 0, minsf = 1000; - /* see if we should use subblock gain */ - for (sfb = i; sfb < psydiv; sfb += 3) { /* part 1 */ - int const v = -sf[sfb]; - if (maxsf1 < v) { - maxsf1 = v; - } - if (minsf > v) { - minsf = v; - } - } - for (; sfb < SFBMAX; sfb += 3) { /* part 2 */ - int const v = -sf[sfb]; - if (maxsf2 < v) { - maxsf2 = v; - } - if (minsf > v) { - minsf = v; - } - } - - /* boost subblock gain as little as possible so we can - * reach maxsf1 with scalefactors - * 8*sbg >= maxsf1 - */ - { - int const m1 = maxsf1 - (maxrange1 << ifqstepShift); - int const m2 = maxsf2 - (maxrange2 << ifqstepShift); - - maxsf1 = Max(m1, m2); - } - if (minsf > 0) { - sbg[i] = minsf >> 3; - } - else { - sbg[i] = 0; - } - if (maxsf1 > 0) { - int const m1 = sbg[i]; - int const m2 = (maxsf1 + 7) >> 3; - sbg[i] = Max(m1, m2); - } - if (sbg[i] > 0 && mingain_s[i] > (cod_info->global_gain - sbg[i] * 8)) { - sbg[i] = (cod_info->global_gain - mingain_s[i]) >> 3; - } - if (sbg[i] > 7) { - sbg[i] = 7; - } - if (min_sbg > sbg[i]) { - min_sbg = sbg[i]; - } - } - sbg0 = sbg[0] * 8; - sbg1 = sbg[1] * 8; - sbg2 = sbg[2] * 8; - for (sfb = 0; sfb < SFBMAX; sfb += 3) { - sf[sfb + 0] += sbg0; - sf[sfb + 1] += sbg1; - sf[sfb + 2] += sbg2; - } - if (min_sbg > 0) { - for (i = 0; i < 3; ++i) { - sbg[i] -= min_sbg; - } - cod_info->global_gain -= min_sbg * 8; - } -} - - - -/* - ifqstep = ( cod_info->scalefac_scale == 0 ) ? 2 : 4; - ol_sf = (cod_info->global_gain-210.0); - ol_sf -= ifqstep*scalefac[gr][ch].l[sfb]; - if (cod_info->preflag && sfb>=11) - ol_sf -= ifqstep*pretab[sfb]; -*/ -static void -set_scalefacs(gr_info * cod_info, const int *vbrsfmin, int sf[], const uint8_t * max_range) -{ - const int ifqstep = (cod_info->scalefac_scale == 0) ? 2 : 4; - const int ifqstepShift = (cod_info->scalefac_scale == 0) ? 1 : 2; - int *const scalefac = cod_info->scalefac; - int const sfbmax = cod_info->sfbmax; - int sfb; - int const *const sbg = cod_info->subblock_gain; - int const *const window = cod_info->window; - int const preflag = cod_info->preflag; - - if (preflag) { - for (sfb = 11; sfb < sfbmax; ++sfb) { - sf[sfb] += pretab[sfb] * ifqstep; - } - } - for (sfb = 0; sfb < sfbmax; ++sfb) { - int const gain = cod_info->global_gain - (sbg[window[sfb]] * 8) - - ((preflag ? pretab[sfb] : 0) * ifqstep); - - if (sf[sfb] < 0) { - int const m = gain - vbrsfmin[sfb]; - /* ifqstep*scalefac >= -sf[sfb], so round UP */ - scalefac[sfb] = (ifqstep - 1 - sf[sfb]) >> ifqstepShift; - - if (scalefac[sfb] > max_range[sfb]) { - scalefac[sfb] = max_range[sfb]; - } - if (scalefac[sfb] > 0 && (scalefac[sfb] << ifqstepShift) > m) { - scalefac[sfb] = m >> ifqstepShift; - } - } - else { - scalefac[sfb] = 0; - } - } - for (; sfb < SFBMAX; ++sfb) { - scalefac[sfb] = 0; /* sfb21 */ - } -} - - -#ifndef NDEBUG -static int -checkScalefactor(const gr_info * cod_info, const int vbrsfmin[SFBMAX]) -{ - int const ifqstep = cod_info->scalefac_scale == 0 ? 2 : 4; - int sfb; - for (sfb = 0; sfb < cod_info->psymax; ++sfb) { - const int s = - ((cod_info->scalefac[sfb] + - (cod_info->preflag ? pretab[sfb] : 0)) * ifqstep) + - cod_info->subblock_gain[cod_info->window[sfb]] * 8; - - if ((cod_info->global_gain - s) < vbrsfmin[sfb]) { - /* - fprintf( stdout, "sf %d\n", sfb ); - fprintf( stdout, "min %d\n", vbrsfmin[sfb] ); - fprintf( stdout, "ggain %d\n", cod_info->global_gain ); - fprintf( stdout, "scalefac %d\n", cod_info->scalefac[sfb] ); - fprintf( stdout, "pretab %d\n", (cod_info->preflag ? pretab[sfb] : 0) ); - fprintf( stdout, "scale %d\n", (cod_info->scalefac_scale + 1) ); - fprintf( stdout, "subgain %d\n", cod_info->subblock_gain[cod_info->window[sfb]] * 8 ); - fflush( stdout ); - exit(-1); - */ - return 0; - } - } - return 1; -} -#endif - - -/****************************************************************** - * - * short block scalefacs - * - ******************************************************************/ - -static void -short_block_constrain(const algo_t * that, const int vbrsf[SFBMAX], - const int vbrsfmin[SFBMAX], int vbrmax) -{ - gr_info *const cod_info = that->cod_info; - lame_internal_flags const *const gfc = that->gfc; - SessionConfig_t const *const cfg = &gfc->cfg; - int const maxminsfb = that->mingain_l; - int mover, maxover0 = 0, maxover1 = 0, delta = 0; - int v, v0, v1; - int sfb; - int const psymax = cod_info->psymax; - - for (sfb = 0; sfb < psymax; ++sfb) { - assert(vbrsf[sfb] >= vbrsfmin[sfb]); - v = vbrmax - vbrsf[sfb]; - if (delta < v) { - delta = v; - } - v0 = v - (4 * 14 + 2 * max_range_short[sfb]); - v1 = v - (4 * 14 + 4 * max_range_short[sfb]); - if (maxover0 < v0) { - maxover0 = v0; - } - if (maxover1 < v1) { - maxover1 = v1; - } - } - if (cfg->noise_shaping == 2) { - /* allow scalefac_scale=1 */ - mover = Min(maxover0, maxover1); - } - else { - mover = maxover0; - } - if (delta > mover) { - delta = mover; - } - vbrmax -= delta; - maxover0 -= mover; - maxover1 -= mover; - - if (maxover0 == 0) { - cod_info->scalefac_scale = 0; - } - else if (maxover1 == 0) { - cod_info->scalefac_scale = 1; - } - if (vbrmax < maxminsfb) { - vbrmax = maxminsfb; - } - cod_info->global_gain = vbrmax; - - if (cod_info->global_gain < 0) { - cod_info->global_gain = 0; - } - else if (cod_info->global_gain > 255) { - cod_info->global_gain = 255; - } - { - int sf_temp[SFBMAX]; - for (sfb = 0; sfb < SFBMAX; ++sfb) { - sf_temp[sfb] = vbrsf[sfb] - vbrmax; - } - set_subblock_gain(cod_info, &that->mingain_s[0], sf_temp); - set_scalefacs(cod_info, vbrsfmin, sf_temp, max_range_short); - } - assert(checkScalefactor(cod_info, vbrsfmin)); -} - - - -/****************************************************************** - * - * long block scalefacs - * - ******************************************************************/ - -static void -long_block_constrain(const algo_t * that, const int vbrsf[SFBMAX], const int vbrsfmin[SFBMAX], - int vbrmax) -{ - gr_info *const cod_info = that->cod_info; - lame_internal_flags const *const gfc = that->gfc; - SessionConfig_t const *const cfg = &gfc->cfg; - uint8_t const *max_rangep; - int const maxminsfb = that->mingain_l; - int sfb; - int maxover0, maxover1, maxover0p, maxover1p, mover, delta = 0; - int v, v0, v1, v0p, v1p, vm0p = 1, vm1p = 1; - int const psymax = cod_info->psymax; - - max_rangep = cfg->mode_gr == 2 ? max_range_long : max_range_long_lsf_pretab; - - maxover0 = 0; - maxover1 = 0; - maxover0p = 0; /* pretab */ - maxover1p = 0; /* pretab */ - - for (sfb = 0; sfb < psymax; ++sfb) { - assert(vbrsf[sfb] >= vbrsfmin[sfb]); - v = vbrmax - vbrsf[sfb]; - if (delta < v) { - delta = v; - } - v0 = v - 2 * max_range_long[sfb]; - v1 = v - 4 * max_range_long[sfb]; - v0p = v - 2 * (max_rangep[sfb] + pretab[sfb]); - v1p = v - 4 * (max_rangep[sfb] + pretab[sfb]); - if (maxover0 < v0) { - maxover0 = v0; - } - if (maxover1 < v1) { - maxover1 = v1; - } - if (maxover0p < v0p) { - maxover0p = v0p; - } - if (maxover1p < v1p) { - maxover1p = v1p; - } - } - if (vm0p == 1) { - int gain = vbrmax - maxover0p; - if (gain < maxminsfb) { - gain = maxminsfb; - } - for (sfb = 0; sfb < psymax; ++sfb) { - int const a = (gain - vbrsfmin[sfb]) - 2 * pretab[sfb]; - if (a <= 0) { - vm0p = 0; - vm1p = 0; - break; - } - } - } - if (vm1p == 1) { - int gain = vbrmax - maxover1p; - if (gain < maxminsfb) { - gain = maxminsfb; - } - for (sfb = 0; sfb < psymax; ++sfb) { - int const b = (gain - vbrsfmin[sfb]) - 4 * pretab[sfb]; - if (b <= 0) { - vm1p = 0; - break; - } - } - } - if (vm0p == 0) { - maxover0p = maxover0; - } - if (vm1p == 0) { - maxover1p = maxover1; - } - if (cfg->noise_shaping != 2) { - maxover1 = maxover0; - maxover1p = maxover0p; - } - mover = Min(maxover0, maxover0p); - mover = Min(mover, maxover1); - mover = Min(mover, maxover1p); - - if (delta > mover) { - delta = mover; - } - vbrmax -= delta; - if (vbrmax < maxminsfb) { - vbrmax = maxminsfb; - } - maxover0 -= mover; - maxover0p -= mover; - maxover1 -= mover; - maxover1p -= mover; - - if (maxover0 == 0) { - cod_info->scalefac_scale = 0; - cod_info->preflag = 0; - max_rangep = max_range_long; - } - else if (maxover0p == 0) { - cod_info->scalefac_scale = 0; - cod_info->preflag = 1; - } - else if (maxover1 == 0) { - cod_info->scalefac_scale = 1; - cod_info->preflag = 0; - max_rangep = max_range_long; - } - else if (maxover1p == 0) { - cod_info->scalefac_scale = 1; - cod_info->preflag = 1; - } - else { - assert(0); /* this should not happen */ - } - cod_info->global_gain = vbrmax; - if (cod_info->global_gain < 0) { - cod_info->global_gain = 0; - } - else if (cod_info->global_gain > 255) { - cod_info->global_gain = 255; - } - { - int sf_temp[SFBMAX]; - for (sfb = 0; sfb < SFBMAX; ++sfb) { - sf_temp[sfb] = vbrsf[sfb] - vbrmax; - } - set_scalefacs(cod_info, vbrsfmin, sf_temp, max_rangep); - } - assert(checkScalefactor(cod_info, vbrsfmin)); -} - - - -static void -bitcount(const algo_t * that) -{ - int rc = scale_bitcount(that->gfc, that->cod_info); - - if (rc == 0) { - return; - } - /* this should not happen due to the way the scalefactors are selected */ - ERRORF(that->gfc, "INTERNAL ERROR IN VBR NEW CODE (986), please send bug report\n"); - exit(-1); -} - - - -static int -quantizeAndCountBits(const algo_t * that) -{ - quantize_x34(that); - that->cod_info->part2_3_length = noquant_count_bits(that->gfc, that->cod_info, 0); - return that->cod_info->part2_3_length; -} - - - - - -static int -tryGlobalStepsize(const algo_t * that, const int sfwork[SFBMAX], - const int vbrsfmin[SFBMAX], int delta) -{ - FLOAT const xrpow_max = that->cod_info->xrpow_max; - int sftemp[SFBMAX], i, nbits; - int gain, vbrmax = 0; - for (i = 0; i < SFBMAX; ++i) { - gain = sfwork[i] + delta; - if (gain < vbrsfmin[i]) { - gain = vbrsfmin[i]; - } - if (gain > 255) { - gain = 255; - } - if (vbrmax < gain) { - vbrmax = gain; - } - sftemp[i] = gain; - } - that->alloc(that, sftemp, vbrsfmin, vbrmax); - bitcount(that); - nbits = quantizeAndCountBits(that); - that->cod_info->xrpow_max = xrpow_max; - return nbits; -} - - - -static void -searchGlobalStepsizeMax(const algo_t * that, const int sfwork[SFBMAX], - const int vbrsfmin[SFBMAX], int target) -{ - gr_info const *const cod_info = that->cod_info; - const int gain = cod_info->global_gain; - int curr = gain; - int gain_ok = 1024; - int nbits = LARGE_BITS; - int l = gain, r = 512; - - assert(gain >= 0); - while (l <= r) { - curr = (l + r) >> 1; - nbits = tryGlobalStepsize(that, sfwork, vbrsfmin, curr - gain); - if (nbits == 0 || (nbits + cod_info->part2_length) < target) { - r = curr - 1; - gain_ok = curr; - } - else { - l = curr + 1; - if (gain_ok == 1024) { - gain_ok = curr; - } - } - } - if (gain_ok != curr) { - curr = gain_ok; - nbits = tryGlobalStepsize(that, sfwork, vbrsfmin, curr - gain); - } -} - - - -static int -sfDepth(const int sfwork[SFBMAX]) -{ - int m = 0; - unsigned int i, j; - for (j = SFBMAX, i = 0; j > 0; --j, ++i) { - int const di = 255 - sfwork[i]; - if (m < di) { - m = di; - } - assert(sfwork[i] >= 0); - assert(sfwork[i] <= 255); - } - assert(m >= 0); - assert(m <= 255); - return m; -} - - -static void -cutDistribution(const int sfwork[SFBMAX], int sf_out[SFBMAX], int cut) -{ - unsigned int i, j; - for (j = SFBMAX, i = 0; j > 0; --j, ++i) { - int const x = sfwork[i]; - sf_out[i] = x < cut ? x : cut; - } -} - - -static int -flattenDistribution(const int sfwork[SFBMAX], int sf_out[SFBMAX], int dm, int k, int p) -{ - unsigned int i, j; - int x, sfmax = 0; - if (dm > 0) { - for (j = SFBMAX, i = 0; j > 0; --j, ++i) { - int const di = p - sfwork[i]; - x = sfwork[i] + (k * di) / dm; - if (x < 0) { - x = 0; - } - else { - if (x > 255) { - x = 255; - } - } - sf_out[i] = x; - if (sfmax < x) { - sfmax = x; - } - } - } - else { - for (j = SFBMAX, i = 0; j > 0u; --j, ++i) { - x = sfwork[i]; - sf_out[i] = x; - if (sfmax < x) { - sfmax = x; - } - } - } - return sfmax; -} - - -static int -tryThatOne(algo_t const* that, const int sftemp[SFBMAX], const int vbrsfmin[SFBMAX], int vbrmax) -{ - FLOAT const xrpow_max = that->cod_info->xrpow_max; - int nbits = LARGE_BITS; - that->alloc(that, sftemp, vbrsfmin, vbrmax); - bitcount(that); - nbits = quantizeAndCountBits(that); - nbits += that->cod_info->part2_length; - that->cod_info->xrpow_max = xrpow_max; - return nbits; -} - - -static void -outOfBitsStrategy(algo_t const* that, const int sfwork[SFBMAX], const int vbrsfmin[SFBMAX], int target) -{ - int wrk[SFBMAX]; - int const dm = sfDepth(sfwork); - int const p = that->cod_info->global_gain; - int nbits; - - /* PART 1 */ - { - int bi = dm / 2; - int bi_ok = -1; - int bu = 0; - int bo = dm; - for (;;) { - int const sfmax = flattenDistribution(sfwork, wrk, dm, bi, p); - nbits = tryThatOne(that, wrk, vbrsfmin, sfmax); - if (nbits <= target) { - bi_ok = bi; - bo = bi - 1; - } - else { - bu = bi + 1; - } - if (bu <= bo) { - bi = (bu + bo) / 2; - } - else { - break; - } - } - if (bi_ok >= 0) { - if (bi != bi_ok) { - int const sfmax = flattenDistribution(sfwork, wrk, dm, bi_ok, p); - nbits = tryThatOne(that, wrk, vbrsfmin, sfmax); - } - return; - } - } - - /* PART 2: */ - { - int bi = (255 + p) / 2; - int bi_ok = -1; - int bu = p; - int bo = 255; - for (;;) { - int const sfmax = flattenDistribution(sfwork, wrk, dm, dm, bi); - nbits = tryThatOne(that, wrk, vbrsfmin, sfmax); - if (nbits <= target) { - bi_ok = bi; - bo = bi - 1; - } - else { - bu = bi + 1; - } - if (bu <= bo) { - bi = (bu + bo) / 2; - } - else { - break; - } - } - if (bi_ok >= 0) { - if (bi != bi_ok) { - int const sfmax = flattenDistribution(sfwork, wrk, dm, dm, bi_ok); - nbits = tryThatOne(that, wrk, vbrsfmin, sfmax); - } - return; - } - } - - /* fall back to old code, likely to be never called */ - searchGlobalStepsizeMax(that, wrk, vbrsfmin, target); -} - - -static int -reduce_bit_usage(lame_internal_flags * gfc, int gr, int ch -#if 0 - , const FLOAT xr34orig[576], const FLOAT l3_xmin[SFBMAX], int maxbits -#endif - ) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - gr_info *const cod_info = &gfc->l3_side.tt[gr][ch]; - /* try some better scalefac storage - */ - best_scalefac_store(gfc, gr, ch, &gfc->l3_side); - - /* best huffman_divide may save some bits too - */ - if (cfg->use_best_huffman == 1) - best_huffman_divide(gfc, cod_info); - return cod_info->part2_3_length + cod_info->part2_length; -} - - - - -int -VBR_encode_frame(lame_internal_flags * gfc, const FLOAT xr34orig[2][2][576], - const FLOAT l3_xmin[2][2][SFBMAX], const int max_bits[2][2]) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - int sfwork_[2][2][SFBMAX]; - int vbrsfmin_[2][2][SFBMAX]; - algo_t that_[2][2]; - int const ngr = cfg->mode_gr; - int const nch = cfg->channels_out; - int max_nbits_ch[2][2] = {{0, 0}, {0 ,0}}; - int max_nbits_gr[2] = {0, 0}; - int max_nbits_fr = 0; - int use_nbits_ch[2][2] = {{MAX_BITS_PER_CHANNEL+1, MAX_BITS_PER_CHANNEL+1} - ,{MAX_BITS_PER_CHANNEL+1, MAX_BITS_PER_CHANNEL+1}}; - int use_nbits_gr[2] = { MAX_BITS_PER_GRANULE+1, MAX_BITS_PER_GRANULE+1 }; - int use_nbits_fr = MAX_BITS_PER_GRANULE+MAX_BITS_PER_GRANULE; - int gr, ch; - int ok, sum_fr; - - /* set up some encoding parameters - */ - for (gr = 0; gr < ngr; ++gr) { - max_nbits_gr[gr] = 0; - for (ch = 0; ch < nch; ++ch) { - max_nbits_ch[gr][ch] = max_bits[gr][ch]; - use_nbits_ch[gr][ch] = 0; - max_nbits_gr[gr] += max_bits[gr][ch]; - max_nbits_fr += max_bits[gr][ch]; - that_[gr][ch].find = (cfg->full_outer_loop < 0) ? guess_scalefac_x34 : find_scalefac_x34; - that_[gr][ch].gfc = gfc; - that_[gr][ch].cod_info = &gfc->l3_side.tt[gr][ch]; - that_[gr][ch].xr34orig = xr34orig[gr][ch]; - if (that_[gr][ch].cod_info->block_type == SHORT_TYPE) { - that_[gr][ch].alloc = short_block_constrain; - } - else { - that_[gr][ch].alloc = long_block_constrain; - } - } /* for ch */ - } - /* searches scalefactors - */ - for (gr = 0; gr < ngr; ++gr) { - for (ch = 0; ch < nch; ++ch) { - if (max_bits[gr][ch] > 0) { - algo_t *that = &that_[gr][ch]; - int *sfwork = sfwork_[gr][ch]; - int *vbrsfmin = vbrsfmin_[gr][ch]; - int vbrmax; - - vbrmax = block_sf(that, l3_xmin[gr][ch], sfwork, vbrsfmin); - that->alloc(that, sfwork, vbrsfmin, vbrmax); - bitcount(that); - } - else { - /* xr contains no energy - * l3_enc, our encoding data, will be quantized to zero - * continue with next channel - */ - } - } /* for ch */ - } - /* encode 'as is' - */ - use_nbits_fr = 0; - for (gr = 0; gr < ngr; ++gr) { - use_nbits_gr[gr] = 0; - for (ch = 0; ch < nch; ++ch) { - algo_t const *that = &that_[gr][ch]; - if (max_bits[gr][ch] > 0) { - memset(&that->cod_info->l3_enc[0], 0, sizeof(that->cod_info->l3_enc)); - (void) quantizeAndCountBits(that); - } - else { - /* xr contains no energy - * l3_enc, our encoding data, will be quantized to zero - * continue with next channel - */ - } - use_nbits_ch[gr][ch] = reduce_bit_usage(gfc, gr, ch); - use_nbits_gr[gr] += use_nbits_ch[gr][ch]; - } /* for ch */ - use_nbits_fr += use_nbits_gr[gr]; - } - - /* check bit constrains - */ - if (use_nbits_fr <= max_nbits_fr) { - ok = 1; - for (gr = 0; gr < ngr; ++gr) { - if (use_nbits_gr[gr] > MAX_BITS_PER_GRANULE) { - /* violates the rule that every granule has to use no more - * bits than MAX_BITS_PER_GRANULE - */ - ok = 0; - } - for (ch = 0; ch < nch; ++ch) { - if (use_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) { - /* violates the rule that every gr_ch has to use no more - * bits than MAX_BITS_PER_CHANNEL - * - * This isn't explicitly stated in the ISO docs, but the - * part2_3_length field has only 12 bits, that makes it - * up to a maximum size of 4095 bits!!! - */ - ok = 0; - } - } - } - if (ok) { - return use_nbits_fr; - } - } - - /* OK, we are in trouble and have to define how many bits are - * to be used for each granule - */ - { - ok = 1; - sum_fr = 0; - - for (gr = 0; gr < ngr; ++gr) { - max_nbits_gr[gr] = 0; - for (ch = 0; ch < nch; ++ch) { - if (use_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) { - max_nbits_ch[gr][ch] = MAX_BITS_PER_CHANNEL; - } - else { - max_nbits_ch[gr][ch] = use_nbits_ch[gr][ch]; - } - max_nbits_gr[gr] += max_nbits_ch[gr][ch]; - } - if (max_nbits_gr[gr] > MAX_BITS_PER_GRANULE) { - float f[2] = {0.0f, 0.0f}, s = 0.0f; - for (ch = 0; ch < nch; ++ch) { - if (max_nbits_ch[gr][ch] > 0) { - f[ch] = sqrt(sqrt(max_nbits_ch[gr][ch])); - s += f[ch]; - } - else { - f[ch] = 0; - } - } - for (ch = 0; ch < nch; ++ch) { - if (s > 0) { - max_nbits_ch[gr][ch] = MAX_BITS_PER_GRANULE * f[ch] / s; - } - else { - max_nbits_ch[gr][ch] = 0; - } - } - if (nch > 1) { - if (max_nbits_ch[gr][0] > use_nbits_ch[gr][0] + 32) { - max_nbits_ch[gr][1] += max_nbits_ch[gr][0]; - max_nbits_ch[gr][1] -= use_nbits_ch[gr][0] + 32; - max_nbits_ch[gr][0] = use_nbits_ch[gr][0] + 32; - } - if (max_nbits_ch[gr][1] > use_nbits_ch[gr][1] + 32) { - max_nbits_ch[gr][0] += max_nbits_ch[gr][1]; - max_nbits_ch[gr][0] -= use_nbits_ch[gr][1] + 32; - max_nbits_ch[gr][1] = use_nbits_ch[gr][1] + 32; - } - if (max_nbits_ch[gr][0] > MAX_BITS_PER_CHANNEL) { - max_nbits_ch[gr][0] = MAX_BITS_PER_CHANNEL; - } - if (max_nbits_ch[gr][1] > MAX_BITS_PER_CHANNEL) { - max_nbits_ch[gr][1] = MAX_BITS_PER_CHANNEL; - } - } - max_nbits_gr[gr] = 0; - for (ch = 0; ch < nch; ++ch) { - max_nbits_gr[gr] += max_nbits_ch[gr][ch]; - } - } - sum_fr += max_nbits_gr[gr]; - } - if (sum_fr > max_nbits_fr) { - { - float f[2] = {0.0f, 0.0f}, s = 0.0f; - for (gr = 0; gr < ngr; ++gr) { - if (max_nbits_gr[gr] > 0) { - f[gr] = sqrt(max_nbits_gr[gr]); - s += f[gr]; - } - else { - f[gr] = 0; - } - } - for (gr = 0; gr < ngr; ++gr) { - if (s > 0) { - max_nbits_gr[gr] = max_nbits_fr * f[gr] / s; - } - else { - max_nbits_gr[gr] = 0; - } - } - } - if (ngr > 1) { - if (max_nbits_gr[0] > use_nbits_gr[0] + 125) { - max_nbits_gr[1] += max_nbits_gr[0]; - max_nbits_gr[1] -= use_nbits_gr[0] + 125; - max_nbits_gr[0] = use_nbits_gr[0] + 125; - } - if (max_nbits_gr[1] > use_nbits_gr[1] + 125) { - max_nbits_gr[0] += max_nbits_gr[1]; - max_nbits_gr[0] -= use_nbits_gr[1] + 125; - max_nbits_gr[1] = use_nbits_gr[1] + 125; - } - for (gr = 0; gr < ngr; ++gr) { - if (max_nbits_gr[gr] > MAX_BITS_PER_GRANULE) { - max_nbits_gr[gr] = MAX_BITS_PER_GRANULE; - } - } - } - for (gr = 0; gr < ngr; ++gr) { - float f[2] = {0.0f, 0.0f}, s = 0.0f; - for (ch = 0; ch < nch; ++ch) { - if (max_nbits_ch[gr][ch] > 0) { - f[ch] = sqrt(max_nbits_ch[gr][ch]); - s += f[ch]; - } - else { - f[ch] = 0; - } - } - for (ch = 0; ch < nch; ++ch) { - if (s > 0) { - max_nbits_ch[gr][ch] = max_nbits_gr[gr] * f[ch] / s; - } - else { - max_nbits_ch[gr][ch] = 0; - } - } - if (nch > 1) { - if (max_nbits_ch[gr][0] > use_nbits_ch[gr][0] + 32) { - max_nbits_ch[gr][1] += max_nbits_ch[gr][0]; - max_nbits_ch[gr][1] -= use_nbits_ch[gr][0] + 32; - max_nbits_ch[gr][0] = use_nbits_ch[gr][0] + 32; - } - if (max_nbits_ch[gr][1] > use_nbits_ch[gr][1] + 32) { - max_nbits_ch[gr][0] += max_nbits_ch[gr][1]; - max_nbits_ch[gr][0] -= use_nbits_ch[gr][1] + 32; - max_nbits_ch[gr][1] = use_nbits_ch[gr][1] + 32; - } - for (ch = 0; ch < nch; ++ch) { - if (max_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) { - max_nbits_ch[gr][ch] = MAX_BITS_PER_CHANNEL; - } - } - } - } - } - /* sanity check */ - sum_fr = 0; - for (gr = 0; gr < ngr; ++gr) { - int sum_gr = 0; - for (ch = 0; ch < nch; ++ch) { - sum_gr += max_nbits_ch[gr][ch]; - if (max_nbits_ch[gr][ch] > MAX_BITS_PER_CHANNEL) { - ok = 0; - } - } - sum_fr += sum_gr; - if (sum_gr > MAX_BITS_PER_GRANULE) { - ok = 0; - } - } - if (sum_fr > max_nbits_fr) { - ok = 0; - } - if (!ok) { - /* we must have done something wrong, fallback to 'on_pe' based constrain */ - for (gr = 0; gr < ngr; ++gr) { - for (ch = 0; ch < nch; ++ch) { - max_nbits_ch[gr][ch] = max_bits[gr][ch]; - } - } - } - } - - /* we already called the 'best_scalefac_store' function, so we need to reset some - * variables before we can do it again. - */ - for (ch = 0; ch < nch; ++ch) { - gfc->l3_side.scfsi[ch][0] = 0; - gfc->l3_side.scfsi[ch][1] = 0; - gfc->l3_side.scfsi[ch][2] = 0; - gfc->l3_side.scfsi[ch][3] = 0; - } - for (gr = 0; gr < ngr; ++gr) { - for (ch = 0; ch < nch; ++ch) { - gfc->l3_side.tt[gr][ch].scalefac_compress = 0; - } - } - - /* alter our encoded data, until it fits into the target bitrate - */ - use_nbits_fr = 0; - for (gr = 0; gr < ngr; ++gr) { - use_nbits_gr[gr] = 0; - for (ch = 0; ch < nch; ++ch) { - algo_t const *that = &that_[gr][ch]; - use_nbits_ch[gr][ch] = 0; - if (max_bits[gr][ch] > 0) { - int *sfwork = sfwork_[gr][ch]; - int const *vbrsfmin = vbrsfmin_[gr][ch]; - cutDistribution(sfwork, sfwork, that->cod_info->global_gain); - outOfBitsStrategy(that, sfwork, vbrsfmin, max_nbits_ch[gr][ch]); - } - use_nbits_ch[gr][ch] = reduce_bit_usage(gfc, gr, ch); - assert(use_nbits_ch[gr][ch] <= max_nbits_ch[gr][ch]); - use_nbits_gr[gr] += use_nbits_ch[gr][ch]; - } /* for ch */ - use_nbits_fr += use_nbits_gr[gr]; - } - - /* check bit constrains, but it should always be ok, iff there are no bugs ;-) - */ - if (use_nbits_fr <= max_nbits_fr) { - return use_nbits_fr; - } - - ERRORF(gfc, "INTERNAL ERROR IN VBR NEW CODE (1313), please send bug report\n" - "maxbits=%d usedbits=%d\n", max_nbits_fr, use_nbits_fr); - exit(-1); - return 0; -} diff --git a/src/lib/dl/ext/lame/vbrquantize.h b/src/lib/dl/ext/lame/vbrquantize.h deleted file mode 100755 index 1c0d18f0..00000000 --- a/src/lib/dl/ext/lame/vbrquantize.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * MP3 VBR quantization - * - * Copyright (c) 1999 Mark Taylor - * - * 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_VBRQUANTIZE_H -#define LAME_VBRQUANTIZE_H - -int VBR_encode_frame(lame_internal_flags * gfc, const FLOAT xr34orig[2][2][576], - const FLOAT l3_xmin[2][2][SFBMAX], const int maxbits[2][2]); - -#endif /* LAME_VBRQUANTIZE_H */ diff --git a/src/lib/dl/ext/lame/vbrtag.c b/src/lib/dl/ext/lame/vbrtag.c deleted file mode 100755 index a4430ec5..00000000 --- a/src/lib/dl/ext/lame/vbrtag.c +++ /dev/null @@ -1,1082 +0,0 @@ -/* - * Xing VBR tagging for LAME. - * - * Copyright (c) 1999 A.L. Faber - * Copyright (c) 2001 Jonathan Dee - * - * 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. - */ - -/* $Id: VbrTag.c,v 1.103.2.1 2011/11/18 09:18:28 robert Exp $ */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "bitstream.h" -#include "vbrtag.h" -#include "lame_global_flags.h" -#include "tables.h" - -#ifdef __sun__ -/* woraround for SunOS 4.x, it has SEEK_* defined here */ -#include <unistd.h> -#endif - - -#ifdef _DEBUG -/* #define DEBUG_VBRTAG */ -#endif - -/* - * 4 bytes for Header Tag - * 4 bytes for Header Flags - * 100 bytes for entry (NUMTOCENTRIES) - * 4 bytes for FRAME SIZE - * 4 bytes for STREAM_SIZE - * 4 bytes for VBR SCALE. a VBR quality indicator: 0=best 100=worst - * 20 bytes for LAME tag. for example, "LAME3.12 (beta 6)" - * ___________ - * 140 bytes -*/ -#define VBRHEADERSIZE (NUMTOCENTRIES+4+4+4+4+4) - -#define LAMEHEADERSIZE (VBRHEADERSIZE + 9 + 1 + 1 + 8 + 1 + 1 + 3 + 1 + 1 + 2 + 4 + 2 + 2) - -/* the size of the Xing header (MPEG1 and MPEG2) in kbps */ -#define XING_BITRATE1 128 -#define XING_BITRATE2 64 -#define XING_BITRATE25 32 - -extern const char* get_lame_tag_encoder_short_version(void); - -static const char VBRTag0[] = { "Xing" }; -static const char VBRTag1[] = { "Info" }; - - - - -/* Lookup table for fast CRC computation - * See 'CRC_update_lookup' - * Uses the polynomial x^16+x^15+x^2+1 */ - -static const unsigned int crc16_lookup[256] = { - 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, - 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, - 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, - 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, - 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, - 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, - 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, - 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, - 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, - 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, - 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, - 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, - 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, - 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, - 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, - 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, - 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, - 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, - 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, - 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, - 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, - 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, - 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, - 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, - 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, - 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, - 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, - 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, - 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, - 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, - 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, - 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 -}; - - - - - -/*********************************************************************** - * Robert Hegemann 2001-01-17 - ***********************************************************************/ - -static void -addVbr(VBR_seek_info_t * v, int bitrate) -{ - int i; - - v->nVbrNumFrames++; - v->sum += bitrate; - v->seen++; - - if (v->seen < v->want) { - return; - } - - if (v->pos < v->size) { - v->bag[v->pos] = v->sum; - v->pos++; - v->seen = 0; - } - if (v->pos == v->size) { - for (i = 1; i < v->size; i += 2) { - v->bag[i / 2] = v->bag[i]; - } - v->want *= 2; - v->pos /= 2; - } -} - -static void -Xing_seek_table(VBR_seek_info_t const* v, unsigned char *t) -{ - int i, indx; - int seek_point; - - if (v->pos <= 0) - return; - - for (i = 1; i < NUMTOCENTRIES; ++i) { - float j = i / (float) NUMTOCENTRIES, act, sum; - indx = (int) (floor(j * v->pos)); - if (indx > v->pos - 1) - indx = v->pos - 1; - act = v->bag[indx]; - sum = v->sum; - seek_point = (int) (256. * act / sum); - if (seek_point > 255) - seek_point = 255; - t[i] = seek_point; - } -} - -#ifdef DEBUG_VBR_SEEKING_TABLE -static void -print_seeking(unsigned char *t) -{ - int i; - - printf("seeking table "); - for (i = 0; i < NUMTOCENTRIES; ++i) { - printf(" %d ", t[i]); - } - printf("\n"); -} -#endif - - -/**************************************************************************** - * AddVbrFrame: Add VBR entry, used to fill the VBR the TOC entries - * Paramters: - * nStreamPos: how many bytes did we write to the bitstream so far - * (in Bytes NOT Bits) - **************************************************************************** -*/ -void -AddVbrFrame(lame_internal_flags * gfc) -{ - int kbps = bitrate_table[gfc->cfg.version][gfc->ov_enc.bitrate_index]; - assert(gfc->VBR_seek_table.bag); - addVbr(&gfc->VBR_seek_table, kbps); -} - - -/*-------------------------------------------------------------*/ -static int -ExtractI4(const 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; -} - -static void -CreateI4(unsigned char *buf, uint32_t nValue) -{ - /* big endian create */ - buf[0] = (nValue >> 24) & 0xff; - buf[1] = (nValue >> 16) & 0xff; - buf[2] = (nValue >> 8) & 0xff; - buf[3] = (nValue) & 0xff; -} - - - -static void -CreateI2(unsigned char *buf, int nValue) -{ - /* big endian create */ - buf[0] = (nValue >> 8) & 0xff; - buf[1] = (nValue) & 0xff; -} - -/* check for magic strings*/ -static int -IsVbrTag(const unsigned char *buf) -{ - int isTag0, isTag1; - - isTag0 = ((buf[0] == VBRTag0[0]) && (buf[1] == VBRTag0[1]) && (buf[2] == VBRTag0[2]) - && (buf[3] == VBRTag0[3])); - isTag1 = ((buf[0] == VBRTag1[0]) && (buf[1] == VBRTag1[1]) && (buf[2] == VBRTag1[2]) - && (buf[3] == VBRTag1[3])); - - return (isTag0 || isTag1); -} - -#define SHIFT_IN_BITS_VALUE(x,n,v) ( x = (x << (n)) | ( (v) & ~(-1 << (n)) ) ) - -static void -setLameTagFrameHeader(lame_internal_flags const *gfc, unsigned char *buffer) -{ - SessionConfig_t const *const cfg = &gfc->cfg; - EncResult_t const *const eov = &gfc->ov_enc; - char abyte, bbyte; - - SHIFT_IN_BITS_VALUE(buffer[0], 8u, 0xffu); - - SHIFT_IN_BITS_VALUE(buffer[1], 3u, 7); - SHIFT_IN_BITS_VALUE(buffer[1], 1u, (cfg->samplerate_out < 16000) ? 0 : 1); - SHIFT_IN_BITS_VALUE(buffer[1], 1u, cfg->version); - SHIFT_IN_BITS_VALUE(buffer[1], 2u, 4 - 3); - SHIFT_IN_BITS_VALUE(buffer[1], 1u, (!cfg->error_protection) ? 1 : 0); - - SHIFT_IN_BITS_VALUE(buffer[2], 4u, eov->bitrate_index); - SHIFT_IN_BITS_VALUE(buffer[2], 2u, cfg->samplerate_index); - SHIFT_IN_BITS_VALUE(buffer[2], 1u, 0); - SHIFT_IN_BITS_VALUE(buffer[2], 1u, cfg->extension); - - SHIFT_IN_BITS_VALUE(buffer[3], 2u, cfg->mode); - SHIFT_IN_BITS_VALUE(buffer[3], 2u, eov->mode_ext); - SHIFT_IN_BITS_VALUE(buffer[3], 1u, cfg->copyright); - SHIFT_IN_BITS_VALUE(buffer[3], 1u, cfg->original); - SHIFT_IN_BITS_VALUE(buffer[3], 2u, cfg->emphasis); - - /* the default VBR header. 48 kbps layer III, no padding, no crc */ - /* but sampling freq, mode andy copyright/copy protection taken */ - /* from first valid frame */ - buffer[0] = (uint8_t) 0xff; - abyte = (buffer[1] & (unsigned char) 0xf1); - { - int bitrate; - if (1 == cfg->version) { - bitrate = XING_BITRATE1; - } - else { - if (cfg->samplerate_out < 16000) - bitrate = XING_BITRATE25; - else - bitrate = XING_BITRATE2; - } - - if (cfg->vbr == vbr_off) - bitrate = cfg->avg_bitrate; - - if (cfg->free_format) - bbyte = 0x00; - else - bbyte = 16 * BitrateIndex(bitrate, cfg->version, cfg->samplerate_out); - } - - /* Use as much of the info from the real frames in the - * Xing header: samplerate, channels, crc, etc... - */ - if (cfg->version == 1) { - /* MPEG1 */ - buffer[1] = abyte | (char) 0x0a; /* was 0x0b; */ - abyte = buffer[2] & (char) 0x0d; /* AF keep also private bit */ - buffer[2] = (char) bbyte | abyte; /* 64kbs MPEG1 frame */ - } - else { - /* MPEG2 */ - buffer[1] = abyte | (char) 0x02; /* was 0x03; */ - abyte = buffer[2] & (char) 0x0d; /* AF keep also private bit */ - buffer[2] = (char) bbyte | abyte; /* 64kbs MPEG2 frame */ - } -} - -#if 0 -static int CheckVbrTag(unsigned char *buf); - -/*-------------------------------------------------------------*/ -/* Same as GetVbrTag below, but only checks for the Xing tag. - requires buf to contain only 40 bytes */ -/*-------------------------------------------------------------*/ -int -CheckVbrTag(unsigned char *buf) -{ - int h_id, h_mode; - - /* get selected MPEG header data */ - h_id = (buf[1] >> 3) & 1; - 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); - } - - return IsVbrTag(buf); -} -#endif - -int -GetVbrTag(VBRTAGDATA * pTagData, const unsigned char *buf) -{ - int i, head_flags; - int h_bitrate, h_id, h_mode, h_sr_index, h_layer; - int enc_delay, enc_padding; - - /* get Vbr header data */ - pTagData->flags = 0; - - /* get selected MPEG header data */ - h_layer = (buf[1] >> 1) & 3; - if ( h_layer != 0x01 ) { - /* the following code assumes Layer-3, so give up here */ - return 0; - } - 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 (!IsVbrTag(buf)) - 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; i < NUMTOCENTRIES; i++) - pTagData->toc[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 DEBUG_VBRTAG - fprintf(stderr, "\n\n********************* VBR TAG INFO *****************\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; i < NUMTOCENTRIES; i++) { - if ((i % 10) == 0) - fprintf(stderr, "\n"); - fprintf(stderr, " %3d", (int) (pTagData->toc[i])); - } - } - fprintf(stderr, "\n***************** END OF VBR TAG INFO ***************\n"); -#endif - return 1; /* success */ -} - - -/**************************************************************************** - * InitVbrTag: Initializes the header, and write empty frame to stream - * Paramters: - * fpStream: pointer to output file stream - * nMode : Channel Mode: 0=STEREO 1=JS 2=DS 3=MONO - **************************************************************************** -*/ -int -InitVbrTag(lame_global_flags * gfp) -{ - lame_internal_flags *gfc = gfp->internal_flags; - SessionConfig_t const *const cfg = &gfc->cfg; - int kbps_header; - -#define MAXFRAMESIZE 2880 /* or 0xB40, the max freeformat 640 32kHz framesize */ - - /* - * Xing VBR pretends to be a 48kbs layer III frame. (at 44.1kHz). - * (at 48kHz they use 56kbs since 48kbs frame not big enough for - * table of contents) - * let's always embed Xing header inside a 64kbs layer III frame. - * this gives us enough room for a LAME version string too. - * size determined by sampling frequency (MPEG1) - * 32kHz: 216 bytes@48kbs 288bytes@ 64kbs - * 44.1kHz: 156 bytes 208bytes@64kbs (+1 if padding = 1) - * 48kHz: 144 bytes 192 - * - * MPEG 2 values are the same since the framesize and samplerate - * are each reduced by a factor of 2. - */ - - - if (1 == cfg->version) { - kbps_header = XING_BITRATE1; - } - else { - if (cfg->samplerate_out < 16000) - kbps_header = XING_BITRATE25; - else - kbps_header = XING_BITRATE2; - } - - if (cfg->vbr == vbr_off) - kbps_header = cfg->avg_bitrate; - - /** make sure LAME Header fits into Frame - */ - { - int total_frame_size = ((cfg->version + 1) * 72000 * kbps_header) / cfg->samplerate_out; - int header_size = (cfg->sideinfo_len + LAMEHEADERSIZE); - gfc->VBR_seek_table.TotalFrameSize = total_frame_size; - if (total_frame_size < header_size || total_frame_size > MAXFRAMESIZE) { - /* disable tag, it wont fit */ - gfc->cfg.write_lame_tag = 0; - return 0; - } - } - - gfc->VBR_seek_table.nVbrNumFrames = 0; - gfc->VBR_seek_table.nBytesWritten = 0; - gfc->VBR_seek_table.sum = 0; - - gfc->VBR_seek_table.seen = 0; - gfc->VBR_seek_table.want = 1; - gfc->VBR_seek_table.pos = 0; - - if (gfc->VBR_seek_table.bag == NULL) { - gfc->VBR_seek_table.bag = malloc(400 * sizeof(int)); - if (gfc->VBR_seek_table.bag != NULL) { - gfc->VBR_seek_table.size = 400; - } - else { - gfc->VBR_seek_table.size = 0; - ERRORF(gfc, "Error: can't allocate VbrFrames buffer\n"); - gfc->cfg.write_lame_tag = 0; - return -1; - } - } - - /* write dummy VBR tag of all 0's into bitstream */ - { - uint8_t buffer[MAXFRAMESIZE]; - size_t i, n; - - memset(buffer, 0, sizeof(buffer)); - setLameTagFrameHeader(gfc, buffer); - n = gfc->VBR_seek_table.TotalFrameSize; - for (i = 0; i < n; ++i) { - add_dummy_byte(gfc, buffer[i], 1); - } - } - /* Success */ - return 0; -} - - - -/* fast CRC-16 computation - uses table crc16_lookup 8*/ -static uint16_t -CRC_update_lookup(uint16_t value, uint16_t crc) -{ - uint16_t tmp; - tmp = crc ^ value; - crc = (crc >> 8) ^ crc16_lookup[tmp & 0xff]; - return crc; -} - -void -UpdateMusicCRC(uint16_t * crc, unsigned char const *buffer, int size) -{ - int i; - for (i = 0; i < size; ++i) - *crc = CRC_update_lookup(buffer[i], *crc); -} - - - - - -/**************************************************************************** - * Jonathan Dee 2001/08/31 - * - * PutLameVBR: Write LAME info: mini version + info on various switches used - * Paramters: - * pbtStreamBuffer : pointer to output buffer - * id3v2size : size of id3v2 tag in bytes - * crc : computation of crc-16 of Lame Tag so far (starting at frame sync) - * - **************************************************************************** -*/ -static int -PutLameVBR(lame_global_flags const *gfp, size_t nMusicLength, uint8_t * pbtStreamBuffer, uint16_t crc) -{ - lame_internal_flags const *gfc = gfp->internal_flags; - SessionConfig_t const *const cfg = &gfc->cfg; - - int nBytesWritten = 0; - int i; - - int enc_delay = gfc->ov_enc.encoder_delay; /* encoder delay */ - int enc_padding = gfc->ov_enc.encoder_padding; /* encoder padding */ - - /*recall: cfg->vbr_q is for example set by the switch -V */ - /* gfp->quality by -q, -h, -f, etc */ - - int nQuality = (100 - 10 * gfp->VBR_q - gfp->quality); - - - /* - NOTE: - Even though the specification for the LAME VBR tag - did explicitly mention other encoders than LAME, - many SW/HW decoder seem to be able to make use of - this tag only, if the encoder version starts with LAME. - To be compatible with such decoders, ANY encoder will - be forced to write a fake LAME version string! - As a result, the encoder version info becomes worthless. - */ - const char *szVersion = get_lame_tag_encoder_short_version(); - uint8_t nVBR; - uint8_t nRevision = 0x00; - uint8_t nRevMethod; - uint8_t vbr_type_translator[] = { 1, 5, 3, 2, 4, 0, 3 }; /*numbering different in vbr_mode vs. Lame tag */ - - uint8_t nLowpass = - (((cfg->lowpassfreq / 100.0) + .5) > 255 ? 255 : (cfg->lowpassfreq / 100.0) + .5); - - uint32_t nPeakSignalAmplitude = 0; - - uint16_t nRadioReplayGain = 0; - uint16_t nAudiophileReplayGain = 0; - - uint8_t nNoiseShaping = cfg->noise_shaping; - uint8_t nStereoMode = 0; - int bNonOptimal = 0; - uint8_t nSourceFreq = 0; - uint8_t nMisc = 0; - uint16_t nMusicCRC = 0; - - /*psy model type: Gpsycho or NsPsytune */ - unsigned char bExpNPsyTune = 1; /* only NsPsytune */ - unsigned char bSafeJoint = (cfg->use_safe_joint_stereo) != 0; - - unsigned char bNoGapMore = 0; - unsigned char bNoGapPrevious = 0; - - int nNoGapCount = gfp->nogap_total; - int nNoGapCurr = gfp->nogap_current; - - - uint8_t nAthType = cfg->ATHtype; /*4 bits. */ - - uint8_t nFlags = 0; - - /* if ABR, {store bitrate <=255} else { store "-b"} */ - int nABRBitrate; - switch (cfg->vbr) { - case vbr_abr:{ - nABRBitrate = cfg->vbr_avg_bitrate_kbps; - break; - } - case vbr_off:{ - nABRBitrate = cfg->avg_bitrate; - break; - } - default:{ /*vbr modes */ - nABRBitrate = bitrate_table[cfg->version][cfg->vbr_min_bitrate_index];; - } - } - - - /*revision and vbr method */ - if (cfg->vbr < sizeof(vbr_type_translator)) - nVBR = vbr_type_translator[cfg->vbr]; - else - nVBR = 0x00; /*unknown. */ - - nRevMethod = 0x10 * nRevision + nVBR; - - - /* ReplayGain */ - if (cfg->findReplayGain) { - int RadioGain = gfc->ov_rpg.RadioGain; - if (RadioGain > 0x1FE) - RadioGain = 0x1FE; - if (RadioGain < -0x1FE) - RadioGain = -0x1FE; - - nRadioReplayGain = 0x2000; /* set name code */ - nRadioReplayGain |= 0xC00; /* set originator code to `determined automatically' */ - - if (RadioGain >= 0) - nRadioReplayGain |= RadioGain; /* set gain adjustment */ - else { - nRadioReplayGain |= 0x200; /* set the sign bit */ - nRadioReplayGain |= -RadioGain; /* set gain adjustment */ - } - } - - /* peak sample */ - if (cfg->findPeakSample) - nPeakSignalAmplitude = - abs((int) ((((FLOAT) gfc->ov_rpg.PeakSample) / 32767.0) * pow(2, 23) + .5)); - - /*nogap */ - if (nNoGapCount != -1) { - if (nNoGapCurr > 0) - bNoGapPrevious = 1; - - if (nNoGapCurr < nNoGapCount - 1) - bNoGapMore = 1; - } - - /*flags */ - - nFlags = nAthType + (bExpNPsyTune << 4) - + (bSafeJoint << 5) - + (bNoGapMore << 6) - + (bNoGapPrevious << 7); - - - if (nQuality < 0) - nQuality = 0; - - /*stereo mode field... a bit ugly. */ - - switch (cfg->mode) { - case MONO: - nStereoMode = 0; - break; - case STEREO: - nStereoMode = 1; - break; - case DUAL_CHANNEL: - nStereoMode = 2; - break; - case JOINT_STEREO: - if (cfg->force_ms) - nStereoMode = 4; - else - nStereoMode = 3; - break; - case NOT_SET: - /* FALLTHROUGH */ - default: - nStereoMode = 7; - break; - } - - /*Intensity stereo : nStereoMode = 6. IS is not implemented */ - - if (cfg->samplerate_in <= 32000) - nSourceFreq = 0x00; - else if (cfg->samplerate_in == 48000) - nSourceFreq = 0x02; - else if (cfg->samplerate_in > 48000) - nSourceFreq = 0x03; - else - nSourceFreq = 0x01; /*default is 44100Hz. */ - - - /*Check if the user overrided the default LAME behaviour with some nasty options */ - - if (cfg->short_blocks == short_block_forced || cfg->short_blocks == short_block_dispensed || ((cfg->lowpassfreq == -1) && (cfg->highpassfreq == -1)) || /* "-k" */ - (cfg->disable_reservoir && cfg->avg_bitrate < 320) || - cfg->noATH || cfg->ATHonly || (nAthType == 0) || cfg->samplerate_in <= 32000) - bNonOptimal = 1; - - nMisc = nNoiseShaping + (nStereoMode << 2) - + (bNonOptimal << 5) - + (nSourceFreq << 6); - - - nMusicCRC = gfc->nMusicCRC; - - - /*Write all this information into the stream */ - CreateI4(&pbtStreamBuffer[nBytesWritten], nQuality); - nBytesWritten += 4; - - strncpy((char *) &pbtStreamBuffer[nBytesWritten], szVersion, 9); - nBytesWritten += 9; - - pbtStreamBuffer[nBytesWritten] = nRevMethod; - nBytesWritten++; - - pbtStreamBuffer[nBytesWritten] = nLowpass; - nBytesWritten++; - - CreateI4(&pbtStreamBuffer[nBytesWritten], nPeakSignalAmplitude); - nBytesWritten += 4; - - CreateI2(&pbtStreamBuffer[nBytesWritten], nRadioReplayGain); - nBytesWritten += 2; - - CreateI2(&pbtStreamBuffer[nBytesWritten], nAudiophileReplayGain); - nBytesWritten += 2; - - pbtStreamBuffer[nBytesWritten] = nFlags; - nBytesWritten++; - - if (nABRBitrate >= 255) - pbtStreamBuffer[nBytesWritten] = 0xFF; - else - pbtStreamBuffer[nBytesWritten] = nABRBitrate; - nBytesWritten++; - - pbtStreamBuffer[nBytesWritten] = enc_delay >> 4; /* works for win32, does it for unix? */ - pbtStreamBuffer[nBytesWritten + 1] = (enc_delay << 4) + (enc_padding >> 8); - pbtStreamBuffer[nBytesWritten + 2] = enc_padding; - - nBytesWritten += 3; - - pbtStreamBuffer[nBytesWritten] = nMisc; - nBytesWritten++; - - - pbtStreamBuffer[nBytesWritten++] = 0; /*unused in rev0 */ - - CreateI2(&pbtStreamBuffer[nBytesWritten], cfg->preset); - nBytesWritten += 2; - - CreateI4(&pbtStreamBuffer[nBytesWritten], (int) nMusicLength); - nBytesWritten += 4; - - CreateI2(&pbtStreamBuffer[nBytesWritten], nMusicCRC); - nBytesWritten += 2; - - /*Calculate tag CRC.... must be done here, since it includes - *previous information*/ - - for (i = 0; i < nBytesWritten; i++) - crc = CRC_update_lookup(pbtStreamBuffer[i], crc); - - CreateI2(&pbtStreamBuffer[nBytesWritten], crc); - nBytesWritten += 2; - - return nBytesWritten; -} - -static long -skipId3v2(FILE * fpStream) -{ - size_t nbytes; - long id3v2TagSize; - unsigned char id3v2Header[10]; - - /* seek to the beginning of the stream */ - if (fseek(fpStream, 0, SEEK_SET) != 0) { - return -2; /* not seekable, abort */ - } - /* read 10 bytes in case there's an ID3 version 2 header here */ - nbytes = fread(id3v2Header, 1, sizeof(id3v2Header), fpStream); - if (nbytes != sizeof(id3v2Header)) { - return -3; /* not readable, maybe opened Write-Only */ - } - /* does the stream begin with the ID3 version 2 file identifier? */ - if (!strncmp((char *) id3v2Header, "ID3", 3)) { - /* the tag size (minus the 10-byte header) is encoded into four - * bytes where the most significant bit is clear in each byte */ - id3v2TagSize = (((id3v2Header[6] & 0x7f) << 21) - | ((id3v2Header[7] & 0x7f) << 14) - | ((id3v2Header[8] & 0x7f) << 7) - | (id3v2Header[9] & 0x7f)) - + sizeof id3v2Header; - } - else { - /* no ID3 version 2 tag in this stream */ - id3v2TagSize = 0; - } - return id3v2TagSize; -} - - - -size_t -lame_get_lametag_frame(lame_global_flags const *gfp, unsigned char *buffer, size_t size) -{ - lame_internal_flags *gfc; - SessionConfig_t const *cfg; - unsigned long stream_size; - unsigned int nStreamIndex; - uint8_t btToc[NUMTOCENTRIES]; - - if (gfp == 0) { - return 0; - } - gfc = gfp->internal_flags; - if (gfc == 0) { - return 0; - } - if (gfc->class_id != LAME_ID) { - return 0; - } - cfg = &gfc->cfg; - if (cfg->write_lame_tag == 0) { - return 0; - } - if (gfc->VBR_seek_table.pos <= 0) { - return 0; - } - if (size < gfc->VBR_seek_table.TotalFrameSize) { - return gfc->VBR_seek_table.TotalFrameSize; - } - if (buffer == 0) { - return 0; - } - - memset(buffer, 0, gfc->VBR_seek_table.TotalFrameSize); - - /* 4 bytes frame header */ - - setLameTagFrameHeader(gfc, buffer); - - /* Clear all TOC entries */ - memset(btToc, 0, sizeof(btToc)); - - if (cfg->free_format) { - int i; - for (i = 1; i < NUMTOCENTRIES; ++i) - btToc[i] = 255 * i / 100; - } - else { - Xing_seek_table(&gfc->VBR_seek_table, btToc); - } -#ifdef DEBUG_VBR_SEEKING_TABLE - print_seeking(btToc); -#endif - - /* Start writing the tag after the zero frame */ - nStreamIndex = cfg->sideinfo_len; - /* note! Xing header specifies that Xing data goes in the - * ancillary data with NO ERROR PROTECTION. If error protecton - * in enabled, the Xing data still starts at the same offset, - * and now it is in sideinfo data block, and thus will not - * decode correctly by non-Xing tag aware players */ - if (cfg->error_protection) - nStreamIndex -= 2; - - /* Put Vbr tag */ - if (cfg->vbr == vbr_off) { - buffer[nStreamIndex++] = VBRTag1[0]; - buffer[nStreamIndex++] = VBRTag1[1]; - buffer[nStreamIndex++] = VBRTag1[2]; - buffer[nStreamIndex++] = VBRTag1[3]; - - } - else { - buffer[nStreamIndex++] = VBRTag0[0]; - buffer[nStreamIndex++] = VBRTag0[1]; - buffer[nStreamIndex++] = VBRTag0[2]; - buffer[nStreamIndex++] = VBRTag0[3]; - } - - /* Put header flags */ - CreateI4(&buffer[nStreamIndex], FRAMES_FLAG + BYTES_FLAG + TOC_FLAG + VBR_SCALE_FLAG); - nStreamIndex += 4; - - /* Put Total Number of frames */ - CreateI4(&buffer[nStreamIndex], gfc->VBR_seek_table.nVbrNumFrames); - nStreamIndex += 4; - - /* Put total audio stream size, including Xing/LAME Header */ - stream_size = gfc->VBR_seek_table.nBytesWritten + gfc->VBR_seek_table.TotalFrameSize; - CreateI4(&buffer[nStreamIndex], stream_size); - nStreamIndex += 4; - - /* Put TOC */ - memcpy(&buffer[nStreamIndex], btToc, sizeof(btToc)); - nStreamIndex += sizeof(btToc); - - - if (cfg->error_protection) { - /* (jo) error_protection: add crc16 information to header */ - CRC_writeheader(gfc, (char *) buffer); - } - { - /*work out CRC so far: initially crc = 0 */ - uint16_t crc = 0x00; - unsigned int i; - for (i = 0; i < nStreamIndex; i++) - crc = CRC_update_lookup(buffer[i], crc); - /*Put LAME VBR info */ - nStreamIndex += PutLameVBR(gfp, stream_size, buffer + nStreamIndex, crc); - } - -#ifdef DEBUG_VBRTAG - { - VBRTAGDATA TestHeader; - GetVbrTag(&TestHeader, buffer); - } -#endif - - return gfc->VBR_seek_table.TotalFrameSize; -} - -/*********************************************************************** - * - * PutVbrTag: Write final VBR tag to the file - * Paramters: - * lpszFileName: filename of MP3 bit stream - * nVbrScale : encoder quality indicator (0..100) - **************************************************************************** - */ - -int -PutVbrTag(lame_global_flags const *gfp, FILE * fpStream) -{ - lame_internal_flags *gfc = gfp->internal_flags; - - long lFileSize; - long id3v2TagSize; - size_t nbytes; - uint8_t buffer[MAXFRAMESIZE]; - - if (gfc->VBR_seek_table.pos <= 0) - return -1; - - /* Seek to end of file */ - fseek(fpStream, 0, SEEK_END); - - /* Get file size */ - lFileSize = ftell(fpStream); - - /* Abort if file has zero length. Yes, it can happen :) */ - if (lFileSize == 0) - return -1; - - /* - * The VBR tag may NOT be located at the beginning of the stream. - * If an ID3 version 2 tag was added, then it must be skipped to write - * the VBR tag data. - */ - - id3v2TagSize = skipId3v2(fpStream); - - if (id3v2TagSize < 0) { - return id3v2TagSize; - } - - /*Seek to the beginning of the stream */ - fseek(fpStream, id3v2TagSize, SEEK_SET); - - nbytes = lame_get_lametag_frame(gfp, buffer, sizeof(buffer)); - if (nbytes > sizeof(buffer)) { - return -1; - } - - if (nbytes < 1) { - return 0; - } - - /* Put it all to disk again */ - if (fwrite(buffer, nbytes, 1, fpStream) != 1) { - return -1; - } - - return 0; /* success */ -} diff --git a/src/lib/dl/ext/lame/vbrtag.h b/src/lib/dl/ext/lame/vbrtag.h deleted file mode 100755 index 406af366..00000000 --- a/src/lib/dl/ext/lame/vbrtag.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 - -#ifndef lame_internal_flags_defined -#define lame_internal_flags_defined -struct lame_internal_flags; -typedef struct lame_internal_flags lame_internal_flags; -#endif - - -/*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 GetVbrTag(VBRTAGDATA * pTagData, const unsigned char *buf); - -int InitVbrTag(lame_global_flags * gfp); -int PutVbrTag(lame_global_flags const *gfp, FILE * fid); -void AddVbrFrame(lame_internal_flags * gfc); -void UpdateMusicCRC(uint16_t * crc, const unsigned char *buffer, int size); - -#endif diff --git a/src/lib/dl/ext/lame/vector/lame_intrin.h b/src/lib/dl/ext/lame/vector/lame_intrin.h deleted file mode 100755 index bc4c1899..00000000 --- a/src/lib/dl/ext/lame/vector/lame_intrin.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * lame_intrin.h include file - * - * Copyright (c) 2006 Gabriel Bouvigne - * - * 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_INTRIN_H -#define LAME_INTRIN_H - - -void -init_xrpow_core_sse(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum); - -void -fht_SSE2(FLOAT* , int); - -#endif diff --git a/src/lib/dl/ext/lame/vector/xmm_quantize_sub.c b/src/lib/dl/ext/lame/vector/xmm_quantize_sub.c deleted file mode 100755 index 1375aa22..00000000 --- a/src/lib/dl/ext/lame/vector/xmm_quantize_sub.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * MP3 quantization, intrinsics functions - * - * Copyright (c) 2005-2006 Gabriel Bouvigne - * - * 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. - */ - - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "lame.h" -#include "machine.h" -#include "encoder.h" -#include "util.h" -#include "lame_intrin.h" - - - -#ifdef HAVE_XMMINTRIN_H - -#include <xmmintrin.h> - -typedef union { - int32_t _i_32[4]; /* unions are initialized by its first member */ - float _float[4]; - __m128 _m128; -} vecfloat_union; - -#define TRI_SIZE (5-1) /* 1024 = 4**5 */ -static const FLOAT costab[TRI_SIZE * 2] = { - 9.238795325112867e-01, 3.826834323650898e-01, - 9.951847266721969e-01, 9.801714032956060e-02, - 9.996988186962042e-01, 2.454122852291229e-02, - 9.999811752826011e-01, 6.135884649154475e-03 -}; - - - -void -init_xrpow_core_sse(gr_info * const cod_info, FLOAT xrpow[576], int upper, FLOAT * sum) -{ - int i; - float tmp_max = 0; - float tmp_sum = 0; - int upper4 = (upper / 4) * 4; - int rest = upper-upper4; - - const vecfloat_union fabs_mask = {{ 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }}; - const __m128 vec_fabs_mask = _mm_loadu_ps(&fabs_mask._float[0]); - vecfloat_union vec_xrpow_max; - vecfloat_union vec_sum; - vecfloat_union vec_tmp; - - _mm_prefetch((char *) cod_info->xr, _MM_HINT_T0); - _mm_prefetch((char *) xrpow, _MM_HINT_T0); - - vec_xrpow_max._m128 = _mm_set_ps1(0); - vec_sum._m128 = _mm_set_ps1(0); - - for (i = 0; i < upper4; i += 4) { - vec_tmp._m128 = _mm_loadu_ps(&(cod_info->xr[i])); /* load */ - vec_tmp._m128 = _mm_and_ps(vec_tmp._m128, vec_fabs_mask); /* fabs */ - vec_sum._m128 = _mm_add_ps(vec_sum._m128, vec_tmp._m128); - vec_tmp._m128 = _mm_sqrt_ps(_mm_mul_ps(vec_tmp._m128, _mm_sqrt_ps(vec_tmp._m128))); - vec_xrpow_max._m128 = _mm_max_ps(vec_xrpow_max._m128, vec_tmp._m128); /* retrieve max */ - _mm_storeu_ps(&(xrpow[i]), vec_tmp._m128); /* store into xrpow[] */ - } - vec_tmp._m128 = _mm_set_ps1(0); - switch (rest) { - case 3: vec_tmp._float[2] = cod_info->xr[upper4+2]; - case 2: vec_tmp._float[1] = cod_info->xr[upper4+1]; - case 1: vec_tmp._float[0] = cod_info->xr[upper4+0]; - vec_tmp._m128 = _mm_and_ps(vec_tmp._m128, vec_fabs_mask); /* fabs */ - vec_sum._m128 = _mm_add_ps(vec_sum._m128, vec_tmp._m128); - vec_tmp._m128 = _mm_sqrt_ps(_mm_mul_ps(vec_tmp._m128, _mm_sqrt_ps(vec_tmp._m128))); - vec_xrpow_max._m128 = _mm_max_ps(vec_xrpow_max._m128, vec_tmp._m128); /* retrieve max */ - switch (rest) { - case 3: xrpow[upper4+2] = vec_tmp._float[2]; - case 2: xrpow[upper4+1] = vec_tmp._float[1]; - case 1: xrpow[upper4+0] = vec_tmp._float[0]; - default: - break; - } - default: - break; - } - tmp_sum = vec_sum._float[0] + vec_sum._float[1] + vec_sum._float[2] + vec_sum._float[3]; - { - float ma = vec_xrpow_max._float[0] > vec_xrpow_max._float[1] - ? vec_xrpow_max._float[0] : vec_xrpow_max._float[1]; - float mb = vec_xrpow_max._float[2] > vec_xrpow_max._float[3] - ? vec_xrpow_max._float[2] : vec_xrpow_max._float[3]; - tmp_max = ma > mb ? ma : mb; - } - cod_info->xrpow_max = tmp_max; - *sum = tmp_sum; -} - - -static void store4(__m128 v, float* f0, float* f1, float* f2, float* f3) -{ - vecfloat_union r; - r._m128 = v; - *f0 = r._float[0]; - *f1 = r._float[1]; - *f2 = r._float[2]; - *f3 = r._float[3]; -} - - -void -fht_SSE2(FLOAT * fz, int n) -{ - const FLOAT *tri = costab; - int k4; - FLOAT *fi, *gi; - FLOAT const *fn; - - n <<= 1; /* to get BLKSIZE, because of 3DNow! ASM routine */ - fn = fz + n; - k4 = 4; - do { - FLOAT s1, c1; - int i, k1, k2, k3, kx; - kx = k4 >> 1; - k1 = k4; - k2 = k4 << 1; - k3 = k2 + k1; - k4 = k2 << 1; - fi = fz; - gi = fi + kx; - do { - FLOAT f0, f1, f2, f3; - f1 = fi[0] - fi[k1]; - f0 = fi[0] + fi[k1]; - f3 = fi[k2] - fi[k3]; - f2 = fi[k2] + fi[k3]; - fi[k2] = f0 - f2; - fi[0] = f0 + f2; - fi[k3] = f1 - f3; - fi[k1] = f1 + f3; - f1 = gi[0] - gi[k1]; - f0 = gi[0] + gi[k1]; - f3 = SQRT2 * gi[k3]; - f2 = SQRT2 * gi[k2]; - gi[k2] = f0 - f2; - gi[0] = f0 + f2; - gi[k3] = f1 - f3; - gi[k1] = f1 + f3; - gi += k4; - fi += k4; - } while (fi < fn); - c1 = tri[0]; - s1 = tri[1]; - for (i = 1; i < kx; i++) { - __m128 v_s2; - __m128 v_c2; - __m128 v_c1; - __m128 v_s1; - FLOAT c2, s2, s1_2 = s1+s1; - c2 = 1 - s1_2 * s1; - s2 = s1_2 * c1; - fi = fz + i; - gi = fz + k1 - i; - v_c1 = _mm_set_ps1(c1); - v_s1 = _mm_set_ps1(s1); - v_c2 = _mm_set_ps1(c2); - v_s2 = _mm_set_ps1(s2); - { - static const vecfloat_union sign_mask = {{0x80000000,0,0,0}}; - v_c1 = _mm_xor_ps(sign_mask._m128, v_c1); /* v_c1 := {-c1, +c1, +c1, +c1} */ - } - { - static const vecfloat_union sign_mask = {{0,0x80000000,0,0}}; - v_s1 = _mm_xor_ps(sign_mask._m128, v_s1); /* v_s1 := {+s1, -s1, +s1, +s1} */ - } - { - static const vecfloat_union sign_mask = {{0,0,0x80000000,0x80000000}}; - v_c2 = _mm_xor_ps(sign_mask._m128, v_c2); /* v_c2 := {+c2, +c2, -c2, -c2} */ - } - do { - __m128 p, q, r; - - q = _mm_setr_ps(fi[k1], fi[k3], gi[k1], gi[k3]); /* Q := {fi_k1,fi_k3,gi_k1,gi_k3}*/ - p = _mm_mul_ps(_mm_set_ps1(s2), q); /* P := s2 * Q */ - q = _mm_mul_ps(v_c2, q); /* Q := c2 * Q */ - q = _mm_shuffle_ps(q, q, _MM_SHUFFLE(1,0,3,2)); /* Q := {-c2*gi_k1,-c2*gi_k3,c2*fi_k1,c2*fi_k3} */ - p = _mm_add_ps(p, q); - - r = _mm_setr_ps(gi[0], gi[k2], fi[0], fi[k2]); /* R := {gi_0,gi_k2,fi_0,fi_k2} */ - q = _mm_sub_ps(r, p); /* Q := {gi_0-p0,gi_k2-p1,fi_0-p2,fi_k2-p3} */ - r = _mm_add_ps(r, p); /* R := {gi_0+p0,gi_k2+p1,fi_0+p2,fi_k2+p3} */ - p = _mm_shuffle_ps(q, r, _MM_SHUFFLE(2,0,2,0)); /* P := {q0,q2,r0,r2} */ - p = _mm_shuffle_ps(p, p, _MM_SHUFFLE(3,1,2,0)); /* P := {q0,r0,q2,r2} */ - q = _mm_shuffle_ps(q, r, _MM_SHUFFLE(3,1,3,1)); /* Q := {q1,q3,r1,r3} */ - r = _mm_mul_ps(v_c1, q); - q = _mm_mul_ps(v_s1, q); - q = _mm_shuffle_ps(q, q, _MM_SHUFFLE(0,1,2,3)); /* Q := {q3,q2,q1,q0} */ - q = _mm_add_ps(q, r); - - store4(_mm_sub_ps(p, q), &gi[k3], &gi[k2], &fi[k3], &fi[k2]); - store4(_mm_add_ps(p, q), &gi[k1], &gi[ 0], &fi[k1], &fi[ 0]); - - gi += k4; - fi += k4; - } while (fi < fn); - c2 = c1; - c1 = c2 * tri[0] - s1 * tri[1]; - s1 = c2 * tri[1] + s1 * tri[0]; - } - tri += 2; - } while (k4 < n); -} - -#endif /* HAVE_XMMINTRIN_H */ - diff --git a/src/lib/dl/ext/lame/version.c b/src/lib/dl/ext/lame/version.c deleted file mode 100755 index 82058125..00000000 --- a/src/lib/dl/ext/lame/version.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Version numbering 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. - */ - -/*! - \file version.c - \brief Version numbering for LAME. - - Contains functions which describe the version of LAME. - - \author A.L. Faber - \version \$Id: version.c,v 1.32.2.2 2011/11/18 09:18:28 robert Exp $ - \ingroup libmp3lame -*/ - - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - - -#include "lame.h" -#include "machine.h" - -#include "version.h" /* macros of version numbers */ - - - - - -/*! Get the LAME version string. */ -/*! - \param void - \return a pointer to a string which describes the version of LAME. -*/ -const char * -get_lame_version(void) -{ /* primary to write screen reports */ - /* Here we can also add informations about compile time configurations */ - -#if LAME_ALPHA_VERSION - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " " - "(alpha " STR(LAME_PATCH_VERSION) ", " __DATE__ " " __TIME__ ")"; -#elif LAME_BETA_VERSION - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " " - "(beta " STR(LAME_PATCH_VERSION) ", " __DATE__ ")"; -#elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0) - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION); -#else - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION); -#endif - - return str; -} - - -/*! Get the short LAME version string. */ -/*! - It's mainly for inclusion into the MP3 stream. - - \param void - \return a pointer to the short version of the LAME version string. -*/ -const char * -get_lame_short_version(void) -{ - /* adding date and time to version string makes it harder for output - validation */ - -#if LAME_ALPHA_VERSION - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (alpha " STR(LAME_PATCH_VERSION) ")"; -#elif LAME_BETA_VERSION - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) " (beta " STR(LAME_PATCH_VERSION) ")"; -#elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0) - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) "." STR(LAME_PATCH_VERSION); -#else - static /*@observer@ */ const char *const str = - STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION); -#endif - - return str; -} - -/*! Get the _very_ short LAME version string. */ -/*! - It's used in the LAME VBR tag only. - - \param void - \return a pointer to the short version of the LAME version string. -*/ -const char * -get_lame_very_short_version(void) -{ - /* adding date and time to version string makes it harder for output - validation */ -#if LAME_ALPHA_VERSION -#define P "a" -#elif LAME_BETA_VERSION -#define P "b" -#elif LAME_RELEASE_VERSION && (LAME_PATCH_VERSION > 0) -#define P "r" -#else -#define P "" -#endif - static /*@observer@ */ const char *const str = -#if (LAME_PATCH_VERSION > 0) - "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P STR(LAME_PATCH_VERSION) -#else - "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P -#endif - ; - return str; -} - -/*! Get the _very_ short LAME version string. */ -/*! - It's used in the LAME VBR tag only, limited to 9 characters max. - Due to some 3rd party HW/SW decoders, it has to start with LAME. - - \param void - \return a pointer to the short version of the LAME version string. - */ -const char* -get_lame_tag_encoder_short_version(void) -{ - static /*@observer@ */ const char *const str = - /* FIXME: new scheme / new version counting / drop versioning here ? */ - "LAME" STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) P - ; - return str; -} - -/*! Get the version string for GPSYCHO. */ -/*! - \param void - \return a pointer to a string which describes the version of GPSYCHO. -*/ -const char * -get_psy_version(void) -{ -#if PSY_ALPHA_VERSION > 0 - static /*@observer@ */ const char *const str = - STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION) - " (alpha " STR(PSY_ALPHA_VERSION) ", " __DATE__ " " __TIME__ ")"; -#elif PSY_BETA_VERSION > 0 - static /*@observer@ */ const char *const str = - STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION) - " (beta " STR(PSY_BETA_VERSION) ", " __DATE__ ")"; -#else - static /*@observer@ */ const char *const str = - STR(PSY_MAJOR_VERSION) "." STR(PSY_MINOR_VERSION); -#endif - - return str; -} - - -/*! Get the URL for the LAME website. */ -/*! - \param void - \return a pointer to a string which is a URL for the LAME website. -*/ -const char * -get_lame_url(void) -{ - static /*@observer@ */ const char *const str = LAME_URL; - - return str; -} - - -/*! Get the numerical representation of the version. */ -/*! - Writes the numerical representation of the version of LAME and - GPSYCHO into lvp. - - \param lvp -*/ -void -get_lame_version_numerical(lame_version_t * lvp) -{ - static /*@observer@ */ const char *const features = ""; /* obsolete */ - - /* generic version */ - lvp->major = LAME_MAJOR_VERSION; - lvp->minor = LAME_MINOR_VERSION; -#if LAME_ALPHA_VERSION - lvp->alpha = LAME_PATCH_VERSION; - lvp->beta = 0; -#elif LAME_BETA_VERSION - lvp->alpha = 0; - lvp->beta = LAME_PATCH_VERSION; -#else - lvp->alpha = 0; - lvp->beta = 0; -#endif - - /* psy version */ - lvp->psy_major = PSY_MAJOR_VERSION; - lvp->psy_minor = PSY_MINOR_VERSION; - lvp->psy_alpha = PSY_ALPHA_VERSION; - lvp->psy_beta = PSY_BETA_VERSION; - - /* compile time features */ - /*@-mustfree@ */ - lvp->features = features; - /*@=mustfree@ */ -} - - -const char * -get_lame_os_bitness(void) -{ - static /*@observer@ */ const char *const strXX = ""; - static /*@observer@ */ const char *const str32 = "32bits"; - static /*@observer@ */ const char *const str64 = "64bits"; - - switch (sizeof(void *)) { - case 4: - return str32; - - case 8: - return str64; - - default: - return strXX; - } -} - -/* end of version.c */ diff --git a/src/lib/dl/ext/lame/version.h b/src/lib/dl/ext/lame/version.h deleted file mode 100755 index 45d80af9..00000000 --- a/src/lib/dl/ext/lame/version.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Version numbering 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_VERSION_H -#define LAME_VERSION_H - - -/* - * To make a string from a token, use the # operator: - */ -#ifndef STR -# define __STR(x) #x -# define STR(x) __STR(x) -#endif - -# define LAME_URL "http://lame.sf.net" - - -# define LAME_MAJOR_VERSION 3 /* Major version number */ -# define LAME_MINOR_VERSION 99 /* Minor version number */ -# define LAME_TYPE_VERSION 2 /* 0:alpha 1:beta 2:release */ -# define LAME_PATCH_VERSION 3 /* Patch level */ -# define LAME_ALPHA_VERSION (LAME_TYPE_VERSION==0) -# define LAME_BETA_VERSION (LAME_TYPE_VERSION==1) -# define LAME_RELEASE_VERSION (LAME_TYPE_VERSION==2) - -# define PSY_MAJOR_VERSION 1 /* Major version number */ -# define PSY_MINOR_VERSION 0 /* Minor version number */ -# define PSY_ALPHA_VERSION 0 /* Set number if this is an alpha version, otherwise zero */ -# define PSY_BETA_VERSION 0 /* Set number if this is a beta version, otherwise zero */ - -#if LAME_ALPHA_VERSION -#define LAME_PATCH_LEVEL_STRING " alpha " STR(LAME_PATCH_VERSION) -#endif -#if LAME_BETA_VERSION -#define LAME_PATCH_LEVEL_STRING " beta " STR(LAME_PATCH_VERSION) -#endif -#if LAME_RELEASE_VERSION -#if LAME_PATCH_VERSION -#define LAME_PATCH_LEVEL_STRING " release " STR(LAME_PATCH_VERSION) -#else -#define LAME_PATCH_LEVEL_STRING "" -#endif -#endif - -# define LAME_VERSION_STRING STR(LAME_MAJOR_VERSION) "." STR(LAME_MINOR_VERSION) LAME_PATCH_LEVEL_STRING - -#endif /* LAME_VERSION_H */ - -/* End of version.h */ diff --git a/src/lib/dl/ext/libmad/CLEAN.BAT b/src/lib/dl/ext/libmad/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/libmad/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/libmad/MAKE.BAT b/src/lib/dl/ext/libmad/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/libmad/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/libmad/bit.c b/src/lib/dl/ext/libmad/bit.c deleted file mode 100755 index c2bfb243..00000000 --- a/src/lib/dl/ext/libmad/bit.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: bit.c,v 1.12 2004/01/23 09:41:32 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# ifdef HAVE_LIMITS_H -# include <limits.h> -# else -# define CHAR_BIT 8 -# endif - -# include "bit.h" - -/* - * This is the lookup table for computing the CRC-check word. - * As described in section 2.4.3.1 and depicted in Figure A.9 - * of ISO/IEC 11172-3, the generator polynomial is: - * - * G(X) = X^16 + X^15 + X^2 + 1 - */ -static -unsigned short const crc_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 -}; - -# define CRC_POLY 0x8005 - -/* - * NAME: bit->init() - * DESCRIPTION: initialize bit pointer struct - */ -void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte) -{ - bitptr->byte = byte; - bitptr->cache = 0; - bitptr->left = CHAR_BIT; -} - -/* - * NAME: bit->length() - * DESCRIPTION: return number of bits between start and end points - */ -unsigned int mad_bit_length(struct mad_bitptr const *begin, - struct mad_bitptr const *end) -{ - return begin->left + - CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left); -} - -/* - * NAME: bit->nextbyte() - * DESCRIPTION: return pointer to next unprocessed byte - */ -unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr) -{ - return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1; -} - -/* - * NAME: bit->skip() - * DESCRIPTION: advance bit pointer - */ -void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len) -{ - bitptr->byte += len / CHAR_BIT; - bitptr->left -= len % CHAR_BIT; - - if (bitptr->left > CHAR_BIT) { - bitptr->byte++; - bitptr->left += CHAR_BIT; - } - - if (bitptr->left < CHAR_BIT) - bitptr->cache = *bitptr->byte; -} - -/* - * NAME: bit->read() - * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value - */ -unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len) -{ - register unsigned long value; - - if (bitptr->left == CHAR_BIT) - bitptr->cache = *bitptr->byte; - - if (len < bitptr->left) { - value = (bitptr->cache & ((1 << bitptr->left) - 1)) >> - (bitptr->left - len); - bitptr->left -= len; - - return value; - } - - /* remaining bits in current byte */ - - value = bitptr->cache & ((1 << bitptr->left) - 1); - len -= bitptr->left; - - bitptr->byte++; - bitptr->left = CHAR_BIT; - - /* more bytes */ - - while (len >= CHAR_BIT) { - value = (value << CHAR_BIT) | *bitptr->byte++; - len -= CHAR_BIT; - } - - if (len > 0) { - bitptr->cache = *bitptr->byte; - - value = (value << len) | (bitptr->cache >> (CHAR_BIT - len)); - bitptr->left -= len; - } - - return value; -} - -# if 0 -/* - * NAME: bit->write() - * DESCRIPTION: write an arbitrary number of bits - */ -void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len, - unsigned long value) -{ - unsigned char *ptr; - - ptr = (unsigned char *) bitptr->byte; - - /* ... */ -} -# endif - -/* - * NAME: bit->crc() - * DESCRIPTION: compute CRC-check word - */ -unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len, - unsigned short init) -{ - register unsigned int crc; - - for (crc = init; len >= 32; len -= 32) { - register unsigned long data; - - data = mad_bit_read(&bitptr, 32); - - crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff]; - crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff]; - crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff]; - crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff]; - } - - switch (len / 8) { - case 3: crc = (crc << 8) ^ - crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; - case 2: crc = (crc << 8) ^ - crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; - case 1: crc = (crc << 8) ^ - crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff]; - - len %= 8; - - case 0: break; - } - - while (len--) { - register unsigned int msb; - - msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15); - - crc <<= 1; - if (msb & 1) - crc ^= CRC_POLY; - } - - return crc & 0xffff; -} diff --git a/src/lib/dl/ext/libmad/bit.h b/src/lib/dl/ext/libmad/bit.h deleted file mode 100755 index 5a51570b..00000000 --- a/src/lib/dl/ext/libmad/bit.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp $ - */ - -# ifndef LIBMAD_BIT_H -# define LIBMAD_BIT_H - -struct mad_bitptr { - unsigned char const *byte; - unsigned short cache; - unsigned short left; -}; - -void mad_bit_init(struct mad_bitptr *, unsigned char const *); - -# define mad_bit_finish(bitptr) /* nothing */ - -unsigned int mad_bit_length(struct mad_bitptr const *, - struct mad_bitptr const *); - -# define mad_bit_bitsleft(bitptr) ((bitptr)->left) -unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); - -void mad_bit_skip(struct mad_bitptr *, unsigned int); -unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); -void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); - -unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); - -# endif diff --git a/src/lib/dl/ext/libmad/common.mak b/src/lib/dl/ext/libmad/common.mak deleted file mode 100755 index 6d2d144f..00000000 --- a/src/lib/dl/ext/libmad/common.mak +++ /dev/null @@ -1,34 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_LIBMAD_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)bit.obj $(SUBDIR)$(HPS)decoder.obj $(SUBDIR)$(HPS)fixed.obj $(SUBDIR)$(HPS)frame.obj $(SUBDIR)$(HPS)huffman.obj $(SUBDIR)$(HPS)layer12.obj $(SUBDIR)$(HPS)layer3.obj $(SUBDIR)$(HPS)stream.obj $(SUBDIR)$(HPS)synth.obj $(SUBDIR)$(HPS)timer.obj $(SUBDIR)$(HPS)version.obj - -!ifdef EXT_LIBMAD_LIB -$(EXT_LIBMAD_LIB): $(OBJS) - wlib -q -b -c $(EXT_LIBMAD_LIB) -+$(SUBDIR)$(HPS)bit.obj -+$(SUBDIR)$(HPS)decoder.obj - wlib -q -b -c $(EXT_LIBMAD_LIB) -+$(SUBDIR)$(HPS)fixed.obj -+$(SUBDIR)$(HPS)frame.obj - wlib -q -b -c $(EXT_LIBMAD_LIB) -+$(SUBDIR)$(HPS)huffman.obj -+$(SUBDIR)$(HPS)layer12.obj - wlib -q -b -c $(EXT_LIBMAD_LIB) -+$(SUBDIR)$(HPS)layer3.obj -+$(SUBDIR)$(HPS)stream.obj - wlib -q -b -c $(EXT_LIBMAD_LIB) -+$(SUBDIR)$(HPS)synth.obj -+$(SUBDIR)$(HPS)timer.obj - wlib -q -b -c $(EXT_LIBMAD_LIB) -+$(SUBDIR)$(HPS)version.obj -!endif - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_LIBMAD_LIB) .symbolic - -exe: .symbolic - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/libmad/config.h b/src/lib/dl/ext/libmad/config.h deleted file mode 100755 index 6eca0969..00000000 --- a/src/lib/dl/ext/libmad/config.h +++ /dev/null @@ -1,138 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to enable diagnostic debugging support. */ -#undef DEBUG - -/* Define to enable experimental code. */ -#undef EXPERIMENTAL - -/* Define to 1 if you have the <assert.h> header file. */ -#undef HAVE_ASSERT_H - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the <errno.h> header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the `fcntl' function. */ -#undef HAVE_FCNTL - -/* Define to 1 if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - -/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */ -#undef HAVE_MADD16_ASM - -/* Define if your MIPS CPU supports a 2-operand MADD instruction. */ -#undef HAVE_MADD_ASM - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `pipe' function. */ -#undef HAVE_PIPE - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `waitpid' function. */ -#undef HAVE_WAITPID - -/* Define to disable debugging assertions. */ -#define NDEBUG 1 - -/* Define to optimize for accuracy over speed. */ -#undef OPT_ACCURACY - -/* Define to optimize for speed over accuracy. */ -#define OPT_SPEED 1 - -/* Define to enable a fast subband synthesis approximation optimization. */ -#undef OPT_SSO - -/* Define to influence a strict interpretation of the ISO/IEC standards, even - if this is in opposition with best accepted practices. */ -#undef OPT_STRICT - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* The size of a `int', as computed by sizeof. */ -#undef SIZEOF_INT - -/* The size of a `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* The size of a `long long', as computed by sizeof. */ -#undef SIZEOF_LONG_LONG - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* 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 `int' if <sys/types.h> does not define. */ -#undef pid_t - -#define FPM_DEFAULT 1 - diff --git a/src/lib/dl/ext/libmad/d.dat b/src/lib/dl/ext/libmad/d.dat deleted file mode 100755 index 4a7fa4fa..00000000 --- a/src/lib/dl/ext/libmad/d.dat +++ /dev/null @@ -1,607 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: D.dat,v 1.9 2004/01/23 09:41:32 rob Exp $ - */ - -/* - * These are the coefficients for the subband synthesis window. This is a - * reordered version of Table B.3 from ISO/IEC 11172-3. - * - * Every value is parameterized so that shift optimizations can be made at - * compile-time. For example, every value can be right-shifted 12 bits to - * minimize multiply instruction times without any loss of accuracy. - */ - - { PRESHIFT(0x00000000) /* 0.000000000 */, /* 0 */ - -PRESHIFT(0x0001d000) /* -0.000442505 */, - PRESHIFT(0x000d5000) /* 0.003250122 */, - -PRESHIFT(0x001cb000) /* -0.007003784 */, - PRESHIFT(0x007f5000) /* 0.031082153 */, - -PRESHIFT(0x01421000) /* -0.078628540 */, - PRESHIFT(0x019ae000) /* 0.100311279 */, - -PRESHIFT(0x09271000) /* -0.572036743 */, - PRESHIFT(0x1251e000) /* 1.144989014 */, - PRESHIFT(0x09271000) /* 0.572036743 */, - PRESHIFT(0x019ae000) /* 0.100311279 */, - PRESHIFT(0x01421000) /* 0.078628540 */, - PRESHIFT(0x007f5000) /* 0.031082153 */, - PRESHIFT(0x001cb000) /* 0.007003784 */, - PRESHIFT(0x000d5000) /* 0.003250122 */, - PRESHIFT(0x0001d000) /* 0.000442505 */, - - PRESHIFT(0x00000000) /* 0.000000000 */, - -PRESHIFT(0x0001d000) /* -0.000442505 */, - PRESHIFT(0x000d5000) /* 0.003250122 */, - -PRESHIFT(0x001cb000) /* -0.007003784 */, - PRESHIFT(0x007f5000) /* 0.031082153 */, - -PRESHIFT(0x01421000) /* -0.078628540 */, - PRESHIFT(0x019ae000) /* 0.100311279 */, - -PRESHIFT(0x09271000) /* -0.572036743 */, - PRESHIFT(0x1251e000) /* 1.144989014 */, - PRESHIFT(0x09271000) /* 0.572036743 */, - PRESHIFT(0x019ae000) /* 0.100311279 */, - PRESHIFT(0x01421000) /* 0.078628540 */, - PRESHIFT(0x007f5000) /* 0.031082153 */, - PRESHIFT(0x001cb000) /* 0.007003784 */, - PRESHIFT(0x000d5000) /* 0.003250122 */, - PRESHIFT(0x0001d000) /* 0.000442505 */ }, - - { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 1 */ - -PRESHIFT(0x0001f000) /* -0.000473022 */, - PRESHIFT(0x000da000) /* 0.003326416 */, - -PRESHIFT(0x00207000) /* -0.007919312 */, - PRESHIFT(0x007d0000) /* 0.030517578 */, - -PRESHIFT(0x0158d000) /* -0.084182739 */, - PRESHIFT(0x01747000) /* 0.090927124 */, - -PRESHIFT(0x099a8000) /* -0.600219727 */, - PRESHIFT(0x124f0000) /* 1.144287109 */, - PRESHIFT(0x08b38000) /* 0.543823242 */, - PRESHIFT(0x01bde000) /* 0.108856201 */, - PRESHIFT(0x012b4000) /* 0.073059082 */, - PRESHIFT(0x0080f000) /* 0.031478882 */, - PRESHIFT(0x00191000) /* 0.006118774 */, - PRESHIFT(0x000d0000) /* 0.003173828 */, - PRESHIFT(0x0001a000) /* 0.000396729 */, - - -PRESHIFT(0x00001000) /* -0.000015259 */, - -PRESHIFT(0x0001f000) /* -0.000473022 */, - PRESHIFT(0x000da000) /* 0.003326416 */, - -PRESHIFT(0x00207000) /* -0.007919312 */, - PRESHIFT(0x007d0000) /* 0.030517578 */, - -PRESHIFT(0x0158d000) /* -0.084182739 */, - PRESHIFT(0x01747000) /* 0.090927124 */, - -PRESHIFT(0x099a8000) /* -0.600219727 */, - PRESHIFT(0x124f0000) /* 1.144287109 */, - PRESHIFT(0x08b38000) /* 0.543823242 */, - PRESHIFT(0x01bde000) /* 0.108856201 */, - PRESHIFT(0x012b4000) /* 0.073059082 */, - PRESHIFT(0x0080f000) /* 0.031478882 */, - PRESHIFT(0x00191000) /* 0.006118774 */, - PRESHIFT(0x000d0000) /* 0.003173828 */, - PRESHIFT(0x0001a000) /* 0.000396729 */ }, - - { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 2 */ - -PRESHIFT(0x00023000) /* -0.000534058 */, - PRESHIFT(0x000de000) /* 0.003387451 */, - -PRESHIFT(0x00245000) /* -0.008865356 */, - PRESHIFT(0x007a0000) /* 0.029785156 */, - -PRESHIFT(0x016f7000) /* -0.089706421 */, - PRESHIFT(0x014a8000) /* 0.080688477 */, - -PRESHIFT(0x0a0d8000) /* -0.628295898 */, - PRESHIFT(0x12468000) /* 1.142211914 */, - PRESHIFT(0x083ff000) /* 0.515609741 */, - PRESHIFT(0x01dd8000) /* 0.116577148 */, - PRESHIFT(0x01149000) /* 0.067520142 */, - PRESHIFT(0x00820000) /* 0.031738281 */, - PRESHIFT(0x0015b000) /* 0.005294800 */, - PRESHIFT(0x000ca000) /* 0.003082275 */, - PRESHIFT(0x00018000) /* 0.000366211 */, - - -PRESHIFT(0x00001000) /* -0.000015259 */, - -PRESHIFT(0x00023000) /* -0.000534058 */, - PRESHIFT(0x000de000) /* 0.003387451 */, - -PRESHIFT(0x00245000) /* -0.008865356 */, - PRESHIFT(0x007a0000) /* 0.029785156 */, - -PRESHIFT(0x016f7000) /* -0.089706421 */, - PRESHIFT(0x014a8000) /* 0.080688477 */, - -PRESHIFT(0x0a0d8000) /* -0.628295898 */, - PRESHIFT(0x12468000) /* 1.142211914 */, - PRESHIFT(0x083ff000) /* 0.515609741 */, - PRESHIFT(0x01dd8000) /* 0.116577148 */, - PRESHIFT(0x01149000) /* 0.067520142 */, - PRESHIFT(0x00820000) /* 0.031738281 */, - PRESHIFT(0x0015b000) /* 0.005294800 */, - PRESHIFT(0x000ca000) /* 0.003082275 */, - PRESHIFT(0x00018000) /* 0.000366211 */ }, - - { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 3 */ - -PRESHIFT(0x00026000) /* -0.000579834 */, - PRESHIFT(0x000e1000) /* 0.003433228 */, - -PRESHIFT(0x00285000) /* -0.009841919 */, - PRESHIFT(0x00765000) /* 0.028884888 */, - -PRESHIFT(0x0185d000) /* -0.095169067 */, - PRESHIFT(0x011d1000) /* 0.069595337 */, - -PRESHIFT(0x0a7fe000) /* -0.656219482 */, - PRESHIFT(0x12386000) /* 1.138763428 */, - PRESHIFT(0x07ccb000) /* 0.487472534 */, - PRESHIFT(0x01f9c000) /* 0.123474121 */, - PRESHIFT(0x00fdf000) /* 0.061996460 */, - PRESHIFT(0x00827000) /* 0.031845093 */, - PRESHIFT(0x00126000) /* 0.004486084 */, - PRESHIFT(0x000c4000) /* 0.002990723 */, - PRESHIFT(0x00015000) /* 0.000320435 */, - - -PRESHIFT(0x00001000) /* -0.000015259 */, - -PRESHIFT(0x00026000) /* -0.000579834 */, - PRESHIFT(0x000e1000) /* 0.003433228 */, - -PRESHIFT(0x00285000) /* -0.009841919 */, - PRESHIFT(0x00765000) /* 0.028884888 */, - -PRESHIFT(0x0185d000) /* -0.095169067 */, - PRESHIFT(0x011d1000) /* 0.069595337 */, - -PRESHIFT(0x0a7fe000) /* -0.656219482 */, - PRESHIFT(0x12386000) /* 1.138763428 */, - PRESHIFT(0x07ccb000) /* 0.487472534 */, - PRESHIFT(0x01f9c000) /* 0.123474121 */, - PRESHIFT(0x00fdf000) /* 0.061996460 */, - PRESHIFT(0x00827000) /* 0.031845093 */, - PRESHIFT(0x00126000) /* 0.004486084 */, - PRESHIFT(0x000c4000) /* 0.002990723 */, - PRESHIFT(0x00015000) /* 0.000320435 */ }, - - { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 4 */ - -PRESHIFT(0x00029000) /* -0.000625610 */, - PRESHIFT(0x000e3000) /* 0.003463745 */, - -PRESHIFT(0x002c7000) /* -0.010848999 */, - PRESHIFT(0x0071e000) /* 0.027801514 */, - -PRESHIFT(0x019bd000) /* -0.100540161 */, - PRESHIFT(0x00ec0000) /* 0.057617187 */, - -PRESHIFT(0x0af15000) /* -0.683914185 */, - PRESHIFT(0x12249000) /* 1.133926392 */, - PRESHIFT(0x075a0000) /* 0.459472656 */, - PRESHIFT(0x0212c000) /* 0.129577637 */, - PRESHIFT(0x00e79000) /* 0.056533813 */, - PRESHIFT(0x00825000) /* 0.031814575 */, - PRESHIFT(0x000f4000) /* 0.003723145 */, - PRESHIFT(0x000be000) /* 0.002899170 */, - PRESHIFT(0x00013000) /* 0.000289917 */, - - -PRESHIFT(0x00001000) /* -0.000015259 */, - -PRESHIFT(0x00029000) /* -0.000625610 */, - PRESHIFT(0x000e3000) /* 0.003463745 */, - -PRESHIFT(0x002c7000) /* -0.010848999 */, - PRESHIFT(0x0071e000) /* 0.027801514 */, - -PRESHIFT(0x019bd000) /* -0.100540161 */, - PRESHIFT(0x00ec0000) /* 0.057617187 */, - -PRESHIFT(0x0af15000) /* -0.683914185 */, - PRESHIFT(0x12249000) /* 1.133926392 */, - PRESHIFT(0x075a0000) /* 0.459472656 */, - PRESHIFT(0x0212c000) /* 0.129577637 */, - PRESHIFT(0x00e79000) /* 0.056533813 */, - PRESHIFT(0x00825000) /* 0.031814575 */, - PRESHIFT(0x000f4000) /* 0.003723145 */, - PRESHIFT(0x000be000) /* 0.002899170 */, - PRESHIFT(0x00013000) /* 0.000289917 */ }, - - { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 5 */ - -PRESHIFT(0x0002d000) /* -0.000686646 */, - PRESHIFT(0x000e4000) /* 0.003479004 */, - -PRESHIFT(0x0030b000) /* -0.011886597 */, - PRESHIFT(0x006cb000) /* 0.026535034 */, - -PRESHIFT(0x01b17000) /* -0.105819702 */, - PRESHIFT(0x00b77000) /* 0.044784546 */, - -PRESHIFT(0x0b619000) /* -0.711318970 */, - PRESHIFT(0x120b4000) /* 1.127746582 */, - PRESHIFT(0x06e81000) /* 0.431655884 */, - PRESHIFT(0x02288000) /* 0.134887695 */, - PRESHIFT(0x00d17000) /* 0.051132202 */, - PRESHIFT(0x0081b000) /* 0.031661987 */, - PRESHIFT(0x000c5000) /* 0.003005981 */, - PRESHIFT(0x000b7000) /* 0.002792358 */, - PRESHIFT(0x00011000) /* 0.000259399 */, - - -PRESHIFT(0x00001000) /* -0.000015259 */, - -PRESHIFT(0x0002d000) /* -0.000686646 */, - PRESHIFT(0x000e4000) /* 0.003479004 */, - -PRESHIFT(0x0030b000) /* -0.011886597 */, - PRESHIFT(0x006cb000) /* 0.026535034 */, - -PRESHIFT(0x01b17000) /* -0.105819702 */, - PRESHIFT(0x00b77000) /* 0.044784546 */, - -PRESHIFT(0x0b619000) /* -0.711318970 */, - PRESHIFT(0x120b4000) /* 1.127746582 */, - PRESHIFT(0x06e81000) /* 0.431655884 */, - PRESHIFT(0x02288000) /* 0.134887695 */, - PRESHIFT(0x00d17000) /* 0.051132202 */, - PRESHIFT(0x0081b000) /* 0.031661987 */, - PRESHIFT(0x000c5000) /* 0.003005981 */, - PRESHIFT(0x000b7000) /* 0.002792358 */, - PRESHIFT(0x00011000) /* 0.000259399 */ }, - - { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 6 */ - -PRESHIFT(0x00031000) /* -0.000747681 */, - PRESHIFT(0x000e4000) /* 0.003479004 */, - -PRESHIFT(0x00350000) /* -0.012939453 */, - PRESHIFT(0x0066c000) /* 0.025085449 */, - -PRESHIFT(0x01c67000) /* -0.110946655 */, - PRESHIFT(0x007f5000) /* 0.031082153 */, - -PRESHIFT(0x0bd06000) /* -0.738372803 */, - PRESHIFT(0x11ec7000) /* 1.120223999 */, - PRESHIFT(0x06772000) /* 0.404083252 */, - PRESHIFT(0x023b3000) /* 0.139450073 */, - PRESHIFT(0x00bbc000) /* 0.045837402 */, - PRESHIFT(0x00809000) /* 0.031387329 */, - PRESHIFT(0x00099000) /* 0.002334595 */, - PRESHIFT(0x000b0000) /* 0.002685547 */, - PRESHIFT(0x00010000) /* 0.000244141 */, - - -PRESHIFT(0x00001000) /* -0.000015259 */, - -PRESHIFT(0x00031000) /* -0.000747681 */, - PRESHIFT(0x000e4000) /* 0.003479004 */, - -PRESHIFT(0x00350000) /* -0.012939453 */, - PRESHIFT(0x0066c000) /* 0.025085449 */, - -PRESHIFT(0x01c67000) /* -0.110946655 */, - PRESHIFT(0x007f5000) /* 0.031082153 */, - -PRESHIFT(0x0bd06000) /* -0.738372803 */, - PRESHIFT(0x11ec7000) /* 1.120223999 */, - PRESHIFT(0x06772000) /* 0.404083252 */, - PRESHIFT(0x023b3000) /* 0.139450073 */, - PRESHIFT(0x00bbc000) /* 0.045837402 */, - PRESHIFT(0x00809000) /* 0.031387329 */, - PRESHIFT(0x00099000) /* 0.002334595 */, - PRESHIFT(0x000b0000) /* 0.002685547 */, - PRESHIFT(0x00010000) /* 0.000244141 */ }, - - { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 7 */ - -PRESHIFT(0x00035000) /* -0.000808716 */, - PRESHIFT(0x000e3000) /* 0.003463745 */, - -PRESHIFT(0x00397000) /* -0.014022827 */, - PRESHIFT(0x005ff000) /* 0.023422241 */, - -PRESHIFT(0x01dad000) /* -0.115921021 */, - PRESHIFT(0x0043a000) /* 0.016510010 */, - -PRESHIFT(0x0c3d9000) /* -0.765029907 */, - PRESHIFT(0x11c83000) /* 1.111373901 */, - PRESHIFT(0x06076000) /* 0.376800537 */, - PRESHIFT(0x024ad000) /* 0.143264771 */, - PRESHIFT(0x00a67000) /* 0.040634155 */, - PRESHIFT(0x007f0000) /* 0.031005859 */, - PRESHIFT(0x0006f000) /* 0.001693726 */, - PRESHIFT(0x000a9000) /* 0.002578735 */, - PRESHIFT(0x0000e000) /* 0.000213623 */, - - -PRESHIFT(0x00002000) /* -0.000030518 */, - -PRESHIFT(0x00035000) /* -0.000808716 */, - PRESHIFT(0x000e3000) /* 0.003463745 */, - -PRESHIFT(0x00397000) /* -0.014022827 */, - PRESHIFT(0x005ff000) /* 0.023422241 */, - -PRESHIFT(0x01dad000) /* -0.115921021 */, - PRESHIFT(0x0043a000) /* 0.016510010 */, - -PRESHIFT(0x0c3d9000) /* -0.765029907 */, - PRESHIFT(0x11c83000) /* 1.111373901 */, - PRESHIFT(0x06076000) /* 0.376800537 */, - PRESHIFT(0x024ad000) /* 0.143264771 */, - PRESHIFT(0x00a67000) /* 0.040634155 */, - PRESHIFT(0x007f0000) /* 0.031005859 */, - PRESHIFT(0x0006f000) /* 0.001693726 */, - PRESHIFT(0x000a9000) /* 0.002578735 */, - PRESHIFT(0x0000e000) /* 0.000213623 */ }, - - { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 8 */ - -PRESHIFT(0x0003a000) /* -0.000885010 */, - PRESHIFT(0x000e0000) /* 0.003417969 */, - -PRESHIFT(0x003df000) /* -0.015121460 */, - PRESHIFT(0x00586000) /* 0.021575928 */, - -PRESHIFT(0x01ee6000) /* -0.120697021 */, - PRESHIFT(0x00046000) /* 0.001068115 */, - -PRESHIFT(0x0ca8d000) /* -0.791213989 */, - PRESHIFT(0x119e9000) /* 1.101211548 */, - PRESHIFT(0x05991000) /* 0.349868774 */, - PRESHIFT(0x02578000) /* 0.146362305 */, - PRESHIFT(0x0091a000) /* 0.035552979 */, - PRESHIFT(0x007d1000) /* 0.030532837 */, - PRESHIFT(0x00048000) /* 0.001098633 */, - PRESHIFT(0x000a1000) /* 0.002456665 */, - PRESHIFT(0x0000d000) /* 0.000198364 */, - - -PRESHIFT(0x00002000) /* -0.000030518 */, - -PRESHIFT(0x0003a000) /* -0.000885010 */, - PRESHIFT(0x000e0000) /* 0.003417969 */, - -PRESHIFT(0x003df000) /* -0.015121460 */, - PRESHIFT(0x00586000) /* 0.021575928 */, - -PRESHIFT(0x01ee6000) /* -0.120697021 */, - PRESHIFT(0x00046000) /* 0.001068115 */, - -PRESHIFT(0x0ca8d000) /* -0.791213989 */, - PRESHIFT(0x119e9000) /* 1.101211548 */, - PRESHIFT(0x05991000) /* 0.349868774 */, - PRESHIFT(0x02578000) /* 0.146362305 */, - PRESHIFT(0x0091a000) /* 0.035552979 */, - PRESHIFT(0x007d1000) /* 0.030532837 */, - PRESHIFT(0x00048000) /* 0.001098633 */, - PRESHIFT(0x000a1000) /* 0.002456665 */, - PRESHIFT(0x0000d000) /* 0.000198364 */ }, - - { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 9 */ - -PRESHIFT(0x0003f000) /* -0.000961304 */, - PRESHIFT(0x000dd000) /* 0.003372192 */, - -PRESHIFT(0x00428000) /* -0.016235352 */, - PRESHIFT(0x00500000) /* 0.019531250 */, - -PRESHIFT(0x02011000) /* -0.125259399 */, - -PRESHIFT(0x003e6000) /* -0.015228271 */, - -PRESHIFT(0x0d11e000) /* -0.816864014 */, - PRESHIFT(0x116fc000) /* 1.089782715 */, - PRESHIFT(0x052c5000) /* 0.323318481 */, - PRESHIFT(0x02616000) /* 0.148773193 */, - PRESHIFT(0x007d6000) /* 0.030609131 */, - PRESHIFT(0x007aa000) /* 0.029937744 */, - PRESHIFT(0x00024000) /* 0.000549316 */, - PRESHIFT(0x0009a000) /* 0.002349854 */, - PRESHIFT(0x0000b000) /* 0.000167847 */, - - -PRESHIFT(0x00002000) /* -0.000030518 */, - -PRESHIFT(0x0003f000) /* -0.000961304 */, - PRESHIFT(0x000dd000) /* 0.003372192 */, - -PRESHIFT(0x00428000) /* -0.016235352 */, - PRESHIFT(0x00500000) /* 0.019531250 */, - -PRESHIFT(0x02011000) /* -0.125259399 */, - -PRESHIFT(0x003e6000) /* -0.015228271 */, - -PRESHIFT(0x0d11e000) /* -0.816864014 */, - PRESHIFT(0x116fc000) /* 1.089782715 */, - PRESHIFT(0x052c5000) /* 0.323318481 */, - PRESHIFT(0x02616000) /* 0.148773193 */, - PRESHIFT(0x007d6000) /* 0.030609131 */, - PRESHIFT(0x007aa000) /* 0.029937744 */, - PRESHIFT(0x00024000) /* 0.000549316 */, - PRESHIFT(0x0009a000) /* 0.002349854 */, - PRESHIFT(0x0000b000) /* 0.000167847 */ }, - - { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 10 */ - -PRESHIFT(0x00044000) /* -0.001037598 */, - PRESHIFT(0x000d7000) /* 0.003280640 */, - -PRESHIFT(0x00471000) /* -0.017349243 */, - PRESHIFT(0x0046b000) /* 0.017257690 */, - -PRESHIFT(0x0212b000) /* -0.129562378 */, - -PRESHIFT(0x0084a000) /* -0.032379150 */, - -PRESHIFT(0x0d78a000) /* -0.841949463 */, - PRESHIFT(0x113be000) /* 1.077117920 */, - PRESHIFT(0x04c16000) /* 0.297210693 */, - PRESHIFT(0x02687000) /* 0.150497437 */, - PRESHIFT(0x0069c000) /* 0.025817871 */, - PRESHIFT(0x0077f000) /* 0.029281616 */, - PRESHIFT(0x00002000) /* 0.000030518 */, - PRESHIFT(0x00093000) /* 0.002243042 */, - PRESHIFT(0x0000a000) /* 0.000152588 */, - - -PRESHIFT(0x00002000) /* -0.000030518 */, - -PRESHIFT(0x00044000) /* -0.001037598 */, - PRESHIFT(0x000d7000) /* 0.003280640 */, - -PRESHIFT(0x00471000) /* -0.017349243 */, - PRESHIFT(0x0046b000) /* 0.017257690 */, - -PRESHIFT(0x0212b000) /* -0.129562378 */, - -PRESHIFT(0x0084a000) /* -0.032379150 */, - -PRESHIFT(0x0d78a000) /* -0.841949463 */, - PRESHIFT(0x113be000) /* 1.077117920 */, - PRESHIFT(0x04c16000) /* 0.297210693 */, - PRESHIFT(0x02687000) /* 0.150497437 */, - PRESHIFT(0x0069c000) /* 0.025817871 */, - PRESHIFT(0x0077f000) /* 0.029281616 */, - PRESHIFT(0x00002000) /* 0.000030518 */, - PRESHIFT(0x00093000) /* 0.002243042 */, - PRESHIFT(0x0000a000) /* 0.000152588 */ }, - - { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 11 */ - -PRESHIFT(0x00049000) /* -0.001113892 */, - PRESHIFT(0x000d0000) /* 0.003173828 */, - -PRESHIFT(0x004ba000) /* -0.018463135 */, - PRESHIFT(0x003ca000) /* 0.014801025 */, - -PRESHIFT(0x02233000) /* -0.133590698 */, - -PRESHIFT(0x00ce4000) /* -0.050354004 */, - -PRESHIFT(0x0ddca000) /* -0.866363525 */, - PRESHIFT(0x1102f000) /* 1.063217163 */, - PRESHIFT(0x04587000) /* 0.271591187 */, - PRESHIFT(0x026cf000) /* 0.151596069 */, - PRESHIFT(0x0056c000) /* 0.021179199 */, - PRESHIFT(0x0074e000) /* 0.028533936 */, - -PRESHIFT(0x0001d000) /* -0.000442505 */, - PRESHIFT(0x0008b000) /* 0.002120972 */, - PRESHIFT(0x00009000) /* 0.000137329 */, - - -PRESHIFT(0x00003000) /* -0.000045776 */, - -PRESHIFT(0x00049000) /* -0.001113892 */, - PRESHIFT(0x000d0000) /* 0.003173828 */, - -PRESHIFT(0x004ba000) /* -0.018463135 */, - PRESHIFT(0x003ca000) /* 0.014801025 */, - -PRESHIFT(0x02233000) /* -0.133590698 */, - -PRESHIFT(0x00ce4000) /* -0.050354004 */, - -PRESHIFT(0x0ddca000) /* -0.866363525 */, - PRESHIFT(0x1102f000) /* 1.063217163 */, - PRESHIFT(0x04587000) /* 0.271591187 */, - PRESHIFT(0x026cf000) /* 0.151596069 */, - PRESHIFT(0x0056c000) /* 0.021179199 */, - PRESHIFT(0x0074e000) /* 0.028533936 */, - -PRESHIFT(0x0001d000) /* -0.000442505 */, - PRESHIFT(0x0008b000) /* 0.002120972 */, - PRESHIFT(0x00009000) /* 0.000137329 */ }, - - { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 12 */ - -PRESHIFT(0x0004f000) /* -0.001205444 */, - PRESHIFT(0x000c8000) /* 0.003051758 */, - -PRESHIFT(0x00503000) /* -0.019577026 */, - PRESHIFT(0x0031a000) /* 0.012115479 */, - -PRESHIFT(0x02326000) /* -0.137298584 */, - -PRESHIFT(0x011b5000) /* -0.069168091 */, - -PRESHIFT(0x0e3dd000) /* -0.890090942 */, - PRESHIFT(0x10c54000) /* 1.048156738 */, - PRESHIFT(0x03f1b000) /* 0.246505737 */, - PRESHIFT(0x026ee000) /* 0.152069092 */, - PRESHIFT(0x00447000) /* 0.016708374 */, - PRESHIFT(0x00719000) /* 0.027725220 */, - -PRESHIFT(0x00039000) /* -0.000869751 */, - PRESHIFT(0x00084000) /* 0.002014160 */, - PRESHIFT(0x00008000) /* 0.000122070 */, - - -PRESHIFT(0x00003000) /* -0.000045776 */, - -PRESHIFT(0x0004f000) /* -0.001205444 */, - PRESHIFT(0x000c8000) /* 0.003051758 */, - -PRESHIFT(0x00503000) /* -0.019577026 */, - PRESHIFT(0x0031a000) /* 0.012115479 */, - -PRESHIFT(0x02326000) /* -0.137298584 */, - -PRESHIFT(0x011b5000) /* -0.069168091 */, - -PRESHIFT(0x0e3dd000) /* -0.890090942 */, - PRESHIFT(0x10c54000) /* 1.048156738 */, - PRESHIFT(0x03f1b000) /* 0.246505737 */, - PRESHIFT(0x026ee000) /* 0.152069092 */, - PRESHIFT(0x00447000) /* 0.016708374 */, - PRESHIFT(0x00719000) /* 0.027725220 */, - -PRESHIFT(0x00039000) /* -0.000869751 */, - PRESHIFT(0x00084000) /* 0.002014160 */, - PRESHIFT(0x00008000) /* 0.000122070 */ }, - - { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 13 */ - -PRESHIFT(0x00055000) /* -0.001296997 */, - PRESHIFT(0x000bd000) /* 0.002883911 */, - -PRESHIFT(0x0054c000) /* -0.020690918 */, - PRESHIFT(0x0025d000) /* 0.009231567 */, - -PRESHIFT(0x02403000) /* -0.140670776 */, - -PRESHIFT(0x016ba000) /* -0.088775635 */, - -PRESHIFT(0x0e9be000) /* -0.913055420 */, - PRESHIFT(0x1082d000) /* 1.031936646 */, - PRESHIFT(0x038d4000) /* 0.221984863 */, - PRESHIFT(0x026e7000) /* 0.151962280 */, - PRESHIFT(0x0032e000) /* 0.012420654 */, - PRESHIFT(0x006df000) /* 0.026840210 */, - -PRESHIFT(0x00053000) /* -0.001266479 */, - PRESHIFT(0x0007d000) /* 0.001907349 */, - PRESHIFT(0x00007000) /* 0.000106812 */, - - -PRESHIFT(0x00004000) /* -0.000061035 */, - -PRESHIFT(0x00055000) /* -0.001296997 */, - PRESHIFT(0x000bd000) /* 0.002883911 */, - -PRESHIFT(0x0054c000) /* -0.020690918 */, - PRESHIFT(0x0025d000) /* 0.009231567 */, - -PRESHIFT(0x02403000) /* -0.140670776 */, - -PRESHIFT(0x016ba000) /* -0.088775635 */, - -PRESHIFT(0x0e9be000) /* -0.913055420 */, - PRESHIFT(0x1082d000) /* 1.031936646 */, - PRESHIFT(0x038d4000) /* 0.221984863 */, - PRESHIFT(0x026e7000) /* 0.151962280 */, - PRESHIFT(0x0032e000) /* 0.012420654 */, - PRESHIFT(0x006df000) /* 0.026840210 */, - -PRESHIFT(0x00053000) /* -0.001266479 */, - PRESHIFT(0x0007d000) /* 0.001907349 */, - PRESHIFT(0x00007000) /* 0.000106812 */ }, - - { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 14 */ - -PRESHIFT(0x0005b000) /* -0.001388550 */, - PRESHIFT(0x000b1000) /* 0.002700806 */, - -PRESHIFT(0x00594000) /* -0.021789551 */, - PRESHIFT(0x00192000) /* 0.006134033 */, - -PRESHIFT(0x024c8000) /* -0.143676758 */, - -PRESHIFT(0x01bf2000) /* -0.109161377 */, - -PRESHIFT(0x0ef69000) /* -0.935195923 */, - PRESHIFT(0x103be000) /* 1.014617920 */, - PRESHIFT(0x032b4000) /* 0.198059082 */, - PRESHIFT(0x026bc000) /* 0.151306152 */, - PRESHIFT(0x00221000) /* 0.008316040 */, - PRESHIFT(0x006a2000) /* 0.025909424 */, - -PRESHIFT(0x0006a000) /* -0.001617432 */, - PRESHIFT(0x00075000) /* 0.001785278 */, - PRESHIFT(0x00007000) /* 0.000106812 */, - - -PRESHIFT(0x00004000) /* -0.000061035 */, - -PRESHIFT(0x0005b000) /* -0.001388550 */, - PRESHIFT(0x000b1000) /* 0.002700806 */, - -PRESHIFT(0x00594000) /* -0.021789551 */, - PRESHIFT(0x00192000) /* 0.006134033 */, - -PRESHIFT(0x024c8000) /* -0.143676758 */, - -PRESHIFT(0x01bf2000) /* -0.109161377 */, - -PRESHIFT(0x0ef69000) /* -0.935195923 */, - PRESHIFT(0x103be000) /* 1.014617920 */, - PRESHIFT(0x032b4000) /* 0.198059082 */, - PRESHIFT(0x026bc000) /* 0.151306152 */, - PRESHIFT(0x00221000) /* 0.008316040 */, - PRESHIFT(0x006a2000) /* 0.025909424 */, - -PRESHIFT(0x0006a000) /* -0.001617432 */, - PRESHIFT(0x00075000) /* 0.001785278 */, - PRESHIFT(0x00007000) /* 0.000106812 */ }, - - { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 15 */ - -PRESHIFT(0x00061000) /* -0.001480103 */, - PRESHIFT(0x000a3000) /* 0.002487183 */, - -PRESHIFT(0x005da000) /* -0.022857666 */, - PRESHIFT(0x000b9000) /* 0.002822876 */, - -PRESHIFT(0x02571000) /* -0.146255493 */, - -PRESHIFT(0x0215c000) /* -0.130310059 */, - -PRESHIFT(0x0f4dc000) /* -0.956481934 */, - PRESHIFT(0x0ff0a000) /* 0.996246338 */, - PRESHIFT(0x02cbf000) /* 0.174789429 */, - PRESHIFT(0x0266e000) /* 0.150115967 */, - PRESHIFT(0x00120000) /* 0.004394531 */, - PRESHIFT(0x00662000) /* 0.024932861 */, - -PRESHIFT(0x0007f000) /* -0.001937866 */, - PRESHIFT(0x0006f000) /* 0.001693726 */, - PRESHIFT(0x00006000) /* 0.000091553 */, - - -PRESHIFT(0x00005000) /* -0.000076294 */, - -PRESHIFT(0x00061000) /* -0.001480103 */, - PRESHIFT(0x000a3000) /* 0.002487183 */, - -PRESHIFT(0x005da000) /* -0.022857666 */, - PRESHIFT(0x000b9000) /* 0.002822876 */, - -PRESHIFT(0x02571000) /* -0.146255493 */, - -PRESHIFT(0x0215c000) /* -0.130310059 */, - -PRESHIFT(0x0f4dc000) /* -0.956481934 */, - PRESHIFT(0x0ff0a000) /* 0.996246338 */, - PRESHIFT(0x02cbf000) /* 0.174789429 */, - PRESHIFT(0x0266e000) /* 0.150115967 */, - PRESHIFT(0x00120000) /* 0.004394531 */, - PRESHIFT(0x00662000) /* 0.024932861 */, - -PRESHIFT(0x0007f000) /* -0.001937866 */, - PRESHIFT(0x0006f000) /* 0.001693726 */, - PRESHIFT(0x00006000) /* 0.000091553 */ }, - - { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 16 */ - -PRESHIFT(0x00068000) /* -0.001586914 */, - PRESHIFT(0x00092000) /* 0.002227783 */, - -PRESHIFT(0x0061f000) /* -0.023910522 */, - -PRESHIFT(0x0002d000) /* -0.000686646 */, - -PRESHIFT(0x025ff000) /* -0.148422241 */, - -PRESHIFT(0x026f7000) /* -0.152206421 */, - -PRESHIFT(0x0fa13000) /* -0.976852417 */, - PRESHIFT(0x0fa13000) /* 0.976852417 */, - PRESHIFT(0x026f7000) /* 0.152206421 */, - PRESHIFT(0x025ff000) /* 0.148422241 */, - PRESHIFT(0x0002d000) /* 0.000686646 */, - PRESHIFT(0x0061f000) /* 0.023910522 */, - -PRESHIFT(0x00092000) /* -0.002227783 */, - PRESHIFT(0x00068000) /* 0.001586914 */, - PRESHIFT(0x00005000) /* 0.000076294 */, - - -PRESHIFT(0x00005000) /* -0.000076294 */, - -PRESHIFT(0x00068000) /* -0.001586914 */, - PRESHIFT(0x00092000) /* 0.002227783 */, - -PRESHIFT(0x0061f000) /* -0.023910522 */, - -PRESHIFT(0x0002d000) /* -0.000686646 */, - -PRESHIFT(0x025ff000) /* -0.148422241 */, - -PRESHIFT(0x026f7000) /* -0.152206421 */, - -PRESHIFT(0x0fa13000) /* -0.976852417 */, - PRESHIFT(0x0fa13000) /* 0.976852417 */, - PRESHIFT(0x026f7000) /* 0.152206421 */, - PRESHIFT(0x025ff000) /* 0.148422241 */, - PRESHIFT(0x0002d000) /* 0.000686646 */, - PRESHIFT(0x0061f000) /* 0.023910522 */, - -PRESHIFT(0x00092000) /* -0.002227783 */, - PRESHIFT(0x00068000) /* 0.001586914 */, - PRESHIFT(0x00005000) /* 0.000076294 */ } diff --git a/src/lib/dl/ext/libmad/decoder.c b/src/lib/dl/ext/libmad/decoder.c deleted file mode 100755 index 6d6df0db..00000000 --- a/src/lib/dl/ext/libmad/decoder.c +++ /dev/null @@ -1,582 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: decoder.c,v 1.22 2004/01/23 09:41:32 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -# endif - -# ifdef HAVE_SYS_WAIT_H -# include <sys/wait.h> -# endif - -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif - -# ifdef HAVE_FCNTL_H -# include <fcntl.h> -# endif - -# include <stdlib.h> - -# ifdef HAVE_ERRNO_H -# include <errno.h> -# endif - -# include "stream.h" -# include "frame.h" -# include "synth.h" -# include "decoder.h" - -/* - * NAME: decoder->init() - * DESCRIPTION: initialize a decoder object with callback routines - */ -void mad_decoder_init(struct mad_decoder *decoder, void *data, - enum mad_flow (*input_func)(void *, - struct mad_stream *), - enum mad_flow (*header_func)(void *, - struct mad_header const *), - enum mad_flow (*filter_func)(void *, - struct mad_stream const *, - struct mad_frame *), - enum mad_flow (*output_func)(void *, - struct mad_header const *, - struct mad_pcm *), - enum mad_flow (*error_func)(void *, - struct mad_stream *, - struct mad_frame *), - enum mad_flow (*message_func)(void *, - void *, unsigned int *)) -{ - decoder->mode = -1; - - decoder->options = 0; - - decoder->async.pid = 0; - decoder->async.in = -1; - decoder->async.out = -1; - - decoder->sync = 0; - - decoder->cb_data = data; - - decoder->input_func = input_func; - decoder->header_func = header_func; - decoder->filter_func = filter_func; - decoder->output_func = output_func; - decoder->error_func = error_func; - decoder->message_func = message_func; -} - -int mad_decoder_finish(struct mad_decoder *decoder) -{ -# if defined(USE_ASYNC) - if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) { - pid_t pid; - int status; - - close(decoder->async.in); - - do - pid = waitpid(decoder->async.pid, &status, 0); - while (pid == -1 && errno == EINTR); - - decoder->mode = -1; - - close(decoder->async.out); - - decoder->async.pid = 0; - decoder->async.in = -1; - decoder->async.out = -1; - - if (pid == -1) - return -1; - - return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0; - } -# endif - - return 0; -} - -# if defined(USE_ASYNC) -static -enum mad_flow send_io(int fd, void const *data, size_t len) -{ - char const *ptr = data; - ssize_t count; - - while (len) { - do - count = write(fd, ptr, len); - while (count == -1 && errno == EINTR); - - if (count == -1) - return MAD_FLOW_BREAK; - - len -= count; - ptr += count; - } - - return MAD_FLOW_CONTINUE; -} - -static -enum mad_flow receive_io(int fd, void *buffer, size_t len) -{ - char *ptr = buffer; - ssize_t count; - - while (len) { - do - count = read(fd, ptr, len); - while (count == -1 && errno == EINTR); - - if (count == -1) - return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK; - else if (count == 0) - return MAD_FLOW_STOP; - - len -= count; - ptr += count; - } - - return MAD_FLOW_CONTINUE; -} - -static -enum mad_flow receive_io_blocking(int fd, void *buffer, size_t len) -{ - int flags, blocking; - enum mad_flow result; - - flags = fcntl(fd, F_GETFL); - if (flags == -1) - return MAD_FLOW_BREAK; - - blocking = flags & ~O_NONBLOCK; - - if (blocking != flags && - fcntl(fd, F_SETFL, blocking) == -1) - return MAD_FLOW_BREAK; - - result = receive_io(fd, buffer, len); - - if (flags != blocking && - fcntl(fd, F_SETFL, flags) == -1) - return MAD_FLOW_BREAK; - - return result; -} - -static -enum mad_flow send(int fd, void const *message, unsigned int size) -{ - enum mad_flow result; - - /* send size */ - - result = send_io(fd, &size, sizeof(size)); - - /* send message */ - - if (result == MAD_FLOW_CONTINUE) - result = send_io(fd, message, size); - - return result; -} - -static -enum mad_flow receive(int fd, void **message, unsigned int *size) -{ - enum mad_flow result; - unsigned int actual; - - if (*message == 0) - *size = 0; - - /* receive size */ - - result = receive_io(fd, &actual, sizeof(actual)); - - /* receive message */ - - if (result == MAD_FLOW_CONTINUE) { - if (actual > *size) - actual -= *size; - else { - *size = actual; - actual = 0; - } - - if (*size > 0) { - if (*message == 0) { - *message = malloc(*size); - if (*message == 0) - return MAD_FLOW_BREAK; - } - - result = receive_io_blocking(fd, *message, *size); - } - - /* throw away remainder of message */ - - while (actual && result == MAD_FLOW_CONTINUE) { - char sink[256]; - unsigned int len; - - len = actual > sizeof(sink) ? sizeof(sink) : actual; - - result = receive_io_blocking(fd, sink, len); - - actual -= len; - } - } - - return result; -} - -static -enum mad_flow check_message(struct mad_decoder *decoder) -{ - enum mad_flow result; - void *message = 0; - unsigned int size; - - result = receive(decoder->async.in, &message, &size); - - if (result == MAD_FLOW_CONTINUE) { - if (decoder->message_func == 0) - size = 0; - else { - result = decoder->message_func(decoder->cb_data, message, &size); - - if (result == MAD_FLOW_IGNORE || - result == MAD_FLOW_BREAK) - size = 0; - } - - if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE) - result = MAD_FLOW_BREAK; - } - - if (message) - free(message); - - return result; -} -# endif - -static -enum mad_flow error_default(void *data, struct mad_stream *stream, - struct mad_frame *frame) -{ - int *bad_last_frame = data; - - switch (stream->error) { - case MAD_ERROR_BADCRC: - if (*bad_last_frame) - mad_frame_mute(frame); - else - *bad_last_frame = 1; - - return MAD_FLOW_IGNORE; - - default: - return MAD_FLOW_CONTINUE; - } -} - -static -int run_sync(struct mad_decoder *decoder) -{ - enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); - void *error_data; - int bad_last_frame = 0; - struct mad_stream *stream; - struct mad_frame *frame; - struct mad_synth *synth; - int result = 0; - - if (decoder->input_func == 0) - return 0; - - if (decoder->error_func) { - error_func = decoder->error_func; - error_data = decoder->cb_data; - } - else { - error_func = error_default; - error_data = &bad_last_frame; - } - - stream = &decoder->sync->stream; - frame = &decoder->sync->frame; - synth = &decoder->sync->synth; - - mad_stream_init(stream); - mad_frame_init(frame); - mad_synth_init(synth); - - mad_stream_options(stream, decoder->options); - - do { - switch (decoder->input_func(decoder->cb_data, stream)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - continue; - case MAD_FLOW_CONTINUE: - break; - } - - while (1) { -# if defined(USE_ASYNC) - if (decoder->mode == MAD_DECODER_MODE_ASYNC) { - switch (check_message(decoder)) { - case MAD_FLOW_IGNORE: - case MAD_FLOW_CONTINUE: - break; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_STOP: - goto done; - } - } -# endif - - if (decoder->header_func) { - if (mad_header_decode(&frame->header, stream) == -1) { - if (!MAD_RECOVERABLE(stream->error)) - break; - - switch (error_func(error_data, stream, frame)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - case MAD_FLOW_CONTINUE: - default: - continue; - } - } - - switch (decoder->header_func(decoder->cb_data, &frame->header)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - continue; - case MAD_FLOW_CONTINUE: - break; - } - } - - if (mad_frame_decode(frame, stream) == -1) { - if (!MAD_RECOVERABLE(stream->error)) - break; - - switch (error_func(error_data, stream, frame)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - break; - case MAD_FLOW_CONTINUE: - default: - continue; - } - } - else - bad_last_frame = 0; - - if (decoder->filter_func) { - switch (decoder->filter_func(decoder->cb_data, stream, frame)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - continue; - case MAD_FLOW_CONTINUE: - break; - } - } - - mad_synth_frame(synth, frame); - - if (decoder->output_func) { - switch (decoder->output_func(decoder->cb_data, - &frame->header, &synth->pcm)) { - case MAD_FLOW_STOP: - goto done; - case MAD_FLOW_BREAK: - goto fail; - case MAD_FLOW_IGNORE: - case MAD_FLOW_CONTINUE: - break; - } - } - } - } - while (stream->error == MAD_ERROR_BUFLEN); - - fail: - result = -1; - - done: - mad_synth_finish(synth); - mad_frame_finish(frame); - mad_stream_finish(stream); - - return result; -} - -# if defined(USE_ASYNC) -static -int run_async(struct mad_decoder *decoder) -{ - pid_t pid; - int ptoc[2], ctop[2], flags; - - if (pipe(ptoc) == -1) - return -1; - - if (pipe(ctop) == -1) { - close(ptoc[0]); - close(ptoc[1]); - return -1; - } - - flags = fcntl(ptoc[0], F_GETFL); - if (flags == -1 || - fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) { - close(ctop[0]); - close(ctop[1]); - close(ptoc[0]); - close(ptoc[1]); - return -1; - } - - pid = fork(); - if (pid == -1) { - close(ctop[0]); - close(ctop[1]); - close(ptoc[0]); - close(ptoc[1]); - return -1; - } - - decoder->async.pid = pid; - - if (pid) { - /* parent */ - - close(ptoc[0]); - close(ctop[1]); - - decoder->async.in = ctop[0]; - decoder->async.out = ptoc[1]; - - return 0; - } - - /* child */ - - close(ptoc[1]); - close(ctop[0]); - - decoder->async.in = ptoc[0]; - decoder->async.out = ctop[1]; - - _exit(run_sync(decoder)); - - /* not reached */ - return -1; -} -# endif - -/* - * NAME: decoder->run() - * DESCRIPTION: run the decoder thread either synchronously or asynchronously - */ -int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode) -{ - int result; - int (*run)(struct mad_decoder *) = 0; - - switch (decoder->mode = mode) { - case MAD_DECODER_MODE_SYNC: - run = run_sync; - break; - - case MAD_DECODER_MODE_ASYNC: -# if defined(USE_ASYNC) - run = run_async; -# endif - break; - } - - if (run == 0) - return -1; - - decoder->sync = malloc(sizeof(*decoder->sync)); - if (decoder->sync == 0) - return -1; - - result = run(decoder); - - free(decoder->sync); - decoder->sync = 0; - - return result; -} - -/* - * NAME: decoder->message() - * DESCRIPTION: send a message to and receive a reply from the decoder process - */ -int mad_decoder_message(struct mad_decoder *decoder, - void *message, unsigned int *len) -{ -# if defined(USE_ASYNC) - if (decoder->mode != MAD_DECODER_MODE_ASYNC || - send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE || - receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE) - return -1; - - return 0; -# else - return -1; -# endif -} diff --git a/src/lib/dl/ext/libmad/decoder.h b/src/lib/dl/ext/libmad/decoder.h deleted file mode 100755 index f0ad758d..00000000 --- a/src/lib/dl/ext/libmad/decoder.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp $ - */ - -# ifndef LIBMAD_DECODER_H -# define LIBMAD_DECODER_H - -# include "stream.h" -# include "frame.h" -# include "synth.h" - -enum mad_decoder_mode { - MAD_DECODER_MODE_SYNC = 0, - MAD_DECODER_MODE_ASYNC -}; - -enum mad_flow { - MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ - MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ - MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ - MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ -}; - -struct mad_decoder { - enum mad_decoder_mode mode; - - int options; - - struct { - long pid; - int in; - int out; - } async; - - struct { - struct mad_stream stream; - struct mad_frame frame; - struct mad_synth synth; - } *sync; - - void *cb_data; - - enum mad_flow (*input_func)(void *, struct mad_stream *); - enum mad_flow (*header_func)(void *, struct mad_header const *); - enum mad_flow (*filter_func)(void *, - struct mad_stream const *, struct mad_frame *); - enum mad_flow (*output_func)(void *, - struct mad_header const *, struct mad_pcm *); - enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); - enum mad_flow (*message_func)(void *, void *, unsigned int *); -}; - -void mad_decoder_init(struct mad_decoder *, void *, - enum mad_flow (*)(void *, struct mad_stream *), - enum mad_flow (*)(void *, struct mad_header const *), - enum mad_flow (*)(void *, - struct mad_stream const *, - struct mad_frame *), - enum mad_flow (*)(void *, - struct mad_header const *, - struct mad_pcm *), - enum mad_flow (*)(void *, - struct mad_stream *, - struct mad_frame *), - enum mad_flow (*)(void *, void *, unsigned int *)); -int mad_decoder_finish(struct mad_decoder *); - -# define mad_decoder_options(decoder, opts) \ - ((void) ((decoder)->options = (opts))) - -int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); -int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); - -# endif diff --git a/src/lib/dl/ext/libmad/fixed.c b/src/lib/dl/ext/libmad/fixed.c deleted file mode 100755 index 9785466f..00000000 --- a/src/lib/dl/ext/libmad/fixed.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: fixed.c,v 1.13 2004/01/23 09:41:32 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include "fixed.h" - -/* - * NAME: fixed->abs() - * DESCRIPTION: return absolute value of a fixed-point number - */ -mad_fixed_t mad_f_abs(mad_fixed_t x) -{ - return x < 0 ? -x : x; -} - -/* - * NAME: fixed->div() - * DESCRIPTION: perform division using fixed-point math - */ -mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y) -{ - mad_fixed_t q, r; - unsigned int bits; - - q = mad_f_abs(x / y); - - if (x < 0) { - x = -x; - y = -y; - } - - r = x % y; - - if (y < 0) { - x = -x; - y = -y; - } - - if (q > mad_f_intpart(MAD_F_MAX) && - !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0))) - return 0; - - for (bits = MAD_F_FRACBITS; bits && r; --bits) { - q <<= 1, r <<= 1; - if (r >= y) - r -= y, ++q; - } - - /* round */ - if (2 * r >= y) - ++q; - - /* fix sign */ - if ((x < 0) != (y < 0)) - q = -q; - - return q << bits; -} diff --git a/src/lib/dl/ext/libmad/fixed.h b/src/lib/dl/ext/libmad/fixed.h deleted file mode 100755 index 4b58abf5..00000000 --- a/src/lib/dl/ext/libmad/fixed.h +++ /dev/null @@ -1,499 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp $ - */ - -# ifndef LIBMAD_FIXED_H -# define LIBMAD_FIXED_H - -# if SIZEOF_INT >= 4 -typedef signed int mad_fixed_t; - -typedef signed int mad_fixed64hi_t; -typedef unsigned int mad_fixed64lo_t; -# else -typedef signed long mad_fixed_t; - -typedef signed long mad_fixed64hi_t; -typedef unsigned long mad_fixed64lo_t; -# endif - -# if defined(_MSC_VER) -# define mad_fixed64_t signed __int64 -# elif 1 || defined(__GNUC__) -# define mad_fixed64_t signed long long -# endif - -# if defined(FPM_FLOAT) -typedef double mad_sample_t; -# else -typedef mad_fixed_t mad_sample_t; -# endif - -/* - * Fixed-point format: 0xABBBBBBB - * A == whole part (sign + 3 bits) - * B == fractional part (28 bits) - * - * Values are signed two's complement, so the effective range is: - * 0x80000000 to 0x7fffffff - * -8.0 to +7.9999999962747097015380859375 - * - * The smallest representable value is: - * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) - * - * 28 bits of fractional accuracy represent about - * 8.6 digits of decimal accuracy. - * - * Fixed-point numbers can be added or subtracted as normal - * integers, but multiplication requires shifting the 64-bit result - * from 56 fractional bits back to 28 (and rounding.) - * - * Changing the definition of MAD_F_FRACBITS is only partially - * supported, and must be done with care. - */ - -# define MAD_F_FRACBITS 28 - -# if MAD_F_FRACBITS == 28 -# define MAD_F(x) ((mad_fixed_t) (x##L)) -# else -# if MAD_F_FRACBITS < 28 -# warning "MAD_F_FRACBITS < 28" -# define MAD_F(x) ((mad_fixed_t) \ - (((x##L) + \ - (1L << (28 - MAD_F_FRACBITS - 1))) >> \ - (28 - MAD_F_FRACBITS))) -# elif MAD_F_FRACBITS > 28 -# error "MAD_F_FRACBITS > 28 not currently supported" -# define MAD_F(x) ((mad_fixed_t) \ - ((x##L) << (MAD_F_FRACBITS - 28))) -# endif -# endif - -# define MAD_F_MIN ((mad_fixed_t) -0x80000000L) -# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) - -# define MAD_F_ONE MAD_F(0x10000000) - -# define mad_f_tofixed(x) ((mad_fixed_t) \ - ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) -# define mad_f_todouble(x) ((double) \ - ((x) / (double) (1L << MAD_F_FRACBITS))) - -# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) -# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) - /* (x should be positive) */ - -# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) - -# define mad_f_add(x, y) ((x) + (y)) -# define mad_f_sub(x, y) ((x) - (y)) - -# if defined(FPM_FLOAT) -# error "FPM_FLOAT not yet supported" - -# undef MAD_F -# define MAD_F(x) mad_f_todouble(x) - -# define mad_f_mul(x, y) ((x) * (y)) -# define mad_f_scale64 - -# undef ASO_ZEROCHECK - -# elif defined(FPM_64BIT) - -/* - * This version should be the most accurate if 64-bit types are supported by - * the compiler, although it may not be the most efficient. - */ -# if defined(OPT_ACCURACY) -# define mad_f_mul(x, y) \ - ((mad_fixed_t) \ - ((((mad_fixed64_t) (x) * (y)) + \ - (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) -# else -# define mad_f_mul(x, y) \ - ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) -# endif - -# define MAD_F_SCALEBITS MAD_F_FRACBITS - -/* --- Intel --------------------------------------------------------------- */ - -# elif defined(FPM_INTEL) - -# if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable: 4035) /* no return value */ -static __forceinline -mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) -{ - enum { - fracbits = MAD_F_FRACBITS - }; - - __asm { - mov eax, x - imul y - shrd eax, edx, fracbits - } - - /* implicit return of eax */ -} -# pragma warning(pop) - -# define mad_f_mul mad_f_mul_inline -# define mad_f_scale64 -# else -/* - * This Intel version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("imull %3" \ - : "=a" (lo), "=d" (hi) \ - : "%a" (x), "rm" (y) \ - : "cc") - -# if defined(OPT_ACCURACY) -/* - * This gives best accuracy but is not very fast. - */ -# define MAD_F_MLA(hi, lo, x, y) \ - ({ mad_fixed64hi_t __hi; \ - mad_fixed64lo_t __lo; \ - MAD_F_MLX(__hi, __lo, (x), (y)); \ - asm ("addl %2,%0\n\t" \ - "adcl %3,%1" \ - : "=rm" (lo), "=rm" (hi) \ - : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ - : "cc"); \ - }) -# endif /* OPT_ACCURACY */ - -# if defined(OPT_ACCURACY) -/* - * Surprisingly, this is faster than SHRD followed by ADC. - */ -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed64hi_t __hi_; \ - mad_fixed64lo_t __lo_; \ - mad_fixed_t __result; \ - asm ("addl %4,%2\n\t" \ - "adcl %5,%3" \ - : "=rm" (__lo_), "=rm" (__hi_) \ - : "0" (lo), "1" (hi), \ - "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ - : "cc"); \ - asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# elif defined(OPT_INTEL) -/* - * Alternate Intel scaling that may or may not perform better. - */ -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("shrl %3,%1\n\t" \ - "shll %4,%2\n\t" \ - "orl %2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), \ - "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# else -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# endif /* OPT_ACCURACY */ - -# define MAD_F_SCALEBITS MAD_F_FRACBITS -# endif - -/* --- ARM ----------------------------------------------------------------- */ - -# elif defined(FPM_ARM) - -/* - * This ARM V4 version is as accurate as FPM_64BIT but much faster. The - * least significant bit is properly rounded at no CPU cycle cost! - */ -# if 1 -/* - * This is faster than the default implementation via MAD_F_MLX() and - * mad_f_scale64(). - */ -# define mad_f_mul(x, y) \ - ({ mad_fixed64hi_t __hi; \ - mad_fixed64lo_t __lo; \ - mad_fixed_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" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# endif - -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("smull %0, %1, %2, %3" \ - : "=&r" (lo), "=&r" (hi) \ - : "%r" (x), "r" (y)) - -# define MAD_F_MLA(hi, lo, x, y) \ - asm ("smlal %0, %1, %2, %3" \ - : "+r" (lo), "+r" (hi) \ - : "%r" (x), "r" (y)) - -# define MAD_F_MLN(hi, lo) \ - asm ("rsbs %0, %2, #0\n\t" \ - "rsc %1, %3, #0" \ - : "=r" (lo), "=r" (hi) \ - : "0" (lo), "1" (hi) \ - : "cc") - -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("movs %0, %1, lsr %3\n\t" \ - "adc %0, %0, %2, lsl %4" \ - : "=&r" (__result) \ - : "r" (lo), "r" (hi), \ - "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) - -# define MAD_F_SCALEBITS MAD_F_FRACBITS - -/* --- MIPS ---------------------------------------------------------------- */ - -# elif defined(FPM_MIPS) - -/* - * This MIPS version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" (x), "r" (y)) - -# if defined(HAVE_MADD_ASM) -# define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" (x), "r" (y)) -# elif defined(HAVE_MADD16_ASM) -/* - * This loses significant accuracy due to the 16-bit integer limit in the - * multiply/accumulate instruction. - */ -# define MAD_F_ML0(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) -# define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd16 %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) -# define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) -# endif - -# if defined(OPT_SPEED) -# define mad_f_scale64(hi, lo) \ - ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) -# define MAD_F_SCALEBITS MAD_F_FRACBITS -# endif - -/* --- SPARC --------------------------------------------------------------- */ - -# elif defined(FPM_SPARC) - -/* - * This SPARC V8 version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("smul %2, %3, %0\n\t" \ - "rd %%y, %1" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (x), "rI" (y)) - -/* --- PowerPC ------------------------------------------------------------- */ - -# elif defined(FPM_PPC) - -/* - * This PowerPC version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - do { \ - asm ("mullw %0,%1,%2" \ - : "=r" (lo) \ - : "%r" (x), "r" (y)); \ - asm ("mulhw %0,%1,%2" \ - : "=r" (hi) \ - : "%r" (x), "r" (y)); \ - } \ - while (0) - -# if defined(OPT_ACCURACY) -/* - * This gives best accuracy but is not very fast. - */ -# define MAD_F_MLA(hi, lo, x, y) \ - ({ mad_fixed64hi_t __hi; \ - mad_fixed64lo_t __lo; \ - MAD_F_MLX(__hi, __lo, (x), (y)); \ - asm ("addc %0,%2,%3\n\t" \ - "adde %1,%4,%5" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (lo), "r" (__lo), \ - "%r" (hi), "r" (__hi) \ - : "xer"); \ - }) -# endif - -# if defined(OPT_ACCURACY) -/* - * This is slower than the truncating version below it. - */ -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result, __round; \ - asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ - asm ("extrwi %0,%1,1,0" \ - : "=r" (__round) \ - : "r" (__result)); \ - asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ - asm ("add %0,%1,%2" \ - : "=r" (__result) \ - : "%r" (__result), "r" (__round)); \ - __result; \ - }) -# else -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ - asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ - __result; \ - }) -# endif - -# define MAD_F_SCALEBITS MAD_F_FRACBITS - -/* --- Default ------------------------------------------------------------- */ - -# elif defined(FPM_DEFAULT) - -/* - * This version is the most portable but it loses significant accuracy. - * Furthermore, accuracy is biased against the second argument, so care - * should be taken when ordering operands. - * - * The scale factors are constant as this is not used with SSO. - * - * Pre-rounding is required to stay within the limits of compliance. - */ -# if defined(OPT_SPEED) -# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) -# else -# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ - (((y) + (1L << 15)) >> 16)) -# endif - -/* ------------------------------------------------------------------------- */ - -# else -# error "no FPM selected" -# endif - -/* default implementations */ - -# if !defined(mad_f_mul) -# define mad_f_mul(x, y) \ - ({ register mad_fixed64hi_t __hi; \ - register mad_fixed64lo_t __lo; \ - MAD_F_MLX(__hi, __lo, (x), (y)); \ - mad_f_scale64(__hi, __lo); \ - }) -# endif - -# if !defined(MAD_F_MLA) -# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) -# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) -# define MAD_F_MLN(hi, lo) ((lo) = -(lo)) -# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) -# endif - -# if !defined(MAD_F_ML0) -# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) -# endif - -# if !defined(MAD_F_MLN) -# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) -# endif - -# if !defined(MAD_F_MLZ) -# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) -# endif - -# if !defined(mad_f_scale64) -# if defined(OPT_ACCURACY) -# define mad_f_scale64(hi, lo) \ - ((((mad_fixed_t) \ - (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ - ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) -# else -# define mad_f_scale64(hi, lo) \ - ((mad_fixed_t) \ - (((hi) << (32 - MAD_F_SCALEBITS)) | \ - ((lo) >> MAD_F_SCALEBITS))) -# endif -# define MAD_F_SCALEBITS MAD_F_FRACBITS -# endif - -/* C routines */ - -mad_fixed_t mad_f_abs(mad_fixed_t); -mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); - -# endif diff --git a/src/lib/dl/ext/libmad/frame.c b/src/lib/dl/ext/libmad/frame.c deleted file mode 100755 index 04351033..00000000 --- a/src/lib/dl/ext/libmad/frame.c +++ /dev/null @@ -1,504 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: frame.c,v 1.29 2004/02/04 22:59:19 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include <stdlib.h> -# include <stdio.h> - -# include "bit.h" -# include "stream.h" -# include "frame.h" -# include "timer.h" -# include "layer12.h" -# include "layer3.h" - -static -unsigned long const bitrate_table[5][15] = { - /* MPEG-1 */ - { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */ - 256000, 288000, 320000, 352000, 384000, 416000, 448000 }, - { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */ - 128000, 160000, 192000, 224000, 256000, 320000, 384000 }, - { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */ - 112000, 128000, 160000, 192000, 224000, 256000, 320000 }, - - /* MPEG-2 LSF */ - { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */ - 128000, 144000, 160000, 176000, 192000, 224000, 256000 }, - { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */ - 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */ -}; - -static -unsigned int const samplerate_table[3] = { 44100, 48000, 32000 }; - -static -int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = { - mad_layer_I, - mad_layer_II, - mad_layer_III -}; - -/* - * NAME: header->init() - * DESCRIPTION: initialize header struct - */ -void mad_header_init(struct mad_header *header) -{ - header->layer = 0; - header->mode = 0; - header->mode_extension = 0; - header->emphasis = 0; - - header->bitrate = 0; - header->samplerate = 0; - - header->crc_check = 0; - header->crc_target = 0; - - header->flags = 0; - header->private_bits = 0; - - header->duration = mad_timer_zero; -} - -/* - * NAME: frame->init() - * DESCRIPTION: initialize frame struct - */ -void mad_frame_init(struct mad_frame *frame) -{ - mad_header_init(&frame->header); - - frame->options = 0; - - frame->overlap = 0; - mad_frame_mute(frame); -} - -/* - * NAME: frame->finish() - * DESCRIPTION: deallocate any dynamic memory associated with frame - */ -void mad_frame_finish(struct mad_frame *frame) -{ - mad_header_finish(&frame->header); - - if (frame->overlap) { - free(frame->overlap); - frame->overlap = 0; - } -} - -/* - * NAME: decode_header() - * DESCRIPTION: read header data and following CRC word - */ -static -int decode_header(struct mad_header *header, struct mad_stream *stream) -{ - unsigned int index; - - header->flags = 0; - header->private_bits = 0; - - /* header() */ - - /* syncword */ - mad_bit_skip(&stream->ptr, 11); - - /* MPEG 2.5 indicator (really part of syncword) */ - if (mad_bit_read(&stream->ptr, 1) == 0) - header->flags |= MAD_FLAG_MPEG_2_5_EXT; - - /* ID */ - if (mad_bit_read(&stream->ptr, 1) == 0) - header->flags |= MAD_FLAG_LSF_EXT; - else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) { - stream->error = MAD_ERROR_LOSTSYNC; - return -1; - } - - /* layer */ - header->layer = 4 - mad_bit_read(&stream->ptr, 2); - - if (header->layer == 4) { - stream->error = MAD_ERROR_BADLAYER; - return -1; - } - - /* protection_bit */ - if (mad_bit_read(&stream->ptr, 1) == 0) { - header->flags |= MAD_FLAG_PROTECTION; - header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff); - } - - /* bitrate_index */ - index = mad_bit_read(&stream->ptr, 4); - - if (index == 15) { - stream->error = MAD_ERROR_BADBITRATE; - return -1; - } - - if (header->flags & MAD_FLAG_LSF_EXT) - header->bitrate = bitrate_table[3 + (header->layer >> 1)][index]; - else - header->bitrate = bitrate_table[header->layer - 1][index]; - - /* sampling_frequency */ - index = mad_bit_read(&stream->ptr, 2); - - if (index == 3) { - stream->error = MAD_ERROR_BADSAMPLERATE; - return -1; - } - - header->samplerate = samplerate_table[index]; - - if (header->flags & MAD_FLAG_LSF_EXT) { - header->samplerate /= 2; - - if (header->flags & MAD_FLAG_MPEG_2_5_EXT) - header->samplerate /= 2; - } - - /* padding_bit */ - if (mad_bit_read(&stream->ptr, 1)) - header->flags |= MAD_FLAG_PADDING; - - /* private_bit */ - if (mad_bit_read(&stream->ptr, 1)) - header->private_bits |= MAD_PRIVATE_HEADER; - - /* mode */ - header->mode = 3 - mad_bit_read(&stream->ptr, 2); - - /* mode_extension */ - header->mode_extension = mad_bit_read(&stream->ptr, 2); - - /* copyright */ - if (mad_bit_read(&stream->ptr, 1)) - header->flags |= MAD_FLAG_COPYRIGHT; - - /* original/copy */ - if (mad_bit_read(&stream->ptr, 1)) - header->flags |= MAD_FLAG_ORIGINAL; - - /* emphasis */ - header->emphasis = mad_bit_read(&stream->ptr, 2); - -# if defined(OPT_STRICT) - /* - * ISO/IEC 11172-3 says this is a reserved emphasis value, but - * streams exist which use it anyway. Since the value is not important - * to the decoder proper, we allow it unless OPT_STRICT is defined. - */ - if (header->emphasis == MAD_EMPHASIS_RESERVED) { - stream->error = MAD_ERROR_BADEMPHASIS; - return -1; - } -# endif - - /* error_check() */ - - /* crc_check */ - if (header->flags & MAD_FLAG_PROTECTION) - header->crc_target = mad_bit_read(&stream->ptr, 16); - - return 0; -} - -/* - * NAME: free_bitrate() - * DESCRIPTION: attempt to discover the bitstream's free bitrate - */ -static -int free_bitrate(struct mad_stream *stream, struct mad_header const *header) -{ - struct mad_bitptr keep_ptr; - unsigned long rate = 0; - unsigned int pad_slot, slots_per_frame; - unsigned char const *ptr = 0; - - keep_ptr = stream->ptr; - - pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; - slots_per_frame = (header->layer == MAD_LAYER_III && - (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; - - while (mad_stream_sync(stream) == 0) { - struct mad_stream peek_stream; - struct mad_header peek_header; - - peek_stream = *stream; - peek_header = *header; - - if (decode_header(&peek_header, &peek_stream) == 0 && - peek_header.layer == header->layer && - peek_header.samplerate == header->samplerate) { - unsigned int N; - - ptr = mad_bit_nextbyte(&stream->ptr); - - N = ptr - stream->this_frame; - - if (header->layer == MAD_LAYER_I) { - rate = (unsigned long) header->samplerate * - (N - 4 * pad_slot + 4) / 48 / 1000; - } - else { - rate = (unsigned long) header->samplerate * - (N - pad_slot + 1) / slots_per_frame / 1000; - } - - if (rate >= 8) - break; - } - - mad_bit_skip(&stream->ptr, 8); - } - - stream->ptr = keep_ptr; - - if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) { - stream->error = MAD_ERROR_LOSTSYNC; - return -1; - } - - stream->freerate = rate * 1000; - - return 0; -} - -/* - * NAME: header->decode() - * DESCRIPTION: read the next frame header from the stream - */ -int mad_header_decode(struct mad_header *header, struct mad_stream *stream) -{ - register unsigned char const *ptr, *end; - unsigned int pad_slot, N; - - ptr = stream->next_frame; - end = stream->bufend; - - if (ptr == 0) { - stream->error = MAD_ERROR_BUFPTR; - goto fail; - } - - /* stream skip */ - if (stream->skiplen) { - if (!stream->sync) - ptr = stream->this_frame; - - if (end - ptr < stream->skiplen) { - stream->skiplen -= end - ptr; - stream->next_frame = end; - - stream->error = MAD_ERROR_BUFLEN; - goto fail; - } - - ptr += stream->skiplen; - stream->skiplen = 0; - - stream->sync = 1; - } - - sync: - /* synchronize */ - if (stream->sync) { - if (end - ptr < MAD_BUFFER_GUARD) { - stream->next_frame = ptr; - - stream->error = MAD_ERROR_BUFLEN; - goto fail; - } - else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { - /* mark point where frame sync word was expected */ - stream->this_frame = ptr; - stream->next_frame = ptr + 1; - - stream->error = MAD_ERROR_LOSTSYNC; - goto fail; - } - } - else { - mad_bit_init(&stream->ptr, ptr); - - if (mad_stream_sync(stream) == -1) { - if (end - stream->next_frame >= MAD_BUFFER_GUARD) - stream->next_frame = end - MAD_BUFFER_GUARD; - - stream->error = MAD_ERROR_BUFLEN; - goto fail; - } - - ptr = mad_bit_nextbyte(&stream->ptr); - } - - /* begin processing */ - stream->this_frame = ptr; - stream->next_frame = ptr + 1; /* possibly bogus sync word */ - - mad_bit_init(&stream->ptr, stream->this_frame); - - if (decode_header(header, stream) == -1) - goto fail; - - /* calculate frame duration */ - mad_timer_set(&header->duration, 0, - 32 * MAD_NSBSAMPLES(header), header->samplerate); - - /* calculate free bit rate */ - if (header->bitrate == 0) { - if ((stream->freerate == 0 || !stream->sync || - (header->layer == MAD_LAYER_III && stream->freerate > 640000)) && - free_bitrate(stream, header) == -1) - goto fail; - - header->bitrate = stream->freerate; - header->flags |= MAD_FLAG_FREEFORMAT; - } - - /* calculate beginning of next frame */ - pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0; - - if (header->layer == MAD_LAYER_I) - N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4; - else { - unsigned int slots_per_frame; - - slots_per_frame = (header->layer == MAD_LAYER_III && - (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144; - - N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot; - } - - /* verify there is enough data left in buffer to decode this frame */ - if (N + MAD_BUFFER_GUARD > end - stream->this_frame) { - stream->next_frame = stream->this_frame; - - stream->error = MAD_ERROR_BUFLEN; - goto fail; - } - - stream->next_frame = stream->this_frame + N; - - if (!stream->sync) { - /* check that a valid frame header follows this frame */ - - ptr = stream->next_frame; - if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) { - ptr = stream->next_frame = stream->this_frame + 1; - goto sync; - } - - stream->sync = 1; - } - - header->flags |= MAD_FLAG_INCOMPLETE; - - return 0; - - fail: - stream->sync = 0; - - return -1; -} - -/* - * NAME: frame->decode() - * DESCRIPTION: decode a single frame from a bitstream - */ -int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream) -{ - frame->options = stream->options; - - /* header() */ - /* error_check() */ - - if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) && - mad_header_decode(&frame->header, stream) == -1) - goto fail; - - /* audio_data() */ - - frame->header.flags &= ~MAD_FLAG_INCOMPLETE; - - if (decoder_table[frame->header.layer - 1](stream, frame) == -1) { - if (!MAD_RECOVERABLE(stream->error)) - stream->next_frame = stream->this_frame; - - goto fail; - } - - /* ancillary_data() */ - - if (frame->header.layer != MAD_LAYER_III) { - struct mad_bitptr next_frame; - - mad_bit_init(&next_frame, stream->next_frame); - - stream->anc_ptr = stream->ptr; - stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame); - - mad_bit_finish(&next_frame); - } - - return 0; - - fail: - stream->anc_bitlen = 0; - return -1; -} - -/* - * NAME: frame->mute() - * DESCRIPTION: zero all subband values so the frame becomes silent - */ -void mad_frame_mute(struct mad_frame *frame) -{ - unsigned int s, sb; - - for (s = 0; s < 36; ++s) { - for (sb = 0; sb < 32; ++sb) { - frame->sbsample[0][s][sb] = - frame->sbsample[1][s][sb] = 0; - } - } - - if (frame->overlap) { - for (s = 0; s < 18; ++s) { - for (sb = 0; sb < 32; ++sb) { - (*frame->overlap)[0][sb][s] = - (*frame->overlap)[1][sb][s] = 0; - } - } - } -} diff --git a/src/lib/dl/ext/libmad/frame.h b/src/lib/dl/ext/libmad/frame.h deleted file mode 100755 index 3f5bf37e..00000000 --- a/src/lib/dl/ext/libmad/frame.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp $ - */ - -# ifndef LIBMAD_FRAME_H -# define LIBMAD_FRAME_H - -# include "fixed.h" -# include "timer.h" -# include "stream.h" - -enum mad_layer { - MAD_LAYER_I = 1, /* Layer I */ - MAD_LAYER_II = 2, /* Layer II */ - MAD_LAYER_III = 3 /* Layer III */ -}; - -enum mad_mode { - MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ - MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ - MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ - MAD_MODE_STEREO = 3 /* normal LR stereo */ -}; - -enum mad_emphasis { - MAD_EMPHASIS_NONE = 0, /* no emphasis */ - MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ - MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ - MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ -}; - -struct mad_header { - enum mad_layer layer; /* audio layer (1, 2, or 3) */ - enum mad_mode mode; /* channel mode (see above) */ - int mode_extension; /* additional mode info */ - enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ - - unsigned long bitrate; /* stream bitrate (bps) */ - unsigned int samplerate; /* sampling frequency (Hz) */ - - unsigned short crc_check; /* frame CRC accumulator */ - unsigned short crc_target; /* final target CRC checksum */ - - int flags; /* flags (see below) */ - int private_bits; /* private bits (see below) */ - - mad_timer_t duration; /* audio playing time of frame */ -}; - -struct mad_frame { - struct mad_header header; /* MPEG audio header */ - - int options; /* decoding options (from stream) */ - - mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */ - mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ -}; - -# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) -# define MAD_NSBSAMPLES(header) \ - ((header)->layer == MAD_LAYER_I ? 12 : \ - (((header)->layer == MAD_LAYER_III && \ - ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) - -enum { - MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ - MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ - - MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ - MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ - MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ - MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ - - MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ - MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ - MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ - - MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ - MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ - MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ -}; - -enum { - MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ - MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ -}; - -void mad_header_init(struct mad_header *); - -# define mad_header_finish(header) /* nothing */ - -int mad_header_decode(struct mad_header *, struct mad_stream *); - -void mad_frame_init(struct mad_frame *); -void mad_frame_finish(struct mad_frame *); - -int mad_frame_decode(struct mad_frame *, struct mad_stream *); - -void mad_frame_mute(struct mad_frame *); - -# endif diff --git a/src/lib/dl/ext/libmad/global.h b/src/lib/dl/ext/libmad/global.h deleted file mode 100755 index a6debfd8..00000000 --- a/src/lib/dl/ext/libmad/global.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: global.h,v 1.11 2004/01/23 09:41:32 rob Exp $ - */ - -# ifndef LIBMAD_GLOBAL_H -# define LIBMAD_GLOBAL_H - -/* conditional debugging */ - -# if defined(DEBUG) && defined(NDEBUG) -# error "cannot define both DEBUG and NDEBUG" -# endif - -# if defined(DEBUG) -# include <stdio.h> -# endif - -/* conditional features */ - -# if defined(OPT_SPEED) && defined(OPT_ACCURACY) -# error "cannot optimize for both speed and accuracy" -# endif - -# if defined(OPT_SPEED) && !defined(OPT_SSO) -# define OPT_SSO -# endif - -# if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \ - defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK) -# define USE_ASYNC -# endif - -# if !defined(HAVE_ASSERT_H) -# if defined(NDEBUG) -# define assert(x) /* nothing */ -# else -# define assert(x) do { if (!(x)) abort(); } while (0) -# endif -# endif - -# endif diff --git a/src/lib/dl/ext/libmad/huffman.c b/src/lib/dl/ext/libmad/huffman.c deleted file mode 100755 index a230a9c1..00000000 --- a/src/lib/dl/ext/libmad/huffman.c +++ /dev/null @@ -1,3109 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: huffman.c,v 1.10 2004/01/23 09:41:32 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include "huffman.h" - -/* - * These are the Huffman code words for Layer III. - * The data for these tables are derived from Table B.7 of ISO/IEC 11172-3. - * - * These tables support decoding up to 4 Huffman code bits at a time. - */ - -# if defined(__GNUC__) || \ - (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) -# define PTR(offs, bits) { .ptr = { 0, bits, offs } } -# define V(v, w, x, y, hlen) { .value = { 1, hlen, v, w, x, y } } -# else -# define PTR(offs, bits) { { 0, bits, offs } } -# if defined(WORDS_BIGENDIAN) -# define V(v, w, x, y, hlen) { { 1, hlen, (v << 11) | (w << 10) | \ - (x << 9) | (y << 8) } } -# else -# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \ - (x << 2) | (y << 3) } } -# endif -# endif - -static -union huffquad const hufftabA[] = { - /* 0000 */ PTR(16, 2), - /* 0001 */ PTR(20, 2), - /* 0010 */ PTR(24, 1), - /* 0011 */ PTR(26, 1), - /* 0100 */ V(0, 0, 1, 0, 4), - /* 0101 */ V(0, 0, 0, 1, 4), - /* 0110 */ V(0, 1, 0, 0, 4), - /* 0111 */ V(1, 0, 0, 0, 4), - /* 1000 */ V(0, 0, 0, 0, 1), - /* 1001 */ V(0, 0, 0, 0, 1), - /* 1010 */ V(0, 0, 0, 0, 1), - /* 1011 */ V(0, 0, 0, 0, 1), - /* 1100 */ V(0, 0, 0, 0, 1), - /* 1101 */ V(0, 0, 0, 0, 1), - /* 1110 */ V(0, 0, 0, 0, 1), - /* 1111 */ V(0, 0, 0, 0, 1), - - /* 0000 ... */ - /* 00 */ V(1, 0, 1, 1, 2), /* 16 */ - /* 01 */ V(1, 1, 1, 1, 2), - /* 10 */ V(1, 1, 0, 1, 2), - /* 11 */ V(1, 1, 1, 0, 2), - - /* 0001 ... */ - /* 00 */ V(0, 1, 1, 1, 2), /* 20 */ - /* 01 */ V(0, 1, 0, 1, 2), - /* 10 */ V(1, 0, 0, 1, 1), - /* 11 */ V(1, 0, 0, 1, 1), - - /* 0010 ... */ - /* 0 */ V(0, 1, 1, 0, 1), /* 24 */ - /* 1 */ V(0, 0, 1, 1, 1), - - /* 0011 ... */ - /* 0 */ V(1, 0, 1, 0, 1), /* 26 */ - /* 1 */ V(1, 1, 0, 0, 1) -}; - -static -union huffquad const hufftabB[] = { - /* 0000 */ V(1, 1, 1, 1, 4), - /* 0001 */ V(1, 1, 1, 0, 4), - /* 0010 */ V(1, 1, 0, 1, 4), - /* 0011 */ V(1, 1, 0, 0, 4), - /* 0100 */ V(1, 0, 1, 1, 4), - /* 0101 */ V(1, 0, 1, 0, 4), - /* 0110 */ V(1, 0, 0, 1, 4), - /* 0111 */ V(1, 0, 0, 0, 4), - /* 1000 */ V(0, 1, 1, 1, 4), - /* 1001 */ V(0, 1, 1, 0, 4), - /* 1010 */ V(0, 1, 0, 1, 4), - /* 1011 */ V(0, 1, 0, 0, 4), - /* 1100 */ V(0, 0, 1, 1, 4), - /* 1101 */ V(0, 0, 1, 0, 4), - /* 1110 */ V(0, 0, 0, 1, 4), - /* 1111 */ V(0, 0, 0, 0, 4) -}; - -# undef V -# undef PTR - -# if defined(__GNUC__) || \ - (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) -# define PTR(offs, bits) { .ptr = { 0, bits, offs } } -# define V(x, y, hlen) { .value = { 1, hlen, x, y } } -# else -# define PTR(offs, bits) { { 0, bits, offs } } -# if defined(WORDS_BIGENDIAN) -# define V(x, y, hlen) { { 1, hlen, (x << 8) | (y << 4) } } -# else -# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } } -# endif -# endif - -static -union huffpair const hufftab0[] = { - /* */ V(0, 0, 0) -}; - -static -union huffpair const hufftab1[] = { - /* 000 */ V(1, 1, 3), - /* 001 */ V(0, 1, 3), - /* 010 */ V(1, 0, 2), - /* 011 */ V(1, 0, 2), - /* 100 */ V(0, 0, 1), - /* 101 */ V(0, 0, 1), - /* 110 */ V(0, 0, 1), - /* 111 */ V(0, 0, 1) -}; - -static -union huffpair const hufftab2[] = { - /* 000 */ PTR(8, 3), - /* 001 */ V(1, 1, 3), - /* 010 */ V(0, 1, 3), - /* 011 */ V(1, 0, 3), - /* 100 */ V(0, 0, 1), - /* 101 */ V(0, 0, 1), - /* 110 */ V(0, 0, 1), - /* 111 */ V(0, 0, 1), - - /* 000 ... */ - /* 000 */ V(2, 2, 3), /* 8 */ - /* 001 */ V(0, 2, 3), - /* 010 */ V(1, 2, 2), - /* 011 */ V(1, 2, 2), - /* 100 */ V(2, 1, 2), - /* 101 */ V(2, 1, 2), - /* 110 */ V(2, 0, 2), - /* 111 */ V(2, 0, 2) -}; - -static -union huffpair const hufftab3[] = { - /* 000 */ PTR(8, 3), - /* 001 */ V(1, 0, 3), - /* 010 */ V(1, 1, 2), - /* 011 */ V(1, 1, 2), - /* 100 */ V(0, 1, 2), - /* 101 */ V(0, 1, 2), - /* 110 */ V(0, 0, 2), - /* 111 */ V(0, 0, 2), - - /* 000 ... */ - /* 000 */ V(2, 2, 3), /* 8 */ - /* 001 */ V(0, 2, 3), - /* 010 */ V(1, 2, 2), - /* 011 */ V(1, 2, 2), - /* 100 */ V(2, 1, 2), - /* 101 */ V(2, 1, 2), - /* 110 */ V(2, 0, 2), - /* 111 */ V(2, 0, 2) -}; - -static -union huffpair const hufftab5[] = { - /* 000 */ PTR(8, 4), - /* 001 */ V(1, 1, 3), - /* 010 */ V(0, 1, 3), - /* 011 */ V(1, 0, 3), - /* 100 */ V(0, 0, 1), - /* 101 */ V(0, 0, 1), - /* 110 */ V(0, 0, 1), - /* 111 */ V(0, 0, 1), - - /* 000 ... */ - /* 0000 */ PTR(24, 1), /* 8 */ - /* 0001 */ V(3, 2, 4), - /* 0010 */ V(3, 1, 3), - /* 0011 */ V(3, 1, 3), - /* 0100 */ V(1, 3, 4), - /* 0101 */ V(0, 3, 4), - /* 0110 */ V(3, 0, 4), - /* 0111 */ V(2, 2, 4), - /* 1000 */ V(1, 2, 3), - /* 1001 */ V(1, 2, 3), - /* 1010 */ V(2, 1, 3), - /* 1011 */ V(2, 1, 3), - /* 1100 */ V(0, 2, 3), - /* 1101 */ V(0, 2, 3), - /* 1110 */ V(2, 0, 3), - /* 1111 */ V(2, 0, 3), - - /* 000 0000 ... */ - /* 0 */ V(3, 3, 1), /* 24 */ - /* 1 */ V(2, 3, 1) -}; - -static -union huffpair const hufftab6[] = { - /* 0000 */ PTR(16, 3), - /* 0001 */ PTR(24, 1), - /* 0010 */ PTR(26, 1), - /* 0011 */ V(1, 2, 4), - /* 0100 */ V(2, 1, 4), - /* 0101 */ V(2, 0, 4), - /* 0110 */ V(0, 1, 3), - /* 0111 */ V(0, 1, 3), - /* 1000 */ V(1, 1, 2), - /* 1001 */ V(1, 1, 2), - /* 1010 */ V(1, 1, 2), - /* 1011 */ V(1, 1, 2), - /* 1100 */ V(1, 0, 3), - /* 1101 */ V(1, 0, 3), - /* 1110 */ V(0, 0, 3), - /* 1111 */ V(0, 0, 3), - - /* 0000 ... */ - /* 000 */ V(3, 3, 3), /* 16 */ - /* 001 */ V(0, 3, 3), - /* 010 */ V(2, 3, 2), - /* 011 */ V(2, 3, 2), - /* 100 */ V(3, 2, 2), - /* 101 */ V(3, 2, 2), - /* 110 */ V(3, 0, 2), - /* 111 */ V(3, 0, 2), - - /* 0001 ... */ - /* 0 */ V(1, 3, 1), /* 24 */ - /* 1 */ V(3, 1, 1), - - /* 0010 ... */ - /* 0 */ V(2, 2, 1), /* 26 */ - /* 1 */ V(0, 2, 1) -}; - -static -union huffpair const hufftab7[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 2), - /* 0011 */ V(1, 1, 4), - /* 0100 */ V(0, 1, 3), - /* 0101 */ V(0, 1, 3), - /* 0110 */ V(1, 0, 3), - /* 0111 */ V(1, 0, 3), - /* 1000 */ V(0, 0, 1), - /* 1001 */ V(0, 0, 1), - /* 1010 */ V(0, 0, 1), - /* 1011 */ V(0, 0, 1), - /* 1100 */ V(0, 0, 1), - /* 1101 */ V(0, 0, 1), - /* 1110 */ V(0, 0, 1), - /* 1111 */ V(0, 0, 1), - - /* 0000 ... */ - /* 0000 */ PTR(52, 2), /* 16 */ - /* 0001 */ PTR(56, 1), - /* 0010 */ PTR(58, 1), - /* 0011 */ V(1, 5, 4), - /* 0100 */ V(5, 1, 4), - /* 0101 */ PTR(60, 1), - /* 0110 */ V(5, 0, 4), - /* 0111 */ PTR(62, 1), - /* 1000 */ V(2, 4, 4), - /* 1001 */ V(4, 2, 4), - /* 1010 */ V(1, 4, 3), - /* 1011 */ V(1, 4, 3), - /* 1100 */ V(4, 1, 3), - /* 1101 */ V(4, 1, 3), - /* 1110 */ V(4, 0, 3), - /* 1111 */ V(4, 0, 3), - - /* 0001 ... */ - /* 0000 */ V(0, 4, 4), /* 32 */ - /* 0001 */ V(2, 3, 4), - /* 0010 */ V(3, 2, 4), - /* 0011 */ V(0, 3, 4), - /* 0100 */ V(1, 3, 3), - /* 0101 */ V(1, 3, 3), - /* 0110 */ V(3, 1, 3), - /* 0111 */ V(3, 1, 3), - /* 1000 */ V(3, 0, 3), - /* 1001 */ V(3, 0, 3), - /* 1010 */ V(2, 2, 3), - /* 1011 */ V(2, 2, 3), - /* 1100 */ V(1, 2, 2), - /* 1101 */ V(1, 2, 2), - /* 1110 */ V(1, 2, 2), - /* 1111 */ V(1, 2, 2), - - /* 0010 ... */ - /* 00 */ V(2, 1, 1), /* 48 */ - /* 01 */ V(2, 1, 1), - /* 10 */ V(0, 2, 2), - /* 11 */ V(2, 0, 2), - - /* 0000 0000 ... */ - /* 00 */ V(5, 5, 2), /* 52 */ - /* 01 */ V(4, 5, 2), - /* 10 */ V(5, 4, 2), - /* 11 */ V(5, 3, 2), - - /* 0000 0001 ... */ - /* 0 */ V(3, 5, 1), /* 56 */ - /* 1 */ V(4, 4, 1), - - /* 0000 0010 ... */ - /* 0 */ V(2, 5, 1), /* 58 */ - /* 1 */ V(5, 2, 1), - - /* 0000 0101 ... */ - /* 0 */ V(0, 5, 1), /* 60 */ - /* 1 */ V(3, 4, 1), - - /* 0000 0111 ... */ - /* 0 */ V(4, 3, 1), /* 62 */ - /* 1 */ V(3, 3, 1) -}; - -# if 0 -/* this version saves 8 entries (16 bytes) at the expense of - an extra lookup in 4 out of 36 cases */ -static -union huffpair const hufftab8[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 2), - /* 0010 */ V(1, 2, 4), - /* 0011 */ V(2, 1, 4), - /* 0100 */ V(1, 1, 2), - /* 0101 */ V(1, 1, 2), - /* 0110 */ V(1, 1, 2), - /* 0111 */ V(1, 1, 2), - /* 1000 */ V(0, 1, 3), - /* 1001 */ V(0, 1, 3), - /* 1010 */ V(1, 0, 3), - /* 1011 */ V(1, 0, 3), - /* 1100 */ V(0, 0, 2), - /* 1101 */ V(0, 0, 2), - /* 1110 */ V(0, 0, 2), - /* 1111 */ V(0, 0, 2), - - /* 0000 ... */ - /* 0000 */ PTR(36, 3), /* 16 */ - /* 0001 */ PTR(44, 2), - /* 0010 */ PTR(48, 1), - /* 0011 */ V(1, 5, 4), - /* 0100 */ V(5, 1, 4), - /* 0101 */ PTR(50, 1), - /* 0110 */ PTR(52, 1), - /* 0111 */ V(2, 4, 4), - /* 1000 */ V(4, 2, 4), - /* 1001 */ V(1, 4, 4), - /* 1010 */ V(4, 1, 3), - /* 1011 */ V(4, 1, 3), - /* 1100 */ V(0, 4, 4), - /* 1101 */ V(4, 0, 4), - /* 1110 */ V(2, 3, 4), - /* 1111 */ V(3, 2, 4), - - /* 0001 ... */ - /* 00 */ PTR(54, 2), /* 32 */ - /* 01 */ V(2, 2, 2), - /* 10 */ V(0, 2, 2), - /* 11 */ V(2, 0, 2), - - /* 0000 0000 ... */ - /* 000 */ V(5, 5, 3), /* 36 */ - /* 001 */ V(5, 4, 3), - /* 010 */ V(4, 5, 2), - /* 011 */ V(4, 5, 2), - /* 100 */ V(5, 3, 1), - /* 101 */ V(5, 3, 1), - /* 110 */ V(5, 3, 1), - /* 111 */ V(5, 3, 1), - - /* 0000 0001 ... */ - /* 00 */ V(3, 5, 2), /* 44 */ - /* 01 */ V(4, 4, 2), - /* 10 */ V(2, 5, 1), - /* 11 */ V(2, 5, 1), - - /* 0000 0010 ... */ - /* 0 */ V(5, 2, 1), /* 48 */ - /* 1 */ V(0, 5, 1), - - /* 0000 0101 ... */ - /* 0 */ V(3, 4, 1), /* 50 */ - /* 1 */ V(4, 3, 1), - - /* 0000 0110 ... */ - /* 0 */ V(5, 0, 1), /* 52 */ - /* 1 */ V(3, 3, 1), - - /* 0001 00 ... */ - /* 00 */ V(1, 3, 2), /* 54 */ - /* 01 */ V(3, 1, 2), - /* 10 */ V(0, 3, 2), - /* 11 */ V(3, 0, 2), -}; -# else -static -union huffpair const hufftab8[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ V(1, 2, 4), - /* 0011 */ V(2, 1, 4), - /* 0100 */ V(1, 1, 2), - /* 0101 */ V(1, 1, 2), - /* 0110 */ V(1, 1, 2), - /* 0111 */ V(1, 1, 2), - /* 1000 */ V(0, 1, 3), - /* 1001 */ V(0, 1, 3), - /* 1010 */ V(1, 0, 3), - /* 1011 */ V(1, 0, 3), - /* 1100 */ V(0, 0, 2), - /* 1101 */ V(0, 0, 2), - /* 1110 */ V(0, 0, 2), - /* 1111 */ V(0, 0, 2), - - /* 0000 ... */ - /* 0000 */ PTR(48, 3), /* 16 */ - /* 0001 */ PTR(56, 2), - /* 0010 */ PTR(60, 1), - /* 0011 */ V(1, 5, 4), - /* 0100 */ V(5, 1, 4), - /* 0101 */ PTR(62, 1), - /* 0110 */ PTR(64, 1), - /* 0111 */ V(2, 4, 4), - /* 1000 */ V(4, 2, 4), - /* 1001 */ V(1, 4, 4), - /* 1010 */ V(4, 1, 3), - /* 1011 */ V(4, 1, 3), - /* 1100 */ V(0, 4, 4), - /* 1101 */ V(4, 0, 4), - /* 1110 */ V(2, 3, 4), - /* 1111 */ V(3, 2, 4), - - /* 0001 ... */ - /* 0000 */ V(1, 3, 4), /* 32 */ - /* 0001 */ V(3, 1, 4), - /* 0010 */ V(0, 3, 4), - /* 0011 */ V(3, 0, 4), - /* 0100 */ V(2, 2, 2), - /* 0101 */ V(2, 2, 2), - /* 0110 */ V(2, 2, 2), - /* 0111 */ V(2, 2, 2), - /* 1000 */ V(0, 2, 2), - /* 1001 */ V(0, 2, 2), - /* 1010 */ V(0, 2, 2), - /* 1011 */ V(0, 2, 2), - /* 1100 */ V(2, 0, 2), - /* 1101 */ V(2, 0, 2), - /* 1110 */ V(2, 0, 2), - /* 1111 */ V(2, 0, 2), - - /* 0000 0000 ... */ - /* 000 */ V(5, 5, 3), /* 48 */ - /* 001 */ V(5, 4, 3), - /* 010 */ V(4, 5, 2), - /* 011 */ V(4, 5, 2), - /* 100 */ V(5, 3, 1), - /* 101 */ V(5, 3, 1), - /* 110 */ V(5, 3, 1), - /* 111 */ V(5, 3, 1), - - /* 0000 0001 ... */ - /* 00 */ V(3, 5, 2), /* 56 */ - /* 01 */ V(4, 4, 2), - /* 10 */ V(2, 5, 1), - /* 11 */ V(2, 5, 1), - - /* 0000 0010 ... */ - /* 0 */ V(5, 2, 1), /* 60 */ - /* 1 */ V(0, 5, 1), - - /* 0000 0101 ... */ - /* 0 */ V(3, 4, 1), /* 62 */ - /* 1 */ V(4, 3, 1), - - /* 0000 0110 ... */ - /* 0 */ V(5, 0, 1), /* 64 */ - /* 1 */ V(3, 3, 1) -}; -# endif - -static -union huffpair const hufftab9[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 3), - /* 0010 */ PTR(40, 2), - /* 0011 */ PTR(44, 2), - /* 0100 */ PTR(48, 1), - /* 0101 */ V(1, 2, 4), - /* 0110 */ V(2, 1, 4), - /* 0111 */ V(2, 0, 4), - /* 1000 */ V(1, 1, 3), - /* 1001 */ V(1, 1, 3), - /* 1010 */ V(0, 1, 3), - /* 1011 */ V(0, 1, 3), - /* 1100 */ V(1, 0, 3), - /* 1101 */ V(1, 0, 3), - /* 1110 */ V(0, 0, 3), - /* 1111 */ V(0, 0, 3), - - /* 0000 ... */ - /* 0000 */ PTR(50, 1), /* 16 */ - /* 0001 */ V(3, 5, 4), - /* 0010 */ V(5, 3, 4), - /* 0011 */ PTR(52, 1), - /* 0100 */ V(4, 4, 4), - /* 0101 */ V(2, 5, 4), - /* 0110 */ V(5, 2, 4), - /* 0111 */ V(1, 5, 4), - /* 1000 */ V(5, 1, 3), - /* 1001 */ V(5, 1, 3), - /* 1010 */ V(3, 4, 3), - /* 1011 */ V(3, 4, 3), - /* 1100 */ V(4, 3, 3), - /* 1101 */ V(4, 3, 3), - /* 1110 */ V(5, 0, 4), - /* 1111 */ V(0, 4, 4), - - /* 0001 ... */ - /* 000 */ V(2, 4, 3), /* 32 */ - /* 001 */ V(4, 2, 3), - /* 010 */ V(3, 3, 3), - /* 011 */ V(4, 0, 3), - /* 100 */ V(1, 4, 2), - /* 101 */ V(1, 4, 2), - /* 110 */ V(4, 1, 2), - /* 111 */ V(4, 1, 2), - - /* 0010 ... */ - /* 00 */ V(2, 3, 2), /* 40 */ - /* 01 */ V(3, 2, 2), - /* 10 */ V(1, 3, 1), - /* 11 */ V(1, 3, 1), - - /* 0011 ... */ - /* 00 */ V(3, 1, 1), /* 44 */ - /* 01 */ V(3, 1, 1), - /* 10 */ V(0, 3, 2), - /* 11 */ V(3, 0, 2), - - /* 0100 ... */ - /* 0 */ V(2, 2, 1), /* 48 */ - /* 1 */ V(0, 2, 1), - - /* 0000 0000 ... */ - /* 0 */ V(5, 5, 1), /* 50 */ - /* 1 */ V(4, 5, 1), - - /* 0000 0011 ... */ - /* 0 */ V(5, 4, 1), /* 52 */ - /* 1 */ V(0, 5, 1) -}; - -static -union huffpair const hufftab10[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 2), - /* 0011 */ V(1, 1, 4), - /* 0100 */ V(0, 1, 3), - /* 0101 */ V(0, 1, 3), - /* 0110 */ V(1, 0, 3), - /* 0111 */ V(1, 0, 3), - /* 1000 */ V(0, 0, 1), - /* 1001 */ V(0, 0, 1), - /* 1010 */ V(0, 0, 1), - /* 1011 */ V(0, 0, 1), - /* 1100 */ V(0, 0, 1), - /* 1101 */ V(0, 0, 1), - /* 1110 */ V(0, 0, 1), - /* 1111 */ V(0, 0, 1), - - /* 0000 ... */ - /* 0000 */ PTR(52, 3), /* 16 */ - /* 0001 */ PTR(60, 2), - /* 0010 */ PTR(64, 3), - /* 0011 */ PTR(72, 1), - /* 0100 */ PTR(74, 2), - /* 0101 */ PTR(78, 2), - /* 0110 */ PTR(82, 2), - /* 0111 */ V(1, 7, 4), - /* 1000 */ V(7, 1, 4), - /* 1001 */ PTR(86, 1), - /* 1010 */ PTR(88, 2), - /* 1011 */ PTR(92, 2), - /* 1100 */ V(1, 6, 4), - /* 1101 */ V(6, 1, 4), - /* 1110 */ V(6, 0, 4), - /* 1111 */ PTR(96, 1), - - /* 0001 ... */ - /* 0000 */ PTR(98, 1), /* 32 */ - /* 0001 */ PTR(100, 1), - /* 0010 */ V(1, 4, 4), - /* 0011 */ V(4, 1, 4), - /* 0100 */ V(4, 0, 4), - /* 0101 */ V(2, 3, 4), - /* 0110 */ V(3, 2, 4), - /* 0111 */ V(0, 3, 4), - /* 1000 */ V(1, 3, 3), - /* 1001 */ V(1, 3, 3), - /* 1010 */ V(3, 1, 3), - /* 1011 */ V(3, 1, 3), - /* 1100 */ V(3, 0, 3), - /* 1101 */ V(3, 0, 3), - /* 1110 */ V(2, 2, 3), - /* 1111 */ V(2, 2, 3), - - /* 0010 ... */ - /* 00 */ V(1, 2, 2), /* 48 */ - /* 01 */ V(2, 1, 2), - /* 10 */ V(0, 2, 2), - /* 11 */ V(2, 0, 2), - - /* 0000 0000 ... */ - /* 000 */ V(7, 7, 3), /* 52 */ - /* 001 */ V(6, 7, 3), - /* 010 */ V(7, 6, 3), - /* 011 */ V(5, 7, 3), - /* 100 */ V(7, 5, 3), - /* 101 */ V(6, 6, 3), - /* 110 */ V(4, 7, 2), - /* 111 */ V(4, 7, 2), - - /* 0000 0001 ... */ - /* 00 */ V(7, 4, 2), /* 60 */ - /* 01 */ V(5, 6, 2), - /* 10 */ V(6, 5, 2), - /* 11 */ V(3, 7, 2), - - /* 0000 0010 ... */ - /* 000 */ V(7, 3, 2), /* 64 */ - /* 001 */ V(7, 3, 2), - /* 010 */ V(4, 6, 2), - /* 011 */ V(4, 6, 2), - /* 100 */ V(5, 5, 3), - /* 101 */ V(5, 4, 3), - /* 110 */ V(6, 3, 2), - /* 111 */ V(6, 3, 2), - - /* 0000 0011 ... */ - /* 0 */ V(2, 7, 1), /* 72 */ - /* 1 */ V(7, 2, 1), - - /* 0000 0100 ... */ - /* 00 */ V(6, 4, 2), /* 74 */ - /* 01 */ V(0, 7, 2), - /* 10 */ V(7, 0, 1), - /* 11 */ V(7, 0, 1), - - /* 0000 0101 ... */ - /* 00 */ V(6, 2, 1), /* 78 */ - /* 01 */ V(6, 2, 1), - /* 10 */ V(4, 5, 2), - /* 11 */ V(3, 5, 2), - - /* 0000 0110 ... */ - /* 00 */ V(0, 6, 1), /* 82 */ - /* 01 */ V(0, 6, 1), - /* 10 */ V(5, 3, 2), - /* 11 */ V(4, 4, 2), - - /* 0000 1001 ... */ - /* 0 */ V(3, 6, 1), /* 86 */ - /* 1 */ V(2, 6, 1), - - /* 0000 1010 ... */ - /* 00 */ V(2, 5, 2), /* 88 */ - /* 01 */ V(5, 2, 2), - /* 10 */ V(1, 5, 1), - /* 11 */ V(1, 5, 1), - - /* 0000 1011 ... */ - /* 00 */ V(5, 1, 1), /* 92 */ - /* 01 */ V(5, 1, 1), - /* 10 */ V(3, 4, 2), - /* 11 */ V(4, 3, 2), - - /* 0000 1111 ... */ - /* 0 */ V(0, 5, 1), /* 96 */ - /* 1 */ V(5, 0, 1), - - /* 0001 0000 ... */ - /* 0 */ V(2, 4, 1), /* 98 */ - /* 1 */ V(4, 2, 1), - - /* 0001 0001 ... */ - /* 0 */ V(3, 3, 1), /* 100 */ - /* 1 */ V(0, 4, 1) -}; - -static -union huffpair const hufftab11[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 4), - /* 0011 */ PTR(64, 3), - /* 0100 */ V(1, 2, 4), - /* 0101 */ PTR(72, 1), - /* 0110 */ V(1, 1, 3), - /* 0111 */ V(1, 1, 3), - /* 1000 */ V(0, 1, 3), - /* 1001 */ V(0, 1, 3), - /* 1010 */ V(1, 0, 3), - /* 1011 */ V(1, 0, 3), - /* 1100 */ V(0, 0, 2), - /* 1101 */ V(0, 0, 2), - /* 1110 */ V(0, 0, 2), - /* 1111 */ V(0, 0, 2), - - /* 0000 ... */ - /* 0000 */ PTR(74, 2), /* 16 */ - /* 0001 */ PTR(78, 3), - /* 0010 */ PTR(86, 2), - /* 0011 */ PTR(90, 1), - /* 0100 */ PTR(92, 2), - /* 0101 */ V(2, 7, 4), - /* 0110 */ V(7, 2, 4), - /* 0111 */ PTR(96, 1), - /* 1000 */ V(7, 1, 3), - /* 1001 */ V(7, 1, 3), - /* 1010 */ V(1, 7, 4), - /* 1011 */ V(7, 0, 4), - /* 1100 */ V(3, 6, 4), - /* 1101 */ V(6, 3, 4), - /* 1110 */ V(6, 0, 4), - /* 1111 */ PTR(98, 1), - - /* 0001 ... */ - /* 0000 */ PTR(100, 1), /* 32 */ - /* 0001 */ V(1, 5, 4), - /* 0010 */ V(6, 2, 3), - /* 0011 */ V(6, 2, 3), - /* 0100 */ V(2, 6, 4), - /* 0101 */ V(0, 6, 4), - /* 0110 */ V(1, 6, 3), - /* 0111 */ V(1, 6, 3), - /* 1000 */ V(6, 1, 3), - /* 1001 */ V(6, 1, 3), - /* 1010 */ V(5, 1, 4), - /* 1011 */ V(3, 4, 4), - /* 1100 */ V(5, 0, 4), - /* 1101 */ PTR(102, 1), - /* 1110 */ V(2, 4, 4), - /* 1111 */ V(4, 2, 4), - - /* 0010 ... */ - /* 0000 */ V(1, 4, 4), /* 48 */ - /* 0001 */ V(4, 1, 4), - /* 0010 */ V(0, 4, 4), - /* 0011 */ V(4, 0, 4), - /* 0100 */ V(2, 3, 3), - /* 0101 */ V(2, 3, 3), - /* 0110 */ V(3, 2, 3), - /* 0111 */ V(3, 2, 3), - /* 1000 */ V(1, 3, 2), - /* 1001 */ V(1, 3, 2), - /* 1010 */ V(1, 3, 2), - /* 1011 */ V(1, 3, 2), - /* 1100 */ V(3, 1, 2), - /* 1101 */ V(3, 1, 2), - /* 1110 */ V(3, 1, 2), - /* 1111 */ V(3, 1, 2), - - /* 0011 ... */ - /* 000 */ V(0, 3, 3), /* 64 */ - /* 001 */ V(3, 0, 3), - /* 010 */ V(2, 2, 2), - /* 011 */ V(2, 2, 2), - /* 100 */ V(2, 1, 1), - /* 101 */ V(2, 1, 1), - /* 110 */ V(2, 1, 1), - /* 111 */ V(2, 1, 1), - - /* 0101 ... */ - /* 0 */ V(0, 2, 1), /* 72 */ - /* 1 */ V(2, 0, 1), - - /* 0000 0000 ... */ - /* 00 */ V(7, 7, 2), /* 74 */ - /* 01 */ V(6, 7, 2), - /* 10 */ V(7, 6, 2), - /* 11 */ V(7, 5, 2), - - /* 0000 0001 ... */ - /* 000 */ V(6, 6, 2), /* 78 */ - /* 001 */ V(6, 6, 2), - /* 010 */ V(4, 7, 2), - /* 011 */ V(4, 7, 2), - /* 100 */ V(7, 4, 2), - /* 101 */ V(7, 4, 2), - /* 110 */ V(5, 7, 3), - /* 111 */ V(5, 5, 3), - - /* 0000 0010 ... */ - /* 00 */ V(5, 6, 2), /* 86 */ - /* 01 */ V(6, 5, 2), - /* 10 */ V(3, 7, 1), - /* 11 */ V(3, 7, 1), - - /* 0000 0011 ... */ - /* 0 */ V(7, 3, 1), /* 90 */ - /* 1 */ V(4, 6, 1), - - /* 0000 0100 ... */ - /* 00 */ V(4, 5, 2), /* 92 */ - /* 01 */ V(5, 4, 2), - /* 10 */ V(3, 5, 2), - /* 11 */ V(5, 3, 2), - - /* 0000 0111 ... */ - /* 0 */ V(6, 4, 1), /* 96 */ - /* 1 */ V(0, 7, 1), - - /* 0000 1111 ... */ - /* 0 */ V(4, 4, 1), /* 98 */ - /* 1 */ V(2, 5, 1), - - /* 0001 0000 ... */ - /* 0 */ V(5, 2, 1), /* 100 */ - /* 1 */ V(0, 5, 1), - - /* 0001 1101 ... */ - /* 0 */ V(4, 3, 1), /* 102 */ - /* 1 */ V(3, 3, 1) -}; - -static -union huffpair const hufftab12[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 4), - /* 0011 */ PTR(64, 2), - /* 0100 */ PTR(68, 3), - /* 0101 */ PTR(76, 1), - /* 0110 */ V(1, 2, 4), - /* 0111 */ V(2, 1, 4), - /* 1000 */ PTR(78, 1), - /* 1001 */ V(0, 0, 4), - /* 1010 */ V(1, 1, 3), - /* 1011 */ V(1, 1, 3), - /* 1100 */ V(0, 1, 3), - /* 1101 */ V(0, 1, 3), - /* 1110 */ V(1, 0, 3), - /* 1111 */ V(1, 0, 3), - - /* 0000 ... */ - /* 0000 */ PTR(80, 2), /* 16 */ - /* 0001 */ PTR(84, 1), - /* 0010 */ PTR(86, 1), - /* 0011 */ PTR(88, 1), - /* 0100 */ V(5, 6, 4), - /* 0101 */ V(3, 7, 4), - /* 0110 */ PTR(90, 1), - /* 0111 */ V(2, 7, 4), - /* 1000 */ V(7, 2, 4), - /* 1001 */ V(4, 6, 4), - /* 1010 */ V(6, 4, 4), - /* 1011 */ V(1, 7, 4), - /* 1100 */ V(7, 1, 4), - /* 1101 */ PTR(92, 1), - /* 1110 */ V(3, 6, 4), - /* 1111 */ V(6, 3, 4), - - /* 0001 ... */ - /* 0000 */ V(4, 5, 4), /* 32 */ - /* 0001 */ V(5, 4, 4), - /* 0010 */ V(4, 4, 4), - /* 0011 */ PTR(94, 1), - /* 0100 */ V(2, 6, 3), - /* 0101 */ V(2, 6, 3), - /* 0110 */ V(6, 2, 3), - /* 0111 */ V(6, 2, 3), - /* 1000 */ V(6, 1, 3), - /* 1001 */ V(6, 1, 3), - /* 1010 */ V(1, 6, 4), - /* 1011 */ V(6, 0, 4), - /* 1100 */ V(3, 5, 4), - /* 1101 */ V(5, 3, 4), - /* 1110 */ V(2, 5, 4), - /* 1111 */ V(5, 2, 4), - - /* 0010 ... */ - /* 0000 */ V(1, 5, 3), /* 48 */ - /* 0001 */ V(1, 5, 3), - /* 0010 */ V(5, 1, 3), - /* 0011 */ V(5, 1, 3), - /* 0100 */ V(3, 4, 3), - /* 0101 */ V(3, 4, 3), - /* 0110 */ V(4, 3, 3), - /* 0111 */ V(4, 3, 3), - /* 1000 */ V(5, 0, 4), - /* 1001 */ V(0, 4, 4), - /* 1010 */ V(2, 4, 3), - /* 1011 */ V(2, 4, 3), - /* 1100 */ V(4, 2, 3), - /* 1101 */ V(4, 2, 3), - /* 1110 */ V(1, 4, 3), - /* 1111 */ V(1, 4, 3), - - /* 0011 ... */ - /* 00 */ V(3, 3, 2), /* 64 */ - /* 01 */ V(4, 1, 2), - /* 10 */ V(2, 3, 2), - /* 11 */ V(3, 2, 2), - - /* 0100 ... */ - /* 000 */ V(4, 0, 3), /* 68 */ - /* 001 */ V(0, 3, 3), - /* 010 */ V(3, 0, 2), - /* 011 */ V(3, 0, 2), - /* 100 */ V(1, 3, 1), - /* 101 */ V(1, 3, 1), - /* 110 */ V(1, 3, 1), - /* 111 */ V(1, 3, 1), - - /* 0101 ... */ - /* 0 */ V(3, 1, 1), /* 76 */ - /* 1 */ V(2, 2, 1), - - /* 1000 ... */ - /* 0 */ V(0, 2, 1), /* 78 */ - /* 1 */ V(2, 0, 1), - - /* 0000 0000 ... */ - /* 00 */ V(7, 7, 2), /* 80 */ - /* 01 */ V(6, 7, 2), - /* 10 */ V(7, 6, 1), - /* 11 */ V(7, 6, 1), - - /* 0000 0001 ... */ - /* 0 */ V(5, 7, 1), /* 84 */ - /* 1 */ V(7, 5, 1), - - /* 0000 0010 ... */ - /* 0 */ V(6, 6, 1), /* 86 */ - /* 1 */ V(4, 7, 1), - - /* 0000 0011 ... */ - /* 0 */ V(7, 4, 1), /* 88 */ - /* 1 */ V(6, 5, 1), - - /* 0000 0110 ... */ - /* 0 */ V(7, 3, 1), /* 90 */ - /* 1 */ V(5, 5, 1), - - /* 0000 1101 ... */ - /* 0 */ V(0, 7, 1), /* 92 */ - /* 1 */ V(7, 0, 1), - - /* 0001 0011 ... */ - /* 0 */ V(0, 6, 1), /* 94 */ - /* 1 */ V(0, 5, 1) -}; - -static -union huffpair const hufftab13[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 4), - /* 0011 */ PTR(64, 2), - /* 0100 */ V(1, 1, 4), - /* 0101 */ V(0, 1, 4), - /* 0110 */ V(1, 0, 3), - /* 0111 */ V(1, 0, 3), - /* 1000 */ V(0, 0, 1), - /* 1001 */ V(0, 0, 1), - /* 1010 */ V(0, 0, 1), - /* 1011 */ V(0, 0, 1), - /* 1100 */ V(0, 0, 1), - /* 1101 */ V(0, 0, 1), - /* 1110 */ V(0, 0, 1), - /* 1111 */ V(0, 0, 1), - - /* 0000 ... */ - /* 0000 */ PTR(68, 4), /* 16 */ - /* 0001 */ PTR(84, 4), - /* 0010 */ PTR(100, 4), - /* 0011 */ PTR(116, 4), - /* 0100 */ PTR(132, 4), - /* 0101 */ PTR(148, 4), - /* 0110 */ PTR(164, 3), - /* 0111 */ PTR(172, 3), - /* 1000 */ PTR(180, 3), - /* 1001 */ PTR(188, 3), - /* 1010 */ PTR(196, 3), - /* 1011 */ PTR(204, 3), - /* 1100 */ PTR(212, 1), - /* 1101 */ PTR(214, 2), - /* 1110 */ PTR(218, 3), - /* 1111 */ PTR(226, 1), - - /* 0001 ... */ - /* 0000 */ PTR(228, 2), /* 32 */ - /* 0001 */ PTR(232, 2), - /* 0010 */ PTR(236, 2), - /* 0011 */ PTR(240, 2), - /* 0100 */ V(8, 1, 4), - /* 0101 */ PTR(244, 1), - /* 0110 */ PTR(246, 1), - /* 0111 */ PTR(248, 1), - /* 1000 */ PTR(250, 2), - /* 1001 */ PTR(254, 1), - /* 1010 */ V(1, 5, 4), - /* 1011 */ V(5, 1, 4), - /* 1100 */ PTR(256, 1), - /* 1101 */ PTR(258, 1), - /* 1110 */ PTR(260, 1), - /* 1111 */ V(1, 4, 4), - - /* 0010 ... */ - /* 0000 */ V(4, 1, 3), /* 48 */ - /* 0001 */ V(4, 1, 3), - /* 0010 */ V(0, 4, 4), - /* 0011 */ V(4, 0, 4), - /* 0100 */ V(2, 3, 4), - /* 0101 */ V(3, 2, 4), - /* 0110 */ V(1, 3, 3), - /* 0111 */ V(1, 3, 3), - /* 1000 */ V(3, 1, 3), - /* 1001 */ V(3, 1, 3), - /* 1010 */ V(0, 3, 3), - /* 1011 */ V(0, 3, 3), - /* 1100 */ V(3, 0, 3), - /* 1101 */ V(3, 0, 3), - /* 1110 */ V(2, 2, 3), - /* 1111 */ V(2, 2, 3), - - /* 0011 ... */ - /* 00 */ V(1, 2, 2), /* 64 */ - /* 01 */ V(2, 1, 2), - /* 10 */ V(0, 2, 2), - /* 11 */ V(2, 0, 2), - - /* 0000 0000 ... */ - /* 0000 */ PTR(262, 4), /* 68 */ - /* 0001 */ PTR(278, 4), - /* 0010 */ PTR(294, 4), - /* 0011 */ PTR(310, 3), - /* 0100 */ PTR(318, 2), - /* 0101 */ PTR(322, 2), - /* 0110 */ PTR(326, 3), - /* 0111 */ PTR(334, 2), - /* 1000 */ PTR(338, 1), - /* 1001 */ PTR(340, 2), - /* 1010 */ PTR(344, 2), - /* 1011 */ PTR(348, 2), - /* 1100 */ PTR(352, 2), - /* 1101 */ PTR(356, 2), - /* 1110 */ V(1, 15, 4), - /* 1111 */ V(15, 1, 4), - - /* 0000 0001 ... */ - /* 0000 */ V(15, 0, 4), /* 84 */ - /* 0001 */ PTR(360, 1), - /* 0010 */ PTR(362, 1), - /* 0011 */ PTR(364, 1), - /* 0100 */ V(14, 2, 4), - /* 0101 */ PTR(366, 1), - /* 0110 */ V(1, 14, 4), - /* 0111 */ V(14, 1, 4), - /* 1000 */ PTR(368, 1), - /* 1001 */ PTR(370, 1), - /* 1010 */ PTR(372, 1), - /* 1011 */ PTR(374, 1), - /* 1100 */ PTR(376, 1), - /* 1101 */ PTR(378, 1), - /* 1110 */ V(12, 6, 4), - /* 1111 */ V(3, 13, 4), - - /* 0000 0010 ... */ - /* 0000 */ PTR(380, 1), /* 100 */ - /* 0001 */ V(2, 13, 4), - /* 0010 */ V(13, 2, 4), - /* 0011 */ V(1, 13, 4), - /* 0100 */ V(11, 7, 4), - /* 0101 */ PTR(382, 1), - /* 0110 */ PTR(384, 1), - /* 0111 */ V(12, 3, 4), - /* 1000 */ PTR(386, 1), - /* 1001 */ V(4, 11, 4), - /* 1010 */ V(13, 1, 3), - /* 1011 */ V(13, 1, 3), - /* 1100 */ V(0, 13, 4), - /* 1101 */ V(13, 0, 4), - /* 1110 */ V(8, 10, 4), - /* 1111 */ V(10, 8, 4), - - /* 0000 0011 ... */ - /* 0000 */ V(4, 12, 4), /* 116 */ - /* 0001 */ V(12, 4, 4), - /* 0010 */ V(6, 11, 4), - /* 0011 */ V(11, 6, 4), - /* 0100 */ V(3, 12, 3), - /* 0101 */ V(3, 12, 3), - /* 0110 */ V(2, 12, 3), - /* 0111 */ V(2, 12, 3), - /* 1000 */ V(12, 2, 3), - /* 1001 */ V(12, 2, 3), - /* 1010 */ V(5, 11, 3), - /* 1011 */ V(5, 11, 3), - /* 1100 */ V(11, 5, 4), - /* 1101 */ V(8, 9, 4), - /* 1110 */ V(1, 12, 3), - /* 1111 */ V(1, 12, 3), - - /* 0000 0100 ... */ - /* 0000 */ V(12, 1, 3), /* 132 */ - /* 0001 */ V(12, 1, 3), - /* 0010 */ V(9, 8, 4), - /* 0011 */ V(0, 12, 4), - /* 0100 */ V(12, 0, 3), - /* 0101 */ V(12, 0, 3), - /* 0110 */ V(11, 4, 4), - /* 0111 */ V(6, 10, 4), - /* 1000 */ V(10, 6, 4), - /* 1001 */ V(7, 9, 4), - /* 1010 */ V(3, 11, 3), - /* 1011 */ V(3, 11, 3), - /* 1100 */ V(11, 3, 3), - /* 1101 */ V(11, 3, 3), - /* 1110 */ V(8, 8, 4), - /* 1111 */ V(5, 10, 4), - - /* 0000 0101 ... */ - /* 0000 */ V(2, 11, 3), /* 148 */ - /* 0001 */ V(2, 11, 3), - /* 0010 */ V(10, 5, 4), - /* 0011 */ V(6, 9, 4), - /* 0100 */ V(10, 4, 3), - /* 0101 */ V(10, 4, 3), - /* 0110 */ V(7, 8, 4), - /* 0111 */ V(8, 7, 4), - /* 1000 */ V(9, 4, 3), - /* 1001 */ V(9, 4, 3), - /* 1010 */ V(7, 7, 4), - /* 1011 */ V(7, 6, 4), - /* 1100 */ V(11, 2, 2), - /* 1101 */ V(11, 2, 2), - /* 1110 */ V(11, 2, 2), - /* 1111 */ V(11, 2, 2), - - /* 0000 0110 ... */ - /* 000 */ V(1, 11, 2), /* 164 */ - /* 001 */ V(1, 11, 2), - /* 010 */ V(11, 1, 2), - /* 011 */ V(11, 1, 2), - /* 100 */ V(0, 11, 3), - /* 101 */ V(11, 0, 3), - /* 110 */ V(9, 6, 3), - /* 111 */ V(4, 10, 3), - - /* 0000 0111 ... */ - /* 000 */ V(3, 10, 3), /* 172 */ - /* 001 */ V(10, 3, 3), - /* 010 */ V(5, 9, 3), - /* 011 */ V(9, 5, 3), - /* 100 */ V(2, 10, 2), - /* 101 */ V(2, 10, 2), - /* 110 */ V(10, 2, 2), - /* 111 */ V(10, 2, 2), - - /* 0000 1000 ... */ - /* 000 */ V(1, 10, 2), /* 180 */ - /* 001 */ V(1, 10, 2), - /* 010 */ V(10, 1, 2), - /* 011 */ V(10, 1, 2), - /* 100 */ V(0, 10, 3), - /* 101 */ V(6, 8, 3), - /* 110 */ V(10, 0, 2), - /* 111 */ V(10, 0, 2), - - /* 0000 1001 ... */ - /* 000 */ V(8, 6, 3), /* 188 */ - /* 001 */ V(4, 9, 3), - /* 010 */ V(9, 3, 2), - /* 011 */ V(9, 3, 2), - /* 100 */ V(3, 9, 3), - /* 101 */ V(5, 8, 3), - /* 110 */ V(8, 5, 3), - /* 111 */ V(6, 7, 3), - - /* 0000 1010 ... */ - /* 000 */ V(2, 9, 2), /* 196 */ - /* 001 */ V(2, 9, 2), - /* 010 */ V(9, 2, 2), - /* 011 */ V(9, 2, 2), - /* 100 */ V(5, 7, 3), - /* 101 */ V(7, 5, 3), - /* 110 */ V(3, 8, 2), - /* 111 */ V(3, 8, 2), - - /* 0000 1011 ... */ - /* 000 */ V(8, 3, 2), /* 204 */ - /* 001 */ V(8, 3, 2), - /* 010 */ V(6, 6, 3), - /* 011 */ V(4, 7, 3), - /* 100 */ V(7, 4, 3), - /* 101 */ V(5, 6, 3), - /* 110 */ V(6, 5, 3), - /* 111 */ V(7, 3, 3), - - /* 0000 1100 ... */ - /* 0 */ V(1, 9, 1), /* 212 */ - /* 1 */ V(9, 1, 1), - - /* 0000 1101 ... */ - /* 00 */ V(0, 9, 2), /* 214 */ - /* 01 */ V(9, 0, 2), - /* 10 */ V(4, 8, 2), - /* 11 */ V(8, 4, 2), - - /* 0000 1110 ... */ - /* 000 */ V(7, 2, 2), /* 218 */ - /* 001 */ V(7, 2, 2), - /* 010 */ V(4, 6, 3), - /* 011 */ V(6, 4, 3), - /* 100 */ V(2, 8, 1), - /* 101 */ V(2, 8, 1), - /* 110 */ V(2, 8, 1), - /* 111 */ V(2, 8, 1), - - /* 0000 1111 ... */ - /* 0 */ V(8, 2, 1), /* 226 */ - /* 1 */ V(1, 8, 1), - - /* 0001 0000 ... */ - /* 00 */ V(3, 7, 2), /* 228 */ - /* 01 */ V(2, 7, 2), - /* 10 */ V(1, 7, 1), - /* 11 */ V(1, 7, 1), - - /* 0001 0001 ... */ - /* 00 */ V(7, 1, 1), /* 232 */ - /* 01 */ V(7, 1, 1), - /* 10 */ V(5, 5, 2), - /* 11 */ V(0, 7, 2), - - /* 0001 0010 ... */ - /* 00 */ V(7, 0, 2), /* 236 */ - /* 01 */ V(3, 6, 2), - /* 10 */ V(6, 3, 2), - /* 11 */ V(4, 5, 2), - - /* 0001 0011 ... */ - /* 00 */ V(5, 4, 2), /* 240 */ - /* 01 */ V(2, 6, 2), - /* 10 */ V(6, 2, 2), - /* 11 */ V(3, 5, 2), - - /* 0001 0101 ... */ - /* 0 */ V(0, 8, 1), /* 244 */ - /* 1 */ V(8, 0, 1), - - /* 0001 0110 ... */ - /* 0 */ V(1, 6, 1), /* 246 */ - /* 1 */ V(6, 1, 1), - - /* 0001 0111 ... */ - /* 0 */ V(0, 6, 1), /* 248 */ - /* 1 */ V(6, 0, 1), - - /* 0001 1000 ... */ - /* 00 */ V(5, 3, 2), /* 250 */ - /* 01 */ V(4, 4, 2), - /* 10 */ V(2, 5, 1), - /* 11 */ V(2, 5, 1), - - /* 0001 1001 ... */ - /* 0 */ V(5, 2, 1), /* 254 */ - /* 1 */ V(0, 5, 1), - - /* 0001 1100 ... */ - /* 0 */ V(3, 4, 1), /* 256 */ - /* 1 */ V(4, 3, 1), - - /* 0001 1101 ... */ - /* 0 */ V(5, 0, 1), /* 258 */ - /* 1 */ V(2, 4, 1), - - /* 0001 1110 ... */ - /* 0 */ V(4, 2, 1), /* 260 */ - /* 1 */ V(3, 3, 1), - - /* 0000 0000 0000 ... */ - /* 0000 */ PTR(388, 3), /* 262 */ - /* 0001 */ V(15, 15, 4), - /* 0010 */ V(14, 15, 4), - /* 0011 */ V(13, 15, 4), - /* 0100 */ V(14, 14, 4), - /* 0101 */ V(12, 15, 4), - /* 0110 */ V(13, 14, 4), - /* 0111 */ V(11, 15, 4), - /* 1000 */ V(15, 11, 4), - /* 1001 */ V(12, 14, 4), - /* 1010 */ V(13, 12, 4), - /* 1011 */ PTR(396, 1), - /* 1100 */ V(14, 12, 3), - /* 1101 */ V(14, 12, 3), - /* 1110 */ V(13, 13, 3), - /* 1111 */ V(13, 13, 3), - - /* 0000 0000 0001 ... */ - /* 0000 */ V(15, 10, 4), /* 278 */ - /* 0001 */ V(12, 13, 4), - /* 0010 */ V(11, 14, 3), - /* 0011 */ V(11, 14, 3), - /* 0100 */ V(14, 11, 3), - /* 0101 */ V(14, 11, 3), - /* 0110 */ V(9, 15, 3), - /* 0111 */ V(9, 15, 3), - /* 1000 */ V(15, 9, 3), - /* 1001 */ V(15, 9, 3), - /* 1010 */ V(14, 10, 3), - /* 1011 */ V(14, 10, 3), - /* 1100 */ V(11, 13, 3), - /* 1101 */ V(11, 13, 3), - /* 1110 */ V(13, 11, 3), - /* 1111 */ V(13, 11, 3), - - /* 0000 0000 0010 ... */ - /* 0000 */ V(8, 15, 3), /* 294 */ - /* 0001 */ V(8, 15, 3), - /* 0010 */ V(15, 8, 3), - /* 0011 */ V(15, 8, 3), - /* 0100 */ V(12, 12, 3), - /* 0101 */ V(12, 12, 3), - /* 0110 */ V(10, 14, 4), - /* 0111 */ V(9, 14, 4), - /* 1000 */ V(8, 14, 3), - /* 1001 */ V(8, 14, 3), - /* 1010 */ V(7, 15, 4), - /* 1011 */ V(7, 14, 4), - /* 1100 */ V(15, 7, 2), - /* 1101 */ V(15, 7, 2), - /* 1110 */ V(15, 7, 2), - /* 1111 */ V(15, 7, 2), - - /* 0000 0000 0011 ... */ - /* 000 */ V(13, 10, 2), /* 310 */ - /* 001 */ V(13, 10, 2), - /* 010 */ V(10, 13, 3), - /* 011 */ V(11, 12, 3), - /* 100 */ V(12, 11, 3), - /* 101 */ V(15, 6, 3), - /* 110 */ V(6, 15, 2), - /* 111 */ V(6, 15, 2), - - /* 0000 0000 0100 ... */ - /* 00 */ V(14, 8, 2), /* 318 */ - /* 01 */ V(5, 15, 2), - /* 10 */ V(9, 13, 2), - /* 11 */ V(13, 9, 2), - - /* 0000 0000 0101 ... */ - /* 00 */ V(15, 5, 2), /* 322 */ - /* 01 */ V(14, 7, 2), - /* 10 */ V(10, 12, 2), - /* 11 */ V(11, 11, 2), - - /* 0000 0000 0110 ... */ - /* 000 */ V(4, 15, 2), /* 326 */ - /* 001 */ V(4, 15, 2), - /* 010 */ V(15, 4, 2), - /* 011 */ V(15, 4, 2), - /* 100 */ V(12, 10, 3), - /* 101 */ V(14, 6, 3), - /* 110 */ V(15, 3, 2), - /* 111 */ V(15, 3, 2), - - /* 0000 0000 0111 ... */ - /* 00 */ V(3, 15, 1), /* 334 */ - /* 01 */ V(3, 15, 1), - /* 10 */ V(8, 13, 2), - /* 11 */ V(13, 8, 2), - - /* 0000 0000 1000 ... */ - /* 0 */ V(2, 15, 1), /* 338 */ - /* 1 */ V(15, 2, 1), - - /* 0000 0000 1001 ... */ - /* 00 */ V(6, 14, 2), /* 340 */ - /* 01 */ V(9, 12, 2), - /* 10 */ V(0, 15, 1), - /* 11 */ V(0, 15, 1), - - /* 0000 0000 1010 ... */ - /* 00 */ V(12, 9, 2), /* 344 */ - /* 01 */ V(5, 14, 2), - /* 10 */ V(10, 11, 1), - /* 11 */ V(10, 11, 1), - - /* 0000 0000 1011 ... */ - /* 00 */ V(7, 13, 2), /* 348 */ - /* 01 */ V(13, 7, 2), - /* 10 */ V(4, 14, 1), - /* 11 */ V(4, 14, 1), - - /* 0000 0000 1100 ... */ - /* 00 */ V(12, 8, 2), /* 352 */ - /* 01 */ V(13, 6, 2), - /* 10 */ V(3, 14, 1), - /* 11 */ V(3, 14, 1), - - /* 0000 0000 1101 ... */ - /* 00 */ V(11, 9, 1), /* 356 */ - /* 01 */ V(11, 9, 1), - /* 10 */ V(9, 11, 2), - /* 11 */ V(10, 10, 2), - - /* 0000 0001 0001 ... */ - /* 0 */ V(11, 10, 1), /* 360 */ - /* 1 */ V(14, 5, 1), - - /* 0000 0001 0010 ... */ - /* 0 */ V(14, 4, 1), /* 362 */ - /* 1 */ V(8, 12, 1), - - /* 0000 0001 0011 ... */ - /* 0 */ V(6, 13, 1), /* 364 */ - /* 1 */ V(14, 3, 1), - - /* 0000 0001 0101 ... */ - /* 0 */ V(2, 14, 1), /* 366 */ - /* 1 */ V(0, 14, 1), - - /* 0000 0001 1000 ... */ - /* 0 */ V(14, 0, 1), /* 368 */ - /* 1 */ V(5, 13, 1), - - /* 0000 0001 1001 ... */ - /* 0 */ V(13, 5, 1), /* 370 */ - /* 1 */ V(7, 12, 1), - - /* 0000 0001 1010 ... */ - /* 0 */ V(12, 7, 1), /* 372 */ - /* 1 */ V(4, 13, 1), - - /* 0000 0001 1011 ... */ - /* 0 */ V(8, 11, 1), /* 374 */ - /* 1 */ V(11, 8, 1), - - /* 0000 0001 1100 ... */ - /* 0 */ V(13, 4, 1), /* 376 */ - /* 1 */ V(9, 10, 1), - - /* 0000 0001 1101 ... */ - /* 0 */ V(10, 9, 1), /* 378 */ - /* 1 */ V(6, 12, 1), - - /* 0000 0010 0000 ... */ - /* 0 */ V(13, 3, 1), /* 380 */ - /* 1 */ V(7, 11, 1), - - /* 0000 0010 0101 ... */ - /* 0 */ V(5, 12, 1), /* 382 */ - /* 1 */ V(12, 5, 1), - - /* 0000 0010 0110 ... */ - /* 0 */ V(9, 9, 1), /* 384 */ - /* 1 */ V(7, 10, 1), - - /* 0000 0010 1000 ... */ - /* 0 */ V(10, 7, 1), /* 386 */ - /* 1 */ V(9, 7, 1), - - /* 0000 0000 0000 0000 ... */ - /* 000 */ V(15, 14, 3), /* 388 */ - /* 001 */ V(15, 12, 3), - /* 010 */ V(15, 13, 2), - /* 011 */ V(15, 13, 2), - /* 100 */ V(14, 13, 1), - /* 101 */ V(14, 13, 1), - /* 110 */ V(14, 13, 1), - /* 111 */ V(14, 13, 1), - - /* 0000 0000 0000 1011 ... */ - /* 0 */ V(10, 15, 1), /* 396 */ - /* 1 */ V(14, 9, 1) -}; - -static -union huffpair const hufftab15[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 4), - /* 0011 */ PTR(64, 4), - /* 0100 */ PTR(80, 4), - /* 0101 */ PTR(96, 3), - /* 0110 */ PTR(104, 3), - /* 0111 */ PTR(112, 2), - /* 1000 */ PTR(116, 1), - /* 1001 */ PTR(118, 1), - /* 1010 */ V(1, 1, 3), - /* 1011 */ V(1, 1, 3), - /* 1100 */ V(0, 1, 4), - /* 1101 */ V(1, 0, 4), - /* 1110 */ V(0, 0, 3), - /* 1111 */ V(0, 0, 3), - - /* 0000 ... */ - /* 0000 */ PTR(120, 4), /* 16 */ - /* 0001 */ PTR(136, 4), - /* 0010 */ PTR(152, 4), - /* 0011 */ PTR(168, 4), - /* 0100 */ PTR(184, 4), - /* 0101 */ PTR(200, 3), - /* 0110 */ PTR(208, 3), - /* 0111 */ PTR(216, 4), - /* 1000 */ PTR(232, 3), - /* 1001 */ PTR(240, 3), - /* 1010 */ PTR(248, 3), - /* 1011 */ PTR(256, 3), - /* 1100 */ PTR(264, 2), - /* 1101 */ PTR(268, 3), - /* 1110 */ PTR(276, 3), - /* 1111 */ PTR(284, 2), - - /* 0001 ... */ - /* 0000 */ PTR(288, 2), /* 32 */ - /* 0001 */ PTR(292, 2), - /* 0010 */ PTR(296, 2), - /* 0011 */ PTR(300, 2), - /* 0100 */ PTR(304, 2), - /* 0101 */ PTR(308, 2), - /* 0110 */ PTR(312, 2), - /* 0111 */ PTR(316, 2), - /* 1000 */ PTR(320, 1), - /* 1001 */ PTR(322, 1), - /* 1010 */ PTR(324, 1), - /* 1011 */ PTR(326, 2), - /* 1100 */ PTR(330, 1), - /* 1101 */ PTR(332, 1), - /* 1110 */ PTR(334, 2), - /* 1111 */ PTR(338, 1), - - /* 0010 ... */ - /* 0000 */ PTR(340, 1), /* 48 */ - /* 0001 */ PTR(342, 1), - /* 0010 */ V(9, 1, 4), - /* 0011 */ PTR(344, 1), - /* 0100 */ PTR(346, 1), - /* 0101 */ PTR(348, 1), - /* 0110 */ PTR(350, 1), - /* 0111 */ PTR(352, 1), - /* 1000 */ V(2, 8, 4), - /* 1001 */ V(8, 2, 4), - /* 1010 */ V(1, 8, 4), - /* 1011 */ V(8, 1, 4), - /* 1100 */ PTR(354, 1), - /* 1101 */ PTR(356, 1), - /* 1110 */ PTR(358, 1), - /* 1111 */ PTR(360, 1), - - /* 0011 ... */ - /* 0000 */ V(2, 7, 4), /* 64 */ - /* 0001 */ V(7, 2, 4), - /* 0010 */ V(6, 4, 4), - /* 0011 */ V(1, 7, 4), - /* 0100 */ V(5, 5, 4), - /* 0101 */ V(7, 1, 4), - /* 0110 */ PTR(362, 1), - /* 0111 */ V(3, 6, 4), - /* 1000 */ V(6, 3, 4), - /* 1001 */ V(4, 5, 4), - /* 1010 */ V(5, 4, 4), - /* 1011 */ V(2, 6, 4), - /* 1100 */ V(6, 2, 4), - /* 1101 */ V(1, 6, 4), - /* 1110 */ PTR(364, 1), - /* 1111 */ V(3, 5, 4), - - /* 0100 ... */ - /* 0000 */ V(6, 1, 3), /* 80 */ - /* 0001 */ V(6, 1, 3), - /* 0010 */ V(5, 3, 4), - /* 0011 */ V(4, 4, 4), - /* 0100 */ V(2, 5, 3), - /* 0101 */ V(2, 5, 3), - /* 0110 */ V(5, 2, 3), - /* 0111 */ V(5, 2, 3), - /* 1000 */ V(1, 5, 3), - /* 1001 */ V(1, 5, 3), - /* 1010 */ V(5, 1, 3), - /* 1011 */ V(5, 1, 3), - /* 1100 */ V(0, 5, 4), - /* 1101 */ V(5, 0, 4), - /* 1110 */ V(3, 4, 3), - /* 1111 */ V(3, 4, 3), - - /* 0101 ... */ - /* 000 */ V(4, 3, 3), /* 96 */ - /* 001 */ V(2, 4, 3), - /* 010 */ V(4, 2, 3), - /* 011 */ V(3, 3, 3), - /* 100 */ V(4, 1, 2), - /* 101 */ V(4, 1, 2), - /* 110 */ V(1, 4, 3), - /* 111 */ V(0, 4, 3), - - /* 0110 ... */ - /* 000 */ V(2, 3, 2), /* 104 */ - /* 001 */ V(2, 3, 2), - /* 010 */ V(3, 2, 2), - /* 011 */ V(3, 2, 2), - /* 100 */ V(4, 0, 3), - /* 101 */ V(0, 3, 3), - /* 110 */ V(1, 3, 2), - /* 111 */ V(1, 3, 2), - - /* 0111 ... */ - /* 00 */ V(3, 1, 2), /* 112 */ - /* 01 */ V(3, 0, 2), - /* 10 */ V(2, 2, 1), - /* 11 */ V(2, 2, 1), - - /* 1000 ... */ - /* 0 */ V(1, 2, 1), /* 116 */ - /* 1 */ V(2, 1, 1), - - /* 1001 ... */ - /* 0 */ V(0, 2, 1), /* 118 */ - /* 1 */ V(2, 0, 1), - - /* 0000 0000 ... */ - /* 0000 */ PTR(366, 1), /* 120 */ - /* 0001 */ PTR(368, 1), - /* 0010 */ V(14, 14, 4), - /* 0011 */ PTR(370, 1), - /* 0100 */ PTR(372, 1), - /* 0101 */ PTR(374, 1), - /* 0110 */ V(15, 11, 4), - /* 0111 */ PTR(376, 1), - /* 1000 */ V(13, 13, 4), - /* 1001 */ V(10, 15, 4), - /* 1010 */ V(15, 10, 4), - /* 1011 */ V(11, 14, 4), - /* 1100 */ V(14, 11, 4), - /* 1101 */ V(12, 13, 4), - /* 1110 */ V(13, 12, 4), - /* 1111 */ V(9, 15, 4), - - /* 0000 0001 ... */ - /* 0000 */ V(15, 9, 4), /* 136 */ - /* 0001 */ V(14, 10, 4), - /* 0010 */ V(11, 13, 4), - /* 0011 */ V(13, 11, 4), - /* 0100 */ V(8, 15, 4), - /* 0101 */ V(15, 8, 4), - /* 0110 */ V(12, 12, 4), - /* 0111 */ V(9, 14, 4), - /* 1000 */ V(14, 9, 4), - /* 1001 */ V(7, 15, 4), - /* 1010 */ V(15, 7, 4), - /* 1011 */ V(10, 13, 4), - /* 1100 */ V(13, 10, 4), - /* 1101 */ V(11, 12, 4), - /* 1110 */ V(6, 15, 4), - /* 1111 */ PTR(378, 1), - - /* 0000 0010 ... */ - /* 0000 */ V(12, 11, 3), /* 152 */ - /* 0001 */ V(12, 11, 3), - /* 0010 */ V(15, 6, 3), - /* 0011 */ V(15, 6, 3), - /* 0100 */ V(8, 14, 4), - /* 0101 */ V(14, 8, 4), - /* 0110 */ V(5, 15, 4), - /* 0111 */ V(9, 13, 4), - /* 1000 */ V(15, 5, 3), - /* 1001 */ V(15, 5, 3), - /* 1010 */ V(7, 14, 3), - /* 1011 */ V(7, 14, 3), - /* 1100 */ V(14, 7, 3), - /* 1101 */ V(14, 7, 3), - /* 1110 */ V(10, 12, 3), - /* 1111 */ V(10, 12, 3), - - /* 0000 0011 ... */ - /* 0000 */ V(12, 10, 3), /* 168 */ - /* 0001 */ V(12, 10, 3), - /* 0010 */ V(11, 11, 3), - /* 0011 */ V(11, 11, 3), - /* 0100 */ V(13, 9, 4), - /* 0101 */ V(8, 13, 4), - /* 0110 */ V(4, 15, 3), - /* 0111 */ V(4, 15, 3), - /* 1000 */ V(15, 4, 3), - /* 1001 */ V(15, 4, 3), - /* 1010 */ V(3, 15, 3), - /* 1011 */ V(3, 15, 3), - /* 1100 */ V(15, 3, 3), - /* 1101 */ V(15, 3, 3), - /* 1110 */ V(13, 8, 3), - /* 1111 */ V(13, 8, 3), - - /* 0000 0100 ... */ - /* 0000 */ V(14, 6, 3), /* 184 */ - /* 0001 */ V(14, 6, 3), - /* 0010 */ V(2, 15, 3), - /* 0011 */ V(2, 15, 3), - /* 0100 */ V(15, 2, 3), - /* 0101 */ V(15, 2, 3), - /* 0110 */ V(6, 14, 4), - /* 0111 */ V(15, 0, 4), - /* 1000 */ V(1, 15, 3), - /* 1001 */ V(1, 15, 3), - /* 1010 */ V(15, 1, 3), - /* 1011 */ V(15, 1, 3), - /* 1100 */ V(9, 12, 3), - /* 1101 */ V(9, 12, 3), - /* 1110 */ V(12, 9, 3), - /* 1111 */ V(12, 9, 3), - - /* 0000 0101 ... */ - /* 000 */ V(5, 14, 3), /* 200 */ - /* 001 */ V(10, 11, 3), - /* 010 */ V(11, 10, 3), - /* 011 */ V(14, 5, 3), - /* 100 */ V(7, 13, 3), - /* 101 */ V(13, 7, 3), - /* 110 */ V(4, 14, 3), - /* 111 */ V(14, 4, 3), - - /* 0000 0110 ... */ - /* 000 */ V(8, 12, 3), /* 208 */ - /* 001 */ V(12, 8, 3), - /* 010 */ V(3, 14, 3), - /* 011 */ V(6, 13, 3), - /* 100 */ V(13, 6, 3), - /* 101 */ V(14, 3, 3), - /* 110 */ V(9, 11, 3), - /* 111 */ V(11, 9, 3), - - /* 0000 0111 ... */ - /* 0000 */ V(2, 14, 3), /* 216 */ - /* 0001 */ V(2, 14, 3), - /* 0010 */ V(10, 10, 3), - /* 0011 */ V(10, 10, 3), - /* 0100 */ V(14, 2, 3), - /* 0101 */ V(14, 2, 3), - /* 0110 */ V(1, 14, 3), - /* 0111 */ V(1, 14, 3), - /* 1000 */ V(14, 1, 3), - /* 1001 */ V(14, 1, 3), - /* 1010 */ V(0, 14, 4), - /* 1011 */ V(14, 0, 4), - /* 1100 */ V(5, 13, 3), - /* 1101 */ V(5, 13, 3), - /* 1110 */ V(13, 5, 3), - /* 1111 */ V(13, 5, 3), - - /* 0000 1000 ... */ - /* 000 */ V(7, 12, 3), /* 232 */ - /* 001 */ V(12, 7, 3), - /* 010 */ V(4, 13, 3), - /* 011 */ V(8, 11, 3), - /* 100 */ V(13, 4, 2), - /* 101 */ V(13, 4, 2), - /* 110 */ V(11, 8, 3), - /* 111 */ V(9, 10, 3), - - /* 0000 1001 ... */ - /* 000 */ V(10, 9, 3), /* 240 */ - /* 001 */ V(6, 12, 3), - /* 010 */ V(12, 6, 3), - /* 011 */ V(3, 13, 3), - /* 100 */ V(13, 3, 2), - /* 101 */ V(13, 3, 2), - /* 110 */ V(13, 2, 2), - /* 111 */ V(13, 2, 2), - - /* 0000 1010 ... */ - /* 000 */ V(2, 13, 3), /* 248 */ - /* 001 */ V(0, 13, 3), - /* 010 */ V(1, 13, 2), - /* 011 */ V(1, 13, 2), - /* 100 */ V(7, 11, 2), - /* 101 */ V(7, 11, 2), - /* 110 */ V(11, 7, 2), - /* 111 */ V(11, 7, 2), - - /* 0000 1011 ... */ - /* 000 */ V(13, 1, 2), /* 256 */ - /* 001 */ V(13, 1, 2), - /* 010 */ V(5, 12, 3), - /* 011 */ V(13, 0, 3), - /* 100 */ V(12, 5, 2), - /* 101 */ V(12, 5, 2), - /* 110 */ V(8, 10, 2), - /* 111 */ V(8, 10, 2), - - /* 0000 1100 ... */ - /* 00 */ V(10, 8, 2), /* 264 */ - /* 01 */ V(4, 12, 2), - /* 10 */ V(12, 4, 2), - /* 11 */ V(6, 11, 2), - - /* 0000 1101 ... */ - /* 000 */ V(11, 6, 2), /* 268 */ - /* 001 */ V(11, 6, 2), - /* 010 */ V(9, 9, 3), - /* 011 */ V(0, 12, 3), - /* 100 */ V(3, 12, 2), - /* 101 */ V(3, 12, 2), - /* 110 */ V(12, 3, 2), - /* 111 */ V(12, 3, 2), - - /* 0000 1110 ... */ - /* 000 */ V(7, 10, 2), /* 276 */ - /* 001 */ V(7, 10, 2), - /* 010 */ V(10, 7, 2), - /* 011 */ V(10, 7, 2), - /* 100 */ V(10, 6, 2), - /* 101 */ V(10, 6, 2), - /* 110 */ V(12, 0, 3), - /* 111 */ V(0, 11, 3), - - /* 0000 1111 ... */ - /* 00 */ V(12, 2, 1), /* 284 */ - /* 01 */ V(12, 2, 1), - /* 10 */ V(2, 12, 2), - /* 11 */ V(5, 11, 2), - - /* 0001 0000 ... */ - /* 00 */ V(11, 5, 2), /* 288 */ - /* 01 */ V(1, 12, 2), - /* 10 */ V(8, 9, 2), - /* 11 */ V(9, 8, 2), - - /* 0001 0001 ... */ - /* 00 */ V(12, 1, 2), /* 292 */ - /* 01 */ V(4, 11, 2), - /* 10 */ V(11, 4, 2), - /* 11 */ V(6, 10, 2), - - /* 0001 0010 ... */ - /* 00 */ V(3, 11, 2), /* 296 */ - /* 01 */ V(7, 9, 2), - /* 10 */ V(11, 3, 1), - /* 11 */ V(11, 3, 1), - - /* 0001 0011 ... */ - /* 00 */ V(9, 7, 2), /* 300 */ - /* 01 */ V(8, 8, 2), - /* 10 */ V(2, 11, 2), - /* 11 */ V(5, 10, 2), - - /* 0001 0100 ... */ - /* 00 */ V(11, 2, 1), /* 304 */ - /* 01 */ V(11, 2, 1), - /* 10 */ V(10, 5, 2), - /* 11 */ V(1, 11, 2), - - /* 0001 0101 ... */ - /* 00 */ V(11, 1, 1), /* 308 */ - /* 01 */ V(11, 1, 1), - /* 10 */ V(11, 0, 2), - /* 11 */ V(6, 9, 2), - - /* 0001 0110 ... */ - /* 00 */ V(9, 6, 2), /* 312 */ - /* 01 */ V(4, 10, 2), - /* 10 */ V(10, 4, 2), - /* 11 */ V(7, 8, 2), - - /* 0001 0111 ... */ - /* 00 */ V(8, 7, 2), /* 316 */ - /* 01 */ V(3, 10, 2), - /* 10 */ V(10, 3, 1), - /* 11 */ V(10, 3, 1), - - /* 0001 1000 ... */ - /* 0 */ V(5, 9, 1), /* 320 */ - /* 1 */ V(9, 5, 1), - - /* 0001 1001 ... */ - /* 0 */ V(2, 10, 1), /* 322 */ - /* 1 */ V(10, 2, 1), - - /* 0001 1010 ... */ - /* 0 */ V(1, 10, 1), /* 324 */ - /* 1 */ V(10, 1, 1), - - /* 0001 1011 ... */ - /* 00 */ V(0, 10, 2), /* 326 */ - /* 01 */ V(10, 0, 2), - /* 10 */ V(6, 8, 1), - /* 11 */ V(6, 8, 1), - - /* 0001 1100 ... */ - /* 0 */ V(8, 6, 1), /* 330 */ - /* 1 */ V(4, 9, 1), - - /* 0001 1101 ... */ - /* 0 */ V(9, 4, 1), /* 332 */ - /* 1 */ V(3, 9, 1), - - /* 0001 1110 ... */ - /* 00 */ V(9, 3, 1), /* 334 */ - /* 01 */ V(9, 3, 1), - /* 10 */ V(7, 7, 2), - /* 11 */ V(0, 9, 2), - - /* 0001 1111 ... */ - /* 0 */ V(5, 8, 1), /* 338 */ - /* 1 */ V(8, 5, 1), - - /* 0010 0000 ... */ - /* 0 */ V(2, 9, 1), /* 340 */ - /* 1 */ V(6, 7, 1), - - /* 0010 0001 ... */ - /* 0 */ V(7, 6, 1), /* 342 */ - /* 1 */ V(9, 2, 1), - - /* 0010 0011 ... */ - /* 0 */ V(1, 9, 1), /* 344 */ - /* 1 */ V(9, 0, 1), - - /* 0010 0100 ... */ - /* 0 */ V(4, 8, 1), /* 346 */ - /* 1 */ V(8, 4, 1), - - /* 0010 0101 ... */ - /* 0 */ V(5, 7, 1), /* 348 */ - /* 1 */ V(7, 5, 1), - - /* 0010 0110 ... */ - /* 0 */ V(3, 8, 1), /* 350 */ - /* 1 */ V(8, 3, 1), - - /* 0010 0111 ... */ - /* 0 */ V(6, 6, 1), /* 352 */ - /* 1 */ V(4, 7, 1), - - /* 0010 1100 ... */ - /* 0 */ V(7, 4, 1), /* 354 */ - /* 1 */ V(0, 8, 1), - - /* 0010 1101 ... */ - /* 0 */ V(8, 0, 1), /* 356 */ - /* 1 */ V(5, 6, 1), - - /* 0010 1110 ... */ - /* 0 */ V(6, 5, 1), /* 358 */ - /* 1 */ V(3, 7, 1), - - /* 0010 1111 ... */ - /* 0 */ V(7, 3, 1), /* 360 */ - /* 1 */ V(4, 6, 1), - - /* 0011 0110 ... */ - /* 0 */ V(0, 7, 1), /* 362 */ - /* 1 */ V(7, 0, 1), - - /* 0011 1110 ... */ - /* 0 */ V(0, 6, 1), /* 364 */ - /* 1 */ V(6, 0, 1), - - /* 0000 0000 0000 ... */ - /* 0 */ V(15, 15, 1), /* 366 */ - /* 1 */ V(14, 15, 1), - - /* 0000 0000 0001 ... */ - /* 0 */ V(15, 14, 1), /* 368 */ - /* 1 */ V(13, 15, 1), - - /* 0000 0000 0011 ... */ - /* 0 */ V(15, 13, 1), /* 370 */ - /* 1 */ V(12, 15, 1), - - /* 0000 0000 0100 ... */ - /* 0 */ V(15, 12, 1), /* 372 */ - /* 1 */ V(13, 14, 1), - - /* 0000 0000 0101 ... */ - /* 0 */ V(14, 13, 1), /* 374 */ - /* 1 */ V(11, 15, 1), - - /* 0000 0000 0111 ... */ - /* 0 */ V(12, 14, 1), /* 376 */ - /* 1 */ V(14, 12, 1), - - /* 0000 0001 1111 ... */ - /* 0 */ V(10, 14, 1), /* 378 */ - /* 1 */ V(0, 15, 1) -}; - -static -union huffpair const hufftab16[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 4), - /* 0011 */ PTR(64, 2), - /* 0100 */ V(1, 1, 4), - /* 0101 */ V(0, 1, 4), - /* 0110 */ V(1, 0, 3), - /* 0111 */ V(1, 0, 3), - /* 1000 */ V(0, 0, 1), - /* 1001 */ V(0, 0, 1), - /* 1010 */ V(0, 0, 1), - /* 1011 */ V(0, 0, 1), - /* 1100 */ V(0, 0, 1), - /* 1101 */ V(0, 0, 1), - /* 1110 */ V(0, 0, 1), - /* 1111 */ V(0, 0, 1), - - /* 0000 ... */ - /* 0000 */ PTR(68, 3), /* 16 */ - /* 0001 */ PTR(76, 3), - /* 0010 */ PTR(84, 2), - /* 0011 */ V(15, 15, 4), - /* 0100 */ PTR(88, 2), - /* 0101 */ PTR(92, 1), - /* 0110 */ PTR(94, 4), - /* 0111 */ V(15, 2, 4), - /* 1000 */ PTR(110, 1), - /* 1001 */ V(1, 15, 4), - /* 1010 */ V(15, 1, 4), - /* 1011 */ PTR(112, 4), - /* 1100 */ PTR(128, 4), - /* 1101 */ PTR(144, 4), - /* 1110 */ PTR(160, 4), - /* 1111 */ PTR(176, 4), - - /* 0001 ... */ - /* 0000 */ PTR(192, 4), /* 32 */ - /* 0001 */ PTR(208, 3), - /* 0010 */ PTR(216, 3), - /* 0011 */ PTR(224, 3), - /* 0100 */ PTR(232, 3), - /* 0101 */ PTR(240, 3), - /* 0110 */ PTR(248, 3), - /* 0111 */ PTR(256, 3), - /* 1000 */ PTR(264, 2), - /* 1001 */ PTR(268, 2), - /* 1010 */ PTR(272, 1), - /* 1011 */ PTR(274, 2), - /* 1100 */ PTR(278, 2), - /* 1101 */ PTR(282, 1), - /* 1110 */ V(5, 1, 4), - /* 1111 */ PTR(284, 1), - - /* 0010 ... */ - /* 0000 */ PTR(286, 1), /* 48 */ - /* 0001 */ PTR(288, 1), - /* 0010 */ PTR(290, 1), - /* 0011 */ V(1, 4, 4), - /* 0100 */ V(4, 1, 4), - /* 0101 */ PTR(292, 1), - /* 0110 */ V(2, 3, 4), - /* 0111 */ V(3, 2, 4), - /* 1000 */ V(1, 3, 3), - /* 1001 */ V(1, 3, 3), - /* 1010 */ V(3, 1, 3), - /* 1011 */ V(3, 1, 3), - /* 1100 */ V(0, 3, 4), - /* 1101 */ V(3, 0, 4), - /* 1110 */ V(2, 2, 3), - /* 1111 */ V(2, 2, 3), - - /* 0011 ... */ - /* 00 */ V(1, 2, 2), /* 64 */ - /* 01 */ V(2, 1, 2), - /* 10 */ V(0, 2, 2), - /* 11 */ V(2, 0, 2), - - /* 0000 0000 ... */ - /* 000 */ V(14, 15, 3), /* 68 */ - /* 001 */ V(15, 14, 3), - /* 010 */ V(13, 15, 3), - /* 011 */ V(15, 13, 3), - /* 100 */ V(12, 15, 3), - /* 101 */ V(15, 12, 3), - /* 110 */ V(11, 15, 3), - /* 111 */ V(15, 11, 3), - - /* 0000 0001 ... */ - /* 000 */ V(10, 15, 2), /* 76 */ - /* 001 */ V(10, 15, 2), - /* 010 */ V(15, 10, 3), - /* 011 */ V(9, 15, 3), - /* 100 */ V(15, 9, 3), - /* 101 */ V(15, 8, 3), - /* 110 */ V(8, 15, 2), - /* 111 */ V(8, 15, 2), - - /* 0000 0010 ... */ - /* 00 */ V(7, 15, 2), /* 84 */ - /* 01 */ V(15, 7, 2), - /* 10 */ V(6, 15, 2), - /* 11 */ V(15, 6, 2), - - /* 0000 0100 ... */ - /* 00 */ V(5, 15, 2), /* 88 */ - /* 01 */ V(15, 5, 2), - /* 10 */ V(4, 15, 1), - /* 11 */ V(4, 15, 1), - - /* 0000 0101 ... */ - /* 0 */ V(15, 4, 1), /* 92 */ - /* 1 */ V(15, 3, 1), - - /* 0000 0110 ... */ - /* 0000 */ V(15, 0, 1), /* 94 */ - /* 0001 */ V(15, 0, 1), - /* 0010 */ V(15, 0, 1), - /* 0011 */ V(15, 0, 1), - /* 0100 */ V(15, 0, 1), - /* 0101 */ V(15, 0, 1), - /* 0110 */ V(15, 0, 1), - /* 0111 */ V(15, 0, 1), - /* 1000 */ V(3, 15, 2), - /* 1001 */ V(3, 15, 2), - /* 1010 */ V(3, 15, 2), - /* 1011 */ V(3, 15, 2), - /* 1100 */ PTR(294, 4), - /* 1101 */ PTR(310, 3), - /* 1110 */ PTR(318, 3), - /* 1111 */ PTR(326, 3), - - /* 0000 1000 ... */ - /* 0 */ V(2, 15, 1), /* 110 */ - /* 1 */ V(0, 15, 1), - - /* 0000 1011 ... */ - /* 0000 */ PTR(334, 2), /* 112 */ - /* 0001 */ PTR(338, 2), - /* 0010 */ PTR(342, 2), - /* 0011 */ PTR(346, 1), - /* 0100 */ PTR(348, 2), - /* 0101 */ PTR(352, 2), - /* 0110 */ PTR(356, 1), - /* 0111 */ PTR(358, 2), - /* 1000 */ PTR(362, 2), - /* 1001 */ PTR(366, 2), - /* 1010 */ PTR(370, 2), - /* 1011 */ V(14, 3, 4), - /* 1100 */ PTR(374, 1), - /* 1101 */ PTR(376, 1), - /* 1110 */ PTR(378, 1), - /* 1111 */ PTR(380, 1), - - /* 0000 1100 ... */ - /* 0000 */ PTR(382, 1), /* 128 */ - /* 0001 */ PTR(384, 1), - /* 0010 */ PTR(386, 1), - /* 0011 */ V(0, 13, 4), - /* 0100 */ PTR(388, 1), - /* 0101 */ PTR(390, 1), - /* 0110 */ PTR(392, 1), - /* 0111 */ V(3, 12, 4), - /* 1000 */ PTR(394, 1), - /* 1001 */ V(1, 12, 4), - /* 1010 */ V(12, 0, 4), - /* 1011 */ PTR(396, 1), - /* 1100 */ V(14, 2, 3), - /* 1101 */ V(14, 2, 3), - /* 1110 */ V(2, 14, 4), - /* 1111 */ V(1, 14, 4), - - /* 0000 1101 ... */ - /* 0000 */ V(13, 3, 4), /* 144 */ - /* 0001 */ V(2, 13, 4), - /* 0010 */ V(13, 2, 4), - /* 0011 */ V(13, 1, 4), - /* 0100 */ V(3, 11, 4), - /* 0101 */ PTR(398, 1), - /* 0110 */ V(1, 13, 3), - /* 0111 */ V(1, 13, 3), - /* 1000 */ V(12, 4, 4), - /* 1001 */ V(6, 11, 4), - /* 1010 */ V(12, 3, 4), - /* 1011 */ V(10, 7, 4), - /* 1100 */ V(2, 12, 3), - /* 1101 */ V(2, 12, 3), - /* 1110 */ V(12, 2, 4), - /* 1111 */ V(11, 5, 4), - - /* 0000 1110 ... */ - /* 0000 */ V(12, 1, 4), /* 160 */ - /* 0001 */ V(0, 12, 4), - /* 0010 */ V(4, 11, 4), - /* 0011 */ V(11, 4, 4), - /* 0100 */ V(6, 10, 4), - /* 0101 */ V(10, 6, 4), - /* 0110 */ V(11, 3, 3), - /* 0111 */ V(11, 3, 3), - /* 1000 */ V(5, 10, 4), - /* 1001 */ V(10, 5, 4), - /* 1010 */ V(2, 11, 3), - /* 1011 */ V(2, 11, 3), - /* 1100 */ V(11, 2, 3), - /* 1101 */ V(11, 2, 3), - /* 1110 */ V(1, 11, 3), - /* 1111 */ V(1, 11, 3), - - /* 0000 1111 ... */ - /* 0000 */ V(11, 1, 3), /* 176 */ - /* 0001 */ V(11, 1, 3), - /* 0010 */ V(0, 11, 4), - /* 0011 */ V(11, 0, 4), - /* 0100 */ V(6, 9, 4), - /* 0101 */ V(9, 6, 4), - /* 0110 */ V(4, 10, 4), - /* 0111 */ V(10, 4, 4), - /* 1000 */ V(7, 8, 4), - /* 1001 */ V(8, 7, 4), - /* 1010 */ V(10, 3, 3), - /* 1011 */ V(10, 3, 3), - /* 1100 */ V(3, 10, 4), - /* 1101 */ V(5, 9, 4), - /* 1110 */ V(2, 10, 3), - /* 1111 */ V(2, 10, 3), - - /* 0001 0000 ... */ - /* 0000 */ V(9, 5, 4), /* 192 */ - /* 0001 */ V(6, 8, 4), - /* 0010 */ V(10, 1, 3), - /* 0011 */ V(10, 1, 3), - /* 0100 */ V(8, 6, 4), - /* 0101 */ V(7, 7, 4), - /* 0110 */ V(9, 4, 3), - /* 0111 */ V(9, 4, 3), - /* 1000 */ V(4, 9, 4), - /* 1001 */ V(5, 7, 4), - /* 1010 */ V(6, 7, 3), - /* 1011 */ V(6, 7, 3), - /* 1100 */ V(10, 2, 2), - /* 1101 */ V(10, 2, 2), - /* 1110 */ V(10, 2, 2), - /* 1111 */ V(10, 2, 2), - - /* 0001 0001 ... */ - /* 000 */ V(1, 10, 2), /* 208 */ - /* 001 */ V(1, 10, 2), - /* 010 */ V(0, 10, 3), - /* 011 */ V(10, 0, 3), - /* 100 */ V(3, 9, 3), - /* 101 */ V(9, 3, 3), - /* 110 */ V(5, 8, 3), - /* 111 */ V(8, 5, 3), - - /* 0001 0010 ... */ - /* 000 */ V(2, 9, 2), /* 216 */ - /* 001 */ V(2, 9, 2), - /* 010 */ V(9, 2, 2), - /* 011 */ V(9, 2, 2), - /* 100 */ V(7, 6, 3), - /* 101 */ V(0, 9, 3), - /* 110 */ V(1, 9, 2), - /* 111 */ V(1, 9, 2), - - /* 0001 0011 ... */ - /* 000 */ V(9, 1, 2), /* 224 */ - /* 001 */ V(9, 1, 2), - /* 010 */ V(9, 0, 3), - /* 011 */ V(4, 8, 3), - /* 100 */ V(8, 4, 3), - /* 101 */ V(7, 5, 3), - /* 110 */ V(3, 8, 3), - /* 111 */ V(8, 3, 3), - - /* 0001 0100 ... */ - /* 000 */ V(6, 6, 3), /* 232 */ - /* 001 */ V(2, 8, 3), - /* 010 */ V(8, 2, 2), - /* 011 */ V(8, 2, 2), - /* 100 */ V(4, 7, 3), - /* 101 */ V(7, 4, 3), - /* 110 */ V(1, 8, 2), - /* 111 */ V(1, 8, 2), - - /* 0001 0101 ... */ - /* 000 */ V(8, 1, 2), /* 240 */ - /* 001 */ V(8, 1, 2), - /* 010 */ V(8, 0, 2), - /* 011 */ V(8, 0, 2), - /* 100 */ V(0, 8, 3), - /* 101 */ V(5, 6, 3), - /* 110 */ V(3, 7, 2), - /* 111 */ V(3, 7, 2), - - /* 0001 0110 ... */ - /* 000 */ V(7, 3, 2), /* 248 */ - /* 001 */ V(7, 3, 2), - /* 010 */ V(6, 5, 3), - /* 011 */ V(4, 6, 3), - /* 100 */ V(2, 7, 2), - /* 101 */ V(2, 7, 2), - /* 110 */ V(7, 2, 2), - /* 111 */ V(7, 2, 2), - - /* 0001 0111 ... */ - /* 000 */ V(6, 4, 3), /* 256 */ - /* 001 */ V(5, 5, 3), - /* 010 */ V(0, 7, 2), - /* 011 */ V(0, 7, 2), - /* 100 */ V(1, 7, 1), - /* 101 */ V(1, 7, 1), - /* 110 */ V(1, 7, 1), - /* 111 */ V(1, 7, 1), - - /* 0001 1000 ... */ - /* 00 */ V(7, 1, 1), /* 264 */ - /* 01 */ V(7, 1, 1), - /* 10 */ V(7, 0, 2), - /* 11 */ V(3, 6, 2), - - /* 0001 1001 ... */ - /* 00 */ V(6, 3, 2), /* 268 */ - /* 01 */ V(4, 5, 2), - /* 10 */ V(5, 4, 2), - /* 11 */ V(2, 6, 2), - - /* 0001 1010 ... */ - /* 0 */ V(6, 2, 1), /* 272 */ - /* 1 */ V(1, 6, 1), - - /* 0001 1011 ... */ - /* 00 */ V(6, 1, 1), /* 274 */ - /* 01 */ V(6, 1, 1), - /* 10 */ V(0, 6, 2), - /* 11 */ V(6, 0, 2), - - /* 0001 1100 ... */ - /* 00 */ V(5, 3, 1), /* 278 */ - /* 01 */ V(5, 3, 1), - /* 10 */ V(3, 5, 2), - /* 11 */ V(4, 4, 2), - - /* 0001 1101 ... */ - /* 0 */ V(2, 5, 1), /* 282 */ - /* 1 */ V(5, 2, 1), - - /* 0001 1111 ... */ - /* 0 */ V(1, 5, 1), /* 284 */ - /* 1 */ V(0, 5, 1), - - /* 0010 0000 ... */ - /* 0 */ V(3, 4, 1), /* 286 */ - /* 1 */ V(4, 3, 1), - - /* 0010 0001 ... */ - /* 0 */ V(5, 0, 1), /* 288 */ - /* 1 */ V(2, 4, 1), - - /* 0010 0010 ... */ - /* 0 */ V(4, 2, 1), /* 290 */ - /* 1 */ V(3, 3, 1), - - /* 0010 0101 ... */ - /* 0 */ V(0, 4, 1), /* 292 */ - /* 1 */ V(4, 0, 1), - - /* 0000 0110 1100 ... */ - /* 0000 */ V(12, 14, 4), /* 294 */ - /* 0001 */ PTR(400, 1), - /* 0010 */ V(13, 14, 3), - /* 0011 */ V(13, 14, 3), - /* 0100 */ V(14, 9, 3), - /* 0101 */ V(14, 9, 3), - /* 0110 */ V(14, 10, 4), - /* 0111 */ V(13, 9, 4), - /* 1000 */ V(14, 14, 2), - /* 1001 */ V(14, 14, 2), - /* 1010 */ V(14, 14, 2), - /* 1011 */ V(14, 14, 2), - /* 1100 */ V(14, 13, 3), - /* 1101 */ V(14, 13, 3), - /* 1110 */ V(14, 11, 3), - /* 1111 */ V(14, 11, 3), - - /* 0000 0110 1101 ... */ - /* 000 */ V(11, 14, 2), /* 310 */ - /* 001 */ V(11, 14, 2), - /* 010 */ V(12, 13, 2), - /* 011 */ V(12, 13, 2), - /* 100 */ V(13, 12, 3), - /* 101 */ V(13, 11, 3), - /* 110 */ V(10, 14, 2), - /* 111 */ V(10, 14, 2), - - /* 0000 0110 1110 ... */ - /* 000 */ V(12, 12, 2), /* 318 */ - /* 001 */ V(12, 12, 2), - /* 010 */ V(10, 13, 3), - /* 011 */ V(13, 10, 3), - /* 100 */ V(7, 14, 3), - /* 101 */ V(10, 12, 3), - /* 110 */ V(12, 10, 2), - /* 111 */ V(12, 10, 2), - - /* 0000 0110 1111 ... */ - /* 000 */ V(12, 9, 3), /* 326 */ - /* 001 */ V(7, 13, 3), - /* 010 */ V(5, 14, 2), - /* 011 */ V(5, 14, 2), - /* 100 */ V(11, 13, 1), - /* 101 */ V(11, 13, 1), - /* 110 */ V(11, 13, 1), - /* 111 */ V(11, 13, 1), - - /* 0000 1011 0000 ... */ - /* 00 */ V(9, 14, 1), /* 334 */ - /* 01 */ V(9, 14, 1), - /* 10 */ V(11, 12, 2), - /* 11 */ V(12, 11, 2), - - /* 0000 1011 0001 ... */ - /* 00 */ V(8, 14, 2), /* 338 */ - /* 01 */ V(14, 8, 2), - /* 10 */ V(9, 13, 2), - /* 11 */ V(14, 7, 2), - - /* 0000 1011 0010 ... */ - /* 00 */ V(11, 11, 2), /* 342 */ - /* 01 */ V(8, 13, 2), - /* 10 */ V(13, 8, 2), - /* 11 */ V(6, 14, 2), - - /* 0000 1011 0011 ... */ - /* 0 */ V(14, 6, 1), /* 346 */ - /* 1 */ V(9, 12, 1), - - /* 0000 1011 0100 ... */ - /* 00 */ V(10, 11, 2), /* 348 */ - /* 01 */ V(11, 10, 2), - /* 10 */ V(14, 5, 2), - /* 11 */ V(13, 7, 2), - - /* 0000 1011 0101 ... */ - /* 00 */ V(4, 14, 1), /* 352 */ - /* 01 */ V(4, 14, 1), - /* 10 */ V(14, 4, 2), - /* 11 */ V(8, 12, 2), - - /* 0000 1011 0110 ... */ - /* 0 */ V(12, 8, 1), /* 356 */ - /* 1 */ V(3, 14, 1), - - /* 0000 1011 0111 ... */ - /* 00 */ V(6, 13, 1), /* 358 */ - /* 01 */ V(6, 13, 1), - /* 10 */ V(13, 6, 2), - /* 11 */ V(9, 11, 2), - - /* 0000 1011 1000 ... */ - /* 00 */ V(11, 9, 2), /* 362 */ - /* 01 */ V(10, 10, 2), - /* 10 */ V(14, 1, 1), - /* 11 */ V(14, 1, 1), - - /* 0000 1011 1001 ... */ - /* 00 */ V(13, 4, 1), /* 366 */ - /* 01 */ V(13, 4, 1), - /* 10 */ V(11, 8, 2), - /* 11 */ V(10, 9, 2), - - /* 0000 1011 1010 ... */ - /* 00 */ V(7, 11, 1), /* 370 */ - /* 01 */ V(7, 11, 1), - /* 10 */ V(11, 7, 2), - /* 11 */ V(13, 0, 2), - - /* 0000 1011 1100 ... */ - /* 0 */ V(0, 14, 1), /* 374 */ - /* 1 */ V(14, 0, 1), - - /* 0000 1011 1101 ... */ - /* 0 */ V(5, 13, 1), /* 376 */ - /* 1 */ V(13, 5, 1), - - /* 0000 1011 1110 ... */ - /* 0 */ V(7, 12, 1), /* 378 */ - /* 1 */ V(12, 7, 1), - - /* 0000 1011 1111 ... */ - /* 0 */ V(4, 13, 1), /* 380 */ - /* 1 */ V(8, 11, 1), - - /* 0000 1100 0000 ... */ - /* 0 */ V(9, 10, 1), /* 382 */ - /* 1 */ V(6, 12, 1), - - /* 0000 1100 0001 ... */ - /* 0 */ V(12, 6, 1), /* 384 */ - /* 1 */ V(3, 13, 1), - - /* 0000 1100 0010 ... */ - /* 0 */ V(5, 12, 1), /* 386 */ - /* 1 */ V(12, 5, 1), - - /* 0000 1100 0100 ... */ - /* 0 */ V(8, 10, 1), /* 388 */ - /* 1 */ V(10, 8, 1), - - /* 0000 1100 0101 ... */ - /* 0 */ V(9, 9, 1), /* 390 */ - /* 1 */ V(4, 12, 1), - - /* 0000 1100 0110 ... */ - /* 0 */ V(11, 6, 1), /* 392 */ - /* 1 */ V(7, 10, 1), - - /* 0000 1100 1000 ... */ - /* 0 */ V(5, 11, 1), /* 394 */ - /* 1 */ V(8, 9, 1), - - /* 0000 1100 1011 ... */ - /* 0 */ V(9, 8, 1), /* 396 */ - /* 1 */ V(7, 9, 1), - - /* 0000 1101 0101 ... */ - /* 0 */ V(9, 7, 1), /* 398 */ - /* 1 */ V(8, 8, 1), - - /* 0000 0110 1100 0001 ... */ - /* 0 */ V(14, 12, 1), /* 400 */ - /* 1 */ V(13, 13, 1) -}; - -static -union huffpair const hufftab24[] = { - /* 0000 */ PTR(16, 4), - /* 0001 */ PTR(32, 4), - /* 0010 */ PTR(48, 4), - /* 0011 */ V(15, 15, 4), - /* 0100 */ PTR(64, 4), - /* 0101 */ PTR(80, 4), - /* 0110 */ PTR(96, 4), - /* 0111 */ PTR(112, 4), - /* 1000 */ PTR(128, 4), - /* 1001 */ PTR(144, 4), - /* 1010 */ PTR(160, 3), - /* 1011 */ PTR(168, 2), - /* 1100 */ V(1, 1, 4), - /* 1101 */ V(0, 1, 4), - /* 1110 */ V(1, 0, 4), - /* 1111 */ V(0, 0, 4), - - /* 0000 ... */ - /* 0000 */ V(14, 15, 4), /* 16 */ - /* 0001 */ V(15, 14, 4), - /* 0010 */ V(13, 15, 4), - /* 0011 */ V(15, 13, 4), - /* 0100 */ V(12, 15, 4), - /* 0101 */ V(15, 12, 4), - /* 0110 */ V(11, 15, 4), - /* 0111 */ V(15, 11, 4), - /* 1000 */ V(15, 10, 3), - /* 1001 */ V(15, 10, 3), - /* 1010 */ V(10, 15, 4), - /* 1011 */ V(9, 15, 4), - /* 1100 */ V(15, 9, 3), - /* 1101 */ V(15, 9, 3), - /* 1110 */ V(15, 8, 3), - /* 1111 */ V(15, 8, 3), - - /* 0001 ... */ - /* 0000 */ V(8, 15, 4), /* 32 */ - /* 0001 */ V(7, 15, 4), - /* 0010 */ V(15, 7, 3), - /* 0011 */ V(15, 7, 3), - /* 0100 */ V(6, 15, 3), - /* 0101 */ V(6, 15, 3), - /* 0110 */ V(15, 6, 3), - /* 0111 */ V(15, 6, 3), - /* 1000 */ V(5, 15, 3), - /* 1001 */ V(5, 15, 3), - /* 1010 */ V(15, 5, 3), - /* 1011 */ V(15, 5, 3), - /* 1100 */ V(4, 15, 3), - /* 1101 */ V(4, 15, 3), - /* 1110 */ V(15, 4, 3), - /* 1111 */ V(15, 4, 3), - - /* 0010 ... */ - /* 0000 */ V(3, 15, 3), /* 48 */ - /* 0001 */ V(3, 15, 3), - /* 0010 */ V(15, 3, 3), - /* 0011 */ V(15, 3, 3), - /* 0100 */ V(2, 15, 3), - /* 0101 */ V(2, 15, 3), - /* 0110 */ V(15, 2, 3), - /* 0111 */ V(15, 2, 3), - /* 1000 */ V(15, 1, 3), - /* 1001 */ V(15, 1, 3), - /* 1010 */ V(1, 15, 4), - /* 1011 */ V(15, 0, 4), - /* 1100 */ PTR(172, 3), - /* 1101 */ PTR(180, 3), - /* 1110 */ PTR(188, 3), - /* 1111 */ PTR(196, 3), - - /* 0100 ... */ - /* 0000 */ PTR(204, 4), /* 64 */ - /* 0001 */ PTR(220, 3), - /* 0010 */ PTR(228, 3), - /* 0011 */ PTR(236, 3), - /* 0100 */ PTR(244, 2), - /* 0101 */ PTR(248, 2), - /* 0110 */ PTR(252, 2), - /* 0111 */ PTR(256, 2), - /* 1000 */ PTR(260, 2), - /* 1001 */ PTR(264, 2), - /* 1010 */ PTR(268, 2), - /* 1011 */ PTR(272, 2), - /* 1100 */ PTR(276, 2), - /* 1101 */ PTR(280, 3), - /* 1110 */ PTR(288, 2), - /* 1111 */ PTR(292, 2), - - /* 0101 ... */ - /* 0000 */ PTR(296, 2), /* 80 */ - /* 0001 */ PTR(300, 3), - /* 0010 */ PTR(308, 2), - /* 0011 */ PTR(312, 3), - /* 0100 */ PTR(320, 1), - /* 0101 */ PTR(322, 2), - /* 0110 */ PTR(326, 2), - /* 0111 */ PTR(330, 1), - /* 1000 */ PTR(332, 2), - /* 1001 */ PTR(336, 1), - /* 1010 */ PTR(338, 1), - /* 1011 */ PTR(340, 1), - /* 1100 */ PTR(342, 1), - /* 1101 */ PTR(344, 1), - /* 1110 */ PTR(346, 1), - /* 1111 */ PTR(348, 1), - - /* 0110 ... */ - /* 0000 */ PTR(350, 1), /* 96 */ - /* 0001 */ PTR(352, 1), - /* 0010 */ PTR(354, 1), - /* 0011 */ PTR(356, 1), - /* 0100 */ PTR(358, 1), - /* 0101 */ PTR(360, 1), - /* 0110 */ PTR(362, 1), - /* 0111 */ PTR(364, 1), - /* 1000 */ PTR(366, 1), - /* 1001 */ PTR(368, 1), - /* 1010 */ PTR(370, 2), - /* 1011 */ PTR(374, 1), - /* 1100 */ PTR(376, 2), - /* 1101 */ V(7, 3, 4), - /* 1110 */ PTR(380, 1), - /* 1111 */ V(7, 2, 4), - - /* 0111 ... */ - /* 0000 */ V(4, 6, 4), /* 112 */ - /* 0001 */ V(6, 4, 4), - /* 0010 */ V(5, 5, 4), - /* 0011 */ V(7, 1, 4), - /* 0100 */ V(3, 6, 4), - /* 0101 */ V(6, 3, 4), - /* 0110 */ V(4, 5, 4), - /* 0111 */ V(5, 4, 4), - /* 1000 */ V(2, 6, 4), - /* 1001 */ V(6, 2, 4), - /* 1010 */ V(1, 6, 4), - /* 1011 */ V(6, 1, 4), - /* 1100 */ PTR(382, 1), - /* 1101 */ V(3, 5, 4), - /* 1110 */ V(5, 3, 4), - /* 1111 */ V(4, 4, 4), - - /* 1000 ... */ - /* 0000 */ V(2, 5, 4), /* 128 */ - /* 0001 */ V(5, 2, 4), - /* 0010 */ V(1, 5, 4), - /* 0011 */ PTR(384, 1), - /* 0100 */ V(5, 1, 3), - /* 0101 */ V(5, 1, 3), - /* 0110 */ V(3, 4, 4), - /* 0111 */ V(4, 3, 4), - /* 1000 */ V(2, 4, 3), - /* 1001 */ V(2, 4, 3), - /* 1010 */ V(4, 2, 3), - /* 1011 */ V(4, 2, 3), - /* 1100 */ V(3, 3, 3), - /* 1101 */ V(3, 3, 3), - /* 1110 */ V(1, 4, 3), - /* 1111 */ V(1, 4, 3), - - /* 1001 ... */ - /* 0000 */ V(4, 1, 3), /* 144 */ - /* 0001 */ V(4, 1, 3), - /* 0010 */ V(0, 4, 4), - /* 0011 */ V(4, 0, 4), - /* 0100 */ V(2, 3, 3), - /* 0101 */ V(2, 3, 3), - /* 0110 */ V(3, 2, 3), - /* 0111 */ V(3, 2, 3), - /* 1000 */ V(1, 3, 2), - /* 1001 */ V(1, 3, 2), - /* 1010 */ V(1, 3, 2), - /* 1011 */ V(1, 3, 2), - /* 1100 */ V(3, 1, 2), - /* 1101 */ V(3, 1, 2), - /* 1110 */ V(3, 1, 2), - /* 1111 */ V(3, 1, 2), - - /* 1010 ... */ - /* 000 */ V(0, 3, 3), /* 160 */ - /* 001 */ V(3, 0, 3), - /* 010 */ V(2, 2, 2), - /* 011 */ V(2, 2, 2), - /* 100 */ V(1, 2, 1), - /* 101 */ V(1, 2, 1), - /* 110 */ V(1, 2, 1), - /* 111 */ V(1, 2, 1), - - /* 1011 ... */ - /* 00 */ V(2, 1, 1), /* 168 */ - /* 01 */ V(2, 1, 1), - /* 10 */ V(0, 2, 2), - /* 11 */ V(2, 0, 2), - - /* 0010 1100 ... */ - /* 000 */ V(0, 15, 1), /* 172 */ - /* 001 */ V(0, 15, 1), - /* 010 */ V(0, 15, 1), - /* 011 */ V(0, 15, 1), - /* 100 */ V(14, 14, 3), - /* 101 */ V(13, 14, 3), - /* 110 */ V(14, 13, 3), - /* 111 */ V(12, 14, 3), - - /* 0010 1101 ... */ - /* 000 */ V(14, 12, 3), /* 180 */ - /* 001 */ V(13, 13, 3), - /* 010 */ V(11, 14, 3), - /* 011 */ V(14, 11, 3), - /* 100 */ V(12, 13, 3), - /* 101 */ V(13, 12, 3), - /* 110 */ V(10, 14, 3), - /* 111 */ V(14, 10, 3), - - /* 0010 1110 ... */ - /* 000 */ V(11, 13, 3), /* 188 */ - /* 001 */ V(13, 11, 3), - /* 010 */ V(12, 12, 3), - /* 011 */ V(9, 14, 3), - /* 100 */ V(14, 9, 3), - /* 101 */ V(10, 13, 3), - /* 110 */ V(13, 10, 3), - /* 111 */ V(11, 12, 3), - - /* 0010 1111 ... */ - /* 000 */ V(12, 11, 3), /* 196 */ - /* 001 */ V(8, 14, 3), - /* 010 */ V(14, 8, 3), - /* 011 */ V(9, 13, 3), - /* 100 */ V(13, 9, 3), - /* 101 */ V(7, 14, 3), - /* 110 */ V(14, 7, 3), - /* 111 */ V(10, 12, 3), - - /* 0100 0000 ... */ - /* 0000 */ V(12, 10, 3), /* 204 */ - /* 0001 */ V(12, 10, 3), - /* 0010 */ V(11, 11, 3), - /* 0011 */ V(11, 11, 3), - /* 0100 */ V(8, 13, 3), - /* 0101 */ V(8, 13, 3), - /* 0110 */ V(13, 8, 3), - /* 0111 */ V(13, 8, 3), - /* 1000 */ V(0, 14, 4), - /* 1001 */ V(14, 0, 4), - /* 1010 */ V(0, 13, 3), - /* 1011 */ V(0, 13, 3), - /* 1100 */ V(14, 6, 2), - /* 1101 */ V(14, 6, 2), - /* 1110 */ V(14, 6, 2), - /* 1111 */ V(14, 6, 2), - - /* 0100 0001 ... */ - /* 000 */ V(6, 14, 3), /* 220 */ - /* 001 */ V(9, 12, 3), - /* 010 */ V(12, 9, 2), - /* 011 */ V(12, 9, 2), - /* 100 */ V(5, 14, 2), - /* 101 */ V(5, 14, 2), - /* 110 */ V(11, 10, 2), - /* 111 */ V(11, 10, 2), - - /* 0100 0010 ... */ - /* 000 */ V(14, 5, 2), /* 228 */ - /* 001 */ V(14, 5, 2), - /* 010 */ V(10, 11, 3), - /* 011 */ V(7, 13, 3), - /* 100 */ V(13, 7, 2), - /* 101 */ V(13, 7, 2), - /* 110 */ V(14, 4, 2), - /* 111 */ V(14, 4, 2), - - /* 0100 0011 ... */ - /* 000 */ V(8, 12, 2), /* 236 */ - /* 001 */ V(8, 12, 2), - /* 010 */ V(12, 8, 2), - /* 011 */ V(12, 8, 2), - /* 100 */ V(4, 14, 3), - /* 101 */ V(2, 14, 3), - /* 110 */ V(3, 14, 2), - /* 111 */ V(3, 14, 2), - - /* 0100 0100 ... */ - /* 00 */ V(6, 13, 2), /* 244 */ - /* 01 */ V(13, 6, 2), - /* 10 */ V(14, 3, 2), - /* 11 */ V(9, 11, 2), - - /* 0100 0101 ... */ - /* 00 */ V(11, 9, 2), /* 248 */ - /* 01 */ V(10, 10, 2), - /* 10 */ V(14, 2, 2), - /* 11 */ V(1, 14, 2), - - /* 0100 0110 ... */ - /* 00 */ V(14, 1, 2), /* 252 */ - /* 01 */ V(5, 13, 2), - /* 10 */ V(13, 5, 2), - /* 11 */ V(7, 12, 2), - - /* 0100 0111 ... */ - /* 00 */ V(12, 7, 2), /* 256 */ - /* 01 */ V(4, 13, 2), - /* 10 */ V(8, 11, 2), - /* 11 */ V(11, 8, 2), - - /* 0100 1000 ... */ - /* 00 */ V(13, 4, 2), /* 260 */ - /* 01 */ V(9, 10, 2), - /* 10 */ V(10, 9, 2), - /* 11 */ V(6, 12, 2), - - /* 0100 1001 ... */ - /* 00 */ V(12, 6, 2), /* 264 */ - /* 01 */ V(3, 13, 2), - /* 10 */ V(13, 3, 2), - /* 11 */ V(2, 13, 2), - - /* 0100 1010 ... */ - /* 00 */ V(13, 2, 2), /* 268 */ - /* 01 */ V(1, 13, 2), - /* 10 */ V(7, 11, 2), - /* 11 */ V(11, 7, 2), - - /* 0100 1011 ... */ - /* 00 */ V(13, 1, 2), /* 272 */ - /* 01 */ V(5, 12, 2), - /* 10 */ V(12, 5, 2), - /* 11 */ V(8, 10, 2), - - /* 0100 1100 ... */ - /* 00 */ V(10, 8, 2), /* 276 */ - /* 01 */ V(9, 9, 2), - /* 10 */ V(4, 12, 2), - /* 11 */ V(12, 4, 2), - - /* 0100 1101 ... */ - /* 000 */ V(6, 11, 2), /* 280 */ - /* 001 */ V(6, 11, 2), - /* 010 */ V(11, 6, 2), - /* 011 */ V(11, 6, 2), - /* 100 */ V(13, 0, 3), - /* 101 */ V(0, 12, 3), - /* 110 */ V(3, 12, 2), - /* 111 */ V(3, 12, 2), - - /* 0100 1110 ... */ - /* 00 */ V(12, 3, 2), /* 288 */ - /* 01 */ V(7, 10, 2), - /* 10 */ V(10, 7, 2), - /* 11 */ V(2, 12, 2), - - /* 0100 1111 ... */ - /* 00 */ V(12, 2, 2), /* 292 */ - /* 01 */ V(5, 11, 2), - /* 10 */ V(11, 5, 2), - /* 11 */ V(1, 12, 2), - - /* 0101 0000 ... */ - /* 00 */ V(8, 9, 2), /* 296 */ - /* 01 */ V(9, 8, 2), - /* 10 */ V(12, 1, 2), - /* 11 */ V(4, 11, 2), - - /* 0101 0001 ... */ - /* 000 */ V(12, 0, 3), /* 300 */ - /* 001 */ V(0, 11, 3), - /* 010 */ V(3, 11, 2), - /* 011 */ V(3, 11, 2), - /* 100 */ V(11, 0, 3), - /* 101 */ V(0, 10, 3), - /* 110 */ V(1, 10, 2), - /* 111 */ V(1, 10, 2), - - /* 0101 0010 ... */ - /* 00 */ V(11, 4, 1), /* 308 */ - /* 01 */ V(11, 4, 1), - /* 10 */ V(6, 10, 2), - /* 11 */ V(10, 6, 2), - - /* 0101 0011 ... */ - /* 000 */ V(7, 9, 2), /* 312 */ - /* 001 */ V(7, 9, 2), - /* 010 */ V(9, 7, 2), - /* 011 */ V(9, 7, 2), - /* 100 */ V(10, 0, 3), - /* 101 */ V(0, 9, 3), - /* 110 */ V(9, 0, 2), - /* 111 */ V(9, 0, 2), - - /* 0101 0100 ... */ - /* 0 */ V(11, 3, 1), /* 320 */ - /* 1 */ V(8, 8, 1), - - /* 0101 0101 ... */ - /* 00 */ V(2, 11, 2), /* 322 */ - /* 01 */ V(5, 10, 2), - /* 10 */ V(11, 2, 1), - /* 11 */ V(11, 2, 1), - - /* 0101 0110 ... */ - /* 00 */ V(10, 5, 2), /* 326 */ - /* 01 */ V(1, 11, 2), - /* 10 */ V(11, 1, 2), - /* 11 */ V(6, 9, 2), - - /* 0101 0111 ... */ - /* 0 */ V(9, 6, 1), /* 330 */ - /* 1 */ V(10, 4, 1), - - /* 0101 1000 ... */ - /* 00 */ V(4, 10, 2), /* 332 */ - /* 01 */ V(7, 8, 2), - /* 10 */ V(8, 7, 1), - /* 11 */ V(8, 7, 1), - - /* 0101 1001 ... */ - /* 0 */ V(3, 10, 1), /* 336 */ - /* 1 */ V(10, 3, 1), - - /* 0101 1010 ... */ - /* 0 */ V(5, 9, 1), /* 338 */ - /* 1 */ V(9, 5, 1), - - /* 0101 1011 ... */ - /* 0 */ V(2, 10, 1), /* 340 */ - /* 1 */ V(10, 2, 1), - - /* 0101 1100 ... */ - /* 0 */ V(10, 1, 1), /* 342 */ - /* 1 */ V(6, 8, 1), - - /* 0101 1101 ... */ - /* 0 */ V(8, 6, 1), /* 344 */ - /* 1 */ V(7, 7, 1), - - /* 0101 1110 ... */ - /* 0 */ V(4, 9, 1), /* 346 */ - /* 1 */ V(9, 4, 1), - - /* 0101 1111 ... */ - /* 0 */ V(3, 9, 1), /* 348 */ - /* 1 */ V(9, 3, 1), - - /* 0110 0000 ... */ - /* 0 */ V(5, 8, 1), /* 350 */ - /* 1 */ V(8, 5, 1), - - /* 0110 0001 ... */ - /* 0 */ V(2, 9, 1), /* 352 */ - /* 1 */ V(6, 7, 1), - - /* 0110 0010 ... */ - /* 0 */ V(7, 6, 1), /* 354 */ - /* 1 */ V(9, 2, 1), - - /* 0110 0011 ... */ - /* 0 */ V(1, 9, 1), /* 356 */ - /* 1 */ V(9, 1, 1), - - /* 0110 0100 ... */ - /* 0 */ V(4, 8, 1), /* 358 */ - /* 1 */ V(8, 4, 1), - - /* 0110 0101 ... */ - /* 0 */ V(5, 7, 1), /* 360 */ - /* 1 */ V(7, 5, 1), - - /* 0110 0110 ... */ - /* 0 */ V(3, 8, 1), /* 362 */ - /* 1 */ V(8, 3, 1), - - /* 0110 0111 ... */ - /* 0 */ V(6, 6, 1), /* 364 */ - /* 1 */ V(2, 8, 1), - - /* 0110 1000 ... */ - /* 0 */ V(8, 2, 1), /* 366 */ - /* 1 */ V(1, 8, 1), - - /* 0110 1001 ... */ - /* 0 */ V(4, 7, 1), /* 368 */ - /* 1 */ V(7, 4, 1), - - /* 0110 1010 ... */ - /* 00 */ V(8, 1, 1), /* 370 */ - /* 01 */ V(8, 1, 1), - /* 10 */ V(0, 8, 2), - /* 11 */ V(8, 0, 2), - - /* 0110 1011 ... */ - /* 0 */ V(5, 6, 1), /* 374 */ - /* 1 */ V(6, 5, 1), - - /* 0110 1100 ... */ - /* 00 */ V(1, 7, 1), /* 376 */ - /* 01 */ V(1, 7, 1), - /* 10 */ V(0, 7, 2), - /* 11 */ V(7, 0, 2), - - /* 0110 1110 ... */ - /* 0 */ V(3, 7, 1), /* 380 */ - /* 1 */ V(2, 7, 1), - - /* 0111 1100 ... */ - /* 0 */ V(0, 6, 1), /* 382 */ - /* 1 */ V(6, 0, 1), - - /* 1000 0011 ... */ - /* 0 */ V(0, 5, 1), /* 384 */ - /* 1 */ V(5, 0, 1) -}; - -# undef V -# undef PTR - -/* external tables */ - -union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB }; - -struct hufftable const mad_huff_pair_table[32] = { - /* 0 */ { hufftab0, 0, 0 }, - /* 1 */ { hufftab1, 0, 3 }, - /* 2 */ { hufftab2, 0, 3 }, - /* 3 */ { hufftab3, 0, 3 }, - /* 4 */ { 0 /* not used */ }, - /* 5 */ { hufftab5, 0, 3 }, - /* 6 */ { hufftab6, 0, 4 }, - /* 7 */ { hufftab7, 0, 4 }, - /* 8 */ { hufftab8, 0, 4 }, - /* 9 */ { hufftab9, 0, 4 }, - /* 10 */ { hufftab10, 0, 4 }, - /* 11 */ { hufftab11, 0, 4 }, - /* 12 */ { hufftab12, 0, 4 }, - /* 13 */ { hufftab13, 0, 4 }, - /* 14 */ { 0 /* not used */ }, - /* 15 */ { hufftab15, 0, 4 }, - /* 16 */ { hufftab16, 1, 4 }, - /* 17 */ { hufftab16, 2, 4 }, - /* 18 */ { hufftab16, 3, 4 }, - /* 19 */ { hufftab16, 4, 4 }, - /* 20 */ { hufftab16, 6, 4 }, - /* 21 */ { hufftab16, 8, 4 }, - /* 22 */ { hufftab16, 10, 4 }, - /* 23 */ { hufftab16, 13, 4 }, - /* 24 */ { hufftab24, 4, 4 }, - /* 25 */ { hufftab24, 5, 4 }, - /* 26 */ { hufftab24, 6, 4 }, - /* 27 */ { hufftab24, 7, 4 }, - /* 28 */ { hufftab24, 8, 4 }, - /* 29 */ { hufftab24, 9, 4 }, - /* 30 */ { hufftab24, 11, 4 }, - /* 31 */ { hufftab24, 13, 4 } -}; diff --git a/src/lib/dl/ext/libmad/huffman.h b/src/lib/dl/ext/libmad/huffman.h deleted file mode 100755 index 6325db44..00000000 --- a/src/lib/dl/ext/libmad/huffman.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: huffman.h,v 1.11 2004/01/23 09:41:32 rob Exp $ - */ - -# ifndef LIBMAD_HUFFMAN_H -# define LIBMAD_HUFFMAN_H - -union huffquad { - struct { - unsigned short final : 1; - unsigned short bits : 3; - unsigned short offset : 12; - } ptr; - struct { - unsigned short final : 1; - unsigned short hlen : 3; - unsigned short v : 1; - unsigned short w : 1; - unsigned short x : 1; - unsigned short y : 1; - } value; - unsigned short final : 1; -}; - -union huffpair { - struct { - unsigned short final : 1; - unsigned short bits : 3; - unsigned short offset : 12; - } ptr; - struct { - unsigned short final : 1; - unsigned short hlen : 3; - unsigned short x : 4; - unsigned short y : 4; - } value; - unsigned short final : 1; -}; - -struct hufftable { - union huffpair const *table; - unsigned short linbits; - unsigned short startbits; -}; - -extern union huffquad const *const mad_huff_quad_table[2]; -extern struct hufftable const mad_huff_pair_table[32]; - -# endif diff --git a/src/lib/dl/ext/libmad/imdct_s.dat b/src/lib/dl/ext/libmad/imdct_s.dat deleted file mode 100755 index 476710ea..00000000 --- a/src/lib/dl/ext/libmad/imdct_s.dat +++ /dev/null @@ -1,62 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: imdct_s.dat,v 1.8 2004/01/23 09:41:32 rob Exp $ - */ - - /* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */, - -MAD_F(0x0ec835e8) /* -0.923879533 */, - -MAD_F(0x0216a2a2) /* -0.130526192 */, - MAD_F(0x0fdcf549) /* 0.991444861 */, - -MAD_F(0x061f78aa) /* -0.382683432 */, - -MAD_F(0x0cb19346) /* -0.793353340 */ }, - - /* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */, - MAD_F(0x061f78aa) /* 0.382683432 */, - MAD_F(0x0fdcf549) /* 0.991444861 */, - MAD_F(0x0216a2a2) /* 0.130526192 */, - -MAD_F(0x0ec835e8) /* -0.923879533 */, - -MAD_F(0x09bd7ca0) /* -0.608761429 */ }, - - /* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */, - -MAD_F(0x0ec835e8) /* -0.923879533 */, - MAD_F(0x0ec835e8) /* 0.923879533 */, - -MAD_F(0x061f78aa) /* -0.382683432 */, - -MAD_F(0x061f78aa) /* -0.382683432 */, - MAD_F(0x0ec835e8) /* 0.923879533 */ }, - - /* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */, - -MAD_F(0x061f78aa) /* -0.382683432 */, - MAD_F(0x061f78aa) /* 0.382683432 */, - MAD_F(0x0ec835e8) /* 0.923879533 */, - MAD_F(0x0ec835e8) /* 0.923879533 */, - MAD_F(0x061f78aa) /* 0.382683432 */ }, - - /* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */, - -MAD_F(0x061f78aa) /* -0.382683432 */, - MAD_F(0x09bd7ca0) /* 0.608761429 */, - -MAD_F(0x0cb19346) /* -0.793353340 */, - MAD_F(0x0ec835e8) /* 0.923879533 */, - -MAD_F(0x0fdcf549) /* -0.991444861 */ }, - - /* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */, - -MAD_F(0x0ec835e8) /* -0.923879533 */, - -MAD_F(0x0cb19346) /* -0.793353340 */, - -MAD_F(0x09bd7ca0) /* -0.608761429 */, - -MAD_F(0x061f78aa) /* -0.382683432 */, - -MAD_F(0x0216a2a2) /* -0.130526192 */ } diff --git a/src/lib/dl/ext/libmad/layer12.c b/src/lib/dl/ext/libmad/layer12.c deleted file mode 100755 index 6981f9ce..00000000 --- a/src/lib/dl/ext/libmad/layer12.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: layer12.c,v 1.17 2004/02/05 09:02:39 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# ifdef HAVE_LIMITS_H -# include <limits.h> -# else -# define CHAR_BIT 8 -# endif - -# include "fixed.h" -# include "bit.h" -# include "stream.h" -# include "frame.h" -# include "layer12.h" - -/* - * scalefactor table - * used in both Layer I and Layer II decoding - */ -static -mad_fixed_t const sf_table[64] = { -# include "sf_table.dat" -}; - -/* --- Layer I ------------------------------------------------------------- */ - -/* linear scaling table */ -static -mad_fixed_t const linear_table[14] = { - MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */ - MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */ - MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */ - MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */ - MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */ - MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */ - MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */ - MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */ - MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */ - MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */ - MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */ - MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */ - MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */ - MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */ -}; - -/* - * NAME: I_sample() - * DESCRIPTION: decode one requantized Layer I sample from a bitstream - */ -static -mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb) -{ - mad_fixed_t sample; - - sample = mad_bit_read(ptr, nb); - - /* invert most significant bit, extend sign, then scale to fixed format */ - - sample ^= 1 << (nb - 1); - sample |= -(sample & (1 << (nb - 1))); - - sample <<= MAD_F_FRACBITS - (nb - 1); - - /* requantize the sample */ - - /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */ - - sample += MAD_F_ONE >> (nb - 1); - - return mad_f_mul(sample, linear_table[nb - 2]); - - /* s' = factor * s'' */ - /* (to be performed by caller) */ -} - -/* - * NAME: layer->I() - * DESCRIPTION: decode a single Layer I frame - */ -int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame) -{ - struct mad_header *header = &frame->header; - unsigned int nch, bound, ch, s, sb, nb; - unsigned char allocation[2][32], scalefactor[2][32]; - - nch = MAD_NCHANNELS(header); - - bound = 32; - if (header->mode == MAD_MODE_JOINT_STEREO) { - header->flags |= MAD_FLAG_I_STEREO; - bound = 4 + header->mode_extension * 4; - } - - /* check CRC word */ - - if (header->flags & MAD_FLAG_PROTECTION) { - header->crc_check = - mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)), - header->crc_check); - - if (header->crc_check != header->crc_target && - !(frame->options & MAD_OPTION_IGNORECRC)) { - stream->error = MAD_ERROR_BADCRC; - return -1; - } - } - - /* decode bit allocations */ - - for (sb = 0; sb < bound; ++sb) { - for (ch = 0; ch < nch; ++ch) { - nb = mad_bit_read(&stream->ptr, 4); - - if (nb == 15) { - stream->error = MAD_ERROR_BADBITALLOC; - return -1; - } - - allocation[ch][sb] = nb ? nb + 1 : 0; - } - } - - for (sb = bound; sb < 32; ++sb) { - nb = mad_bit_read(&stream->ptr, 4); - - if (nb == 15) { - stream->error = MAD_ERROR_BADBITALLOC; - return -1; - } - - allocation[0][sb] = - allocation[1][sb] = nb ? nb + 1 : 0; - } - - /* decode scalefactors */ - - for (sb = 0; sb < 32; ++sb) { - for (ch = 0; ch < nch; ++ch) { - if (allocation[ch][sb]) { - scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); - -# if defined(OPT_STRICT) - /* - * Scalefactor index 63 does not appear in Table B.1 of - * ISO/IEC 11172-3. Nonetheless, other implementations accept it, - * so we only reject it if OPT_STRICT is defined. - */ - if (scalefactor[ch][sb] == 63) { - stream->error = MAD_ERROR_BADSCALEFACTOR; - return -1; - } -# endif - } - } - } - - /* decode samples */ - - for (s = 0; s < 12; ++s) { - for (sb = 0; sb < bound; ++sb) { - for (ch = 0; ch < nch; ++ch) { - nb = allocation[ch][sb]; - frame->sbsample[ch][s][sb] = nb ? - mad_f_mul(I_sample(&stream->ptr, nb), - sf_table[scalefactor[ch][sb]]) : 0; - } - } - - for (sb = bound; sb < 32; ++sb) { - if ((nb = allocation[0][sb])) { - mad_fixed_t sample; - - sample = I_sample(&stream->ptr, nb); - - for (ch = 0; ch < nch; ++ch) { - frame->sbsample[ch][s][sb] = - mad_f_mul(sample, sf_table[scalefactor[ch][sb]]); - } - } - else { - for (ch = 0; ch < nch; ++ch) - frame->sbsample[ch][s][sb] = 0; - } - } - } - - return 0; -} - -/* --- Layer II ------------------------------------------------------------ */ - -/* possible quantization per subband table */ -static -struct { - unsigned int sblimit; - unsigned char const offsets[30]; -} const sbquant_table[5] = { - /* ISO/IEC 11172-3 Table B.2a */ - { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */ - 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } }, - /* ISO/IEC 11172-3 Table B.2b */ - { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */ - 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } }, - /* ISO/IEC 11172-3 Table B.2c */ - { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */ - /* ISO/IEC 11172-3 Table B.2d */ - { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */ - /* ISO/IEC 13818-3 Table B.1 */ - { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } -}; - -/* bit allocation table */ -static -struct { - unsigned short nbal; - unsigned short offset; -} const bitalloc_table[8] = { - { 2, 0 }, /* 0 */ - { 2, 3 }, /* 1 */ - { 3, 3 }, /* 2 */ - { 3, 1 }, /* 3 */ - { 4, 2 }, /* 4 */ - { 4, 3 }, /* 5 */ - { 4, 4 }, /* 6 */ - { 4, 5 } /* 7 */ -}; - -/* offsets into quantization class table */ -static -unsigned char const offset_table[6][15] = { - { 0, 1, 16 }, /* 0 */ - { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */ - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */ - { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */ - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */ - { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */ -}; - -/* quantization class table */ -static -struct quantclass { - unsigned short nlevels; - unsigned char group; - unsigned char bits; - mad_fixed_t C; - mad_fixed_t D; -} const qc_table[17] = { -# include "qc_table.dat" -}; - -/* - * NAME: II_samples() - * DESCRIPTION: decode three requantized Layer II samples from a bitstream - */ -static -void II_samples(struct mad_bitptr *ptr, - struct quantclass const *quantclass, - mad_fixed_t output[3]) -{ - unsigned int nb, s, sample[3]; - - if ((nb = quantclass->group)) { - unsigned int c, nlevels; - - /* degrouping */ - c = mad_bit_read(ptr, quantclass->bits); - nlevels = quantclass->nlevels; - - for (s = 0; s < 3; ++s) { - sample[s] = c % nlevels; - c /= nlevels; - } - } - else { - nb = quantclass->bits; - - for (s = 0; s < 3; ++s) - sample[s] = mad_bit_read(ptr, nb); - } - - for (s = 0; s < 3; ++s) { - mad_fixed_t requantized; - - /* invert most significant bit, extend sign, then scale to fixed format */ - - requantized = sample[s] ^ (1 << (nb - 1)); - requantized |= -(requantized & (1 << (nb - 1))); - - requantized <<= MAD_F_FRACBITS - (nb - 1); - - /* requantize the sample */ - - /* s'' = C * (s''' + D) */ - - output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C); - - /* s' = factor * s'' */ - /* (to be performed by caller) */ - } -} - -/* - * NAME: layer->II() - * DESCRIPTION: decode a single Layer II frame - */ -int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame) -{ - struct mad_header *header = &frame->header; - struct mad_bitptr start; - unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb; - unsigned char const *offsets; - unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3]; - mad_fixed_t samples[3]; - - nch = MAD_NCHANNELS(header); - - if (header->flags & MAD_FLAG_LSF_EXT) - index = 4; - else if (header->flags & MAD_FLAG_FREEFORMAT) - goto freeformat; - else { - unsigned long bitrate_per_channel; - - bitrate_per_channel = header->bitrate; - if (nch == 2) { - bitrate_per_channel /= 2; - -# if defined(OPT_STRICT) - /* - * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and - * 80 kbps bitrates in Layer II, but some encoders ignore this - * restriction. We enforce it if OPT_STRICT is defined. - */ - if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) { - stream->error = MAD_ERROR_BADMODE; - return -1; - } -# endif - } - else { /* nch == 1 */ - if (bitrate_per_channel > 192000) { - /* - * ISO/IEC 11172-3 does not allow single channel mode for 224, 256, - * 320, or 384 kbps bitrates in Layer II. - */ - stream->error = MAD_ERROR_BADMODE; - return -1; - } - } - - if (bitrate_per_channel <= 48000) - index = (header->samplerate == 32000) ? 3 : 2; - else if (bitrate_per_channel <= 80000) - index = 0; - else { - freeformat: - index = (header->samplerate == 48000) ? 0 : 1; - } - } - - sblimit = sbquant_table[index].sblimit; - offsets = sbquant_table[index].offsets; - - bound = 32; - if (header->mode == MAD_MODE_JOINT_STEREO) { - header->flags |= MAD_FLAG_I_STEREO; - bound = 4 + header->mode_extension * 4; - } - - if (bound > sblimit) - bound = sblimit; - - start = stream->ptr; - - /* decode bit allocations */ - - for (sb = 0; sb < bound; ++sb) { - nbal = bitalloc_table[offsets[sb]].nbal; - - for (ch = 0; ch < nch; ++ch) - allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); - } - - for (sb = bound; sb < sblimit; ++sb) { - nbal = bitalloc_table[offsets[sb]].nbal; - - allocation[0][sb] = - allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); - } - - /* decode scalefactor selection info */ - - for (sb = 0; sb < sblimit; ++sb) { - for (ch = 0; ch < nch; ++ch) { - if (allocation[ch][sb]) - scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); - } - } - - /* check CRC word */ - - if (header->flags & MAD_FLAG_PROTECTION) { - header->crc_check = - mad_bit_crc(start, mad_bit_length(&start, &stream->ptr), - header->crc_check); - - if (header->crc_check != header->crc_target && - !(frame->options & MAD_OPTION_IGNORECRC)) { - stream->error = MAD_ERROR_BADCRC; - return -1; - } - } - - /* decode scalefactors */ - - for (sb = 0; sb < sblimit; ++sb) { - for (ch = 0; ch < nch; ++ch) { - if (allocation[ch][sb]) { - scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); - - switch (scfsi[ch][sb]) { - case 2: - scalefactor[ch][sb][2] = - scalefactor[ch][sb][1] = - scalefactor[ch][sb][0]; - break; - - case 0: - scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); - /* fall through */ - - case 1: - case 3: - scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); - } - - if (scfsi[ch][sb] & 1) - scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1]; - -# if defined(OPT_STRICT) - /* - * Scalefactor index 63 does not appear in Table B.1 of - * ISO/IEC 11172-3. Nonetheless, other implementations accept it, - * so we only reject it if OPT_STRICT is defined. - */ - if (scalefactor[ch][sb][0] == 63 || - scalefactor[ch][sb][1] == 63 || - scalefactor[ch][sb][2] == 63) { - stream->error = MAD_ERROR_BADSCALEFACTOR; - return -1; - } -# endif - } - } - } - - /* decode samples */ - - for (gr = 0; gr < 12; ++gr) { - for (sb = 0; sb < bound; ++sb) { - for (ch = 0; ch < nch; ++ch) { - if ((index = allocation[ch][sb])) { - index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; - - II_samples(&stream->ptr, &qc_table[index], samples); - - for (s = 0; s < 3; ++s) { - frame->sbsample[ch][3 * gr + s][sb] = - mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); - } - } - else { - for (s = 0; s < 3; ++s) - frame->sbsample[ch][3 * gr + s][sb] = 0; - } - } - } - - for (sb = bound; sb < sblimit; ++sb) { - if ((index = allocation[0][sb])) { - index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; - - II_samples(&stream->ptr, &qc_table[index], samples); - - for (ch = 0; ch < nch; ++ch) { - for (s = 0; s < 3; ++s) { - frame->sbsample[ch][3 * gr + s][sb] = - mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]); - } - } - } - else { - for (ch = 0; ch < nch; ++ch) { - for (s = 0; s < 3; ++s) - frame->sbsample[ch][3 * gr + s][sb] = 0; - } - } - } - - for (ch = 0; ch < nch; ++ch) { - for (s = 0; s < 3; ++s) { - for (sb = sblimit; sb < 32; ++sb) - frame->sbsample[ch][3 * gr + s][sb] = 0; - } - } - } - - return 0; -} diff --git a/src/lib/dl/ext/libmad/layer12.h b/src/lib/dl/ext/libmad/layer12.h deleted file mode 100755 index e1c49969..00000000 --- a/src/lib/dl/ext/libmad/layer12.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: layer12.h,v 1.10 2004/01/23 09:41:32 rob Exp $ - */ - -# ifndef LIBMAD_LAYER12_H -# define LIBMAD_LAYER12_H - -# include "stream.h" -# include "frame.h" - -int mad_layer_I(struct mad_stream *, struct mad_frame *); -int mad_layer_II(struct mad_stream *, struct mad_frame *); - -# endif diff --git a/src/lib/dl/ext/libmad/layer3.c b/src/lib/dl/ext/libmad/layer3.c deleted file mode 100755 index 12231624..00000000 --- a/src/lib/dl/ext/libmad/layer3.c +++ /dev/null @@ -1,2739 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: layer3.c,v 1.43 2004/01/23 09:41:32 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include <stdlib.h> -# include <string.h> -# include <stdio.h> - -# ifdef HAVE_ASSERT_H -# include <assert.h> -# endif - -# ifdef HAVE_LIMITS_H -# include <limits.h> -# else -# define CHAR_BIT 8 -# endif - -#if TARGET_MSDOS == 16 -# include <dos.h> -#endif - -# include "fixed.h" -# include "bit.h" -# include "stream.h" -# include "frame.h" -# include "huffman.h" -# include "layer3.h" - -/* --- Layer III ----------------------------------------------------------- */ - -enum { - count1table_select = 0x01, - scalefac_scale = 0x02, - preflag = 0x04, - mixed_block_flag = 0x08 -}; - -enum { - I_STEREO = 0x1, - MS_STEREO = 0x2 -}; - -struct sideinfo { - unsigned int main_data_begin; - unsigned int private_bits; - - unsigned char scfsi[2]; - - struct granule { - struct channel { - /* from side info */ - unsigned short part2_3_length; - unsigned short big_values; - unsigned short global_gain; - unsigned short scalefac_compress; - - unsigned char flags; - unsigned char block_type; - unsigned char table_select[3]; - unsigned char subblock_gain[3]; - unsigned char region0_count; - unsigned char region1_count; - - /* from main_data */ - unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */ - } ch[2]; - } gr[2]; -}; - -/* - * scalefactor bit lengths - * derived from section 2.4.2.7 of ISO/IEC 11172-3 - */ -static -struct { - unsigned char slen1; - unsigned char slen2; -} const sflen_table[16] = { - { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 }, - { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 }, - { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 }, - { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 } -}; - -/* - * number of LSF scalefactor band values - * derived from section 2.4.3.2 of ISO/IEC 13818-3 - */ -static -unsigned char const nsfb_table[6][3][4] = { - { { 6, 5, 5, 5 }, - { 9, 9, 9, 9 }, - { 6, 9, 9, 9 } }, - - { { 6, 5, 7, 3 }, - { 9, 9, 12, 6 }, - { 6, 9, 12, 6 } }, - - { { 11, 10, 0, 0 }, - { 18, 18, 0, 0 }, - { 15, 18, 0, 0 } }, - - { { 7, 7, 7, 0 }, - { 12, 12, 12, 0 }, - { 6, 15, 12, 0 } }, - - { { 6, 6, 6, 3 }, - { 12, 9, 9, 6 }, - { 6, 12, 9, 6 } }, - - { { 8, 8, 5, 0 }, - { 15, 12, 9, 0 }, - { 6, 18, 9, 0 } } -}; - -/* - * MPEG-1 scalefactor band widths - * derived from Table B.8 of ISO/IEC 11172-3 - */ -static -unsigned char const sfb_48000_long[] = { - 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, - 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192 -}; - -static -unsigned char const sfb_44100_long[] = { - 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, - 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158 -}; - -static -unsigned char const sfb_32000_long[] = { - 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, - 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26 -}; - -static -unsigned char const sfb_48000_short[] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, - 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14, - 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 -}; - -static -unsigned char const sfb_44100_short[] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, - 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, - 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 -}; - -static -unsigned char const sfb_32000_short[] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, - 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20, - 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 -}; - -static -unsigned char const sfb_48000_mixed[] = { - /* long */ 4, 4, 4, 4, 4, 4, 6, 6, - /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10, - 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, - 16, 20, 20, 20, 26, 26, 26, 66, 66, 66 -}; - -static -unsigned char const sfb_44100_mixed[] = { - /* long */ 4, 4, 4, 4, 4, 4, 6, 6, - /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, - 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, - 18, 22, 22, 22, 30, 30, 30, 56, 56, 56 -}; - -static -unsigned char const sfb_32000_mixed[] = { - /* long */ 4, 4, 4, 4, 4, 4, 6, 6, - /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12, - 12, 12, 16, 16, 16, 20, 20, 20, 26, 26, - 26, 34, 34, 34, 42, 42, 42, 12, 12, 12 -}; - -/* - * MPEG-2 scalefactor band widths - * derived from Table B.2 of ISO/IEC 13818-3 - */ -static -unsigned char const sfb_24000_long[] = { - 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, - 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36 -}; - -static -unsigned char const sfb_22050_long[] = { - 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, - 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54 -}; - -# define sfb_16000_long sfb_22050_long - -static -unsigned char const sfb_24000_short[] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, - 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, - 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 -}; - -static -unsigned char const sfb_22050_short[] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, - 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18, - 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 -}; - -static -unsigned char const sfb_16000_short[] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, - 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18, - 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 -}; - -static -unsigned char const sfb_24000_mixed[] = { - /* long */ 6, 6, 6, 6, 6, 6, - /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, - 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, - 24, 32, 32, 32, 44, 44, 44, 12, 12, 12 -}; - -static -unsigned char const sfb_22050_mixed[] = { - /* long */ 6, 6, 6, 6, 6, 6, - /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10, - 10, 10, 14, 14, 14, 18, 18, 18, 26, 26, - 26, 32, 32, 32, 42, 42, 42, 18, 18, 18 -}; - -static -unsigned char const sfb_16000_mixed[] = { - /* long */ 6, 6, 6, 6, 6, 6, - /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, - 12, 12, 14, 14, 14, 18, 18, 18, 24, 24, - 24, 30, 30, 30, 40, 40, 40, 18, 18, 18 -}; - -/* - * MPEG 2.5 scalefactor band widths - * derived from public sources - */ -# define sfb_12000_long sfb_16000_long -# define sfb_11025_long sfb_12000_long - -static -unsigned char const sfb_8000_long[] = { - 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, - 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2 -}; - -# define sfb_12000_short sfb_16000_short -# define sfb_11025_short sfb_12000_short - -static -unsigned char const sfb_8000_short[] = { - 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16, - 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, - 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 -}; - -# define sfb_12000_mixed sfb_16000_mixed -# define sfb_11025_mixed sfb_12000_mixed - -/* the 8000 Hz short block scalefactor bands do not break after - the first 36 frequency lines, so this is probably wrong */ -static -unsigned char const sfb_8000_mixed[] = { - /* long */ 12, 12, 12, - /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16, - 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26 -}; - -static -struct { - unsigned char const *l; - unsigned char const *s; - unsigned char const *m; -} const sfbwidth_table[9] = { - { sfb_48000_long, sfb_48000_short, sfb_48000_mixed }, - { sfb_44100_long, sfb_44100_short, sfb_44100_mixed }, - { sfb_32000_long, sfb_32000_short, sfb_32000_mixed }, - { sfb_24000_long, sfb_24000_short, sfb_24000_mixed }, - { sfb_22050_long, sfb_22050_short, sfb_22050_mixed }, - { sfb_16000_long, sfb_16000_short, sfb_16000_mixed }, - { sfb_12000_long, sfb_12000_short, sfb_12000_mixed }, - { sfb_11025_long, sfb_11025_short, sfb_11025_mixed }, - { sfb_8000_long, sfb_8000_short, sfb_8000_mixed } -}; - -/* - * scalefactor band preemphasis (used only when preflag is set) - * derived from Table B.6 of ISO/IEC 11172-3 - */ -static -unsigned char const pretab[22] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 -}; - -/* - * table for requantization - * - * rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3) - */ -static -struct fixedfloat { - unsigned long mantissa : 27; - unsigned short exponent : 5; -} const rq_table[8207] = { -# include "rq_table.dat" -}; - -/* - * fractional powers of two - * used for requantization and joint stereo decoding - * - * root_table[3 + x] = 2^(x/4) - */ -static -mad_fixed_t const root_table[7] = { - MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */, - MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */, - MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */, - MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */, - MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */, - MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */, - MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */ -}; - -/* - * coefficients for aliasing reduction - * derived from Table B.9 of ISO/IEC 11172-3 - * - * c[] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 } - * cs[i] = 1 / sqrt(1 + c[i]^2) - * ca[i] = c[i] / sqrt(1 + c[i]^2) - */ -static -mad_fixed_t const cs[8] = { - +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */, - +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */, - +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */, - +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */ -}; - -static -mad_fixed_t const ca[8] = { - -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */, - -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */, - -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */, - -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */ -}; - -/* - * IMDCT coefficients for short blocks - * derived from section 2.4.3.4.10.2 of ISO/IEC 11172-3 - * - * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1)) - * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1)) - */ -static -mad_fixed_t const imdct_s[6][6] = { -# include "imdct_s.dat" -}; - -# if !defined(ASO_IMDCT) -/* - * windowing coefficients for long blocks - * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 - * - * window_l[i] = sin((PI / 36) * (i + 1/2)) - */ -static -mad_fixed_t const window_l[36] = { - MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */, - MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */, - MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */, - MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, - MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */, - MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */, - - MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */, - MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */, - MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */, - MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */, - MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */, - MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */, - - MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */, - MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */, - MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */, - MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */, - MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */, - MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */, -}; -# endif /* ASO_IMDCT */ - -/* - * windowing coefficients for short blocks - * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3 - * - * window_s[i] = sin((PI / 12) * (i + 1/2)) - */ -static -mad_fixed_t const window_s[12] = { - MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */, - MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */, - MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */, - MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */, - MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */, - MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */, -}; - -/* - * coefficients for intensity stereo processing - * derived from section 2.4.3.4.9.3 of ISO/IEC 11172-3 - * - * is_ratio[i] = tan(i * (PI / 12)) - * is_table[i] = is_ratio[i] / (1 + is_ratio[i]) - */ -static -mad_fixed_t const is_table[7] = { - MAD_F(0x00000000) /* 0.000000000 */, - MAD_F(0x0361962f) /* 0.211324865 */, - MAD_F(0x05db3d74) /* 0.366025404 */, - MAD_F(0x08000000) /* 0.500000000 */, - MAD_F(0x0a24c28c) /* 0.633974596 */, - MAD_F(0x0c9e69d1) /* 0.788675135 */, - MAD_F(0x10000000) /* 1.000000000 */ -}; - -/* - * coefficients for LSF intensity stereo processing - * derived from section 2.4.3.2 of ISO/IEC 13818-3 - * - * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1) - * is_lsf_table[1][i] = (1 / sqrt(2)) ^(i + 1) - */ -static -mad_fixed_t const is_lsf_table[2][15] = { - { - MAD_F(0x0d744fcd) /* 0.840896415 */, - MAD_F(0x0b504f33) /* 0.707106781 */, - MAD_F(0x09837f05) /* 0.594603558 */, - MAD_F(0x08000000) /* 0.500000000 */, - MAD_F(0x06ba27e6) /* 0.420448208 */, - MAD_F(0x05a8279a) /* 0.353553391 */, - MAD_F(0x04c1bf83) /* 0.297301779 */, - MAD_F(0x04000000) /* 0.250000000 */, - MAD_F(0x035d13f3) /* 0.210224104 */, - MAD_F(0x02d413cd) /* 0.176776695 */, - MAD_F(0x0260dfc1) /* 0.148650889 */, - MAD_F(0x02000000) /* 0.125000000 */, - MAD_F(0x01ae89fa) /* 0.105112052 */, - MAD_F(0x016a09e6) /* 0.088388348 */, - MAD_F(0x01306fe1) /* 0.074325445 */ - }, { - MAD_F(0x0b504f33) /* 0.707106781 */, - MAD_F(0x08000000) /* 0.500000000 */, - MAD_F(0x05a8279a) /* 0.353553391 */, - MAD_F(0x04000000) /* 0.250000000 */, - MAD_F(0x02d413cd) /* 0.176776695 */, - MAD_F(0x02000000) /* 0.125000000 */, - MAD_F(0x016a09e6) /* 0.088388348 */, - MAD_F(0x01000000) /* 0.062500000 */, - MAD_F(0x00b504f3) /* 0.044194174 */, - MAD_F(0x00800000) /* 0.031250000 */, - MAD_F(0x005a827a) /* 0.022097087 */, - MAD_F(0x00400000) /* 0.015625000 */, - MAD_F(0x002d413d) /* 0.011048543 */, - MAD_F(0x00200000) /* 0.007812500 */, - MAD_F(0x0016a09e) /* 0.005524272 */ - } -}; - -/* - * NAME: III_sideinfo() - * DESCRIPTION: decode frame side information from a bitstream - */ -static -enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch, - int lsf, struct sideinfo *si, - unsigned int *data_bitlen, - unsigned int *priv_bitlen) -{ - unsigned int ngr, gr, ch, i; - enum mad_error result = MAD_ERROR_NONE; - - *data_bitlen = 0; - *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3); - - si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9); - si->private_bits = mad_bit_read(ptr, *priv_bitlen); - - ngr = 1; - if (!lsf) { - ngr = 2; - - for (ch = 0; ch < nch; ++ch) - si->scfsi[ch] = mad_bit_read(ptr, 4); - } - - for (gr = 0; gr < ngr; ++gr) { - struct granule *granule = &si->gr[gr]; - - for (ch = 0; ch < nch; ++ch) { - struct channel *channel = &granule->ch[ch]; - - channel->part2_3_length = mad_bit_read(ptr, 12); - channel->big_values = mad_bit_read(ptr, 9); - channel->global_gain = mad_bit_read(ptr, 8); - channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4); - - *data_bitlen += channel->part2_3_length; - - if (channel->big_values > 288 && result == 0) - result = MAD_ERROR_BADBIGVALUES; - - channel->flags = 0; - - /* window_switching_flag */ - if (mad_bit_read(ptr, 1)) { - channel->block_type = mad_bit_read(ptr, 2); - - if (channel->block_type == 0 && result == 0) - result = MAD_ERROR_BADBLOCKTYPE; - - if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0) - result = MAD_ERROR_BADSCFSI; - - channel->region0_count = 7; - channel->region1_count = 36; - - if (mad_bit_read(ptr, 1)) - channel->flags |= mixed_block_flag; - else if (channel->block_type == 2) - channel->region0_count = 8; - - for (i = 0; i < 2; ++i) - channel->table_select[i] = mad_bit_read(ptr, 5); - -# if defined(DEBUG) - channel->table_select[2] = 4; /* not used */ -# endif - - for (i = 0; i < 3; ++i) - channel->subblock_gain[i] = mad_bit_read(ptr, 3); - } - else { - channel->block_type = 0; - - for (i = 0; i < 3; ++i) - channel->table_select[i] = mad_bit_read(ptr, 5); - - channel->region0_count = mad_bit_read(ptr, 4); - channel->region1_count = mad_bit_read(ptr, 3); - } - - /* [preflag,] scalefac_scale, count1table_select */ - channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3); - } - } - - return result; -} - -/* - * NAME: III_scalefactors_lsf() - * DESCRIPTION: decode channel scalefactors for LSF from a bitstream - */ -static -unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr, - struct channel *channel, - struct channel *gr1ch, int mode_extension) -{ - struct mad_bitptr start; - unsigned int scalefac_compress, index, slen[4], part, n, i; - unsigned char const *nsfb; - - start = *ptr; - - scalefac_compress = channel->scalefac_compress; - index = (channel->block_type == 2) ? - ((channel->flags & mixed_block_flag) ? 2 : 1) : 0; - - if (!((mode_extension & I_STEREO) && gr1ch)) { - if (scalefac_compress < 400) { - slen[0] = (scalefac_compress >> 4) / 5; - slen[1] = (scalefac_compress >> 4) % 5; - slen[2] = (scalefac_compress % 16) >> 2; - slen[3] = scalefac_compress % 4; - - nsfb = nsfb_table[0][index]; - } - else if (scalefac_compress < 500) { - scalefac_compress -= 400; - - slen[0] = (scalefac_compress >> 2) / 5; - slen[1] = (scalefac_compress >> 2) % 5; - slen[2] = scalefac_compress % 4; - slen[3] = 0; - - nsfb = nsfb_table[1][index]; - } - else { - scalefac_compress -= 500; - - slen[0] = scalefac_compress / 3; - slen[1] = scalefac_compress % 3; - slen[2] = 0; - slen[3] = 0; - - channel->flags |= preflag; - - nsfb = nsfb_table[2][index]; - } - - n = 0; - for (part = 0; part < 4; ++part) { - for (i = 0; i < nsfb[part]; ++i) - channel->scalefac[n++] = mad_bit_read(ptr, slen[part]); - } - - while (n < 39) - channel->scalefac[n++] = 0; - } - else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */ - scalefac_compress >>= 1; - - if (scalefac_compress < 180) { - slen[0] = scalefac_compress / 36; - slen[1] = (scalefac_compress % 36) / 6; - slen[2] = (scalefac_compress % 36) % 6; - slen[3] = 0; - - nsfb = nsfb_table[3][index]; - } - else if (scalefac_compress < 244) { - scalefac_compress -= 180; - - slen[0] = (scalefac_compress % 64) >> 4; - slen[1] = (scalefac_compress % 16) >> 2; - slen[2] = scalefac_compress % 4; - slen[3] = 0; - - nsfb = nsfb_table[4][index]; - } - else { - scalefac_compress -= 244; - - slen[0] = scalefac_compress / 3; - slen[1] = scalefac_compress % 3; - slen[2] = 0; - slen[3] = 0; - - nsfb = nsfb_table[5][index]; - } - - n = 0; - for (part = 0; part < 4; ++part) { - unsigned int max, is_pos; - - max = (1 << slen[part]) - 1; - - for (i = 0; i < nsfb[part]; ++i) { - is_pos = mad_bit_read(ptr, slen[part]); - - channel->scalefac[n] = is_pos; - gr1ch->scalefac[n++] = (is_pos == max); - } - } - - while (n < 39) { - channel->scalefac[n] = 0; - gr1ch->scalefac[n++] = 0; /* apparently not illegal */ - } - } - - return mad_bit_length(&start, ptr); -} - -/* - * NAME: III_scalefactors() - * DESCRIPTION: decode channel scalefactors of one granule from a bitstream - */ -static -unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel, - struct channel const *gr0ch, unsigned int scfsi) -{ - struct mad_bitptr start; - unsigned int slen1, slen2, sfbi; - - start = *ptr; - - slen1 = sflen_table[channel->scalefac_compress].slen1; - slen2 = sflen_table[channel->scalefac_compress].slen2; - - if (channel->block_type == 2) { - unsigned int nsfb; - - sfbi = 0; - - nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3; - while (nsfb--) - channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1); - - nsfb = 6 * 3; - while (nsfb--) - channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2); - - nsfb = 1 * 3; - while (nsfb--) - channel->scalefac[sfbi++] = 0; - } - else { /* channel->block_type != 2 */ - if (scfsi & 0x8) { - for (sfbi = 0; sfbi < 6; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; - } - else { - for (sfbi = 0; sfbi < 6; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); - } - - if (scfsi & 0x4) { - for (sfbi = 6; sfbi < 11; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; - } - else { - for (sfbi = 6; sfbi < 11; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen1); - } - - if (scfsi & 0x2) { - for (sfbi = 11; sfbi < 16; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; - } - else { - for (sfbi = 11; sfbi < 16; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); - } - - if (scfsi & 0x1) { - for (sfbi = 16; sfbi < 21; ++sfbi) - channel->scalefac[sfbi] = gr0ch->scalefac[sfbi]; - } - else { - for (sfbi = 16; sfbi < 21; ++sfbi) - channel->scalefac[sfbi] = mad_bit_read(ptr, slen2); - } - - channel->scalefac[21] = 0; - } - - return mad_bit_length(&start, ptr); -} - -/* - * The Layer III formula for requantization and scaling is defined by - * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows: - * - * long blocks: - * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * - * 2^((1/4) * (global_gain - 210)) * - * 2^-(scalefac_multiplier * - * (scalefac_l[sfb] + preflag * pretab[sfb])) - * - * short blocks: - * xr[i] = sign(is[i]) * abs(is[i])^(4/3) * - * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) * - * 2^-(scalefac_multiplier * scalefac_s[sfb][w]) - * - * where: - * scalefac_multiplier = (scalefac_scale + 1) / 2 - * - * The routines III_exponents() and III_requantize() facilitate this - * calculation. - */ - -/* - * NAME: III_exponents() - * DESCRIPTION: calculate scalefactor exponents - */ -static -void III_exponents(struct channel const *channel, - unsigned char const *sfbwidth, signed int exponents[39]) -{ - signed int gain; - unsigned int scalefac_multiplier, sfbi; - - gain = (signed int) channel->global_gain - 210; - scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1; - - if (channel->block_type == 2) { - unsigned int l; - signed int gain0, gain1, gain2; - - sfbi = l = 0; - - if (channel->flags & mixed_block_flag) { - unsigned int premask; - - premask = (channel->flags & preflag) ? ~0 : 0; - - /* long block subbands 0-1 */ - - while (l < 36) { - exponents[sfbi] = gain - - (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) << - scalefac_multiplier); - - l += sfbwidth[sfbi++]; - } - } - - /* this is probably wrong for 8000 Hz short/mixed blocks */ - - gain0 = gain - 8 * (signed int) channel->subblock_gain[0]; - gain1 = gain - 8 * (signed int) channel->subblock_gain[1]; - gain2 = gain - 8 * (signed int) channel->subblock_gain[2]; - - while (l < 576) { - exponents[sfbi + 0] = gain0 - - (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier); - exponents[sfbi + 1] = gain1 - - (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier); - exponents[sfbi + 2] = gain2 - - (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier); - - l += 3 * sfbwidth[sfbi]; - sfbi += 3; - } - } - else { /* channel->block_type != 2 */ - if (channel->flags & preflag) { - for (sfbi = 0; sfbi < 22; ++sfbi) { - exponents[sfbi] = gain - - (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) << - scalefac_multiplier); - } - } - else { - for (sfbi = 0; sfbi < 22; ++sfbi) { - exponents[sfbi] = gain - - (signed int) (channel->scalefac[sfbi] << scalefac_multiplier); - } - } - } -} - -/* - * NAME: III_requantize() - * DESCRIPTION: requantize one (positive) value - */ -static -mad_fixed_t III_requantize(unsigned int value, signed int exp) -{ - mad_fixed_t requantized; - signed int frac; - struct fixedfloat const *power; - - frac = exp % 4; /* assumes sign(frac) == sign(exp) */ - exp /= 4; - - power = &rq_table[value]; - requantized = power->mantissa; - exp += power->exponent; - - if (exp < 0) { - if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) { - /* underflow */ - requantized = 0; - } - else { - requantized += 1L << (-exp - 1); - requantized >>= -exp; - } - } - else { - if (exp >= 5) { - /* overflow */ -# if defined(DEBUG) - fprintf(stderr, "requantize overflow (%f * 2^%d)\n", - mad_f_todouble(requantized), exp); -# endif - requantized = MAD_F_MAX; - } - else - requantized <<= exp; - } - - return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized; -} - -/* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */ -# define MASK(cache, sz, bits) \ - (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1)) -# define MASK1BIT(cache, sz) \ - ((cache) & (1 << ((sz) - 1))) - -/* - * NAME: III_huffdecode() - * DESCRIPTION: decode Huffman code words of one channel of one granule - */ -static -enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576], - struct channel *channel, - unsigned char const *sfbwidth, - unsigned int part2_length) -{ - signed int exponents[39], exp; - signed int const *expptr; - struct mad_bitptr peek; - signed int bits_left, cachesz; - register mad_fixed_t *xrptr; - mad_fixed_t const *sfbound; - register unsigned long bitcache; - - bits_left = (signed) channel->part2_3_length - (signed) part2_length; - if (bits_left < 0) - return MAD_ERROR_BADPART3LEN; - - III_exponents(channel, sfbwidth, exponents); - - peek = *ptr; - mad_bit_skip(ptr, bits_left); - - /* align bit reads to byte boundaries */ - cachesz = mad_bit_bitsleft(&peek); - cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7; - - bitcache = mad_bit_read(&peek, cachesz); - bits_left -= cachesz; - - xrptr = &xr[0]; - - /* big_values */ - { - unsigned int region, rcount; - struct hufftable const *entry; - union huffpair const *table; - unsigned int linbits, startbits, big_values, reqhits; - mad_fixed_t reqcache[16]; - - sfbound = xrptr + *sfbwidth++; - rcount = channel->region0_count + 1; - - entry = &mad_huff_pair_table[channel->table_select[region = 0]]; - table = entry->table; - linbits = entry->linbits; - startbits = entry->startbits; - - if (table == 0) - return MAD_ERROR_BADHUFFTABLE; - - expptr = &exponents[0]; - exp = *expptr++; - reqhits = 0; - - big_values = channel->big_values; - - while (big_values-- && cachesz + bits_left > 0) { - union huffpair const *pair; - unsigned int clumpsz, value; - register mad_fixed_t requantized; - - if (xrptr == sfbound) { - sfbound += *sfbwidth++; - - /* change table if region boundary */ - - if (--rcount == 0) { - if (region == 0) - rcount = channel->region1_count + 1; - else - rcount = 0; /* all remaining */ - - entry = &mad_huff_pair_table[channel->table_select[++region]]; - table = entry->table; - linbits = entry->linbits; - startbits = entry->startbits; - - if (table == 0) - return MAD_ERROR_BADHUFFTABLE; - } - - if (exp != *expptr) { - exp = *expptr; - reqhits = 0; - } - - ++expptr; - } - - if (cachesz < 21) { - unsigned int bits; - - bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7; - bitcache = (bitcache << bits) | mad_bit_read(&peek, bits); - cachesz += bits; - bits_left -= bits; - } - - /* hcod (0..19) */ - - clumpsz = startbits; - pair = &table[MASK(bitcache, cachesz, clumpsz)]; - - while (!pair->final) { - cachesz -= clumpsz; - - clumpsz = pair->ptr.bits; - pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)]; - } - - cachesz -= pair->value.hlen; - - if (linbits) { - /* x (0..14) */ - - value = pair->value.x; - - switch (value) { - case 0: - xrptr[0] = 0; - break; - - case 15: - if (cachesz < linbits + 2) { - bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); - cachesz += 16; - bits_left -= 16; - } - - value += MASK(bitcache, cachesz, linbits); - cachesz -= linbits; - - requantized = III_requantize(value, exp); - goto x_final; - - default: - if (reqhits & (1 << value)) - requantized = reqcache[value]; - else { - reqhits |= (1 << value); - requantized = reqcache[value] = III_requantize(value, exp); - } - - x_final: - xrptr[0] = MASK1BIT(bitcache, cachesz--) ? - -requantized : requantized; - } - - /* y (0..14) */ - - value = pair->value.y; - - switch (value) { - case 0: - xrptr[1] = 0; - break; - - case 15: - if (cachesz < linbits + 1) { - bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); - cachesz += 16; - bits_left -= 16; - } - - value += MASK(bitcache, cachesz, linbits); - cachesz -= linbits; - - requantized = III_requantize(value, exp); - goto y_final; - - default: - if (reqhits & (1 << value)) - requantized = reqcache[value]; - else { - reqhits |= (1 << value); - requantized = reqcache[value] = III_requantize(value, exp); - } - - y_final: - xrptr[1] = MASK1BIT(bitcache, cachesz--) ? - -requantized : requantized; - } - } - else { - /* x (0..1) */ - - value = pair->value.x; - - if (value == 0) - xrptr[0] = 0; - else { - if (reqhits & (1 << value)) - requantized = reqcache[value]; - else { - reqhits |= (1 << value); - requantized = reqcache[value] = III_requantize(value, exp); - } - - xrptr[0] = MASK1BIT(bitcache, cachesz--) ? - -requantized : requantized; - } - - /* y (0..1) */ - - value = pair->value.y; - - if (value == 0) - xrptr[1] = 0; - else { - if (reqhits & (1 << value)) - requantized = reqcache[value]; - else { - reqhits |= (1 << value); - requantized = reqcache[value] = III_requantize(value, exp); - } - - xrptr[1] = MASK1BIT(bitcache, cachesz--) ? - -requantized : requantized; - } - } - - xrptr += 2; - } - } - - if (cachesz + bits_left < 0) - return MAD_ERROR_BADHUFFDATA; /* big_values overrun */ - - /* count1 */ - { - union huffquad const *table; - register mad_fixed_t requantized; - - table = mad_huff_quad_table[channel->flags & count1table_select]; - - requantized = III_requantize(1, exp); - - while (cachesz + bits_left > 0 && xrptr <= &xr[572]) { - union huffquad const *quad; - - /* hcod (1..6) */ - - if (cachesz < 10) { - bitcache = (bitcache << 16) | mad_bit_read(&peek, 16); - cachesz += 16; - bits_left -= 16; - } - - quad = &table[MASK(bitcache, cachesz, 4)]; - - /* quad tables guaranteed to have at most one extra lookup */ - if (!quad->final) { - cachesz -= 4; - - quad = &table[quad->ptr.offset + - MASK(bitcache, cachesz, quad->ptr.bits)]; - } - - cachesz -= quad->value.hlen; - - if (xrptr == sfbound) { - sfbound += *sfbwidth++; - - if (exp != *expptr) { - exp = *expptr; - requantized = III_requantize(1, exp); - } - - ++expptr; - } - - /* v (0..1) */ - - xrptr[0] = quad->value.v ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; - - /* w (0..1) */ - - xrptr[1] = quad->value.w ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; - - xrptr += 2; - - if (xrptr == sfbound) { - sfbound += *sfbwidth++; - - if (exp != *expptr) { - exp = *expptr; - requantized = III_requantize(1, exp); - } - - ++expptr; - } - - /* x (0..1) */ - - xrptr[0] = quad->value.x ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; - - /* y (0..1) */ - - xrptr[1] = quad->value.y ? - (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0; - - xrptr += 2; - } - - if (cachesz + bits_left < 0) { -# if 0 && defined(DEBUG) - fprintf(stderr, "huffman count1 overrun (%d bits)\n", - -(cachesz + bits_left)); -# endif - - /* technically the bitstream is misformatted, but apparently - some encoders are just a bit sloppy with stuffing bits */ - - xrptr -= 4; - } - } - - assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT); - -# if 0 && defined(DEBUG) - if (bits_left < 0) - fprintf(stderr, "read %d bits too many\n", -bits_left); - else if (cachesz + bits_left > 0) - fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left); -# endif - - /* rzero */ - while (xrptr < &xr[576]) { - xrptr[0] = 0; - xrptr[1] = 0; - - xrptr += 2; - } - - return MAD_ERROR_NONE; -} - -# undef MASK -# undef MASK1BIT - -#if TARGET_MSDOS == 16 -static mad_fixed_t III_reorder_tmp[32][3][6]; /* FIXME */ -#endif - -/* - * NAME: III_reorder() - * DESCRIPTION: reorder frequency lines of a short block into subband order - */ -static -void III_reorder(mad_fixed_t xr[576], struct channel const *channel, - unsigned char const sfbwidth[39]) -{ -#if TARGET_MSDOS == 16 - mad_fixed_t (*tmp)[3][6] = III_reorder_tmp; -#else - mad_fixed_t tmp[32][3][6]; -#endif - unsigned int sb, l, f, w, sbw[3], sw[3]; - - /* this is probably wrong for 8000 Hz mixed blocks */ - - sb = 0; - if (channel->flags & mixed_block_flag) { - sb = 2; - - l = 0; - while (l < 36) - l += *sfbwidth++; - } - - for (w = 0; w < 3; ++w) { - sbw[w] = sb; - sw[w] = 0; - } - - f = *sfbwidth++; - w = 0; - - for (l = 18 * sb; l < 576; ++l) { - if (f-- == 0) { - f = *sfbwidth++ - 1; - w = (w + 1) % 3; - } - - tmp[sbw[w]][w][sw[w]++] = xr[l]; - - if (sw[w] == 6) { - sw[w] = 0; - ++sbw[w]; - } - } - - memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t)); -} - -/* - * NAME: III_stereo() - * DESCRIPTION: perform joint stereo processing on a granule - */ -static -enum mad_error III_stereo(mad_fixed_t xr[2][576], - struct granule const *granule, - struct mad_header *header, - unsigned char const *sfbwidth) -{ - short modes[39]; - unsigned int sfbi, l, n, i; - - if (granule->ch[0].block_type != - granule->ch[1].block_type || - (granule->ch[0].flags & mixed_block_flag) != - (granule->ch[1].flags & mixed_block_flag)) - return MAD_ERROR_BADSTEREO; - - for (i = 0; i < 39; ++i) - modes[i] = header->mode_extension; - - /* intensity stereo */ - - if (header->mode_extension & I_STEREO) { - struct channel const *right_ch = &granule->ch[1]; - mad_fixed_t const *right_xr = xr[1]; - unsigned int is_pos; - - header->flags |= MAD_FLAG_I_STEREO; - - /* first determine which scalefactor bands are to be processed */ - - if (right_ch->block_type == 2) { - unsigned int lower, start, max, bound[3], w; - - lower = start = max = bound[0] = bound[1] = bound[2] = 0; - - sfbi = l = 0; - - if (right_ch->flags & mixed_block_flag) { - while (l < 36) { - n = sfbwidth[sfbi++]; - - for (i = 0; i < n; ++i) { - if (right_xr[i]) { - lower = sfbi; - break; - } - } - - right_xr += n; - l += n; - } - - start = sfbi; - } - - w = 0; - while (l < 576) { - n = sfbwidth[sfbi++]; - - for (i = 0; i < n; ++i) { - if (right_xr[i]) { - max = bound[w] = sfbi; - break; - } - } - - right_xr += n; - l += n; - w = (w + 1) % 3; - } - - if (max) - lower = start; - - /* long blocks */ - - for (i = 0; i < lower; ++i) - modes[i] = header->mode_extension & ~I_STEREO; - - /* short blocks */ - - w = 0; - for (i = start; i < max; ++i) { - if (i < bound[w]) - modes[i] = header->mode_extension & ~I_STEREO; - - w = (w + 1) % 3; - } - } - else { /* right_ch->block_type != 2 */ - unsigned int bound; - - bound = 0; - for (sfbi = l = 0; l < 576; l += n) { - n = sfbwidth[sfbi++]; - - for (i = 0; i < n; ++i) { - if (right_xr[i]) { - bound = sfbi; - break; - } - } - - right_xr += n; - } - - for (i = 0; i < bound; ++i) - modes[i] = header->mode_extension & ~I_STEREO; - } - - /* now do the actual processing */ - - if (header->flags & MAD_FLAG_LSF_EXT) { - unsigned char const *illegal_pos = granule[1].ch[1].scalefac; - mad_fixed_t const *lsf_scale; - - /* intensity_scale */ - lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1]; - - for (sfbi = l = 0; l < 576; ++sfbi, l += n) { - n = sfbwidth[sfbi]; - - if (!(modes[sfbi] & I_STEREO)) - continue; - - if (illegal_pos[sfbi]) { - modes[sfbi] &= ~I_STEREO; - continue; - } - - is_pos = right_ch->scalefac[sfbi]; - - for (i = 0; i < n; ++i) { - register mad_fixed_t left; - - left = xr[0][l + i]; - - if (is_pos == 0) - xr[1][l + i] = left; - else { - register mad_fixed_t opposite; - - opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]); - - if (is_pos & 1) { - xr[0][l + i] = opposite; - xr[1][l + i] = left; - } - else - xr[1][l + i] = opposite; - } - } - } - } - else { /* !(header->flags & MAD_FLAG_LSF_EXT) */ - for (sfbi = l = 0; l < 576; ++sfbi, l += n) { - n = sfbwidth[sfbi]; - - if (!(modes[sfbi] & I_STEREO)) - continue; - - is_pos = right_ch->scalefac[sfbi]; - - if (is_pos >= 7) { /* illegal intensity position */ - modes[sfbi] &= ~I_STEREO; - continue; - } - - for (i = 0; i < n; ++i) { - register mad_fixed_t left; - - left = xr[0][l + i]; - - xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]); - xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]); - } - } - } - } - - /* middle/side stereo */ - - if (header->mode_extension & MS_STEREO) { - register mad_fixed_t invsqrt2; - - header->flags |= MAD_FLAG_MS_STEREO; - - invsqrt2 = root_table[3 + -2]; - - for (sfbi = l = 0; l < 576; ++sfbi, l += n) { - n = sfbwidth[sfbi]; - - if (modes[sfbi] != MS_STEREO) - continue; - - for (i = 0; i < n; ++i) { - register mad_fixed_t m, s; - - m = xr[0][l + i]; - s = xr[1][l + i]; - - xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */ - xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */ - } - } - } - - return MAD_ERROR_NONE; -} - -/* - * NAME: III_aliasreduce() - * DESCRIPTION: perform frequency line alias reduction - */ -static -void III_aliasreduce(mad_fixed_t xr[576], int lines) -{ - mad_fixed_t const *bound; - int i; - -/* NTS: Testing shows this function is NOT responsible for 16-bit build memory corruption */ - - bound = &xr[lines]; - for (xr += 18; xr < bound; xr += 18) { - for (i = 0; i < 8; ++i) { - register mad_fixed_t a, b; - register mad_fixed64hi_t hi; - register mad_fixed64lo_t lo; - - a = xr[-1 - i]; - b = xr[ i]; - -# if defined(ASO_ZEROCHECK) - if (a | b) { -# endif - MAD_F_ML0(hi, lo, a, cs[i]); - MAD_F_MLA(hi, lo, -b, ca[i]); - - xr[-1 - i] = MAD_F_MLZ(hi, lo); - - MAD_F_ML0(hi, lo, b, cs[i]); - MAD_F_MLA(hi, lo, a, ca[i]); - - xr[ i] = MAD_F_MLZ(hi, lo); -# if defined(ASO_ZEROCHECK) - } -# endif - } - } -} - -# if defined(ASO_IMDCT) -void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int); -# else -# if 1 -static -void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[18]) -{ - mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12; - mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25; - mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7; - - enum { - c0 = MAD_F(0x1f838b8d), /* 2 * cos( 1 * PI / 18) */ - c1 = MAD_F(0x1bb67ae8), /* 2 * cos( 3 * PI / 18) */ - c2 = MAD_F(0x18836fa3), /* 2 * cos( 4 * PI / 18) */ - c3 = MAD_F(0x1491b752), /* 2 * cos( 5 * PI / 18) */ - c4 = MAD_F(0x0af1d43a), /* 2 * cos( 7 * PI / 18) */ - c5 = MAD_F(0x058e86a0), /* 2 * cos( 8 * PI / 18) */ - c6 = -MAD_F(0x1e11f642) /* 2 * cos(16 * PI / 18) */ - }; - - a0 = x[3] + x[5]; - a1 = x[3] - x[5]; - a2 = x[6] + x[2]; - a3 = x[6] - x[2]; - a4 = x[1] + x[7]; - a5 = x[1] - x[7]; - a6 = x[8] + x[0]; - a7 = x[8] - x[0]; - - a8 = a0 + a2; - a9 = a0 - a2; - a10 = a0 - a6; - a11 = a2 - a6; - a12 = a8 + a6; - a13 = a1 - a3; - a14 = a13 + a7; - a15 = a3 + a7; - a16 = a1 - a7; - a17 = a1 + a3; - - m0 = mad_f_mul(a17, -c3); - m1 = mad_f_mul(a16, -c0); - m2 = mad_f_mul(a15, -c4); - m3 = mad_f_mul(a14, -c1); - m4 = mad_f_mul(a5, -c1); - m5 = mad_f_mul(a11, -c6); - m6 = mad_f_mul(a10, -c5); - m7 = mad_f_mul(a9, -c2); - - a18 = x[4] + a4; - a19 = 2 * x[4] - a4; - a20 = a19 + m5; - a21 = a19 - m5; - a22 = a19 + m6; - a23 = m4 + m2; - a24 = m4 - m2; - a25 = m4 + m1; - - /* output to every other slot for convenience */ - - y[ 0] = a18 + a12; - y[ 2] = m0 - a25; - y[ 4] = m7 - a20; - y[ 6] = m3; - y[ 8] = a21 - m6; - y[10] = a24 - m1; - y[12] = a12 - 2 * a18; - y[14] = a23 + m0; - y[16] = a22 + m7; -} - -static inline -void sdctII(mad_fixed_t const x[18], mad_fixed_t X[18]) -{ - mad_fixed_t tmp[9]; - int i; - - /* scale[i] = 2 * cos(PI * (2 * i + 1) / (2 * 18)) */ - static mad_fixed_t const scale[9] = { - MAD_F(0x1fe0d3b4), MAD_F(0x1ee8dd47), MAD_F(0x1d007930), - MAD_F(0x1a367e59), MAD_F(0x16a09e66), MAD_F(0x125abcf8), - MAD_F(0x0d8616bc), MAD_F(0x08483ee1), MAD_F(0x02c9fad7) - }; - - /* divide the 18-point SDCT-II into two 9-point SDCT-IIs */ - - /* even input butterfly */ - - for (i = 0; i < 9; i += 3) { - tmp[i + 0] = x[i + 0] + x[18 - (i + 0) - 1]; - tmp[i + 1] = x[i + 1] + x[18 - (i + 1) - 1]; - tmp[i + 2] = x[i + 2] + x[18 - (i + 2) - 1]; - } - - fastsdct(tmp, &X[0]); - - /* odd input butterfly and scaling */ - - for (i = 0; i < 9; i += 3) { - tmp[i + 0] = mad_f_mul(x[i + 0] - x[18 - (i + 0) - 1], scale[i + 0]); - tmp[i + 1] = mad_f_mul(x[i + 1] - x[18 - (i + 1) - 1], scale[i + 1]); - tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], scale[i + 2]); - } - - fastsdct(tmp, &X[1]); - - /* output accumulation */ - - for (i = 3; i < 18; i += 8) { - X[i + 0] -= X[(i + 0) - 2]; - X[i + 2] -= X[(i + 2) - 2]; - X[i + 4] -= X[(i + 4) - 2]; - X[i + 6] -= X[(i + 6) - 2]; - } -} - -static inline -void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18]) -{ - mad_fixed_t tmp[18]; - int i; - - /* scale[i] = 2 * cos(PI * (2 * i + 1) / (4 * 18)) */ - static mad_fixed_t const scale[18] = { - MAD_F(0x1ff833fa), MAD_F(0x1fb9ea93), MAD_F(0x1f3dd120), - MAD_F(0x1e84d969), MAD_F(0x1d906bcf), MAD_F(0x1c62648b), - MAD_F(0x1afd100f), MAD_F(0x1963268b), MAD_F(0x1797c6a4), - MAD_F(0x159e6f5b), MAD_F(0x137af940), MAD_F(0x11318ef3), - MAD_F(0x0ec6a507), MAD_F(0x0c3ef153), MAD_F(0x099f61c5), - MAD_F(0x06ed12c5), MAD_F(0x042d4544), MAD_F(0x0165547c) - }; - - /* scaling */ - - for (i = 0; i < 18; i += 3) { - tmp[i + 0] = mad_f_mul(y[i + 0], scale[i + 0]); - tmp[i + 1] = mad_f_mul(y[i + 1], scale[i + 1]); - tmp[i + 2] = mad_f_mul(y[i + 2], scale[i + 2]); - } - - /* SDCT-II */ - - sdctII(tmp, X); - - /* scale reduction and output accumulation */ - - X[0] /= 2; - for (i = 1; i < 17; i += 4) { - X[i + 0] = X[i + 0] / 2 - X[(i + 0) - 1]; - X[i + 1] = X[i + 1] / 2 - X[(i + 1) - 1]; - X[i + 2] = X[i + 2] / 2 - X[(i + 2) - 1]; - X[i + 3] = X[i + 3] / 2 - X[(i + 3) - 1]; - } - X[17] = X[17] / 2 - X[16]; -} - -/* - * NAME: imdct36 - * DESCRIPTION: perform X[18]->x[36] IMDCT using Szu-Wei Lee's fast algorithm - */ -static inline -void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36]) -{ - mad_fixed_t tmp[18]; - int i; - - /* DCT-IV */ - - dctIV(x, tmp); - - /* convert 18-point DCT-IV to 36-point IMDCT */ - - for (i = 0; i < 9; i += 3) { - y[i + 0] = tmp[9 + (i + 0)]; - y[i + 1] = tmp[9 + (i + 1)]; - y[i + 2] = tmp[9 + (i + 2)]; - } - for (i = 9; i < 27; i += 3) { - y[i + 0] = -tmp[36 - (9 + (i + 0)) - 1]; - y[i + 1] = -tmp[36 - (9 + (i + 1)) - 1]; - y[i + 2] = -tmp[36 - (9 + (i + 2)) - 1]; - } - for (i = 27; i < 36; i += 3) { - y[i + 0] = -tmp[(i + 0) - 27]; - y[i + 1] = -tmp[(i + 1) - 27]; - y[i + 2] = -tmp[(i + 2) - 27]; - } -} -# else -/* - * NAME: imdct36 - * DESCRIPTION: perform X[18]->x[36] IMDCT - */ -static inline -void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36]) -{ - mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; - mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; - register mad_fixed64hi_t hi; - register mad_fixed64lo_t lo; - - MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8)); - MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa)); - - t6 = MAD_F_MLZ(hi, lo); - - MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa)); - MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8)); - - t0 = MAD_F_MLZ(hi, lo); - - MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2)); - MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0)); - MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346)); - MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549)); - - x[7] = MAD_F_MLZ(hi, lo); - x[10] = -x[7]; - - MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346)); - MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549)); - MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2)); - MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0)); - - x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0; - - t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15]; - t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17]; - - MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8)); - MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa)); - - x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0; - - MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0)); - MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2)); - MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549)); - MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346)); - - t1 = MAD_F_MLZ(hi, lo) + t6; - - MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890)); - - x[6] = MAD_F_MLZ(hi, lo) + t1; - x[11] = -x[6]; - - MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2)); - - x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1; - - MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad)); - - x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1; - - MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa)); - MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8)); - - t7 = MAD_F_MLZ(hi, lo); - - MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346)); - MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549)); - MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2)); - MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0)); - - t2 = MAD_F_MLZ(hi, lo); - - MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5)); - - x[5] = MAD_F_MLZ(hi, lo); - x[12] = -x[5]; - - MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352)); - - x[0] = MAD_F_MLZ(hi, lo) + t2; - x[17] = -x[0]; - - MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962)); - - x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2; - - MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2)); - MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0)); - MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346)); - MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549)); - - t3 = MAD_F_MLZ(hi, lo) + t7; - - MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd)); - - x[8] = MAD_F_MLZ(hi, lo) + t3; - x[9] = -x[8]; - - MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284)); - - x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3; - - MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779)); - - x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3; - - MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8)); - MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa)); - - t4 = MAD_F_MLZ(hi, lo) - t7; - - MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa)); - MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8)); - - x[4] = MAD_F_MLZ(hi, lo) + t4; - x[13] = -x[4]; - - MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0)); - MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2)); - MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549)); - MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346)); - - x[1] = MAD_F_MLZ(hi, lo) + t4; - x[16] = -x[1]; - - MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549)); - MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346)); - MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0)); - MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2)); - - x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4; - - MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549)); - MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346)); - MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0)); - MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2)); - - t5 = MAD_F_MLZ(hi, lo) - t6; - - MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807)); - - x[2] = MAD_F_MLZ(hi, lo) + t5; - x[15] = -x[2]; - - MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e)); - MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245)); - - x[3] = MAD_F_MLZ(hi, lo) + t5; - x[14] = -x[3]; - - MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd)); - MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890)); - MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5)); - MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245)); - MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807)); - MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352)); - MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad)); - MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779)); - MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284)); - MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2)); - MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962)); - MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e)); - - x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5; -} -# endif - -/* - * NAME: III_imdct_l() - * DESCRIPTION: perform IMDCT and windowing for long blocks - */ -static -void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36], - unsigned int block_type) -{ - unsigned int i; - - /* IMDCT */ - - imdct36(X, z); - - /* windowing */ - - switch (block_type) { - case 0: /* normal window */ -# if defined(ASO_INTERLEAVE1) - { - register mad_fixed_t tmp1, tmp2; - - tmp1 = window_l[0]; - tmp2 = window_l[1]; - - for (i = 0; i < 34; i += 2) { - z[i + 0] = mad_f_mul(z[i + 0], tmp1); - tmp1 = window_l[i + 2]; - z[i + 1] = mad_f_mul(z[i + 1], tmp2); - tmp2 = window_l[i + 3]; - } - - z[34] = mad_f_mul(z[34], tmp1); - z[35] = mad_f_mul(z[35], tmp2); - } -# elif defined(ASO_INTERLEAVE2) - { - register mad_fixed_t tmp1, tmp2; - - tmp1 = z[0]; - tmp2 = window_l[0]; - - for (i = 0; i < 35; ++i) { - z[i] = mad_f_mul(tmp1, tmp2); - tmp1 = z[i + 1]; - tmp2 = window_l[i + 1]; - } - - z[35] = mad_f_mul(tmp1, tmp2); - } -# elif 1 - for (i = 0; i < 36; i += 4) { - z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); - z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); - z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); - z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]); - } -# else - for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]); -# endif - break; - - case 1: /* start block */ - for (i = 0; i < 18; i += 3) { - z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); - z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); - z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); - } - /* (i = 18; i < 24; ++i) z[i] unchanged */ - for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]); - for (i = 30; i < 36; ++i) z[i] = 0; - break; - - case 3: /* stop block */ - for (i = 0; i < 6; ++i) z[i] = 0; - for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]); - /* (i = 12; i < 18; ++i) z[i] unchanged */ - for (i = 18; i < 36; i += 3) { - z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]); - z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]); - z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]); - } - break; - } -} -# endif /* ASO_IMDCT */ - -/* - * NAME: III_imdct_s() - * DESCRIPTION: perform IMDCT and windowing for short blocks - */ -static -void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36]) -{ - mad_fixed_t y[36], *yptr; - mad_fixed_t const *wptr; - int w, i; - register mad_fixed64hi_t hi; - register mad_fixed64lo_t lo; - - /* IMDCT */ - - yptr = &y[0]; - - for (w = 0; w < 3; ++w) { - register mad_fixed_t const (*s)[6]; - - s = imdct_s; - - for (i = 0; i < 3; ++i) { - MAD_F_ML0(hi, lo, X[0], (*s)[0]); - MAD_F_MLA(hi, lo, X[1], (*s)[1]); - MAD_F_MLA(hi, lo, X[2], (*s)[2]); - MAD_F_MLA(hi, lo, X[3], (*s)[3]); - MAD_F_MLA(hi, lo, X[4], (*s)[4]); - MAD_F_MLA(hi, lo, X[5], (*s)[5]); - - yptr[i + 0] = MAD_F_MLZ(hi, lo); - yptr[5 - i] = -yptr[i + 0]; - - ++s; - - MAD_F_ML0(hi, lo, X[0], (*s)[0]); - MAD_F_MLA(hi, lo, X[1], (*s)[1]); - MAD_F_MLA(hi, lo, X[2], (*s)[2]); - MAD_F_MLA(hi, lo, X[3], (*s)[3]); - MAD_F_MLA(hi, lo, X[4], (*s)[4]); - MAD_F_MLA(hi, lo, X[5], (*s)[5]); - - yptr[ i + 6] = MAD_F_MLZ(hi, lo); - yptr[11 - i] = yptr[i + 6]; - - ++s; - } - - yptr += 12; - X += 6; - } - - /* windowing, overlapping and concatenation */ - - yptr = &y[0]; - wptr = &window_s[0]; - - for (i = 0; i < 6; ++i) { - z[i + 0] = 0; - z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]); - - MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]); - MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]); - - z[i + 12] = MAD_F_MLZ(hi, lo); - - MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]); - MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]); - - z[i + 18] = MAD_F_MLZ(hi, lo); - - z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]); - z[i + 30] = 0; - - ++yptr; - ++wptr; - } -} - -/* - * NAME: III_overlap() - * DESCRIPTION: perform overlap-add of windowed IMDCT outputs - */ -static -void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18], - mad_fixed_t sample[18][32], unsigned int sb) -{ - unsigned int i; - -# if defined(ASO_INTERLEAVE2) - { - register mad_fixed_t tmp1, tmp2; - - tmp1 = overlap[0]; - tmp2 = overlap[1]; - - for (i = 0; i < 16; i += 2) { - sample[i + 0][sb] = output[i + 0 + 0] + tmp1; - overlap[i + 0] = output[i + 0 + 18]; - tmp1 = overlap[i + 2]; - - sample[i + 1][sb] = output[i + 1 + 0] + tmp2; - overlap[i + 1] = output[i + 1 + 18]; - tmp2 = overlap[i + 3]; - } - - sample[16][sb] = output[16 + 0] + tmp1; - overlap[16] = output[16 + 18]; - sample[17][sb] = output[17 + 0] + tmp2; - overlap[17] = output[17 + 18]; - } -# elif 0 - for (i = 0; i < 18; i += 2) { - sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0]; - overlap[i + 0] = output[i + 0 + 18]; - - sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1]; - overlap[i + 1] = output[i + 1 + 18]; - } -# else - for (i = 0; i < 18; ++i) { - sample[i][sb] = output[i + 0] + overlap[i]; - overlap[i] = output[i + 18]; - } -# endif -} - -/* - * NAME: III_overlap_z() - * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs - */ -static inline -void III_overlap_z(mad_fixed_t overlap[18], - mad_fixed_t sample[18][32], unsigned int sb) -{ - unsigned int i; - -# if defined(ASO_INTERLEAVE2) - { - register mad_fixed_t tmp1, tmp2; - - tmp1 = overlap[0]; - tmp2 = overlap[1]; - - for (i = 0; i < 16; i += 2) { - sample[i + 0][sb] = tmp1; - overlap[i + 0] = 0; - tmp1 = overlap[i + 2]; - - sample[i + 1][sb] = tmp2; - overlap[i + 1] = 0; - tmp2 = overlap[i + 3]; - } - - sample[16][sb] = tmp1; - overlap[16] = 0; - sample[17][sb] = tmp2; - overlap[17] = 0; - } -# else - for (i = 0; i < 18; ++i) { - sample[i][sb] = overlap[i]; - overlap[i] = 0; - } -# endif -} - -/* - * NAME: III_freqinver() - * DESCRIPTION: perform subband frequency inversion for odd sample lines - */ -static -void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb) -{ - unsigned int i; - -# if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2) - { - register mad_fixed_t tmp1, tmp2; - - tmp1 = sample[1][sb]; - tmp2 = sample[3][sb]; - - for (i = 1; i < 13; i += 4) { - sample[i + 0][sb] = -tmp1; - tmp1 = sample[i + 4][sb]; - sample[i + 2][sb] = -tmp2; - tmp2 = sample[i + 6][sb]; - } - - sample[13][sb] = -tmp1; - tmp1 = sample[17][sb]; - sample[15][sb] = -tmp2; - sample[17][sb] = -tmp1; - } -# else - for (i = 1; i < 18; i += 2) - sample[i][sb] = -sample[i][sb]; -# endif -} - -#if TARGET_MSDOS == 16 -typedef mad_fixed_t mad_fixed_t_2x576[576]; -static mad_fixed_t_2x576* III_xr = NULL; -#endif - -/* - * NAME: III_decode() - * DESCRIPTION: decode frame main_data - */ -/* FIXME: The memory corruption issues seem to occur within this function - * or within one of the subroutines. The compiler is evalulating - * (*ptr)[2][3] etc... correctly, so that's not the problem. - * - * The major culprit seems to be III_overlap_z, though that might - * just be a side effect. - * - * As far as I know, these issues do not occur in the 32-bit flat - * mode builds. They only seem to happen when compiled as 16-bit - * real mode code (large model). */ -static -enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame, - struct sideinfo *si, unsigned int nch) -{ - struct mad_header *header = &frame->header; - unsigned int sfreqi, ngr, gr; - - { - unsigned int sfreq; - - sfreq = header->samplerate; - if (header->flags & MAD_FLAG_MPEG_2_5_EXT) - sfreq *= 2; - - /* 48000 => 0, 44100 => 1, 32000 => 2, - 24000 => 3, 22050 => 4, 16000 => 5 */ - sfreqi = ((sfreq >> 7) & 0x000f) + - ((sfreq >> 15) & 0x0001) - 8; - - if (header->flags & MAD_FLAG_MPEG_2_5_EXT) - sfreqi += 3; - } - - /* scalefactors, Huffman decoding, requantization */ - - ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2; - -#if TARGET_MSDOS == 16 - if (III_xr == NULL) { - if ((III_xr = malloc(sizeof(*III_xr))) == NULL) - return MAD_ERROR_NOMEM; - } -#endif - - for (gr = 0; gr < ngr; ++gr) { - struct granule *granule = &si->gr[gr]; - unsigned char const *sfbwidth[2]; -#if TARGET_MSDOS == 16 - mad_fixed_t_2x576 *xr = III_xr; /* 16-bit real mode stacks are small: malloc() it instead */ -#else - mad_fixed_t xr[2][576]; -#endif - unsigned int ch; - enum mad_error error; - - for (ch = 0; ch < nch; ++ch) { - struct channel *channel = &granule->ch[ch]; - unsigned int part2_length; - - sfbwidth[ch] = sfbwidth_table[sfreqi].l; - if (channel->block_type == 2) { - sfbwidth[ch] = (channel->flags & mixed_block_flag) ? - sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s; - } - - if (header->flags & MAD_FLAG_LSF_EXT) { - part2_length = III_scalefactors_lsf(ptr, channel, - ch == 0 ? 0 : &si->gr[1].ch[1], - header->mode_extension); - } - else { - part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch], - gr == 0 ? 0 : si->scfsi[ch]); - } - - error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length); - if (error) - return error; - } - - /* joint stereo processing */ - - if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) { - error = III_stereo(xr, granule, header, sfbwidth[0]); - if (error) - return error; - } - - /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */ - - for (ch = 0; ch < nch; ++ch) { - struct channel const *channel = &granule->ch[ch]; - mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr]; - unsigned int sb, l, i, sblimit; - mad_fixed_t output[36]; - - if (channel->block_type == 2) { - III_reorder(xr[ch], channel, sfbwidth[ch]); - -# if !defined(OPT_STRICT) - /* - * According to ISO/IEC 11172-3, "Alias reduction is not applied for - * granules with block_type == 2 (short block)." However, other - * sources suggest alias reduction should indeed be performed on the - * lower two subbands of mixed blocks. Most other implementations do - * this, so by default we will too. - */ - if (channel->flags & mixed_block_flag) - III_aliasreduce(xr[ch], 36); -# endif - } - else - III_aliasreduce(xr[ch], 576); - - l = 0; - - /* subbands 0-1 */ - - if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) { - unsigned int block_type; - - block_type = channel->block_type; - if (channel->flags & mixed_block_flag) - block_type = 0; - - /* long blocks */ - for (sb = 0; sb < 2; ++sb, l += 18) { - III_imdct_l(&xr[ch][l], output, block_type); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - } - } - else { - /* short blocks */ - for (sb = 0; sb < 2; ++sb, l += 18) { - III_imdct_s(&xr[ch][l], output); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - } - } - - III_freqinver(sample, 1); - - /* (nonzero) subbands 2-31 */ - - i = 576; - while (i > 36 && xr[ch][i - 1] == 0) - --i; - - sblimit = 32 - (576 - i) / 18; - - if (channel->block_type != 2) { - /* long blocks */ - for (sb = 2; sb < sblimit; ++sb, l += 18) { - III_imdct_l(&xr[ch][l], output, channel->block_type); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - - if (sb & 1) - III_freqinver(sample, sb); - } - } - else { - /* short blocks */ - for (sb = 2; sb < sblimit; ++sb, l += 18) { - III_imdct_s(&xr[ch][l], output); - III_overlap(output, (*frame->overlap)[ch][sb], sample, sb); - - if (sb & 1) - III_freqinver(sample, sb); - } - } - - /* remaining (zero) subbands */ - - for (sb = sblimit; sb < 32; ++sb) { - III_overlap_z((*frame->overlap)[ch][sb], sample, sb); - - if (sb & 1) - III_freqinver(sample, sb); - } - } - } - - return MAD_ERROR_NONE; -} - -/* - * NAME: layer->III() - * DESCRIPTION: decode a single Layer III frame - */ -int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame) -{ - struct mad_header *header = &frame->header; - unsigned int nch, priv_bitlen, next_md_begin = 0; - unsigned int si_len, data_bitlen, md_len; - unsigned int frame_space, frame_used, frame_free; - struct mad_bitptr ptr; - struct sideinfo si; - enum mad_error error; - int result = 0; - - /* allocate Layer III dynamic structures */ - - if (stream->main_data == 0) { - stream->main_data = malloc(MAD_BUFFER_MDLEN); - if (stream->main_data == 0) { - stream->error = MAD_ERROR_NOMEM; - return -1; - } - } - - if (frame->overlap == 0) { - frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t)); - if (frame->overlap == 0) { - stream->error = MAD_ERROR_NOMEM; - return -1; - } - } - - nch = MAD_NCHANNELS(header); - si_len = (header->flags & MAD_FLAG_LSF_EXT) ? - (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32); - - /* check frame sanity */ - - if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) < - (signed int) si_len) { - stream->error = MAD_ERROR_BADFRAMELEN; - stream->md_len = 0; - return -1; - } - - /* check CRC word */ - - if (header->flags & MAD_FLAG_PROTECTION) { - header->crc_check = - mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check); - - if (header->crc_check != header->crc_target && - !(frame->options & MAD_OPTION_IGNORECRC)) { - stream->error = MAD_ERROR_BADCRC; - result = -1; - } - } - - /* decode frame side information */ - - error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT, - &si, &data_bitlen, &priv_bitlen); - if (error && result == 0) { - stream->error = error; - result = -1; - } - - header->flags |= priv_bitlen; - header->private_bits |= si.private_bits; - - /* find main_data of next frame */ - - { - struct mad_bitptr peek; - unsigned long header; - - mad_bit_init(&peek, stream->next_frame); - - header = mad_bit_read(&peek, 32); - if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) { - if (!(header & 0x00010000L)) /* protection_bit */ - mad_bit_skip(&peek, 16); /* crc_check */ - - next_md_begin = - mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8); - } - - mad_bit_finish(&peek); - } - - /* find main_data of this frame */ - - frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr); - - if (next_md_begin > si.main_data_begin + frame_space) - next_md_begin = 0; - - md_len = si.main_data_begin + frame_space - next_md_begin; - - frame_used = 0; - - if (si.main_data_begin == 0) { - ptr = stream->ptr; - stream->md_len = 0; - - frame_used = md_len; - } - else { - if (si.main_data_begin > stream->md_len) { - if (result == 0) { - stream->error = MAD_ERROR_BADDATAPTR; - result = -1; - } - } - else { - mad_bit_init(&ptr, - *stream->main_data + stream->md_len - si.main_data_begin); - - if (md_len > si.main_data_begin) { - assert(stream->md_len + md_len - - si.main_data_begin <= MAD_BUFFER_MDLEN); - - memcpy(*stream->main_data + stream->md_len, - mad_bit_nextbyte(&stream->ptr), - frame_used = md_len - si.main_data_begin); - stream->md_len += frame_used; - } - } - } - - frame_free = frame_space - frame_used; - - /* decode main_data */ - - if (result == 0) { - error = III_decode(&ptr, frame, &si, nch); - if (error) { - stream->error = error; - result = -1; - } - - /* designate ancillary bits */ - - stream->anc_ptr = ptr; - stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen; - } - -# if 0 && defined(DEBUG) - fprintf(stderr, - "main_data_begin:%u, md_len:%u, frame_free:%u, " - "data_bitlen:%u, anc_bitlen: %u\n", - si.main_data_begin, md_len, frame_free, - data_bitlen, stream->anc_bitlen); -# endif - - /* preload main_data buffer with up to 511 bytes for next frame(s) */ - - if (frame_free >= next_md_begin) { - memcpy(*stream->main_data, - stream->next_frame - next_md_begin, next_md_begin); - stream->md_len = next_md_begin; - } - else { - if (md_len < si.main_data_begin) { - unsigned int extra; - - extra = si.main_data_begin - md_len; - if (extra + frame_free > next_md_begin) - extra = next_md_begin - frame_free; - - if (extra < stream->md_len) { - memmove(*stream->main_data, - *stream->main_data + stream->md_len - extra, extra); - stream->md_len = extra; - } - } - else - stream->md_len = 0; - - memcpy(*stream->main_data + stream->md_len, - stream->next_frame - frame_free, frame_free); - stream->md_len += frame_free; - } - - return result; -} diff --git a/src/lib/dl/ext/libmad/layer3.h b/src/lib/dl/ext/libmad/layer3.h deleted file mode 100755 index 2504d461..00000000 --- a/src/lib/dl/ext/libmad/layer3.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: layer3.h,v 1.10 2004/01/23 09:41:32 rob Exp $ - */ - -# ifndef LIBMAD_LAYER3_H -# define LIBMAD_LAYER3_H - -# include "stream.h" -# include "frame.h" - -int mad_layer_III(struct mad_stream *, struct mad_frame *); - -# endif diff --git a/src/lib/dl/ext/libmad/mad.h b/src/lib/dl/ext/libmad/mad.h deleted file mode 100755 index 2b9d33b5..00000000 --- a/src/lib/dl/ext/libmad/mad.h +++ /dev/null @@ -1,969 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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 you would like to negotiate alternate licensing terms, you may do - * so by contacting: Underbit Technologies, Inc. <info@underbit.com> - */ - -# ifdef __cplusplus -extern "C" { -# endif - -# define FPM_INTEL - - -#if TARGET_MSDOS == 32 -# define SIZEOF_INT 4 -# define SIZEOF_LONG 4 -# define SIZEOF_LONG_LONG 8 -#else -# define SIZEOF_INT 2 -# define SIZEOF_LONG 4 -# define SIZEOF_LONG_LONG 8 -#endif - - -/* Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp */ - -# ifndef LIBMAD_VERSION_H -# define LIBMAD_VERSION_H - -# define MAD_VERSION_MAJOR 0 -# define MAD_VERSION_MINOR 15 -# define MAD_VERSION_PATCH 1 -# define MAD_VERSION_EXTRA " (beta)" - -# define MAD_VERSION_STRINGIZE(str) #str -# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) - -# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_PATCH) \ - MAD_VERSION_EXTRA - -# define MAD_PUBLISHYEAR "2000-2004" -# define MAD_AUTHOR "Underbit Technologies, Inc." -# define MAD_EMAIL "info@underbit.com" - -extern char const mad_version[]; -extern char const mad_copyright[]; -extern char const mad_author[]; -extern char const mad_build[]; - -# endif - -/* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */ - -# ifndef LIBMAD_FIXED_H -# define LIBMAD_FIXED_H - -# if SIZEOF_INT >= 4 -typedef signed int mad_fixed_t; - -typedef signed int mad_fixed64hi_t; -typedef unsigned int mad_fixed64lo_t; -# else -typedef signed long mad_fixed_t; - -typedef signed long mad_fixed64hi_t; -typedef unsigned long mad_fixed64lo_t; -# endif - -# if defined(_MSC_VER) -# define mad_fixed64_t signed __int64 -# elif 1 || defined(__GNUC__) -# define mad_fixed64_t signed long long -# endif - -# if defined(FPM_FLOAT) -typedef double mad_sample_t; -# else -typedef mad_fixed_t mad_sample_t; -# endif - -/* - * Fixed-point format: 0xABBBBBBB - * A == whole part (sign + 3 bits) - * B == fractional part (28 bits) - * - * Values are signed two's complement, so the effective range is: - * 0x80000000 to 0x7fffffff - * -8.0 to +7.9999999962747097015380859375 - * - * The smallest representable value is: - * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9) - * - * 28 bits of fractional accuracy represent about - * 8.6 digits of decimal accuracy. - * - * Fixed-point numbers can be added or subtracted as normal - * integers, but multiplication requires shifting the 64-bit result - * from 56 fractional bits back to 28 (and rounding.) - * - * Changing the definition of MAD_F_FRACBITS is only partially - * supported, and must be done with care. - */ - -# define MAD_F_FRACBITS 28 - -# if MAD_F_FRACBITS == 28 -# define MAD_F(x) ((mad_fixed_t) (x##L)) -# else -# if MAD_F_FRACBITS < 28 -# warning "MAD_F_FRACBITS < 28" -# define MAD_F(x) ((mad_fixed_t) \ - (((x##L) + \ - (1L << (28 - MAD_F_FRACBITS - 1))) >> \ - (28 - MAD_F_FRACBITS))) -# elif MAD_F_FRACBITS > 28 -# error "MAD_F_FRACBITS > 28 not currently supported" -# define MAD_F(x) ((mad_fixed_t) \ - ((x##L) << (MAD_F_FRACBITS - 28))) -# endif -# endif - -# define MAD_F_MIN ((mad_fixed_t) -0x80000000L) -# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) - -# define MAD_F_ONE MAD_F(0x10000000) - -# define mad_f_tofixed(x) ((mad_fixed_t) \ - ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) -# define mad_f_todouble(x) ((double) \ - ((x) / (double) (1L << MAD_F_FRACBITS))) - -# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) -# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) - /* (x should be positive) */ - -# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) - -# define mad_f_add(x, y) ((x) + (y)) -# define mad_f_sub(x, y) ((x) - (y)) - -# if defined(FPM_FLOAT) -# error "FPM_FLOAT not yet supported" - -# undef MAD_F -# define MAD_F(x) mad_f_todouble(x) - -# define mad_f_mul(x, y) ((x) * (y)) -# define mad_f_scale64 - -# undef ASO_ZEROCHECK - -# elif defined(FPM_64BIT) - -/* - * This version should be the most accurate if 64-bit types are supported by - * the compiler, although it may not be the most efficient. - */ -# if defined(OPT_ACCURACY) -# define mad_f_mul(x, y) \ - ((mad_fixed_t) \ - ((((mad_fixed64_t) (x) * (y)) + \ - (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) -# else -# define mad_f_mul(x, y) \ - ((mad_fixed_t) (((mad_fixed64_t)(x) * (mad_fixed64_t)(y)) >> (mad_fixed64_t)(MAD_F_SCALEBITS))) -# endif - -# define MAD_F_SCALEBITS MAD_F_FRACBITS - -/* --- Intel --------------------------------------------------------------- */ - -# elif defined(FPM_INTEL) - -# if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable: 4035) /* no return value */ -static __forceinline -mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) -{ - enum { - fracbits = MAD_F_FRACBITS - }; - - __asm { - mov eax, x - imul y - shrd eax, edx, fracbits - } - - /* implicit return of eax */ -} -# pragma warning(pop) - -# define mad_f_mul mad_f_mul_inline -# define mad_f_scale64 -# else -/* - * This Intel version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("imull %3" \ - : "=a" (lo), "=d" (hi) \ - : "%a" (x), "rm" (y) \ - : "cc") - -# if defined(OPT_ACCURACY) -/* - * This gives best accuracy but is not very fast. - */ -# define MAD_F_MLA(hi, lo, x, y) \ - ({ mad_fixed64hi_t __hi; \ - mad_fixed64lo_t __lo; \ - MAD_F_MLX(__hi, __lo, (x), (y)); \ - asm ("addl %2,%0\n\t" \ - "adcl %3,%1" \ - : "=rm" (lo), "=rm" (hi) \ - : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ - : "cc"); \ - }) -# endif /* OPT_ACCURACY */ - -# if defined(OPT_ACCURACY) -/* - * Surprisingly, this is faster than SHRD followed by ADC. - */ -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed64hi_t __hi_; \ - mad_fixed64lo_t __lo_; \ - mad_fixed_t __result; \ - asm ("addl %4,%2\n\t" \ - "adcl %5,%3" \ - : "=rm" (__lo_), "=rm" (__hi_) \ - : "0" (lo), "1" (hi), \ - "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ - : "cc"); \ - asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# elif defined(OPT_INTEL) -/* - * Alternate Intel scaling that may or may not perform better. - */ -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("shrl %3,%1\n\t" \ - "shll %4,%2\n\t" \ - "orl %2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), \ - "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# else -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("shrdl %3,%2,%1" \ - : "=rm" (__result) \ - : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# endif /* OPT_ACCURACY */ - -# define MAD_F_SCALEBITS MAD_F_FRACBITS -# endif - -/* --- ARM ----------------------------------------------------------------- */ - -# elif defined(FPM_ARM) - -/* - * This ARM V4 version is as accurate as FPM_64BIT but much faster. The - * least significant bit is properly rounded at no CPU cycle cost! - */ -# if 1 -/* - * This is faster than the default implementation via MAD_F_MLX() and - * mad_f_scale64(). - */ -# define mad_f_mul(x, y) \ - ({ mad_fixed64hi_t __hi; \ - mad_fixed64lo_t __lo; \ - mad_fixed_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" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) -# endif - -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("smull %0, %1, %2, %3" \ - : "=&r" (lo), "=&r" (hi) \ - : "%r" (x), "r" (y)) - -# define MAD_F_MLA(hi, lo, x, y) \ - asm ("smlal %0, %1, %2, %3" \ - : "+r" (lo), "+r" (hi) \ - : "%r" (x), "r" (y)) - -# define MAD_F_MLN(hi, lo) \ - asm ("rsbs %0, %2, #0\n\t" \ - "rsc %1, %3, #0" \ - : "=r" (lo), "=r" (hi) \ - : "0" (lo), "1" (hi) \ - : "cc") - -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("movs %0, %1, lsr %3\n\t" \ - "adc %0, %0, %2, lsl %4" \ - : "=&r" (__result) \ - : "r" (lo), "r" (hi), \ - "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ - : "cc"); \ - __result; \ - }) - -# define MAD_F_SCALEBITS MAD_F_FRACBITS - -/* --- MIPS ---------------------------------------------------------------- */ - -# elif defined(FPM_MIPS) - -/* - * This MIPS version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" (x), "r" (y)) - -# if defined(HAVE_MADD_ASM) -# define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" (x), "r" (y)) -# elif defined(HAVE_MADD16_ASM) -/* - * This loses significant accuracy due to the 16-bit integer limit in the - * multiply/accumulate instruction. - */ -# define MAD_F_ML0(hi, lo, x, y) \ - asm ("mult %2,%3" \ - : "=l" (lo), "=h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) -# define MAD_F_MLA(hi, lo, x, y) \ - asm ("madd16 %2,%3" \ - : "+l" (lo), "+h" (hi) \ - : "%r" ((x) >> 12), "r" ((y) >> 16)) -# define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) -# endif - -# if defined(OPT_SPEED) -# define mad_f_scale64(hi, lo) \ - ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) -# define MAD_F_SCALEBITS MAD_F_FRACBITS -# endif - -/* --- SPARC --------------------------------------------------------------- */ - -# elif defined(FPM_SPARC) - -/* - * This SPARC V8 version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - asm ("smul %2, %3, %0\n\t" \ - "rd %%y, %1" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (x), "rI" (y)) - -/* --- PowerPC ------------------------------------------------------------- */ - -# elif defined(FPM_PPC) - -/* - * This PowerPC version is fast and accurate; the disposition of the least - * significant bit depends on OPT_ACCURACY via mad_f_scale64(). - */ -# define MAD_F_MLX(hi, lo, x, y) \ - do { \ - asm ("mullw %0,%1,%2" \ - : "=r" (lo) \ - : "%r" (x), "r" (y)); \ - asm ("mulhw %0,%1,%2" \ - : "=r" (hi) \ - : "%r" (x), "r" (y)); \ - } \ - while (0) - -# if defined(OPT_ACCURACY) -/* - * This gives best accuracy but is not very fast. - */ -# define MAD_F_MLA(hi, lo, x, y) \ - ({ mad_fixed64hi_t __hi; \ - mad_fixed64lo_t __lo; \ - MAD_F_MLX(__hi, __lo, (x), (y)); \ - asm ("addc %0,%2,%3\n\t" \ - "adde %1,%4,%5" \ - : "=r" (lo), "=r" (hi) \ - : "%r" (lo), "r" (__lo), \ - "%r" (hi), "r" (__hi) \ - : "xer"); \ - }) -# endif - -# if defined(OPT_ACCURACY) -/* - * This is slower than the truncating version below it. - */ -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result, __round; \ - asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ - asm ("extrwi %0,%1,1,0" \ - : "=r" (__round) \ - : "r" (__result)); \ - asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ - asm ("add %0,%1,%2" \ - : "=r" (__result) \ - : "%r" (__result), "r" (__round)); \ - __result; \ - }) -# else -# define mad_f_scale64(hi, lo) \ - ({ mad_fixed_t __result; \ - asm ("rotrwi %0,%1,%2" \ - : "=r" (__result) \ - : "r" (lo), "i" (MAD_F_SCALEBITS)); \ - asm ("insrwi %0,%1,%2,0" \ - : "+r" (__result) \ - : "r" (hi), "i" (MAD_F_SCALEBITS)); \ - __result; \ - }) -# endif - -# define MAD_F_SCALEBITS MAD_F_FRACBITS - -/* --- Default ------------------------------------------------------------- */ - -# elif defined(FPM_DEFAULT) - -/* - * This version is the most portable but it loses significant accuracy. - * Furthermore, accuracy is biased against the second argument, so care - * should be taken when ordering operands. - * - * The scale factors are constant as this is not used with SSO. - * - * Pre-rounding is required to stay within the limits of compliance. - */ -# if defined(OPT_SPEED) -# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) -# else -# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ - (((y) + (1L << 15)) >> 16)) -# endif - -/* ------------------------------------------------------------------------- */ - -# else -# error "no FPM selected" -# endif - -/* default implementations */ - -# if !defined(mad_f_mul) -# define mad_f_mul(x, y) \ - ({ register mad_fixed64hi_t __hi; \ - register mad_fixed64lo_t __lo; \ - MAD_F_MLX(__hi, __lo, (x), (y)); \ - mad_f_scale64(__hi, __lo); \ - }) -# endif - -# if !defined(MAD_F_MLA) -# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) -# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) -# define MAD_F_MLN(hi, lo) ((lo) = -(lo)) -# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) -# endif - -# if !defined(MAD_F_ML0) -# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) -# endif - -# if !defined(MAD_F_MLN) -# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) -# endif - -# if !defined(MAD_F_MLZ) -# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) -# endif - -# if !defined(mad_f_scale64) -# if defined(OPT_ACCURACY) -# define mad_f_scale64(hi, lo) \ - ((((mad_fixed_t) \ - (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ - ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) -# else -# define mad_f_scale64(hi, lo) \ - ((mad_fixed_t) \ - (((hi) << (32 - MAD_F_SCALEBITS)) | \ - ((lo) >> MAD_F_SCALEBITS))) -# endif -# define MAD_F_SCALEBITS MAD_F_FRACBITS -# endif - -/* C routines */ - -mad_fixed_t mad_f_abs(mad_fixed_t); -mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); - -# endif - -/* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */ - -# ifndef LIBMAD_BIT_H -# define LIBMAD_BIT_H - -struct mad_bitptr { - unsigned char const *byte; - unsigned short cache; - unsigned short left; -}; - -void mad_bit_init(struct mad_bitptr *, unsigned char const *); - -# define mad_bit_finish(bitptr) /* nothing */ - -unsigned int mad_bit_length(struct mad_bitptr const *, - struct mad_bitptr const *); - -# define mad_bit_bitsleft(bitptr) ((bitptr)->left) -unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); - -void mad_bit_skip(struct mad_bitptr *, unsigned int); -unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); -void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); - -unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short); - -# endif - -/* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */ - -# ifndef LIBMAD_TIMER_H -# define LIBMAD_TIMER_H - -typedef struct { - signed long seconds; /* whole seconds */ - unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ -} mad_timer_t; - -extern mad_timer_t const mad_timer_zero; - -# define MAD_TIMER_RESOLUTION 352800000UL - -enum mad_units { - MAD_UNITS_HOURS = -2, - MAD_UNITS_MINUTES = -1, - MAD_UNITS_SECONDS = 0, - - /* metric units */ - - MAD_UNITS_DECISECONDS = 10, - MAD_UNITS_CENTISECONDS = 100, - MAD_UNITS_MILLISECONDS = 1000, - - /* audio sample units */ - - MAD_UNITS_8000_HZ = 8000, - MAD_UNITS_11025_HZ = 11025, - MAD_UNITS_12000_HZ = 12000, - - MAD_UNITS_16000_HZ = 16000, - MAD_UNITS_22050_HZ = 22050, - MAD_UNITS_24000_HZ = 24000, - - MAD_UNITS_32000_HZ = 32000, - MAD_UNITS_44100_HZ = 44100, - MAD_UNITS_48000_HZ = 48000, - - /* video frame/field units */ - - MAD_UNITS_24_FPS = 24, - MAD_UNITS_25_FPS = 25, - MAD_UNITS_30_FPS = 30, - MAD_UNITS_48_FPS = 48, - MAD_UNITS_50_FPS = 50, - MAD_UNITS_60_FPS = 60, - - /* CD audio frames */ - - MAD_UNITS_75_FPS = 75, - - /* video drop-frame units */ - - MAD_UNITS_23_976_FPS = -24, - MAD_UNITS_24_975_FPS = -25, - MAD_UNITS_29_97_FPS = -30, - MAD_UNITS_47_952_FPS = -48, - MAD_UNITS_49_95_FPS = -50, - MAD_UNITS_59_94_FPS = -60 -}; - -# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) - -int mad_timer_compare(mad_timer_t, mad_timer_t); - -# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) - -void mad_timer_negate(mad_timer_t *); -mad_timer_t mad_timer_abs(mad_timer_t); - -void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); -void mad_timer_add(mad_timer_t *, mad_timer_t); -void mad_timer_multiply(mad_timer_t *, signed long); - -signed long mad_timer_count(mad_timer_t, enum mad_units); -unsigned long mad_timer_fraction(mad_timer_t, unsigned long); -void mad_timer_string(mad_timer_t, char *, char const *, - enum mad_units, enum mad_units, unsigned long); - -# endif - -/* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */ - -# ifndef LIBMAD_STREAM_H -# define LIBMAD_STREAM_H - - -# define MAD_BUFFER_GUARD 8 -# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) - -enum mad_error { - MAD_ERROR_NONE = 0x0000, /* no error */ - - MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ - MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ - - MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ - - MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ - MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ - MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ - MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ - MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ - - MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ - MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ - MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ - MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ - MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ - MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ - MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ - MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ - MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ - MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ - MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ - MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ - MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ -}; - -# define MAD_RECOVERABLE(error) ((error) & 0xff00) - -struct mad_stream { - unsigned char const *buffer; /* input bitstream buffer */ - unsigned char const *bufend; /* end of buffer */ - unsigned long skiplen; /* bytes to skip before next frame */ - - int sync; /* stream sync found */ - unsigned long freerate; /* free bitrate (fixed) */ - - unsigned char const *this_frame; /* start of current frame */ - unsigned char const *next_frame; /* start of next frame */ - struct mad_bitptr ptr; /* current processing bit pointer */ - - struct mad_bitptr anc_ptr; /* ancillary bits pointer */ - unsigned int anc_bitlen; /* number of ancillary bits */ - - unsigned char (*main_data)[MAD_BUFFER_MDLEN]; - /* Layer III main_data() */ - unsigned int md_len; /* bytes in main_data */ - - int options; /* decoding options (see below) */ - enum mad_error error; /* error code (see above) */ -}; - -enum { - MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ - MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ -# if 0 /* not yet implemented */ - MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ - MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ - MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ -# endif -}; - -void mad_stream_init(struct mad_stream *); -void mad_stream_finish(struct mad_stream *); - -# define mad_stream_options(stream, opts) \ - ((void) ((stream)->options = (opts))) - -void mad_stream_buffer(struct mad_stream *, - unsigned char const *, unsigned long); -void mad_stream_skip(struct mad_stream *, unsigned long); - -int mad_stream_sync(struct mad_stream *); - -char const *mad_stream_errorstr(struct mad_stream const *); - -# endif - -/* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */ - -# ifndef LIBMAD_FRAME_H -# define LIBMAD_FRAME_H - - -enum mad_layer { - MAD_LAYER_I = 1, /* Layer I */ - MAD_LAYER_II = 2, /* Layer II */ - MAD_LAYER_III = 3 /* Layer III */ -}; - -enum mad_mode { - MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */ - MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */ - MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */ - MAD_MODE_STEREO = 3 /* normal LR stereo */ -}; - -enum mad_emphasis { - MAD_EMPHASIS_NONE = 0, /* no emphasis */ - MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */ - MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */ - MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */ -}; - -struct mad_header { - enum mad_layer layer; /* audio layer (1, 2, or 3) */ - enum mad_mode mode; /* channel mode (see above) */ - int mode_extension; /* additional mode info */ - enum mad_emphasis emphasis; /* de-emphasis to use (see above) */ - - unsigned long bitrate; /* stream bitrate (bps) */ - unsigned int samplerate; /* sampling frequency (Hz) */ - - unsigned short crc_check; /* frame CRC accumulator */ - unsigned short crc_target; /* final target CRC checksum */ - - int flags; /* flags (see below) */ - int private_bits; /* private bits (see below) */ - - mad_timer_t duration; /* audio playing time of frame */ -}; - -struct mad_frame { - struct mad_header header; /* MPEG audio header */ - - int options; /* decoding options (from stream) */ - - mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */ - mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */ -}; - -# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1) -# define MAD_NSBSAMPLES(header) \ - ((header)->layer == MAD_LAYER_I ? 12 : \ - (((header)->layer == MAD_LAYER_III && \ - ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36)) - -enum { - MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */ - MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */ - - MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */ - MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */ - MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */ - MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */ - - MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */ - MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */ - MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */ - - MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */ - MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */ - MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */ -}; - -enum { - MAD_PRIVATE_HEADER = 0x0100, /* header private bit */ - MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */ -}; - -void mad_header_init(struct mad_header *); - -# define mad_header_finish(header) /* nothing */ - -int mad_header_decode(struct mad_header *, struct mad_stream *); - -void mad_frame_init(struct mad_frame *); -void mad_frame_finish(struct mad_frame *); - -int mad_frame_decode(struct mad_frame *, struct mad_stream *); - -void mad_frame_mute(struct mad_frame *); - -# endif - -/* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */ - -# ifndef LIBMAD_SYNTH_H -# define LIBMAD_SYNTH_H - - -struct mad_pcm { - unsigned int samplerate; /* sampling frequency (Hz) */ - unsigned short channels; /* number of channels */ - unsigned short length; /* number of samples per channel */ - mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ -}; - -struct mad_synth { - mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ - /* [ch][eo][peo][s][v] */ - - unsigned int phase; /* current processing phase */ - - struct mad_pcm pcm; /* PCM output */ -}; - -/* single channel PCM selector */ -enum { - MAD_PCM_CHANNEL_SINGLE = 0 -}; - -/* dual channel PCM selector */ -enum { - MAD_PCM_CHANNEL_DUAL_1 = 0, - MAD_PCM_CHANNEL_DUAL_2 = 1 -}; - -/* stereo PCM selector */ -enum { - MAD_PCM_CHANNEL_STEREO_LEFT = 0, - MAD_PCM_CHANNEL_STEREO_RIGHT = 1 -}; - -void mad_synth_init(struct mad_synth *); - -# define mad_synth_finish(synth) /* nothing */ - -void mad_synth_mute(struct mad_synth *); - -void mad_synth_frame(struct mad_synth *, struct mad_frame const *); - -# endif - -/* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */ - -# ifndef LIBMAD_DECODER_H -# define LIBMAD_DECODER_H - - -enum mad_decoder_mode { - MAD_DECODER_MODE_SYNC = 0, - MAD_DECODER_MODE_ASYNC -}; - -enum mad_flow { - MAD_FLOW_CONTINUE = 0x0000, /* continue normally */ - MAD_FLOW_STOP = 0x0010, /* stop decoding normally */ - MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */ - MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */ -}; - -struct mad_decoder { - enum mad_decoder_mode mode; - - int options; - - struct { - long pid; - int in; - int out; - } async; - - struct { - struct mad_stream stream; - struct mad_frame frame; - struct mad_synth synth; - } *sync; - - void *cb_data; - - enum mad_flow (*input_func)(void *, struct mad_stream *); - enum mad_flow (*header_func)(void *, struct mad_header const *); - enum mad_flow (*filter_func)(void *, - struct mad_stream const *, struct mad_frame *); - enum mad_flow (*output_func)(void *, - struct mad_header const *, struct mad_pcm *); - enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *); - enum mad_flow (*message_func)(void *, void *, unsigned int *); -}; - -void mad_decoder_init(struct mad_decoder *, void *, - enum mad_flow (*)(void *, struct mad_stream *), - enum mad_flow (*)(void *, struct mad_header const *), - enum mad_flow (*)(void *, - struct mad_stream const *, - struct mad_frame *), - enum mad_flow (*)(void *, - struct mad_header const *, - struct mad_pcm *), - enum mad_flow (*)(void *, - struct mad_stream *, - struct mad_frame *), - enum mad_flow (*)(void *, void *, unsigned int *)); -int mad_decoder_finish(struct mad_decoder *); - -# define mad_decoder_options(decoder, opts) \ - ((void) ((decoder)->options = (opts))) - -int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode); -int mad_decoder_message(struct mad_decoder *, void *, unsigned int *); - -# endif - -# ifdef __cplusplus -} -# endif diff --git a/src/lib/dl/ext/libmad/playcom.h b/src/lib/dl/ext/libmad/playcom.h deleted file mode 100755 index 7cf772f5..00000000 --- a/src/lib/dl/ext/libmad/playcom.h +++ /dev/null @@ -1,86 +0,0 @@ - -#include <ext/libmad/mad.h> - -#define mp3_data_size (16*1024) - -#define COMMON_ABOUT_HELP_STR "MP3 player v1.0 for DOS\n\n(C) 2008-2011 Jonathan Campbell\nALL RIGHTS RESERVED\n" \ - "32-bit protected mode version\n" \ - "\n" \ - "Uses libmad MP3 decoder library\n" \ - "(C) 2000-2004 Underbit Technologies, Inc." - -extern char temp_str[512]; -extern unsigned char animator; -extern int mp3_fd; -extern char mp3_file[130]; -extern unsigned char mp3_stereo,mp3_16bit,mp3_bytes_per_sample; -extern unsigned long mp3_data_offset,mp3_data_length,mp3_sample_rate; -extern unsigned long mp3_sample_rate_by_timer_ticks; -extern unsigned long mp3_sample_rate_by_timer; -extern unsigned char mp3_flipsign; -extern unsigned char mp3_playing; - -/* libmad decoding state */ -extern unsigned char mad_init; -extern struct mad_stream mad_stream; -extern struct mad_frame mad_frame; -extern struct mad_synth mad_synth; -extern unsigned char mad_synth_ready; -extern unsigned int mad_synth_readofs; -extern unsigned char mp3_data[mp3_data_size],*mp3_data_read,*mp3_data_write; -extern volatile unsigned char sb_irq_count; -extern volatile unsigned char IRQ_anim; -extern uint32_t irq_0_count; -extern uint32_t irq_0_adv; -extern uint32_t irq_0_max; -extern uint8_t irq_0_sent_command; -extern unsigned char irq_0_had_warned; -extern volatile uint32_t irq_0_watchdog; -extern uint32_t last_dma_position; -extern int change_param_idx; -#define PARAM_PRESET_RATES 17 -extern const unsigned short param_preset_rates[PARAM_PRESET_RATES]; -extern const char* dos32_irq_0_warning; - -extern const struct vga_menu_item menu_separator; -extern const struct vga_menu_item main_menu_file_set; -extern const struct vga_menu_item main_menu_file_quit; -extern const struct vga_menu_item main_menu_playback_play; -extern const struct vga_menu_item main_menu_playback_stop; -extern const struct vga_menu_item main_menu_playback_params; -extern const struct vga_menu_item main_menu_help_about; - -void mp3_data_clear(); -void mp3_data_refill(); -void mp3_data_flush(unsigned char force); -void free_libmad(); -unsigned char init_libmad(); -void draw_irq_indicator(); -void mad_reset_decoder(); -void irq_0_watchdog_do(); -void irq_0_watchdog_ack(); -void irq_0_watchdog_reset(); -void vga_write_until(unsigned int x); -void prompt_play_mp3(unsigned char rec); -int confirm_quit(); -void close_mp3(); -void open_mp3(); -int mad_more(); - -extern void (interrupt *old_irq_0)(); - -static inline unsigned char xdigit2int(char c) { - if (c >= '0' && c <= '9') - return (unsigned char)(c - '0'); - else if (c >= 'a' && c <= 'f') - return (unsigned char)(c - 'a' + 10); - else if (c >= 'A' && c <= 'F') - return (unsigned char)(c - 'A' + 10); - return 0; -} - -/* provided by the calling program */ -void ui_anim(int force); -void begin_play(); -void stop_play(); - diff --git a/src/lib/dl/ext/libmad/qc_table.dat b/src/lib/dl/ext/libmad/qc_table.dat deleted file mode 100755 index 35a22234..00000000 --- a/src/lib/dl/ext/libmad/qc_table.dat +++ /dev/null @@ -1,77 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: qc_table.dat,v 1.7 2004/01/23 09:41:32 rob Exp $ - */ - -/* - * These are the Layer II classes of quantization. - * The table is derived from Table B.4 of ISO/IEC 11172-3. - */ - - { 3, 2, 5, - MAD_F(0x15555555) /* 1.33333333333 => 1.33333333209, e 0.00000000124 */, - MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, - { 5, 3, 7, - MAD_F(0x1999999a) /* 1.60000000000 => 1.60000000149, e -0.00000000149 */, - MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, - { 7, 0, 3, - MAD_F(0x12492492) /* 1.14285714286 => 1.14285714179, e 0.00000000107 */, - MAD_F(0x04000000) /* 0.25000000000 => 0.25000000000, e 0.00000000000 */ }, - { 9, 4, 10, - MAD_F(0x1c71c71c) /* 1.77777777777 => 1.77777777612, e 0.00000000165 */, - MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ }, - { 15, 0, 4, - MAD_F(0x11111111) /* 1.06666666666 => 1.06666666642, e 0.00000000024 */, - MAD_F(0x02000000) /* 0.12500000000 => 0.12500000000, e 0.00000000000 */ }, - { 31, 0, 5, - MAD_F(0x10842108) /* 1.03225806452 => 1.03225806355, e 0.00000000097 */, - MAD_F(0x01000000) /* 0.06250000000 => 0.06250000000, e 0.00000000000 */ }, - { 63, 0, 6, - MAD_F(0x10410410) /* 1.01587301587 => 1.01587301493, e 0.00000000094 */, - MAD_F(0x00800000) /* 0.03125000000 => 0.03125000000, e 0.00000000000 */ }, - { 127, 0, 7, - MAD_F(0x10204081) /* 1.00787401575 => 1.00787401572, e 0.00000000003 */, - MAD_F(0x00400000) /* 0.01562500000 => 0.01562500000, e 0.00000000000 */ }, - { 255, 0, 8, - MAD_F(0x10101010) /* 1.00392156863 => 1.00392156839, e 0.00000000024 */, - MAD_F(0x00200000) /* 0.00781250000 => 0.00781250000, e 0.00000000000 */ }, - { 511, 0, 9, - MAD_F(0x10080402) /* 1.00195694716 => 1.00195694715, e 0.00000000001 */, - MAD_F(0x00100000) /* 0.00390625000 => 0.00390625000, e 0.00000000000 */ }, - { 1023, 0, 10, - MAD_F(0x10040100) /* 1.00097751711 => 1.00097751617, e 0.00000000094 */, - MAD_F(0x00080000) /* 0.00195312500 => 0.00195312500, e 0.00000000000 */ }, - { 2047, 0, 11, - MAD_F(0x10020040) /* 1.00048851979 => 1.00048851967, e 0.00000000012 */, - MAD_F(0x00040000) /* 0.00097656250 => 0.00097656250, e 0.00000000000 */ }, - { 4095, 0, 12, - MAD_F(0x10010010) /* 1.00024420024 => 1.00024420023, e 0.00000000001 */, - MAD_F(0x00020000) /* 0.00048828125 => 0.00048828125, e 0.00000000000 */ }, - { 8191, 0, 13, - MAD_F(0x10008004) /* 1.00012208522 => 1.00012208521, e 0.00000000001 */, - MAD_F(0x00010000) /* 0.00024414063 => 0.00024414062, e 0.00000000000 */ }, - { 16383, 0, 14, - MAD_F(0x10004001) /* 1.00006103888 => 1.00006103888, e -0.00000000000 */, - MAD_F(0x00008000) /* 0.00012207031 => 0.00012207031, e -0.00000000000 */ }, - { 32767, 0, 15, - MAD_F(0x10002000) /* 1.00003051851 => 1.00003051758, e 0.00000000093 */, - MAD_F(0x00004000) /* 0.00006103516 => 0.00006103516, e 0.00000000000 */ }, - { 65535, 0, 16, - MAD_F(0x10001000) /* 1.00001525902 => 1.00001525879, e 0.00000000023 */, - MAD_F(0x00002000) /* 0.00003051758 => 0.00003051758, e 0.00000000000 */ } diff --git a/src/lib/dl/ext/libmad/readme b/src/lib/dl/ext/libmad/readme deleted file mode 100755 index 42fa18e6..00000000 --- a/src/lib/dl/ext/libmad/readme +++ /dev/null @@ -1,54 +0,0 @@ -libmad library. -Ported to MS-DOS/OpenWatcom by Jonathan Campbell. - - -Notes: - -- The Sound Blaster MP3 player uses the same codebase as the test.exe - executable under hw/sndsb, except that some modes have been removed - and the code rewritten to decode and play back MP3 data. - -- If your DOS machine has no sound card, but does have the traditional - "PC Speaker", you can use playspkr.exe to play the MP3 through the - internal beeper (using the old DPCM trick). However there may be - slight audio glitches depending on background processes, - interrupts, and disk I/O. Make sure your DOS extender and CPU are - fast enough to service interrupts at a high timer tick rate. - Playback will also not sound very good if the "PC speaker" is not - an actual speaker, such as the piezoelectric ones on laptops. - -- If you have a Gravis Ultrasound, use the playgus.exe MP3 player. - The Sound Blaster version does NOT work with SBOS or MEGA-EM despite - my best efforts. - -- If you have a LPT parallel port, you can use the LPT DAC version, - playlpt.exe. Though playback up to 44.1KHz is supported, it may - not be possibly depending on whether or not the parallel port - delays I/O for compatability reasons, or any other sources of - latency. - -- Experimental: If you have a Covox Sound Master, try playsm.exe. - Since I don't actually have a Covox Sound Master, I don't know whether - this works on real hardware. - - - -TODO LIST: - - 16-bit real-mode MP3 decoding. Currently, libmad seems to compile properly - only for 32-bit flat protected mode. I got it to "sort of" compile for - 16-bit large memory model builds, but it doesn't work properly and it seems - to cause memory corruption as well. - - Specification for 16-bit real mode: Take libmad, valgrind it under Linux to - catch all possible problems, then incorporate the validated code into this - source tree. That will be the 32-bit build. Then, take the libmad source - code, put it under a separate directory (libmad16), modify it to use - 14-bit precision and math that favors 16-bit integers (what will fit into - real-mode 8086 CPU registers), and incorporate that into /etc/libmad16. - Copy over the test programs here and compile them with it, to produce the - 16-bit real mode builds. Make the makefile for libmad16 so that it only - produces binaries for 16-bit real mode builds. If the differences are - minimal enough, you could merge the two source trees into one project - that can produce a fast high quality decode for 386+ systems, and a faster - (less precise) decoder for systems as low as an 8086. - diff --git a/src/lib/dl/ext/libmad/rq_table.dat b/src/lib/dl/ext/libmad/rq_table.dat deleted file mode 100755 index 059c4f31..00000000 --- a/src/lib/dl/ext/libmad/rq_table.dat +++ /dev/null @@ -1,8747 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: rq_table.dat,v 1.7 2004/01/23 09:41:32 rob Exp $ - */ - -/* - * This is the lookup table used to compute x^(4/3) for Layer III - * requantization. To maintain the best possible accuracy, the value is - * stored as a normalized mantissa with exponent. The requantization - * algorithm recombines these parts with appropriate scaling. - */ - - /* 0 */ { MAD_F(0x00000000) /* 0.000000000 */, 0 }, - /* 1 */ { MAD_F(0x04000000) /* 0.250000000 */, 2 }, - /* 2 */ { MAD_F(0x050a28be) /* 0.314980262 */, 3 }, - /* 3 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 4 }, - /* 4 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 4 }, - /* 5 */ { MAD_F(0x04466275) /* 0.267183742 */, 5 }, - /* 6 */ { MAD_F(0x05738c72) /* 0.340710111 */, 5 }, - /* 7 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 5 }, - /* 8 */ { MAD_F(0x04000000) /* 0.250000000 */, 6 }, - /* 9 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 6 }, - /* 10 */ { MAD_F(0x0562d694) /* 0.336630420 */, 6 }, - /* 11 */ { MAD_F(0x061dae96) /* 0.382246578 */, 6 }, - /* 12 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 6 }, - /* 13 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 6 }, - /* 14 */ { MAD_F(0x0437be65) /* 0.263609310 */, 7 }, - /* 15 */ { MAD_F(0x049fc824) /* 0.289009227 */, 7 }, - - /* 16 */ { MAD_F(0x050a28be) /* 0.314980262 */, 7 }, - /* 17 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 7 }, - /* 18 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 7 }, - /* 19 */ { MAD_F(0x06566361) /* 0.396090870 */, 7 }, - /* 20 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 7 }, - /* 21 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 7 }, - /* 22 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 7 }, - /* 23 */ { MAD_F(0x04168b05) /* 0.255503674 */, 8 }, - /* 24 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 8 }, - /* 25 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 8 }, - /* 26 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 8 }, - /* 27 */ { MAD_F(0x05100000) /* 0.316406250 */, 8 }, - /* 28 */ { MAD_F(0x05506451) /* 0.332126919 */, 8 }, - /* 29 */ { MAD_F(0x05918e15) /* 0.348035890 */, 8 }, - /* 30 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 8 }, - /* 31 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 8 }, - - /* 32 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 8 }, - /* 33 */ { MAD_F(0x069d9400) /* 0.413471222 */, 8 }, - /* 34 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 8 }, - /* 35 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 8 }, - /* 36 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 8 }, - /* 37 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 8 }, - /* 38 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 8 }, - /* 39 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 9 }, - /* 40 */ { MAD_F(0x04466275) /* 0.267183742 */, 9 }, - /* 41 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 9 }, - /* 42 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 9 }, - /* 43 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 9 }, - /* 44 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 9 }, - /* 45 */ { MAD_F(0x05007b49) /* 0.312617576 */, 9 }, - /* 46 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 9 }, - /* 47 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 9 }, - - /* 48 */ { MAD_F(0x05738c72) /* 0.340710111 */, 9 }, - /* 49 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 9 }, - /* 50 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 9 }, - /* 51 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 9 }, - /* 52 */ { MAD_F(0x0610b982) /* 0.379083164 */, 9 }, - /* 53 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 9 }, - /* 54 */ { MAD_F(0x0660db91) /* 0.398646895 */, 9 }, - /* 55 */ { MAD_F(0x06894c90) /* 0.408520284 */, 9 }, - /* 56 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 9 }, - /* 57 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 9 }, - /* 58 */ { MAD_F(0x07041636) /* 0.438497744 */, 9 }, - /* 59 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 9 }, - /* 60 */ { MAD_F(0x075722ef) /* 0.458773552 */, 9 }, - /* 61 */ { MAD_F(0x078102b8) /* 0.468996735 */, 9 }, - /* 62 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 9 }, - /* 63 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 9 }, - - /* 64 */ { MAD_F(0x04000000) /* 0.250000000 */, 10 }, - /* 65 */ { MAD_F(0x04156381) /* 0.255221850 */, 10 }, - /* 66 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 10 }, - /* 67 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 10 }, - /* 68 */ { MAD_F(0x045635cf) /* 0.271047409 */, 10 }, - /* 69 */ { MAD_F(0x046c083e) /* 0.276375048 */, 10 }, - /* 70 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 10 }, - /* 71 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 10 }, - /* 72 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 10 }, - /* 73 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 10 }, - /* 74 */ { MAD_F(0x04dab524) /* 0.303395408 */, 10 }, - /* 75 */ { MAD_F(0x04f12624) /* 0.308874267 */, 10 }, - /* 76 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 10 }, - /* 77 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 10 }, - /* 78 */ { MAD_F(0x053511cb) /* 0.325456423 */, 10 }, - /* 79 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 10 }, - - /* 80 */ { MAD_F(0x0562d694) /* 0.336630420 */, 10 }, - /* 81 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 10 }, - /* 82 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 10 }, - /* 83 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 10 }, - /* 84 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 10 }, - /* 85 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 10 }, - /* 86 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 10 }, - /* 87 */ { MAD_F(0x0606012b) /* 0.376465960 */, 10 }, - /* 88 */ { MAD_F(0x061dae96) /* 0.382246578 */, 10 }, - /* 89 */ { MAD_F(0x06357302) /* 0.388049134 */, 10 }, - /* 90 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 10 }, - /* 91 */ { MAD_F(0x0665402d) /* 0.399719406 */, 10 }, - /* 92 */ { MAD_F(0x067d4896) /* 0.405586801 */, 10 }, - /* 93 */ { MAD_F(0x06956753) /* 0.411475493 */, 10 }, - /* 94 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 10 }, - /* 95 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 10 }, - - /* 96 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 10 }, - /* 97 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 10 }, - /* 98 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 10 }, - /* 99 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 10 }, - /* 100 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 10 }, - /* 101 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 10 }, - /* 102 */ { MAD_F(0x07724f64) /* 0.465407744 */, 10 }, - /* 103 */ { MAD_F(0x078b4514) /* 0.471501425 */, 10 }, - /* 104 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 10 }, - /* 105 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 10 }, - /* 106 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 10 }, - /* 107 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 10 }, - /* 108 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 11 }, - /* 109 */ { MAD_F(0x04115aca) /* 0.254236974 */, 11 }, - /* 110 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 11 }, - /* 111 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 11 }, - - /* 112 */ { MAD_F(0x0437be65) /* 0.263609310 */, 11 }, - /* 113 */ { MAD_F(0x04449dee) /* 0.266752177 */, 11 }, - /* 114 */ { MAD_F(0x04518733) /* 0.269904329 */, 11 }, - /* 115 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 11 }, - /* 116 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 11 }, - /* 117 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 11 }, - /* 118 */ { MAD_F(0x04858c83) /* 0.282604707 */, 11 }, - /* 119 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 11 }, - /* 120 */ { MAD_F(0x049fc824) /* 0.289009227 */, 11 }, - /* 121 */ { MAD_F(0x04acf402) /* 0.292224893 */, 11 }, - /* 122 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 11 }, - /* 123 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 11 }, - /* 124 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 11 }, - /* 125 */ { MAD_F(0x04e20000) /* 0.305175781 */, 11 }, - /* 126 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 11 }, - /* 127 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 11 }, - - /* 128 */ { MAD_F(0x050a28be) /* 0.314980262 */, 11 }, - /* 129 */ { MAD_F(0x05179da4) /* 0.318265572 */, 11 }, - /* 130 */ { MAD_F(0x05251b73) /* 0.321559381 */, 11 }, - /* 131 */ { MAD_F(0x0532a220) /* 0.324861647 */, 11 }, - /* 132 */ { MAD_F(0x054031a0) /* 0.328172327 */, 11 }, - /* 133 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 11 }, - /* 134 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 11 }, - /* 135 */ { MAD_F(0x0569149c) /* 0.338154423 */, 11 }, - /* 136 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 11 }, - /* 137 */ { MAD_F(0x058481e9) /* 0.344850455 */, 11 }, - /* 138 */ { MAD_F(0x0592456d) /* 0.348210741 */, 11 }, - /* 139 */ { MAD_F(0x05a01176) /* 0.351579152 */, 11 }, - /* 140 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 11 }, - /* 141 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 11 }, - /* 142 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 11 }, - /* 143 */ { MAD_F(0x05d79601) /* 0.365133291 */, 11 }, - - /* 144 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 11 }, - /* 145 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 11 }, - /* 146 */ { MAD_F(0x060190ee) /* 0.375382356 */, 11 }, - /* 147 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 11 }, - /* 148 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 11 }, - /* 149 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 11 }, - /* 150 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 11 }, - /* 151 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 11 }, - /* 152 */ { MAD_F(0x06566361) /* 0.396090870 */, 11 }, - /* 153 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 11 }, - /* 154 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 11 }, - /* 155 */ { MAD_F(0x068138f3) /* 0.406548452 */, 11 }, - /* 156 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 11 }, - /* 157 */ { MAD_F(0x069deed1) /* 0.413557833 */, 11 }, - /* 158 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 11 }, - /* 159 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 11 }, - - /* 160 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 11 }, - /* 161 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 11 }, - /* 162 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 11 }, - /* 163 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 11 }, - /* 164 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 11 }, - /* 165 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 11 }, - /* 166 */ { MAD_F(0x0720a087) /* 0.445465593 */, 11 }, - /* 167 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 11 }, - /* 168 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 11 }, - /* 169 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 11 }, - /* 170 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 11 }, - /* 171 */ { MAD_F(0x076a454c) /* 0.463444993 */, 11 }, - /* 172 */ { MAD_F(0x07791620) /* 0.467062117 */, 11 }, - /* 173 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 11 }, - /* 174 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 11 }, - /* 175 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 11 }, - - /* 176 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 11 }, - /* 177 */ { MAD_F(0x07c39812) /* 0.485252449 */, 11 }, - /* 178 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 11 }, - /* 179 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 11 }, - /* 180 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 11 }, - /* 181 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 11 }, - /* 182 */ { MAD_F(0x0407673f) /* 0.251807447 */, 12 }, - /* 183 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 12 }, - /* 184 */ { MAD_F(0x04168b05) /* 0.255503674 */, 12 }, - /* 185 */ { MAD_F(0x041e2230) /* 0.257356825 */, 12 }, - /* 186 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 12 }, - /* 187 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 12 }, - /* 188 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 12 }, - /* 189 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 12 }, - /* 190 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 12 }, - /* 191 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 12 }, - - /* 192 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 12 }, - /* 193 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 12 }, - /* 194 */ { MAD_F(0x04630eed) /* 0.274184158 */, 12 }, - /* 195 */ { MAD_F(0x046ac896) /* 0.276070203 */, 12 }, - /* 196 */ { MAD_F(0x047285a2) /* 0.277959474 */, 12 }, - /* 197 */ { MAD_F(0x047a460c) /* 0.279851960 */, 12 }, - /* 198 */ { MAD_F(0x048209d3) /* 0.281747652 */, 12 }, - /* 199 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 12 }, - /* 200 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 12 }, - /* 201 */ { MAD_F(0x04996935) /* 0.287453849 */, 12 }, - /* 202 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 12 }, - /* 203 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 12 }, - /* 204 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 12 }, - /* 205 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 12 }, - /* 206 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 12 }, - /* 207 */ { MAD_F(0x04c88135) /* 0.298951346 */, 12 }, - - /* 208 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 12 }, - /* 209 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 12 }, - /* 210 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 12 }, - /* 211 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 12 }, - /* 212 */ { MAD_F(0x04f01963) /* 0.308617963 */, 12 }, - /* 213 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 12 }, - /* 214 */ { MAD_F(0x05000655) /* 0.312506041 */, 12 }, - /* 215 */ { MAD_F(0x05080195) /* 0.314454634 */, 12 }, - /* 216 */ { MAD_F(0x05100000) /* 0.316406250 */, 12 }, - /* 217 */ { MAD_F(0x05180194) /* 0.318360880 */, 12 }, - /* 218 */ { MAD_F(0x0520064f) /* 0.320318516 */, 12 }, - /* 219 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 12 }, - /* 220 */ { MAD_F(0x0530192e) /* 0.324242764 */, 12 }, - /* 221 */ { MAD_F(0x0538274e) /* 0.326209359 */, 12 }, - /* 222 */ { MAD_F(0x0540388a) /* 0.328178922 */, 12 }, - /* 223 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 12 }, - - /* 224 */ { MAD_F(0x05506451) /* 0.332126919 */, 12 }, - /* 225 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 12 }, - /* 226 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 12 }, - /* 227 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 12 }, - /* 228 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 12 }, - /* 229 */ { MAD_F(0x05790793) /* 0.342048241 */, 12 }, - /* 230 */ { MAD_F(0x05813162) /* 0.344041237 */, 12 }, - /* 231 */ { MAD_F(0x05895e39) /* 0.346037122 */, 12 }, - /* 232 */ { MAD_F(0x05918e15) /* 0.348035890 */, 12 }, - /* 233 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 12 }, - /* 234 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 12 }, - /* 235 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 12 }, - /* 236 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 12 }, - /* 237 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 12 }, - /* 238 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 12 }, - /* 239 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 12 }, - - /* 240 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 12 }, - /* 241 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 12 }, - /* 242 */ { MAD_F(0x05e41105) /* 0.368180294 */, 12 }, - /* 243 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 12 }, - /* 244 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 12 }, - /* 245 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 12 }, - /* 246 */ { MAD_F(0x060564b1) /* 0.376316732 */, 12 }, - /* 247 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 12 }, - /* 248 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 12 }, - /* 249 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 12 }, - /* 250 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 12 }, - /* 251 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 12 }, - /* 252 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 12 }, - /* 253 */ { MAD_F(0x06402666) /* 0.390661620 */, 12 }, - /* 254 */ { MAD_F(0x064896a7) /* 0.392721798 */, 12 }, - /* 255 */ { MAD_F(0x065109be) /* 0.394784681 */, 12 }, - - /* 256 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 12 }, - /* 257 */ { MAD_F(0x0661f867) /* 0.398918536 */, 12 }, - /* 258 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 12 }, - /* 259 */ { MAD_F(0x0672f252) /* 0.403063128 */, 12 }, - /* 260 */ { MAD_F(0x067b737c) /* 0.405139433 */, 12 }, - /* 261 */ { MAD_F(0x0683f771) /* 0.407218402 */, 12 }, - /* 262 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 12 }, - /* 263 */ { MAD_F(0x069507b5) /* 0.411384303 */, 12 }, - /* 264 */ { MAD_F(0x069d9400) /* 0.413471222 */, 12 }, - /* 265 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 12 }, - /* 266 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 12 }, - /* 267 */ { MAD_F(0x06b74971) /* 0.419747773 */, 12 }, - /* 268 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 12 }, - /* 269 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 12 }, - /* 270 */ { MAD_F(0x06d11794) /* 0.426047876 */, 12 }, - /* 271 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 12 }, - - /* 272 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 12 }, - /* 273 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 12 }, - /* 274 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 12 }, - /* 275 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 12 }, - /* 276 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 12 }, - /* 277 */ { MAD_F(0x070dacea) /* 0.440838732 */, 12 }, - /* 278 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 12 }, - /* 279 */ { MAD_F(0x071f1459) /* 0.445087765 */, 12 }, - /* 280 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 12 }, - /* 281 */ { MAD_F(0x07308671) /* 0.449346964 */, 12 }, - /* 282 */ { MAD_F(0x07394378) /* 0.451480360 */, 12 }, - /* 283 */ { MAD_F(0x07420325) /* 0.453616280 */, 12 }, - /* 284 */ { MAD_F(0x074ac575) /* 0.455754717 */, 12 }, - /* 285 */ { MAD_F(0x07538a67) /* 0.457895665 */, 12 }, - /* 286 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 12 }, - /* 287 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 12 }, - - /* 288 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 12 }, - /* 289 */ { MAD_F(0x0776b867) /* 0.466484455 */, 12 }, - /* 290 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 12 }, - /* 291 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 12 }, - /* 292 */ { MAD_F(0x07913641) /* 0.472952132 */, 12 }, - /* 293 */ { MAD_F(0x079a100c) /* 0.475112962 */, 12 }, - /* 294 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 12 }, - /* 295 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 12 }, - /* 296 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 12 }, - /* 297 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 12 }, - /* 298 */ { MAD_F(0x07c67798) /* 0.485953899 */, 12 }, - /* 299 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 12 }, - /* 300 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 12 }, - /* 301 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 12 }, - /* 302 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 12 }, - /* 303 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 12 }, - - /* 304 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 12 }, - /* 305 */ { MAD_F(0x0402868e) /* 0.250616605 */, 13 }, - /* 306 */ { MAD_F(0x040703ff) /* 0.251712795 */, 13 }, - /* 307 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 13 }, - /* 308 */ { MAD_F(0x041002a1) /* 0.253908756 */, 13 }, - /* 309 */ { MAD_F(0x041483d1) /* 0.255008523 */, 13 }, - /* 310 */ { MAD_F(0x04190640) /* 0.256109476 */, 13 }, - /* 311 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 13 }, - /* 312 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 13 }, - /* 313 */ { MAD_F(0x042694fe) /* 0.259419433 */, 13 }, - /* 314 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 13 }, - /* 315 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 13 }, - /* 316 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 13 }, - /* 317 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 13 }, - /* 318 */ { MAD_F(0x043d4635) /* 0.264959533 */, 13 }, - /* 319 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 13 }, - - /* 320 */ { MAD_F(0x04466275) /* 0.267183742 */, 13 }, - /* 321 */ { MAD_F(0x044af269) /* 0.268297587 */, 13 }, - /* 322 */ { MAD_F(0x044f8393) /* 0.269412589 */, 13 }, - /* 323 */ { MAD_F(0x045415f3) /* 0.270528746 */, 13 }, - /* 324 */ { MAD_F(0x0458a989) /* 0.271646056 */, 13 }, - /* 325 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 13 }, - /* 326 */ { MAD_F(0x0461d451) /* 0.273884123 */, 13 }, - /* 327 */ { MAD_F(0x04666b83) /* 0.275004875 */, 13 }, - /* 328 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 13 }, - /* 329 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 13 }, - /* 330 */ { MAD_F(0x04743847) /* 0.278373983 */, 13 }, - /* 331 */ { MAD_F(0x0478d440) /* 0.279499294 */, 13 }, - /* 332 */ { MAD_F(0x047d716a) /* 0.280625739 */, 13 }, - /* 333 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 13 }, - /* 334 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 13 }, - /* 335 */ { MAD_F(0x048b5003) /* 0.284011853 */, 13 }, - - /* 336 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 13 }, - /* 337 */ { MAD_F(0x049494fb) /* 0.286274891 */, 13 }, - /* 338 */ { MAD_F(0x0499393a) /* 0.287408091 */, 13 }, - /* 339 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 13 }, - /* 340 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 13 }, - /* 341 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 13 }, - /* 342 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 13 }, - /* 343 */ { MAD_F(0x04b08000) /* 0.293090820 */, 13 }, - /* 344 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 13 }, - /* 345 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 13 }, - /* 346 */ { MAD_F(0x04be8537) /* 0.296513762 */, 13 }, - /* 347 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 13 }, - /* 348 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 13 }, - /* 349 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 13 }, - /* 350 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 13 }, - /* 351 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 13 }, - - /* 352 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 13 }, - /* 353 */ { MAD_F(0x04df6458) /* 0.304539056 */, 13 }, - /* 354 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 13 }, - /* 355 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 13 }, - /* 356 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 13 }, - /* 357 */ { MAD_F(0x04f24618) /* 0.309148880 */, 13 }, - /* 358 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 13 }, - /* 359 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 13 }, - /* 360 */ { MAD_F(0x05007b49) /* 0.312617576 */, 13 }, - /* 361 */ { MAD_F(0x050539ef) /* 0.313775954 */, 13 }, - /* 362 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 13 }, - /* 363 */ { MAD_F(0x050eba98) /* 0.316095920 */, 13 }, - /* 364 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 13 }, - /* 365 */ { MAD_F(0x05183fba) /* 0.318420150 */, 13 }, - /* 366 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 13 }, - /* 367 */ { MAD_F(0x0521c950) /* 0.320748629 */, 13 }, - - /* 368 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 13 }, - /* 369 */ { MAD_F(0x052b5757) /* 0.323081342 */, 13 }, - /* 370 */ { MAD_F(0x05302003) /* 0.324249281 */, 13 }, - /* 371 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 13 }, - /* 372 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 13 }, - /* 373 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 13 }, - /* 374 */ { MAD_F(0x05434db9) /* 0.328931546 */, 13 }, - /* 375 */ { MAD_F(0x05481be5) /* 0.330104730 */, 13 }, - /* 376 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 13 }, - /* 377 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 13 }, - /* 378 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 13 }, - /* 379 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 13 }, - /* 380 */ { MAD_F(0x05603321) /* 0.335986261 */, 13 }, - /* 381 */ { MAD_F(0x056507d6) /* 0.337165677 */, 13 }, - /* 382 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 13 }, - /* 383 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 13 }, - - /* 384 */ { MAD_F(0x05738c72) /* 0.340710111 */, 13 }, - /* 385 */ { MAD_F(0x05786578) /* 0.341893646 */, 13 }, - /* 386 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 13 }, - /* 387 */ { MAD_F(0x05821abf) /* 0.344263788 */, 13 }, - /* 388 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 13 }, - /* 389 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 13 }, - /* 390 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 13 }, - /* 391 */ { MAD_F(0x05959222) /* 0.349016318 */, 13 }, - /* 392 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 13 }, - /* 393 */ { MAD_F(0x059f5438) /* 0.351398678 */, 13 }, - /* 394 */ { MAD_F(0x05a436da) /* 0.352591376 */, 13 }, - /* 395 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 13 }, - /* 396 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 13 }, - /* 397 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 13 }, - /* 398 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 13 }, - /* 399 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 13 }, - - /* 400 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 13 }, - /* 401 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 13 }, - /* 402 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 13 }, - /* 403 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 13 }, - /* 404 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 13 }, - /* 405 */ { MAD_F(0x05da394d) /* 0.365777304 */, 13 }, - /* 406 */ { MAD_F(0x05df2885) /* 0.366982004 */, 13 }, - /* 407 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 13 }, - /* 408 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 13 }, - /* 409 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 13 }, - /* 410 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 13 }, - /* 411 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 13 }, - /* 412 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 13 }, - /* 413 */ { MAD_F(0x0601d004) /* 0.375442522 */, 13 }, - /* 414 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 13 }, - /* 415 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 13 }, - - /* 416 */ { MAD_F(0x0610b982) /* 0.379083164 */, 13 }, - /* 417 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 13 }, - /* 418 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 13 }, - /* 419 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 13 }, - /* 420 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 13 }, - /* 421 */ { MAD_F(0x0629a863) /* 0.385170352 */, 13 }, - /* 422 */ { MAD_F(0x062ea802) /* 0.386390694 */, 13 }, - /* 423 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 13 }, - /* 424 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 13 }, - /* 425 */ { MAD_F(0x063dacee) /* 0.390057497 */, 13 }, - /* 426 */ { MAD_F(0x0642b096) /* 0.391281687 */, 13 }, - /* 427 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 13 }, - /* 428 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 13 }, - /* 429 */ { MAD_F(0x0651c193) /* 0.394959999 */, 13 }, - /* 430 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 13 }, - /* 431 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 13 }, - - /* 432 */ { MAD_F(0x0660db91) /* 0.398646895 */, 13 }, - /* 433 */ { MAD_F(0x0665e639) /* 0.399877761 */, 13 }, - /* 434 */ { MAD_F(0x066af1df) /* 0.401109575 */, 13 }, - /* 435 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 13 }, - /* 436 */ { MAD_F(0x06750c26) /* 0.403576041 */, 13 }, - /* 437 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 13 }, - /* 438 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 13 }, - /* 439 */ { MAD_F(0x06843afb) /* 0.407282813 */, 13 }, - /* 440 */ { MAD_F(0x06894c90) /* 0.408520284 */, 13 }, - /* 441 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 13 }, - /* 442 */ { MAD_F(0x069372ae) /* 0.410998038 */, 13 }, - /* 443 */ { MAD_F(0x06988735) /* 0.412238319 */, 13 }, - /* 444 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 13 }, - /* 445 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 13 }, - /* 446 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 13 }, - /* 447 */ { MAD_F(0x06ace318) /* 0.417208762 */, 13 }, - - /* 448 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 13 }, - /* 449 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 13 }, - /* 450 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 13 }, - /* 451 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 13 }, - /* 452 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 13 }, - /* 453 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 13 }, - /* 454 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 13 }, - /* 455 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 13 }, - /* 456 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 13 }, - /* 457 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 13 }, - /* 458 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 13 }, - /* 459 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 13 }, - /* 460 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 13 }, - /* 461 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 13 }, - /* 462 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 13 }, - /* 463 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 13 }, - - /* 464 */ { MAD_F(0x07041636) /* 0.438497744 */, 13 }, - /* 465 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 13 }, - /* 466 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 13 }, - /* 467 */ { MAD_F(0x07139641) /* 0.442281965 */, 13 }, - /* 468 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 13 }, - /* 469 */ { MAD_F(0x071df058) /* 0.444809288 */, 13 }, - /* 470 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 13 }, - /* 471 */ { MAD_F(0x07284e34) /* 0.447340205 */, 13 }, - /* 472 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 13 }, - /* 473 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 13 }, - /* 474 */ { MAD_F(0x0737e209) /* 0.451143300 */, 13 }, - /* 475 */ { MAD_F(0x073d1530) /* 0.452412785 */, 13 }, - /* 476 */ { MAD_F(0x07424946) /* 0.453683161 */, 13 }, - /* 477 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 13 }, - /* 478 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 13 }, - /* 479 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 13 }, - - /* 480 */ { MAD_F(0x075722ef) /* 0.458773552 */, 13 }, - /* 481 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 13 }, - /* 482 */ { MAD_F(0x07619557) /* 0.461324062 */, 13 }, - /* 483 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 13 }, - /* 484 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 13 }, - /* 485 */ { MAD_F(0x077147e2) /* 0.465156443 */, 13 }, - /* 486 */ { MAD_F(0x0776853e) /* 0.466435663 */, 13 }, - /* 487 */ { MAD_F(0x077bc385) /* 0.467715761 */, 13 }, - /* 488 */ { MAD_F(0x078102b8) /* 0.468996735 */, 13 }, - /* 489 */ { MAD_F(0x078642d6) /* 0.470278584 */, 13 }, - /* 490 */ { MAD_F(0x078b83de) /* 0.471561307 */, 13 }, - /* 491 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 13 }, - /* 492 */ { MAD_F(0x079608ae) /* 0.474129372 */, 13 }, - /* 493 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 13 }, - /* 494 */ { MAD_F(0x07a09124) /* 0.476700918 */, 13 }, - /* 495 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 13 }, - - /* 496 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 13 }, - /* 497 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 13 }, - /* 498 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 13 }, - /* 499 */ { MAD_F(0x07baf635) /* 0.483144957 */, 13 }, - /* 500 */ { MAD_F(0x07c04056) /* 0.484436356 */, 13 }, - /* 501 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 13 }, - /* 502 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 13 }, - /* 503 */ { MAD_F(0x07d02424) /* 0.488315717 */, 13 }, - /* 504 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 13 }, - /* 505 */ { MAD_F(0x07dac083) /* 0.490906249 */, 13 }, - /* 506 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 13 }, - /* 507 */ { MAD_F(0x07e56078) /* 0.493500203 */, 13 }, - /* 508 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 13 }, - /* 509 */ { MAD_F(0x07f00401) /* 0.496097570 */, 13 }, - /* 510 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 13 }, - /* 511 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 13 }, - - /* 512 */ { MAD_F(0x04000000) /* 0.250000000 */, 14 }, - /* 513 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 14 }, - /* 514 */ { MAD_F(0x04055638) /* 0.251302930 */, 14 }, - /* 515 */ { MAD_F(0x040801ff) /* 0.251955030 */, 14 }, - /* 516 */ { MAD_F(0x040aae37) /* 0.252607552 */, 14 }, - /* 517 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 14 }, - /* 518 */ { MAD_F(0x041007fa) /* 0.253913860 */, 14 }, - /* 519 */ { MAD_F(0x0412b586) /* 0.254567645 */, 14 }, - /* 520 */ { MAD_F(0x04156381) /* 0.255221850 */, 14 }, - /* 521 */ { MAD_F(0x041811ee) /* 0.255876475 */, 14 }, - /* 522 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 14 }, - /* 523 */ { MAD_F(0x041d7018) /* 0.257186980 */, 14 }, - /* 524 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 14 }, - /* 525 */ { MAD_F(0x0422d003) /* 0.258499157 */, 14 }, - /* 526 */ { MAD_F(0x042580a0) /* 0.259155872 */, 14 }, - /* 527 */ { MAD_F(0x042831ad) /* 0.259813002 */, 14 }, - - /* 528 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 14 }, - /* 529 */ { MAD_F(0x042d9516) /* 0.261128510 */, 14 }, - /* 530 */ { MAD_F(0x04304772) /* 0.261786886 */, 14 }, - /* 531 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 14 }, - /* 532 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 14 }, - /* 533 */ { MAD_F(0x0438611f) /* 0.263764497 */, 14 }, - /* 534 */ { MAD_F(0x043b1536) /* 0.264424527 */, 14 }, - /* 535 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 14 }, - /* 536 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 14 }, - /* 537 */ { MAD_F(0x04433414) /* 0.266407088 */, 14 }, - /* 538 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 14 }, - /* 539 */ { MAD_F(0x0448a024) /* 0.267730848 */, 14 }, - /* 540 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 14 }, - /* 541 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 14 }, - /* 542 */ { MAD_F(0x0450c575) /* 0.269719560 */, 14 }, - /* 543 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 14 }, - - /* 544 */ { MAD_F(0x045635cf) /* 0.271047409 */, 14 }, - /* 545 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 14 }, - /* 546 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 14 }, - /* 547 */ { MAD_F(0x045e6188) /* 0.273042234 */, 14 }, - /* 548 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 14 }, - /* 549 */ { MAD_F(0x0463d625) /* 0.274374147 */, 14 }, - /* 550 */ { MAD_F(0x04669116) /* 0.275040710 */, 14 }, - /* 551 */ { MAD_F(0x04694c74) /* 0.275707677 */, 14 }, - /* 552 */ { MAD_F(0x046c083e) /* 0.276375048 */, 14 }, - /* 553 */ { MAD_F(0x046ec474) /* 0.277042822 */, 14 }, - /* 554 */ { MAD_F(0x04718116) /* 0.277710999 */, 14 }, - /* 555 */ { MAD_F(0x04743e25) /* 0.278379578 */, 14 }, - /* 556 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 14 }, - /* 557 */ { MAD_F(0x0479b984) /* 0.279717940 */, 14 }, - /* 558 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 14 }, - /* 559 */ { MAD_F(0x047f3693) /* 0.281057905 */, 14 }, - - /* 560 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 14 }, - /* 561 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 14 }, - /* 562 */ { MAD_F(0x0487754c) /* 0.283070849 */, 14 }, - /* 563 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 14 }, - /* 564 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 14 }, - /* 565 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 14 }, - /* 566 */ { MAD_F(0x04927972) /* 0.285760350 */, 14 }, - /* 567 */ { MAD_F(0x04953b85) /* 0.286433717 */, 14 }, - /* 568 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 14 }, - /* 569 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 14 }, - /* 570 */ { MAD_F(0x049d843e) /* 0.288456194 */, 14 }, - /* 571 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 14 }, - /* 572 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 14 }, - /* 573 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 14 }, - /* 574 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 14 }, - /* 575 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 14 }, - - /* 576 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 14 }, - /* 577 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 14 }, - /* 578 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 14 }, - /* 579 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 14 }, - /* 580 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 14 }, - /* 581 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 14 }, - /* 582 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 14 }, - /* 583 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 14 }, - /* 584 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 14 }, - /* 585 */ { MAD_F(0x04c72771) /* 0.298621598 */, 14 }, - /* 586 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 14 }, - /* 587 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 14 }, - /* 588 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 14 }, - /* 589 */ { MAD_F(0x04d25169) /* 0.301347172 */, 14 }, - /* 590 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 14 }, - /* 591 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 14 }, - - /* 592 */ { MAD_F(0x04dab524) /* 0.303395408 */, 14 }, - /* 593 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 14 }, - /* 594 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 14 }, - /* 595 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 14 }, - /* 596 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 14 }, - /* 597 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 14 }, - /* 598 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 14 }, - /* 599 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 14 }, - /* 600 */ { MAD_F(0x04f12624) /* 0.308874267 */, 14 }, - /* 601 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 14 }, - /* 602 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 14 }, - /* 603 */ { MAD_F(0x04f99721) /* 0.310935143 */, 14 }, - /* 604 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 14 }, - /* 605 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 14 }, - /* 606 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 14 }, - /* 607 */ { MAD_F(0x0504de05) /* 0.313688296 */, 14 }, - - /* 608 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 14 }, - /* 609 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 14 }, - /* 610 */ { MAD_F(0x050d575b) /* 0.315757136 */, 14 }, - /* 611 */ { MAD_F(0x05102b42) /* 0.316447504 */, 14 }, - /* 612 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 14 }, - /* 613 */ { MAD_F(0x0515d440) /* 0.317829370 */, 14 }, - /* 614 */ { MAD_F(0x0518a956) /* 0.318520867 */, 14 }, - /* 615 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 14 }, - /* 616 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 14 }, - /* 617 */ { MAD_F(0x05212af5) /* 0.320597609 */, 14 }, - /* 618 */ { MAD_F(0x0524019e) /* 0.321290606 */, 14 }, - /* 619 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 14 }, - /* 620 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 14 }, - /* 621 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 14 }, - /* 622 */ { MAD_F(0x052f602c) /* 0.324066327 */, 14 }, - /* 623 */ { MAD_F(0x053238ca) /* 0.324761189 */, 14 }, - - /* 624 */ { MAD_F(0x053511cb) /* 0.325456423 */, 14 }, - /* 625 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 14 }, - /* 626 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 14 }, - /* 627 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 14 }, - /* 628 */ { MAD_F(0x054079b5) /* 0.328241070 */, 14 }, - /* 629 */ { MAD_F(0x054354a8) /* 0.328938157 */, 14 }, - /* 630 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 14 }, - /* 631 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 14 }, - /* 632 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 14 }, - /* 633 */ { MAD_F(0x054ec453) /* 0.331730198 */, 14 }, - /* 634 */ { MAD_F(0x0551a134) /* 0.332429129 */, 14 }, - /* 635 */ { MAD_F(0x05547e79) /* 0.333128427 */, 14 }, - /* 636 */ { MAD_F(0x05575c20) /* 0.333828093 */, 14 }, - /* 637 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 14 }, - /* 638 */ { MAD_F(0x055d1896) /* 0.335228525 */, 14 }, - /* 639 */ { MAD_F(0x055ff764) /* 0.335929290 */, 14 }, - - /* 640 */ { MAD_F(0x0562d694) /* 0.336630420 */, 14 }, - /* 641 */ { MAD_F(0x0565b627) /* 0.337331916 */, 14 }, - /* 642 */ { MAD_F(0x0568961b) /* 0.338033777 */, 14 }, - /* 643 */ { MAD_F(0x056b7671) /* 0.338736002 */, 14 }, - /* 644 */ { MAD_F(0x056e5729) /* 0.339438592 */, 14 }, - /* 645 */ { MAD_F(0x05713843) /* 0.340141545 */, 14 }, - /* 646 */ { MAD_F(0x057419be) /* 0.340844862 */, 14 }, - /* 647 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 14 }, - /* 648 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 14 }, - /* 649 */ { MAD_F(0x057cc077) /* 0.342956988 */, 14 }, - /* 650 */ { MAD_F(0x057fa378) /* 0.343661754 */, 14 }, - /* 651 */ { MAD_F(0x058286d9) /* 0.344366882 */, 14 }, - /* 652 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 14 }, - /* 653 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 14 }, - /* 654 */ { MAD_F(0x058b3342) /* 0.346484431 */, 14 }, - /* 655 */ { MAD_F(0x058e1827) /* 0.347191002 */, 14 }, - - /* 656 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 14 }, - /* 657 */ { MAD_F(0x0593e311) /* 0.348605221 */, 14 }, - /* 658 */ { MAD_F(0x0596c917) /* 0.349312869 */, 14 }, - /* 659 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 14 }, - /* 660 */ { MAD_F(0x059c9643) /* 0.350729240 */, 14 }, - /* 661 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 14 }, - /* 662 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 14 }, - /* 663 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 14 }, - /* 664 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 14 }, - /* 665 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 14 }, - /* 666 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 14 }, - /* 667 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 14 }, - /* 668 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 14 }, - /* 669 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 14 }, - /* 670 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 14 }, - /* 671 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 14 }, - - /* 672 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 14 }, - /* 673 */ { MAD_F(0x05c27057) /* 0.359970419 */, 14 }, - /* 674 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 14 }, - /* 675 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 14 }, - /* 676 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 14 }, - /* 677 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 14 }, - /* 678 */ { MAD_F(0x05d11001) /* 0.363540655 */, 14 }, - /* 679 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 14 }, - /* 680 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 14 }, - /* 681 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 14 }, - /* 682 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 14 }, - /* 683 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 14 }, - /* 684 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 14 }, - /* 685 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 14 }, - /* 686 */ { MAD_F(0x05e88904) /* 0.369271294 */, 14 }, - /* 687 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 14 }, - - /* 688 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 14 }, - /* 689 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 14 }, - /* 690 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 14 }, - /* 691 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 14 }, - /* 692 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 14 }, - /* 693 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 14 }, - /* 694 */ { MAD_F(0x0600196e) /* 0.375024253 */, 14 }, - /* 695 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 14 }, - /* 696 */ { MAD_F(0x0606012b) /* 0.376465960 */, 14 }, - /* 697 */ { MAD_F(0x0608f595) /* 0.377187332 */, 14 }, - /* 698 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 14 }, - /* 699 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 14 }, - /* 700 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 14 }, - /* 701 */ { MAD_F(0x0614cada) /* 0.380076266 */, 14 }, - /* 702 */ { MAD_F(0x0617c112) /* 0.380799360 */, 14 }, - /* 703 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 14 }, - - /* 704 */ { MAD_F(0x061dae96) /* 0.382246578 */, 14 }, - /* 705 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 14 }, - /* 706 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 14 }, - /* 707 */ { MAD_F(0x0626958f) /* 0.384419975 */, 14 }, - /* 708 */ { MAD_F(0x06298def) /* 0.385145124 */, 14 }, - /* 709 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 14 }, - /* 710 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 14 }, - /* 711 */ { MAD_F(0x06327934) /* 0.387322621 */, 14 }, - /* 712 */ { MAD_F(0x06357302) /* 0.388049134 */, 14 }, - /* 713 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 14 }, - /* 714 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 14 }, - /* 715 */ { MAD_F(0x063e6290) /* 0.390230715 */, 14 }, - /* 716 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 14 }, - /* 717 */ { MAD_F(0x06445960) /* 0.391686799 */, 14 }, - /* 718 */ { MAD_F(0x06475551) /* 0.392415349 */, 14 }, - /* 719 */ { MAD_F(0x064a519c) /* 0.393144238 */, 14 }, - - /* 720 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 14 }, - /* 721 */ { MAD_F(0x06504b44) /* 0.394603028 */, 14 }, - /* 722 */ { MAD_F(0x0653489f) /* 0.395332930 */, 14 }, - /* 723 */ { MAD_F(0x06564655) /* 0.396063168 */, 14 }, - /* 724 */ { MAD_F(0x06594465) /* 0.396793743 */, 14 }, - /* 725 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 14 }, - /* 726 */ { MAD_F(0x065f4195) /* 0.398255903 */, 14 }, - /* 727 */ { MAD_F(0x066240b4) /* 0.398987487 */, 14 }, - /* 728 */ { MAD_F(0x0665402d) /* 0.399719406 */, 14 }, - /* 729 */ { MAD_F(0x06684000) /* 0.400451660 */, 14 }, - /* 730 */ { MAD_F(0x066b402d) /* 0.401184249 */, 14 }, - /* 731 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 14 }, - /* 732 */ { MAD_F(0x06714194) /* 0.402650431 */, 14 }, - /* 733 */ { MAD_F(0x067442ce) /* 0.403384024 */, 14 }, - /* 734 */ { MAD_F(0x06774462) /* 0.404117949 */, 14 }, - /* 735 */ { MAD_F(0x067a464f) /* 0.404852209 */, 14 }, - - /* 736 */ { MAD_F(0x067d4896) /* 0.405586801 */, 14 }, - /* 737 */ { MAD_F(0x06804b36) /* 0.406321726 */, 14 }, - /* 738 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 14 }, - /* 739 */ { MAD_F(0x06865181) /* 0.407792573 */, 14 }, - /* 740 */ { MAD_F(0x0689552c) /* 0.408528495 */, 14 }, - /* 741 */ { MAD_F(0x068c5931) /* 0.409264748 */, 14 }, - /* 742 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 14 }, - /* 743 */ { MAD_F(0x06926245) /* 0.410738247 */, 14 }, - /* 744 */ { MAD_F(0x06956753) /* 0.411475493 */, 14 }, - /* 745 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 14 }, - /* 746 */ { MAD_F(0x069b727b) /* 0.412950976 */, 14 }, - /* 747 */ { MAD_F(0x069e7894) /* 0.413689213 */, 14 }, - /* 748 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 14 }, - /* 749 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 14 }, - /* 750 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 14 }, - /* 751 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 14 }, - - /* 752 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 14 }, - /* 753 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 14 }, - /* 754 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 14 }, - /* 755 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 14 }, - /* 756 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 14 }, - /* 757 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 14 }, - /* 758 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 14 }, - /* 759 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 14 }, - /* 760 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 14 }, - /* 761 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 14 }, - /* 762 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 14 }, - /* 763 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 14 }, - /* 764 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 14 }, - /* 765 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 14 }, - /* 766 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 14 }, - /* 767 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 14 }, - - /* 768 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 14 }, - /* 769 */ { MAD_F(0x06e15595) /* 0.430013259 */, 14 }, - /* 770 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 14 }, - /* 771 */ { MAD_F(0x06e771db) /* 0.431505065 */, 14 }, - /* 772 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 14 }, - /* 773 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 14 }, - /* 774 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 14 }, - /* 775 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 14 }, - /* 776 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 14 }, - /* 777 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 14 }, - /* 778 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 14 }, - /* 779 */ { MAD_F(0x06fff073) /* 0.437485172 */, 14 }, - /* 780 */ { MAD_F(0x070301ca) /* 0.438234130 */, 14 }, - /* 781 */ { MAD_F(0x07061377) /* 0.438983408 */, 14 }, - /* 782 */ { MAD_F(0x0709257a) /* 0.439733006 */, 14 }, - /* 783 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 14 }, - - /* 784 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 14 }, - /* 785 */ { MAD_F(0x07125d84) /* 0.441983717 */, 14 }, - /* 786 */ { MAD_F(0x071570de) /* 0.442734592 */, 14 }, - /* 787 */ { MAD_F(0x0718848d) /* 0.443485785 */, 14 }, - /* 788 */ { MAD_F(0x071b9891) /* 0.444237296 */, 14 }, - /* 789 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 14 }, - /* 790 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 14 }, - /* 791 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 14 }, - /* 792 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 14 }, - /* 793 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 14 }, - /* 794 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 14 }, - /* 795 */ { MAD_F(0x07312e01) /* 0.449506765 */, 14 }, - /* 796 */ { MAD_F(0x073444ae) /* 0.450260813 */, 14 }, - /* 797 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 14 }, - /* 798 */ { MAD_F(0x073a7307) /* 0.451769856 */, 14 }, - /* 799 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 14 }, - - /* 800 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 14 }, - /* 801 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 14 }, - /* 802 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 14 }, - /* 803 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 14 }, - /* 804 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 14 }, - /* 805 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 14 }, - /* 806 */ { MAD_F(0x0753399d) /* 0.457818618 */, 14 }, - /* 807 */ { MAD_F(0x075653eb) /* 0.458576125 */, 14 }, - /* 808 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 14 }, - /* 809 */ { MAD_F(0x075c8983) /* 0.460092079 */, 14 }, - /* 810 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 14 }, - /* 811 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 14 }, - /* 812 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 14 }, - /* 813 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 14 }, - /* 814 */ { MAD_F(0x076c1538) /* 0.463887426 */, 14 }, - /* 815 */ { MAD_F(0x076f3224) /* 0.464647430 */, 14 }, - - /* 816 */ { MAD_F(0x07724f64) /* 0.465407744 */, 14 }, - /* 817 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 14 }, - /* 818 */ { MAD_F(0x07788add) /* 0.466929306 */, 14 }, - /* 819 */ { MAD_F(0x077ba916) /* 0.467690552 */, 14 }, - /* 820 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 14 }, - /* 821 */ { MAD_F(0x0781e683) /* 0.469213973 */, 14 }, - /* 822 */ { MAD_F(0x078505b5) /* 0.469976148 */, 14 }, - /* 823 */ { MAD_F(0x0788253b) /* 0.470738632 */, 14 }, - /* 824 */ { MAD_F(0x078b4514) /* 0.471501425 */, 14 }, - /* 825 */ { MAD_F(0x078e653f) /* 0.472264527 */, 14 }, - /* 826 */ { MAD_F(0x079185be) /* 0.473027937 */, 14 }, - /* 827 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 14 }, - /* 828 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 14 }, - /* 829 */ { MAD_F(0x079ae929) /* 0.475320014 */, 14 }, - /* 830 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 14 }, - /* 831 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 14 }, - - /* 832 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 14 }, - /* 833 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 14 }, - /* 834 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 14 }, - /* 835 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 14 }, - /* 836 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 14 }, - /* 837 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 14 }, - /* 838 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 14 }, - /* 839 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 14 }, - /* 840 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 14 }, - /* 841 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 14 }, - /* 842 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 14 }, - /* 843 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 14 }, - /* 844 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 14 }, - /* 845 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 14 }, - /* 846 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 14 }, - /* 847 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 14 }, - - /* 848 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 14 }, - /* 849 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 14 }, - /* 850 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 14 }, - /* 851 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 14 }, - /* 852 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 14 }, - /* 853 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 14 }, - /* 854 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 14 }, - /* 855 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 14 }, - /* 856 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 14 }, - /* 857 */ { MAD_F(0x07f31405) /* 0.496845266 */, 14 }, - /* 858 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 14 }, - /* 859 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 14 }, - /* 860 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 14 }, - /* 861 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 14 }, - /* 862 */ { MAD_F(0x04017659) /* 0.250357008 */, 15 }, - /* 863 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 15 }, - - /* 864 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 15 }, - /* 865 */ { MAD_F(0x0406393d) /* 0.251519431 */, 15 }, - /* 866 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 15 }, - /* 867 */ { MAD_F(0x0409669d) /* 0.252295127 */, 15 }, - /* 868 */ { MAD_F(0x040afd89) /* 0.252683198 */, 15 }, - /* 869 */ { MAD_F(0x040c949e) /* 0.253071419 */, 15 }, - /* 870 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 15 }, - /* 871 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 15 }, - /* 872 */ { MAD_F(0x04115aca) /* 0.254236974 */, 15 }, - /* 873 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 15 }, - /* 874 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 15 }, - /* 875 */ { MAD_F(0x0416225d) /* 0.255403867 */, 15 }, - /* 876 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 15 }, - /* 877 */ { MAD_F(0x041952dc) /* 0.256182537 */, 15 }, - /* 878 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 15 }, - /* 879 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 15 }, - - /* 880 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 15 }, - /* 881 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 15 }, - /* 882 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 15 }, - /* 883 */ { MAD_F(0x0422e811) /* 0.258522097 */, 15 }, - /* 884 */ { MAD_F(0x04248179) /* 0.258912540 */, 15 }, - /* 885 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 15 }, - /* 886 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 15 }, - /* 887 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 15 }, - /* 888 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 15 }, - /* 889 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 15 }, - /* 890 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 15 }, - /* 891 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 15 }, - /* 892 */ { MAD_F(0x0431524c) /* 0.262041376 */, 15 }, - /* 893 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 15 }, - /* 894 */ { MAD_F(0x0434880a) /* 0.262825051 */, 15 }, - /* 895 */ { MAD_F(0x04362324) /* 0.263217107 */, 15 }, - - /* 896 */ { MAD_F(0x0437be65) /* 0.263609310 */, 15 }, - /* 897 */ { MAD_F(0x043959cd) /* 0.264001659 */, 15 }, - /* 898 */ { MAD_F(0x043af55d) /* 0.264394153 */, 15 }, - /* 899 */ { MAD_F(0x043c9113) /* 0.264786794 */, 15 }, - /* 900 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 15 }, - /* 901 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 15 }, - /* 902 */ { MAD_F(0x04416522) /* 0.265965588 */, 15 }, - /* 903 */ { MAD_F(0x04430174) /* 0.266358810 */, 15 }, - /* 904 */ { MAD_F(0x04449dee) /* 0.266752177 */, 15 }, - /* 905 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 15 }, - /* 906 */ { MAD_F(0x0447d756) /* 0.267539347 */, 15 }, - /* 907 */ { MAD_F(0x04497445) /* 0.267933149 */, 15 }, - /* 908 */ { MAD_F(0x044b115a) /* 0.268327096 */, 15 }, - /* 909 */ { MAD_F(0x044cae96) /* 0.268721187 */, 15 }, - /* 910 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 15 }, - /* 911 */ { MAD_F(0x044fe983) /* 0.269509804 */, 15 }, - - /* 912 */ { MAD_F(0x04518733) /* 0.269904329 */, 15 }, - /* 913 */ { MAD_F(0x0453250a) /* 0.270298998 */, 15 }, - /* 914 */ { MAD_F(0x0454c308) /* 0.270693811 */, 15 }, - /* 915 */ { MAD_F(0x0456612d) /* 0.271088768 */, 15 }, - /* 916 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 15 }, - /* 917 */ { MAD_F(0x04599dea) /* 0.271879114 */, 15 }, - /* 918 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 15 }, - /* 919 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 15 }, - /* 920 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 15 }, - /* 921 */ { MAD_F(0x04601932) /* 0.273461530 */, 15 }, - /* 922 */ { MAD_F(0x0461b864) /* 0.273857492 */, 15 }, - /* 923 */ { MAD_F(0x046357bd) /* 0.274253597 */, 15 }, - /* 924 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 15 }, - /* 925 */ { MAD_F(0x046696e2) /* 0.275046238 */, 15 }, - /* 926 */ { MAD_F(0x046836ae) /* 0.275442772 */, 15 }, - /* 927 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 15 }, - - /* 928 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 15 }, - /* 929 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 15 }, - /* 930 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 15 }, - /* 931 */ { MAD_F(0x047057e8) /* 0.277427584 */, 15 }, - /* 932 */ { MAD_F(0x0471f899) /* 0.277824973 */, 15 }, - /* 933 */ { MAD_F(0x04739971) /* 0.278222505 */, 15 }, - /* 934 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 15 }, - /* 935 */ { MAD_F(0x0476db92) /* 0.279017995 */, 15 }, - /* 936 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 15 }, - /* 937 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 15 }, - /* 938 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 15 }, - /* 939 */ { MAD_F(0x047d619e) /* 0.280610675 */, 15 }, - /* 940 */ { MAD_F(0x047f0380) /* 0.281009199 */, 15 }, - /* 941 */ { MAD_F(0x0480a588) /* 0.281407864 */, 15 }, - /* 942 */ { MAD_F(0x048247b6) /* 0.281806670 */, 15 }, - /* 943 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 15 }, - - /* 944 */ { MAD_F(0x04858c83) /* 0.282604707 */, 15 }, - /* 945 */ { MAD_F(0x04872f22) /* 0.283003936 */, 15 }, - /* 946 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 15 }, - /* 947 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 15 }, - /* 948 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 15 }, - /* 949 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 15 }, - /* 950 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 15 }, - /* 951 */ { MAD_F(0x049101f8) /* 0.285402269 */, 15 }, - /* 952 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 15 }, - /* 953 */ { MAD_F(0x0494496c) /* 0.286202836 */, 15 }, - /* 954 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 15 }, - /* 955 */ { MAD_F(0x04979177) /* 0.287003963 */, 15 }, - /* 956 */ { MAD_F(0x049935b5) /* 0.287404737 */, 15 }, - /* 957 */ { MAD_F(0x049ada19) /* 0.287805650 */, 15 }, - /* 958 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 15 }, - /* 959 */ { MAD_F(0x049e2350) /* 0.288607895 */, 15 }, - - /* 960 */ { MAD_F(0x049fc824) /* 0.289009227 */, 15 }, - /* 961 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 15 }, - /* 962 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 15 }, - /* 963 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 15 }, - /* 964 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 15 }, - /* 965 */ { MAD_F(0x04a80277) /* 0.291017976 */, 15 }, - /* 966 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 15 }, - /* 967 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 15 }, - /* 968 */ { MAD_F(0x04acf402) /* 0.292224893 */, 15 }, - /* 969 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 15 }, - /* 970 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 15 }, - /* 971 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 15 }, - /* 972 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 15 }, - /* 973 */ { MAD_F(0x04b53427) /* 0.294239192 */, 15 }, - /* 974 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 15 }, - /* 975 */ { MAD_F(0x04b88207) /* 0.295045879 */, 15 }, - - /* 976 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 15 }, - /* 977 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 15 }, - /* 978 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 15 }, - /* 979 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 15 }, - /* 980 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 15 }, - /* 981 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 15 }, - /* 982 */ { MAD_F(0x04c41722) /* 0.297873624 */, 15 }, - /* 983 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 15 }, - /* 984 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 15 }, - /* 985 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 15 }, - /* 986 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 15 }, - /* 987 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 15 }, - /* 988 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 15 }, - /* 989 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 15 }, - /* 990 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 15 }, - /* 991 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 15 }, - - /* 992 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 15 }, - /* 993 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 15 }, - /* 994 */ { MAD_F(0x04d80290) /* 0.302736820 */, 15 }, - /* 995 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 15 }, - /* 996 */ { MAD_F(0x04db5679) /* 0.303549263 */, 15 }, - /* 997 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 15 }, - /* 998 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 15 }, - /* 999 */ { MAD_F(0x04e05567) /* 0.304768948 */, 15 }, - /* 1000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 15 }, - /* 1001 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 15 }, - /* 1002 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 15 }, - /* 1003 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 15 }, - /* 1004 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 15 }, - /* 1005 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 15 }, - /* 1006 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 15 }, - /* 1007 */ { MAD_F(0x04edae25) /* 0.308027406 */, 15 }, - - /* 1008 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 15 }, - /* 1009 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 15 }, - /* 1010 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 15 }, - /* 1011 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 15 }, - /* 1012 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 15 }, - /* 1013 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 15 }, - /* 1014 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 15 }, - /* 1015 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 15 }, - /* 1016 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 15 }, - /* 1017 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 15 }, - /* 1018 */ { MAD_F(0x050016f3) /* 0.312521885 */, 15 }, - /* 1019 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 15 }, - /* 1020 */ { MAD_F(0x050371a7) /* 0.313340809 */, 15 }, - /* 1021 */ { MAD_F(0x05051f37) /* 0.313750472 */, 15 }, - /* 1022 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 15 }, - /* 1023 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 15 }, - - /* 1024 */ { MAD_F(0x050a28be) /* 0.314980262 */, 15 }, - /* 1025 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 15 }, - /* 1026 */ { MAD_F(0x050d8521) /* 0.315800790 */, 15 }, - /* 1027 */ { MAD_F(0x050f3388) /* 0.316211255 */, 15 }, - /* 1028 */ { MAD_F(0x0510e213) /* 0.316621852 */, 15 }, - /* 1029 */ { MAD_F(0x051290c2) /* 0.317032582 */, 15 }, - /* 1030 */ { MAD_F(0x05143f94) /* 0.317443446 */, 15 }, - /* 1031 */ { MAD_F(0x0515ee8a) /* 0.317854442 */, 15 }, - /* 1032 */ { MAD_F(0x05179da4) /* 0.318265572 */, 15 }, - /* 1033 */ { MAD_F(0x05194ce1) /* 0.318676834 */, 15 }, - /* 1034 */ { MAD_F(0x051afc42) /* 0.319088229 */, 15 }, - /* 1035 */ { MAD_F(0x051cabc7) /* 0.319499756 */, 15 }, - /* 1036 */ { MAD_F(0x051e5b6f) /* 0.319911417 */, 15 }, - /* 1037 */ { MAD_F(0x05200b3a) /* 0.320323209 */, 15 }, - /* 1038 */ { MAD_F(0x0521bb2a) /* 0.320735134 */, 15 }, - /* 1039 */ { MAD_F(0x05236b3d) /* 0.321147192 */, 15 }, - - /* 1040 */ { MAD_F(0x05251b73) /* 0.321559381 */, 15 }, - /* 1041 */ { MAD_F(0x0526cbcd) /* 0.321971703 */, 15 }, - /* 1042 */ { MAD_F(0x05287c4a) /* 0.322384156 */, 15 }, - /* 1043 */ { MAD_F(0x052a2cea) /* 0.322796742 */, 15 }, - /* 1044 */ { MAD_F(0x052bddae) /* 0.323209460 */, 15 }, - /* 1045 */ { MAD_F(0x052d8e96) /* 0.323622309 */, 15 }, - /* 1046 */ { MAD_F(0x052f3fa1) /* 0.324035290 */, 15 }, - /* 1047 */ { MAD_F(0x0530f0cf) /* 0.324448403 */, 15 }, - /* 1048 */ { MAD_F(0x0532a220) /* 0.324861647 */, 15 }, - /* 1049 */ { MAD_F(0x05345395) /* 0.325275023 */, 15 }, - /* 1050 */ { MAD_F(0x0536052d) /* 0.325688530 */, 15 }, - /* 1051 */ { MAD_F(0x0537b6e8) /* 0.326102168 */, 15 }, - /* 1052 */ { MAD_F(0x053968c6) /* 0.326515938 */, 15 }, - /* 1053 */ { MAD_F(0x053b1ac8) /* 0.326929839 */, 15 }, - /* 1054 */ { MAD_F(0x053ccced) /* 0.327343870 */, 15 }, - /* 1055 */ { MAD_F(0x053e7f35) /* 0.327758033 */, 15 }, - - /* 1056 */ { MAD_F(0x054031a0) /* 0.328172327 */, 15 }, - /* 1057 */ { MAD_F(0x0541e42e) /* 0.328586751 */, 15 }, - /* 1058 */ { MAD_F(0x054396df) /* 0.329001306 */, 15 }, - /* 1059 */ { MAD_F(0x054549b4) /* 0.329415992 */, 15 }, - /* 1060 */ { MAD_F(0x0546fcab) /* 0.329830808 */, 15 }, - /* 1061 */ { MAD_F(0x0548afc6) /* 0.330245755 */, 15 }, - /* 1062 */ { MAD_F(0x054a6303) /* 0.330660832 */, 15 }, - /* 1063 */ { MAD_F(0x054c1663) /* 0.331076039 */, 15 }, - /* 1064 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 15 }, - /* 1065 */ { MAD_F(0x054f7d8d) /* 0.331906845 */, 15 }, - /* 1066 */ { MAD_F(0x05513156) /* 0.332322443 */, 15 }, - /* 1067 */ { MAD_F(0x0552e542) /* 0.332738170 */, 15 }, - /* 1068 */ { MAD_F(0x05549951) /* 0.333154028 */, 15 }, - /* 1069 */ { MAD_F(0x05564d83) /* 0.333570016 */, 15 }, - /* 1070 */ { MAD_F(0x055801d8) /* 0.333986133 */, 15 }, - /* 1071 */ { MAD_F(0x0559b64f) /* 0.334402380 */, 15 }, - - /* 1072 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 15 }, - /* 1073 */ { MAD_F(0x055d1fa6) /* 0.335235262 */, 15 }, - /* 1074 */ { MAD_F(0x055ed486) /* 0.335651898 */, 15 }, - /* 1075 */ { MAD_F(0x05608988) /* 0.336068662 */, 15 }, - /* 1076 */ { MAD_F(0x05623ead) /* 0.336485556 */, 15 }, - /* 1077 */ { MAD_F(0x0563f3f5) /* 0.336902579 */, 15 }, - /* 1078 */ { MAD_F(0x0565a960) /* 0.337319732 */, 15 }, - /* 1079 */ { MAD_F(0x05675eed) /* 0.337737013 */, 15 }, - /* 1080 */ { MAD_F(0x0569149c) /* 0.338154423 */, 15 }, - /* 1081 */ { MAD_F(0x056aca6f) /* 0.338571962 */, 15 }, - /* 1082 */ { MAD_F(0x056c8064) /* 0.338989630 */, 15 }, - /* 1083 */ { MAD_F(0x056e367b) /* 0.339407426 */, 15 }, - /* 1084 */ { MAD_F(0x056fecb5) /* 0.339825351 */, 15 }, - /* 1085 */ { MAD_F(0x0571a311) /* 0.340243405 */, 15 }, - /* 1086 */ { MAD_F(0x05735990) /* 0.340661587 */, 15 }, - /* 1087 */ { MAD_F(0x05751032) /* 0.341079898 */, 15 }, - - /* 1088 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 15 }, - /* 1089 */ { MAD_F(0x05787ddc) /* 0.341916903 */, 15 }, - /* 1090 */ { MAD_F(0x057a34e4) /* 0.342335598 */, 15 }, - /* 1091 */ { MAD_F(0x057bec0f) /* 0.342754421 */, 15 }, - /* 1092 */ { MAD_F(0x057da35d) /* 0.343173373 */, 15 }, - /* 1093 */ { MAD_F(0x057f5acc) /* 0.343592452 */, 15 }, - /* 1094 */ { MAD_F(0x0581125e) /* 0.344011659 */, 15 }, - /* 1095 */ { MAD_F(0x0582ca12) /* 0.344430993 */, 15 }, - /* 1096 */ { MAD_F(0x058481e9) /* 0.344850455 */, 15 }, - /* 1097 */ { MAD_F(0x058639e2) /* 0.345270045 */, 15 }, - /* 1098 */ { MAD_F(0x0587f1fd) /* 0.345689763 */, 15 }, - /* 1099 */ { MAD_F(0x0589aa3a) /* 0.346109608 */, 15 }, - /* 1100 */ { MAD_F(0x058b629a) /* 0.346529580 */, 15 }, - /* 1101 */ { MAD_F(0x058d1b1b) /* 0.346949679 */, 15 }, - /* 1102 */ { MAD_F(0x058ed3bf) /* 0.347369906 */, 15 }, - /* 1103 */ { MAD_F(0x05908c85) /* 0.347790260 */, 15 }, - - /* 1104 */ { MAD_F(0x0592456d) /* 0.348210741 */, 15 }, - /* 1105 */ { MAD_F(0x0593fe77) /* 0.348631348 */, 15 }, - /* 1106 */ { MAD_F(0x0595b7a3) /* 0.349052083 */, 15 }, - /* 1107 */ { MAD_F(0x059770f1) /* 0.349472945 */, 15 }, - /* 1108 */ { MAD_F(0x05992a61) /* 0.349893933 */, 15 }, - /* 1109 */ { MAD_F(0x059ae3f3) /* 0.350315048 */, 15 }, - /* 1110 */ { MAD_F(0x059c9da8) /* 0.350736290 */, 15 }, - /* 1111 */ { MAD_F(0x059e577e) /* 0.351157658 */, 15 }, - /* 1112 */ { MAD_F(0x05a01176) /* 0.351579152 */, 15 }, - /* 1113 */ { MAD_F(0x05a1cb90) /* 0.352000773 */, 15 }, - /* 1114 */ { MAD_F(0x05a385cc) /* 0.352422520 */, 15 }, - /* 1115 */ { MAD_F(0x05a5402a) /* 0.352844394 */, 15 }, - /* 1116 */ { MAD_F(0x05a6faa9) /* 0.353266393 */, 15 }, - /* 1117 */ { MAD_F(0x05a8b54b) /* 0.353688519 */, 15 }, - /* 1118 */ { MAD_F(0x05aa700e) /* 0.354110771 */, 15 }, - /* 1119 */ { MAD_F(0x05ac2af3) /* 0.354533148 */, 15 }, - - /* 1120 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 15 }, - /* 1121 */ { MAD_F(0x05afa123) /* 0.355378281 */, 15 }, - /* 1122 */ { MAD_F(0x05b15c6d) /* 0.355801035 */, 15 }, - /* 1123 */ { MAD_F(0x05b317d9) /* 0.356223916 */, 15 }, - /* 1124 */ { MAD_F(0x05b4d367) /* 0.356646922 */, 15 }, - /* 1125 */ { MAD_F(0x05b68f16) /* 0.357070053 */, 15 }, - /* 1126 */ { MAD_F(0x05b84ae7) /* 0.357493310 */, 15 }, - /* 1127 */ { MAD_F(0x05ba06da) /* 0.357916692 */, 15 }, - /* 1128 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 15 }, - /* 1129 */ { MAD_F(0x05bd7f25) /* 0.358763832 */, 15 }, - /* 1130 */ { MAD_F(0x05bf3b7c) /* 0.359187590 */, 15 }, - /* 1131 */ { MAD_F(0x05c0f7f5) /* 0.359611472 */, 15 }, - /* 1132 */ { MAD_F(0x05c2b490) /* 0.360035480 */, 15 }, - /* 1133 */ { MAD_F(0x05c4714c) /* 0.360459613 */, 15 }, - /* 1134 */ { MAD_F(0x05c62e2a) /* 0.360883870 */, 15 }, - /* 1135 */ { MAD_F(0x05c7eb29) /* 0.361308252 */, 15 }, - - /* 1136 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 15 }, - /* 1137 */ { MAD_F(0x05cb658c) /* 0.362157390 */, 15 }, - /* 1138 */ { MAD_F(0x05cd22ef) /* 0.362582145 */, 15 }, - /* 1139 */ { MAD_F(0x05cee074) /* 0.363007026 */, 15 }, - /* 1140 */ { MAD_F(0x05d09e1b) /* 0.363432030 */, 15 }, - /* 1141 */ { MAD_F(0x05d25be2) /* 0.363857159 */, 15 }, - /* 1142 */ { MAD_F(0x05d419cb) /* 0.364282412 */, 15 }, - /* 1143 */ { MAD_F(0x05d5d7d5) /* 0.364707789 */, 15 }, - /* 1144 */ { MAD_F(0x05d79601) /* 0.365133291 */, 15 }, - /* 1145 */ { MAD_F(0x05d9544e) /* 0.365558916 */, 15 }, - /* 1146 */ { MAD_F(0x05db12bc) /* 0.365984665 */, 15 }, - /* 1147 */ { MAD_F(0x05dcd14c) /* 0.366410538 */, 15 }, - /* 1148 */ { MAD_F(0x05de8ffc) /* 0.366836535 */, 15 }, - /* 1149 */ { MAD_F(0x05e04ece) /* 0.367262655 */, 15 }, - /* 1150 */ { MAD_F(0x05e20dc1) /* 0.367688900 */, 15 }, - /* 1151 */ { MAD_F(0x05e3ccd5) /* 0.368115267 */, 15 }, - - /* 1152 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 15 }, - /* 1153 */ { MAD_F(0x05e74b61) /* 0.368968373 */, 15 }, - /* 1154 */ { MAD_F(0x05e90ad9) /* 0.369395111 */, 15 }, - /* 1155 */ { MAD_F(0x05eaca72) /* 0.369821973 */, 15 }, - /* 1156 */ { MAD_F(0x05ec8a2b) /* 0.370248957 */, 15 }, - /* 1157 */ { MAD_F(0x05ee4a06) /* 0.370676065 */, 15 }, - /* 1158 */ { MAD_F(0x05f00a02) /* 0.371103295 */, 15 }, - /* 1159 */ { MAD_F(0x05f1ca1f) /* 0.371530649 */, 15 }, - /* 1160 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 15 }, - /* 1161 */ { MAD_F(0x05f54abc) /* 0.372385725 */, 15 }, - /* 1162 */ { MAD_F(0x05f70b3c) /* 0.372813448 */, 15 }, - /* 1163 */ { MAD_F(0x05f8cbdc) /* 0.373241292 */, 15 }, - /* 1164 */ { MAD_F(0x05fa8c9e) /* 0.373669260 */, 15 }, - /* 1165 */ { MAD_F(0x05fc4d81) /* 0.374097350 */, 15 }, - /* 1166 */ { MAD_F(0x05fe0e84) /* 0.374525563 */, 15 }, - /* 1167 */ { MAD_F(0x05ffcfa8) /* 0.374953898 */, 15 }, - - /* 1168 */ { MAD_F(0x060190ee) /* 0.375382356 */, 15 }, - /* 1169 */ { MAD_F(0x06035254) /* 0.375810936 */, 15 }, - /* 1170 */ { MAD_F(0x060513da) /* 0.376239638 */, 15 }, - /* 1171 */ { MAD_F(0x0606d582) /* 0.376668462 */, 15 }, - /* 1172 */ { MAD_F(0x0608974a) /* 0.377097408 */, 15 }, - /* 1173 */ { MAD_F(0x060a5934) /* 0.377526476 */, 15 }, - /* 1174 */ { MAD_F(0x060c1b3d) /* 0.377955667 */, 15 }, - /* 1175 */ { MAD_F(0x060ddd68) /* 0.378384979 */, 15 }, - /* 1176 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 15 }, - /* 1177 */ { MAD_F(0x0611621f) /* 0.379243968 */, 15 }, - /* 1178 */ { MAD_F(0x061324ac) /* 0.379673646 */, 15 }, - /* 1179 */ { MAD_F(0x0614e759) /* 0.380103444 */, 15 }, - /* 1180 */ { MAD_F(0x0616aa27) /* 0.380533365 */, 15 }, - /* 1181 */ { MAD_F(0x06186d16) /* 0.380963407 */, 15 }, - /* 1182 */ { MAD_F(0x061a3025) /* 0.381393570 */, 15 }, - /* 1183 */ { MAD_F(0x061bf354) /* 0.381823855 */, 15 }, - - /* 1184 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 15 }, - /* 1185 */ { MAD_F(0x061f7a15) /* 0.382684788 */, 15 }, - /* 1186 */ { MAD_F(0x06213da7) /* 0.383115436 */, 15 }, - /* 1187 */ { MAD_F(0x06230158) /* 0.383546205 */, 15 }, - /* 1188 */ { MAD_F(0x0624c52a) /* 0.383977096 */, 15 }, - /* 1189 */ { MAD_F(0x0626891d) /* 0.384408107 */, 15 }, - /* 1190 */ { MAD_F(0x06284d30) /* 0.384839239 */, 15 }, - /* 1191 */ { MAD_F(0x062a1164) /* 0.385270492 */, 15 }, - /* 1192 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 15 }, - /* 1193 */ { MAD_F(0x062d9a2c) /* 0.386133359 */, 15 }, - /* 1194 */ { MAD_F(0x062f5ec1) /* 0.386564974 */, 15 }, - /* 1195 */ { MAD_F(0x06312376) /* 0.386996709 */, 15 }, - /* 1196 */ { MAD_F(0x0632e84b) /* 0.387428565 */, 15 }, - /* 1197 */ { MAD_F(0x0634ad41) /* 0.387860541 */, 15 }, - /* 1198 */ { MAD_F(0x06367257) /* 0.388292637 */, 15 }, - /* 1199 */ { MAD_F(0x0638378d) /* 0.388724854 */, 15 }, - - /* 1200 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 15 }, - /* 1201 */ { MAD_F(0x063bc25b) /* 0.389589648 */, 15 }, - /* 1202 */ { MAD_F(0x063d87f2) /* 0.390022225 */, 15 }, - /* 1203 */ { MAD_F(0x063f4da9) /* 0.390454922 */, 15 }, - /* 1204 */ { MAD_F(0x06411380) /* 0.390887739 */, 15 }, - /* 1205 */ { MAD_F(0x0642d978) /* 0.391320675 */, 15 }, - /* 1206 */ { MAD_F(0x06449f8f) /* 0.391753732 */, 15 }, - /* 1207 */ { MAD_F(0x064665c7) /* 0.392186908 */, 15 }, - /* 1208 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 15 }, - /* 1209 */ { MAD_F(0x0649f297) /* 0.393053619 */, 15 }, - /* 1210 */ { MAD_F(0x064bb92f) /* 0.393487154 */, 15 }, - /* 1211 */ { MAD_F(0x064d7fe8) /* 0.393920808 */, 15 }, - /* 1212 */ { MAD_F(0x064f46c0) /* 0.394354582 */, 15 }, - /* 1213 */ { MAD_F(0x06510db8) /* 0.394788475 */, 15 }, - /* 1214 */ { MAD_F(0x0652d4d0) /* 0.395222488 */, 15 }, - /* 1215 */ { MAD_F(0x06549c09) /* 0.395656619 */, 15 }, - - /* 1216 */ { MAD_F(0x06566361) /* 0.396090870 */, 15 }, - /* 1217 */ { MAD_F(0x06582ad9) /* 0.396525239 */, 15 }, - /* 1218 */ { MAD_F(0x0659f271) /* 0.396959728 */, 15 }, - /* 1219 */ { MAD_F(0x065bba29) /* 0.397394336 */, 15 }, - /* 1220 */ { MAD_F(0x065d8201) /* 0.397829062 */, 15 }, - /* 1221 */ { MAD_F(0x065f49f9) /* 0.398263907 */, 15 }, - /* 1222 */ { MAD_F(0x06611211) /* 0.398698871 */, 15 }, - /* 1223 */ { MAD_F(0x0662da49) /* 0.399133954 */, 15 }, - /* 1224 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 15 }, - /* 1225 */ { MAD_F(0x06666b17) /* 0.400004475 */, 15 }, - /* 1226 */ { MAD_F(0x066833ae) /* 0.400439913 */, 15 }, - /* 1227 */ { MAD_F(0x0669fc65) /* 0.400875470 */, 15 }, - /* 1228 */ { MAD_F(0x066bc53c) /* 0.401311145 */, 15 }, - /* 1229 */ { MAD_F(0x066d8e32) /* 0.401746938 */, 15 }, - /* 1230 */ { MAD_F(0x066f5748) /* 0.402182850 */, 15 }, - /* 1231 */ { MAD_F(0x0671207e) /* 0.402618879 */, 15 }, - - /* 1232 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 15 }, - /* 1233 */ { MAD_F(0x0674b349) /* 0.403491293 */, 15 }, - /* 1234 */ { MAD_F(0x06767cde) /* 0.403927676 */, 15 }, - /* 1235 */ { MAD_F(0x06784692) /* 0.404364178 */, 15 }, - /* 1236 */ { MAD_F(0x067a1066) /* 0.404800797 */, 15 }, - /* 1237 */ { MAD_F(0x067bda5a) /* 0.405237535 */, 15 }, - /* 1238 */ { MAD_F(0x067da46d) /* 0.405674390 */, 15 }, - /* 1239 */ { MAD_F(0x067f6ea0) /* 0.406111362 */, 15 }, - /* 1240 */ { MAD_F(0x068138f3) /* 0.406548452 */, 15 }, - /* 1241 */ { MAD_F(0x06830365) /* 0.406985660 */, 15 }, - /* 1242 */ { MAD_F(0x0684cdf6) /* 0.407422985 */, 15 }, - /* 1243 */ { MAD_F(0x068698a8) /* 0.407860427 */, 15 }, - /* 1244 */ { MAD_F(0x06886378) /* 0.408297987 */, 15 }, - /* 1245 */ { MAD_F(0x068a2e68) /* 0.408735664 */, 15 }, - /* 1246 */ { MAD_F(0x068bf978) /* 0.409173458 */, 15 }, - /* 1247 */ { MAD_F(0x068dc4a7) /* 0.409611370 */, 15 }, - - /* 1248 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 15 }, - /* 1249 */ { MAD_F(0x06915b63) /* 0.410487544 */, 15 }, - /* 1250 */ { MAD_F(0x069326f0) /* 0.410925806 */, 15 }, - /* 1251 */ { MAD_F(0x0694f29c) /* 0.411364185 */, 15 }, - /* 1252 */ { MAD_F(0x0696be68) /* 0.411802681 */, 15 }, - /* 1253 */ { MAD_F(0x06988a54) /* 0.412241294 */, 15 }, - /* 1254 */ { MAD_F(0x069a565e) /* 0.412680024 */, 15 }, - /* 1255 */ { MAD_F(0x069c2288) /* 0.413118870 */, 15 }, - /* 1256 */ { MAD_F(0x069deed1) /* 0.413557833 */, 15 }, - /* 1257 */ { MAD_F(0x069fbb3a) /* 0.413996912 */, 15 }, - /* 1258 */ { MAD_F(0x06a187c1) /* 0.414436108 */, 15 }, - /* 1259 */ { MAD_F(0x06a35468) /* 0.414875420 */, 15 }, - /* 1260 */ { MAD_F(0x06a5212f) /* 0.415314849 */, 15 }, - /* 1261 */ { MAD_F(0x06a6ee14) /* 0.415754393 */, 15 }, - /* 1262 */ { MAD_F(0x06a8bb18) /* 0.416194054 */, 15 }, - /* 1263 */ { MAD_F(0x06aa883c) /* 0.416633831 */, 15 }, - - /* 1264 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 15 }, - /* 1265 */ { MAD_F(0x06ae22e1) /* 0.417513734 */, 15 }, - /* 1266 */ { MAD_F(0x06aff062) /* 0.417953859 */, 15 }, - /* 1267 */ { MAD_F(0x06b1be03) /* 0.418394100 */, 15 }, - /* 1268 */ { MAD_F(0x06b38bc2) /* 0.418834457 */, 15 }, - /* 1269 */ { MAD_F(0x06b559a1) /* 0.419274929 */, 15 }, - /* 1270 */ { MAD_F(0x06b7279e) /* 0.419715518 */, 15 }, - /* 1271 */ { MAD_F(0x06b8f5bb) /* 0.420156222 */, 15 }, - /* 1272 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 15 }, - /* 1273 */ { MAD_F(0x06bc9251) /* 0.421037977 */, 15 }, - /* 1274 */ { MAD_F(0x06be60cb) /* 0.421479027 */, 15 }, - /* 1275 */ { MAD_F(0x06c02f63) /* 0.421920193 */, 15 }, - /* 1276 */ { MAD_F(0x06c1fe1b) /* 0.422361475 */, 15 }, - /* 1277 */ { MAD_F(0x06c3ccf1) /* 0.422802871 */, 15 }, - /* 1278 */ { MAD_F(0x06c59be7) /* 0.423244383 */, 15 }, - /* 1279 */ { MAD_F(0x06c76afb) /* 0.423686010 */, 15 }, - - /* 1280 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 15 }, - /* 1281 */ { MAD_F(0x06cb0981) /* 0.424569610 */, 15 }, - /* 1282 */ { MAD_F(0x06ccd8f2) /* 0.425011582 */, 15 }, - /* 1283 */ { MAD_F(0x06cea881) /* 0.425453669 */, 15 }, - /* 1284 */ { MAD_F(0x06d07830) /* 0.425895871 */, 15 }, - /* 1285 */ { MAD_F(0x06d247fe) /* 0.426338188 */, 15 }, - /* 1286 */ { MAD_F(0x06d417ea) /* 0.426780620 */, 15 }, - /* 1287 */ { MAD_F(0x06d5e7f5) /* 0.427223166 */, 15 }, - /* 1288 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 15 }, - /* 1289 */ { MAD_F(0x06d98868) /* 0.428108603 */, 15 }, - /* 1290 */ { MAD_F(0x06db58cf) /* 0.428551493 */, 15 }, - /* 1291 */ { MAD_F(0x06dd2955) /* 0.428994497 */, 15 }, - /* 1292 */ { MAD_F(0x06def9fa) /* 0.429437616 */, 15 }, - /* 1293 */ { MAD_F(0x06e0cabe) /* 0.429880849 */, 15 }, - /* 1294 */ { MAD_F(0x06e29ba0) /* 0.430324197 */, 15 }, - /* 1295 */ { MAD_F(0x06e46ca1) /* 0.430767659 */, 15 }, - - /* 1296 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 15 }, - /* 1297 */ { MAD_F(0x06e80efe) /* 0.431654924 */, 15 }, - /* 1298 */ { MAD_F(0x06e9e05b) /* 0.432098728 */, 15 }, - /* 1299 */ { MAD_F(0x06ebb1d6) /* 0.432542647 */, 15 }, - /* 1300 */ { MAD_F(0x06ed8370) /* 0.432986678 */, 15 }, - /* 1301 */ { MAD_F(0x06ef5529) /* 0.433430824 */, 15 }, - /* 1302 */ { MAD_F(0x06f12700) /* 0.433875084 */, 15 }, - /* 1303 */ { MAD_F(0x06f2f8f5) /* 0.434319457 */, 15 }, - /* 1304 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 15 }, - /* 1305 */ { MAD_F(0x06f69d3c) /* 0.435208545 */, 15 }, - /* 1306 */ { MAD_F(0x06f86f8d) /* 0.435653259 */, 15 }, - /* 1307 */ { MAD_F(0x06fa41fd) /* 0.436098087 */, 15 }, - /* 1308 */ { MAD_F(0x06fc148b) /* 0.436543029 */, 15 }, - /* 1309 */ { MAD_F(0x06fde737) /* 0.436988083 */, 15 }, - /* 1310 */ { MAD_F(0x06ffba02) /* 0.437433251 */, 15 }, - /* 1311 */ { MAD_F(0x07018ceb) /* 0.437878533 */, 15 }, - - /* 1312 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 15 }, - /* 1313 */ { MAD_F(0x07053319) /* 0.438769435 */, 15 }, - /* 1314 */ { MAD_F(0x0707065d) /* 0.439215056 */, 15 }, - /* 1315 */ { MAD_F(0x0708d9c0) /* 0.439660790 */, 15 }, - /* 1316 */ { MAD_F(0x070aad41) /* 0.440106636 */, 15 }, - /* 1317 */ { MAD_F(0x070c80e1) /* 0.440552596 */, 15 }, - /* 1318 */ { MAD_F(0x070e549f) /* 0.440998669 */, 15 }, - /* 1319 */ { MAD_F(0x0710287b) /* 0.441444855 */, 15 }, - /* 1320 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 15 }, - /* 1321 */ { MAD_F(0x0713d08d) /* 0.442337564 */, 15 }, - /* 1322 */ { MAD_F(0x0715a4c4) /* 0.442784088 */, 15 }, - /* 1323 */ { MAD_F(0x07177919) /* 0.443230724 */, 15 }, - /* 1324 */ { MAD_F(0x07194d8c) /* 0.443677473 */, 15 }, - /* 1325 */ { MAD_F(0x071b221e) /* 0.444124334 */, 15 }, - /* 1326 */ { MAD_F(0x071cf6ce) /* 0.444571308 */, 15 }, - /* 1327 */ { MAD_F(0x071ecb9b) /* 0.445018394 */, 15 }, - - /* 1328 */ { MAD_F(0x0720a087) /* 0.445465593 */, 15 }, - /* 1329 */ { MAD_F(0x07227591) /* 0.445912903 */, 15 }, - /* 1330 */ { MAD_F(0x07244ab9) /* 0.446360326 */, 15 }, - /* 1331 */ { MAD_F(0x07262000) /* 0.446807861 */, 15 }, - /* 1332 */ { MAD_F(0x0727f564) /* 0.447255509 */, 15 }, - /* 1333 */ { MAD_F(0x0729cae7) /* 0.447703268 */, 15 }, - /* 1334 */ { MAD_F(0x072ba087) /* 0.448151139 */, 15 }, - /* 1335 */ { MAD_F(0x072d7646) /* 0.448599122 */, 15 }, - /* 1336 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 15 }, - /* 1337 */ { MAD_F(0x0731221d) /* 0.449495424 */, 15 }, - /* 1338 */ { MAD_F(0x0732f835) /* 0.449943742 */, 15 }, - /* 1339 */ { MAD_F(0x0734ce6c) /* 0.450392173 */, 15 }, - /* 1340 */ { MAD_F(0x0736a4c1) /* 0.450840715 */, 15 }, - /* 1341 */ { MAD_F(0x07387b33) /* 0.451289368 */, 15 }, - /* 1342 */ { MAD_F(0x073a51c4) /* 0.451738133 */, 15 }, - /* 1343 */ { MAD_F(0x073c2872) /* 0.452187010 */, 15 }, - - /* 1344 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 15 }, - /* 1345 */ { MAD_F(0x073fd628) /* 0.453085097 */, 15 }, - /* 1346 */ { MAD_F(0x0741ad30) /* 0.453534308 */, 15 }, - /* 1347 */ { MAD_F(0x07438456) /* 0.453983630 */, 15 }, - /* 1348 */ { MAD_F(0x07455b9a) /* 0.454433063 */, 15 }, - /* 1349 */ { MAD_F(0x074732fc) /* 0.454882607 */, 15 }, - /* 1350 */ { MAD_F(0x07490a7b) /* 0.455332262 */, 15 }, - /* 1351 */ { MAD_F(0x074ae218) /* 0.455782029 */, 15 }, - /* 1352 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 15 }, - /* 1353 */ { MAD_F(0x074e91ac) /* 0.456681894 */, 15 }, - /* 1354 */ { MAD_F(0x075069a3) /* 0.457131993 */, 15 }, - /* 1355 */ { MAD_F(0x075241b7) /* 0.457582203 */, 15 }, - /* 1356 */ { MAD_F(0x075419e9) /* 0.458032524 */, 15 }, - /* 1357 */ { MAD_F(0x0755f239) /* 0.458482956 */, 15 }, - /* 1358 */ { MAD_F(0x0757caa7) /* 0.458933498 */, 15 }, - /* 1359 */ { MAD_F(0x0759a332) /* 0.459384151 */, 15 }, - - /* 1360 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 15 }, - /* 1361 */ { MAD_F(0x075d54a1) /* 0.460285788 */, 15 }, - /* 1362 */ { MAD_F(0x075f2d85) /* 0.460736772 */, 15 }, - /* 1363 */ { MAD_F(0x07610687) /* 0.461187867 */, 15 }, - /* 1364 */ { MAD_F(0x0762dfa6) /* 0.461639071 */, 15 }, - /* 1365 */ { MAD_F(0x0764b8e3) /* 0.462090387 */, 15 }, - /* 1366 */ { MAD_F(0x0766923e) /* 0.462541812 */, 15 }, - /* 1367 */ { MAD_F(0x07686bb6) /* 0.462993348 */, 15 }, - /* 1368 */ { MAD_F(0x076a454c) /* 0.463444993 */, 15 }, - /* 1369 */ { MAD_F(0x076c1eff) /* 0.463896749 */, 15 }, - /* 1370 */ { MAD_F(0x076df8d0) /* 0.464348615 */, 15 }, - /* 1371 */ { MAD_F(0x076fd2be) /* 0.464800591 */, 15 }, - /* 1372 */ { MAD_F(0x0771acca) /* 0.465252676 */, 15 }, - /* 1373 */ { MAD_F(0x077386f3) /* 0.465704872 */, 15 }, - /* 1374 */ { MAD_F(0x0775613a) /* 0.466157177 */, 15 }, - /* 1375 */ { MAD_F(0x07773b9e) /* 0.466609592 */, 15 }, - - /* 1376 */ { MAD_F(0x07791620) /* 0.467062117 */, 15 }, - /* 1377 */ { MAD_F(0x077af0bf) /* 0.467514751 */, 15 }, - /* 1378 */ { MAD_F(0x077ccb7c) /* 0.467967495 */, 15 }, - /* 1379 */ { MAD_F(0x077ea656) /* 0.468420349 */, 15 }, - /* 1380 */ { MAD_F(0x0780814d) /* 0.468873312 */, 15 }, - /* 1381 */ { MAD_F(0x07825c62) /* 0.469326384 */, 15 }, - /* 1382 */ { MAD_F(0x07843794) /* 0.469779566 */, 15 }, - /* 1383 */ { MAD_F(0x078612e3) /* 0.470232857 */, 15 }, - /* 1384 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 15 }, - /* 1385 */ { MAD_F(0x0789c9da) /* 0.471139767 */, 15 }, - /* 1386 */ { MAD_F(0x078ba581) /* 0.471593386 */, 15 }, - /* 1387 */ { MAD_F(0x078d8146) /* 0.472047114 */, 15 }, - /* 1388 */ { MAD_F(0x078f5d28) /* 0.472500951 */, 15 }, - /* 1389 */ { MAD_F(0x07913927) /* 0.472954896 */, 15 }, - /* 1390 */ { MAD_F(0x07931543) /* 0.473408951 */, 15 }, - /* 1391 */ { MAD_F(0x0794f17d) /* 0.473863115 */, 15 }, - - /* 1392 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 15 }, - /* 1393 */ { MAD_F(0x0798aa48) /* 0.474771769 */, 15 }, - /* 1394 */ { MAD_F(0x079a86d9) /* 0.475226259 */, 15 }, - /* 1395 */ { MAD_F(0x079c6388) /* 0.475680858 */, 15 }, - /* 1396 */ { MAD_F(0x079e4053) /* 0.476135565 */, 15 }, - /* 1397 */ { MAD_F(0x07a01d3c) /* 0.476590381 */, 15 }, - /* 1398 */ { MAD_F(0x07a1fa42) /* 0.477045306 */, 15 }, - /* 1399 */ { MAD_F(0x07a3d765) /* 0.477500339 */, 15 }, - /* 1400 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 15 }, - /* 1401 */ { MAD_F(0x07a79202) /* 0.478410731 */, 15 }, - /* 1402 */ { MAD_F(0x07a96f7d) /* 0.478866089 */, 15 }, - /* 1403 */ { MAD_F(0x07ab4d14) /* 0.479321555 */, 15 }, - /* 1404 */ { MAD_F(0x07ad2ac8) /* 0.479777130 */, 15 }, - /* 1405 */ { MAD_F(0x07af089a) /* 0.480232813 */, 15 }, - /* 1406 */ { MAD_F(0x07b0e688) /* 0.480688604 */, 15 }, - /* 1407 */ { MAD_F(0x07b2c494) /* 0.481144503 */, 15 }, - - /* 1408 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 15 }, - /* 1409 */ { MAD_F(0x07b68102) /* 0.482056625 */, 15 }, - /* 1410 */ { MAD_F(0x07b85f64) /* 0.482512848 */, 15 }, - /* 1411 */ { MAD_F(0x07ba3de4) /* 0.482969179 */, 15 }, - /* 1412 */ { MAD_F(0x07bc1c80) /* 0.483425618 */, 15 }, - /* 1413 */ { MAD_F(0x07bdfb39) /* 0.483882164 */, 15 }, - /* 1414 */ { MAD_F(0x07bfda0f) /* 0.484338818 */, 15 }, - /* 1415 */ { MAD_F(0x07c1b902) /* 0.484795580 */, 15 }, - /* 1416 */ { MAD_F(0x07c39812) /* 0.485252449 */, 15 }, - /* 1417 */ { MAD_F(0x07c5773f) /* 0.485709426 */, 15 }, - /* 1418 */ { MAD_F(0x07c75689) /* 0.486166511 */, 15 }, - /* 1419 */ { MAD_F(0x07c935ef) /* 0.486623703 */, 15 }, - /* 1420 */ { MAD_F(0x07cb1573) /* 0.487081002 */, 15 }, - /* 1421 */ { MAD_F(0x07ccf513) /* 0.487538409 */, 15 }, - /* 1422 */ { MAD_F(0x07ced4d0) /* 0.487995923 */, 15 }, - /* 1423 */ { MAD_F(0x07d0b4aa) /* 0.488453544 */, 15 }, - - /* 1424 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 15 }, - /* 1425 */ { MAD_F(0x07d474b3) /* 0.489369108 */, 15 }, - /* 1426 */ { MAD_F(0x07d654e4) /* 0.489827051 */, 15 }, - /* 1427 */ { MAD_F(0x07d83530) /* 0.490285101 */, 15 }, - /* 1428 */ { MAD_F(0x07da159a) /* 0.490743258 */, 15 }, - /* 1429 */ { MAD_F(0x07dbf620) /* 0.491201522 */, 15 }, - /* 1430 */ { MAD_F(0x07ddd6c3) /* 0.491659892 */, 15 }, - /* 1431 */ { MAD_F(0x07dfb783) /* 0.492118370 */, 15 }, - /* 1432 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 15 }, - /* 1433 */ { MAD_F(0x07e37958) /* 0.493035645 */, 15 }, - /* 1434 */ { MAD_F(0x07e55a6e) /* 0.493494443 */, 15 }, - /* 1435 */ { MAD_F(0x07e73ba0) /* 0.493953348 */, 15 }, - /* 1436 */ { MAD_F(0x07e91cef) /* 0.494412359 */, 15 }, - /* 1437 */ { MAD_F(0x07eafe5a) /* 0.494871476 */, 15 }, - /* 1438 */ { MAD_F(0x07ecdfe2) /* 0.495330701 */, 15 }, - /* 1439 */ { MAD_F(0x07eec187) /* 0.495790031 */, 15 }, - - /* 1440 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 15 }, - /* 1441 */ { MAD_F(0x07f28526) /* 0.496709012 */, 15 }, - /* 1442 */ { MAD_F(0x07f46720) /* 0.497168662 */, 15 }, - /* 1443 */ { MAD_F(0x07f64937) /* 0.497628418 */, 15 }, - /* 1444 */ { MAD_F(0x07f82b6a) /* 0.498088280 */, 15 }, - /* 1445 */ { MAD_F(0x07fa0dba) /* 0.498548248 */, 15 }, - /* 1446 */ { MAD_F(0x07fbf026) /* 0.499008323 */, 15 }, - /* 1447 */ { MAD_F(0x07fdd2af) /* 0.499468503 */, 15 }, - /* 1448 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 15 }, - /* 1449 */ { MAD_F(0x0400cc0b) /* 0.250194591 */, 16 }, - /* 1450 */ { MAD_F(0x0401bd7a) /* 0.250424840 */, 16 }, - /* 1451 */ { MAD_F(0x0402aef7) /* 0.250655143 */, 16 }, - /* 1452 */ { MAD_F(0x0403a083) /* 0.250885498 */, 16 }, - /* 1453 */ { MAD_F(0x0404921c) /* 0.251115906 */, 16 }, - /* 1454 */ { MAD_F(0x040583c4) /* 0.251346367 */, 16 }, - /* 1455 */ { MAD_F(0x0406757a) /* 0.251576880 */, 16 }, - - /* 1456 */ { MAD_F(0x0407673f) /* 0.251807447 */, 16 }, - /* 1457 */ { MAD_F(0x04085911) /* 0.252038066 */, 16 }, - /* 1458 */ { MAD_F(0x04094af1) /* 0.252268738 */, 16 }, - /* 1459 */ { MAD_F(0x040a3ce0) /* 0.252499463 */, 16 }, - /* 1460 */ { MAD_F(0x040b2edd) /* 0.252730240 */, 16 }, - /* 1461 */ { MAD_F(0x040c20e8) /* 0.252961071 */, 16 }, - /* 1462 */ { MAD_F(0x040d1301) /* 0.253191953 */, 16 }, - /* 1463 */ { MAD_F(0x040e0529) /* 0.253422889 */, 16 }, - /* 1464 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 16 }, - /* 1465 */ { MAD_F(0x040fe9a1) /* 0.253884918 */, 16 }, - /* 1466 */ { MAD_F(0x0410dbf3) /* 0.254116011 */, 16 }, - /* 1467 */ { MAD_F(0x0411ce53) /* 0.254347157 */, 16 }, - /* 1468 */ { MAD_F(0x0412c0c1) /* 0.254578356 */, 16 }, - /* 1469 */ { MAD_F(0x0413b33d) /* 0.254809606 */, 16 }, - /* 1470 */ { MAD_F(0x0414a5c7) /* 0.255040910 */, 16 }, - /* 1471 */ { MAD_F(0x0415985f) /* 0.255272266 */, 16 }, - - /* 1472 */ { MAD_F(0x04168b05) /* 0.255503674 */, 16 }, - /* 1473 */ { MAD_F(0x04177db9) /* 0.255735135 */, 16 }, - /* 1474 */ { MAD_F(0x0418707c) /* 0.255966648 */, 16 }, - /* 1475 */ { MAD_F(0x0419634c) /* 0.256198213 */, 16 }, - /* 1476 */ { MAD_F(0x041a562a) /* 0.256429831 */, 16 }, - /* 1477 */ { MAD_F(0x041b4917) /* 0.256661501 */, 16 }, - /* 1478 */ { MAD_F(0x041c3c11) /* 0.256893223 */, 16 }, - /* 1479 */ { MAD_F(0x041d2f1a) /* 0.257124998 */, 16 }, - /* 1480 */ { MAD_F(0x041e2230) /* 0.257356825 */, 16 }, - /* 1481 */ { MAD_F(0x041f1555) /* 0.257588704 */, 16 }, - /* 1482 */ { MAD_F(0x04200888) /* 0.257820635 */, 16 }, - /* 1483 */ { MAD_F(0x0420fbc8) /* 0.258052619 */, 16 }, - /* 1484 */ { MAD_F(0x0421ef17) /* 0.258284654 */, 16 }, - /* 1485 */ { MAD_F(0x0422e273) /* 0.258516742 */, 16 }, - /* 1486 */ { MAD_F(0x0423d5de) /* 0.258748882 */, 16 }, - /* 1487 */ { MAD_F(0x0424c956) /* 0.258981074 */, 16 }, - - /* 1488 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 16 }, - /* 1489 */ { MAD_F(0x0426b071) /* 0.259445614 */, 16 }, - /* 1490 */ { MAD_F(0x0427a414) /* 0.259677962 */, 16 }, - /* 1491 */ { MAD_F(0x042897c4) /* 0.259910362 */, 16 }, - /* 1492 */ { MAD_F(0x04298b83) /* 0.260142814 */, 16 }, - /* 1493 */ { MAD_F(0x042a7f4f) /* 0.260375318 */, 16 }, - /* 1494 */ { MAD_F(0x042b7329) /* 0.260607874 */, 16 }, - /* 1495 */ { MAD_F(0x042c6711) /* 0.260840481 */, 16 }, - /* 1496 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 16 }, - /* 1497 */ { MAD_F(0x042e4f0b) /* 0.261305852 */, 16 }, - /* 1498 */ { MAD_F(0x042f431d) /* 0.261538616 */, 16 }, - /* 1499 */ { MAD_F(0x0430373d) /* 0.261771431 */, 16 }, - /* 1500 */ { MAD_F(0x04312b6b) /* 0.262004297 */, 16 }, - /* 1501 */ { MAD_F(0x04321fa6) /* 0.262237216 */, 16 }, - /* 1502 */ { MAD_F(0x043313f0) /* 0.262470186 */, 16 }, - /* 1503 */ { MAD_F(0x04340847) /* 0.262703208 */, 16 }, - - /* 1504 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 16 }, - /* 1505 */ { MAD_F(0x0435f120) /* 0.263169407 */, 16 }, - /* 1506 */ { MAD_F(0x0436e5a1) /* 0.263402584 */, 16 }, - /* 1507 */ { MAD_F(0x0437da2f) /* 0.263635813 */, 16 }, - /* 1508 */ { MAD_F(0x0438cecc) /* 0.263869093 */, 16 }, - /* 1509 */ { MAD_F(0x0439c377) /* 0.264102425 */, 16 }, - /* 1510 */ { MAD_F(0x043ab82f) /* 0.264335808 */, 16 }, - /* 1511 */ { MAD_F(0x043bacf5) /* 0.264569243 */, 16 }, - /* 1512 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 16 }, - /* 1513 */ { MAD_F(0x043d96ab) /* 0.265036267 */, 16 }, - /* 1514 */ { MAD_F(0x043e8b9b) /* 0.265269857 */, 16 }, - /* 1515 */ { MAD_F(0x043f8098) /* 0.265503498 */, 16 }, - /* 1516 */ { MAD_F(0x044075a3) /* 0.265737190 */, 16 }, - /* 1517 */ { MAD_F(0x04416abc) /* 0.265970933 */, 16 }, - /* 1518 */ { MAD_F(0x04425fe3) /* 0.266204728 */, 16 }, - /* 1519 */ { MAD_F(0x04435518) /* 0.266438574 */, 16 }, - - /* 1520 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 16 }, - /* 1521 */ { MAD_F(0x04453fab) /* 0.266906421 */, 16 }, - /* 1522 */ { MAD_F(0x04463508) /* 0.267140421 */, 16 }, - /* 1523 */ { MAD_F(0x04472a74) /* 0.267374472 */, 16 }, - /* 1524 */ { MAD_F(0x04481fee) /* 0.267608575 */, 16 }, - /* 1525 */ { MAD_F(0x04491575) /* 0.267842729 */, 16 }, - /* 1526 */ { MAD_F(0x044a0b0a) /* 0.268076934 */, 16 }, - /* 1527 */ { MAD_F(0x044b00ac) /* 0.268311190 */, 16 }, - /* 1528 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 16 }, - /* 1529 */ { MAD_F(0x044cec1b) /* 0.268779856 */, 16 }, - /* 1530 */ { MAD_F(0x044de1e7) /* 0.269014265 */, 16 }, - /* 1531 */ { MAD_F(0x044ed7c0) /* 0.269248726 */, 16 }, - /* 1532 */ { MAD_F(0x044fcda8) /* 0.269483238 */, 16 }, - /* 1533 */ { MAD_F(0x0450c39c) /* 0.269717800 */, 16 }, - /* 1534 */ { MAD_F(0x0451b99f) /* 0.269952414 */, 16 }, - /* 1535 */ { MAD_F(0x0452afaf) /* 0.270187079 */, 16 }, - - /* 1536 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 16 }, - /* 1537 */ { MAD_F(0x04549bf9) /* 0.270656561 */, 16 }, - /* 1538 */ { MAD_F(0x04559232) /* 0.270891379 */, 16 }, - /* 1539 */ { MAD_F(0x04568879) /* 0.271126247 */, 16 }, - /* 1540 */ { MAD_F(0x04577ece) /* 0.271361166 */, 16 }, - /* 1541 */ { MAD_F(0x04587530) /* 0.271596136 */, 16 }, - /* 1542 */ { MAD_F(0x04596ba0) /* 0.271831157 */, 16 }, - /* 1543 */ { MAD_F(0x045a621e) /* 0.272066229 */, 16 }, - /* 1544 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 16 }, - /* 1545 */ { MAD_F(0x045c4f42) /* 0.272536525 */, 16 }, - /* 1546 */ { MAD_F(0x045d45e9) /* 0.272771749 */, 16 }, - /* 1547 */ { MAD_F(0x045e3c9d) /* 0.273007024 */, 16 }, - /* 1548 */ { MAD_F(0x045f335e) /* 0.273242350 */, 16 }, - /* 1549 */ { MAD_F(0x04602a2e) /* 0.273477726 */, 16 }, - /* 1550 */ { MAD_F(0x0461210b) /* 0.273713153 */, 16 }, - /* 1551 */ { MAD_F(0x046217f5) /* 0.273948630 */, 16 }, - - /* 1552 */ { MAD_F(0x04630eed) /* 0.274184158 */, 16 }, - /* 1553 */ { MAD_F(0x046405f3) /* 0.274419737 */, 16 }, - /* 1554 */ { MAD_F(0x0464fd06) /* 0.274655366 */, 16 }, - /* 1555 */ { MAD_F(0x0465f427) /* 0.274891046 */, 16 }, - /* 1556 */ { MAD_F(0x0466eb55) /* 0.275126776 */, 16 }, - /* 1557 */ { MAD_F(0x0467e291) /* 0.275362557 */, 16 }, - /* 1558 */ { MAD_F(0x0468d9db) /* 0.275598389 */, 16 }, - /* 1559 */ { MAD_F(0x0469d132) /* 0.275834270 */, 16 }, - /* 1560 */ { MAD_F(0x046ac896) /* 0.276070203 */, 16 }, - /* 1561 */ { MAD_F(0x046bc009) /* 0.276306185 */, 16 }, - /* 1562 */ { MAD_F(0x046cb788) /* 0.276542218 */, 16 }, - /* 1563 */ { MAD_F(0x046daf15) /* 0.276778302 */, 16 }, - /* 1564 */ { MAD_F(0x046ea6b0) /* 0.277014435 */, 16 }, - /* 1565 */ { MAD_F(0x046f9e58) /* 0.277250619 */, 16 }, - /* 1566 */ { MAD_F(0x0470960e) /* 0.277486854 */, 16 }, - /* 1567 */ { MAD_F(0x04718dd1) /* 0.277723139 */, 16 }, - - /* 1568 */ { MAD_F(0x047285a2) /* 0.277959474 */, 16 }, - /* 1569 */ { MAD_F(0x04737d80) /* 0.278195859 */, 16 }, - /* 1570 */ { MAD_F(0x0474756c) /* 0.278432294 */, 16 }, - /* 1571 */ { MAD_F(0x04756d65) /* 0.278668780 */, 16 }, - /* 1572 */ { MAD_F(0x0476656b) /* 0.278905316 */, 16 }, - /* 1573 */ { MAD_F(0x04775d7f) /* 0.279141902 */, 16 }, - /* 1574 */ { MAD_F(0x047855a1) /* 0.279378538 */, 16 }, - /* 1575 */ { MAD_F(0x04794dd0) /* 0.279615224 */, 16 }, - /* 1576 */ { MAD_F(0x047a460c) /* 0.279851960 */, 16 }, - /* 1577 */ { MAD_F(0x047b3e56) /* 0.280088747 */, 16 }, - /* 1578 */ { MAD_F(0x047c36ae) /* 0.280325583 */, 16 }, - /* 1579 */ { MAD_F(0x047d2f12) /* 0.280562470 */, 16 }, - /* 1580 */ { MAD_F(0x047e2784) /* 0.280799406 */, 16 }, - /* 1581 */ { MAD_F(0x047f2004) /* 0.281036393 */, 16 }, - /* 1582 */ { MAD_F(0x04801891) /* 0.281273429 */, 16 }, - /* 1583 */ { MAD_F(0x0481112b) /* 0.281510516 */, 16 }, - - /* 1584 */ { MAD_F(0x048209d3) /* 0.281747652 */, 16 }, - /* 1585 */ { MAD_F(0x04830288) /* 0.281984838 */, 16 }, - /* 1586 */ { MAD_F(0x0483fb4b) /* 0.282222075 */, 16 }, - /* 1587 */ { MAD_F(0x0484f41b) /* 0.282459361 */, 16 }, - /* 1588 */ { MAD_F(0x0485ecf8) /* 0.282696697 */, 16 }, - /* 1589 */ { MAD_F(0x0486e5e3) /* 0.282934082 */, 16 }, - /* 1590 */ { MAD_F(0x0487dedb) /* 0.283171518 */, 16 }, - /* 1591 */ { MAD_F(0x0488d7e1) /* 0.283409003 */, 16 }, - /* 1592 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 16 }, - /* 1593 */ { MAD_F(0x048aca14) /* 0.283884123 */, 16 }, - /* 1594 */ { MAD_F(0x048bc341) /* 0.284121757 */, 16 }, - /* 1595 */ { MAD_F(0x048cbc7c) /* 0.284359441 */, 16 }, - /* 1596 */ { MAD_F(0x048db5c4) /* 0.284597175 */, 16 }, - /* 1597 */ { MAD_F(0x048eaf1a) /* 0.284834959 */, 16 }, - /* 1598 */ { MAD_F(0x048fa87d) /* 0.285072792 */, 16 }, - /* 1599 */ { MAD_F(0x0490a1ed) /* 0.285310675 */, 16 }, - - /* 1600 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 16 }, - /* 1601 */ { MAD_F(0x049294f5) /* 0.285786589 */, 16 }, - /* 1602 */ { MAD_F(0x04938e8d) /* 0.286024621 */, 16 }, - /* 1603 */ { MAD_F(0x04948833) /* 0.286262702 */, 16 }, - /* 1604 */ { MAD_F(0x049581e5) /* 0.286500832 */, 16 }, - /* 1605 */ { MAD_F(0x04967ba5) /* 0.286739012 */, 16 }, - /* 1606 */ { MAD_F(0x04977573) /* 0.286977242 */, 16 }, - /* 1607 */ { MAD_F(0x04986f4d) /* 0.287215521 */, 16 }, - /* 1608 */ { MAD_F(0x04996935) /* 0.287453849 */, 16 }, - /* 1609 */ { MAD_F(0x049a632a) /* 0.287692227 */, 16 }, - /* 1610 */ { MAD_F(0x049b5d2c) /* 0.287930654 */, 16 }, - /* 1611 */ { MAD_F(0x049c573c) /* 0.288169131 */, 16 }, - /* 1612 */ { MAD_F(0x049d5159) /* 0.288407657 */, 16 }, - /* 1613 */ { MAD_F(0x049e4b83) /* 0.288646232 */, 16 }, - /* 1614 */ { MAD_F(0x049f45ba) /* 0.288884857 */, 16 }, - /* 1615 */ { MAD_F(0x04a03ffe) /* 0.289123530 */, 16 }, - - /* 1616 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 16 }, - /* 1617 */ { MAD_F(0x04a234af) /* 0.289601026 */, 16 }, - /* 1618 */ { MAD_F(0x04a32f1b) /* 0.289839847 */, 16 }, - /* 1619 */ { MAD_F(0x04a42995) /* 0.290078718 */, 16 }, - /* 1620 */ { MAD_F(0x04a5241b) /* 0.290317638 */, 16 }, - /* 1621 */ { MAD_F(0x04a61eaf) /* 0.290556607 */, 16 }, - /* 1622 */ { MAD_F(0x04a71950) /* 0.290795626 */, 16 }, - /* 1623 */ { MAD_F(0x04a813fe) /* 0.291034693 */, 16 }, - /* 1624 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 16 }, - /* 1625 */ { MAD_F(0x04aa0982) /* 0.291512975 */, 16 }, - /* 1626 */ { MAD_F(0x04ab0458) /* 0.291752190 */, 16 }, - /* 1627 */ { MAD_F(0x04abff3b) /* 0.291991453 */, 16 }, - /* 1628 */ { MAD_F(0x04acfa2b) /* 0.292230766 */, 16 }, - /* 1629 */ { MAD_F(0x04adf528) /* 0.292470128 */, 16 }, - /* 1630 */ { MAD_F(0x04aef032) /* 0.292709539 */, 16 }, - /* 1631 */ { MAD_F(0x04afeb4a) /* 0.292948998 */, 16 }, - - /* 1632 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 16 }, - /* 1633 */ { MAD_F(0x04b1e1a0) /* 0.293428065 */, 16 }, - /* 1634 */ { MAD_F(0x04b2dcdf) /* 0.293667671 */, 16 }, - /* 1635 */ { MAD_F(0x04b3d82b) /* 0.293907326 */, 16 }, - /* 1636 */ { MAD_F(0x04b4d384) /* 0.294147031 */, 16 }, - /* 1637 */ { MAD_F(0x04b5ceea) /* 0.294386784 */, 16 }, - /* 1638 */ { MAD_F(0x04b6ca5e) /* 0.294626585 */, 16 }, - /* 1639 */ { MAD_F(0x04b7c5de) /* 0.294866436 */, 16 }, - /* 1640 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 16 }, - /* 1641 */ { MAD_F(0x04b9bd06) /* 0.295346284 */, 16 }, - /* 1642 */ { MAD_F(0x04bab8ae) /* 0.295586281 */, 16 }, - /* 1643 */ { MAD_F(0x04bbb463) /* 0.295826327 */, 16 }, - /* 1644 */ { MAD_F(0x04bcb024) /* 0.296066421 */, 16 }, - /* 1645 */ { MAD_F(0x04bdabf3) /* 0.296306564 */, 16 }, - /* 1646 */ { MAD_F(0x04bea7cf) /* 0.296546756 */, 16 }, - /* 1647 */ { MAD_F(0x04bfa3b8) /* 0.296786996 */, 16 }, - - /* 1648 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 16 }, - /* 1649 */ { MAD_F(0x04c19bb2) /* 0.297267623 */, 16 }, - /* 1650 */ { MAD_F(0x04c297c2) /* 0.297508009 */, 16 }, - /* 1651 */ { MAD_F(0x04c393df) /* 0.297748444 */, 16 }, - /* 1652 */ { MAD_F(0x04c49009) /* 0.297988927 */, 16 }, - /* 1653 */ { MAD_F(0x04c58c41) /* 0.298229459 */, 16 }, - /* 1654 */ { MAD_F(0x04c68885) /* 0.298470039 */, 16 }, - /* 1655 */ { MAD_F(0x04c784d6) /* 0.298710668 */, 16 }, - /* 1656 */ { MAD_F(0x04c88135) /* 0.298951346 */, 16 }, - /* 1657 */ { MAD_F(0x04c97da0) /* 0.299192071 */, 16 }, - /* 1658 */ { MAD_F(0x04ca7a18) /* 0.299432846 */, 16 }, - /* 1659 */ { MAD_F(0x04cb769e) /* 0.299673668 */, 16 }, - /* 1660 */ { MAD_F(0x04cc7330) /* 0.299914539 */, 16 }, - /* 1661 */ { MAD_F(0x04cd6fcf) /* 0.300155459 */, 16 }, - /* 1662 */ { MAD_F(0x04ce6c7b) /* 0.300396426 */, 16 }, - /* 1663 */ { MAD_F(0x04cf6935) /* 0.300637443 */, 16 }, - - /* 1664 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 16 }, - /* 1665 */ { MAD_F(0x04d162ce) /* 0.301119620 */, 16 }, - /* 1666 */ { MAD_F(0x04d25fae) /* 0.301360781 */, 16 }, - /* 1667 */ { MAD_F(0x04d35c9b) /* 0.301601990 */, 16 }, - /* 1668 */ { MAD_F(0x04d45995) /* 0.301843247 */, 16 }, - /* 1669 */ { MAD_F(0x04d5569c) /* 0.302084553 */, 16 }, - /* 1670 */ { MAD_F(0x04d653b0) /* 0.302325907 */, 16 }, - /* 1671 */ { MAD_F(0x04d750d1) /* 0.302567309 */, 16 }, - /* 1672 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 16 }, - /* 1673 */ { MAD_F(0x04d94b3a) /* 0.303050257 */, 16 }, - /* 1674 */ { MAD_F(0x04da4881) /* 0.303291804 */, 16 }, - /* 1675 */ { MAD_F(0x04db45d6) /* 0.303533399 */, 16 }, - /* 1676 */ { MAD_F(0x04dc4337) /* 0.303775041 */, 16 }, - /* 1677 */ { MAD_F(0x04dd40a6) /* 0.304016732 */, 16 }, - /* 1678 */ { MAD_F(0x04de3e21) /* 0.304258471 */, 16 }, - /* 1679 */ { MAD_F(0x04df3ba9) /* 0.304500257 */, 16 }, - - /* 1680 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 16 }, - /* 1681 */ { MAD_F(0x04e136e0) /* 0.304983975 */, 16 }, - /* 1682 */ { MAD_F(0x04e2348f) /* 0.305225906 */, 16 }, - /* 1683 */ { MAD_F(0x04e3324b) /* 0.305467885 */, 16 }, - /* 1684 */ { MAD_F(0x04e43013) /* 0.305709911 */, 16 }, - /* 1685 */ { MAD_F(0x04e52de9) /* 0.305951986 */, 16 }, - /* 1686 */ { MAD_F(0x04e62bcb) /* 0.306194108 */, 16 }, - /* 1687 */ { MAD_F(0x04e729ba) /* 0.306436279 */, 16 }, - /* 1688 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 16 }, - /* 1689 */ { MAD_F(0x04e925bf) /* 0.306920763 */, 16 }, - /* 1690 */ { MAD_F(0x04ea23d4) /* 0.307163077 */, 16 }, - /* 1691 */ { MAD_F(0x04eb21f7) /* 0.307405438 */, 16 }, - /* 1692 */ { MAD_F(0x04ec2026) /* 0.307647848 */, 16 }, - /* 1693 */ { MAD_F(0x04ed1e62) /* 0.307890305 */, 16 }, - /* 1694 */ { MAD_F(0x04ee1cab) /* 0.308132810 */, 16 }, - /* 1695 */ { MAD_F(0x04ef1b01) /* 0.308375362 */, 16 }, - - /* 1696 */ { MAD_F(0x04f01963) /* 0.308617963 */, 16 }, - /* 1697 */ { MAD_F(0x04f117d3) /* 0.308860611 */, 16 }, - /* 1698 */ { MAD_F(0x04f2164f) /* 0.309103306 */, 16 }, - /* 1699 */ { MAD_F(0x04f314d8) /* 0.309346050 */, 16 }, - /* 1700 */ { MAD_F(0x04f4136d) /* 0.309588841 */, 16 }, - /* 1701 */ { MAD_F(0x04f51210) /* 0.309831679 */, 16 }, - /* 1702 */ { MAD_F(0x04f610bf) /* 0.310074565 */, 16 }, - /* 1703 */ { MAD_F(0x04f70f7b) /* 0.310317499 */, 16 }, - /* 1704 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 16 }, - /* 1705 */ { MAD_F(0x04f90d19) /* 0.310803509 */, 16 }, - /* 1706 */ { MAD_F(0x04fa0bfc) /* 0.311046586 */, 16 }, - /* 1707 */ { MAD_F(0x04fb0aeb) /* 0.311289710 */, 16 }, - /* 1708 */ { MAD_F(0x04fc09e7) /* 0.311532881 */, 16 }, - /* 1709 */ { MAD_F(0x04fd08ef) /* 0.311776100 */, 16 }, - /* 1710 */ { MAD_F(0x04fe0805) /* 0.312019366 */, 16 }, - /* 1711 */ { MAD_F(0x04ff0727) /* 0.312262680 */, 16 }, - - /* 1712 */ { MAD_F(0x05000655) /* 0.312506041 */, 16 }, - /* 1713 */ { MAD_F(0x05010591) /* 0.312749449 */, 16 }, - /* 1714 */ { MAD_F(0x050204d9) /* 0.312992905 */, 16 }, - /* 1715 */ { MAD_F(0x0503042e) /* 0.313236408 */, 16 }, - /* 1716 */ { MAD_F(0x0504038f) /* 0.313479959 */, 16 }, - /* 1717 */ { MAD_F(0x050502fe) /* 0.313723556 */, 16 }, - /* 1718 */ { MAD_F(0x05060279) /* 0.313967202 */, 16 }, - /* 1719 */ { MAD_F(0x05070200) /* 0.314210894 */, 16 }, - /* 1720 */ { MAD_F(0x05080195) /* 0.314454634 */, 16 }, - /* 1721 */ { MAD_F(0x05090136) /* 0.314698420 */, 16 }, - /* 1722 */ { MAD_F(0x050a00e3) /* 0.314942255 */, 16 }, - /* 1723 */ { MAD_F(0x050b009e) /* 0.315186136 */, 16 }, - /* 1724 */ { MAD_F(0x050c0065) /* 0.315430064 */, 16 }, - /* 1725 */ { MAD_F(0x050d0039) /* 0.315674040 */, 16 }, - /* 1726 */ { MAD_F(0x050e0019) /* 0.315918063 */, 16 }, - /* 1727 */ { MAD_F(0x050f0006) /* 0.316162133 */, 16 }, - - /* 1728 */ { MAD_F(0x05100000) /* 0.316406250 */, 16 }, - /* 1729 */ { MAD_F(0x05110006) /* 0.316650414 */, 16 }, - /* 1730 */ { MAD_F(0x05120019) /* 0.316894625 */, 16 }, - /* 1731 */ { MAD_F(0x05130039) /* 0.317138884 */, 16 }, - /* 1732 */ { MAD_F(0x05140065) /* 0.317383189 */, 16 }, - /* 1733 */ { MAD_F(0x0515009e) /* 0.317627541 */, 16 }, - /* 1734 */ { MAD_F(0x051600e3) /* 0.317871941 */, 16 }, - /* 1735 */ { MAD_F(0x05170135) /* 0.318116387 */, 16 }, - /* 1736 */ { MAD_F(0x05180194) /* 0.318360880 */, 16 }, - /* 1737 */ { MAD_F(0x051901ff) /* 0.318605421 */, 16 }, - /* 1738 */ { MAD_F(0x051a0277) /* 0.318850008 */, 16 }, - /* 1739 */ { MAD_F(0x051b02fc) /* 0.319094642 */, 16 }, - /* 1740 */ { MAD_F(0x051c038d) /* 0.319339323 */, 16 }, - /* 1741 */ { MAD_F(0x051d042a) /* 0.319584051 */, 16 }, - /* 1742 */ { MAD_F(0x051e04d4) /* 0.319828826 */, 16 }, - /* 1743 */ { MAD_F(0x051f058b) /* 0.320073647 */, 16 }, - - /* 1744 */ { MAD_F(0x0520064f) /* 0.320318516 */, 16 }, - /* 1745 */ { MAD_F(0x0521071f) /* 0.320563431 */, 16 }, - /* 1746 */ { MAD_F(0x052207fb) /* 0.320808393 */, 16 }, - /* 1747 */ { MAD_F(0x052308e4) /* 0.321053402 */, 16 }, - /* 1748 */ { MAD_F(0x052409da) /* 0.321298457 */, 16 }, - /* 1749 */ { MAD_F(0x05250adc) /* 0.321543560 */, 16 }, - /* 1750 */ { MAD_F(0x05260bea) /* 0.321788709 */, 16 }, - /* 1751 */ { MAD_F(0x05270d06) /* 0.322033904 */, 16 }, - /* 1752 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 16 }, - /* 1753 */ { MAD_F(0x05290f62) /* 0.322524436 */, 16 }, - /* 1754 */ { MAD_F(0x052a10a3) /* 0.322769771 */, 16 }, - /* 1755 */ { MAD_F(0x052b11f0) /* 0.323015154 */, 16 }, - /* 1756 */ { MAD_F(0x052c134a) /* 0.323260583 */, 16 }, - /* 1757 */ { MAD_F(0x052d14b0) /* 0.323506058 */, 16 }, - /* 1758 */ { MAD_F(0x052e1623) /* 0.323751580 */, 16 }, - /* 1759 */ { MAD_F(0x052f17a2) /* 0.323997149 */, 16 }, - - /* 1760 */ { MAD_F(0x0530192e) /* 0.324242764 */, 16 }, - /* 1761 */ { MAD_F(0x05311ac6) /* 0.324488426 */, 16 }, - /* 1762 */ { MAD_F(0x05321c6b) /* 0.324734134 */, 16 }, - /* 1763 */ { MAD_F(0x05331e1c) /* 0.324979889 */, 16 }, - /* 1764 */ { MAD_F(0x05341fda) /* 0.325225690 */, 16 }, - /* 1765 */ { MAD_F(0x053521a4) /* 0.325471538 */, 16 }, - /* 1766 */ { MAD_F(0x0536237b) /* 0.325717432 */, 16 }, - /* 1767 */ { MAD_F(0x0537255e) /* 0.325963372 */, 16 }, - /* 1768 */ { MAD_F(0x0538274e) /* 0.326209359 */, 16 }, - /* 1769 */ { MAD_F(0x0539294a) /* 0.326455392 */, 16 }, - /* 1770 */ { MAD_F(0x053a2b52) /* 0.326701472 */, 16 }, - /* 1771 */ { MAD_F(0x053b2d67) /* 0.326947598 */, 16 }, - /* 1772 */ { MAD_F(0x053c2f89) /* 0.327193770 */, 16 }, - /* 1773 */ { MAD_F(0x053d31b6) /* 0.327439989 */, 16 }, - /* 1774 */ { MAD_F(0x053e33f1) /* 0.327686254 */, 16 }, - /* 1775 */ { MAD_F(0x053f3637) /* 0.327932565 */, 16 }, - - /* 1776 */ { MAD_F(0x0540388a) /* 0.328178922 */, 16 }, - /* 1777 */ { MAD_F(0x05413aea) /* 0.328425326 */, 16 }, - /* 1778 */ { MAD_F(0x05423d56) /* 0.328671776 */, 16 }, - /* 1779 */ { MAD_F(0x05433fce) /* 0.328918272 */, 16 }, - /* 1780 */ { MAD_F(0x05444253) /* 0.329164814 */, 16 }, - /* 1781 */ { MAD_F(0x054544e4) /* 0.329411403 */, 16 }, - /* 1782 */ { MAD_F(0x05464781) /* 0.329658038 */, 16 }, - /* 1783 */ { MAD_F(0x05474a2b) /* 0.329904718 */, 16 }, - /* 1784 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 16 }, - /* 1785 */ { MAD_F(0x05494fa4) /* 0.330398218 */, 16 }, - /* 1786 */ { MAD_F(0x054a5273) /* 0.330645037 */, 16 }, - /* 1787 */ { MAD_F(0x054b554e) /* 0.330891903 */, 16 }, - /* 1788 */ { MAD_F(0x054c5836) /* 0.331138814 */, 16 }, - /* 1789 */ { MAD_F(0x054d5b2a) /* 0.331385771 */, 16 }, - /* 1790 */ { MAD_F(0x054e5e2b) /* 0.331632774 */, 16 }, - /* 1791 */ { MAD_F(0x054f6138) /* 0.331879824 */, 16 }, - - /* 1792 */ { MAD_F(0x05506451) /* 0.332126919 */, 16 }, - /* 1793 */ { MAD_F(0x05516776) /* 0.332374060 */, 16 }, - /* 1794 */ { MAD_F(0x05526aa8) /* 0.332621247 */, 16 }, - /* 1795 */ { MAD_F(0x05536de6) /* 0.332868480 */, 16 }, - /* 1796 */ { MAD_F(0x05547131) /* 0.333115759 */, 16 }, - /* 1797 */ { MAD_F(0x05557487) /* 0.333363084 */, 16 }, - /* 1798 */ { MAD_F(0x055677ea) /* 0.333610455 */, 16 }, - /* 1799 */ { MAD_F(0x05577b5a) /* 0.333857872 */, 16 }, - /* 1800 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 16 }, - /* 1801 */ { MAD_F(0x0559825e) /* 0.334352843 */, 16 }, - /* 1802 */ { MAD_F(0x055a85f2) /* 0.334600397 */, 16 }, - /* 1803 */ { MAD_F(0x055b8992) /* 0.334847997 */, 16 }, - /* 1804 */ { MAD_F(0x055c8d3f) /* 0.335095642 */, 16 }, - /* 1805 */ { MAD_F(0x055d90f9) /* 0.335343334 */, 16 }, - /* 1806 */ { MAD_F(0x055e94be) /* 0.335591071 */, 16 }, - /* 1807 */ { MAD_F(0x055f9890) /* 0.335838854 */, 16 }, - - /* 1808 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 16 }, - /* 1809 */ { MAD_F(0x0561a058) /* 0.336334557 */, 16 }, - /* 1810 */ { MAD_F(0x0562a44f) /* 0.336582477 */, 16 }, - /* 1811 */ { MAD_F(0x0563a851) /* 0.336830443 */, 16 }, - /* 1812 */ { MAD_F(0x0564ac60) /* 0.337078454 */, 16 }, - /* 1813 */ { MAD_F(0x0565b07c) /* 0.337326511 */, 16 }, - /* 1814 */ { MAD_F(0x0566b4a3) /* 0.337574614 */, 16 }, - /* 1815 */ { MAD_F(0x0567b8d7) /* 0.337822762 */, 16 }, - /* 1816 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 16 }, - /* 1817 */ { MAD_F(0x0569c163) /* 0.338319195 */, 16 }, - /* 1818 */ { MAD_F(0x056ac5bc) /* 0.338567480 */, 16 }, - /* 1819 */ { MAD_F(0x056bca20) /* 0.338815811 */, 16 }, - /* 1820 */ { MAD_F(0x056cce91) /* 0.339064186 */, 16 }, - /* 1821 */ { MAD_F(0x056dd30e) /* 0.339312608 */, 16 }, - /* 1822 */ { MAD_F(0x056ed798) /* 0.339561075 */, 16 }, - /* 1823 */ { MAD_F(0x056fdc2d) /* 0.339809587 */, 16 }, - - /* 1824 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 16 }, - /* 1825 */ { MAD_F(0x0571e57d) /* 0.340306748 */, 16 }, - /* 1826 */ { MAD_F(0x0572ea37) /* 0.340555397 */, 16 }, - /* 1827 */ { MAD_F(0x0573eefd) /* 0.340804091 */, 16 }, - /* 1828 */ { MAD_F(0x0574f3d0) /* 0.341052830 */, 16 }, - /* 1829 */ { MAD_F(0x0575f8ae) /* 0.341301615 */, 16 }, - /* 1830 */ { MAD_F(0x0576fd99) /* 0.341550445 */, 16 }, - /* 1831 */ { MAD_F(0x05780290) /* 0.341799321 */, 16 }, - /* 1832 */ { MAD_F(0x05790793) /* 0.342048241 */, 16 }, - /* 1833 */ { MAD_F(0x057a0ca3) /* 0.342297207 */, 16 }, - /* 1834 */ { MAD_F(0x057b11be) /* 0.342546219 */, 16 }, - /* 1835 */ { MAD_F(0x057c16e6) /* 0.342795275 */, 16 }, - /* 1836 */ { MAD_F(0x057d1c1a) /* 0.343044377 */, 16 }, - /* 1837 */ { MAD_F(0x057e2159) /* 0.343293524 */, 16 }, - /* 1838 */ { MAD_F(0x057f26a6) /* 0.343542717 */, 16 }, - /* 1839 */ { MAD_F(0x05802bfe) /* 0.343791954 */, 16 }, - - /* 1840 */ { MAD_F(0x05813162) /* 0.344041237 */, 16 }, - /* 1841 */ { MAD_F(0x058236d2) /* 0.344290564 */, 16 }, - /* 1842 */ { MAD_F(0x05833c4f) /* 0.344539937 */, 16 }, - /* 1843 */ { MAD_F(0x058441d8) /* 0.344789356 */, 16 }, - /* 1844 */ { MAD_F(0x0585476c) /* 0.345038819 */, 16 }, - /* 1845 */ { MAD_F(0x05864d0d) /* 0.345288327 */, 16 }, - /* 1846 */ { MAD_F(0x058752ba) /* 0.345537880 */, 16 }, - /* 1847 */ { MAD_F(0x05885873) /* 0.345787479 */, 16 }, - /* 1848 */ { MAD_F(0x05895e39) /* 0.346037122 */, 16 }, - /* 1849 */ { MAD_F(0x058a640a) /* 0.346286811 */, 16 }, - /* 1850 */ { MAD_F(0x058b69e7) /* 0.346536545 */, 16 }, - /* 1851 */ { MAD_F(0x058c6fd1) /* 0.346786323 */, 16 }, - /* 1852 */ { MAD_F(0x058d75c6) /* 0.347036147 */, 16 }, - /* 1853 */ { MAD_F(0x058e7bc8) /* 0.347286015 */, 16 }, - /* 1854 */ { MAD_F(0x058f81d5) /* 0.347535929 */, 16 }, - /* 1855 */ { MAD_F(0x059087ef) /* 0.347785887 */, 16 }, - - /* 1856 */ { MAD_F(0x05918e15) /* 0.348035890 */, 16 }, - /* 1857 */ { MAD_F(0x05929447) /* 0.348285939 */, 16 }, - /* 1858 */ { MAD_F(0x05939a84) /* 0.348536032 */, 16 }, - /* 1859 */ { MAD_F(0x0594a0ce) /* 0.348786170 */, 16 }, - /* 1860 */ { MAD_F(0x0595a724) /* 0.349036353 */, 16 }, - /* 1861 */ { MAD_F(0x0596ad86) /* 0.349286580 */, 16 }, - /* 1862 */ { MAD_F(0x0597b3f4) /* 0.349536853 */, 16 }, - /* 1863 */ { MAD_F(0x0598ba6e) /* 0.349787170 */, 16 }, - /* 1864 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 16 }, - /* 1865 */ { MAD_F(0x059ac786) /* 0.350287939 */, 16 }, - /* 1866 */ { MAD_F(0x059bce25) /* 0.350538391 */, 16 }, - /* 1867 */ { MAD_F(0x059cd4cf) /* 0.350788887 */, 16 }, - /* 1868 */ { MAD_F(0x059ddb85) /* 0.351039428 */, 16 }, - /* 1869 */ { MAD_F(0x059ee247) /* 0.351290014 */, 16 }, - /* 1870 */ { MAD_F(0x059fe915) /* 0.351540645 */, 16 }, - /* 1871 */ { MAD_F(0x05a0efef) /* 0.351791320 */, 16 }, - - /* 1872 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 16 }, - /* 1873 */ { MAD_F(0x05a2fdc7) /* 0.352292804 */, 16 }, - /* 1874 */ { MAD_F(0x05a404c5) /* 0.352543613 */, 16 }, - /* 1875 */ { MAD_F(0x05a50bcf) /* 0.352794467 */, 16 }, - /* 1876 */ { MAD_F(0x05a612e5) /* 0.353045365 */, 16 }, - /* 1877 */ { MAD_F(0x05a71a07) /* 0.353296308 */, 16 }, - /* 1878 */ { MAD_F(0x05a82135) /* 0.353547296 */, 16 }, - /* 1879 */ { MAD_F(0x05a9286f) /* 0.353798328 */, 16 }, - /* 1880 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 16 }, - /* 1881 */ { MAD_F(0x05ab3707) /* 0.354300526 */, 16 }, - /* 1882 */ { MAD_F(0x05ac3e65) /* 0.354551691 */, 16 }, - /* 1883 */ { MAD_F(0x05ad45ce) /* 0.354802901 */, 16 }, - /* 1884 */ { MAD_F(0x05ae4d44) /* 0.355054156 */, 16 }, - /* 1885 */ { MAD_F(0x05af54c6) /* 0.355305455 */, 16 }, - /* 1886 */ { MAD_F(0x05b05c53) /* 0.355556799 */, 16 }, - /* 1887 */ { MAD_F(0x05b163ed) /* 0.355808187 */, 16 }, - - /* 1888 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 16 }, - /* 1889 */ { MAD_F(0x05b37343) /* 0.356311096 */, 16 }, - /* 1890 */ { MAD_F(0x05b47b00) /* 0.356562617 */, 16 }, - /* 1891 */ { MAD_F(0x05b582c9) /* 0.356814182 */, 16 }, - /* 1892 */ { MAD_F(0x05b68a9e) /* 0.357065792 */, 16 }, - /* 1893 */ { MAD_F(0x05b7927f) /* 0.357317446 */, 16 }, - /* 1894 */ { MAD_F(0x05b89a6c) /* 0.357569145 */, 16 }, - /* 1895 */ { MAD_F(0x05b9a265) /* 0.357820887 */, 16 }, - /* 1896 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 16 }, - /* 1897 */ { MAD_F(0x05bbb27a) /* 0.358324506 */, 16 }, - /* 1898 */ { MAD_F(0x05bcba96) /* 0.358576381 */, 16 }, - /* 1899 */ { MAD_F(0x05bdc2be) /* 0.358828301 */, 16 }, - /* 1900 */ { MAD_F(0x05becaf2) /* 0.359080265 */, 16 }, - /* 1901 */ { MAD_F(0x05bfd332) /* 0.359332273 */, 16 }, - /* 1902 */ { MAD_F(0x05c0db7e) /* 0.359584326 */, 16 }, - /* 1903 */ { MAD_F(0x05c1e3d6) /* 0.359836423 */, 16 }, - - /* 1904 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 16 }, - /* 1905 */ { MAD_F(0x05c3f4a9) /* 0.360340748 */, 16 }, - /* 1906 */ { MAD_F(0x05c4fd24) /* 0.360592977 */, 16 }, - /* 1907 */ { MAD_F(0x05c605ab) /* 0.360845251 */, 16 }, - /* 1908 */ { MAD_F(0x05c70e3e) /* 0.361097568 */, 16 }, - /* 1909 */ { MAD_F(0x05c816dd) /* 0.361349929 */, 16 }, - /* 1910 */ { MAD_F(0x05c91f87) /* 0.361602335 */, 16 }, - /* 1911 */ { MAD_F(0x05ca283e) /* 0.361854784 */, 16 }, - /* 1912 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 16 }, - /* 1913 */ { MAD_F(0x05cc39ce) /* 0.362359815 */, 16 }, - /* 1914 */ { MAD_F(0x05cd42a8) /* 0.362612397 */, 16 }, - /* 1915 */ { MAD_F(0x05ce4b8d) /* 0.362865022 */, 16 }, - /* 1916 */ { MAD_F(0x05cf547f) /* 0.363117692 */, 16 }, - /* 1917 */ { MAD_F(0x05d05d7c) /* 0.363370405 */, 16 }, - /* 1918 */ { MAD_F(0x05d16685) /* 0.363623163 */, 16 }, - /* 1919 */ { MAD_F(0x05d26f9a) /* 0.363875964 */, 16 }, - - /* 1920 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 16 }, - /* 1921 */ { MAD_F(0x05d481e7) /* 0.364381698 */, 16 }, - /* 1922 */ { MAD_F(0x05d58b1f) /* 0.364634632 */, 16 }, - /* 1923 */ { MAD_F(0x05d69463) /* 0.364887608 */, 16 }, - /* 1924 */ { MAD_F(0x05d79db3) /* 0.365140629 */, 16 }, - /* 1925 */ { MAD_F(0x05d8a70f) /* 0.365393694 */, 16 }, - /* 1926 */ { MAD_F(0x05d9b076) /* 0.365646802 */, 16 }, - /* 1927 */ { MAD_F(0x05dab9e9) /* 0.365899955 */, 16 }, - /* 1928 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 16 }, - /* 1929 */ { MAD_F(0x05dcccf2) /* 0.366406390 */, 16 }, - /* 1930 */ { MAD_F(0x05ddd689) /* 0.366659674 */, 16 }, - /* 1931 */ { MAD_F(0x05dee02b) /* 0.366913001 */, 16 }, - /* 1932 */ { MAD_F(0x05dfe9d8) /* 0.367166372 */, 16 }, - /* 1933 */ { MAD_F(0x05e0f392) /* 0.367419787 */, 16 }, - /* 1934 */ { MAD_F(0x05e1fd57) /* 0.367673246 */, 16 }, - /* 1935 */ { MAD_F(0x05e30728) /* 0.367926748 */, 16 }, - - /* 1936 */ { MAD_F(0x05e41105) /* 0.368180294 */, 16 }, - /* 1937 */ { MAD_F(0x05e51aed) /* 0.368433883 */, 16 }, - /* 1938 */ { MAD_F(0x05e624e1) /* 0.368687517 */, 16 }, - /* 1939 */ { MAD_F(0x05e72ee1) /* 0.368941193 */, 16 }, - /* 1940 */ { MAD_F(0x05e838ed) /* 0.369194914 */, 16 }, - /* 1941 */ { MAD_F(0x05e94304) /* 0.369448678 */, 16 }, - /* 1942 */ { MAD_F(0x05ea4d27) /* 0.369702485 */, 16 }, - /* 1943 */ { MAD_F(0x05eb5756) /* 0.369956336 */, 16 }, - /* 1944 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 16 }, - /* 1945 */ { MAD_F(0x05ed6bd6) /* 0.370464169 */, 16 }, - /* 1946 */ { MAD_F(0x05ee7628) /* 0.370718151 */, 16 }, - /* 1947 */ { MAD_F(0x05ef8085) /* 0.370972177 */, 16 }, - /* 1948 */ { MAD_F(0x05f08aee) /* 0.371226245 */, 16 }, - /* 1949 */ { MAD_F(0x05f19563) /* 0.371480358 */, 16 }, - /* 1950 */ { MAD_F(0x05f29fe3) /* 0.371734513 */, 16 }, - /* 1951 */ { MAD_F(0x05f3aa6f) /* 0.371988712 */, 16 }, - - /* 1952 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 16 }, - /* 1953 */ { MAD_F(0x05f5bfab) /* 0.372497241 */, 16 }, - /* 1954 */ { MAD_F(0x05f6ca5a) /* 0.372751570 */, 16 }, - /* 1955 */ { MAD_F(0x05f7d514) /* 0.373005943 */, 16 }, - /* 1956 */ { MAD_F(0x05f8dfdb) /* 0.373260359 */, 16 }, - /* 1957 */ { MAD_F(0x05f9eaad) /* 0.373514819 */, 16 }, - /* 1958 */ { MAD_F(0x05faf58a) /* 0.373769322 */, 16 }, - /* 1959 */ { MAD_F(0x05fc0073) /* 0.374023868 */, 16 }, - /* 1960 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 16 }, - /* 1961 */ { MAD_F(0x05fe1669) /* 0.374533091 */, 16 }, - /* 1962 */ { MAD_F(0x05ff2175) /* 0.374787767 */, 16 }, - /* 1963 */ { MAD_F(0x06002c8d) /* 0.375042486 */, 16 }, - /* 1964 */ { MAD_F(0x060137b0) /* 0.375297249 */, 16 }, - /* 1965 */ { MAD_F(0x060242df) /* 0.375552055 */, 16 }, - /* 1966 */ { MAD_F(0x06034e19) /* 0.375806904 */, 16 }, - /* 1967 */ { MAD_F(0x0604595f) /* 0.376061796 */, 16 }, - - /* 1968 */ { MAD_F(0x060564b1) /* 0.376316732 */, 16 }, - /* 1969 */ { MAD_F(0x0606700f) /* 0.376571710 */, 16 }, - /* 1970 */ { MAD_F(0x06077b77) /* 0.376826732 */, 16 }, - /* 1971 */ { MAD_F(0x060886ec) /* 0.377081797 */, 16 }, - /* 1972 */ { MAD_F(0x0609926c) /* 0.377336905 */, 16 }, - /* 1973 */ { MAD_F(0x060a9df8) /* 0.377592057 */, 16 }, - /* 1974 */ { MAD_F(0x060ba98f) /* 0.377847251 */, 16 }, - /* 1975 */ { MAD_F(0x060cb532) /* 0.378102489 */, 16 }, - /* 1976 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 16 }, - /* 1977 */ { MAD_F(0x060ecc9a) /* 0.378613093 */, 16 }, - /* 1978 */ { MAD_F(0x060fd860) /* 0.378868460 */, 16 }, - /* 1979 */ { MAD_F(0x0610e431) /* 0.379123870 */, 16 }, - /* 1980 */ { MAD_F(0x0611f00d) /* 0.379379322 */, 16 }, - /* 1981 */ { MAD_F(0x0612fbf5) /* 0.379634818 */, 16 }, - /* 1982 */ { MAD_F(0x061407e9) /* 0.379890357 */, 16 }, - /* 1983 */ { MAD_F(0x061513e8) /* 0.380145939 */, 16 }, - - /* 1984 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 16 }, - /* 1985 */ { MAD_F(0x06172c09) /* 0.380657231 */, 16 }, - /* 1986 */ { MAD_F(0x0618382b) /* 0.380912942 */, 16 }, - /* 1987 */ { MAD_F(0x06194458) /* 0.381168695 */, 16 }, - /* 1988 */ { MAD_F(0x061a5091) /* 0.381424492 */, 16 }, - /* 1989 */ { MAD_F(0x061b5cd5) /* 0.381680331 */, 16 }, - /* 1990 */ { MAD_F(0x061c6925) /* 0.381936213 */, 16 }, - /* 1991 */ { MAD_F(0x061d7581) /* 0.382192138 */, 16 }, - /* 1992 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 16 }, - /* 1993 */ { MAD_F(0x061f8e5a) /* 0.382704117 */, 16 }, - /* 1994 */ { MAD_F(0x06209ad8) /* 0.382960171 */, 16 }, - /* 1995 */ { MAD_F(0x0621a761) /* 0.383216267 */, 16 }, - /* 1996 */ { MAD_F(0x0622b3f6) /* 0.383472406 */, 16 }, - /* 1997 */ { MAD_F(0x0623c096) /* 0.383728588 */, 16 }, - /* 1998 */ { MAD_F(0x0624cd42) /* 0.383984813 */, 16 }, - /* 1999 */ { MAD_F(0x0625d9f9) /* 0.384241080 */, 16 }, - - /* 2000 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 16 }, - /* 2001 */ { MAD_F(0x0627f38a) /* 0.384753744 */, 16 }, - /* 2002 */ { MAD_F(0x06290064) /* 0.385010139 */, 16 }, - /* 2003 */ { MAD_F(0x062a0d49) /* 0.385266578 */, 16 }, - /* 2004 */ { MAD_F(0x062b1a3a) /* 0.385523059 */, 16 }, - /* 2005 */ { MAD_F(0x062c2736) /* 0.385779582 */, 16 }, - /* 2006 */ { MAD_F(0x062d343d) /* 0.386036149 */, 16 }, - /* 2007 */ { MAD_F(0x062e4150) /* 0.386292758 */, 16 }, - /* 2008 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 16 }, - /* 2009 */ { MAD_F(0x06305b99) /* 0.386806104 */, 16 }, - /* 2010 */ { MAD_F(0x063168ce) /* 0.387062840 */, 16 }, - /* 2011 */ { MAD_F(0x0632760f) /* 0.387319620 */, 16 }, - /* 2012 */ { MAD_F(0x0633835b) /* 0.387576442 */, 16 }, - /* 2013 */ { MAD_F(0x063490b2) /* 0.387833306 */, 16 }, - /* 2014 */ { MAD_F(0x06359e15) /* 0.388090213 */, 16 }, - /* 2015 */ { MAD_F(0x0636ab83) /* 0.388347163 */, 16 }, - - /* 2016 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 16 }, - /* 2017 */ { MAD_F(0x0638c682) /* 0.388861190 */, 16 }, - /* 2018 */ { MAD_F(0x0639d413) /* 0.389118267 */, 16 }, - /* 2019 */ { MAD_F(0x063ae1af) /* 0.389375386 */, 16 }, - /* 2020 */ { MAD_F(0x063bef56) /* 0.389632548 */, 16 }, - /* 2021 */ { MAD_F(0x063cfd09) /* 0.389889752 */, 16 }, - /* 2022 */ { MAD_F(0x063e0ac7) /* 0.390146999 */, 16 }, - /* 2023 */ { MAD_F(0x063f1891) /* 0.390404289 */, 16 }, - /* 2024 */ { MAD_F(0x06402666) /* 0.390661620 */, 16 }, - /* 2025 */ { MAD_F(0x06413446) /* 0.390918994 */, 16 }, - /* 2026 */ { MAD_F(0x06424232) /* 0.391176411 */, 16 }, - /* 2027 */ { MAD_F(0x06435029) /* 0.391433869 */, 16 }, - /* 2028 */ { MAD_F(0x06445e2b) /* 0.391691371 */, 16 }, - /* 2029 */ { MAD_F(0x06456c39) /* 0.391948914 */, 16 }, - /* 2030 */ { MAD_F(0x06467a52) /* 0.392206500 */, 16 }, - /* 2031 */ { MAD_F(0x06478877) /* 0.392464128 */, 16 }, - - /* 2032 */ { MAD_F(0x064896a7) /* 0.392721798 */, 16 }, - /* 2033 */ { MAD_F(0x0649a4e2) /* 0.392979511 */, 16 }, - /* 2034 */ { MAD_F(0x064ab328) /* 0.393237266 */, 16 }, - /* 2035 */ { MAD_F(0x064bc17a) /* 0.393495063 */, 16 }, - /* 2036 */ { MAD_F(0x064ccfd8) /* 0.393752902 */, 16 }, - /* 2037 */ { MAD_F(0x064dde40) /* 0.394010784 */, 16 }, - /* 2038 */ { MAD_F(0x064eecb4) /* 0.394268707 */, 16 }, - /* 2039 */ { MAD_F(0x064ffb33) /* 0.394526673 */, 16 }, - /* 2040 */ { MAD_F(0x065109be) /* 0.394784681 */, 16 }, - /* 2041 */ { MAD_F(0x06521854) /* 0.395042732 */, 16 }, - /* 2042 */ { MAD_F(0x065326f5) /* 0.395300824 */, 16 }, - /* 2043 */ { MAD_F(0x065435a1) /* 0.395558959 */, 16 }, - /* 2044 */ { MAD_F(0x06554459) /* 0.395817135 */, 16 }, - /* 2045 */ { MAD_F(0x0656531c) /* 0.396075354 */, 16 }, - /* 2046 */ { MAD_F(0x065761ea) /* 0.396333615 */, 16 }, - /* 2047 */ { MAD_F(0x065870c4) /* 0.396591918 */, 16 }, - - /* 2048 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 16 }, - /* 2049 */ { MAD_F(0x065a8e99) /* 0.397108650 */, 16 }, - /* 2050 */ { MAD_F(0x065b9d95) /* 0.397367079 */, 16 }, - /* 2051 */ { MAD_F(0x065cac9c) /* 0.397625550 */, 16 }, - /* 2052 */ { MAD_F(0x065dbbae) /* 0.397884063 */, 16 }, - /* 2053 */ { MAD_F(0x065ecacb) /* 0.398142619 */, 16 }, - /* 2054 */ { MAD_F(0x065fd9f4) /* 0.398401216 */, 16 }, - /* 2055 */ { MAD_F(0x0660e928) /* 0.398659855 */, 16 }, - /* 2056 */ { MAD_F(0x0661f867) /* 0.398918536 */, 16 }, - /* 2057 */ { MAD_F(0x066307b1) /* 0.399177259 */, 16 }, - /* 2058 */ { MAD_F(0x06641707) /* 0.399436024 */, 16 }, - /* 2059 */ { MAD_F(0x06652668) /* 0.399694831 */, 16 }, - /* 2060 */ { MAD_F(0x066635d4) /* 0.399953679 */, 16 }, - /* 2061 */ { MAD_F(0x0667454c) /* 0.400212570 */, 16 }, - /* 2062 */ { MAD_F(0x066854ce) /* 0.400471503 */, 16 }, - /* 2063 */ { MAD_F(0x0669645c) /* 0.400730477 */, 16 }, - - /* 2064 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 16 }, - /* 2065 */ { MAD_F(0x066b839a) /* 0.401248551 */, 16 }, - /* 2066 */ { MAD_F(0x066c9349) /* 0.401507651 */, 16 }, - /* 2067 */ { MAD_F(0x066da304) /* 0.401766793 */, 16 }, - /* 2068 */ { MAD_F(0x066eb2ca) /* 0.402025976 */, 16 }, - /* 2069 */ { MAD_F(0x066fc29b) /* 0.402285202 */, 16 }, - /* 2070 */ { MAD_F(0x0670d278) /* 0.402544469 */, 16 }, - /* 2071 */ { MAD_F(0x0671e25f) /* 0.402803777 */, 16 }, - /* 2072 */ { MAD_F(0x0672f252) /* 0.403063128 */, 16 }, - /* 2073 */ { MAD_F(0x06740250) /* 0.403322520 */, 16 }, - /* 2074 */ { MAD_F(0x0675125a) /* 0.403581954 */, 16 }, - /* 2075 */ { MAD_F(0x0676226e) /* 0.403841430 */, 16 }, - /* 2076 */ { MAD_F(0x0677328e) /* 0.404100947 */, 16 }, - /* 2077 */ { MAD_F(0x067842b9) /* 0.404360506 */, 16 }, - /* 2078 */ { MAD_F(0x067952ef) /* 0.404620107 */, 16 }, - /* 2079 */ { MAD_F(0x067a6330) /* 0.404879749 */, 16 }, - - /* 2080 */ { MAD_F(0x067b737c) /* 0.405139433 */, 16 }, - /* 2081 */ { MAD_F(0x067c83d4) /* 0.405399159 */, 16 }, - /* 2082 */ { MAD_F(0x067d9436) /* 0.405658926 */, 16 }, - /* 2083 */ { MAD_F(0x067ea4a4) /* 0.405918735 */, 16 }, - /* 2084 */ { MAD_F(0x067fb51d) /* 0.406178585 */, 16 }, - /* 2085 */ { MAD_F(0x0680c5a2) /* 0.406438477 */, 16 }, - /* 2086 */ { MAD_F(0x0681d631) /* 0.406698410 */, 16 }, - /* 2087 */ { MAD_F(0x0682e6cb) /* 0.406958385 */, 16 }, - /* 2088 */ { MAD_F(0x0683f771) /* 0.407218402 */, 16 }, - /* 2089 */ { MAD_F(0x06850822) /* 0.407478460 */, 16 }, - /* 2090 */ { MAD_F(0x068618de) /* 0.407738559 */, 16 }, - /* 2091 */ { MAD_F(0x068729a5) /* 0.407998700 */, 16 }, - /* 2092 */ { MAD_F(0x06883a77) /* 0.408258883 */, 16 }, - /* 2093 */ { MAD_F(0x06894b55) /* 0.408519107 */, 16 }, - /* 2094 */ { MAD_F(0x068a5c3d) /* 0.408779372 */, 16 }, - /* 2095 */ { MAD_F(0x068b6d31) /* 0.409039679 */, 16 }, - - /* 2096 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 16 }, - /* 2097 */ { MAD_F(0x068d8f39) /* 0.409560417 */, 16 }, - /* 2098 */ { MAD_F(0x068ea04e) /* 0.409820848 */, 16 }, - /* 2099 */ { MAD_F(0x068fb16e) /* 0.410081321 */, 16 }, - /* 2100 */ { MAD_F(0x0690c299) /* 0.410341834 */, 16 }, - /* 2101 */ { MAD_F(0x0691d3cf) /* 0.410602390 */, 16 }, - /* 2102 */ { MAD_F(0x0692e511) /* 0.410862986 */, 16 }, - /* 2103 */ { MAD_F(0x0693f65d) /* 0.411123624 */, 16 }, - /* 2104 */ { MAD_F(0x069507b5) /* 0.411384303 */, 16 }, - /* 2105 */ { MAD_F(0x06961917) /* 0.411645024 */, 16 }, - /* 2106 */ { MAD_F(0x06972a85) /* 0.411905785 */, 16 }, - /* 2107 */ { MAD_F(0x06983bfe) /* 0.412166588 */, 16 }, - /* 2108 */ { MAD_F(0x06994d82) /* 0.412427433 */, 16 }, - /* 2109 */ { MAD_F(0x069a5f11) /* 0.412688318 */, 16 }, - /* 2110 */ { MAD_F(0x069b70ab) /* 0.412949245 */, 16 }, - /* 2111 */ { MAD_F(0x069c8250) /* 0.413210213 */, 16 }, - - /* 2112 */ { MAD_F(0x069d9400) /* 0.413471222 */, 16 }, - /* 2113 */ { MAD_F(0x069ea5bb) /* 0.413732273 */, 16 }, - /* 2114 */ { MAD_F(0x069fb781) /* 0.413993364 */, 16 }, - /* 2115 */ { MAD_F(0x06a0c953) /* 0.414254497 */, 16 }, - /* 2116 */ { MAD_F(0x06a1db2f) /* 0.414515671 */, 16 }, - /* 2117 */ { MAD_F(0x06a2ed16) /* 0.414776886 */, 16 }, - /* 2118 */ { MAD_F(0x06a3ff09) /* 0.415038142 */, 16 }, - /* 2119 */ { MAD_F(0x06a51106) /* 0.415299440 */, 16 }, - /* 2120 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 16 }, - /* 2121 */ { MAD_F(0x06a73522) /* 0.415822157 */, 16 }, - /* 2122 */ { MAD_F(0x06a84741) /* 0.416083578 */, 16 }, - /* 2123 */ { MAD_F(0x06a9596a) /* 0.416345040 */, 16 }, - /* 2124 */ { MAD_F(0x06aa6b9f) /* 0.416606542 */, 16 }, - /* 2125 */ { MAD_F(0x06ab7ddf) /* 0.416868086 */, 16 }, - /* 2126 */ { MAD_F(0x06ac9029) /* 0.417129671 */, 16 }, - /* 2127 */ { MAD_F(0x06ada27f) /* 0.417391297 */, 16 }, - - /* 2128 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 16 }, - /* 2129 */ { MAD_F(0x06afc74b) /* 0.417914672 */, 16 }, - /* 2130 */ { MAD_F(0x06b0d9c2) /* 0.418176420 */, 16 }, - /* 2131 */ { MAD_F(0x06b1ec43) /* 0.418438210 */, 16 }, - /* 2132 */ { MAD_F(0x06b2fed0) /* 0.418700041 */, 16 }, - /* 2133 */ { MAD_F(0x06b41168) /* 0.418961912 */, 16 }, - /* 2134 */ { MAD_F(0x06b5240a) /* 0.419223825 */, 16 }, - /* 2135 */ { MAD_F(0x06b636b8) /* 0.419485778 */, 16 }, - /* 2136 */ { MAD_F(0x06b74971) /* 0.419747773 */, 16 }, - /* 2137 */ { MAD_F(0x06b85c34) /* 0.420009808 */, 16 }, - /* 2138 */ { MAD_F(0x06b96f03) /* 0.420271884 */, 16 }, - /* 2139 */ { MAD_F(0x06ba81dc) /* 0.420534001 */, 16 }, - /* 2140 */ { MAD_F(0x06bb94c1) /* 0.420796159 */, 16 }, - /* 2141 */ { MAD_F(0x06bca7b0) /* 0.421058358 */, 16 }, - /* 2142 */ { MAD_F(0x06bdbaaa) /* 0.421320597 */, 16 }, - /* 2143 */ { MAD_F(0x06becdb0) /* 0.421582878 */, 16 }, - - /* 2144 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 16 }, - /* 2145 */ { MAD_F(0x06c0f3db) /* 0.422107561 */, 16 }, - /* 2146 */ { MAD_F(0x06c20702) /* 0.422369964 */, 16 }, - /* 2147 */ { MAD_F(0x06c31a33) /* 0.422632407 */, 16 }, - /* 2148 */ { MAD_F(0x06c42d6f) /* 0.422894891 */, 16 }, - /* 2149 */ { MAD_F(0x06c540b6) /* 0.423157416 */, 16 }, - /* 2150 */ { MAD_F(0x06c65408) /* 0.423419982 */, 16 }, - /* 2151 */ { MAD_F(0x06c76765) /* 0.423682588 */, 16 }, - /* 2152 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 16 }, - /* 2153 */ { MAD_F(0x06c98e3f) /* 0.424207923 */, 16 }, - /* 2154 */ { MAD_F(0x06caa1bd) /* 0.424470652 */, 16 }, - /* 2155 */ { MAD_F(0x06cbb545) /* 0.424733421 */, 16 }, - /* 2156 */ { MAD_F(0x06ccc8d9) /* 0.424996230 */, 16 }, - /* 2157 */ { MAD_F(0x06cddc77) /* 0.425259081 */, 16 }, - /* 2158 */ { MAD_F(0x06cef020) /* 0.425521972 */, 16 }, - /* 2159 */ { MAD_F(0x06d003d4) /* 0.425784903 */, 16 }, - - /* 2160 */ { MAD_F(0x06d11794) /* 0.426047876 */, 16 }, - /* 2161 */ { MAD_F(0x06d22b5e) /* 0.426310889 */, 16 }, - /* 2162 */ { MAD_F(0x06d33f32) /* 0.426573942 */, 16 }, - /* 2163 */ { MAD_F(0x06d45312) /* 0.426837036 */, 16 }, - /* 2164 */ { MAD_F(0x06d566fd) /* 0.427100170 */, 16 }, - /* 2165 */ { MAD_F(0x06d67af2) /* 0.427363345 */, 16 }, - /* 2166 */ { MAD_F(0x06d78ef3) /* 0.427626561 */, 16 }, - /* 2167 */ { MAD_F(0x06d8a2fe) /* 0.427889817 */, 16 }, - /* 2168 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 16 }, - /* 2169 */ { MAD_F(0x06dacb35) /* 0.428416451 */, 16 }, - /* 2170 */ { MAD_F(0x06dbdf61) /* 0.428679828 */, 16 }, - /* 2171 */ { MAD_F(0x06dcf398) /* 0.428943246 */, 16 }, - /* 2172 */ { MAD_F(0x06de07d9) /* 0.429206704 */, 16 }, - /* 2173 */ { MAD_F(0x06df1c26) /* 0.429470203 */, 16 }, - /* 2174 */ { MAD_F(0x06e0307d) /* 0.429733743 */, 16 }, - /* 2175 */ { MAD_F(0x06e144df) /* 0.429997322 */, 16 }, - - /* 2176 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 16 }, - /* 2177 */ { MAD_F(0x06e36dc4) /* 0.430524603 */, 16 }, - /* 2178 */ { MAD_F(0x06e48246) /* 0.430788304 */, 16 }, - /* 2179 */ { MAD_F(0x06e596d4) /* 0.431052045 */, 16 }, - /* 2180 */ { MAD_F(0x06e6ab6c) /* 0.431315826 */, 16 }, - /* 2181 */ { MAD_F(0x06e7c00f) /* 0.431579648 */, 16 }, - /* 2182 */ { MAD_F(0x06e8d4bd) /* 0.431843511 */, 16 }, - /* 2183 */ { MAD_F(0x06e9e976) /* 0.432107413 */, 16 }, - /* 2184 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 16 }, - /* 2185 */ { MAD_F(0x06ec1308) /* 0.432635339 */, 16 }, - /* 2186 */ { MAD_F(0x06ed27e2) /* 0.432899362 */, 16 }, - /* 2187 */ { MAD_F(0x06ee3cc6) /* 0.433163426 */, 16 }, - /* 2188 */ { MAD_F(0x06ef51b4) /* 0.433427530 */, 16 }, - /* 2189 */ { MAD_F(0x06f066ae) /* 0.433691674 */, 16 }, - /* 2190 */ { MAD_F(0x06f17bb3) /* 0.433955859 */, 16 }, - /* 2191 */ { MAD_F(0x06f290c2) /* 0.434220083 */, 16 }, - - /* 2192 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 16 }, - /* 2193 */ { MAD_F(0x06f4bb01) /* 0.434748653 */, 16 }, - /* 2194 */ { MAD_F(0x06f5d030) /* 0.435012998 */, 16 }, - /* 2195 */ { MAD_F(0x06f6e56b) /* 0.435277383 */, 16 }, - /* 2196 */ { MAD_F(0x06f7fab0) /* 0.435541809 */, 16 }, - /* 2197 */ { MAD_F(0x06f91000) /* 0.435806274 */, 16 }, - /* 2198 */ { MAD_F(0x06fa255a) /* 0.436070780 */, 16 }, - /* 2199 */ { MAD_F(0x06fb3ac0) /* 0.436335326 */, 16 }, - /* 2200 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 16 }, - /* 2201 */ { MAD_F(0x06fd65ab) /* 0.436864538 */, 16 }, - /* 2202 */ { MAD_F(0x06fe7b31) /* 0.437129204 */, 16 }, - /* 2203 */ { MAD_F(0x06ff90c2) /* 0.437393910 */, 16 }, - /* 2204 */ { MAD_F(0x0700a65d) /* 0.437658657 */, 16 }, - /* 2205 */ { MAD_F(0x0701bc03) /* 0.437923443 */, 16 }, - /* 2206 */ { MAD_F(0x0702d1b4) /* 0.438188269 */, 16 }, - /* 2207 */ { MAD_F(0x0703e76f) /* 0.438453136 */, 16 }, - - /* 2208 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 16 }, - /* 2209 */ { MAD_F(0x07061306) /* 0.438982988 */, 16 }, - /* 2210 */ { MAD_F(0x070728e2) /* 0.439247975 */, 16 }, - /* 2211 */ { MAD_F(0x07083ec9) /* 0.439513001 */, 16 }, - /* 2212 */ { MAD_F(0x070954ba) /* 0.439778067 */, 16 }, - /* 2213 */ { MAD_F(0x070a6ab6) /* 0.440043173 */, 16 }, - /* 2214 */ { MAD_F(0x070b80bc) /* 0.440308320 */, 16 }, - /* 2215 */ { MAD_F(0x070c96ce) /* 0.440573506 */, 16 }, - /* 2216 */ { MAD_F(0x070dacea) /* 0.440838732 */, 16 }, - /* 2217 */ { MAD_F(0x070ec310) /* 0.441103997 */, 16 }, - /* 2218 */ { MAD_F(0x070fd942) /* 0.441369303 */, 16 }, - /* 2219 */ { MAD_F(0x0710ef7e) /* 0.441634649 */, 16 }, - /* 2220 */ { MAD_F(0x071205c5) /* 0.441900034 */, 16 }, - /* 2221 */ { MAD_F(0x07131c17) /* 0.442165460 */, 16 }, - /* 2222 */ { MAD_F(0x07143273) /* 0.442430925 */, 16 }, - /* 2223 */ { MAD_F(0x071548da) /* 0.442696430 */, 16 }, - - /* 2224 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 16 }, - /* 2225 */ { MAD_F(0x071775c8) /* 0.443227559 */, 16 }, - /* 2226 */ { MAD_F(0x07188c4f) /* 0.443493184 */, 16 }, - /* 2227 */ { MAD_F(0x0719a2e0) /* 0.443758848 */, 16 }, - /* 2228 */ { MAD_F(0x071ab97d) /* 0.444024552 */, 16 }, - /* 2229 */ { MAD_F(0x071bd024) /* 0.444290296 */, 16 }, - /* 2230 */ { MAD_F(0x071ce6d6) /* 0.444556079 */, 16 }, - /* 2231 */ { MAD_F(0x071dfd92) /* 0.444821902 */, 16 }, - /* 2232 */ { MAD_F(0x071f1459) /* 0.445087765 */, 16 }, - /* 2233 */ { MAD_F(0x07202b2b) /* 0.445353668 */, 16 }, - /* 2234 */ { MAD_F(0x07214207) /* 0.445619610 */, 16 }, - /* 2235 */ { MAD_F(0x072258ee) /* 0.445885592 */, 16 }, - /* 2236 */ { MAD_F(0x07236fe0) /* 0.446151614 */, 16 }, - /* 2237 */ { MAD_F(0x072486dc) /* 0.446417675 */, 16 }, - /* 2238 */ { MAD_F(0x07259de3) /* 0.446683776 */, 16 }, - /* 2239 */ { MAD_F(0x0726b4f4) /* 0.446949917 */, 16 }, - - /* 2240 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 16 }, - /* 2241 */ { MAD_F(0x0728e338) /* 0.447482317 */, 16 }, - /* 2242 */ { MAD_F(0x0729fa69) /* 0.447748576 */, 16 }, - /* 2243 */ { MAD_F(0x072b11a5) /* 0.448014875 */, 16 }, - /* 2244 */ { MAD_F(0x072c28ec) /* 0.448281214 */, 16 }, - /* 2245 */ { MAD_F(0x072d403d) /* 0.448547592 */, 16 }, - /* 2246 */ { MAD_F(0x072e5799) /* 0.448814010 */, 16 }, - /* 2247 */ { MAD_F(0x072f6f00) /* 0.449080467 */, 16 }, - /* 2248 */ { MAD_F(0x07308671) /* 0.449346964 */, 16 }, - /* 2249 */ { MAD_F(0x07319ded) /* 0.449613501 */, 16 }, - /* 2250 */ { MAD_F(0x0732b573) /* 0.449880076 */, 16 }, - /* 2251 */ { MAD_F(0x0733cd04) /* 0.450146692 */, 16 }, - /* 2252 */ { MAD_F(0x0734e4a0) /* 0.450413347 */, 16 }, - /* 2253 */ { MAD_F(0x0735fc46) /* 0.450680041 */, 16 }, - /* 2254 */ { MAD_F(0x073713f7) /* 0.450946775 */, 16 }, - /* 2255 */ { MAD_F(0x07382bb2) /* 0.451213548 */, 16 }, - - /* 2256 */ { MAD_F(0x07394378) /* 0.451480360 */, 16 }, - /* 2257 */ { MAD_F(0x073a5b49) /* 0.451747213 */, 16 }, - /* 2258 */ { MAD_F(0x073b7324) /* 0.452014104 */, 16 }, - /* 2259 */ { MAD_F(0x073c8b0a) /* 0.452281035 */, 16 }, - /* 2260 */ { MAD_F(0x073da2fa) /* 0.452548005 */, 16 }, - /* 2261 */ { MAD_F(0x073ebaf5) /* 0.452815015 */, 16 }, - /* 2262 */ { MAD_F(0x073fd2fa) /* 0.453082064 */, 16 }, - /* 2263 */ { MAD_F(0x0740eb0a) /* 0.453349152 */, 16 }, - /* 2264 */ { MAD_F(0x07420325) /* 0.453616280 */, 16 }, - /* 2265 */ { MAD_F(0x07431b4a) /* 0.453883447 */, 16 }, - /* 2266 */ { MAD_F(0x0744337a) /* 0.454150653 */, 16 }, - /* 2267 */ { MAD_F(0x07454bb4) /* 0.454417899 */, 16 }, - /* 2268 */ { MAD_F(0x074663f8) /* 0.454685184 */, 16 }, - /* 2269 */ { MAD_F(0x07477c48) /* 0.454952508 */, 16 }, - /* 2270 */ { MAD_F(0x074894a2) /* 0.455219872 */, 16 }, - /* 2271 */ { MAD_F(0x0749ad06) /* 0.455487275 */, 16 }, - - /* 2272 */ { MAD_F(0x074ac575) /* 0.455754717 */, 16 }, - /* 2273 */ { MAD_F(0x074bddee) /* 0.456022198 */, 16 }, - /* 2274 */ { MAD_F(0x074cf672) /* 0.456289719 */, 16 }, - /* 2275 */ { MAD_F(0x074e0f01) /* 0.456557278 */, 16 }, - /* 2276 */ { MAD_F(0x074f279a) /* 0.456824877 */, 16 }, - /* 2277 */ { MAD_F(0x0750403e) /* 0.457092516 */, 16 }, - /* 2278 */ { MAD_F(0x075158ec) /* 0.457360193 */, 16 }, - /* 2279 */ { MAD_F(0x075271a4) /* 0.457627909 */, 16 }, - /* 2280 */ { MAD_F(0x07538a67) /* 0.457895665 */, 16 }, - /* 2281 */ { MAD_F(0x0754a335) /* 0.458163460 */, 16 }, - /* 2282 */ { MAD_F(0x0755bc0d) /* 0.458431294 */, 16 }, - /* 2283 */ { MAD_F(0x0756d4f0) /* 0.458699167 */, 16 }, - /* 2284 */ { MAD_F(0x0757eddd) /* 0.458967079 */, 16 }, - /* 2285 */ { MAD_F(0x075906d5) /* 0.459235030 */, 16 }, - /* 2286 */ { MAD_F(0x075a1fd7) /* 0.459503021 */, 16 }, - /* 2287 */ { MAD_F(0x075b38e3) /* 0.459771050 */, 16 }, - - /* 2288 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 16 }, - /* 2289 */ { MAD_F(0x075d6b1c) /* 0.460307226 */, 16 }, - /* 2290 */ { MAD_F(0x075e8448) /* 0.460575373 */, 16 }, - /* 2291 */ { MAD_F(0x075f9d7f) /* 0.460843559 */, 16 }, - /* 2292 */ { MAD_F(0x0760b6c0) /* 0.461111783 */, 16 }, - /* 2293 */ { MAD_F(0x0761d00b) /* 0.461380047 */, 16 }, - /* 2294 */ { MAD_F(0x0762e961) /* 0.461648350 */, 16 }, - /* 2295 */ { MAD_F(0x076402c1) /* 0.461916691 */, 16 }, - /* 2296 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 16 }, - /* 2297 */ { MAD_F(0x076635a2) /* 0.462453492 */, 16 }, - /* 2298 */ { MAD_F(0x07674f22) /* 0.462721950 */, 16 }, - /* 2299 */ { MAD_F(0x076868ac) /* 0.462990448 */, 16 }, - /* 2300 */ { MAD_F(0x07698240) /* 0.463258984 */, 16 }, - /* 2301 */ { MAD_F(0x076a9be0) /* 0.463527560 */, 16 }, - /* 2302 */ { MAD_F(0x076bb589) /* 0.463796174 */, 16 }, - /* 2303 */ { MAD_F(0x076ccf3d) /* 0.464064827 */, 16 }, - - /* 2304 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 16 }, - /* 2305 */ { MAD_F(0x076f02c5) /* 0.464602250 */, 16 }, - /* 2306 */ { MAD_F(0x07701c98) /* 0.464871020 */, 16 }, - /* 2307 */ { MAD_F(0x07713676) /* 0.465139829 */, 16 }, - /* 2308 */ { MAD_F(0x0772505e) /* 0.465408676 */, 16 }, - /* 2309 */ { MAD_F(0x07736a51) /* 0.465677563 */, 16 }, - /* 2310 */ { MAD_F(0x0774844e) /* 0.465946488 */, 16 }, - /* 2311 */ { MAD_F(0x07759e55) /* 0.466215452 */, 16 }, - /* 2312 */ { MAD_F(0x0776b867) /* 0.466484455 */, 16 }, - /* 2313 */ { MAD_F(0x0777d283) /* 0.466753496 */, 16 }, - /* 2314 */ { MAD_F(0x0778ecaa) /* 0.467022577 */, 16 }, - /* 2315 */ { MAD_F(0x077a06db) /* 0.467291696 */, 16 }, - /* 2316 */ { MAD_F(0x077b2117) /* 0.467560854 */, 16 }, - /* 2317 */ { MAD_F(0x077c3b5d) /* 0.467830050 */, 16 }, - /* 2318 */ { MAD_F(0x077d55ad) /* 0.468099285 */, 16 }, - /* 2319 */ { MAD_F(0x077e7008) /* 0.468368560 */, 16 }, - - /* 2320 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 16 }, - /* 2321 */ { MAD_F(0x0780a4dc) /* 0.468907224 */, 16 }, - /* 2322 */ { MAD_F(0x0781bf56) /* 0.469176614 */, 16 }, - /* 2323 */ { MAD_F(0x0782d9da) /* 0.469446043 */, 16 }, - /* 2324 */ { MAD_F(0x0783f469) /* 0.469715510 */, 16 }, - /* 2325 */ { MAD_F(0x07850f02) /* 0.469985016 */, 16 }, - /* 2326 */ { MAD_F(0x078629a5) /* 0.470254561 */, 16 }, - /* 2327 */ { MAD_F(0x07874453) /* 0.470524145 */, 16 }, - /* 2328 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 16 }, - /* 2329 */ { MAD_F(0x078979ce) /* 0.471063427 */, 16 }, - /* 2330 */ { MAD_F(0x078a949a) /* 0.471333126 */, 16 }, - /* 2331 */ { MAD_F(0x078baf72) /* 0.471602864 */, 16 }, - /* 2332 */ { MAD_F(0x078cca53) /* 0.471872641 */, 16 }, - /* 2333 */ { MAD_F(0x078de53f) /* 0.472142456 */, 16 }, - /* 2334 */ { MAD_F(0x078f0035) /* 0.472412309 */, 16 }, - /* 2335 */ { MAD_F(0x07901b36) /* 0.472682201 */, 16 }, - - /* 2336 */ { MAD_F(0x07913641) /* 0.472952132 */, 16 }, - /* 2337 */ { MAD_F(0x07925156) /* 0.473222101 */, 16 }, - /* 2338 */ { MAD_F(0x07936c76) /* 0.473492108 */, 16 }, - /* 2339 */ { MAD_F(0x079487a0) /* 0.473762155 */, 16 }, - /* 2340 */ { MAD_F(0x0795a2d4) /* 0.474032239 */, 16 }, - /* 2341 */ { MAD_F(0x0796be13) /* 0.474302362 */, 16 }, - /* 2342 */ { MAD_F(0x0797d95c) /* 0.474572524 */, 16 }, - /* 2343 */ { MAD_F(0x0798f4af) /* 0.474842724 */, 16 }, - /* 2344 */ { MAD_F(0x079a100c) /* 0.475112962 */, 16 }, - /* 2345 */ { MAD_F(0x079b2b74) /* 0.475383239 */, 16 }, - /* 2346 */ { MAD_F(0x079c46e7) /* 0.475653554 */, 16 }, - /* 2347 */ { MAD_F(0x079d6263) /* 0.475923908 */, 16 }, - /* 2348 */ { MAD_F(0x079e7dea) /* 0.476194300 */, 16 }, - /* 2349 */ { MAD_F(0x079f997b) /* 0.476464731 */, 16 }, - /* 2350 */ { MAD_F(0x07a0b516) /* 0.476735200 */, 16 }, - /* 2351 */ { MAD_F(0x07a1d0bc) /* 0.477005707 */, 16 }, - - /* 2352 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 16 }, - /* 2353 */ { MAD_F(0x07a40827) /* 0.477546836 */, 16 }, - /* 2354 */ { MAD_F(0x07a523eb) /* 0.477817459 */, 16 }, - /* 2355 */ { MAD_F(0x07a63fba) /* 0.478088119 */, 16 }, - /* 2356 */ { MAD_F(0x07a75b93) /* 0.478358818 */, 16 }, - /* 2357 */ { MAD_F(0x07a87777) /* 0.478629555 */, 16 }, - /* 2358 */ { MAD_F(0x07a99364) /* 0.478900331 */, 16 }, - /* 2359 */ { MAD_F(0x07aaaf5c) /* 0.479171145 */, 16 }, - /* 2360 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 16 }, - /* 2361 */ { MAD_F(0x07ace76b) /* 0.479712887 */, 16 }, - /* 2362 */ { MAD_F(0x07ae0382) /* 0.479983816 */, 16 }, - /* 2363 */ { MAD_F(0x07af1fa3) /* 0.480254782 */, 16 }, - /* 2364 */ { MAD_F(0x07b03bcf) /* 0.480525787 */, 16 }, - /* 2365 */ { MAD_F(0x07b15804) /* 0.480796831 */, 16 }, - /* 2366 */ { MAD_F(0x07b27444) /* 0.481067912 */, 16 }, - /* 2367 */ { MAD_F(0x07b3908e) /* 0.481339032 */, 16 }, - - /* 2368 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 16 }, - /* 2369 */ { MAD_F(0x07b5c941) /* 0.481881385 */, 16 }, - /* 2370 */ { MAD_F(0x07b6e5aa) /* 0.482152620 */, 16 }, - /* 2371 */ { MAD_F(0x07b8021d) /* 0.482423892 */, 16 }, - /* 2372 */ { MAD_F(0x07b91e9b) /* 0.482695202 */, 16 }, - /* 2373 */ { MAD_F(0x07ba3b22) /* 0.482966551 */, 16 }, - /* 2374 */ { MAD_F(0x07bb57b4) /* 0.483237938 */, 16 }, - /* 2375 */ { MAD_F(0x07bc7450) /* 0.483509362 */, 16 }, - /* 2376 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 16 }, - /* 2377 */ { MAD_F(0x07beada7) /* 0.484052326 */, 16 }, - /* 2378 */ { MAD_F(0x07bfca61) /* 0.484323865 */, 16 }, - /* 2379 */ { MAD_F(0x07c0e726) /* 0.484595443 */, 16 }, - /* 2380 */ { MAD_F(0x07c203f5) /* 0.484867058 */, 16 }, - /* 2381 */ { MAD_F(0x07c320cf) /* 0.485138711 */, 16 }, - /* 2382 */ { MAD_F(0x07c43db2) /* 0.485410402 */, 16 }, - /* 2383 */ { MAD_F(0x07c55aa0) /* 0.485682131 */, 16 }, - - /* 2384 */ { MAD_F(0x07c67798) /* 0.485953899 */, 16 }, - /* 2385 */ { MAD_F(0x07c7949a) /* 0.486225704 */, 16 }, - /* 2386 */ { MAD_F(0x07c8b1a7) /* 0.486497547 */, 16 }, - /* 2387 */ { MAD_F(0x07c9cebd) /* 0.486769429 */, 16 }, - /* 2388 */ { MAD_F(0x07caebde) /* 0.487041348 */, 16 }, - /* 2389 */ { MAD_F(0x07cc0909) /* 0.487313305 */, 16 }, - /* 2390 */ { MAD_F(0x07cd263e) /* 0.487585300 */, 16 }, - /* 2391 */ { MAD_F(0x07ce437d) /* 0.487857333 */, 16 }, - /* 2392 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 16 }, - /* 2393 */ { MAD_F(0x07d07e1b) /* 0.488401513 */, 16 }, - /* 2394 */ { MAD_F(0x07d19b79) /* 0.488673660 */, 16 }, - /* 2395 */ { MAD_F(0x07d2b8e1) /* 0.488945845 */, 16 }, - /* 2396 */ { MAD_F(0x07d3d653) /* 0.489218067 */, 16 }, - /* 2397 */ { MAD_F(0x07d4f3cf) /* 0.489490328 */, 16 }, - /* 2398 */ { MAD_F(0x07d61156) /* 0.489762626 */, 16 }, - /* 2399 */ { MAD_F(0x07d72ee6) /* 0.490034962 */, 16 }, - - /* 2400 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 16 }, - /* 2401 */ { MAD_F(0x07d96a26) /* 0.490579748 */, 16 }, - /* 2402 */ { MAD_F(0x07da87d5) /* 0.490852198 */, 16 }, - /* 2403 */ { MAD_F(0x07dba58f) /* 0.491124686 */, 16 }, - /* 2404 */ { MAD_F(0x07dcc352) /* 0.491397211 */, 16 }, - /* 2405 */ { MAD_F(0x07dde120) /* 0.491669774 */, 16 }, - /* 2406 */ { MAD_F(0x07defef7) /* 0.491942375 */, 16 }, - /* 2407 */ { MAD_F(0x07e01cd9) /* 0.492215014 */, 16 }, - /* 2408 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 16 }, - /* 2409 */ { MAD_F(0x07e258bc) /* 0.492760404 */, 16 }, - /* 2410 */ { MAD_F(0x07e376bc) /* 0.493033156 */, 16 }, - /* 2411 */ { MAD_F(0x07e494c6) /* 0.493305946 */, 16 }, - /* 2412 */ { MAD_F(0x07e5b2db) /* 0.493578773 */, 16 }, - /* 2413 */ { MAD_F(0x07e6d0f9) /* 0.493851638 */, 16 }, - /* 2414 */ { MAD_F(0x07e7ef22) /* 0.494124541 */, 16 }, - /* 2415 */ { MAD_F(0x07e90d55) /* 0.494397481 */, 16 }, - - /* 2416 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 16 }, - /* 2417 */ { MAD_F(0x07eb49d9) /* 0.494943475 */, 16 }, - /* 2418 */ { MAD_F(0x07ec682a) /* 0.495216529 */, 16 }, - /* 2419 */ { MAD_F(0x07ed8686) /* 0.495489620 */, 16 }, - /* 2420 */ { MAD_F(0x07eea4eb) /* 0.495762748 */, 16 }, - /* 2421 */ { MAD_F(0x07efc35b) /* 0.496035915 */, 16 }, - /* 2422 */ { MAD_F(0x07f0e1d4) /* 0.496309119 */, 16 }, - /* 2423 */ { MAD_F(0x07f20058) /* 0.496582360 */, 16 }, - /* 2424 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 16 }, - /* 2425 */ { MAD_F(0x07f43d7e) /* 0.497128956 */, 16 }, - /* 2426 */ { MAD_F(0x07f55c20) /* 0.497402310 */, 16 }, - /* 2427 */ { MAD_F(0x07f67acc) /* 0.497675702 */, 16 }, - /* 2428 */ { MAD_F(0x07f79982) /* 0.497949132 */, 16 }, - /* 2429 */ { MAD_F(0x07f8b842) /* 0.498222598 */, 16 }, - /* 2430 */ { MAD_F(0x07f9d70c) /* 0.498496103 */, 16 }, - /* 2431 */ { MAD_F(0x07faf5e1) /* 0.498769645 */, 16 }, - - /* 2432 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 16 }, - /* 2433 */ { MAD_F(0x07fd33a8) /* 0.499316841 */, 16 }, - /* 2434 */ { MAD_F(0x07fe529a) /* 0.499590496 */, 16 }, - /* 2435 */ { MAD_F(0x07ff7197) /* 0.499864188 */, 16 }, - /* 2436 */ { MAD_F(0x0400484f) /* 0.250068959 */, 17 }, - /* 2437 */ { MAD_F(0x0400d7d7) /* 0.250205842 */, 17 }, - /* 2438 */ { MAD_F(0x04016764) /* 0.250342744 */, 17 }, - /* 2439 */ { MAD_F(0x0401f6f7) /* 0.250479665 */, 17 }, - /* 2440 */ { MAD_F(0x0402868e) /* 0.250616605 */, 17 }, - /* 2441 */ { MAD_F(0x0403162b) /* 0.250753563 */, 17 }, - /* 2442 */ { MAD_F(0x0403a5cc) /* 0.250890540 */, 17 }, - /* 2443 */ { MAD_F(0x04043573) /* 0.251027536 */, 17 }, - /* 2444 */ { MAD_F(0x0404c51e) /* 0.251164550 */, 17 }, - /* 2445 */ { MAD_F(0x040554cf) /* 0.251301583 */, 17 }, - /* 2446 */ { MAD_F(0x0405e484) /* 0.251438635 */, 17 }, - /* 2447 */ { MAD_F(0x0406743f) /* 0.251575706 */, 17 }, - - /* 2448 */ { MAD_F(0x040703ff) /* 0.251712795 */, 17 }, - /* 2449 */ { MAD_F(0x040793c3) /* 0.251849903 */, 17 }, - /* 2450 */ { MAD_F(0x0408238d) /* 0.251987029 */, 17 }, - /* 2451 */ { MAD_F(0x0408b35b) /* 0.252124174 */, 17 }, - /* 2452 */ { MAD_F(0x0409432f) /* 0.252261338 */, 17 }, - /* 2453 */ { MAD_F(0x0409d308) /* 0.252398520 */, 17 }, - /* 2454 */ { MAD_F(0x040a62e5) /* 0.252535721 */, 17 }, - /* 2455 */ { MAD_F(0x040af2c8) /* 0.252672941 */, 17 }, - /* 2456 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 17 }, - /* 2457 */ { MAD_F(0x040c129c) /* 0.252947436 */, 17 }, - /* 2458 */ { MAD_F(0x040ca28e) /* 0.253084712 */, 17 }, - /* 2459 */ { MAD_F(0x040d3284) /* 0.253222006 */, 17 }, - /* 2460 */ { MAD_F(0x040dc280) /* 0.253359319 */, 17 }, - /* 2461 */ { MAD_F(0x040e5281) /* 0.253496651 */, 17 }, - /* 2462 */ { MAD_F(0x040ee286) /* 0.253634001 */, 17 }, - /* 2463 */ { MAD_F(0x040f7291) /* 0.253771369 */, 17 }, - - /* 2464 */ { MAD_F(0x041002a1) /* 0.253908756 */, 17 }, - /* 2465 */ { MAD_F(0x041092b5) /* 0.254046162 */, 17 }, - /* 2466 */ { MAD_F(0x041122cf) /* 0.254183587 */, 17 }, - /* 2467 */ { MAD_F(0x0411b2ed) /* 0.254321030 */, 17 }, - /* 2468 */ { MAD_F(0x04124311) /* 0.254458491 */, 17 }, - /* 2469 */ { MAD_F(0x0412d339) /* 0.254595971 */, 17 }, - /* 2470 */ { MAD_F(0x04136367) /* 0.254733470 */, 17 }, - /* 2471 */ { MAD_F(0x0413f399) /* 0.254870987 */, 17 }, - /* 2472 */ { MAD_F(0x041483d1) /* 0.255008523 */, 17 }, - /* 2473 */ { MAD_F(0x0415140d) /* 0.255146077 */, 17 }, - /* 2474 */ { MAD_F(0x0415a44f) /* 0.255283650 */, 17 }, - /* 2475 */ { MAD_F(0x04163495) /* 0.255421241 */, 17 }, - /* 2476 */ { MAD_F(0x0416c4e1) /* 0.255558851 */, 17 }, - /* 2477 */ { MAD_F(0x04175531) /* 0.255696480 */, 17 }, - /* 2478 */ { MAD_F(0x0417e586) /* 0.255834127 */, 17 }, - /* 2479 */ { MAD_F(0x041875e1) /* 0.255971792 */, 17 }, - - /* 2480 */ { MAD_F(0x04190640) /* 0.256109476 */, 17 }, - /* 2481 */ { MAD_F(0x041996a4) /* 0.256247179 */, 17 }, - /* 2482 */ { MAD_F(0x041a270d) /* 0.256384900 */, 17 }, - /* 2483 */ { MAD_F(0x041ab77b) /* 0.256522639 */, 17 }, - /* 2484 */ { MAD_F(0x041b47ef) /* 0.256660397 */, 17 }, - /* 2485 */ { MAD_F(0x041bd867) /* 0.256798174 */, 17 }, - /* 2486 */ { MAD_F(0x041c68e4) /* 0.256935969 */, 17 }, - /* 2487 */ { MAD_F(0x041cf966) /* 0.257073782 */, 17 }, - /* 2488 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 17 }, - /* 2489 */ { MAD_F(0x041e1a79) /* 0.257349465 */, 17 }, - /* 2490 */ { MAD_F(0x041eab0a) /* 0.257487334 */, 17 }, - /* 2491 */ { MAD_F(0x041f3b9f) /* 0.257625221 */, 17 }, - /* 2492 */ { MAD_F(0x041fcc3a) /* 0.257763127 */, 17 }, - /* 2493 */ { MAD_F(0x04205cda) /* 0.257901051 */, 17 }, - /* 2494 */ { MAD_F(0x0420ed7f) /* 0.258038994 */, 17 }, - /* 2495 */ { MAD_F(0x04217e28) /* 0.258176955 */, 17 }, - - /* 2496 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 17 }, - /* 2497 */ { MAD_F(0x04229f8a) /* 0.258452932 */, 17 }, - /* 2498 */ { MAD_F(0x04233043) /* 0.258590948 */, 17 }, - /* 2499 */ { MAD_F(0x0423c100) /* 0.258728983 */, 17 }, - /* 2500 */ { MAD_F(0x042451c3) /* 0.258867036 */, 17 }, - /* 2501 */ { MAD_F(0x0424e28a) /* 0.259005108 */, 17 }, - /* 2502 */ { MAD_F(0x04257356) /* 0.259143198 */, 17 }, - /* 2503 */ { MAD_F(0x04260428) /* 0.259281307 */, 17 }, - /* 2504 */ { MAD_F(0x042694fe) /* 0.259419433 */, 17 }, - /* 2505 */ { MAD_F(0x042725d9) /* 0.259557579 */, 17 }, - /* 2506 */ { MAD_F(0x0427b6b9) /* 0.259695742 */, 17 }, - /* 2507 */ { MAD_F(0x0428479e) /* 0.259833924 */, 17 }, - /* 2508 */ { MAD_F(0x0428d888) /* 0.259972124 */, 17 }, - /* 2509 */ { MAD_F(0x04296976) /* 0.260110343 */, 17 }, - /* 2510 */ { MAD_F(0x0429fa6a) /* 0.260248580 */, 17 }, - /* 2511 */ { MAD_F(0x042a8b63) /* 0.260386836 */, 17 }, - - /* 2512 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 17 }, - /* 2513 */ { MAD_F(0x042bad63) /* 0.260663402 */, 17 }, - /* 2514 */ { MAD_F(0x042c3e6a) /* 0.260801712 */, 17 }, - /* 2515 */ { MAD_F(0x042ccf77) /* 0.260940041 */, 17 }, - /* 2516 */ { MAD_F(0x042d6088) /* 0.261078388 */, 17 }, - /* 2517 */ { MAD_F(0x042df19e) /* 0.261216754 */, 17 }, - /* 2518 */ { MAD_F(0x042e82b9) /* 0.261355137 */, 17 }, - /* 2519 */ { MAD_F(0x042f13d9) /* 0.261493540 */, 17 }, - /* 2520 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 17 }, - /* 2521 */ { MAD_F(0x04303628) /* 0.261770399 */, 17 }, - /* 2522 */ { MAD_F(0x0430c757) /* 0.261908856 */, 17 }, - /* 2523 */ { MAD_F(0x0431588b) /* 0.262047331 */, 17 }, - /* 2524 */ { MAD_F(0x0431e9c3) /* 0.262185825 */, 17 }, - /* 2525 */ { MAD_F(0x04327b01) /* 0.262324337 */, 17 }, - /* 2526 */ { MAD_F(0x04330c43) /* 0.262462867 */, 17 }, - /* 2527 */ { MAD_F(0x04339d8a) /* 0.262601416 */, 17 }, - - /* 2528 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 17 }, - /* 2529 */ { MAD_F(0x0434c028) /* 0.262878568 */, 17 }, - /* 2530 */ { MAD_F(0x0435517e) /* 0.263017171 */, 17 }, - /* 2531 */ { MAD_F(0x0435e2d9) /* 0.263155792 */, 17 }, - /* 2532 */ { MAD_F(0x04367439) /* 0.263294432 */, 17 }, - /* 2533 */ { MAD_F(0x0437059e) /* 0.263433090 */, 17 }, - /* 2534 */ { MAD_F(0x04379707) /* 0.263571767 */, 17 }, - /* 2535 */ { MAD_F(0x04382876) /* 0.263710461 */, 17 }, - /* 2536 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 17 }, - /* 2537 */ { MAD_F(0x04394b61) /* 0.263987905 */, 17 }, - /* 2538 */ { MAD_F(0x0439dcdf) /* 0.264126655 */, 17 }, - /* 2539 */ { MAD_F(0x043a6e61) /* 0.264265422 */, 17 }, - /* 2540 */ { MAD_F(0x043affe8) /* 0.264404208 */, 17 }, - /* 2541 */ { MAD_F(0x043b9174) /* 0.264543012 */, 17 }, - /* 2542 */ { MAD_F(0x043c2305) /* 0.264681834 */, 17 }, - /* 2543 */ { MAD_F(0x043cb49a) /* 0.264820674 */, 17 }, - - /* 2544 */ { MAD_F(0x043d4635) /* 0.264959533 */, 17 }, - /* 2545 */ { MAD_F(0x043dd7d4) /* 0.265098410 */, 17 }, - /* 2546 */ { MAD_F(0x043e6979) /* 0.265237305 */, 17 }, - /* 2547 */ { MAD_F(0x043efb22) /* 0.265376218 */, 17 }, - /* 2548 */ { MAD_F(0x043f8cd0) /* 0.265515149 */, 17 }, - /* 2549 */ { MAD_F(0x04401e83) /* 0.265654099 */, 17 }, - /* 2550 */ { MAD_F(0x0440b03b) /* 0.265793066 */, 17 }, - /* 2551 */ { MAD_F(0x044141f7) /* 0.265932052 */, 17 }, - /* 2552 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 17 }, - /* 2553 */ { MAD_F(0x04426580) /* 0.266210078 */, 17 }, - /* 2554 */ { MAD_F(0x0442f74b) /* 0.266349119 */, 17 }, - /* 2555 */ { MAD_F(0x0443891b) /* 0.266488177 */, 17 }, - /* 2556 */ { MAD_F(0x04441af0) /* 0.266627254 */, 17 }, - /* 2557 */ { MAD_F(0x0444acca) /* 0.266766349 */, 17 }, - /* 2558 */ { MAD_F(0x04453ea9) /* 0.266905462 */, 17 }, - /* 2559 */ { MAD_F(0x0445d08d) /* 0.267044593 */, 17 }, - - /* 2560 */ { MAD_F(0x04466275) /* 0.267183742 */, 17 }, - /* 2561 */ { MAD_F(0x0446f463) /* 0.267322909 */, 17 }, - /* 2562 */ { MAD_F(0x04478655) /* 0.267462094 */, 17 }, - /* 2563 */ { MAD_F(0x0448184c) /* 0.267601298 */, 17 }, - /* 2564 */ { MAD_F(0x0448aa48) /* 0.267740519 */, 17 }, - /* 2565 */ { MAD_F(0x04493c49) /* 0.267879759 */, 17 }, - /* 2566 */ { MAD_F(0x0449ce4f) /* 0.268019017 */, 17 }, - /* 2567 */ { MAD_F(0x044a6059) /* 0.268158293 */, 17 }, - /* 2568 */ { MAD_F(0x044af269) /* 0.268297587 */, 17 }, - /* 2569 */ { MAD_F(0x044b847d) /* 0.268436899 */, 17 }, - /* 2570 */ { MAD_F(0x044c1696) /* 0.268576229 */, 17 }, - /* 2571 */ { MAD_F(0x044ca8b4) /* 0.268715577 */, 17 }, - /* 2572 */ { MAD_F(0x044d3ad7) /* 0.268854943 */, 17 }, - /* 2573 */ { MAD_F(0x044dccff) /* 0.268994328 */, 17 }, - /* 2574 */ { MAD_F(0x044e5f2b) /* 0.269133730 */, 17 }, - /* 2575 */ { MAD_F(0x044ef15d) /* 0.269273150 */, 17 }, - - /* 2576 */ { MAD_F(0x044f8393) /* 0.269412589 */, 17 }, - /* 2577 */ { MAD_F(0x045015ce) /* 0.269552045 */, 17 }, - /* 2578 */ { MAD_F(0x0450a80e) /* 0.269691520 */, 17 }, - /* 2579 */ { MAD_F(0x04513a53) /* 0.269831013 */, 17 }, - /* 2580 */ { MAD_F(0x0451cc9c) /* 0.269970523 */, 17 }, - /* 2581 */ { MAD_F(0x04525eeb) /* 0.270110052 */, 17 }, - /* 2582 */ { MAD_F(0x0452f13e) /* 0.270249599 */, 17 }, - /* 2583 */ { MAD_F(0x04538396) /* 0.270389163 */, 17 }, - /* 2584 */ { MAD_F(0x045415f3) /* 0.270528746 */, 17 }, - /* 2585 */ { MAD_F(0x0454a855) /* 0.270668347 */, 17 }, - /* 2586 */ { MAD_F(0x04553abb) /* 0.270807965 */, 17 }, - /* 2587 */ { MAD_F(0x0455cd27) /* 0.270947602 */, 17 }, - /* 2588 */ { MAD_F(0x04565f97) /* 0.271087257 */, 17 }, - /* 2589 */ { MAD_F(0x0456f20c) /* 0.271226930 */, 17 }, - /* 2590 */ { MAD_F(0x04578486) /* 0.271366620 */, 17 }, - /* 2591 */ { MAD_F(0x04581705) /* 0.271506329 */, 17 }, - - /* 2592 */ { MAD_F(0x0458a989) /* 0.271646056 */, 17 }, - /* 2593 */ { MAD_F(0x04593c11) /* 0.271785800 */, 17 }, - /* 2594 */ { MAD_F(0x0459ce9e) /* 0.271925563 */, 17 }, - /* 2595 */ { MAD_F(0x045a6130) /* 0.272065343 */, 17 }, - /* 2596 */ { MAD_F(0x045af3c7) /* 0.272205142 */, 17 }, - /* 2597 */ { MAD_F(0x045b8663) /* 0.272344958 */, 17 }, - /* 2598 */ { MAD_F(0x045c1903) /* 0.272484793 */, 17 }, - /* 2599 */ { MAD_F(0x045caba9) /* 0.272624645 */, 17 }, - /* 2600 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 17 }, - /* 2601 */ { MAD_F(0x045dd102) /* 0.272904403 */, 17 }, - /* 2602 */ { MAD_F(0x045e63b6) /* 0.273044310 */, 17 }, - /* 2603 */ { MAD_F(0x045ef66e) /* 0.273184234 */, 17 }, - /* 2604 */ { MAD_F(0x045f892b) /* 0.273324176 */, 17 }, - /* 2605 */ { MAD_F(0x04601bee) /* 0.273464136 */, 17 }, - /* 2606 */ { MAD_F(0x0460aeb5) /* 0.273604113 */, 17 }, - /* 2607 */ { MAD_F(0x04614180) /* 0.273744109 */, 17 }, - - /* 2608 */ { MAD_F(0x0461d451) /* 0.273884123 */, 17 }, - /* 2609 */ { MAD_F(0x04626727) /* 0.274024154 */, 17 }, - /* 2610 */ { MAD_F(0x0462fa01) /* 0.274164204 */, 17 }, - /* 2611 */ { MAD_F(0x04638ce0) /* 0.274304271 */, 17 }, - /* 2612 */ { MAD_F(0x04641fc4) /* 0.274444356 */, 17 }, - /* 2613 */ { MAD_F(0x0464b2ac) /* 0.274584459 */, 17 }, - /* 2614 */ { MAD_F(0x0465459a) /* 0.274724580 */, 17 }, - /* 2615 */ { MAD_F(0x0465d88c) /* 0.274864719 */, 17 }, - /* 2616 */ { MAD_F(0x04666b83) /* 0.275004875 */, 17 }, - /* 2617 */ { MAD_F(0x0466fe7f) /* 0.275145050 */, 17 }, - /* 2618 */ { MAD_F(0x0467917f) /* 0.275285242 */, 17 }, - /* 2619 */ { MAD_F(0x04682485) /* 0.275425452 */, 17 }, - /* 2620 */ { MAD_F(0x0468b78f) /* 0.275565681 */, 17 }, - /* 2621 */ { MAD_F(0x04694a9e) /* 0.275705926 */, 17 }, - /* 2622 */ { MAD_F(0x0469ddb2) /* 0.275846190 */, 17 }, - /* 2623 */ { MAD_F(0x046a70ca) /* 0.275986472 */, 17 }, - - /* 2624 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 17 }, - /* 2625 */ { MAD_F(0x046b970a) /* 0.276267088 */, 17 }, - /* 2626 */ { MAD_F(0x046c2a31) /* 0.276407423 */, 17 }, - /* 2627 */ { MAD_F(0x046cbd5c) /* 0.276547776 */, 17 }, - /* 2628 */ { MAD_F(0x046d508d) /* 0.276688147 */, 17 }, - /* 2629 */ { MAD_F(0x046de3c2) /* 0.276828535 */, 17 }, - /* 2630 */ { MAD_F(0x046e76fc) /* 0.276968942 */, 17 }, - /* 2631 */ { MAD_F(0x046f0a3b) /* 0.277109366 */, 17 }, - /* 2632 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 17 }, - /* 2633 */ { MAD_F(0x047030c7) /* 0.277390267 */, 17 }, - /* 2634 */ { MAD_F(0x0470c414) /* 0.277530745 */, 17 }, - /* 2635 */ { MAD_F(0x04715766) /* 0.277671240 */, 17 }, - /* 2636 */ { MAD_F(0x0471eabc) /* 0.277811753 */, 17 }, - /* 2637 */ { MAD_F(0x04727e18) /* 0.277952284 */, 17 }, - /* 2638 */ { MAD_F(0x04731178) /* 0.278092832 */, 17 }, - /* 2639 */ { MAD_F(0x0473a4dd) /* 0.278233399 */, 17 }, - - /* 2640 */ { MAD_F(0x04743847) /* 0.278373983 */, 17 }, - /* 2641 */ { MAD_F(0x0474cbb5) /* 0.278514584 */, 17 }, - /* 2642 */ { MAD_F(0x04755f29) /* 0.278655204 */, 17 }, - /* 2643 */ { MAD_F(0x0475f2a1) /* 0.278795841 */, 17 }, - /* 2644 */ { MAD_F(0x0476861d) /* 0.278936496 */, 17 }, - /* 2645 */ { MAD_F(0x0477199f) /* 0.279077169 */, 17 }, - /* 2646 */ { MAD_F(0x0477ad25) /* 0.279217860 */, 17 }, - /* 2647 */ { MAD_F(0x047840b0) /* 0.279358568 */, 17 }, - /* 2648 */ { MAD_F(0x0478d440) /* 0.279499294 */, 17 }, - /* 2649 */ { MAD_F(0x047967d5) /* 0.279640037 */, 17 }, - /* 2650 */ { MAD_F(0x0479fb6e) /* 0.279780799 */, 17 }, - /* 2651 */ { MAD_F(0x047a8f0c) /* 0.279921578 */, 17 }, - /* 2652 */ { MAD_F(0x047b22af) /* 0.280062375 */, 17 }, - /* 2653 */ { MAD_F(0x047bb657) /* 0.280203189 */, 17 }, - /* 2654 */ { MAD_F(0x047c4a03) /* 0.280344021 */, 17 }, - /* 2655 */ { MAD_F(0x047cddb4) /* 0.280484871 */, 17 }, - - /* 2656 */ { MAD_F(0x047d716a) /* 0.280625739 */, 17 }, - /* 2657 */ { MAD_F(0x047e0524) /* 0.280766624 */, 17 }, - /* 2658 */ { MAD_F(0x047e98e4) /* 0.280907527 */, 17 }, - /* 2659 */ { MAD_F(0x047f2ca8) /* 0.281048447 */, 17 }, - /* 2660 */ { MAD_F(0x047fc071) /* 0.281189385 */, 17 }, - /* 2661 */ { MAD_F(0x0480543e) /* 0.281330341 */, 17 }, - /* 2662 */ { MAD_F(0x0480e811) /* 0.281471315 */, 17 }, - /* 2663 */ { MAD_F(0x04817be8) /* 0.281612306 */, 17 }, - /* 2664 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 17 }, - /* 2665 */ { MAD_F(0x0482a3a4) /* 0.281894341 */, 17 }, - /* 2666 */ { MAD_F(0x04833789) /* 0.282035386 */, 17 }, - /* 2667 */ { MAD_F(0x0483cb73) /* 0.282176447 */, 17 }, - /* 2668 */ { MAD_F(0x04845f62) /* 0.282317527 */, 17 }, - /* 2669 */ { MAD_F(0x0484f355) /* 0.282458624 */, 17 }, - /* 2670 */ { MAD_F(0x0485874d) /* 0.282599738 */, 17 }, - /* 2671 */ { MAD_F(0x04861b4a) /* 0.282740871 */, 17 }, - - /* 2672 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 17 }, - /* 2673 */ { MAD_F(0x04874352) /* 0.283023188 */, 17 }, - /* 2674 */ { MAD_F(0x0487d75d) /* 0.283164373 */, 17 }, - /* 2675 */ { MAD_F(0x04886b6d) /* 0.283305576 */, 17 }, - /* 2676 */ { MAD_F(0x0488ff82) /* 0.283446796 */, 17 }, - /* 2677 */ { MAD_F(0x0489939b) /* 0.283588034 */, 17 }, - /* 2678 */ { MAD_F(0x048a27b9) /* 0.283729290 */, 17 }, - /* 2679 */ { MAD_F(0x048abbdc) /* 0.283870563 */, 17 }, - /* 2680 */ { MAD_F(0x048b5003) /* 0.284011853 */, 17 }, - /* 2681 */ { MAD_F(0x048be42f) /* 0.284153161 */, 17 }, - /* 2682 */ { MAD_F(0x048c7860) /* 0.284294487 */, 17 }, - /* 2683 */ { MAD_F(0x048d0c96) /* 0.284435831 */, 17 }, - /* 2684 */ { MAD_F(0x048da0d0) /* 0.284577192 */, 17 }, - /* 2685 */ { MAD_F(0x048e350f) /* 0.284718570 */, 17 }, - /* 2686 */ { MAD_F(0x048ec953) /* 0.284859966 */, 17 }, - /* 2687 */ { MAD_F(0x048f5d9b) /* 0.285001380 */, 17 }, - - /* 2688 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 17 }, - /* 2689 */ { MAD_F(0x0490863a) /* 0.285284259 */, 17 }, - /* 2690 */ { MAD_F(0x04911a91) /* 0.285425726 */, 17 }, - /* 2691 */ { MAD_F(0x0491aeec) /* 0.285567209 */, 17 }, - /* 2692 */ { MAD_F(0x0492434c) /* 0.285708711 */, 17 }, - /* 2693 */ { MAD_F(0x0492d7b0) /* 0.285850229 */, 17 }, - /* 2694 */ { MAD_F(0x04936c1a) /* 0.285991766 */, 17 }, - /* 2695 */ { MAD_F(0x04940088) /* 0.286133319 */, 17 }, - /* 2696 */ { MAD_F(0x049494fb) /* 0.286274891 */, 17 }, - /* 2697 */ { MAD_F(0x04952972) /* 0.286416480 */, 17 }, - /* 2698 */ { MAD_F(0x0495bdee) /* 0.286558086 */, 17 }, - /* 2699 */ { MAD_F(0x0496526f) /* 0.286699710 */, 17 }, - /* 2700 */ { MAD_F(0x0496e6f5) /* 0.286841351 */, 17 }, - /* 2701 */ { MAD_F(0x04977b7f) /* 0.286983010 */, 17 }, - /* 2702 */ { MAD_F(0x0498100e) /* 0.287124686 */, 17 }, - /* 2703 */ { MAD_F(0x0498a4a1) /* 0.287266380 */, 17 }, - - /* 2704 */ { MAD_F(0x0499393a) /* 0.287408091 */, 17 }, - /* 2705 */ { MAD_F(0x0499cdd7) /* 0.287549820 */, 17 }, - /* 2706 */ { MAD_F(0x049a6278) /* 0.287691566 */, 17 }, - /* 2707 */ { MAD_F(0x049af71f) /* 0.287833330 */, 17 }, - /* 2708 */ { MAD_F(0x049b8bca) /* 0.287975111 */, 17 }, - /* 2709 */ { MAD_F(0x049c207a) /* 0.288116909 */, 17 }, - /* 2710 */ { MAD_F(0x049cb52e) /* 0.288258725 */, 17 }, - /* 2711 */ { MAD_F(0x049d49e7) /* 0.288400559 */, 17 }, - /* 2712 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 17 }, - /* 2713 */ { MAD_F(0x049e7367) /* 0.288684278 */, 17 }, - /* 2714 */ { MAD_F(0x049f082f) /* 0.288826163 */, 17 }, - /* 2715 */ { MAD_F(0x049f9cfa) /* 0.288968067 */, 17 }, - /* 2716 */ { MAD_F(0x04a031cb) /* 0.289109987 */, 17 }, - /* 2717 */ { MAD_F(0x04a0c6a0) /* 0.289251925 */, 17 }, - /* 2718 */ { MAD_F(0x04a15b7a) /* 0.289393881 */, 17 }, - /* 2719 */ { MAD_F(0x04a1f059) /* 0.289535854 */, 17 }, - - /* 2720 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 17 }, - /* 2721 */ { MAD_F(0x04a31a24) /* 0.289819851 */, 17 }, - /* 2722 */ { MAD_F(0x04a3af10) /* 0.289961876 */, 17 }, - /* 2723 */ { MAD_F(0x04a44401) /* 0.290103919 */, 17 }, - /* 2724 */ { MAD_F(0x04a4d8f7) /* 0.290245979 */, 17 }, - /* 2725 */ { MAD_F(0x04a56df2) /* 0.290388056 */, 17 }, - /* 2726 */ { MAD_F(0x04a602f1) /* 0.290530150 */, 17 }, - /* 2727 */ { MAD_F(0x04a697f5) /* 0.290672262 */, 17 }, - /* 2728 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 17 }, - /* 2729 */ { MAD_F(0x04a7c20b) /* 0.290956538 */, 17 }, - /* 2730 */ { MAD_F(0x04a8571d) /* 0.291098703 */, 17 }, - /* 2731 */ { MAD_F(0x04a8ec33) /* 0.291240884 */, 17 }, - /* 2732 */ { MAD_F(0x04a9814e) /* 0.291383083 */, 17 }, - /* 2733 */ { MAD_F(0x04aa166e) /* 0.291525299 */, 17 }, - /* 2734 */ { MAD_F(0x04aaab93) /* 0.291667532 */, 17 }, - /* 2735 */ { MAD_F(0x04ab40bc) /* 0.291809783 */, 17 }, - - /* 2736 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 17 }, - /* 2737 */ { MAD_F(0x04ac6b1c) /* 0.292094337 */, 17 }, - /* 2738 */ { MAD_F(0x04ad0053) /* 0.292236640 */, 17 }, - /* 2739 */ { MAD_F(0x04ad958f) /* 0.292378960 */, 17 }, - /* 2740 */ { MAD_F(0x04ae2ad0) /* 0.292521297 */, 17 }, - /* 2741 */ { MAD_F(0x04aec015) /* 0.292663652 */, 17 }, - /* 2742 */ { MAD_F(0x04af555e) /* 0.292806024 */, 17 }, - /* 2743 */ { MAD_F(0x04afeaad) /* 0.292948414 */, 17 }, - /* 2744 */ { MAD_F(0x04b08000) /* 0.293090820 */, 17 }, - /* 2745 */ { MAD_F(0x04b11557) /* 0.293233244 */, 17 }, - /* 2746 */ { MAD_F(0x04b1aab4) /* 0.293375686 */, 17 }, - /* 2747 */ { MAD_F(0x04b24015) /* 0.293518144 */, 17 }, - /* 2748 */ { MAD_F(0x04b2d57a) /* 0.293660620 */, 17 }, - /* 2749 */ { MAD_F(0x04b36ae4) /* 0.293803113 */, 17 }, - /* 2750 */ { MAD_F(0x04b40053) /* 0.293945624 */, 17 }, - /* 2751 */ { MAD_F(0x04b495c7) /* 0.294088151 */, 17 }, - - /* 2752 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 17 }, - /* 2753 */ { MAD_F(0x04b5c0bc) /* 0.294373259 */, 17 }, - /* 2754 */ { MAD_F(0x04b6563d) /* 0.294515838 */, 17 }, - /* 2755 */ { MAD_F(0x04b6ebc3) /* 0.294658435 */, 17 }, - /* 2756 */ { MAD_F(0x04b7814e) /* 0.294801049 */, 17 }, - /* 2757 */ { MAD_F(0x04b816dd) /* 0.294943680 */, 17 }, - /* 2758 */ { MAD_F(0x04b8ac71) /* 0.295086329 */, 17 }, - /* 2759 */ { MAD_F(0x04b9420a) /* 0.295228995 */, 17 }, - /* 2760 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 17 }, - /* 2761 */ { MAD_F(0x04ba6d49) /* 0.295514378 */, 17 }, - /* 2762 */ { MAD_F(0x04bb02ef) /* 0.295657095 */, 17 }, - /* 2763 */ { MAD_F(0x04bb989a) /* 0.295799830 */, 17 }, - /* 2764 */ { MAD_F(0x04bc2e4a) /* 0.295942582 */, 17 }, - /* 2765 */ { MAD_F(0x04bcc3fe) /* 0.296085351 */, 17 }, - /* 2766 */ { MAD_F(0x04bd59b7) /* 0.296228138 */, 17 }, - /* 2767 */ { MAD_F(0x04bdef74) /* 0.296370941 */, 17 }, - - /* 2768 */ { MAD_F(0x04be8537) /* 0.296513762 */, 17 }, - /* 2769 */ { MAD_F(0x04bf1afd) /* 0.296656600 */, 17 }, - /* 2770 */ { MAD_F(0x04bfb0c9) /* 0.296799455 */, 17 }, - /* 2771 */ { MAD_F(0x04c04699) /* 0.296942327 */, 17 }, - /* 2772 */ { MAD_F(0x04c0dc6d) /* 0.297085217 */, 17 }, - /* 2773 */ { MAD_F(0x04c17247) /* 0.297228124 */, 17 }, - /* 2774 */ { MAD_F(0x04c20824) /* 0.297371048 */, 17 }, - /* 2775 */ { MAD_F(0x04c29e07) /* 0.297513989 */, 17 }, - /* 2776 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 17 }, - /* 2777 */ { MAD_F(0x04c3c9da) /* 0.297799922 */, 17 }, - /* 2778 */ { MAD_F(0x04c45fca) /* 0.297942915 */, 17 }, - /* 2779 */ { MAD_F(0x04c4f5bf) /* 0.298085925 */, 17 }, - /* 2780 */ { MAD_F(0x04c58bb8) /* 0.298228951 */, 17 }, - /* 2781 */ { MAD_F(0x04c621b6) /* 0.298371996 */, 17 }, - /* 2782 */ { MAD_F(0x04c6b7b9) /* 0.298515057 */, 17 }, - /* 2783 */ { MAD_F(0x04c74dc0) /* 0.298658135 */, 17 }, - - /* 2784 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 17 }, - /* 2785 */ { MAD_F(0x04c879dd) /* 0.298944343 */, 17 }, - /* 2786 */ { MAD_F(0x04c90ff2) /* 0.299087473 */, 17 }, - /* 2787 */ { MAD_F(0x04c9a60c) /* 0.299230620 */, 17 }, - /* 2788 */ { MAD_F(0x04ca3c2a) /* 0.299373784 */, 17 }, - /* 2789 */ { MAD_F(0x04cad24d) /* 0.299516965 */, 17 }, - /* 2790 */ { MAD_F(0x04cb6874) /* 0.299660163 */, 17 }, - /* 2791 */ { MAD_F(0x04cbfea0) /* 0.299803378 */, 17 }, - /* 2792 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 17 }, - /* 2793 */ { MAD_F(0x04cd2b06) /* 0.300089860 */, 17 }, - /* 2794 */ { MAD_F(0x04cdc140) /* 0.300233127 */, 17 }, - /* 2795 */ { MAD_F(0x04ce577f) /* 0.300376411 */, 17 }, - /* 2796 */ { MAD_F(0x04ceedc2) /* 0.300519711 */, 17 }, - /* 2797 */ { MAD_F(0x04cf8409) /* 0.300663029 */, 17 }, - /* 2798 */ { MAD_F(0x04d01a55) /* 0.300806364 */, 17 }, - /* 2799 */ { MAD_F(0x04d0b0a6) /* 0.300949716 */, 17 }, - - /* 2800 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 17 }, - /* 2801 */ { MAD_F(0x04d1dd55) /* 0.301236472 */, 17 }, - /* 2802 */ { MAD_F(0x04d273b4) /* 0.301379875 */, 17 }, - /* 2803 */ { MAD_F(0x04d30a17) /* 0.301523295 */, 17 }, - /* 2804 */ { MAD_F(0x04d3a07f) /* 0.301666733 */, 17 }, - /* 2805 */ { MAD_F(0x04d436eb) /* 0.301810187 */, 17 }, - /* 2806 */ { MAD_F(0x04d4cd5c) /* 0.301953659 */, 17 }, - /* 2807 */ { MAD_F(0x04d563d1) /* 0.302097147 */, 17 }, - /* 2808 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 17 }, - /* 2809 */ { MAD_F(0x04d690ca) /* 0.302384175 */, 17 }, - /* 2810 */ { MAD_F(0x04d7274d) /* 0.302527715 */, 17 }, - /* 2811 */ { MAD_F(0x04d7bdd5) /* 0.302671271 */, 17 }, - /* 2812 */ { MAD_F(0x04d85461) /* 0.302814845 */, 17 }, - /* 2813 */ { MAD_F(0x04d8eaf2) /* 0.302958436 */, 17 }, - /* 2814 */ { MAD_F(0x04d98187) /* 0.303102044 */, 17 }, - /* 2815 */ { MAD_F(0x04da1821) /* 0.303245668 */, 17 }, - - /* 2816 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 17 }, - /* 2817 */ { MAD_F(0x04db4563) /* 0.303532969 */, 17 }, - /* 2818 */ { MAD_F(0x04dbdc0a) /* 0.303676645 */, 17 }, - /* 2819 */ { MAD_F(0x04dc72b7) /* 0.303820337 */, 17 }, - /* 2820 */ { MAD_F(0x04dd0967) /* 0.303964047 */, 17 }, - /* 2821 */ { MAD_F(0x04dda01d) /* 0.304107774 */, 17 }, - /* 2822 */ { MAD_F(0x04de36d7) /* 0.304251517 */, 17 }, - /* 2823 */ { MAD_F(0x04decd95) /* 0.304395278 */, 17 }, - /* 2824 */ { MAD_F(0x04df6458) /* 0.304539056 */, 17 }, - /* 2825 */ { MAD_F(0x04dffb20) /* 0.304682850 */, 17 }, - /* 2826 */ { MAD_F(0x04e091ec) /* 0.304826662 */, 17 }, - /* 2827 */ { MAD_F(0x04e128bc) /* 0.304970491 */, 17 }, - /* 2828 */ { MAD_F(0x04e1bf92) /* 0.305114336 */, 17 }, - /* 2829 */ { MAD_F(0x04e2566b) /* 0.305258199 */, 17 }, - /* 2830 */ { MAD_F(0x04e2ed4a) /* 0.305402078 */, 17 }, - /* 2831 */ { MAD_F(0x04e3842d) /* 0.305545974 */, 17 }, - - /* 2832 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 17 }, - /* 2833 */ { MAD_F(0x04e4b200) /* 0.305833818 */, 17 }, - /* 2834 */ { MAD_F(0x04e548f1) /* 0.305977765 */, 17 }, - /* 2835 */ { MAD_F(0x04e5dfe6) /* 0.306121729 */, 17 }, - /* 2836 */ { MAD_F(0x04e676df) /* 0.306265710 */, 17 }, - /* 2837 */ { MAD_F(0x04e70dde) /* 0.306409708 */, 17 }, - /* 2838 */ { MAD_F(0x04e7a4e0) /* 0.306553723 */, 17 }, - /* 2839 */ { MAD_F(0x04e83be7) /* 0.306697755 */, 17 }, - /* 2840 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 17 }, - /* 2841 */ { MAD_F(0x04e96a04) /* 0.306985869 */, 17 }, - /* 2842 */ { MAD_F(0x04ea0118) /* 0.307129952 */, 17 }, - /* 2843 */ { MAD_F(0x04ea9832) /* 0.307274051 */, 17 }, - /* 2844 */ { MAD_F(0x04eb2f50) /* 0.307418168 */, 17 }, - /* 2845 */ { MAD_F(0x04ebc672) /* 0.307562301 */, 17 }, - /* 2846 */ { MAD_F(0x04ec5d99) /* 0.307706451 */, 17 }, - /* 2847 */ { MAD_F(0x04ecf4c5) /* 0.307850618 */, 17 }, - - /* 2848 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 17 }, - /* 2849 */ { MAD_F(0x04ee2329) /* 0.308139003 */, 17 }, - /* 2850 */ { MAD_F(0x04eeba63) /* 0.308283220 */, 17 }, - /* 2851 */ { MAD_F(0x04ef51a0) /* 0.308427455 */, 17 }, - /* 2852 */ { MAD_F(0x04efe8e2) /* 0.308571706 */, 17 }, - /* 2853 */ { MAD_F(0x04f08029) /* 0.308715974 */, 17 }, - /* 2854 */ { MAD_F(0x04f11774) /* 0.308860260 */, 17 }, - /* 2855 */ { MAD_F(0x04f1aec4) /* 0.309004561 */, 17 }, - /* 2856 */ { MAD_F(0x04f24618) /* 0.309148880 */, 17 }, - /* 2857 */ { MAD_F(0x04f2dd71) /* 0.309293216 */, 17 }, - /* 2858 */ { MAD_F(0x04f374cf) /* 0.309437568 */, 17 }, - /* 2859 */ { MAD_F(0x04f40c30) /* 0.309581938 */, 17 }, - /* 2860 */ { MAD_F(0x04f4a397) /* 0.309726324 */, 17 }, - /* 2861 */ { MAD_F(0x04f53b02) /* 0.309870727 */, 17 }, - /* 2862 */ { MAD_F(0x04f5d271) /* 0.310015147 */, 17 }, - /* 2863 */ { MAD_F(0x04f669e5) /* 0.310159583 */, 17 }, - - /* 2864 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 17 }, - /* 2865 */ { MAD_F(0x04f798da) /* 0.310448507 */, 17 }, - /* 2866 */ { MAD_F(0x04f8305c) /* 0.310592994 */, 17 }, - /* 2867 */ { MAD_F(0x04f8c7e2) /* 0.310737498 */, 17 }, - /* 2868 */ { MAD_F(0x04f95f6c) /* 0.310882018 */, 17 }, - /* 2869 */ { MAD_F(0x04f9f6fb) /* 0.311026556 */, 17 }, - /* 2870 */ { MAD_F(0x04fa8e8f) /* 0.311171110 */, 17 }, - /* 2871 */ { MAD_F(0x04fb2627) /* 0.311315681 */, 17 }, - /* 2872 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 17 }, - /* 2873 */ { MAD_F(0x04fc5564) /* 0.311604874 */, 17 }, - /* 2874 */ { MAD_F(0x04fced0a) /* 0.311749495 */, 17 }, - /* 2875 */ { MAD_F(0x04fd84b4) /* 0.311894133 */, 17 }, - /* 2876 */ { MAD_F(0x04fe1c62) /* 0.312038788 */, 17 }, - /* 2877 */ { MAD_F(0x04feb415) /* 0.312183460 */, 17 }, - /* 2878 */ { MAD_F(0x04ff4bcd) /* 0.312328148 */, 17 }, - /* 2879 */ { MAD_F(0x04ffe389) /* 0.312472854 */, 17 }, - - /* 2880 */ { MAD_F(0x05007b49) /* 0.312617576 */, 17 }, - /* 2881 */ { MAD_F(0x0501130e) /* 0.312762314 */, 17 }, - /* 2882 */ { MAD_F(0x0501aad8) /* 0.312907070 */, 17 }, - /* 2883 */ { MAD_F(0x050242a6) /* 0.313051842 */, 17 }, - /* 2884 */ { MAD_F(0x0502da78) /* 0.313196631 */, 17 }, - /* 2885 */ { MAD_F(0x0503724f) /* 0.313341437 */, 17 }, - /* 2886 */ { MAD_F(0x05040a2b) /* 0.313486259 */, 17 }, - /* 2887 */ { MAD_F(0x0504a20b) /* 0.313631098 */, 17 }, - /* 2888 */ { MAD_F(0x050539ef) /* 0.313775954 */, 17 }, - /* 2889 */ { MAD_F(0x0505d1d8) /* 0.313920827 */, 17 }, - /* 2890 */ { MAD_F(0x050669c5) /* 0.314065716 */, 17 }, - /* 2891 */ { MAD_F(0x050701b7) /* 0.314210622 */, 17 }, - /* 2892 */ { MAD_F(0x050799ae) /* 0.314355545 */, 17 }, - /* 2893 */ { MAD_F(0x050831a9) /* 0.314500484 */, 17 }, - /* 2894 */ { MAD_F(0x0508c9a8) /* 0.314645440 */, 17 }, - /* 2895 */ { MAD_F(0x050961ac) /* 0.314790413 */, 17 }, - - /* 2896 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 17 }, - /* 2897 */ { MAD_F(0x050a91c1) /* 0.315080409 */, 17 }, - /* 2898 */ { MAD_F(0x050b29d2) /* 0.315225432 */, 17 }, - /* 2899 */ { MAD_F(0x050bc1e8) /* 0.315370472 */, 17 }, - /* 2900 */ { MAD_F(0x050c5a02) /* 0.315515528 */, 17 }, - /* 2901 */ { MAD_F(0x050cf221) /* 0.315660601 */, 17 }, - /* 2902 */ { MAD_F(0x050d8a44) /* 0.315805690 */, 17 }, - /* 2903 */ { MAD_F(0x050e226c) /* 0.315950797 */, 17 }, - /* 2904 */ { MAD_F(0x050eba98) /* 0.316095920 */, 17 }, - /* 2905 */ { MAD_F(0x050f52c9) /* 0.316241059 */, 17 }, - /* 2906 */ { MAD_F(0x050feafe) /* 0.316386216 */, 17 }, - /* 2907 */ { MAD_F(0x05108337) /* 0.316531388 */, 17 }, - /* 2908 */ { MAD_F(0x05111b75) /* 0.316676578 */, 17 }, - /* 2909 */ { MAD_F(0x0511b3b8) /* 0.316821784 */, 17 }, - /* 2910 */ { MAD_F(0x05124bff) /* 0.316967007 */, 17 }, - /* 2911 */ { MAD_F(0x0512e44a) /* 0.317112247 */, 17 }, - - /* 2912 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 17 }, - /* 2913 */ { MAD_F(0x051414ee) /* 0.317402775 */, 17 }, - /* 2914 */ { MAD_F(0x0514ad47) /* 0.317548065 */, 17 }, - /* 2915 */ { MAD_F(0x051545a5) /* 0.317693371 */, 17 }, - /* 2916 */ { MAD_F(0x0515de06) /* 0.317838693 */, 17 }, - /* 2917 */ { MAD_F(0x0516766d) /* 0.317984033 */, 17 }, - /* 2918 */ { MAD_F(0x05170ed7) /* 0.318129388 */, 17 }, - /* 2919 */ { MAD_F(0x0517a746) /* 0.318274761 */, 17 }, - /* 2920 */ { MAD_F(0x05183fba) /* 0.318420150 */, 17 }, - /* 2921 */ { MAD_F(0x0518d832) /* 0.318565555 */, 17 }, - /* 2922 */ { MAD_F(0x051970ae) /* 0.318710978 */, 17 }, - /* 2923 */ { MAD_F(0x051a092f) /* 0.318856416 */, 17 }, - /* 2924 */ { MAD_F(0x051aa1b5) /* 0.319001872 */, 17 }, - /* 2925 */ { MAD_F(0x051b3a3f) /* 0.319147344 */, 17 }, - /* 2926 */ { MAD_F(0x051bd2cd) /* 0.319292832 */, 17 }, - /* 2927 */ { MAD_F(0x051c6b60) /* 0.319438338 */, 17 }, - - /* 2928 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 17 }, - /* 2929 */ { MAD_F(0x051d9c92) /* 0.319729398 */, 17 }, - /* 2930 */ { MAD_F(0x051e3532) /* 0.319874952 */, 17 }, - /* 2931 */ { MAD_F(0x051ecdd7) /* 0.320020524 */, 17 }, - /* 2932 */ { MAD_F(0x051f6680) /* 0.320166112 */, 17 }, - /* 2933 */ { MAD_F(0x051fff2d) /* 0.320311716 */, 17 }, - /* 2934 */ { MAD_F(0x052097df) /* 0.320457337 */, 17 }, - /* 2935 */ { MAD_F(0x05213095) /* 0.320602975 */, 17 }, - /* 2936 */ { MAD_F(0x0521c950) /* 0.320748629 */, 17 }, - /* 2937 */ { MAD_F(0x0522620f) /* 0.320894300 */, 17 }, - /* 2938 */ { MAD_F(0x0522fad3) /* 0.321039987 */, 17 }, - /* 2939 */ { MAD_F(0x0523939b) /* 0.321185691 */, 17 }, - /* 2940 */ { MAD_F(0x05242c68) /* 0.321331411 */, 17 }, - /* 2941 */ { MAD_F(0x0524c538) /* 0.321477148 */, 17 }, - /* 2942 */ { MAD_F(0x05255e0e) /* 0.321622901 */, 17 }, - /* 2943 */ { MAD_F(0x0525f6e8) /* 0.321768671 */, 17 }, - - /* 2944 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 17 }, - /* 2945 */ { MAD_F(0x052728a9) /* 0.322060260 */, 17 }, - /* 2946 */ { MAD_F(0x0527c190) /* 0.322206079 */, 17 }, - /* 2947 */ { MAD_F(0x05285a7b) /* 0.322351915 */, 17 }, - /* 2948 */ { MAD_F(0x0528f36b) /* 0.322497768 */, 17 }, - /* 2949 */ { MAD_F(0x05298c5f) /* 0.322643636 */, 17 }, - /* 2950 */ { MAD_F(0x052a2558) /* 0.322789522 */, 17 }, - /* 2951 */ { MAD_F(0x052abe55) /* 0.322935424 */, 17 }, - /* 2952 */ { MAD_F(0x052b5757) /* 0.323081342 */, 17 }, - /* 2953 */ { MAD_F(0x052bf05d) /* 0.323227277 */, 17 }, - /* 2954 */ { MAD_F(0x052c8968) /* 0.323373228 */, 17 }, - /* 2955 */ { MAD_F(0x052d2277) /* 0.323519196 */, 17 }, - /* 2956 */ { MAD_F(0x052dbb8a) /* 0.323665180 */, 17 }, - /* 2957 */ { MAD_F(0x052e54a2) /* 0.323811180 */, 17 }, - /* 2958 */ { MAD_F(0x052eedbe) /* 0.323957197 */, 17 }, - /* 2959 */ { MAD_F(0x052f86de) /* 0.324103231 */, 17 }, - - /* 2960 */ { MAD_F(0x05302003) /* 0.324249281 */, 17 }, - /* 2961 */ { MAD_F(0x0530b92d) /* 0.324395347 */, 17 }, - /* 2962 */ { MAD_F(0x0531525b) /* 0.324541430 */, 17 }, - /* 2963 */ { MAD_F(0x0531eb8d) /* 0.324687530 */, 17 }, - /* 2964 */ { MAD_F(0x053284c4) /* 0.324833646 */, 17 }, - /* 2965 */ { MAD_F(0x05331dff) /* 0.324979778 */, 17 }, - /* 2966 */ { MAD_F(0x0533b73e) /* 0.325125926 */, 17 }, - /* 2967 */ { MAD_F(0x05345082) /* 0.325272091 */, 17 }, - /* 2968 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 17 }, - /* 2969 */ { MAD_F(0x05358317) /* 0.325564471 */, 17 }, - /* 2970 */ { MAD_F(0x05361c68) /* 0.325710685 */, 17 }, - /* 2971 */ { MAD_F(0x0536b5be) /* 0.325856916 */, 17 }, - /* 2972 */ { MAD_F(0x05374f17) /* 0.326003163 */, 17 }, - /* 2973 */ { MAD_F(0x0537e876) /* 0.326149427 */, 17 }, - /* 2974 */ { MAD_F(0x053881d9) /* 0.326295707 */, 17 }, - /* 2975 */ { MAD_F(0x05391b40) /* 0.326442003 */, 17 }, - - /* 2976 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 17 }, - /* 2977 */ { MAD_F(0x053a4e1b) /* 0.326734645 */, 17 }, - /* 2978 */ { MAD_F(0x053ae78f) /* 0.326880990 */, 17 }, - /* 2979 */ { MAD_F(0x053b8108) /* 0.327027352 */, 17 }, - /* 2980 */ { MAD_F(0x053c1a85) /* 0.327173730 */, 17 }, - /* 2981 */ { MAD_F(0x053cb407) /* 0.327320125 */, 17 }, - /* 2982 */ { MAD_F(0x053d4d8d) /* 0.327466536 */, 17 }, - /* 2983 */ { MAD_F(0x053de717) /* 0.327612963 */, 17 }, - /* 2984 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 17 }, - /* 2985 */ { MAD_F(0x053f1a39) /* 0.327905867 */, 17 }, - /* 2986 */ { MAD_F(0x053fb3d0) /* 0.328052344 */, 17 }, - /* 2987 */ { MAD_F(0x05404d6c) /* 0.328198837 */, 17 }, - /* 2988 */ { MAD_F(0x0540e70c) /* 0.328345346 */, 17 }, - /* 2989 */ { MAD_F(0x054180b1) /* 0.328491871 */, 17 }, - /* 2990 */ { MAD_F(0x05421a5a) /* 0.328638413 */, 17 }, - /* 2991 */ { MAD_F(0x0542b407) /* 0.328784971 */, 17 }, - - /* 2992 */ { MAD_F(0x05434db9) /* 0.328931546 */, 17 }, - /* 2993 */ { MAD_F(0x0543e76f) /* 0.329078137 */, 17 }, - /* 2994 */ { MAD_F(0x0544812a) /* 0.329224744 */, 17 }, - /* 2995 */ { MAD_F(0x05451ae9) /* 0.329371367 */, 17 }, - /* 2996 */ { MAD_F(0x0545b4ac) /* 0.329518007 */, 17 }, - /* 2997 */ { MAD_F(0x05464e74) /* 0.329664663 */, 17 }, - /* 2998 */ { MAD_F(0x0546e840) /* 0.329811336 */, 17 }, - /* 2999 */ { MAD_F(0x05478211) /* 0.329958024 */, 17 }, - /* 3000 */ { MAD_F(0x05481be5) /* 0.330104730 */, 17 }, - /* 3001 */ { MAD_F(0x0548b5bf) /* 0.330251451 */, 17 }, - /* 3002 */ { MAD_F(0x05494f9c) /* 0.330398189 */, 17 }, - /* 3003 */ { MAD_F(0x0549e97e) /* 0.330544943 */, 17 }, - /* 3004 */ { MAD_F(0x054a8364) /* 0.330691713 */, 17 }, - /* 3005 */ { MAD_F(0x054b1d4f) /* 0.330838499 */, 17 }, - /* 3006 */ { MAD_F(0x054bb73e) /* 0.330985302 */, 17 }, - /* 3007 */ { MAD_F(0x054c5132) /* 0.331132121 */, 17 }, - - /* 3008 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 17 }, - /* 3009 */ { MAD_F(0x054d8526) /* 0.331425808 */, 17 }, - /* 3010 */ { MAD_F(0x054e1f26) /* 0.331572676 */, 17 }, - /* 3011 */ { MAD_F(0x054eb92b) /* 0.331719560 */, 17 }, - /* 3012 */ { MAD_F(0x054f5334) /* 0.331866461 */, 17 }, - /* 3013 */ { MAD_F(0x054fed42) /* 0.332013377 */, 17 }, - /* 3014 */ { MAD_F(0x05508754) /* 0.332160310 */, 17 }, - /* 3015 */ { MAD_F(0x0551216b) /* 0.332307260 */, 17 }, - /* 3016 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 17 }, - /* 3017 */ { MAD_F(0x055255a4) /* 0.332601207 */, 17 }, - /* 3018 */ { MAD_F(0x0552efc8) /* 0.332748205 */, 17 }, - /* 3019 */ { MAD_F(0x055389f0) /* 0.332895219 */, 17 }, - /* 3020 */ { MAD_F(0x0554241c) /* 0.333042249 */, 17 }, - /* 3021 */ { MAD_F(0x0554be4c) /* 0.333189296 */, 17 }, - /* 3022 */ { MAD_F(0x05555881) /* 0.333336359 */, 17 }, - /* 3023 */ { MAD_F(0x0555f2ba) /* 0.333483438 */, 17 }, - - /* 3024 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 17 }, - /* 3025 */ { MAD_F(0x0557273a) /* 0.333777645 */, 17 }, - /* 3026 */ { MAD_F(0x0557c180) /* 0.333924772 */, 17 }, - /* 3027 */ { MAD_F(0x05585bcb) /* 0.334071916 */, 17 }, - /* 3028 */ { MAD_F(0x0558f61a) /* 0.334219076 */, 17 }, - /* 3029 */ { MAD_F(0x0559906d) /* 0.334366253 */, 17 }, - /* 3030 */ { MAD_F(0x055a2ac5) /* 0.334513445 */, 17 }, - /* 3031 */ { MAD_F(0x055ac521) /* 0.334660654 */, 17 }, - /* 3032 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 17 }, - /* 3033 */ { MAD_F(0x055bf9e6) /* 0.334955120 */, 17 }, - /* 3034 */ { MAD_F(0x055c944f) /* 0.335102377 */, 17 }, - /* 3035 */ { MAD_F(0x055d2ebd) /* 0.335249651 */, 17 }, - /* 3036 */ { MAD_F(0x055dc92e) /* 0.335396941 */, 17 }, - /* 3037 */ { MAD_F(0x055e63a5) /* 0.335544246 */, 17 }, - /* 3038 */ { MAD_F(0x055efe1f) /* 0.335691568 */, 17 }, - /* 3039 */ { MAD_F(0x055f989e) /* 0.335838906 */, 17 }, - - /* 3040 */ { MAD_F(0x05603321) /* 0.335986261 */, 17 }, - /* 3041 */ { MAD_F(0x0560cda8) /* 0.336133631 */, 17 }, - /* 3042 */ { MAD_F(0x05616834) /* 0.336281018 */, 17 }, - /* 3043 */ { MAD_F(0x056202c4) /* 0.336428421 */, 17 }, - /* 3044 */ { MAD_F(0x05629d59) /* 0.336575840 */, 17 }, - /* 3045 */ { MAD_F(0x056337f2) /* 0.336723275 */, 17 }, - /* 3046 */ { MAD_F(0x0563d28f) /* 0.336870726 */, 17 }, - /* 3047 */ { MAD_F(0x05646d30) /* 0.337018193 */, 17 }, - /* 3048 */ { MAD_F(0x056507d6) /* 0.337165677 */, 17 }, - /* 3049 */ { MAD_F(0x0565a280) /* 0.337313176 */, 17 }, - /* 3050 */ { MAD_F(0x05663d2f) /* 0.337460692 */, 17 }, - /* 3051 */ { MAD_F(0x0566d7e1) /* 0.337608224 */, 17 }, - /* 3052 */ { MAD_F(0x05677298) /* 0.337755772 */, 17 }, - /* 3053 */ { MAD_F(0x05680d54) /* 0.337903336 */, 17 }, - /* 3054 */ { MAD_F(0x0568a814) /* 0.338050916 */, 17 }, - /* 3055 */ { MAD_F(0x056942d8) /* 0.338198513 */, 17 }, - - /* 3056 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 17 }, - /* 3057 */ { MAD_F(0x056a786d) /* 0.338493753 */, 17 }, - /* 3058 */ { MAD_F(0x056b133e) /* 0.338641398 */, 17 }, - /* 3059 */ { MAD_F(0x056bae13) /* 0.338789059 */, 17 }, - /* 3060 */ { MAD_F(0x056c48ed) /* 0.338936736 */, 17 }, - /* 3061 */ { MAD_F(0x056ce3cb) /* 0.339084429 */, 17 }, - /* 3062 */ { MAD_F(0x056d7ead) /* 0.339232138 */, 17 }, - /* 3063 */ { MAD_F(0x056e1994) /* 0.339379863 */, 17 }, - /* 3064 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 17 }, - /* 3065 */ { MAD_F(0x056f4f6e) /* 0.339675361 */, 17 }, - /* 3066 */ { MAD_F(0x056fea62) /* 0.339823134 */, 17 }, - /* 3067 */ { MAD_F(0x0570855a) /* 0.339970924 */, 17 }, - /* 3068 */ { MAD_F(0x05712056) /* 0.340118729 */, 17 }, - /* 3069 */ { MAD_F(0x0571bb56) /* 0.340266550 */, 17 }, - /* 3070 */ { MAD_F(0x0572565b) /* 0.340414388 */, 17 }, - /* 3071 */ { MAD_F(0x0572f164) /* 0.340562242 */, 17 }, - - /* 3072 */ { MAD_F(0x05738c72) /* 0.340710111 */, 17 }, - /* 3073 */ { MAD_F(0x05742784) /* 0.340857997 */, 17 }, - /* 3074 */ { MAD_F(0x0574c29a) /* 0.341005899 */, 17 }, - /* 3075 */ { MAD_F(0x05755db4) /* 0.341153816 */, 17 }, - /* 3076 */ { MAD_F(0x0575f8d3) /* 0.341301750 */, 17 }, - /* 3077 */ { MAD_F(0x057693f6) /* 0.341449700 */, 17 }, - /* 3078 */ { MAD_F(0x05772f1d) /* 0.341597666 */, 17 }, - /* 3079 */ { MAD_F(0x0577ca49) /* 0.341745648 */, 17 }, - /* 3080 */ { MAD_F(0x05786578) /* 0.341893646 */, 17 }, - /* 3081 */ { MAD_F(0x057900ad) /* 0.342041659 */, 17 }, - /* 3082 */ { MAD_F(0x05799be5) /* 0.342189689 */, 17 }, - /* 3083 */ { MAD_F(0x057a3722) /* 0.342337735 */, 17 }, - /* 3084 */ { MAD_F(0x057ad263) /* 0.342485797 */, 17 }, - /* 3085 */ { MAD_F(0x057b6da8) /* 0.342633875 */, 17 }, - /* 3086 */ { MAD_F(0x057c08f2) /* 0.342781969 */, 17 }, - /* 3087 */ { MAD_F(0x057ca440) /* 0.342930079 */, 17 }, - - /* 3088 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 17 }, - /* 3089 */ { MAD_F(0x057ddae9) /* 0.343226347 */, 17 }, - /* 3090 */ { MAD_F(0x057e7644) /* 0.343374505 */, 17 }, - /* 3091 */ { MAD_F(0x057f11a3) /* 0.343522679 */, 17 }, - /* 3092 */ { MAD_F(0x057fad06) /* 0.343670869 */, 17 }, - /* 3093 */ { MAD_F(0x0580486e) /* 0.343819075 */, 17 }, - /* 3094 */ { MAD_F(0x0580e3da) /* 0.343967296 */, 17 }, - /* 3095 */ { MAD_F(0x05817f4a) /* 0.344115534 */, 17 }, - /* 3096 */ { MAD_F(0x05821abf) /* 0.344263788 */, 17 }, - /* 3097 */ { MAD_F(0x0582b638) /* 0.344412058 */, 17 }, - /* 3098 */ { MAD_F(0x058351b5) /* 0.344560343 */, 17 }, - /* 3099 */ { MAD_F(0x0583ed36) /* 0.344708645 */, 17 }, - /* 3100 */ { MAD_F(0x058488bc) /* 0.344856963 */, 17 }, - /* 3101 */ { MAD_F(0x05852446) /* 0.345005296 */, 17 }, - /* 3102 */ { MAD_F(0x0585bfd4) /* 0.345153646 */, 17 }, - /* 3103 */ { MAD_F(0x05865b67) /* 0.345302011 */, 17 }, - - /* 3104 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 17 }, - /* 3105 */ { MAD_F(0x05879298) /* 0.345598790 */, 17 }, - /* 3106 */ { MAD_F(0x05882e38) /* 0.345747203 */, 17 }, - /* 3107 */ { MAD_F(0x0588c9dc) /* 0.345895632 */, 17 }, - /* 3108 */ { MAD_F(0x05896583) /* 0.346044077 */, 17 }, - /* 3109 */ { MAD_F(0x058a0130) /* 0.346192538 */, 17 }, - /* 3110 */ { MAD_F(0x058a9ce0) /* 0.346341015 */, 17 }, - /* 3111 */ { MAD_F(0x058b3895) /* 0.346489508 */, 17 }, - /* 3112 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 17 }, - /* 3113 */ { MAD_F(0x058c700b) /* 0.346786542 */, 17 }, - /* 3114 */ { MAD_F(0x058d0bcd) /* 0.346935082 */, 17 }, - /* 3115 */ { MAD_F(0x058da793) /* 0.347083639 */, 17 }, - /* 3116 */ { MAD_F(0x058e435d) /* 0.347232211 */, 17 }, - /* 3117 */ { MAD_F(0x058edf2b) /* 0.347380799 */, 17 }, - /* 3118 */ { MAD_F(0x058f7afe) /* 0.347529403 */, 17 }, - /* 3119 */ { MAD_F(0x059016d5) /* 0.347678023 */, 17 }, - - /* 3120 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 17 }, - /* 3121 */ { MAD_F(0x05914e8f) /* 0.347975311 */, 17 }, - /* 3122 */ { MAD_F(0x0591ea73) /* 0.348123979 */, 17 }, - /* 3123 */ { MAD_F(0x0592865b) /* 0.348272662 */, 17 }, - /* 3124 */ { MAD_F(0x05932247) /* 0.348421362 */, 17 }, - /* 3125 */ { MAD_F(0x0593be37) /* 0.348570077 */, 17 }, - /* 3126 */ { MAD_F(0x05945a2c) /* 0.348718808 */, 17 }, - /* 3127 */ { MAD_F(0x0594f625) /* 0.348867555 */, 17 }, - /* 3128 */ { MAD_F(0x05959222) /* 0.349016318 */, 17 }, - /* 3129 */ { MAD_F(0x05962e24) /* 0.349165097 */, 17 }, - /* 3130 */ { MAD_F(0x0596ca2a) /* 0.349313892 */, 17 }, - /* 3131 */ { MAD_F(0x05976634) /* 0.349462702 */, 17 }, - /* 3132 */ { MAD_F(0x05980242) /* 0.349611528 */, 17 }, - /* 3133 */ { MAD_F(0x05989e54) /* 0.349760370 */, 17 }, - /* 3134 */ { MAD_F(0x05993a6b) /* 0.349909228 */, 17 }, - /* 3135 */ { MAD_F(0x0599d686) /* 0.350058102 */, 17 }, - - /* 3136 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 17 }, - /* 3137 */ { MAD_F(0x059b0ec9) /* 0.350355897 */, 17 }, - /* 3138 */ { MAD_F(0x059baaf1) /* 0.350504818 */, 17 }, - /* 3139 */ { MAD_F(0x059c471d) /* 0.350653756 */, 17 }, - /* 3140 */ { MAD_F(0x059ce34d) /* 0.350802708 */, 17 }, - /* 3141 */ { MAD_F(0x059d7f81) /* 0.350951677 */, 17 }, - /* 3142 */ { MAD_F(0x059e1bba) /* 0.351100662 */, 17 }, - /* 3143 */ { MAD_F(0x059eb7f7) /* 0.351249662 */, 17 }, - /* 3144 */ { MAD_F(0x059f5438) /* 0.351398678 */, 17 }, - /* 3145 */ { MAD_F(0x059ff07e) /* 0.351547710 */, 17 }, - /* 3146 */ { MAD_F(0x05a08cc7) /* 0.351696758 */, 17 }, - /* 3147 */ { MAD_F(0x05a12915) /* 0.351845821 */, 17 }, - /* 3148 */ { MAD_F(0x05a1c567) /* 0.351994901 */, 17 }, - /* 3149 */ { MAD_F(0x05a261be) /* 0.352143996 */, 17 }, - /* 3150 */ { MAD_F(0x05a2fe18) /* 0.352293107 */, 17 }, - /* 3151 */ { MAD_F(0x05a39a77) /* 0.352442233 */, 17 }, - - /* 3152 */ { MAD_F(0x05a436da) /* 0.352591376 */, 17 }, - /* 3153 */ { MAD_F(0x05a4d342) /* 0.352740534 */, 17 }, - /* 3154 */ { MAD_F(0x05a56fad) /* 0.352889708 */, 17 }, - /* 3155 */ { MAD_F(0x05a60c1d) /* 0.353038898 */, 17 }, - /* 3156 */ { MAD_F(0x05a6a891) /* 0.353188103 */, 17 }, - /* 3157 */ { MAD_F(0x05a7450a) /* 0.353337325 */, 17 }, - /* 3158 */ { MAD_F(0x05a7e186) /* 0.353486562 */, 17 }, - /* 3159 */ { MAD_F(0x05a87e07) /* 0.353635814 */, 17 }, - /* 3160 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 17 }, - /* 3161 */ { MAD_F(0x05a9b715) /* 0.353934367 */, 17 }, - /* 3162 */ { MAD_F(0x05aa53a2) /* 0.354083667 */, 17 }, - /* 3163 */ { MAD_F(0x05aaf034) /* 0.354232983 */, 17 }, - /* 3164 */ { MAD_F(0x05ab8cca) /* 0.354382314 */, 17 }, - /* 3165 */ { MAD_F(0x05ac2964) /* 0.354531662 */, 17 }, - /* 3166 */ { MAD_F(0x05acc602) /* 0.354681025 */, 17 }, - /* 3167 */ { MAD_F(0x05ad62a5) /* 0.354830403 */, 17 }, - - /* 3168 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 17 }, - /* 3169 */ { MAD_F(0x05ae9bf7) /* 0.355129208 */, 17 }, - /* 3170 */ { MAD_F(0x05af38a6) /* 0.355278634 */, 17 }, - /* 3171 */ { MAD_F(0x05afd559) /* 0.355428075 */, 17 }, - /* 3172 */ { MAD_F(0x05b07211) /* 0.355577533 */, 17 }, - /* 3173 */ { MAD_F(0x05b10ecd) /* 0.355727006 */, 17 }, - /* 3174 */ { MAD_F(0x05b1ab8d) /* 0.355876494 */, 17 }, - /* 3175 */ { MAD_F(0x05b24851) /* 0.356025999 */, 17 }, - /* 3176 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 17 }, - /* 3177 */ { MAD_F(0x05b381e6) /* 0.356325054 */, 17 }, - /* 3178 */ { MAD_F(0x05b41eb7) /* 0.356474606 */, 17 }, - /* 3179 */ { MAD_F(0x05b4bb8c) /* 0.356624173 */, 17 }, - /* 3180 */ { MAD_F(0x05b55866) /* 0.356773756 */, 17 }, - /* 3181 */ { MAD_F(0x05b5f543) /* 0.356923354 */, 17 }, - /* 3182 */ { MAD_F(0x05b69225) /* 0.357072969 */, 17 }, - /* 3183 */ { MAD_F(0x05b72f0b) /* 0.357222598 */, 17 }, - - /* 3184 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 17 }, - /* 3185 */ { MAD_F(0x05b868e3) /* 0.357521905 */, 17 }, - /* 3186 */ { MAD_F(0x05b905d6) /* 0.357671582 */, 17 }, - /* 3187 */ { MAD_F(0x05b9a2cd) /* 0.357821275 */, 17 }, - /* 3188 */ { MAD_F(0x05ba3fc8) /* 0.357970983 */, 17 }, - /* 3189 */ { MAD_F(0x05badcc7) /* 0.358120707 */, 17 }, - /* 3190 */ { MAD_F(0x05bb79ca) /* 0.358270446 */, 17 }, - /* 3191 */ { MAD_F(0x05bc16d2) /* 0.358420201 */, 17 }, - /* 3192 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 17 }, - /* 3193 */ { MAD_F(0x05bd50ee) /* 0.358719758 */, 17 }, - /* 3194 */ { MAD_F(0x05bdee02) /* 0.358869560 */, 17 }, - /* 3195 */ { MAD_F(0x05be8b1a) /* 0.359019378 */, 17 }, - /* 3196 */ { MAD_F(0x05bf2837) /* 0.359169211 */, 17 }, - /* 3197 */ { MAD_F(0x05bfc558) /* 0.359319060 */, 17 }, - /* 3198 */ { MAD_F(0x05c0627d) /* 0.359468925 */, 17 }, - /* 3199 */ { MAD_F(0x05c0ffa6) /* 0.359618805 */, 17 }, - - /* 3200 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 17 }, - /* 3201 */ { MAD_F(0x05c23a05) /* 0.359918612 */, 17 }, - /* 3202 */ { MAD_F(0x05c2d73a) /* 0.360068540 */, 17 }, - /* 3203 */ { MAD_F(0x05c37474) /* 0.360218482 */, 17 }, - /* 3204 */ { MAD_F(0x05c411b2) /* 0.360368440 */, 17 }, - /* 3205 */ { MAD_F(0x05c4aef5) /* 0.360518414 */, 17 }, - /* 3206 */ { MAD_F(0x05c54c3b) /* 0.360668404 */, 17 }, - /* 3207 */ { MAD_F(0x05c5e986) /* 0.360818409 */, 17 }, - /* 3208 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 17 }, - /* 3209 */ { MAD_F(0x05c72428) /* 0.361118466 */, 17 }, - /* 3210 */ { MAD_F(0x05c7c17f) /* 0.361268517 */, 17 }, - /* 3211 */ { MAD_F(0x05c85eda) /* 0.361418585 */, 17 }, - /* 3212 */ { MAD_F(0x05c8fc3a) /* 0.361568668 */, 17 }, - /* 3213 */ { MAD_F(0x05c9999e) /* 0.361718766 */, 17 }, - /* 3214 */ { MAD_F(0x05ca3706) /* 0.361868881 */, 17 }, - /* 3215 */ { MAD_F(0x05cad472) /* 0.362019010 */, 17 }, - - /* 3216 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 17 }, - /* 3217 */ { MAD_F(0x05cc0f57) /* 0.362319316 */, 17 }, - /* 3218 */ { MAD_F(0x05ccaccf) /* 0.362469493 */, 17 }, - /* 3219 */ { MAD_F(0x05cd4a4c) /* 0.362619685 */, 17 }, - /* 3220 */ { MAD_F(0x05cde7cd) /* 0.362769892 */, 17 }, - /* 3221 */ { MAD_F(0x05ce8552) /* 0.362920115 */, 17 }, - /* 3222 */ { MAD_F(0x05cf22dc) /* 0.363070354 */, 17 }, - /* 3223 */ { MAD_F(0x05cfc069) /* 0.363220608 */, 17 }, - /* 3224 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 17 }, - /* 3225 */ { MAD_F(0x05d0fb91) /* 0.363521163 */, 17 }, - /* 3226 */ { MAD_F(0x05d1992b) /* 0.363671464 */, 17 }, - /* 3227 */ { MAD_F(0x05d236c9) /* 0.363821780 */, 17 }, - /* 3228 */ { MAD_F(0x05d2d46c) /* 0.363972112 */, 17 }, - /* 3229 */ { MAD_F(0x05d37212) /* 0.364122459 */, 17 }, - /* 3230 */ { MAD_F(0x05d40fbd) /* 0.364272822 */, 17 }, - /* 3231 */ { MAD_F(0x05d4ad6c) /* 0.364423200 */, 17 }, - - /* 3232 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 17 }, - /* 3233 */ { MAD_F(0x05d5e8d6) /* 0.364724004 */, 17 }, - /* 3234 */ { MAD_F(0x05d68691) /* 0.364874429 */, 17 }, - /* 3235 */ { MAD_F(0x05d72451) /* 0.365024869 */, 17 }, - /* 3236 */ { MAD_F(0x05d7c215) /* 0.365175325 */, 17 }, - /* 3237 */ { MAD_F(0x05d85fdc) /* 0.365325796 */, 17 }, - /* 3238 */ { MAD_F(0x05d8fda8) /* 0.365476283 */, 17 }, - /* 3239 */ { MAD_F(0x05d99b79) /* 0.365626786 */, 17 }, - /* 3240 */ { MAD_F(0x05da394d) /* 0.365777304 */, 17 }, - /* 3241 */ { MAD_F(0x05dad726) /* 0.365927837 */, 17 }, - /* 3242 */ { MAD_F(0x05db7502) /* 0.366078386 */, 17 }, - /* 3243 */ { MAD_F(0x05dc12e3) /* 0.366228950 */, 17 }, - /* 3244 */ { MAD_F(0x05dcb0c8) /* 0.366379530 */, 17 }, - /* 3245 */ { MAD_F(0x05dd4eb1) /* 0.366530125 */, 17 }, - /* 3246 */ { MAD_F(0x05ddec9e) /* 0.366680736 */, 17 }, - /* 3247 */ { MAD_F(0x05de8a90) /* 0.366831362 */, 17 }, - - /* 3248 */ { MAD_F(0x05df2885) /* 0.366982004 */, 17 }, - /* 3249 */ { MAD_F(0x05dfc67f) /* 0.367132661 */, 17 }, - /* 3250 */ { MAD_F(0x05e0647d) /* 0.367283334 */, 17 }, - /* 3251 */ { MAD_F(0x05e1027f) /* 0.367434022 */, 17 }, - /* 3252 */ { MAD_F(0x05e1a085) /* 0.367584725 */, 17 }, - /* 3253 */ { MAD_F(0x05e23e8f) /* 0.367735444 */, 17 }, - /* 3254 */ { MAD_F(0x05e2dc9e) /* 0.367886179 */, 17 }, - /* 3255 */ { MAD_F(0x05e37ab0) /* 0.368036929 */, 17 }, - /* 3256 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 17 }, - /* 3257 */ { MAD_F(0x05e4b6e2) /* 0.368338475 */, 17 }, - /* 3258 */ { MAD_F(0x05e55501) /* 0.368489271 */, 17 }, - /* 3259 */ { MAD_F(0x05e5f324) /* 0.368640082 */, 17 }, - /* 3260 */ { MAD_F(0x05e6914c) /* 0.368790909 */, 17 }, - /* 3261 */ { MAD_F(0x05e72f77) /* 0.368941752 */, 17 }, - /* 3262 */ { MAD_F(0x05e7cda7) /* 0.369092610 */, 17 }, - /* 3263 */ { MAD_F(0x05e86bda) /* 0.369243483 */, 17 }, - - /* 3264 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 17 }, - /* 3265 */ { MAD_F(0x05e9a84e) /* 0.369545276 */, 17 }, - /* 3266 */ { MAD_F(0x05ea468e) /* 0.369696195 */, 17 }, - /* 3267 */ { MAD_F(0x05eae4d3) /* 0.369847130 */, 17 }, - /* 3268 */ { MAD_F(0x05eb831b) /* 0.369998080 */, 17 }, - /* 3269 */ { MAD_F(0x05ec2168) /* 0.370149046 */, 17 }, - /* 3270 */ { MAD_F(0x05ecbfb8) /* 0.370300027 */, 17 }, - /* 3271 */ { MAD_F(0x05ed5e0d) /* 0.370451024 */, 17 }, - /* 3272 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 17 }, - /* 3273 */ { MAD_F(0x05ee9ac3) /* 0.370753063 */, 17 }, - /* 3274 */ { MAD_F(0x05ef3924) /* 0.370904105 */, 17 }, - /* 3275 */ { MAD_F(0x05efd78a) /* 0.371055163 */, 17 }, - /* 3276 */ { MAD_F(0x05f075f3) /* 0.371206237 */, 17 }, - /* 3277 */ { MAD_F(0x05f11461) /* 0.371357326 */, 17 }, - /* 3278 */ { MAD_F(0x05f1b2d3) /* 0.371508430 */, 17 }, - /* 3279 */ { MAD_F(0x05f25148) /* 0.371659549 */, 17 }, - - /* 3280 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 17 }, - /* 3281 */ { MAD_F(0x05f38e40) /* 0.371961834 */, 17 }, - /* 3282 */ { MAD_F(0x05f42cc3) /* 0.372113000 */, 17 }, - /* 3283 */ { MAD_F(0x05f4cb49) /* 0.372264181 */, 17 }, - /* 3284 */ { MAD_F(0x05f569d3) /* 0.372415377 */, 17 }, - /* 3285 */ { MAD_F(0x05f60862) /* 0.372566589 */, 17 }, - /* 3286 */ { MAD_F(0x05f6a6f5) /* 0.372717816 */, 17 }, - /* 3287 */ { MAD_F(0x05f7458b) /* 0.372869058 */, 17 }, - /* 3288 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 17 }, - /* 3289 */ { MAD_F(0x05f882c5) /* 0.373171589 */, 17 }, - /* 3290 */ { MAD_F(0x05f92169) /* 0.373322877 */, 17 }, - /* 3291 */ { MAD_F(0x05f9c010) /* 0.373474181 */, 17 }, - /* 3292 */ { MAD_F(0x05fa5ebb) /* 0.373625500 */, 17 }, - /* 3293 */ { MAD_F(0x05fafd6b) /* 0.373776834 */, 17 }, - /* 3294 */ { MAD_F(0x05fb9c1e) /* 0.373928184 */, 17 }, - /* 3295 */ { MAD_F(0x05fc3ad6) /* 0.374079549 */, 17 }, - - /* 3296 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 17 }, - /* 3297 */ { MAD_F(0x05fd7852) /* 0.374382325 */, 17 }, - /* 3298 */ { MAD_F(0x05fe1716) /* 0.374533735 */, 17 }, - /* 3299 */ { MAD_F(0x05feb5de) /* 0.374685162 */, 17 }, - /* 3300 */ { MAD_F(0x05ff54aa) /* 0.374836603 */, 17 }, - /* 3301 */ { MAD_F(0x05fff37b) /* 0.374988060 */, 17 }, - /* 3302 */ { MAD_F(0x0600924f) /* 0.375139532 */, 17 }, - /* 3303 */ { MAD_F(0x06013128) /* 0.375291019 */, 17 }, - /* 3304 */ { MAD_F(0x0601d004) /* 0.375442522 */, 17 }, - /* 3305 */ { MAD_F(0x06026ee5) /* 0.375594040 */, 17 }, - /* 3306 */ { MAD_F(0x06030dca) /* 0.375745573 */, 17 }, - /* 3307 */ { MAD_F(0x0603acb3) /* 0.375897122 */, 17 }, - /* 3308 */ { MAD_F(0x06044ba0) /* 0.376048685 */, 17 }, - /* 3309 */ { MAD_F(0x0604ea91) /* 0.376200265 */, 17 }, - /* 3310 */ { MAD_F(0x06058987) /* 0.376351859 */, 17 }, - /* 3311 */ { MAD_F(0x06062880) /* 0.376503468 */, 17 }, - - /* 3312 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 17 }, - /* 3313 */ { MAD_F(0x0607667f) /* 0.376806733 */, 17 }, - /* 3314 */ { MAD_F(0x06080585) /* 0.376958389 */, 17 }, - /* 3315 */ { MAD_F(0x0608a48f) /* 0.377110059 */, 17 }, - /* 3316 */ { MAD_F(0x0609439c) /* 0.377261745 */, 17 }, - /* 3317 */ { MAD_F(0x0609e2ae) /* 0.377413446 */, 17 }, - /* 3318 */ { MAD_F(0x060a81c4) /* 0.377565163 */, 17 }, - /* 3319 */ { MAD_F(0x060b20df) /* 0.377716894 */, 17 }, - /* 3320 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 17 }, - /* 3321 */ { MAD_F(0x060c5f1f) /* 0.378020403 */, 17 }, - /* 3322 */ { MAD_F(0x060cfe46) /* 0.378172181 */, 17 }, - /* 3323 */ { MAD_F(0x060d9d70) /* 0.378323973 */, 17 }, - /* 3324 */ { MAD_F(0x060e3c9f) /* 0.378475781 */, 17 }, - /* 3325 */ { MAD_F(0x060edbd1) /* 0.378627604 */, 17 }, - /* 3326 */ { MAD_F(0x060f7b08) /* 0.378779442 */, 17 }, - /* 3327 */ { MAD_F(0x06101a43) /* 0.378931296 */, 17 }, - - /* 3328 */ { MAD_F(0x0610b982) /* 0.379083164 */, 17 }, - /* 3329 */ { MAD_F(0x061158c5) /* 0.379235048 */, 17 }, - /* 3330 */ { MAD_F(0x0611f80c) /* 0.379386947 */, 17 }, - /* 3331 */ { MAD_F(0x06129757) /* 0.379538862 */, 17 }, - /* 3332 */ { MAD_F(0x061336a6) /* 0.379690791 */, 17 }, - /* 3333 */ { MAD_F(0x0613d5fa) /* 0.379842736 */, 17 }, - /* 3334 */ { MAD_F(0x06147551) /* 0.379994696 */, 17 }, - /* 3335 */ { MAD_F(0x061514ad) /* 0.380146671 */, 17 }, - /* 3336 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 17 }, - /* 3337 */ { MAD_F(0x06165370) /* 0.380450666 */, 17 }, - /* 3338 */ { MAD_F(0x0616f2d8) /* 0.380602687 */, 17 }, - /* 3339 */ { MAD_F(0x06179243) /* 0.380754723 */, 17 }, - /* 3340 */ { MAD_F(0x061831b3) /* 0.380906774 */, 17 }, - /* 3341 */ { MAD_F(0x0618d127) /* 0.381058840 */, 17 }, - /* 3342 */ { MAD_F(0x0619709f) /* 0.381210921 */, 17 }, - /* 3343 */ { MAD_F(0x061a101b) /* 0.381363018 */, 17 }, - - /* 3344 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 17 }, - /* 3345 */ { MAD_F(0x061b4f20) /* 0.381667257 */, 17 }, - /* 3346 */ { MAD_F(0x061beea8) /* 0.381819399 */, 17 }, - /* 3347 */ { MAD_F(0x061c8e34) /* 0.381971556 */, 17 }, - /* 3348 */ { MAD_F(0x061d2dc5) /* 0.382123728 */, 17 }, - /* 3349 */ { MAD_F(0x061dcd59) /* 0.382275916 */, 17 }, - /* 3350 */ { MAD_F(0x061e6cf2) /* 0.382428118 */, 17 }, - /* 3351 */ { MAD_F(0x061f0c8f) /* 0.382580336 */, 17 }, - /* 3352 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 17 }, - /* 3353 */ { MAD_F(0x06204bd4) /* 0.382884817 */, 17 }, - /* 3354 */ { MAD_F(0x0620eb7d) /* 0.383037080 */, 17 }, - /* 3355 */ { MAD_F(0x06218b2a) /* 0.383189358 */, 17 }, - /* 3356 */ { MAD_F(0x06222adb) /* 0.383341652 */, 17 }, - /* 3357 */ { MAD_F(0x0622ca90) /* 0.383493960 */, 17 }, - /* 3358 */ { MAD_F(0x06236a49) /* 0.383646284 */, 17 }, - /* 3359 */ { MAD_F(0x06240a06) /* 0.383798623 */, 17 }, - - /* 3360 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 17 }, - /* 3361 */ { MAD_F(0x0625498d) /* 0.384103346 */, 17 }, - /* 3362 */ { MAD_F(0x0625e956) /* 0.384255730 */, 17 }, - /* 3363 */ { MAD_F(0x06268923) /* 0.384408129 */, 17 }, - /* 3364 */ { MAD_F(0x062728f5) /* 0.384560544 */, 17 }, - /* 3365 */ { MAD_F(0x0627c8ca) /* 0.384712973 */, 17 }, - /* 3366 */ { MAD_F(0x062868a4) /* 0.384865418 */, 17 }, - /* 3367 */ { MAD_F(0x06290881) /* 0.385017878 */, 17 }, - /* 3368 */ { MAD_F(0x0629a863) /* 0.385170352 */, 17 }, - /* 3369 */ { MAD_F(0x062a4849) /* 0.385322842 */, 17 }, - /* 3370 */ { MAD_F(0x062ae832) /* 0.385475347 */, 17 }, - /* 3371 */ { MAD_F(0x062b8820) /* 0.385627867 */, 17 }, - /* 3372 */ { MAD_F(0x062c2812) /* 0.385780402 */, 17 }, - /* 3373 */ { MAD_F(0x062cc808) /* 0.385932953 */, 17 }, - /* 3374 */ { MAD_F(0x062d6802) /* 0.386085518 */, 17 }, - /* 3375 */ { MAD_F(0x062e0800) /* 0.386238098 */, 17 }, - - /* 3376 */ { MAD_F(0x062ea802) /* 0.386390694 */, 17 }, - /* 3377 */ { MAD_F(0x062f4808) /* 0.386543304 */, 17 }, - /* 3378 */ { MAD_F(0x062fe812) /* 0.386695930 */, 17 }, - /* 3379 */ { MAD_F(0x06308820) /* 0.386848570 */, 17 }, - /* 3380 */ { MAD_F(0x06312832) /* 0.387001226 */, 17 }, - /* 3381 */ { MAD_F(0x0631c849) /* 0.387153897 */, 17 }, - /* 3382 */ { MAD_F(0x06326863) /* 0.387306582 */, 17 }, - /* 3383 */ { MAD_F(0x06330881) /* 0.387459283 */, 17 }, - /* 3384 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 17 }, - /* 3385 */ { MAD_F(0x063448ca) /* 0.387764730 */, 17 }, - /* 3386 */ { MAD_F(0x0634e8f4) /* 0.387917476 */, 17 }, - /* 3387 */ { MAD_F(0x06358923) /* 0.388070237 */, 17 }, - /* 3388 */ { MAD_F(0x06362955) /* 0.388223013 */, 17 }, - /* 3389 */ { MAD_F(0x0636c98c) /* 0.388375804 */, 17 }, - /* 3390 */ { MAD_F(0x063769c6) /* 0.388528610 */, 17 }, - /* 3391 */ { MAD_F(0x06380a05) /* 0.388681431 */, 17 }, - - /* 3392 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 17 }, - /* 3393 */ { MAD_F(0x06394a8e) /* 0.388987119 */, 17 }, - /* 3394 */ { MAD_F(0x0639ead9) /* 0.389139985 */, 17 }, - /* 3395 */ { MAD_F(0x063a8b28) /* 0.389292866 */, 17 }, - /* 3396 */ { MAD_F(0x063b2b7b) /* 0.389445762 */, 17 }, - /* 3397 */ { MAD_F(0x063bcbd1) /* 0.389598674 */, 17 }, - /* 3398 */ { MAD_F(0x063c6c2c) /* 0.389751600 */, 17 }, - /* 3399 */ { MAD_F(0x063d0c8b) /* 0.389904541 */, 17 }, - /* 3400 */ { MAD_F(0x063dacee) /* 0.390057497 */, 17 }, - /* 3401 */ { MAD_F(0x063e4d55) /* 0.390210468 */, 17 }, - /* 3402 */ { MAD_F(0x063eedc0) /* 0.390363455 */, 17 }, - /* 3403 */ { MAD_F(0x063f8e2f) /* 0.390516456 */, 17 }, - /* 3404 */ { MAD_F(0x06402ea2) /* 0.390669472 */, 17 }, - /* 3405 */ { MAD_F(0x0640cf19) /* 0.390822503 */, 17 }, - /* 3406 */ { MAD_F(0x06416f94) /* 0.390975549 */, 17 }, - /* 3407 */ { MAD_F(0x06421013) /* 0.391128611 */, 17 }, - - /* 3408 */ { MAD_F(0x0642b096) /* 0.391281687 */, 17 }, - /* 3409 */ { MAD_F(0x0643511d) /* 0.391434778 */, 17 }, - /* 3410 */ { MAD_F(0x0643f1a8) /* 0.391587884 */, 17 }, - /* 3411 */ { MAD_F(0x06449237) /* 0.391741005 */, 17 }, - /* 3412 */ { MAD_F(0x064532ca) /* 0.391894141 */, 17 }, - /* 3413 */ { MAD_F(0x0645d361) /* 0.392047292 */, 17 }, - /* 3414 */ { MAD_F(0x064673fc) /* 0.392200458 */, 17 }, - /* 3415 */ { MAD_F(0x0647149c) /* 0.392353638 */, 17 }, - /* 3416 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 17 }, - /* 3417 */ { MAD_F(0x064855e6) /* 0.392660045 */, 17 }, - /* 3418 */ { MAD_F(0x0648f691) /* 0.392813271 */, 17 }, - /* 3419 */ { MAD_F(0x06499740) /* 0.392966511 */, 17 }, - /* 3420 */ { MAD_F(0x064a37f4) /* 0.393119767 */, 17 }, - /* 3421 */ { MAD_F(0x064ad8ab) /* 0.393273038 */, 17 }, - /* 3422 */ { MAD_F(0x064b7966) /* 0.393426323 */, 17 }, - /* 3423 */ { MAD_F(0x064c1a25) /* 0.393579623 */, 17 }, - - /* 3424 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 17 }, - /* 3425 */ { MAD_F(0x064d5bb0) /* 0.393886269 */, 17 }, - /* 3426 */ { MAD_F(0x064dfc7b) /* 0.394039614 */, 17 }, - /* 3427 */ { MAD_F(0x064e9d4b) /* 0.394192974 */, 17 }, - /* 3428 */ { MAD_F(0x064f3e1e) /* 0.394346349 */, 17 }, - /* 3429 */ { MAD_F(0x064fdef5) /* 0.394499739 */, 17 }, - /* 3430 */ { MAD_F(0x06507fd0) /* 0.394653144 */, 17 }, - /* 3431 */ { MAD_F(0x065120b0) /* 0.394806564 */, 17 }, - /* 3432 */ { MAD_F(0x0651c193) /* 0.394959999 */, 17 }, - /* 3433 */ { MAD_F(0x0652627a) /* 0.395113448 */, 17 }, - /* 3434 */ { MAD_F(0x06530366) /* 0.395266913 */, 17 }, - /* 3435 */ { MAD_F(0x0653a455) /* 0.395420392 */, 17 }, - /* 3436 */ { MAD_F(0x06544548) /* 0.395573886 */, 17 }, - /* 3437 */ { MAD_F(0x0654e640) /* 0.395727395 */, 17 }, - /* 3438 */ { MAD_F(0x0655873b) /* 0.395880919 */, 17 }, - /* 3439 */ { MAD_F(0x0656283a) /* 0.396034458 */, 17 }, - - /* 3440 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 17 }, - /* 3441 */ { MAD_F(0x06576a45) /* 0.396341581 */, 17 }, - /* 3442 */ { MAD_F(0x06580b50) /* 0.396495164 */, 17 }, - /* 3443 */ { MAD_F(0x0658ac5f) /* 0.396648763 */, 17 }, - /* 3444 */ { MAD_F(0x06594d73) /* 0.396802376 */, 17 }, - /* 3445 */ { MAD_F(0x0659ee8a) /* 0.396956004 */, 17 }, - /* 3446 */ { MAD_F(0x065a8fa5) /* 0.397109647 */, 17 }, - /* 3447 */ { MAD_F(0x065b30c4) /* 0.397263305 */, 17 }, - /* 3448 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 17 }, - /* 3449 */ { MAD_F(0x065c730f) /* 0.397570666 */, 17 }, - /* 3450 */ { MAD_F(0x065d143a) /* 0.397724368 */, 17 }, - /* 3451 */ { MAD_F(0x065db569) /* 0.397878085 */, 17 }, - /* 3452 */ { MAD_F(0x065e569c) /* 0.398031818 */, 17 }, - /* 3453 */ { MAD_F(0x065ef7d3) /* 0.398185565 */, 17 }, - /* 3454 */ { MAD_F(0x065f990e) /* 0.398339326 */, 17 }, - /* 3455 */ { MAD_F(0x06603a4e) /* 0.398493103 */, 17 }, - - /* 3456 */ { MAD_F(0x0660db91) /* 0.398646895 */, 17 }, - /* 3457 */ { MAD_F(0x06617cd8) /* 0.398800701 */, 17 }, - /* 3458 */ { MAD_F(0x06621e23) /* 0.398954522 */, 17 }, - /* 3459 */ { MAD_F(0x0662bf72) /* 0.399108358 */, 17 }, - /* 3460 */ { MAD_F(0x066360c5) /* 0.399262209 */, 17 }, - /* 3461 */ { MAD_F(0x0664021c) /* 0.399416075 */, 17 }, - /* 3462 */ { MAD_F(0x0664a377) /* 0.399569955 */, 17 }, - /* 3463 */ { MAD_F(0x066544d6) /* 0.399723851 */, 17 }, - /* 3464 */ { MAD_F(0x0665e639) /* 0.399877761 */, 17 }, - /* 3465 */ { MAD_F(0x066687a0) /* 0.400031686 */, 17 }, - /* 3466 */ { MAD_F(0x0667290b) /* 0.400185625 */, 17 }, - /* 3467 */ { MAD_F(0x0667ca79) /* 0.400339580 */, 17 }, - /* 3468 */ { MAD_F(0x06686bec) /* 0.400493549 */, 17 }, - /* 3469 */ { MAD_F(0x06690d63) /* 0.400647534 */, 17 }, - /* 3470 */ { MAD_F(0x0669aede) /* 0.400801533 */, 17 }, - /* 3471 */ { MAD_F(0x066a505d) /* 0.400955546 */, 17 }, - - /* 3472 */ { MAD_F(0x066af1df) /* 0.401109575 */, 17 }, - /* 3473 */ { MAD_F(0x066b9366) /* 0.401263618 */, 17 }, - /* 3474 */ { MAD_F(0x066c34f1) /* 0.401417676 */, 17 }, - /* 3475 */ { MAD_F(0x066cd67f) /* 0.401571749 */, 17 }, - /* 3476 */ { MAD_F(0x066d7812) /* 0.401725837 */, 17 }, - /* 3477 */ { MAD_F(0x066e19a9) /* 0.401879939 */, 17 }, - /* 3478 */ { MAD_F(0x066ebb43) /* 0.402034056 */, 17 }, - /* 3479 */ { MAD_F(0x066f5ce2) /* 0.402188188 */, 17 }, - /* 3480 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 17 }, - /* 3481 */ { MAD_F(0x0670a02a) /* 0.402496497 */, 17 }, - /* 3482 */ { MAD_F(0x067141d5) /* 0.402650673 */, 17 }, - /* 3483 */ { MAD_F(0x0671e383) /* 0.402804864 */, 17 }, - /* 3484 */ { MAD_F(0x06728535) /* 0.402959070 */, 17 }, - /* 3485 */ { MAD_F(0x067326ec) /* 0.403113291 */, 17 }, - /* 3486 */ { MAD_F(0x0673c8a6) /* 0.403267526 */, 17 }, - /* 3487 */ { MAD_F(0x06746a64) /* 0.403421776 */, 17 }, - - /* 3488 */ { MAD_F(0x06750c26) /* 0.403576041 */, 17 }, - /* 3489 */ { MAD_F(0x0675adec) /* 0.403730320 */, 17 }, - /* 3490 */ { MAD_F(0x06764fb6) /* 0.403884615 */, 17 }, - /* 3491 */ { MAD_F(0x0676f184) /* 0.404038924 */, 17 }, - /* 3492 */ { MAD_F(0x06779356) /* 0.404193247 */, 17 }, - /* 3493 */ { MAD_F(0x0678352c) /* 0.404347586 */, 17 }, - /* 3494 */ { MAD_F(0x0678d706) /* 0.404501939 */, 17 }, - /* 3495 */ { MAD_F(0x067978e4) /* 0.404656307 */, 17 }, - /* 3496 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 17 }, - /* 3497 */ { MAD_F(0x067abcac) /* 0.404965087 */, 17 }, - /* 3498 */ { MAD_F(0x067b5e95) /* 0.405119499 */, 17 }, - /* 3499 */ { MAD_F(0x067c0083) /* 0.405273926 */, 17 }, - /* 3500 */ { MAD_F(0x067ca275) /* 0.405428368 */, 17 }, - /* 3501 */ { MAD_F(0x067d446a) /* 0.405582824 */, 17 }, - /* 3502 */ { MAD_F(0x067de664) /* 0.405737295 */, 17 }, - /* 3503 */ { MAD_F(0x067e8861) /* 0.405891781 */, 17 }, - - /* 3504 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 17 }, - /* 3505 */ { MAD_F(0x067fcc68) /* 0.406200796 */, 17 }, - /* 3506 */ { MAD_F(0x06806e71) /* 0.406355326 */, 17 }, - /* 3507 */ { MAD_F(0x0681107e) /* 0.406509870 */, 17 }, - /* 3508 */ { MAD_F(0x0681b28f) /* 0.406664429 */, 17 }, - /* 3509 */ { MAD_F(0x068254a4) /* 0.406819003 */, 17 }, - /* 3510 */ { MAD_F(0x0682f6bd) /* 0.406973592 */, 17 }, - /* 3511 */ { MAD_F(0x068398da) /* 0.407128195 */, 17 }, - /* 3512 */ { MAD_F(0x06843afb) /* 0.407282813 */, 17 }, - /* 3513 */ { MAD_F(0x0684dd20) /* 0.407437445 */, 17 }, - /* 3514 */ { MAD_F(0x06857f49) /* 0.407592093 */, 17 }, - /* 3515 */ { MAD_F(0x06862176) /* 0.407746754 */, 17 }, - /* 3516 */ { MAD_F(0x0686c3a6) /* 0.407901431 */, 17 }, - /* 3517 */ { MAD_F(0x068765db) /* 0.408056122 */, 17 }, - /* 3518 */ { MAD_F(0x06880814) /* 0.408210828 */, 17 }, - /* 3519 */ { MAD_F(0x0688aa50) /* 0.408365549 */, 17 }, - - /* 3520 */ { MAD_F(0x06894c90) /* 0.408520284 */, 17 }, - /* 3521 */ { MAD_F(0x0689eed5) /* 0.408675034 */, 17 }, - /* 3522 */ { MAD_F(0x068a911d) /* 0.408829798 */, 17 }, - /* 3523 */ { MAD_F(0x068b3369) /* 0.408984577 */, 17 }, - /* 3524 */ { MAD_F(0x068bd5b9) /* 0.409139371 */, 17 }, - /* 3525 */ { MAD_F(0x068c780e) /* 0.409294180 */, 17 }, - /* 3526 */ { MAD_F(0x068d1a66) /* 0.409449003 */, 17 }, - /* 3527 */ { MAD_F(0x068dbcc1) /* 0.409603840 */, 17 }, - /* 3528 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 17 }, - /* 3529 */ { MAD_F(0x068f0185) /* 0.409913560 */, 17 }, - /* 3530 */ { MAD_F(0x068fa3ed) /* 0.410068441 */, 17 }, - /* 3531 */ { MAD_F(0x06904658) /* 0.410223338 */, 17 }, - /* 3532 */ { MAD_F(0x0690e8c8) /* 0.410378249 */, 17 }, - /* 3533 */ { MAD_F(0x06918b3c) /* 0.410533174 */, 17 }, - /* 3534 */ { MAD_F(0x06922db3) /* 0.410688114 */, 17 }, - /* 3535 */ { MAD_F(0x0692d02e) /* 0.410843069 */, 17 }, - - /* 3536 */ { MAD_F(0x069372ae) /* 0.410998038 */, 17 }, - /* 3537 */ { MAD_F(0x06941531) /* 0.411153022 */, 17 }, - /* 3538 */ { MAD_F(0x0694b7b8) /* 0.411308021 */, 17 }, - /* 3539 */ { MAD_F(0x06955a43) /* 0.411463034 */, 17 }, - /* 3540 */ { MAD_F(0x0695fcd2) /* 0.411618062 */, 17 }, - /* 3541 */ { MAD_F(0x06969f65) /* 0.411773104 */, 17 }, - /* 3542 */ { MAD_F(0x069741fb) /* 0.411928161 */, 17 }, - /* 3543 */ { MAD_F(0x0697e496) /* 0.412083232 */, 17 }, - /* 3544 */ { MAD_F(0x06988735) /* 0.412238319 */, 17 }, - /* 3545 */ { MAD_F(0x069929d7) /* 0.412393419 */, 17 }, - /* 3546 */ { MAD_F(0x0699cc7e) /* 0.412548535 */, 17 }, - /* 3547 */ { MAD_F(0x069a6f28) /* 0.412703664 */, 17 }, - /* 3548 */ { MAD_F(0x069b11d6) /* 0.412858809 */, 17 }, - /* 3549 */ { MAD_F(0x069bb489) /* 0.413013968 */, 17 }, - /* 3550 */ { MAD_F(0x069c573f) /* 0.413169142 */, 17 }, - /* 3551 */ { MAD_F(0x069cf9f9) /* 0.413324330 */, 17 }, - - /* 3552 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 17 }, - /* 3553 */ { MAD_F(0x069e3f78) /* 0.413634750 */, 17 }, - /* 3554 */ { MAD_F(0x069ee23e) /* 0.413789982 */, 17 }, - /* 3555 */ { MAD_F(0x069f8508) /* 0.413945228 */, 17 }, - /* 3556 */ { MAD_F(0x06a027d5) /* 0.414100489 */, 17 }, - /* 3557 */ { MAD_F(0x06a0caa7) /* 0.414255765 */, 17 }, - /* 3558 */ { MAD_F(0x06a16d7c) /* 0.414411055 */, 17 }, - /* 3559 */ { MAD_F(0x06a21055) /* 0.414566359 */, 17 }, - /* 3560 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 17 }, - /* 3561 */ { MAD_F(0x06a35614) /* 0.414877012 */, 17 }, - /* 3562 */ { MAD_F(0x06a3f8f9) /* 0.415032361 */, 17 }, - /* 3563 */ { MAD_F(0x06a49be2) /* 0.415187723 */, 17 }, - /* 3564 */ { MAD_F(0x06a53ece) /* 0.415343101 */, 17 }, - /* 3565 */ { MAD_F(0x06a5e1bf) /* 0.415498493 */, 17 }, - /* 3566 */ { MAD_F(0x06a684b4) /* 0.415653899 */, 17 }, - /* 3567 */ { MAD_F(0x06a727ac) /* 0.415809320 */, 17 }, - - /* 3568 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 17 }, - /* 3569 */ { MAD_F(0x06a86da9) /* 0.416120206 */, 17 }, - /* 3570 */ { MAD_F(0x06a910ad) /* 0.416275670 */, 17 }, - /* 3571 */ { MAD_F(0x06a9b3b5) /* 0.416431149 */, 17 }, - /* 3572 */ { MAD_F(0x06aa56c1) /* 0.416586643 */, 17 }, - /* 3573 */ { MAD_F(0x06aaf9d1) /* 0.416742151 */, 17 }, - /* 3574 */ { MAD_F(0x06ab9ce5) /* 0.416897673 */, 17 }, - /* 3575 */ { MAD_F(0x06ac3ffc) /* 0.417053210 */, 17 }, - /* 3576 */ { MAD_F(0x06ace318) /* 0.417208762 */, 17 }, - /* 3577 */ { MAD_F(0x06ad8637) /* 0.417364328 */, 17 }, - /* 3578 */ { MAD_F(0x06ae295b) /* 0.417519909 */, 17 }, - /* 3579 */ { MAD_F(0x06aecc82) /* 0.417675504 */, 17 }, - /* 3580 */ { MAD_F(0x06af6fad) /* 0.417831113 */, 17 }, - /* 3581 */ { MAD_F(0x06b012dc) /* 0.417986737 */, 17 }, - /* 3582 */ { MAD_F(0x06b0b60f) /* 0.418142376 */, 17 }, - /* 3583 */ { MAD_F(0x06b15946) /* 0.418298029 */, 17 }, - - /* 3584 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 17 }, - /* 3585 */ { MAD_F(0x06b29fbf) /* 0.418609378 */, 17 }, - /* 3586 */ { MAD_F(0x06b34302) /* 0.418765075 */, 17 }, - /* 3587 */ { MAD_F(0x06b3e648) /* 0.418920786 */, 17 }, - /* 3588 */ { MAD_F(0x06b48992) /* 0.419076511 */, 17 }, - /* 3589 */ { MAD_F(0x06b52ce0) /* 0.419232251 */, 17 }, - /* 3590 */ { MAD_F(0x06b5d032) /* 0.419388005 */, 17 }, - /* 3591 */ { MAD_F(0x06b67388) /* 0.419543774 */, 17 }, - /* 3592 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 17 }, - /* 3593 */ { MAD_F(0x06b7ba3f) /* 0.419855355 */, 17 }, - /* 3594 */ { MAD_F(0x06b85da1) /* 0.420011167 */, 17 }, - /* 3595 */ { MAD_F(0x06b90106) /* 0.420166994 */, 17 }, - /* 3596 */ { MAD_F(0x06b9a470) /* 0.420322835 */, 17 }, - /* 3597 */ { MAD_F(0x06ba47dd) /* 0.420478690 */, 17 }, - /* 3598 */ { MAD_F(0x06baeb4e) /* 0.420634560 */, 17 }, - /* 3599 */ { MAD_F(0x06bb8ec3) /* 0.420790445 */, 17 }, - - /* 3600 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 17 }, - /* 3601 */ { MAD_F(0x06bcd5b8) /* 0.421102257 */, 17 }, - /* 3602 */ { MAD_F(0x06bd7939) /* 0.421258184 */, 17 }, - /* 3603 */ { MAD_F(0x06be1cbd) /* 0.421414127 */, 17 }, - /* 3604 */ { MAD_F(0x06bec045) /* 0.421570083 */, 17 }, - /* 3605 */ { MAD_F(0x06bf63d1) /* 0.421726054 */, 17 }, - /* 3606 */ { MAD_F(0x06c00761) /* 0.421882040 */, 17 }, - /* 3607 */ { MAD_F(0x06c0aaf5) /* 0.422038039 */, 17 }, - /* 3608 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 17 }, - /* 3609 */ { MAD_F(0x06c1f229) /* 0.422350082 */, 17 }, - /* 3610 */ { MAD_F(0x06c295c8) /* 0.422506125 */, 17 }, - /* 3611 */ { MAD_F(0x06c3396c) /* 0.422662183 */, 17 }, - /* 3612 */ { MAD_F(0x06c3dd13) /* 0.422818255 */, 17 }, - /* 3613 */ { MAD_F(0x06c480be) /* 0.422974341 */, 17 }, - /* 3614 */ { MAD_F(0x06c5246d) /* 0.423130442 */, 17 }, - /* 3615 */ { MAD_F(0x06c5c820) /* 0.423286557 */, 17 }, - - /* 3616 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 17 }, - /* 3617 */ { MAD_F(0x06c70f91) /* 0.423598830 */, 17 }, - /* 3618 */ { MAD_F(0x06c7b34f) /* 0.423754988 */, 17 }, - /* 3619 */ { MAD_F(0x06c85712) /* 0.423911161 */, 17 }, - /* 3620 */ { MAD_F(0x06c8fad8) /* 0.424067348 */, 17 }, - /* 3621 */ { MAD_F(0x06c99ea2) /* 0.424223550 */, 17 }, - /* 3622 */ { MAD_F(0x06ca4270) /* 0.424379765 */, 17 }, - /* 3623 */ { MAD_F(0x06cae641) /* 0.424535996 */, 17 }, - /* 3624 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 17 }, - /* 3625 */ { MAD_F(0x06cc2df0) /* 0.424848499 */, 17 }, - /* 3626 */ { MAD_F(0x06ccd1ce) /* 0.425004772 */, 17 }, - /* 3627 */ { MAD_F(0x06cd75af) /* 0.425161060 */, 17 }, - /* 3628 */ { MAD_F(0x06ce1994) /* 0.425317362 */, 17 }, - /* 3629 */ { MAD_F(0x06cebd7d) /* 0.425473678 */, 17 }, - /* 3630 */ { MAD_F(0x06cf6169) /* 0.425630009 */, 17 }, - /* 3631 */ { MAD_F(0x06d0055a) /* 0.425786354 */, 17 }, - - /* 3632 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 17 }, - /* 3633 */ { MAD_F(0x06d14d47) /* 0.426099088 */, 17 }, - /* 3634 */ { MAD_F(0x06d1f143) /* 0.426255476 */, 17 }, - /* 3635 */ { MAD_F(0x06d29543) /* 0.426411878 */, 17 }, - /* 3636 */ { MAD_F(0x06d33947) /* 0.426568295 */, 17 }, - /* 3637 */ { MAD_F(0x06d3dd4e) /* 0.426724726 */, 17 }, - /* 3638 */ { MAD_F(0x06d4815a) /* 0.426881172 */, 17 }, - /* 3639 */ { MAD_F(0x06d52569) /* 0.427037632 */, 17 }, - /* 3640 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 17 }, - /* 3641 */ { MAD_F(0x06d66d93) /* 0.427350594 */, 17 }, - /* 3642 */ { MAD_F(0x06d711ae) /* 0.427507097 */, 17 }, - /* 3643 */ { MAD_F(0x06d7b5cd) /* 0.427663614 */, 17 }, - /* 3644 */ { MAD_F(0x06d859f0) /* 0.427820146 */, 17 }, - /* 3645 */ { MAD_F(0x06d8fe16) /* 0.427976692 */, 17 }, - /* 3646 */ { MAD_F(0x06d9a240) /* 0.428133252 */, 17 }, - /* 3647 */ { MAD_F(0x06da466f) /* 0.428289826 */, 17 }, - - /* 3648 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 17 }, - /* 3649 */ { MAD_F(0x06db8ed6) /* 0.428603018 */, 17 }, - /* 3650 */ { MAD_F(0x06dc3310) /* 0.428759635 */, 17 }, - /* 3651 */ { MAD_F(0x06dcd74d) /* 0.428916267 */, 17 }, - /* 3652 */ { MAD_F(0x06dd7b8f) /* 0.429072913 */, 17 }, - /* 3653 */ { MAD_F(0x06de1fd4) /* 0.429229573 */, 17 }, - /* 3654 */ { MAD_F(0x06dec41d) /* 0.429386248 */, 17 }, - /* 3655 */ { MAD_F(0x06df686a) /* 0.429542937 */, 17 }, - /* 3656 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 17 }, - /* 3657 */ { MAD_F(0x06e0b10f) /* 0.429856357 */, 17 }, - /* 3658 */ { MAD_F(0x06e15567) /* 0.430013089 */, 17 }, - /* 3659 */ { MAD_F(0x06e1f9c4) /* 0.430169835 */, 17 }, - /* 3660 */ { MAD_F(0x06e29e24) /* 0.430326595 */, 17 }, - /* 3661 */ { MAD_F(0x06e34287) /* 0.430483370 */, 17 }, - /* 3662 */ { MAD_F(0x06e3e6ef) /* 0.430640159 */, 17 }, - /* 3663 */ { MAD_F(0x06e48b5b) /* 0.430796962 */, 17 }, - - /* 3664 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 17 }, - /* 3665 */ { MAD_F(0x06e5d43d) /* 0.431110611 */, 17 }, - /* 3666 */ { MAD_F(0x06e678b4) /* 0.431267457 */, 17 }, - /* 3667 */ { MAD_F(0x06e71d2f) /* 0.431424317 */, 17 }, - /* 3668 */ { MAD_F(0x06e7c1ae) /* 0.431581192 */, 17 }, - /* 3669 */ { MAD_F(0x06e86630) /* 0.431738080 */, 17 }, - /* 3670 */ { MAD_F(0x06e90ab7) /* 0.431894983 */, 17 }, - /* 3671 */ { MAD_F(0x06e9af41) /* 0.432051900 */, 17 }, - /* 3672 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 17 }, - /* 3673 */ { MAD_F(0x06eaf860) /* 0.432365778 */, 17 }, - /* 3674 */ { MAD_F(0x06eb9cf6) /* 0.432522737 */, 17 }, - /* 3675 */ { MAD_F(0x06ec418f) /* 0.432679712 */, 17 }, - /* 3676 */ { MAD_F(0x06ece62d) /* 0.432836700 */, 17 }, - /* 3677 */ { MAD_F(0x06ed8ace) /* 0.432993703 */, 17 }, - /* 3678 */ { MAD_F(0x06ee2f73) /* 0.433150720 */, 17 }, - /* 3679 */ { MAD_F(0x06eed41b) /* 0.433307751 */, 17 }, - - /* 3680 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 17 }, - /* 3681 */ { MAD_F(0x06f01d78) /* 0.433621856 */, 17 }, - /* 3682 */ { MAD_F(0x06f0c22c) /* 0.433778929 */, 17 }, - /* 3683 */ { MAD_F(0x06f166e4) /* 0.433936017 */, 17 }, - /* 3684 */ { MAD_F(0x06f20ba0) /* 0.434093120 */, 17 }, - /* 3685 */ { MAD_F(0x06f2b060) /* 0.434250236 */, 17 }, - /* 3686 */ { MAD_F(0x06f35523) /* 0.434407367 */, 17 }, - /* 3687 */ { MAD_F(0x06f3f9eb) /* 0.434564512 */, 17 }, - /* 3688 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 17 }, - /* 3689 */ { MAD_F(0x06f54385) /* 0.434878844 */, 17 }, - /* 3690 */ { MAD_F(0x06f5e857) /* 0.435036032 */, 17 }, - /* 3691 */ { MAD_F(0x06f68d2e) /* 0.435193233 */, 17 }, - /* 3692 */ { MAD_F(0x06f73208) /* 0.435350449 */, 17 }, - /* 3693 */ { MAD_F(0x06f7d6e6) /* 0.435507679 */, 17 }, - /* 3694 */ { MAD_F(0x06f87bc8) /* 0.435664924 */, 17 }, - /* 3695 */ { MAD_F(0x06f920ae) /* 0.435822182 */, 17 }, - - /* 3696 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 17 }, - /* 3697 */ { MAD_F(0x06fa6a85) /* 0.436136741 */, 17 }, - /* 3698 */ { MAD_F(0x06fb0f76) /* 0.436294042 */, 17 }, - /* 3699 */ { MAD_F(0x06fbb46b) /* 0.436451358 */, 17 }, - /* 3700 */ { MAD_F(0x06fc5964) /* 0.436608687 */, 17 }, - /* 3701 */ { MAD_F(0x06fcfe60) /* 0.436766031 */, 17 }, - /* 3702 */ { MAD_F(0x06fda361) /* 0.436923388 */, 17 }, - /* 3703 */ { MAD_F(0x06fe4865) /* 0.437080760 */, 17 }, - /* 3704 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 17 }, - /* 3705 */ { MAD_F(0x06ff9279) /* 0.437395547 */, 17 }, - /* 3706 */ { MAD_F(0x07003788) /* 0.437552961 */, 17 }, - /* 3707 */ { MAD_F(0x0700dc9c) /* 0.437710389 */, 17 }, - /* 3708 */ { MAD_F(0x070181b3) /* 0.437867832 */, 17 }, - /* 3709 */ { MAD_F(0x070226ce) /* 0.438025289 */, 17 }, - /* 3710 */ { MAD_F(0x0702cbed) /* 0.438182760 */, 17 }, - /* 3711 */ { MAD_F(0x0703710f) /* 0.438340245 */, 17 }, - - /* 3712 */ { MAD_F(0x07041636) /* 0.438497744 */, 17 }, - /* 3713 */ { MAD_F(0x0704bb60) /* 0.438655258 */, 17 }, - /* 3714 */ { MAD_F(0x0705608e) /* 0.438812785 */, 17 }, - /* 3715 */ { MAD_F(0x070605c0) /* 0.438970327 */, 17 }, - /* 3716 */ { MAD_F(0x0706aaf5) /* 0.439127883 */, 17 }, - /* 3717 */ { MAD_F(0x0707502f) /* 0.439285453 */, 17 }, - /* 3718 */ { MAD_F(0x0707f56c) /* 0.439443037 */, 17 }, - /* 3719 */ { MAD_F(0x07089aad) /* 0.439600635 */, 17 }, - /* 3720 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 17 }, - /* 3721 */ { MAD_F(0x0709e53a) /* 0.439915874 */, 17 }, - /* 3722 */ { MAD_F(0x070a8a86) /* 0.440073515 */, 17 }, - /* 3723 */ { MAD_F(0x070b2fd7) /* 0.440231170 */, 17 }, - /* 3724 */ { MAD_F(0x070bd52a) /* 0.440388839 */, 17 }, - /* 3725 */ { MAD_F(0x070c7a82) /* 0.440546522 */, 17 }, - /* 3726 */ { MAD_F(0x070d1fde) /* 0.440704219 */, 17 }, - /* 3727 */ { MAD_F(0x070dc53d) /* 0.440861930 */, 17 }, - - /* 3728 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 17 }, - /* 3729 */ { MAD_F(0x070f1007) /* 0.441177395 */, 17 }, - /* 3730 */ { MAD_F(0x070fb571) /* 0.441335148 */, 17 }, - /* 3731 */ { MAD_F(0x07105ae0) /* 0.441492916 */, 17 }, - /* 3732 */ { MAD_F(0x07110052) /* 0.441650697 */, 17 }, - /* 3733 */ { MAD_F(0x0711a5c8) /* 0.441808493 */, 17 }, - /* 3734 */ { MAD_F(0x07124b42) /* 0.441966303 */, 17 }, - /* 3735 */ { MAD_F(0x0712f0bf) /* 0.442124127 */, 17 }, - /* 3736 */ { MAD_F(0x07139641) /* 0.442281965 */, 17 }, - /* 3737 */ { MAD_F(0x07143bc6) /* 0.442439817 */, 17 }, - /* 3738 */ { MAD_F(0x0714e14f) /* 0.442597683 */, 17 }, - /* 3739 */ { MAD_F(0x071586db) /* 0.442755564 */, 17 }, - /* 3740 */ { MAD_F(0x07162c6c) /* 0.442913458 */, 17 }, - /* 3741 */ { MAD_F(0x0716d200) /* 0.443071366 */, 17 }, - /* 3742 */ { MAD_F(0x07177798) /* 0.443229289 */, 17 }, - /* 3743 */ { MAD_F(0x07181d34) /* 0.443387226 */, 17 }, - - /* 3744 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 17 }, - /* 3745 */ { MAD_F(0x07196877) /* 0.443703141 */, 17 }, - /* 3746 */ { MAD_F(0x071a0e1e) /* 0.443861120 */, 17 }, - /* 3747 */ { MAD_F(0x071ab3c9) /* 0.444019113 */, 17 }, - /* 3748 */ { MAD_F(0x071b5977) /* 0.444177119 */, 17 }, - /* 3749 */ { MAD_F(0x071bff2a) /* 0.444335140 */, 17 }, - /* 3750 */ { MAD_F(0x071ca4e0) /* 0.444493175 */, 17 }, - /* 3751 */ { MAD_F(0x071d4a9a) /* 0.444651224 */, 17 }, - /* 3752 */ { MAD_F(0x071df058) /* 0.444809288 */, 17 }, - /* 3753 */ { MAD_F(0x071e9619) /* 0.444967365 */, 17 }, - /* 3754 */ { MAD_F(0x071f3bde) /* 0.445125456 */, 17 }, - /* 3755 */ { MAD_F(0x071fe1a8) /* 0.445283561 */, 17 }, - /* 3756 */ { MAD_F(0x07208774) /* 0.445441680 */, 17 }, - /* 3757 */ { MAD_F(0x07212d45) /* 0.445599814 */, 17 }, - /* 3758 */ { MAD_F(0x0721d319) /* 0.445757961 */, 17 }, - /* 3759 */ { MAD_F(0x072278f1) /* 0.445916122 */, 17 }, - - /* 3760 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 17 }, - /* 3761 */ { MAD_F(0x0723c4ad) /* 0.446232487 */, 17 }, - /* 3762 */ { MAD_F(0x07246a90) /* 0.446390690 */, 17 }, - /* 3763 */ { MAD_F(0x07251077) /* 0.446548908 */, 17 }, - /* 3764 */ { MAD_F(0x0725b662) /* 0.446707139 */, 17 }, - /* 3765 */ { MAD_F(0x07265c51) /* 0.446865385 */, 17 }, - /* 3766 */ { MAD_F(0x07270244) /* 0.447023644 */, 17 }, - /* 3767 */ { MAD_F(0x0727a83a) /* 0.447181918 */, 17 }, - /* 3768 */ { MAD_F(0x07284e34) /* 0.447340205 */, 17 }, - /* 3769 */ { MAD_F(0x0728f431) /* 0.447498507 */, 17 }, - /* 3770 */ { MAD_F(0x07299a33) /* 0.447656822 */, 17 }, - /* 3771 */ { MAD_F(0x072a4038) /* 0.447815152 */, 17 }, - /* 3772 */ { MAD_F(0x072ae641) /* 0.447973495 */, 17 }, - /* 3773 */ { MAD_F(0x072b8c4e) /* 0.448131853 */, 17 }, - /* 3774 */ { MAD_F(0x072c325e) /* 0.448290224 */, 17 }, - /* 3775 */ { MAD_F(0x072cd873) /* 0.448448609 */, 17 }, - - /* 3776 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 17 }, - /* 3777 */ { MAD_F(0x072e24a7) /* 0.448765422 */, 17 }, - /* 3778 */ { MAD_F(0x072ecac6) /* 0.448923850 */, 17 }, - /* 3779 */ { MAD_F(0x072f70e9) /* 0.449082291 */, 17 }, - /* 3780 */ { MAD_F(0x07301710) /* 0.449240746 */, 17 }, - /* 3781 */ { MAD_F(0x0730bd3b) /* 0.449399216 */, 17 }, - /* 3782 */ { MAD_F(0x0731636a) /* 0.449557699 */, 17 }, - /* 3783 */ { MAD_F(0x0732099c) /* 0.449716196 */, 17 }, - /* 3784 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 17 }, - /* 3785 */ { MAD_F(0x0733560c) /* 0.450033233 */, 17 }, - /* 3786 */ { MAD_F(0x0733fc49) /* 0.450191772 */, 17 }, - /* 3787 */ { MAD_F(0x0734a28b) /* 0.450350325 */, 17 }, - /* 3788 */ { MAD_F(0x073548d0) /* 0.450508892 */, 17 }, - /* 3789 */ { MAD_F(0x0735ef18) /* 0.450667473 */, 17 }, - /* 3790 */ { MAD_F(0x07369565) /* 0.450826068 */, 17 }, - /* 3791 */ { MAD_F(0x07373bb5) /* 0.450984677 */, 17 }, - - /* 3792 */ { MAD_F(0x0737e209) /* 0.451143300 */, 17 }, - /* 3793 */ { MAD_F(0x07388861) /* 0.451301937 */, 17 }, - /* 3794 */ { MAD_F(0x07392ebc) /* 0.451460588 */, 17 }, - /* 3795 */ { MAD_F(0x0739d51c) /* 0.451619252 */, 17 }, - /* 3796 */ { MAD_F(0x073a7b7f) /* 0.451777931 */, 17 }, - /* 3797 */ { MAD_F(0x073b21e5) /* 0.451936623 */, 17 }, - /* 3798 */ { MAD_F(0x073bc850) /* 0.452095330 */, 17 }, - /* 3799 */ { MAD_F(0x073c6ebe) /* 0.452254050 */, 17 }, - /* 3800 */ { MAD_F(0x073d1530) /* 0.452412785 */, 17 }, - /* 3801 */ { MAD_F(0x073dbba6) /* 0.452571533 */, 17 }, - /* 3802 */ { MAD_F(0x073e621f) /* 0.452730295 */, 17 }, - /* 3803 */ { MAD_F(0x073f089c) /* 0.452889071 */, 17 }, - /* 3804 */ { MAD_F(0x073faf1d) /* 0.453047861 */, 17 }, - /* 3805 */ { MAD_F(0x074055a2) /* 0.453206665 */, 17 }, - /* 3806 */ { MAD_F(0x0740fc2a) /* 0.453365483 */, 17 }, - /* 3807 */ { MAD_F(0x0741a2b6) /* 0.453524315 */, 17 }, - - /* 3808 */ { MAD_F(0x07424946) /* 0.453683161 */, 17 }, - /* 3809 */ { MAD_F(0x0742efd9) /* 0.453842020 */, 17 }, - /* 3810 */ { MAD_F(0x07439671) /* 0.454000894 */, 17 }, - /* 3811 */ { MAD_F(0x07443d0c) /* 0.454159781 */, 17 }, - /* 3812 */ { MAD_F(0x0744e3aa) /* 0.454318683 */, 17 }, - /* 3813 */ { MAD_F(0x07458a4d) /* 0.454477598 */, 17 }, - /* 3814 */ { MAD_F(0x074630f3) /* 0.454636527 */, 17 }, - /* 3815 */ { MAD_F(0x0746d79d) /* 0.454795470 */, 17 }, - /* 3816 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 17 }, - /* 3817 */ { MAD_F(0x074824fc) /* 0.455113397 */, 17 }, - /* 3818 */ { MAD_F(0x0748cbb1) /* 0.455272382 */, 17 }, - /* 3819 */ { MAD_F(0x0749726a) /* 0.455431381 */, 17 }, - /* 3820 */ { MAD_F(0x074a1927) /* 0.455590393 */, 17 }, - /* 3821 */ { MAD_F(0x074abfe7) /* 0.455749419 */, 17 }, - /* 3822 */ { MAD_F(0x074b66ab) /* 0.455908459 */, 17 }, - /* 3823 */ { MAD_F(0x074c0d73) /* 0.456067513 */, 17 }, - - /* 3824 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 17 }, - /* 3825 */ { MAD_F(0x074d5b0d) /* 0.456385663 */, 17 }, - /* 3826 */ { MAD_F(0x074e01e0) /* 0.456544759 */, 17 }, - /* 3827 */ { MAD_F(0x074ea8b7) /* 0.456703868 */, 17 }, - /* 3828 */ { MAD_F(0x074f4f91) /* 0.456862992 */, 17 }, - /* 3829 */ { MAD_F(0x074ff66f) /* 0.457022129 */, 17 }, - /* 3830 */ { MAD_F(0x07509d51) /* 0.457181280 */, 17 }, - /* 3831 */ { MAD_F(0x07514437) /* 0.457340445 */, 17 }, - /* 3832 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 17 }, - /* 3833 */ { MAD_F(0x0752920d) /* 0.457658816 */, 17 }, - /* 3834 */ { MAD_F(0x075338fd) /* 0.457818022 */, 17 }, - /* 3835 */ { MAD_F(0x0753dff2) /* 0.457977243 */, 17 }, - /* 3836 */ { MAD_F(0x075486ea) /* 0.458136477 */, 17 }, - /* 3837 */ { MAD_F(0x07552de6) /* 0.458295725 */, 17 }, - /* 3838 */ { MAD_F(0x0755d4e5) /* 0.458454987 */, 17 }, - /* 3839 */ { MAD_F(0x07567be8) /* 0.458614262 */, 17 }, - - /* 3840 */ { MAD_F(0x075722ef) /* 0.458773552 */, 17 }, - /* 3841 */ { MAD_F(0x0757c9fa) /* 0.458932855 */, 17 }, - /* 3842 */ { MAD_F(0x07587108) /* 0.459092172 */, 17 }, - /* 3843 */ { MAD_F(0x0759181a) /* 0.459251503 */, 17 }, - /* 3844 */ { MAD_F(0x0759bf30) /* 0.459410848 */, 17 }, - /* 3845 */ { MAD_F(0x075a664a) /* 0.459570206 */, 17 }, - /* 3846 */ { MAD_F(0x075b0d67) /* 0.459729579 */, 17 }, - /* 3847 */ { MAD_F(0x075bb488) /* 0.459888965 */, 17 }, - /* 3848 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 17 }, - /* 3849 */ { MAD_F(0x075d02d5) /* 0.460207779 */, 17 }, - /* 3850 */ { MAD_F(0x075daa01) /* 0.460367206 */, 17 }, - /* 3851 */ { MAD_F(0x075e5130) /* 0.460526648 */, 17 }, - /* 3852 */ { MAD_F(0x075ef864) /* 0.460686103 */, 17 }, - /* 3853 */ { MAD_F(0x075f9f9b) /* 0.460845572 */, 17 }, - /* 3854 */ { MAD_F(0x076046d6) /* 0.461005055 */, 17 }, - /* 3855 */ { MAD_F(0x0760ee14) /* 0.461164552 */, 17 }, - - /* 3856 */ { MAD_F(0x07619557) /* 0.461324062 */, 17 }, - /* 3857 */ { MAD_F(0x07623c9d) /* 0.461483586 */, 17 }, - /* 3858 */ { MAD_F(0x0762e3e6) /* 0.461643124 */, 17 }, - /* 3859 */ { MAD_F(0x07638b34) /* 0.461802676 */, 17 }, - /* 3860 */ { MAD_F(0x07643285) /* 0.461962242 */, 17 }, - /* 3861 */ { MAD_F(0x0764d9d9) /* 0.462121821 */, 17 }, - /* 3862 */ { MAD_F(0x07658132) /* 0.462281414 */, 17 }, - /* 3863 */ { MAD_F(0x0766288e) /* 0.462441021 */, 17 }, - /* 3864 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 17 }, - /* 3865 */ { MAD_F(0x07677751) /* 0.462760276 */, 17 }, - /* 3866 */ { MAD_F(0x07681eb9) /* 0.462919924 */, 17 }, - /* 3867 */ { MAD_F(0x0768c624) /* 0.463079586 */, 17 }, - /* 3868 */ { MAD_F(0x07696d92) /* 0.463239262 */, 17 }, - /* 3869 */ { MAD_F(0x076a1505) /* 0.463398951 */, 17 }, - /* 3870 */ { MAD_F(0x076abc7b) /* 0.463558655 */, 17 }, - /* 3871 */ { MAD_F(0x076b63f4) /* 0.463718372 */, 17 }, - - /* 3872 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 17 }, - /* 3873 */ { MAD_F(0x076cb2f3) /* 0.464037847 */, 17 }, - /* 3874 */ { MAD_F(0x076d5a78) /* 0.464197605 */, 17 }, - /* 3875 */ { MAD_F(0x076e0200) /* 0.464357377 */, 17 }, - /* 3876 */ { MAD_F(0x076ea98c) /* 0.464517163 */, 17 }, - /* 3877 */ { MAD_F(0x076f511c) /* 0.464676962 */, 17 }, - /* 3878 */ { MAD_F(0x076ff8b0) /* 0.464836776 */, 17 }, - /* 3879 */ { MAD_F(0x0770a047) /* 0.464996603 */, 17 }, - /* 3880 */ { MAD_F(0x077147e2) /* 0.465156443 */, 17 }, - /* 3881 */ { MAD_F(0x0771ef80) /* 0.465316298 */, 17 }, - /* 3882 */ { MAD_F(0x07729723) /* 0.465476166 */, 17 }, - /* 3883 */ { MAD_F(0x07733ec9) /* 0.465636048 */, 17 }, - /* 3884 */ { MAD_F(0x0773e672) /* 0.465795943 */, 17 }, - /* 3885 */ { MAD_F(0x07748e20) /* 0.465955853 */, 17 }, - /* 3886 */ { MAD_F(0x077535d1) /* 0.466115776 */, 17 }, - /* 3887 */ { MAD_F(0x0775dd85) /* 0.466275713 */, 17 }, - - /* 3888 */ { MAD_F(0x0776853e) /* 0.466435663 */, 17 }, - /* 3889 */ { MAD_F(0x07772cfa) /* 0.466595627 */, 17 }, - /* 3890 */ { MAD_F(0x0777d4ba) /* 0.466755605 */, 17 }, - /* 3891 */ { MAD_F(0x07787c7d) /* 0.466915597 */, 17 }, - /* 3892 */ { MAD_F(0x07792444) /* 0.467075602 */, 17 }, - /* 3893 */ { MAD_F(0x0779cc0f) /* 0.467235621 */, 17 }, - /* 3894 */ { MAD_F(0x077a73dd) /* 0.467395654 */, 17 }, - /* 3895 */ { MAD_F(0x077b1baf) /* 0.467555701 */, 17 }, - /* 3896 */ { MAD_F(0x077bc385) /* 0.467715761 */, 17 }, - /* 3897 */ { MAD_F(0x077c6b5f) /* 0.467875835 */, 17 }, - /* 3898 */ { MAD_F(0x077d133c) /* 0.468035922 */, 17 }, - /* 3899 */ { MAD_F(0x077dbb1d) /* 0.468196023 */, 17 }, - /* 3900 */ { MAD_F(0x077e6301) /* 0.468356138 */, 17 }, - /* 3901 */ { MAD_F(0x077f0ae9) /* 0.468516267 */, 17 }, - /* 3902 */ { MAD_F(0x077fb2d5) /* 0.468676409 */, 17 }, - /* 3903 */ { MAD_F(0x07805ac5) /* 0.468836565 */, 17 }, - - /* 3904 */ { MAD_F(0x078102b8) /* 0.468996735 */, 17 }, - /* 3905 */ { MAD_F(0x0781aaaf) /* 0.469156918 */, 17 }, - /* 3906 */ { MAD_F(0x078252aa) /* 0.469317115 */, 17 }, - /* 3907 */ { MAD_F(0x0782faa8) /* 0.469477326 */, 17 }, - /* 3908 */ { MAD_F(0x0783a2aa) /* 0.469637550 */, 17 }, - /* 3909 */ { MAD_F(0x07844aaf) /* 0.469797788 */, 17 }, - /* 3910 */ { MAD_F(0x0784f2b8) /* 0.469958040 */, 17 }, - /* 3911 */ { MAD_F(0x07859ac5) /* 0.470118305 */, 17 }, - /* 3912 */ { MAD_F(0x078642d6) /* 0.470278584 */, 17 }, - /* 3913 */ { MAD_F(0x0786eaea) /* 0.470438877 */, 17 }, - /* 3914 */ { MAD_F(0x07879302) /* 0.470599183 */, 17 }, - /* 3915 */ { MAD_F(0x07883b1e) /* 0.470759503 */, 17 }, - /* 3916 */ { MAD_F(0x0788e33d) /* 0.470919836 */, 17 }, - /* 3917 */ { MAD_F(0x07898b60) /* 0.471080184 */, 17 }, - /* 3918 */ { MAD_F(0x078a3386) /* 0.471240545 */, 17 }, - /* 3919 */ { MAD_F(0x078adbb0) /* 0.471400919 */, 17 }, - - /* 3920 */ { MAD_F(0x078b83de) /* 0.471561307 */, 17 }, - /* 3921 */ { MAD_F(0x078c2c10) /* 0.471721709 */, 17 }, - /* 3922 */ { MAD_F(0x078cd445) /* 0.471882125 */, 17 }, - /* 3923 */ { MAD_F(0x078d7c7e) /* 0.472042554 */, 17 }, - /* 3924 */ { MAD_F(0x078e24ba) /* 0.472202996 */, 17 }, - /* 3925 */ { MAD_F(0x078eccfb) /* 0.472363453 */, 17 }, - /* 3926 */ { MAD_F(0x078f753e) /* 0.472523923 */, 17 }, - /* 3927 */ { MAD_F(0x07901d86) /* 0.472684406 */, 17 }, - /* 3928 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 17 }, - /* 3929 */ { MAD_F(0x07916e20) /* 0.473005414 */, 17 }, - /* 3930 */ { MAD_F(0x07921672) /* 0.473165939 */, 17 }, - /* 3931 */ { MAD_F(0x0792bec8) /* 0.473326477 */, 17 }, - /* 3932 */ { MAD_F(0x07936722) /* 0.473487029 */, 17 }, - /* 3933 */ { MAD_F(0x07940f80) /* 0.473647594 */, 17 }, - /* 3934 */ { MAD_F(0x0794b7e1) /* 0.473808173 */, 17 }, - /* 3935 */ { MAD_F(0x07956045) /* 0.473968765 */, 17 }, - - /* 3936 */ { MAD_F(0x079608ae) /* 0.474129372 */, 17 }, - /* 3937 */ { MAD_F(0x0796b11a) /* 0.474289991 */, 17 }, - /* 3938 */ { MAD_F(0x0797598a) /* 0.474450625 */, 17 }, - /* 3939 */ { MAD_F(0x079801fd) /* 0.474611272 */, 17 }, - /* 3940 */ { MAD_F(0x0798aa74) /* 0.474771932 */, 17 }, - /* 3941 */ { MAD_F(0x079952ee) /* 0.474932606 */, 17 }, - /* 3942 */ { MAD_F(0x0799fb6d) /* 0.475093294 */, 17 }, - /* 3943 */ { MAD_F(0x079aa3ef) /* 0.475253995 */, 17 }, - /* 3944 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 17 }, - /* 3945 */ { MAD_F(0x079bf4fd) /* 0.475575439 */, 17 }, - /* 3946 */ { MAD_F(0x079c9d8a) /* 0.475736181 */, 17 }, - /* 3947 */ { MAD_F(0x079d461b) /* 0.475896936 */, 17 }, - /* 3948 */ { MAD_F(0x079deeaf) /* 0.476057705 */, 17 }, - /* 3949 */ { MAD_F(0x079e9747) /* 0.476218488 */, 17 }, - /* 3950 */ { MAD_F(0x079f3fe2) /* 0.476379285 */, 17 }, - /* 3951 */ { MAD_F(0x079fe881) /* 0.476540095 */, 17 }, - - /* 3952 */ { MAD_F(0x07a09124) /* 0.476700918 */, 17 }, - /* 3953 */ { MAD_F(0x07a139ca) /* 0.476861755 */, 17 }, - /* 3954 */ { MAD_F(0x07a1e274) /* 0.477022606 */, 17 }, - /* 3955 */ { MAD_F(0x07a28b22) /* 0.477183470 */, 17 }, - /* 3956 */ { MAD_F(0x07a333d3) /* 0.477344348 */, 17 }, - /* 3957 */ { MAD_F(0x07a3dc88) /* 0.477505239 */, 17 }, - /* 3958 */ { MAD_F(0x07a48541) /* 0.477666144 */, 17 }, - /* 3959 */ { MAD_F(0x07a52dfd) /* 0.477827062 */, 17 }, - /* 3960 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 17 }, - /* 3961 */ { MAD_F(0x07a67f80) /* 0.478148940 */, 17 }, - /* 3962 */ { MAD_F(0x07a72847) /* 0.478309899 */, 17 }, - /* 3963 */ { MAD_F(0x07a7d112) /* 0.478470871 */, 17 }, - /* 3964 */ { MAD_F(0x07a879e1) /* 0.478631857 */, 17 }, - /* 3965 */ { MAD_F(0x07a922b3) /* 0.478792857 */, 17 }, - /* 3966 */ { MAD_F(0x07a9cb88) /* 0.478953870 */, 17 }, - /* 3967 */ { MAD_F(0x07aa7462) /* 0.479114897 */, 17 }, - - /* 3968 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 17 }, - /* 3969 */ { MAD_F(0x07abc61f) /* 0.479436991 */, 17 }, - /* 3970 */ { MAD_F(0x07ac6f03) /* 0.479598058 */, 17 }, - /* 3971 */ { MAD_F(0x07ad17eb) /* 0.479759139 */, 17 }, - /* 3972 */ { MAD_F(0x07adc0d6) /* 0.479920233 */, 17 }, - /* 3973 */ { MAD_F(0x07ae69c6) /* 0.480081341 */, 17 }, - /* 3974 */ { MAD_F(0x07af12b8) /* 0.480242463 */, 17 }, - /* 3975 */ { MAD_F(0x07afbbaf) /* 0.480403598 */, 17 }, - /* 3976 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 17 }, - /* 3977 */ { MAD_F(0x07b10da6) /* 0.480725908 */, 17 }, - /* 3978 */ { MAD_F(0x07b1b6a7) /* 0.480887083 */, 17 }, - /* 3979 */ { MAD_F(0x07b25fac) /* 0.481048272 */, 17 }, - /* 3980 */ { MAD_F(0x07b308b5) /* 0.481209475 */, 17 }, - /* 3981 */ { MAD_F(0x07b3b1c1) /* 0.481370691 */, 17 }, - /* 3982 */ { MAD_F(0x07b45ad0) /* 0.481531920 */, 17 }, - /* 3983 */ { MAD_F(0x07b503e4) /* 0.481693163 */, 17 }, - - /* 3984 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 17 }, - /* 3985 */ { MAD_F(0x07b65615) /* 0.482015690 */, 17 }, - /* 3986 */ { MAD_F(0x07b6ff33) /* 0.482176973 */, 17 }, - /* 3987 */ { MAD_F(0x07b7a855) /* 0.482338270 */, 17 }, - /* 3988 */ { MAD_F(0x07b8517b) /* 0.482499580 */, 17 }, - /* 3989 */ { MAD_F(0x07b8faa4) /* 0.482660904 */, 17 }, - /* 3990 */ { MAD_F(0x07b9a3d0) /* 0.482822242 */, 17 }, - /* 3991 */ { MAD_F(0x07ba4d01) /* 0.482983592 */, 17 }, - /* 3992 */ { MAD_F(0x07baf635) /* 0.483144957 */, 17 }, - /* 3993 */ { MAD_F(0x07bb9f6c) /* 0.483306335 */, 17 }, - /* 3994 */ { MAD_F(0x07bc48a7) /* 0.483467726 */, 17 }, - /* 3995 */ { MAD_F(0x07bcf1e6) /* 0.483629131 */, 17 }, - /* 3996 */ { MAD_F(0x07bd9b28) /* 0.483790549 */, 17 }, - /* 3997 */ { MAD_F(0x07be446e) /* 0.483951980 */, 17 }, - /* 3998 */ { MAD_F(0x07beedb8) /* 0.484113426 */, 17 }, - /* 3999 */ { MAD_F(0x07bf9705) /* 0.484274884 */, 17 }, - - /* 4000 */ { MAD_F(0x07c04056) /* 0.484436356 */, 17 }, - /* 4001 */ { MAD_F(0x07c0e9aa) /* 0.484597842 */, 17 }, - /* 4002 */ { MAD_F(0x07c19302) /* 0.484759341 */, 17 }, - /* 4003 */ { MAD_F(0x07c23c5e) /* 0.484920853 */, 17 }, - /* 4004 */ { MAD_F(0x07c2e5bd) /* 0.485082379 */, 17 }, - /* 4005 */ { MAD_F(0x07c38f20) /* 0.485243918 */, 17 }, - /* 4006 */ { MAD_F(0x07c43887) /* 0.485405471 */, 17 }, - /* 4007 */ { MAD_F(0x07c4e1f1) /* 0.485567037 */, 17 }, - /* 4008 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 17 }, - /* 4009 */ { MAD_F(0x07c634d0) /* 0.485890210 */, 17 }, - /* 4010 */ { MAD_F(0x07c6de45) /* 0.486051817 */, 17 }, - /* 4011 */ { MAD_F(0x07c787bd) /* 0.486213436 */, 17 }, - /* 4012 */ { MAD_F(0x07c83139) /* 0.486375070 */, 17 }, - /* 4013 */ { MAD_F(0x07c8dab9) /* 0.486536717 */, 17 }, - /* 4014 */ { MAD_F(0x07c9843c) /* 0.486698377 */, 17 }, - /* 4015 */ { MAD_F(0x07ca2dc3) /* 0.486860051 */, 17 }, - - /* 4016 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 17 }, - /* 4017 */ { MAD_F(0x07cb80dc) /* 0.487183438 */, 17 }, - /* 4018 */ { MAD_F(0x07cc2a6e) /* 0.487345152 */, 17 }, - /* 4019 */ { MAD_F(0x07ccd403) /* 0.487506879 */, 17 }, - /* 4020 */ { MAD_F(0x07cd7d9c) /* 0.487668620 */, 17 }, - /* 4021 */ { MAD_F(0x07ce2739) /* 0.487830374 */, 17 }, - /* 4022 */ { MAD_F(0x07ced0d9) /* 0.487992142 */, 17 }, - /* 4023 */ { MAD_F(0x07cf7a7d) /* 0.488153923 */, 17 }, - /* 4024 */ { MAD_F(0x07d02424) /* 0.488315717 */, 17 }, - /* 4025 */ { MAD_F(0x07d0cdcf) /* 0.488477525 */, 17 }, - /* 4026 */ { MAD_F(0x07d1777e) /* 0.488639346 */, 17 }, - /* 4027 */ { MAD_F(0x07d22130) /* 0.488801181 */, 17 }, - /* 4028 */ { MAD_F(0x07d2cae5) /* 0.488963029 */, 17 }, - /* 4029 */ { MAD_F(0x07d3749f) /* 0.489124890 */, 17 }, - /* 4030 */ { MAD_F(0x07d41e5c) /* 0.489286765 */, 17 }, - /* 4031 */ { MAD_F(0x07d4c81c) /* 0.489448653 */, 17 }, - - /* 4032 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 17 }, - /* 4033 */ { MAD_F(0x07d61ba8) /* 0.489772470 */, 17 }, - /* 4034 */ { MAD_F(0x07d6c573) /* 0.489934398 */, 17 }, - /* 4035 */ { MAD_F(0x07d76f42) /* 0.490096340 */, 17 }, - /* 4036 */ { MAD_F(0x07d81915) /* 0.490258295 */, 17 }, - /* 4037 */ { MAD_F(0x07d8c2eb) /* 0.490420263 */, 17 }, - /* 4038 */ { MAD_F(0x07d96cc4) /* 0.490582245 */, 17 }, - /* 4039 */ { MAD_F(0x07da16a2) /* 0.490744240 */, 17 }, - /* 4040 */ { MAD_F(0x07dac083) /* 0.490906249 */, 17 }, - /* 4041 */ { MAD_F(0x07db6a67) /* 0.491068271 */, 17 }, - /* 4042 */ { MAD_F(0x07dc144f) /* 0.491230306 */, 17 }, - /* 4043 */ { MAD_F(0x07dcbe3b) /* 0.491392355 */, 17 }, - /* 4044 */ { MAD_F(0x07dd682a) /* 0.491554417 */, 17 }, - /* 4045 */ { MAD_F(0x07de121d) /* 0.491716492 */, 17 }, - /* 4046 */ { MAD_F(0x07debc13) /* 0.491878581 */, 17 }, - /* 4047 */ { MAD_F(0x07df660d) /* 0.492040683 */, 17 }, - - /* 4048 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 17 }, - /* 4049 */ { MAD_F(0x07e0ba0c) /* 0.492364928 */, 17 }, - /* 4050 */ { MAD_F(0x07e16410) /* 0.492527070 */, 17 }, - /* 4051 */ { MAD_F(0x07e20e19) /* 0.492689225 */, 17 }, - /* 4052 */ { MAD_F(0x07e2b824) /* 0.492851394 */, 17 }, - /* 4053 */ { MAD_F(0x07e36234) /* 0.493013576 */, 17 }, - /* 4054 */ { MAD_F(0x07e40c47) /* 0.493175772 */, 17 }, - /* 4055 */ { MAD_F(0x07e4b65e) /* 0.493337981 */, 17 }, - /* 4056 */ { MAD_F(0x07e56078) /* 0.493500203 */, 17 }, - /* 4057 */ { MAD_F(0x07e60a95) /* 0.493662438 */, 17 }, - /* 4058 */ { MAD_F(0x07e6b4b7) /* 0.493824687 */, 17 }, - /* 4059 */ { MAD_F(0x07e75edc) /* 0.493986949 */, 17 }, - /* 4060 */ { MAD_F(0x07e80904) /* 0.494149225 */, 17 }, - /* 4061 */ { MAD_F(0x07e8b330) /* 0.494311514 */, 17 }, - /* 4062 */ { MAD_F(0x07e95d60) /* 0.494473816 */, 17 }, - /* 4063 */ { MAD_F(0x07ea0793) /* 0.494636131 */, 17 }, - - /* 4064 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 17 }, - /* 4065 */ { MAD_F(0x07eb5c04) /* 0.494960802 */, 17 }, - /* 4066 */ { MAD_F(0x07ec0642) /* 0.495123158 */, 17 }, - /* 4067 */ { MAD_F(0x07ecb084) /* 0.495285526 */, 17 }, - /* 4068 */ { MAD_F(0x07ed5ac9) /* 0.495447908 */, 17 }, - /* 4069 */ { MAD_F(0x07ee0512) /* 0.495610304 */, 17 }, - /* 4070 */ { MAD_F(0x07eeaf5e) /* 0.495772712 */, 17 }, - /* 4071 */ { MAD_F(0x07ef59ae) /* 0.495935134 */, 17 }, - /* 4072 */ { MAD_F(0x07f00401) /* 0.496097570 */, 17 }, - /* 4073 */ { MAD_F(0x07f0ae58) /* 0.496260018 */, 17 }, - /* 4074 */ { MAD_F(0x07f158b3) /* 0.496422480 */, 17 }, - /* 4075 */ { MAD_F(0x07f20311) /* 0.496584955 */, 17 }, - /* 4076 */ { MAD_F(0x07f2ad72) /* 0.496747444 */, 17 }, - /* 4077 */ { MAD_F(0x07f357d8) /* 0.496909945 */, 17 }, - /* 4078 */ { MAD_F(0x07f40240) /* 0.497072460 */, 17 }, - /* 4079 */ { MAD_F(0x07f4acad) /* 0.497234989 */, 17 }, - - /* 4080 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 17 }, - /* 4081 */ { MAD_F(0x07f60190) /* 0.497560085 */, 17 }, - /* 4082 */ { MAD_F(0x07f6ac07) /* 0.497722653 */, 17 }, - /* 4083 */ { MAD_F(0x07f75682) /* 0.497885235 */, 17 }, - /* 4084 */ { MAD_F(0x07f80100) /* 0.498047829 */, 17 }, - /* 4085 */ { MAD_F(0x07f8ab82) /* 0.498210437 */, 17 }, - /* 4086 */ { MAD_F(0x07f95607) /* 0.498373058 */, 17 }, - /* 4087 */ { MAD_F(0x07fa0090) /* 0.498535693 */, 17 }, - /* 4088 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 17 }, - /* 4089 */ { MAD_F(0x07fb55ac) /* 0.498861002 */, 17 }, - /* 4090 */ { MAD_F(0x07fc0040) /* 0.499023676 */, 17 }, - /* 4091 */ { MAD_F(0x07fcaad7) /* 0.499186364 */, 17 }, - /* 4092 */ { MAD_F(0x07fd5572) /* 0.499349064 */, 17 }, - /* 4093 */ { MAD_F(0x07fe0010) /* 0.499511778 */, 17 }, - /* 4094 */ { MAD_F(0x07feaab2) /* 0.499674506 */, 17 }, - /* 4095 */ { MAD_F(0x07ff5557) /* 0.499837246 */, 17 }, - - /* 4096 */ { MAD_F(0x04000000) /* 0.250000000 */, 18 }, - /* 4097 */ { MAD_F(0x04005556) /* 0.250081384 */, 18 }, - /* 4098 */ { MAD_F(0x0400aaae) /* 0.250162774 */, 18 }, - /* 4099 */ { MAD_F(0x04010008) /* 0.250244170 */, 18 }, - /* 4100 */ { MAD_F(0x04015563) /* 0.250325574 */, 18 }, - /* 4101 */ { MAD_F(0x0401aac1) /* 0.250406984 */, 18 }, - /* 4102 */ { MAD_F(0x04020020) /* 0.250488400 */, 18 }, - /* 4103 */ { MAD_F(0x04025581) /* 0.250569824 */, 18 }, - /* 4104 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 18 }, - /* 4105 */ { MAD_F(0x04030048) /* 0.250732690 */, 18 }, - /* 4106 */ { MAD_F(0x040355ae) /* 0.250814133 */, 18 }, - /* 4107 */ { MAD_F(0x0403ab16) /* 0.250895583 */, 18 }, - /* 4108 */ { MAD_F(0x04040080) /* 0.250977039 */, 18 }, - /* 4109 */ { MAD_F(0x040455eb) /* 0.251058502 */, 18 }, - /* 4110 */ { MAD_F(0x0404ab59) /* 0.251139971 */, 18 }, - /* 4111 */ { MAD_F(0x040500c8) /* 0.251221448 */, 18 }, - - /* 4112 */ { MAD_F(0x04055638) /* 0.251302930 */, 18 }, - /* 4113 */ { MAD_F(0x0405abab) /* 0.251384420 */, 18 }, - /* 4114 */ { MAD_F(0x0406011f) /* 0.251465916 */, 18 }, - /* 4115 */ { MAD_F(0x04065696) /* 0.251547418 */, 18 }, - /* 4116 */ { MAD_F(0x0406ac0e) /* 0.251628927 */, 18 }, - /* 4117 */ { MAD_F(0x04070187) /* 0.251710443 */, 18 }, - /* 4118 */ { MAD_F(0x04075703) /* 0.251791965 */, 18 }, - /* 4119 */ { MAD_F(0x0407ac80) /* 0.251873494 */, 18 }, - /* 4120 */ { MAD_F(0x040801ff) /* 0.251955030 */, 18 }, - /* 4121 */ { MAD_F(0x04085780) /* 0.252036572 */, 18 }, - /* 4122 */ { MAD_F(0x0408ad02) /* 0.252118121 */, 18 }, - /* 4123 */ { MAD_F(0x04090287) /* 0.252199676 */, 18 }, - /* 4124 */ { MAD_F(0x0409580d) /* 0.252281238 */, 18 }, - /* 4125 */ { MAD_F(0x0409ad95) /* 0.252362807 */, 18 }, - /* 4126 */ { MAD_F(0x040a031e) /* 0.252444382 */, 18 }, - /* 4127 */ { MAD_F(0x040a58aa) /* 0.252525963 */, 18 }, - - /* 4128 */ { MAD_F(0x040aae37) /* 0.252607552 */, 18 }, - /* 4129 */ { MAD_F(0x040b03c6) /* 0.252689147 */, 18 }, - /* 4130 */ { MAD_F(0x040b5957) /* 0.252770748 */, 18 }, - /* 4131 */ { MAD_F(0x040baee9) /* 0.252852356 */, 18 }, - /* 4132 */ { MAD_F(0x040c047e) /* 0.252933971 */, 18 }, - /* 4133 */ { MAD_F(0x040c5a14) /* 0.253015592 */, 18 }, - /* 4134 */ { MAD_F(0x040cafab) /* 0.253097220 */, 18 }, - /* 4135 */ { MAD_F(0x040d0545) /* 0.253178854 */, 18 }, - /* 4136 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 18 }, - /* 4137 */ { MAD_F(0x040db07d) /* 0.253342143 */, 18 }, - /* 4138 */ { MAD_F(0x040e061c) /* 0.253423797 */, 18 }, - /* 4139 */ { MAD_F(0x040e5bbd) /* 0.253505457 */, 18 }, - /* 4140 */ { MAD_F(0x040eb15f) /* 0.253587125 */, 18 }, - /* 4141 */ { MAD_F(0x040f0703) /* 0.253668799 */, 18 }, - /* 4142 */ { MAD_F(0x040f5ca9) /* 0.253750479 */, 18 }, - /* 4143 */ { MAD_F(0x040fb251) /* 0.253832166 */, 18 }, - - /* 4144 */ { MAD_F(0x041007fa) /* 0.253913860 */, 18 }, - /* 4145 */ { MAD_F(0x04105da6) /* 0.253995560 */, 18 }, - /* 4146 */ { MAD_F(0x0410b353) /* 0.254077266 */, 18 }, - /* 4147 */ { MAD_F(0x04110901) /* 0.254158980 */, 18 }, - /* 4148 */ { MAD_F(0x04115eb2) /* 0.254240700 */, 18 }, - /* 4149 */ { MAD_F(0x0411b464) /* 0.254322426 */, 18 }, - /* 4150 */ { MAD_F(0x04120a18) /* 0.254404159 */, 18 }, - /* 4151 */ { MAD_F(0x04125fce) /* 0.254485899 */, 18 }, - /* 4152 */ { MAD_F(0x0412b586) /* 0.254567645 */, 18 }, - /* 4153 */ { MAD_F(0x04130b3f) /* 0.254649397 */, 18 }, - /* 4154 */ { MAD_F(0x041360fa) /* 0.254731157 */, 18 }, - /* 4155 */ { MAD_F(0x0413b6b7) /* 0.254812922 */, 18 }, - /* 4156 */ { MAD_F(0x04140c75) /* 0.254894695 */, 18 }, - /* 4157 */ { MAD_F(0x04146236) /* 0.254976474 */, 18 }, - /* 4158 */ { MAD_F(0x0414b7f8) /* 0.255058259 */, 18 }, - /* 4159 */ { MAD_F(0x04150dbc) /* 0.255140051 */, 18 }, - - /* 4160 */ { MAD_F(0x04156381) /* 0.255221850 */, 18 }, - /* 4161 */ { MAD_F(0x0415b949) /* 0.255303655 */, 18 }, - /* 4162 */ { MAD_F(0x04160f12) /* 0.255385467 */, 18 }, - /* 4163 */ { MAD_F(0x041664dd) /* 0.255467285 */, 18 }, - /* 4164 */ { MAD_F(0x0416baaa) /* 0.255549110 */, 18 }, - /* 4165 */ { MAD_F(0x04171078) /* 0.255630941 */, 18 }, - /* 4166 */ { MAD_F(0x04176648) /* 0.255712779 */, 18 }, - /* 4167 */ { MAD_F(0x0417bc1a) /* 0.255794624 */, 18 }, - /* 4168 */ { MAD_F(0x041811ee) /* 0.255876475 */, 18 }, - /* 4169 */ { MAD_F(0x041867c3) /* 0.255958332 */, 18 }, - /* 4170 */ { MAD_F(0x0418bd9b) /* 0.256040196 */, 18 }, - /* 4171 */ { MAD_F(0x04191374) /* 0.256122067 */, 18 }, - /* 4172 */ { MAD_F(0x0419694e) /* 0.256203944 */, 18 }, - /* 4173 */ { MAD_F(0x0419bf2b) /* 0.256285828 */, 18 }, - /* 4174 */ { MAD_F(0x041a1509) /* 0.256367718 */, 18 }, - /* 4175 */ { MAD_F(0x041a6ae9) /* 0.256449615 */, 18 }, - - /* 4176 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 18 }, - /* 4177 */ { MAD_F(0x041b16ae) /* 0.256613428 */, 18 }, - /* 4178 */ { MAD_F(0x041b6c94) /* 0.256695344 */, 18 }, - /* 4179 */ { MAD_F(0x041bc27b) /* 0.256777267 */, 18 }, - /* 4180 */ { MAD_F(0x041c1863) /* 0.256859197 */, 18 }, - /* 4181 */ { MAD_F(0x041c6e4e) /* 0.256941133 */, 18 }, - /* 4182 */ { MAD_F(0x041cc43a) /* 0.257023076 */, 18 }, - /* 4183 */ { MAD_F(0x041d1a28) /* 0.257105025 */, 18 }, - /* 4184 */ { MAD_F(0x041d7018) /* 0.257186980 */, 18 }, - /* 4185 */ { MAD_F(0x041dc60a) /* 0.257268942 */, 18 }, - /* 4186 */ { MAD_F(0x041e1bfd) /* 0.257350911 */, 18 }, - /* 4187 */ { MAD_F(0x041e71f2) /* 0.257432886 */, 18 }, - /* 4188 */ { MAD_F(0x041ec7e9) /* 0.257514868 */, 18 }, - /* 4189 */ { MAD_F(0x041f1de1) /* 0.257596856 */, 18 }, - /* 4190 */ { MAD_F(0x041f73dc) /* 0.257678851 */, 18 }, - /* 4191 */ { MAD_F(0x041fc9d8) /* 0.257760852 */, 18 }, - - /* 4192 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 18 }, - /* 4193 */ { MAD_F(0x042075d5) /* 0.257924875 */, 18 }, - /* 4194 */ { MAD_F(0x0420cbd6) /* 0.258006895 */, 18 }, - /* 4195 */ { MAD_F(0x042121d9) /* 0.258088923 */, 18 }, - /* 4196 */ { MAD_F(0x042177de) /* 0.258170957 */, 18 }, - /* 4197 */ { MAD_F(0x0421cde5) /* 0.258252997 */, 18 }, - /* 4198 */ { MAD_F(0x042223ed) /* 0.258335044 */, 18 }, - /* 4199 */ { MAD_F(0x042279f7) /* 0.258417097 */, 18 }, - /* 4200 */ { MAD_F(0x0422d003) /* 0.258499157 */, 18 }, - /* 4201 */ { MAD_F(0x04232611) /* 0.258581224 */, 18 }, - /* 4202 */ { MAD_F(0x04237c20) /* 0.258663297 */, 18 }, - /* 4203 */ { MAD_F(0x0423d231) /* 0.258745376 */, 18 }, - /* 4204 */ { MAD_F(0x04242844) /* 0.258827462 */, 18 }, - /* 4205 */ { MAD_F(0x04247e58) /* 0.258909555 */, 18 }, - /* 4206 */ { MAD_F(0x0424d46e) /* 0.258991654 */, 18 }, - /* 4207 */ { MAD_F(0x04252a87) /* 0.259073760 */, 18 }, - - /* 4208 */ { MAD_F(0x042580a0) /* 0.259155872 */, 18 }, - /* 4209 */ { MAD_F(0x0425d6bc) /* 0.259237990 */, 18 }, - /* 4210 */ { MAD_F(0x04262cd9) /* 0.259320115 */, 18 }, - /* 4211 */ { MAD_F(0x042682f8) /* 0.259402247 */, 18 }, - /* 4212 */ { MAD_F(0x0426d919) /* 0.259484385 */, 18 }, - /* 4213 */ { MAD_F(0x04272f3b) /* 0.259566529 */, 18 }, - /* 4214 */ { MAD_F(0x04278560) /* 0.259648680 */, 18 }, - /* 4215 */ { MAD_F(0x0427db86) /* 0.259730838 */, 18 }, - /* 4216 */ { MAD_F(0x042831ad) /* 0.259813002 */, 18 }, - /* 4217 */ { MAD_F(0x042887d7) /* 0.259895173 */, 18 }, - /* 4218 */ { MAD_F(0x0428de02) /* 0.259977350 */, 18 }, - /* 4219 */ { MAD_F(0x0429342f) /* 0.260059533 */, 18 }, - /* 4220 */ { MAD_F(0x04298a5e) /* 0.260141723 */, 18 }, - /* 4221 */ { MAD_F(0x0429e08e) /* 0.260223920 */, 18 }, - /* 4222 */ { MAD_F(0x042a36c0) /* 0.260306123 */, 18 }, - /* 4223 */ { MAD_F(0x042a8cf4) /* 0.260388332 */, 18 }, - - /* 4224 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 18 }, - /* 4225 */ { MAD_F(0x042b3962) /* 0.260552771 */, 18 }, - /* 4226 */ { MAD_F(0x042b8f9b) /* 0.260635000 */, 18 }, - /* 4227 */ { MAD_F(0x042be5d6) /* 0.260717235 */, 18 }, - /* 4228 */ { MAD_F(0x042c3c12) /* 0.260799477 */, 18 }, - /* 4229 */ { MAD_F(0x042c9251) /* 0.260881725 */, 18 }, - /* 4230 */ { MAD_F(0x042ce891) /* 0.260963980 */, 18 }, - /* 4231 */ { MAD_F(0x042d3ed3) /* 0.261046242 */, 18 }, - /* 4232 */ { MAD_F(0x042d9516) /* 0.261128510 */, 18 }, - /* 4233 */ { MAD_F(0x042deb5c) /* 0.261210784 */, 18 }, - /* 4234 */ { MAD_F(0x042e41a3) /* 0.261293065 */, 18 }, - /* 4235 */ { MAD_F(0x042e97ec) /* 0.261375352 */, 18 }, - /* 4236 */ { MAD_F(0x042eee36) /* 0.261457646 */, 18 }, - /* 4237 */ { MAD_F(0x042f4482) /* 0.261539946 */, 18 }, - /* 4238 */ { MAD_F(0x042f9ad1) /* 0.261622253 */, 18 }, - /* 4239 */ { MAD_F(0x042ff120) /* 0.261704566 */, 18 }, - - /* 4240 */ { MAD_F(0x04304772) /* 0.261786886 */, 18 }, - /* 4241 */ { MAD_F(0x04309dc5) /* 0.261869212 */, 18 }, - /* 4242 */ { MAD_F(0x0430f41a) /* 0.261951545 */, 18 }, - /* 4243 */ { MAD_F(0x04314a71) /* 0.262033884 */, 18 }, - /* 4244 */ { MAD_F(0x0431a0c9) /* 0.262116229 */, 18 }, - /* 4245 */ { MAD_F(0x0431f723) /* 0.262198581 */, 18 }, - /* 4246 */ { MAD_F(0x04324d7f) /* 0.262280940 */, 18 }, - /* 4247 */ { MAD_F(0x0432a3dd) /* 0.262363305 */, 18 }, - /* 4248 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 18 }, - /* 4249 */ { MAD_F(0x0433509e) /* 0.262528054 */, 18 }, - /* 4250 */ { MAD_F(0x0433a701) /* 0.262610438 */, 18 }, - /* 4251 */ { MAD_F(0x0433fd65) /* 0.262692829 */, 18 }, - /* 4252 */ { MAD_F(0x043453cc) /* 0.262775227 */, 18 }, - /* 4253 */ { MAD_F(0x0434aa34) /* 0.262857630 */, 18 }, - /* 4254 */ { MAD_F(0x0435009d) /* 0.262940040 */, 18 }, - /* 4255 */ { MAD_F(0x04355709) /* 0.263022457 */, 18 }, - - /* 4256 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 18 }, - /* 4257 */ { MAD_F(0x043603e5) /* 0.263187310 */, 18 }, - /* 4258 */ { MAD_F(0x04365a56) /* 0.263269746 */, 18 }, - /* 4259 */ { MAD_F(0x0436b0c9) /* 0.263352188 */, 18 }, - /* 4260 */ { MAD_F(0x0437073d) /* 0.263434637 */, 18 }, - /* 4261 */ { MAD_F(0x04375db3) /* 0.263517093 */, 18 }, - /* 4262 */ { MAD_F(0x0437b42a) /* 0.263599554 */, 18 }, - /* 4263 */ { MAD_F(0x04380aa4) /* 0.263682023 */, 18 }, - /* 4264 */ { MAD_F(0x0438611f) /* 0.263764497 */, 18 }, - /* 4265 */ { MAD_F(0x0438b79c) /* 0.263846979 */, 18 }, - /* 4266 */ { MAD_F(0x04390e1a) /* 0.263929466 */, 18 }, - /* 4267 */ { MAD_F(0x0439649b) /* 0.264011960 */, 18 }, - /* 4268 */ { MAD_F(0x0439bb1d) /* 0.264094461 */, 18 }, - /* 4269 */ { MAD_F(0x043a11a1) /* 0.264176968 */, 18 }, - /* 4270 */ { MAD_F(0x043a6826) /* 0.264259481 */, 18 }, - /* 4271 */ { MAD_F(0x043abead) /* 0.264342001 */, 18 }, - - /* 4272 */ { MAD_F(0x043b1536) /* 0.264424527 */, 18 }, - /* 4273 */ { MAD_F(0x043b6bc1) /* 0.264507060 */, 18 }, - /* 4274 */ { MAD_F(0x043bc24d) /* 0.264589599 */, 18 }, - /* 4275 */ { MAD_F(0x043c18dc) /* 0.264672145 */, 18 }, - /* 4276 */ { MAD_F(0x043c6f6c) /* 0.264754697 */, 18 }, - /* 4277 */ { MAD_F(0x043cc5fd) /* 0.264837255 */, 18 }, - /* 4278 */ { MAD_F(0x043d1c91) /* 0.264919820 */, 18 }, - /* 4279 */ { MAD_F(0x043d7326) /* 0.265002392 */, 18 }, - /* 4280 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 18 }, - /* 4281 */ { MAD_F(0x043e2055) /* 0.265167554 */, 18 }, - /* 4282 */ { MAD_F(0x043e76ef) /* 0.265250144 */, 18 }, - /* 4283 */ { MAD_F(0x043ecd8b) /* 0.265332741 */, 18 }, - /* 4284 */ { MAD_F(0x043f2429) /* 0.265415345 */, 18 }, - /* 4285 */ { MAD_F(0x043f7ac8) /* 0.265497955 */, 18 }, - /* 4286 */ { MAD_F(0x043fd169) /* 0.265580571 */, 18 }, - /* 4287 */ { MAD_F(0x0440280c) /* 0.265663194 */, 18 }, - - /* 4288 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 18 }, - /* 4289 */ { MAD_F(0x0440d557) /* 0.265828459 */, 18 }, - /* 4290 */ { MAD_F(0x04412bff) /* 0.265911101 */, 18 }, - /* 4291 */ { MAD_F(0x044182a9) /* 0.265993749 */, 18 }, - /* 4292 */ { MAD_F(0x0441d955) /* 0.266076404 */, 18 }, - /* 4293 */ { MAD_F(0x04423002) /* 0.266159065 */, 18 }, - /* 4294 */ { MAD_F(0x044286b1) /* 0.266241733 */, 18 }, - /* 4295 */ { MAD_F(0x0442dd61) /* 0.266324407 */, 18 }, - /* 4296 */ { MAD_F(0x04433414) /* 0.266407088 */, 18 }, - /* 4297 */ { MAD_F(0x04438ac8) /* 0.266489775 */, 18 }, - /* 4298 */ { MAD_F(0x0443e17e) /* 0.266572468 */, 18 }, - /* 4299 */ { MAD_F(0x04443835) /* 0.266655168 */, 18 }, - /* 4300 */ { MAD_F(0x04448eef) /* 0.266737874 */, 18 }, - /* 4301 */ { MAD_F(0x0444e5aa) /* 0.266820587 */, 18 }, - /* 4302 */ { MAD_F(0x04453c66) /* 0.266903306 */, 18 }, - /* 4303 */ { MAD_F(0x04459325) /* 0.266986031 */, 18 }, - - /* 4304 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 18 }, - /* 4305 */ { MAD_F(0x044640a7) /* 0.267151501 */, 18 }, - /* 4306 */ { MAD_F(0x0446976a) /* 0.267234246 */, 18 }, - /* 4307 */ { MAD_F(0x0446ee30) /* 0.267316997 */, 18 }, - /* 4308 */ { MAD_F(0x044744f7) /* 0.267399755 */, 18 }, - /* 4309 */ { MAD_F(0x04479bc0) /* 0.267482518 */, 18 }, - /* 4310 */ { MAD_F(0x0447f28a) /* 0.267565289 */, 18 }, - /* 4311 */ { MAD_F(0x04484956) /* 0.267648065 */, 18 }, - /* 4312 */ { MAD_F(0x0448a024) /* 0.267730848 */, 18 }, - /* 4313 */ { MAD_F(0x0448f6f4) /* 0.267813638 */, 18 }, - /* 4314 */ { MAD_F(0x04494dc5) /* 0.267896434 */, 18 }, - /* 4315 */ { MAD_F(0x0449a498) /* 0.267979236 */, 18 }, - /* 4316 */ { MAD_F(0x0449fb6d) /* 0.268062045 */, 18 }, - /* 4317 */ { MAD_F(0x044a5243) /* 0.268144860 */, 18 }, - /* 4318 */ { MAD_F(0x044aa91c) /* 0.268227681 */, 18 }, - /* 4319 */ { MAD_F(0x044afff6) /* 0.268310509 */, 18 }, - - /* 4320 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 18 }, - /* 4321 */ { MAD_F(0x044badaf) /* 0.268476184 */, 18 }, - /* 4322 */ { MAD_F(0x044c048e) /* 0.268559031 */, 18 }, - /* 4323 */ { MAD_F(0x044c5b6f) /* 0.268641885 */, 18 }, - /* 4324 */ { MAD_F(0x044cb251) /* 0.268724744 */, 18 }, - /* 4325 */ { MAD_F(0x044d0935) /* 0.268807611 */, 18 }, - /* 4326 */ { MAD_F(0x044d601b) /* 0.268890483 */, 18 }, - /* 4327 */ { MAD_F(0x044db703) /* 0.268973362 */, 18 }, - /* 4328 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 18 }, - /* 4329 */ { MAD_F(0x044e64d7) /* 0.269139139 */, 18 }, - /* 4330 */ { MAD_F(0x044ebbc4) /* 0.269222037 */, 18 }, - /* 4331 */ { MAD_F(0x044f12b3) /* 0.269304942 */, 18 }, - /* 4332 */ { MAD_F(0x044f69a3) /* 0.269387853 */, 18 }, - /* 4333 */ { MAD_F(0x044fc095) /* 0.269470770 */, 18 }, - /* 4334 */ { MAD_F(0x04501788) /* 0.269553694 */, 18 }, - /* 4335 */ { MAD_F(0x04506e7e) /* 0.269636624 */, 18 }, - - /* 4336 */ { MAD_F(0x0450c575) /* 0.269719560 */, 18 }, - /* 4337 */ { MAD_F(0x04511c6e) /* 0.269802503 */, 18 }, - /* 4338 */ { MAD_F(0x04517368) /* 0.269885452 */, 18 }, - /* 4339 */ { MAD_F(0x0451ca64) /* 0.269968408 */, 18 }, - /* 4340 */ { MAD_F(0x04522162) /* 0.270051370 */, 18 }, - /* 4341 */ { MAD_F(0x04527862) /* 0.270134338 */, 18 }, - /* 4342 */ { MAD_F(0x0452cf63) /* 0.270217312 */, 18 }, - /* 4343 */ { MAD_F(0x04532666) /* 0.270300293 */, 18 }, - /* 4344 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 18 }, - /* 4345 */ { MAD_F(0x0453d472) /* 0.270466275 */, 18 }, - /* 4346 */ { MAD_F(0x04542b7a) /* 0.270549275 */, 18 }, - /* 4347 */ { MAD_F(0x04548284) /* 0.270632281 */, 18 }, - /* 4348 */ { MAD_F(0x0454d98f) /* 0.270715294 */, 18 }, - /* 4349 */ { MAD_F(0x0455309c) /* 0.270798313 */, 18 }, - /* 4350 */ { MAD_F(0x045587ab) /* 0.270881339 */, 18 }, - /* 4351 */ { MAD_F(0x0455debc) /* 0.270964371 */, 18 }, - - /* 4352 */ { MAD_F(0x045635cf) /* 0.271047409 */, 18 }, - /* 4353 */ { MAD_F(0x04568ce3) /* 0.271130454 */, 18 }, - /* 4354 */ { MAD_F(0x0456e3f9) /* 0.271213505 */, 18 }, - /* 4355 */ { MAD_F(0x04573b10) /* 0.271296562 */, 18 }, - /* 4356 */ { MAD_F(0x04579229) /* 0.271379626 */, 18 }, - /* 4357 */ { MAD_F(0x0457e944) /* 0.271462696 */, 18 }, - /* 4358 */ { MAD_F(0x04584061) /* 0.271545772 */, 18 }, - /* 4359 */ { MAD_F(0x0458977f) /* 0.271628855 */, 18 }, - /* 4360 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 18 }, - /* 4361 */ { MAD_F(0x045945c1) /* 0.271795040 */, 18 }, - /* 4362 */ { MAD_F(0x04599ce5) /* 0.271878142 */, 18 }, - /* 4363 */ { MAD_F(0x0459f40a) /* 0.271961250 */, 18 }, - /* 4364 */ { MAD_F(0x045a4b31) /* 0.272044365 */, 18 }, - /* 4365 */ { MAD_F(0x045aa259) /* 0.272127486 */, 18 }, - /* 4366 */ { MAD_F(0x045af984) /* 0.272210613 */, 18 }, - /* 4367 */ { MAD_F(0x045b50b0) /* 0.272293746 */, 18 }, - - /* 4368 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 18 }, - /* 4369 */ { MAD_F(0x045bff0d) /* 0.272460033 */, 18 }, - /* 4370 */ { MAD_F(0x045c563e) /* 0.272543185 */, 18 }, - /* 4371 */ { MAD_F(0x045cad71) /* 0.272626344 */, 18 }, - /* 4372 */ { MAD_F(0x045d04a5) /* 0.272709510 */, 18 }, - /* 4373 */ { MAD_F(0x045d5bdc) /* 0.272792681 */, 18 }, - /* 4374 */ { MAD_F(0x045db313) /* 0.272875859 */, 18 }, - /* 4375 */ { MAD_F(0x045e0a4d) /* 0.272959044 */, 18 }, - /* 4376 */ { MAD_F(0x045e6188) /* 0.273042234 */, 18 }, - /* 4377 */ { MAD_F(0x045eb8c5) /* 0.273125431 */, 18 }, - /* 4378 */ { MAD_F(0x045f1004) /* 0.273208635 */, 18 }, - /* 4379 */ { MAD_F(0x045f6745) /* 0.273291844 */, 18 }, - /* 4380 */ { MAD_F(0x045fbe87) /* 0.273375060 */, 18 }, - /* 4381 */ { MAD_F(0x046015cb) /* 0.273458283 */, 18 }, - /* 4382 */ { MAD_F(0x04606d10) /* 0.273541511 */, 18 }, - /* 4383 */ { MAD_F(0x0460c457) /* 0.273624747 */, 18 }, - - /* 4384 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 18 }, - /* 4385 */ { MAD_F(0x046172eb) /* 0.273791236 */, 18 }, - /* 4386 */ { MAD_F(0x0461ca37) /* 0.273874490 */, 18 }, - /* 4387 */ { MAD_F(0x04622185) /* 0.273957750 */, 18 }, - /* 4388 */ { MAD_F(0x046278d5) /* 0.274041017 */, 18 }, - /* 4389 */ { MAD_F(0x0462d026) /* 0.274124290 */, 18 }, - /* 4390 */ { MAD_F(0x0463277a) /* 0.274207569 */, 18 }, - /* 4391 */ { MAD_F(0x04637ece) /* 0.274290855 */, 18 }, - /* 4392 */ { MAD_F(0x0463d625) /* 0.274374147 */, 18 }, - /* 4393 */ { MAD_F(0x04642d7d) /* 0.274457445 */, 18 }, - /* 4394 */ { MAD_F(0x046484d7) /* 0.274540749 */, 18 }, - /* 4395 */ { MAD_F(0x0464dc33) /* 0.274624060 */, 18 }, - /* 4396 */ { MAD_F(0x04653390) /* 0.274707378 */, 18 }, - /* 4397 */ { MAD_F(0x04658aef) /* 0.274790701 */, 18 }, - /* 4398 */ { MAD_F(0x0465e250) /* 0.274874031 */, 18 }, - /* 4399 */ { MAD_F(0x046639b2) /* 0.274957367 */, 18 }, - - /* 4400 */ { MAD_F(0x04669116) /* 0.275040710 */, 18 }, - /* 4401 */ { MAD_F(0x0466e87c) /* 0.275124059 */, 18 }, - /* 4402 */ { MAD_F(0x04673fe3) /* 0.275207414 */, 18 }, - /* 4403 */ { MAD_F(0x0467974d) /* 0.275290775 */, 18 }, - /* 4404 */ { MAD_F(0x0467eeb7) /* 0.275374143 */, 18 }, - /* 4405 */ { MAD_F(0x04684624) /* 0.275457517 */, 18 }, - /* 4406 */ { MAD_F(0x04689d92) /* 0.275540897 */, 18 }, - /* 4407 */ { MAD_F(0x0468f502) /* 0.275624284 */, 18 }, - /* 4408 */ { MAD_F(0x04694c74) /* 0.275707677 */, 18 }, - /* 4409 */ { MAD_F(0x0469a3e7) /* 0.275791076 */, 18 }, - /* 4410 */ { MAD_F(0x0469fb5c) /* 0.275874482 */, 18 }, - /* 4411 */ { MAD_F(0x046a52d3) /* 0.275957894 */, 18 }, - /* 4412 */ { MAD_F(0x046aaa4b) /* 0.276041312 */, 18 }, - /* 4413 */ { MAD_F(0x046b01c5) /* 0.276124737 */, 18 }, - /* 4414 */ { MAD_F(0x046b5941) /* 0.276208167 */, 18 }, - /* 4415 */ { MAD_F(0x046bb0bf) /* 0.276291605 */, 18 }, - - /* 4416 */ { MAD_F(0x046c083e) /* 0.276375048 */, 18 }, - /* 4417 */ { MAD_F(0x046c5fbf) /* 0.276458498 */, 18 }, - /* 4418 */ { MAD_F(0x046cb741) /* 0.276541954 */, 18 }, - /* 4419 */ { MAD_F(0x046d0ec5) /* 0.276625416 */, 18 }, - /* 4420 */ { MAD_F(0x046d664b) /* 0.276708885 */, 18 }, - /* 4421 */ { MAD_F(0x046dbdd3) /* 0.276792360 */, 18 }, - /* 4422 */ { MAD_F(0x046e155c) /* 0.276875841 */, 18 }, - /* 4423 */ { MAD_F(0x046e6ce7) /* 0.276959328 */, 18 }, - /* 4424 */ { MAD_F(0x046ec474) /* 0.277042822 */, 18 }, - /* 4425 */ { MAD_F(0x046f1c02) /* 0.277126322 */, 18 }, - /* 4426 */ { MAD_F(0x046f7392) /* 0.277209829 */, 18 }, - /* 4427 */ { MAD_F(0x046fcb24) /* 0.277293341 */, 18 }, - /* 4428 */ { MAD_F(0x047022b8) /* 0.277376860 */, 18 }, - /* 4429 */ { MAD_F(0x04707a4d) /* 0.277460385 */, 18 }, - /* 4430 */ { MAD_F(0x0470d1e4) /* 0.277543917 */, 18 }, - /* 4431 */ { MAD_F(0x0471297c) /* 0.277627455 */, 18 }, - - /* 4432 */ { MAD_F(0x04718116) /* 0.277710999 */, 18 }, - /* 4433 */ { MAD_F(0x0471d8b2) /* 0.277794549 */, 18 }, - /* 4434 */ { MAD_F(0x04723050) /* 0.277878106 */, 18 }, - /* 4435 */ { MAD_F(0x047287ef) /* 0.277961669 */, 18 }, - /* 4436 */ { MAD_F(0x0472df90) /* 0.278045238 */, 18 }, - /* 4437 */ { MAD_F(0x04733733) /* 0.278128813 */, 18 }, - /* 4438 */ { MAD_F(0x04738ed7) /* 0.278212395 */, 18 }, - /* 4439 */ { MAD_F(0x0473e67d) /* 0.278295983 */, 18 }, - /* 4440 */ { MAD_F(0x04743e25) /* 0.278379578 */, 18 }, - /* 4441 */ { MAD_F(0x047495ce) /* 0.278463178 */, 18 }, - /* 4442 */ { MAD_F(0x0474ed79) /* 0.278546785 */, 18 }, - /* 4443 */ { MAD_F(0x04754526) /* 0.278630398 */, 18 }, - /* 4444 */ { MAD_F(0x04759cd4) /* 0.278714018 */, 18 }, - /* 4445 */ { MAD_F(0x0475f484) /* 0.278797643 */, 18 }, - /* 4446 */ { MAD_F(0x04764c36) /* 0.278881275 */, 18 }, - /* 4447 */ { MAD_F(0x0476a3ea) /* 0.278964914 */, 18 }, - - /* 4448 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 18 }, - /* 4449 */ { MAD_F(0x04775356) /* 0.279132209 */, 18 }, - /* 4450 */ { MAD_F(0x0477ab0e) /* 0.279215866 */, 18 }, - /* 4451 */ { MAD_F(0x047802c8) /* 0.279299529 */, 18 }, - /* 4452 */ { MAD_F(0x04785a84) /* 0.279383199 */, 18 }, - /* 4453 */ { MAD_F(0x0478b242) /* 0.279466875 */, 18 }, - /* 4454 */ { MAD_F(0x04790a01) /* 0.279550557 */, 18 }, - /* 4455 */ { MAD_F(0x047961c2) /* 0.279634245 */, 18 }, - /* 4456 */ { MAD_F(0x0479b984) /* 0.279717940 */, 18 }, - /* 4457 */ { MAD_F(0x047a1149) /* 0.279801641 */, 18 }, - /* 4458 */ { MAD_F(0x047a690f) /* 0.279885348 */, 18 }, - /* 4459 */ { MAD_F(0x047ac0d6) /* 0.279969061 */, 18 }, - /* 4460 */ { MAD_F(0x047b18a0) /* 0.280052781 */, 18 }, - /* 4461 */ { MAD_F(0x047b706b) /* 0.280136507 */, 18 }, - /* 4462 */ { MAD_F(0x047bc837) /* 0.280220239 */, 18 }, - /* 4463 */ { MAD_F(0x047c2006) /* 0.280303978 */, 18 }, - - /* 4464 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 18 }, - /* 4465 */ { MAD_F(0x047ccfa8) /* 0.280471473 */, 18 }, - /* 4466 */ { MAD_F(0x047d277b) /* 0.280555230 */, 18 }, - /* 4467 */ { MAD_F(0x047d7f50) /* 0.280638994 */, 18 }, - /* 4468 */ { MAD_F(0x047dd727) /* 0.280722764 */, 18 }, - /* 4469 */ { MAD_F(0x047e2eff) /* 0.280806540 */, 18 }, - /* 4470 */ { MAD_F(0x047e86d9) /* 0.280890322 */, 18 }, - /* 4471 */ { MAD_F(0x047edeb5) /* 0.280974110 */, 18 }, - /* 4472 */ { MAD_F(0x047f3693) /* 0.281057905 */, 18 }, - /* 4473 */ { MAD_F(0x047f8e72) /* 0.281141706 */, 18 }, - /* 4474 */ { MAD_F(0x047fe653) /* 0.281225513 */, 18 }, - /* 4475 */ { MAD_F(0x04803e35) /* 0.281309326 */, 18 }, - /* 4476 */ { MAD_F(0x04809619) /* 0.281393146 */, 18 }, - /* 4477 */ { MAD_F(0x0480edff) /* 0.281476972 */, 18 }, - /* 4478 */ { MAD_F(0x048145e7) /* 0.281560804 */, 18 }, - /* 4479 */ { MAD_F(0x04819dd0) /* 0.281644643 */, 18 }, - - /* 4480 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 18 }, - /* 4481 */ { MAD_F(0x04824da7) /* 0.281812338 */, 18 }, - /* 4482 */ { MAD_F(0x0482a595) /* 0.281896195 */, 18 }, - /* 4483 */ { MAD_F(0x0482fd85) /* 0.281980059 */, 18 }, - /* 4484 */ { MAD_F(0x04835577) /* 0.282063928 */, 18 }, - /* 4485 */ { MAD_F(0x0483ad6a) /* 0.282147804 */, 18 }, - /* 4486 */ { MAD_F(0x0484055f) /* 0.282231686 */, 18 }, - /* 4487 */ { MAD_F(0x04845d56) /* 0.282315574 */, 18 }, - /* 4488 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 18 }, - /* 4489 */ { MAD_F(0x04850d48) /* 0.282483370 */, 18 }, - /* 4490 */ { MAD_F(0x04856544) /* 0.282567277 */, 18 }, - /* 4491 */ { MAD_F(0x0485bd41) /* 0.282651190 */, 18 }, - /* 4492 */ { MAD_F(0x04861540) /* 0.282735109 */, 18 }, - /* 4493 */ { MAD_F(0x04866d40) /* 0.282819035 */, 18 }, - /* 4494 */ { MAD_F(0x0486c543) /* 0.282902967 */, 18 }, - /* 4495 */ { MAD_F(0x04871d47) /* 0.282986905 */, 18 }, - - /* 4496 */ { MAD_F(0x0487754c) /* 0.283070849 */, 18 }, - /* 4497 */ { MAD_F(0x0487cd54) /* 0.283154800 */, 18 }, - /* 4498 */ { MAD_F(0x0488255d) /* 0.283238757 */, 18 }, - /* 4499 */ { MAD_F(0x04887d67) /* 0.283322720 */, 18 }, - /* 4500 */ { MAD_F(0x0488d574) /* 0.283406689 */, 18 }, - /* 4501 */ { MAD_F(0x04892d82) /* 0.283490665 */, 18 }, - /* 4502 */ { MAD_F(0x04898591) /* 0.283574646 */, 18 }, - /* 4503 */ { MAD_F(0x0489dda3) /* 0.283658634 */, 18 }, - /* 4504 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 18 }, - /* 4505 */ { MAD_F(0x048a8dca) /* 0.283826629 */, 18 }, - /* 4506 */ { MAD_F(0x048ae5e1) /* 0.283910635 */, 18 }, - /* 4507 */ { MAD_F(0x048b3df9) /* 0.283994648 */, 18 }, - /* 4508 */ { MAD_F(0x048b9612) /* 0.284078667 */, 18 }, - /* 4509 */ { MAD_F(0x048bee2e) /* 0.284162692 */, 18 }, - /* 4510 */ { MAD_F(0x048c464b) /* 0.284246723 */, 18 }, - /* 4511 */ { MAD_F(0x048c9e69) /* 0.284330761 */, 18 }, - - /* 4512 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 18 }, - /* 4513 */ { MAD_F(0x048d4eac) /* 0.284498855 */, 18 }, - /* 4514 */ { MAD_F(0x048da6cf) /* 0.284582911 */, 18 }, - /* 4515 */ { MAD_F(0x048dfef5) /* 0.284666974 */, 18 }, - /* 4516 */ { MAD_F(0x048e571c) /* 0.284751042 */, 18 }, - /* 4517 */ { MAD_F(0x048eaf44) /* 0.284835117 */, 18 }, - /* 4518 */ { MAD_F(0x048f076f) /* 0.284919198 */, 18 }, - /* 4519 */ { MAD_F(0x048f5f9b) /* 0.285003285 */, 18 }, - /* 4520 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 18 }, - /* 4521 */ { MAD_F(0x04900ff8) /* 0.285171479 */, 18 }, - /* 4522 */ { MAD_F(0x04906829) /* 0.285255584 */, 18 }, - /* 4523 */ { MAD_F(0x0490c05b) /* 0.285339697 */, 18 }, - /* 4524 */ { MAD_F(0x04911890) /* 0.285423815 */, 18 }, - /* 4525 */ { MAD_F(0x049170c6) /* 0.285507939 */, 18 }, - /* 4526 */ { MAD_F(0x0491c8fd) /* 0.285592070 */, 18 }, - /* 4527 */ { MAD_F(0x04922137) /* 0.285676207 */, 18 }, - - /* 4528 */ { MAD_F(0x04927972) /* 0.285760350 */, 18 }, - /* 4529 */ { MAD_F(0x0492d1ae) /* 0.285844499 */, 18 }, - /* 4530 */ { MAD_F(0x049329ed) /* 0.285928655 */, 18 }, - /* 4531 */ { MAD_F(0x0493822c) /* 0.286012816 */, 18 }, - /* 4532 */ { MAD_F(0x0493da6e) /* 0.286096984 */, 18 }, - /* 4533 */ { MAD_F(0x049432b1) /* 0.286181158 */, 18 }, - /* 4534 */ { MAD_F(0x04948af6) /* 0.286265338 */, 18 }, - /* 4535 */ { MAD_F(0x0494e33d) /* 0.286349525 */, 18 }, - /* 4536 */ { MAD_F(0x04953b85) /* 0.286433717 */, 18 }, - /* 4537 */ { MAD_F(0x049593cf) /* 0.286517916 */, 18 }, - /* 4538 */ { MAD_F(0x0495ec1b) /* 0.286602121 */, 18 }, - /* 4539 */ { MAD_F(0x04964468) /* 0.286686332 */, 18 }, - /* 4540 */ { MAD_F(0x04969cb7) /* 0.286770550 */, 18 }, - /* 4541 */ { MAD_F(0x0496f508) /* 0.286854773 */, 18 }, - /* 4542 */ { MAD_F(0x04974d5a) /* 0.286939003 */, 18 }, - /* 4543 */ { MAD_F(0x0497a5ae) /* 0.287023239 */, 18 }, - - /* 4544 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 18 }, - /* 4545 */ { MAD_F(0x0498565a) /* 0.287191729 */, 18 }, - /* 4546 */ { MAD_F(0x0498aeb3) /* 0.287275983 */, 18 }, - /* 4547 */ { MAD_F(0x0499070e) /* 0.287360244 */, 18 }, - /* 4548 */ { MAD_F(0x04995f6a) /* 0.287444511 */, 18 }, - /* 4549 */ { MAD_F(0x0499b7c8) /* 0.287528784 */, 18 }, - /* 4550 */ { MAD_F(0x049a1027) /* 0.287613063 */, 18 }, - /* 4551 */ { MAD_F(0x049a6889) /* 0.287697348 */, 18 }, - /* 4552 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 18 }, - /* 4553 */ { MAD_F(0x049b1950) /* 0.287865937 */, 18 }, - /* 4554 */ { MAD_F(0x049b71b6) /* 0.287950241 */, 18 }, - /* 4555 */ { MAD_F(0x049bca1e) /* 0.288034551 */, 18 }, - /* 4556 */ { MAD_F(0x049c2287) /* 0.288118867 */, 18 }, - /* 4557 */ { MAD_F(0x049c7af2) /* 0.288203190 */, 18 }, - /* 4558 */ { MAD_F(0x049cd35f) /* 0.288287518 */, 18 }, - /* 4559 */ { MAD_F(0x049d2bce) /* 0.288371853 */, 18 }, - - /* 4560 */ { MAD_F(0x049d843e) /* 0.288456194 */, 18 }, - /* 4561 */ { MAD_F(0x049ddcaf) /* 0.288540541 */, 18 }, - /* 4562 */ { MAD_F(0x049e3523) /* 0.288624894 */, 18 }, - /* 4563 */ { MAD_F(0x049e8d98) /* 0.288709253 */, 18 }, - /* 4564 */ { MAD_F(0x049ee60e) /* 0.288793619 */, 18 }, - /* 4565 */ { MAD_F(0x049f3e87) /* 0.288877990 */, 18 }, - /* 4566 */ { MAD_F(0x049f9701) /* 0.288962368 */, 18 }, - /* 4567 */ { MAD_F(0x049fef7c) /* 0.289046752 */, 18 }, - /* 4568 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 18 }, - /* 4569 */ { MAD_F(0x04a0a079) /* 0.289215538 */, 18 }, - /* 4570 */ { MAD_F(0x04a0f8f9) /* 0.289299941 */, 18 }, - /* 4571 */ { MAD_F(0x04a1517c) /* 0.289384349 */, 18 }, - /* 4572 */ { MAD_F(0x04a1a9ff) /* 0.289468764 */, 18 }, - /* 4573 */ { MAD_F(0x04a20285) /* 0.289553185 */, 18 }, - /* 4574 */ { MAD_F(0x04a25b0c) /* 0.289637612 */, 18 }, - /* 4575 */ { MAD_F(0x04a2b395) /* 0.289722045 */, 18 }, - - /* 4576 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 18 }, - /* 4577 */ { MAD_F(0x04a364ac) /* 0.289890930 */, 18 }, - /* 4578 */ { MAD_F(0x04a3bd3a) /* 0.289975382 */, 18 }, - /* 4579 */ { MAD_F(0x04a415c9) /* 0.290059840 */, 18 }, - /* 4580 */ { MAD_F(0x04a46e5a) /* 0.290144304 */, 18 }, - /* 4581 */ { MAD_F(0x04a4c6ed) /* 0.290228774 */, 18 }, - /* 4582 */ { MAD_F(0x04a51f81) /* 0.290313250 */, 18 }, - /* 4583 */ { MAD_F(0x04a57818) /* 0.290397733 */, 18 }, - /* 4584 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 18 }, - /* 4585 */ { MAD_F(0x04a62949) /* 0.290566716 */, 18 }, - /* 4586 */ { MAD_F(0x04a681e4) /* 0.290651217 */, 18 }, - /* 4587 */ { MAD_F(0x04a6da80) /* 0.290735724 */, 18 }, - /* 4588 */ { MAD_F(0x04a7331f) /* 0.290820237 */, 18 }, - /* 4589 */ { MAD_F(0x04a78bbf) /* 0.290904756 */, 18 }, - /* 4590 */ { MAD_F(0x04a7e460) /* 0.290989281 */, 18 }, - /* 4591 */ { MAD_F(0x04a83d03) /* 0.291073813 */, 18 }, - - /* 4592 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 18 }, - /* 4593 */ { MAD_F(0x04a8ee4f) /* 0.291242894 */, 18 }, - /* 4594 */ { MAD_F(0x04a946f7) /* 0.291327444 */, 18 }, - /* 4595 */ { MAD_F(0x04a99fa1) /* 0.291412001 */, 18 }, - /* 4596 */ { MAD_F(0x04a9f84c) /* 0.291496563 */, 18 }, - /* 4597 */ { MAD_F(0x04aa50fa) /* 0.291581131 */, 18 }, - /* 4598 */ { MAD_F(0x04aaa9a8) /* 0.291665706 */, 18 }, - /* 4599 */ { MAD_F(0x04ab0259) /* 0.291750286 */, 18 }, - /* 4600 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 18 }, - /* 4601 */ { MAD_F(0x04abb3bf) /* 0.291919466 */, 18 }, - /* 4602 */ { MAD_F(0x04ac0c74) /* 0.292004065 */, 18 }, - /* 4603 */ { MAD_F(0x04ac652b) /* 0.292088670 */, 18 }, - /* 4604 */ { MAD_F(0x04acbde4) /* 0.292173281 */, 18 }, - /* 4605 */ { MAD_F(0x04ad169e) /* 0.292257899 */, 18 }, - /* 4606 */ { MAD_F(0x04ad6f5a) /* 0.292342522 */, 18 }, - /* 4607 */ { MAD_F(0x04adc818) /* 0.292427152 */, 18 }, - - /* 4608 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 18 }, - /* 4609 */ { MAD_F(0x04ae7998) /* 0.292596430 */, 18 }, - /* 4610 */ { MAD_F(0x04aed25a) /* 0.292681078 */, 18 }, - /* 4611 */ { MAD_F(0x04af2b1e) /* 0.292765732 */, 18 }, - /* 4612 */ { MAD_F(0x04af83e4) /* 0.292850392 */, 18 }, - /* 4613 */ { MAD_F(0x04afdcac) /* 0.292935058 */, 18 }, - /* 4614 */ { MAD_F(0x04b03575) /* 0.293019731 */, 18 }, - /* 4615 */ { MAD_F(0x04b08e40) /* 0.293104409 */, 18 }, - /* 4616 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 18 }, - /* 4617 */ { MAD_F(0x04b13fda) /* 0.293273785 */, 18 }, - /* 4618 */ { MAD_F(0x04b198aa) /* 0.293358482 */, 18 }, - /* 4619 */ { MAD_F(0x04b1f17b) /* 0.293443185 */, 18 }, - /* 4620 */ { MAD_F(0x04b24a4e) /* 0.293527894 */, 18 }, - /* 4621 */ { MAD_F(0x04b2a322) /* 0.293612609 */, 18 }, - /* 4622 */ { MAD_F(0x04b2fbf9) /* 0.293697331 */, 18 }, - /* 4623 */ { MAD_F(0x04b354d1) /* 0.293782058 */, 18 }, - - /* 4624 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 18 }, - /* 4625 */ { MAD_F(0x04b40685) /* 0.293951532 */, 18 }, - /* 4626 */ { MAD_F(0x04b45f62) /* 0.294036278 */, 18 }, - /* 4627 */ { MAD_F(0x04b4b840) /* 0.294121029 */, 18 }, - /* 4628 */ { MAD_F(0x04b51120) /* 0.294205788 */, 18 }, - /* 4629 */ { MAD_F(0x04b56a02) /* 0.294290552 */, 18 }, - /* 4630 */ { MAD_F(0x04b5c2e6) /* 0.294375322 */, 18 }, - /* 4631 */ { MAD_F(0x04b61bcb) /* 0.294460098 */, 18 }, - /* 4632 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 18 }, - /* 4633 */ { MAD_F(0x04b6cd99) /* 0.294629669 */, 18 }, - /* 4634 */ { MAD_F(0x04b72683) /* 0.294714464 */, 18 }, - /* 4635 */ { MAD_F(0x04b77f6f) /* 0.294799265 */, 18 }, - /* 4636 */ { MAD_F(0x04b7d85c) /* 0.294884072 */, 18 }, - /* 4637 */ { MAD_F(0x04b8314b) /* 0.294968885 */, 18 }, - /* 4638 */ { MAD_F(0x04b88a3b) /* 0.295053704 */, 18 }, - /* 4639 */ { MAD_F(0x04b8e32d) /* 0.295138529 */, 18 }, - - /* 4640 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 18 }, - /* 4641 */ { MAD_F(0x04b99516) /* 0.295308197 */, 18 }, - /* 4642 */ { MAD_F(0x04b9ee0d) /* 0.295393041 */, 18 }, - /* 4643 */ { MAD_F(0x04ba4706) /* 0.295477890 */, 18 }, - /* 4644 */ { MAD_F(0x04baa000) /* 0.295562746 */, 18 }, - /* 4645 */ { MAD_F(0x04baf8fc) /* 0.295647608 */, 18 }, - /* 4646 */ { MAD_F(0x04bb51fa) /* 0.295732476 */, 18 }, - /* 4647 */ { MAD_F(0x04bbaaf9) /* 0.295817349 */, 18 }, - /* 4648 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 18 }, - /* 4649 */ { MAD_F(0x04bc5cfc) /* 0.295987115 */, 18 }, - /* 4650 */ { MAD_F(0x04bcb600) /* 0.296072008 */, 18 }, - /* 4651 */ { MAD_F(0x04bd0f06) /* 0.296156906 */, 18 }, - /* 4652 */ { MAD_F(0x04bd680d) /* 0.296241810 */, 18 }, - /* 4653 */ { MAD_F(0x04bdc116) /* 0.296326721 */, 18 }, - /* 4654 */ { MAD_F(0x04be1a21) /* 0.296411637 */, 18 }, - /* 4655 */ { MAD_F(0x04be732d) /* 0.296496560 */, 18 }, - - /* 4656 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 18 }, - /* 4657 */ { MAD_F(0x04bf254a) /* 0.296666423 */, 18 }, - /* 4658 */ { MAD_F(0x04bf7e5b) /* 0.296751364 */, 18 }, - /* 4659 */ { MAD_F(0x04bfd76e) /* 0.296836311 */, 18 }, - /* 4660 */ { MAD_F(0x04c03083) /* 0.296921264 */, 18 }, - /* 4661 */ { MAD_F(0x04c08999) /* 0.297006223 */, 18 }, - /* 4662 */ { MAD_F(0x04c0e2b0) /* 0.297091188 */, 18 }, - /* 4663 */ { MAD_F(0x04c13bca) /* 0.297176159 */, 18 }, - /* 4664 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 18 }, - /* 4665 */ { MAD_F(0x04c1ee01) /* 0.297346120 */, 18 }, - /* 4666 */ { MAD_F(0x04c2471f) /* 0.297431109 */, 18 }, - /* 4667 */ { MAD_F(0x04c2a03f) /* 0.297516105 */, 18 }, - /* 4668 */ { MAD_F(0x04c2f960) /* 0.297601106 */, 18 }, - /* 4669 */ { MAD_F(0x04c35283) /* 0.297686114 */, 18 }, - /* 4670 */ { MAD_F(0x04c3aba8) /* 0.297771128 */, 18 }, - /* 4671 */ { MAD_F(0x04c404ce) /* 0.297856147 */, 18 }, - - /* 4672 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 18 }, - /* 4673 */ { MAD_F(0x04c4b720) /* 0.298026205 */, 18 }, - /* 4674 */ { MAD_F(0x04c5104b) /* 0.298111243 */, 18 }, - /* 4675 */ { MAD_F(0x04c56978) /* 0.298196287 */, 18 }, - /* 4676 */ { MAD_F(0x04c5c2a7) /* 0.298281337 */, 18 }, - /* 4677 */ { MAD_F(0x04c61bd7) /* 0.298366393 */, 18 }, - /* 4678 */ { MAD_F(0x04c67508) /* 0.298451456 */, 18 }, - /* 4679 */ { MAD_F(0x04c6ce3c) /* 0.298536524 */, 18 }, - /* 4680 */ { MAD_F(0x04c72771) /* 0.298621598 */, 18 }, - /* 4681 */ { MAD_F(0x04c780a7) /* 0.298706679 */, 18 }, - /* 4682 */ { MAD_F(0x04c7d9df) /* 0.298791765 */, 18 }, - /* 4683 */ { MAD_F(0x04c83319) /* 0.298876858 */, 18 }, - /* 4684 */ { MAD_F(0x04c88c55) /* 0.298961956 */, 18 }, - /* 4685 */ { MAD_F(0x04c8e592) /* 0.299047061 */, 18 }, - /* 4686 */ { MAD_F(0x04c93ed1) /* 0.299132172 */, 18 }, - /* 4687 */ { MAD_F(0x04c99811) /* 0.299217288 */, 18 }, - - /* 4688 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 18 }, - /* 4689 */ { MAD_F(0x04ca4a97) /* 0.299387540 */, 18 }, - /* 4690 */ { MAD_F(0x04caa3dc) /* 0.299472675 */, 18 }, - /* 4691 */ { MAD_F(0x04cafd23) /* 0.299557816 */, 18 }, - /* 4692 */ { MAD_F(0x04cb566b) /* 0.299642963 */, 18 }, - /* 4693 */ { MAD_F(0x04cbafb5) /* 0.299728116 */, 18 }, - /* 4694 */ { MAD_F(0x04cc0901) /* 0.299813275 */, 18 }, - /* 4695 */ { MAD_F(0x04cc624e) /* 0.299898440 */, 18 }, - /* 4696 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 18 }, - /* 4697 */ { MAD_F(0x04cd14ee) /* 0.300068789 */, 18 }, - /* 4698 */ { MAD_F(0x04cd6e40) /* 0.300153972 */, 18 }, - /* 4699 */ { MAD_F(0x04cdc794) /* 0.300239161 */, 18 }, - /* 4700 */ { MAD_F(0x04ce20e9) /* 0.300324357 */, 18 }, - /* 4701 */ { MAD_F(0x04ce7a40) /* 0.300409558 */, 18 }, - /* 4702 */ { MAD_F(0x04ced399) /* 0.300494765 */, 18 }, - /* 4703 */ { MAD_F(0x04cf2cf3) /* 0.300579979 */, 18 }, - - /* 4704 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 18 }, - /* 4705 */ { MAD_F(0x04cfdfad) /* 0.300750424 */, 18 }, - /* 4706 */ { MAD_F(0x04d0390c) /* 0.300835656 */, 18 }, - /* 4707 */ { MAD_F(0x04d0926d) /* 0.300920893 */, 18 }, - /* 4708 */ { MAD_F(0x04d0ebcf) /* 0.301006137 */, 18 }, - /* 4709 */ { MAD_F(0x04d14533) /* 0.301091387 */, 18 }, - /* 4710 */ { MAD_F(0x04d19e99) /* 0.301176643 */, 18 }, - /* 4711 */ { MAD_F(0x04d1f800) /* 0.301261904 */, 18 }, - /* 4712 */ { MAD_F(0x04d25169) /* 0.301347172 */, 18 }, - /* 4713 */ { MAD_F(0x04d2aad4) /* 0.301432446 */, 18 }, - /* 4714 */ { MAD_F(0x04d30440) /* 0.301517726 */, 18 }, - /* 4715 */ { MAD_F(0x04d35dae) /* 0.301603012 */, 18 }, - /* 4716 */ { MAD_F(0x04d3b71d) /* 0.301688304 */, 18 }, - /* 4717 */ { MAD_F(0x04d4108e) /* 0.301773602 */, 18 }, - /* 4718 */ { MAD_F(0x04d46a01) /* 0.301858906 */, 18 }, - /* 4719 */ { MAD_F(0x04d4c375) /* 0.301944216 */, 18 }, - - /* 4720 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 18 }, - /* 4721 */ { MAD_F(0x04d57662) /* 0.302114854 */, 18 }, - /* 4722 */ { MAD_F(0x04d5cfdb) /* 0.302200182 */, 18 }, - /* 4723 */ { MAD_F(0x04d62956) /* 0.302285516 */, 18 }, - /* 4724 */ { MAD_F(0x04d682d2) /* 0.302370856 */, 18 }, - /* 4725 */ { MAD_F(0x04d6dc50) /* 0.302456203 */, 18 }, - /* 4726 */ { MAD_F(0x04d735d0) /* 0.302541555 */, 18 }, - /* 4727 */ { MAD_F(0x04d78f51) /* 0.302626913 */, 18 }, - /* 4728 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 18 }, - /* 4729 */ { MAD_F(0x04d84258) /* 0.302797648 */, 18 }, - /* 4730 */ { MAD_F(0x04d89bde) /* 0.302883024 */, 18 }, - /* 4731 */ { MAD_F(0x04d8f566) /* 0.302968406 */, 18 }, - /* 4732 */ { MAD_F(0x04d94eef) /* 0.303053794 */, 18 }, - /* 4733 */ { MAD_F(0x04d9a87a) /* 0.303139189 */, 18 }, - /* 4734 */ { MAD_F(0x04da0207) /* 0.303224589 */, 18 }, - /* 4735 */ { MAD_F(0x04da5b95) /* 0.303309995 */, 18 }, - - /* 4736 */ { MAD_F(0x04dab524) /* 0.303395408 */, 18 }, - /* 4737 */ { MAD_F(0x04db0eb6) /* 0.303480826 */, 18 }, - /* 4738 */ { MAD_F(0x04db6849) /* 0.303566251 */, 18 }, - /* 4739 */ { MAD_F(0x04dbc1dd) /* 0.303651681 */, 18 }, - /* 4740 */ { MAD_F(0x04dc1b73) /* 0.303737117 */, 18 }, - /* 4741 */ { MAD_F(0x04dc750b) /* 0.303822560 */, 18 }, - /* 4742 */ { MAD_F(0x04dccea5) /* 0.303908008 */, 18 }, - /* 4743 */ { MAD_F(0x04dd2840) /* 0.303993463 */, 18 }, - /* 4744 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 18 }, - /* 4745 */ { MAD_F(0x04dddb7a) /* 0.304164390 */, 18 }, - /* 4746 */ { MAD_F(0x04de351a) /* 0.304249862 */, 18 }, - /* 4747 */ { MAD_F(0x04de8ebc) /* 0.304335340 */, 18 }, - /* 4748 */ { MAD_F(0x04dee85f) /* 0.304420825 */, 18 }, - /* 4749 */ { MAD_F(0x04df4203) /* 0.304506315 */, 18 }, - /* 4750 */ { MAD_F(0x04df9baa) /* 0.304591812 */, 18 }, - /* 4751 */ { MAD_F(0x04dff552) /* 0.304677314 */, 18 }, - - /* 4752 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 18 }, - /* 4753 */ { MAD_F(0x04e0a8a6) /* 0.304848337 */, 18 }, - /* 4754 */ { MAD_F(0x04e10253) /* 0.304933858 */, 18 }, - /* 4755 */ { MAD_F(0x04e15c01) /* 0.305019384 */, 18 }, - /* 4756 */ { MAD_F(0x04e1b5b1) /* 0.305104917 */, 18 }, - /* 4757 */ { MAD_F(0x04e20f63) /* 0.305190455 */, 18 }, - /* 4758 */ { MAD_F(0x04e26916) /* 0.305275999 */, 18 }, - /* 4759 */ { MAD_F(0x04e2c2cb) /* 0.305361550 */, 18 }, - /* 4760 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 18 }, - /* 4761 */ { MAD_F(0x04e37639) /* 0.305532669 */, 18 }, - /* 4762 */ { MAD_F(0x04e3cff3) /* 0.305618237 */, 18 }, - /* 4763 */ { MAD_F(0x04e429ae) /* 0.305703811 */, 18 }, - /* 4764 */ { MAD_F(0x04e4836b) /* 0.305789392 */, 18 }, - /* 4765 */ { MAD_F(0x04e4dd29) /* 0.305874978 */, 18 }, - /* 4766 */ { MAD_F(0x04e536e9) /* 0.305960571 */, 18 }, - /* 4767 */ { MAD_F(0x04e590ab) /* 0.306046169 */, 18 }, - - /* 4768 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 18 }, - /* 4769 */ { MAD_F(0x04e64433) /* 0.306217383 */, 18 }, - /* 4770 */ { MAD_F(0x04e69df9) /* 0.306303000 */, 18 }, - /* 4771 */ { MAD_F(0x04e6f7c1) /* 0.306388622 */, 18 }, - /* 4772 */ { MAD_F(0x04e7518b) /* 0.306474250 */, 18 }, - /* 4773 */ { MAD_F(0x04e7ab56) /* 0.306559885 */, 18 }, - /* 4774 */ { MAD_F(0x04e80523) /* 0.306645525 */, 18 }, - /* 4775 */ { MAD_F(0x04e85ef2) /* 0.306731171 */, 18 }, - /* 4776 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 18 }, - /* 4777 */ { MAD_F(0x04e91293) /* 0.306902481 */, 18 }, - /* 4778 */ { MAD_F(0x04e96c67) /* 0.306988145 */, 18 }, - /* 4779 */ { MAD_F(0x04e9c63b) /* 0.307073816 */, 18 }, - /* 4780 */ { MAD_F(0x04ea2012) /* 0.307159492 */, 18 }, - /* 4781 */ { MAD_F(0x04ea79ea) /* 0.307245174 */, 18 }, - /* 4782 */ { MAD_F(0x04ead3c4) /* 0.307330862 */, 18 }, - /* 4783 */ { MAD_F(0x04eb2d9f) /* 0.307416556 */, 18 }, - - /* 4784 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 18 }, - /* 4785 */ { MAD_F(0x04ebe15b) /* 0.307587962 */, 18 }, - /* 4786 */ { MAD_F(0x04ec3b3b) /* 0.307673674 */, 18 }, - /* 4787 */ { MAD_F(0x04ec951c) /* 0.307759392 */, 18 }, - /* 4788 */ { MAD_F(0x04ecef00) /* 0.307845115 */, 18 }, - /* 4789 */ { MAD_F(0x04ed48e5) /* 0.307930845 */, 18 }, - /* 4790 */ { MAD_F(0x04eda2cb) /* 0.308016581 */, 18 }, - /* 4791 */ { MAD_F(0x04edfcb3) /* 0.308102323 */, 18 }, - /* 4792 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 18 }, - /* 4793 */ { MAD_F(0x04eeb088) /* 0.308273824 */, 18 }, - /* 4794 */ { MAD_F(0x04ef0a75) /* 0.308359584 */, 18 }, - /* 4795 */ { MAD_F(0x04ef6464) /* 0.308445350 */, 18 }, - /* 4796 */ { MAD_F(0x04efbe54) /* 0.308531121 */, 18 }, - /* 4797 */ { MAD_F(0x04f01846) /* 0.308616899 */, 18 }, - /* 4798 */ { MAD_F(0x04f07239) /* 0.308702682 */, 18 }, - /* 4799 */ { MAD_F(0x04f0cc2e) /* 0.308788472 */, 18 }, - - /* 4800 */ { MAD_F(0x04f12624) /* 0.308874267 */, 18 }, - /* 4801 */ { MAD_F(0x04f1801d) /* 0.308960068 */, 18 }, - /* 4802 */ { MAD_F(0x04f1da16) /* 0.309045876 */, 18 }, - /* 4803 */ { MAD_F(0x04f23412) /* 0.309131689 */, 18 }, - /* 4804 */ { MAD_F(0x04f28e0f) /* 0.309217508 */, 18 }, - /* 4805 */ { MAD_F(0x04f2e80d) /* 0.309303334 */, 18 }, - /* 4806 */ { MAD_F(0x04f3420d) /* 0.309389165 */, 18 }, - /* 4807 */ { MAD_F(0x04f39c0f) /* 0.309475002 */, 18 }, - /* 4808 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 18 }, - /* 4809 */ { MAD_F(0x04f45017) /* 0.309646694 */, 18 }, - /* 4810 */ { MAD_F(0x04f4aa1e) /* 0.309732549 */, 18 }, - /* 4811 */ { MAD_F(0x04f50426) /* 0.309818410 */, 18 }, - /* 4812 */ { MAD_F(0x04f55e30) /* 0.309904277 */, 18 }, - /* 4813 */ { MAD_F(0x04f5b83b) /* 0.309990150 */, 18 }, - /* 4814 */ { MAD_F(0x04f61248) /* 0.310076028 */, 18 }, - /* 4815 */ { MAD_F(0x04f66c56) /* 0.310161913 */, 18 }, - - /* 4816 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 18 }, - /* 4817 */ { MAD_F(0x04f72078) /* 0.310333700 */, 18 }, - /* 4818 */ { MAD_F(0x04f77a8b) /* 0.310419603 */, 18 }, - /* 4819 */ { MAD_F(0x04f7d4a0) /* 0.310505511 */, 18 }, - /* 4820 */ { MAD_F(0x04f82eb7) /* 0.310591426 */, 18 }, - /* 4821 */ { MAD_F(0x04f888cf) /* 0.310677346 */, 18 }, - /* 4822 */ { MAD_F(0x04f8e2e9) /* 0.310763272 */, 18 }, - /* 4823 */ { MAD_F(0x04f93d04) /* 0.310849205 */, 18 }, - /* 4824 */ { MAD_F(0x04f99721) /* 0.310935143 */, 18 }, - /* 4825 */ { MAD_F(0x04f9f13f) /* 0.311021087 */, 18 }, - /* 4826 */ { MAD_F(0x04fa4b5f) /* 0.311107037 */, 18 }, - /* 4827 */ { MAD_F(0x04faa581) /* 0.311192993 */, 18 }, - /* 4828 */ { MAD_F(0x04faffa4) /* 0.311278955 */, 18 }, - /* 4829 */ { MAD_F(0x04fb59c9) /* 0.311364923 */, 18 }, - /* 4830 */ { MAD_F(0x04fbb3ef) /* 0.311450897 */, 18 }, - /* 4831 */ { MAD_F(0x04fc0e17) /* 0.311536877 */, 18 }, - - /* 4832 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 18 }, - /* 4833 */ { MAD_F(0x04fcc26c) /* 0.311708854 */, 18 }, - /* 4834 */ { MAD_F(0x04fd1c99) /* 0.311794851 */, 18 }, - /* 4835 */ { MAD_F(0x04fd76c7) /* 0.311880855 */, 18 }, - /* 4836 */ { MAD_F(0x04fdd0f7) /* 0.311966864 */, 18 }, - /* 4837 */ { MAD_F(0x04fe2b29) /* 0.312052880 */, 18 }, - /* 4838 */ { MAD_F(0x04fe855c) /* 0.312138901 */, 18 }, - /* 4839 */ { MAD_F(0x04fedf91) /* 0.312224928 */, 18 }, - /* 4840 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 18 }, - /* 4841 */ { MAD_F(0x04ff93ff) /* 0.312397000 */, 18 }, - /* 4842 */ { MAD_F(0x04ffee38) /* 0.312483045 */, 18 }, - /* 4843 */ { MAD_F(0x05004874) /* 0.312569096 */, 18 }, - /* 4844 */ { MAD_F(0x0500a2b0) /* 0.312655153 */, 18 }, - /* 4845 */ { MAD_F(0x0500fcef) /* 0.312741216 */, 18 }, - /* 4846 */ { MAD_F(0x0501572e) /* 0.312827284 */, 18 }, - /* 4847 */ { MAD_F(0x0501b170) /* 0.312913359 */, 18 }, - - /* 4848 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 18 }, - /* 4849 */ { MAD_F(0x050265f8) /* 0.313085526 */, 18 }, - /* 4850 */ { MAD_F(0x0502c03e) /* 0.313171618 */, 18 }, - /* 4851 */ { MAD_F(0x05031a86) /* 0.313257716 */, 18 }, - /* 4852 */ { MAD_F(0x050374cf) /* 0.313343820 */, 18 }, - /* 4853 */ { MAD_F(0x0503cf1a) /* 0.313429931 */, 18 }, - /* 4854 */ { MAD_F(0x05042967) /* 0.313516047 */, 18 }, - /* 4855 */ { MAD_F(0x050483b5) /* 0.313602168 */, 18 }, - /* 4856 */ { MAD_F(0x0504de05) /* 0.313688296 */, 18 }, - /* 4857 */ { MAD_F(0x05053856) /* 0.313774430 */, 18 }, - /* 4858 */ { MAD_F(0x050592a9) /* 0.313860570 */, 18 }, - /* 4859 */ { MAD_F(0x0505ecfd) /* 0.313946715 */, 18 }, - /* 4860 */ { MAD_F(0x05064754) /* 0.314032867 */, 18 }, - /* 4861 */ { MAD_F(0x0506a1ab) /* 0.314119024 */, 18 }, - /* 4862 */ { MAD_F(0x0506fc04) /* 0.314205187 */, 18 }, - /* 4863 */ { MAD_F(0x0507565f) /* 0.314291357 */, 18 }, - - /* 4864 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 18 }, - /* 4865 */ { MAD_F(0x05080b1a) /* 0.314463713 */, 18 }, - /* 4866 */ { MAD_F(0x05086579) /* 0.314549900 */, 18 }, - /* 4867 */ { MAD_F(0x0508bfdb) /* 0.314636092 */, 18 }, - /* 4868 */ { MAD_F(0x05091a3d) /* 0.314722291 */, 18 }, - /* 4869 */ { MAD_F(0x050974a2) /* 0.314808496 */, 18 }, - /* 4870 */ { MAD_F(0x0509cf08) /* 0.314894706 */, 18 }, - /* 4871 */ { MAD_F(0x050a296f) /* 0.314980923 */, 18 }, - /* 4872 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 18 }, - /* 4873 */ { MAD_F(0x050ade43) /* 0.315153373 */, 18 }, - /* 4874 */ { MAD_F(0x050b38af) /* 0.315239607 */, 18 }, - /* 4875 */ { MAD_F(0x050b931d) /* 0.315325847 */, 18 }, - /* 4876 */ { MAD_F(0x050bed8d) /* 0.315412093 */, 18 }, - /* 4877 */ { MAD_F(0x050c47fe) /* 0.315498345 */, 18 }, - /* 4878 */ { MAD_F(0x050ca271) /* 0.315584603 */, 18 }, - /* 4879 */ { MAD_F(0x050cfce5) /* 0.315670866 */, 18 }, - - /* 4880 */ { MAD_F(0x050d575b) /* 0.315757136 */, 18 }, - /* 4881 */ { MAD_F(0x050db1d2) /* 0.315843411 */, 18 }, - /* 4882 */ { MAD_F(0x050e0c4b) /* 0.315929693 */, 18 }, - /* 4883 */ { MAD_F(0x050e66c5) /* 0.316015980 */, 18 }, - /* 4884 */ { MAD_F(0x050ec141) /* 0.316102273 */, 18 }, - /* 4885 */ { MAD_F(0x050f1bbf) /* 0.316188572 */, 18 }, - /* 4886 */ { MAD_F(0x050f763e) /* 0.316274877 */, 18 }, - /* 4887 */ { MAD_F(0x050fd0bf) /* 0.316361187 */, 18 }, - /* 4888 */ { MAD_F(0x05102b42) /* 0.316447504 */, 18 }, - /* 4889 */ { MAD_F(0x051085c6) /* 0.316533826 */, 18 }, - /* 4890 */ { MAD_F(0x0510e04b) /* 0.316620155 */, 18 }, - /* 4891 */ { MAD_F(0x05113ad3) /* 0.316706489 */, 18 }, - /* 4892 */ { MAD_F(0x0511955b) /* 0.316792829 */, 18 }, - /* 4893 */ { MAD_F(0x0511efe6) /* 0.316879175 */, 18 }, - /* 4894 */ { MAD_F(0x05124a72) /* 0.316965527 */, 18 }, - /* 4895 */ { MAD_F(0x0512a4ff) /* 0.317051885 */, 18 }, - - /* 4896 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 18 }, - /* 4897 */ { MAD_F(0x05135a1f) /* 0.317224618 */, 18 }, - /* 4898 */ { MAD_F(0x0513b4b1) /* 0.317310994 */, 18 }, - /* 4899 */ { MAD_F(0x05140f45) /* 0.317397375 */, 18 }, - /* 4900 */ { MAD_F(0x051469da) /* 0.317483762 */, 18 }, - /* 4901 */ { MAD_F(0x0514c471) /* 0.317570155 */, 18 }, - /* 4902 */ { MAD_F(0x05151f0a) /* 0.317656554 */, 18 }, - /* 4903 */ { MAD_F(0x051579a4) /* 0.317742959 */, 18 }, - /* 4904 */ { MAD_F(0x0515d440) /* 0.317829370 */, 18 }, - /* 4905 */ { MAD_F(0x05162edd) /* 0.317915786 */, 18 }, - /* 4906 */ { MAD_F(0x0516897c) /* 0.318002209 */, 18 }, - /* 4907 */ { MAD_F(0x0516e41c) /* 0.318088637 */, 18 }, - /* 4908 */ { MAD_F(0x05173ebe) /* 0.318175071 */, 18 }, - /* 4909 */ { MAD_F(0x05179962) /* 0.318261511 */, 18 }, - /* 4910 */ { MAD_F(0x0517f407) /* 0.318347957 */, 18 }, - /* 4911 */ { MAD_F(0x05184eae) /* 0.318434409 */, 18 }, - - /* 4912 */ { MAD_F(0x0518a956) /* 0.318520867 */, 18 }, - /* 4913 */ { MAD_F(0x05190400) /* 0.318607330 */, 18 }, - /* 4914 */ { MAD_F(0x05195eab) /* 0.318693800 */, 18 }, - /* 4915 */ { MAD_F(0x0519b958) /* 0.318780275 */, 18 }, - /* 4916 */ { MAD_F(0x051a1407) /* 0.318866756 */, 18 }, - /* 4917 */ { MAD_F(0x051a6eb7) /* 0.318953243 */, 18 }, - /* 4918 */ { MAD_F(0x051ac969) /* 0.319039736 */, 18 }, - /* 4919 */ { MAD_F(0x051b241c) /* 0.319126235 */, 18 }, - /* 4920 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 18 }, - /* 4921 */ { MAD_F(0x051bd987) /* 0.319299250 */, 18 }, - /* 4922 */ { MAD_F(0x051c3440) /* 0.319385766 */, 18 }, - /* 4923 */ { MAD_F(0x051c8ef9) /* 0.319472288 */, 18 }, - /* 4924 */ { MAD_F(0x051ce9b4) /* 0.319558816 */, 18 }, - /* 4925 */ { MAD_F(0x051d4471) /* 0.319645350 */, 18 }, - /* 4926 */ { MAD_F(0x051d9f2f) /* 0.319731890 */, 18 }, - /* 4927 */ { MAD_F(0x051df9ef) /* 0.319818435 */, 18 }, - - /* 4928 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 18 }, - /* 4929 */ { MAD_F(0x051eaf74) /* 0.319991544 */, 18 }, - /* 4930 */ { MAD_F(0x051f0a38) /* 0.320078107 */, 18 }, - /* 4931 */ { MAD_F(0x051f64ff) /* 0.320164676 */, 18 }, - /* 4932 */ { MAD_F(0x051fbfc6) /* 0.320251251 */, 18 }, - /* 4933 */ { MAD_F(0x05201a90) /* 0.320337832 */, 18 }, - /* 4934 */ { MAD_F(0x0520755b) /* 0.320424419 */, 18 }, - /* 4935 */ { MAD_F(0x0520d027) /* 0.320511011 */, 18 }, - /* 4936 */ { MAD_F(0x05212af5) /* 0.320597609 */, 18 }, - /* 4937 */ { MAD_F(0x052185c5) /* 0.320684213 */, 18 }, - /* 4938 */ { MAD_F(0x0521e096) /* 0.320770823 */, 18 }, - /* 4939 */ { MAD_F(0x05223b69) /* 0.320857439 */, 18 }, - /* 4940 */ { MAD_F(0x0522963d) /* 0.320944061 */, 18 }, - /* 4941 */ { MAD_F(0x0522f113) /* 0.321030688 */, 18 }, - /* 4942 */ { MAD_F(0x05234bea) /* 0.321117322 */, 18 }, - /* 4943 */ { MAD_F(0x0523a6c3) /* 0.321203961 */, 18 }, - - /* 4944 */ { MAD_F(0x0524019e) /* 0.321290606 */, 18 }, - /* 4945 */ { MAD_F(0x05245c7a) /* 0.321377257 */, 18 }, - /* 4946 */ { MAD_F(0x0524b758) /* 0.321463913 */, 18 }, - /* 4947 */ { MAD_F(0x05251237) /* 0.321550576 */, 18 }, - /* 4948 */ { MAD_F(0x05256d18) /* 0.321637244 */, 18 }, - /* 4949 */ { MAD_F(0x0525c7fb) /* 0.321723919 */, 18 }, - /* 4950 */ { MAD_F(0x052622df) /* 0.321810599 */, 18 }, - /* 4951 */ { MAD_F(0x05267dc4) /* 0.321897285 */, 18 }, - /* 4952 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 18 }, - /* 4953 */ { MAD_F(0x05273394) /* 0.322070674 */, 18 }, - /* 4954 */ { MAD_F(0x05278e7e) /* 0.322157377 */, 18 }, - /* 4955 */ { MAD_F(0x0527e96a) /* 0.322244087 */, 18 }, - /* 4956 */ { MAD_F(0x05284457) /* 0.322330802 */, 18 }, - /* 4957 */ { MAD_F(0x05289f46) /* 0.322417523 */, 18 }, - /* 4958 */ { MAD_F(0x0528fa37) /* 0.322504249 */, 18 }, - /* 4959 */ { MAD_F(0x05295529) /* 0.322590982 */, 18 }, - - /* 4960 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 18 }, - /* 4961 */ { MAD_F(0x052a0b12) /* 0.322764465 */, 18 }, - /* 4962 */ { MAD_F(0x052a6609) /* 0.322851215 */, 18 }, - /* 4963 */ { MAD_F(0x052ac101) /* 0.322937971 */, 18 }, - /* 4964 */ { MAD_F(0x052b1bfb) /* 0.323024732 */, 18 }, - /* 4965 */ { MAD_F(0x052b76f7) /* 0.323111500 */, 18 }, - /* 4966 */ { MAD_F(0x052bd1f4) /* 0.323198273 */, 18 }, - /* 4967 */ { MAD_F(0x052c2cf2) /* 0.323285052 */, 18 }, - /* 4968 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 18 }, - /* 4969 */ { MAD_F(0x052ce2f4) /* 0.323458628 */, 18 }, - /* 4970 */ { MAD_F(0x052d3df7) /* 0.323545425 */, 18 }, - /* 4971 */ { MAD_F(0x052d98fc) /* 0.323632227 */, 18 }, - /* 4972 */ { MAD_F(0x052df403) /* 0.323719036 */, 18 }, - /* 4973 */ { MAD_F(0x052e4f0b) /* 0.323805850 */, 18 }, - /* 4974 */ { MAD_F(0x052eaa14) /* 0.323892670 */, 18 }, - /* 4975 */ { MAD_F(0x052f051f) /* 0.323979496 */, 18 }, - - /* 4976 */ { MAD_F(0x052f602c) /* 0.324066327 */, 18 }, - /* 4977 */ { MAD_F(0x052fbb3a) /* 0.324153165 */, 18 }, - /* 4978 */ { MAD_F(0x0530164a) /* 0.324240008 */, 18 }, - /* 4979 */ { MAD_F(0x0530715b) /* 0.324326857 */, 18 }, - /* 4980 */ { MAD_F(0x0530cc6e) /* 0.324413712 */, 18 }, - /* 4981 */ { MAD_F(0x05312783) /* 0.324500572 */, 18 }, - /* 4982 */ { MAD_F(0x05318299) /* 0.324587439 */, 18 }, - /* 4983 */ { MAD_F(0x0531ddb0) /* 0.324674311 */, 18 }, - /* 4984 */ { MAD_F(0x053238ca) /* 0.324761189 */, 18 }, - /* 4985 */ { MAD_F(0x053293e4) /* 0.324848073 */, 18 }, - /* 4986 */ { MAD_F(0x0532ef01) /* 0.324934963 */, 18 }, - /* 4987 */ { MAD_F(0x05334a1e) /* 0.325021858 */, 18 }, - /* 4988 */ { MAD_F(0x0533a53e) /* 0.325108760 */, 18 }, - /* 4989 */ { MAD_F(0x0534005f) /* 0.325195667 */, 18 }, - /* 4990 */ { MAD_F(0x05345b81) /* 0.325282580 */, 18 }, - /* 4991 */ { MAD_F(0x0534b6a5) /* 0.325369498 */, 18 }, - - /* 4992 */ { MAD_F(0x053511cb) /* 0.325456423 */, 18 }, - /* 4993 */ { MAD_F(0x05356cf2) /* 0.325543353 */, 18 }, - /* 4994 */ { MAD_F(0x0535c81b) /* 0.325630290 */, 18 }, - /* 4995 */ { MAD_F(0x05362345) /* 0.325717232 */, 18 }, - /* 4996 */ { MAD_F(0x05367e71) /* 0.325804179 */, 18 }, - /* 4997 */ { MAD_F(0x0536d99f) /* 0.325891133 */, 18 }, - /* 4998 */ { MAD_F(0x053734ce) /* 0.325978092 */, 18 }, - /* 4999 */ { MAD_F(0x05378ffe) /* 0.326065057 */, 18 }, - /* 5000 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 18 }, - /* 5001 */ { MAD_F(0x05384664) /* 0.326239005 */, 18 }, - /* 5002 */ { MAD_F(0x0538a199) /* 0.326325988 */, 18 }, - /* 5003 */ { MAD_F(0x0538fcd0) /* 0.326412976 */, 18 }, - /* 5004 */ { MAD_F(0x05395808) /* 0.326499970 */, 18 }, - /* 5005 */ { MAD_F(0x0539b342) /* 0.326586970 */, 18 }, - /* 5006 */ { MAD_F(0x053a0e7d) /* 0.326673976 */, 18 }, - /* 5007 */ { MAD_F(0x053a69ba) /* 0.326760988 */, 18 }, - - /* 5008 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 18 }, - /* 5009 */ { MAD_F(0x053b2039) /* 0.326935028 */, 18 }, - /* 5010 */ { MAD_F(0x053b7b7b) /* 0.327022057 */, 18 }, - /* 5011 */ { MAD_F(0x053bd6be) /* 0.327109092 */, 18 }, - /* 5012 */ { MAD_F(0x053c3203) /* 0.327196132 */, 18 }, - /* 5013 */ { MAD_F(0x053c8d49) /* 0.327283178 */, 18 }, - /* 5014 */ { MAD_F(0x053ce891) /* 0.327370231 */, 18 }, - /* 5015 */ { MAD_F(0x053d43da) /* 0.327457288 */, 18 }, - /* 5016 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 18 }, - /* 5017 */ { MAD_F(0x053dfa72) /* 0.327631421 */, 18 }, - /* 5018 */ { MAD_F(0x053e55c0) /* 0.327718497 */, 18 }, - /* 5019 */ { MAD_F(0x053eb10f) /* 0.327805578 */, 18 }, - /* 5020 */ { MAD_F(0x053f0c61) /* 0.327892665 */, 18 }, - /* 5021 */ { MAD_F(0x053f67b3) /* 0.327979757 */, 18 }, - /* 5022 */ { MAD_F(0x053fc308) /* 0.328066855 */, 18 }, - /* 5023 */ { MAD_F(0x05401e5e) /* 0.328153960 */, 18 }, - - /* 5024 */ { MAD_F(0x054079b5) /* 0.328241070 */, 18 }, - /* 5025 */ { MAD_F(0x0540d50e) /* 0.328328185 */, 18 }, - /* 5026 */ { MAD_F(0x05413068) /* 0.328415307 */, 18 }, - /* 5027 */ { MAD_F(0x05418bc4) /* 0.328502434 */, 18 }, - /* 5028 */ { MAD_F(0x0541e722) /* 0.328589567 */, 18 }, - /* 5029 */ { MAD_F(0x05424281) /* 0.328676706 */, 18 }, - /* 5030 */ { MAD_F(0x05429de2) /* 0.328763850 */, 18 }, - /* 5031 */ { MAD_F(0x0542f944) /* 0.328851001 */, 18 }, - /* 5032 */ { MAD_F(0x054354a8) /* 0.328938157 */, 18 }, - /* 5033 */ { MAD_F(0x0543b00d) /* 0.329025319 */, 18 }, - /* 5034 */ { MAD_F(0x05440b74) /* 0.329112486 */, 18 }, - /* 5035 */ { MAD_F(0x054466dd) /* 0.329199660 */, 18 }, - /* 5036 */ { MAD_F(0x0544c247) /* 0.329286839 */, 18 }, - /* 5037 */ { MAD_F(0x05451db2) /* 0.329374024 */, 18 }, - /* 5038 */ { MAD_F(0x0545791f) /* 0.329461215 */, 18 }, - /* 5039 */ { MAD_F(0x0545d48e) /* 0.329548411 */, 18 }, - - /* 5040 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 18 }, - /* 5041 */ { MAD_F(0x05468b70) /* 0.329722822 */, 18 }, - /* 5042 */ { MAD_F(0x0546e6e3) /* 0.329810036 */, 18 }, - /* 5043 */ { MAD_F(0x05474258) /* 0.329897255 */, 18 }, - /* 5044 */ { MAD_F(0x05479dce) /* 0.329984481 */, 18 }, - /* 5045 */ { MAD_F(0x0547f946) /* 0.330071712 */, 18 }, - /* 5046 */ { MAD_F(0x054854c0) /* 0.330158949 */, 18 }, - /* 5047 */ { MAD_F(0x0548b03b) /* 0.330246191 */, 18 }, - /* 5048 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 18 }, - /* 5049 */ { MAD_F(0x05496735) /* 0.330420694 */, 18 }, - /* 5050 */ { MAD_F(0x0549c2b5) /* 0.330507954 */, 18 }, - /* 5051 */ { MAD_F(0x054a1e36) /* 0.330595220 */, 18 }, - /* 5052 */ { MAD_F(0x054a79b9) /* 0.330682491 */, 18 }, - /* 5053 */ { MAD_F(0x054ad53d) /* 0.330769768 */, 18 }, - /* 5054 */ { MAD_F(0x054b30c3) /* 0.330857051 */, 18 }, - /* 5055 */ { MAD_F(0x054b8c4b) /* 0.330944340 */, 18 }, - - /* 5056 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 18 }, - /* 5057 */ { MAD_F(0x054c435e) /* 0.331118935 */, 18 }, - /* 5058 */ { MAD_F(0x054c9eea) /* 0.331206241 */, 18 }, - /* 5059 */ { MAD_F(0x054cfa78) /* 0.331293553 */, 18 }, - /* 5060 */ { MAD_F(0x054d5607) /* 0.331380870 */, 18 }, - /* 5061 */ { MAD_F(0x054db197) /* 0.331468193 */, 18 }, - /* 5062 */ { MAD_F(0x054e0d2a) /* 0.331555522 */, 18 }, - /* 5063 */ { MAD_F(0x054e68bd) /* 0.331642857 */, 18 }, - /* 5064 */ { MAD_F(0x054ec453) /* 0.331730198 */, 18 }, - /* 5065 */ { MAD_F(0x054f1fe9) /* 0.331817544 */, 18 }, - /* 5066 */ { MAD_F(0x054f7b82) /* 0.331904896 */, 18 }, - /* 5067 */ { MAD_F(0x054fd71c) /* 0.331992254 */, 18 }, - /* 5068 */ { MAD_F(0x055032b7) /* 0.332079617 */, 18 }, - /* 5069 */ { MAD_F(0x05508e54) /* 0.332166986 */, 18 }, - /* 5070 */ { MAD_F(0x0550e9f3) /* 0.332254361 */, 18 }, - /* 5071 */ { MAD_F(0x05514593) /* 0.332341742 */, 18 }, - - /* 5072 */ { MAD_F(0x0551a134) /* 0.332429129 */, 18 }, - /* 5073 */ { MAD_F(0x0551fcd8) /* 0.332516521 */, 18 }, - /* 5074 */ { MAD_F(0x0552587c) /* 0.332603919 */, 18 }, - /* 5075 */ { MAD_F(0x0552b423) /* 0.332691323 */, 18 }, - /* 5076 */ { MAD_F(0x05530fca) /* 0.332778732 */, 18 }, - /* 5077 */ { MAD_F(0x05536b74) /* 0.332866147 */, 18 }, - /* 5078 */ { MAD_F(0x0553c71f) /* 0.332953568 */, 18 }, - /* 5079 */ { MAD_F(0x055422cb) /* 0.333040995 */, 18 }, - /* 5080 */ { MAD_F(0x05547e79) /* 0.333128427 */, 18 }, - /* 5081 */ { MAD_F(0x0554da29) /* 0.333215865 */, 18 }, - /* 5082 */ { MAD_F(0x055535da) /* 0.333303309 */, 18 }, - /* 5083 */ { MAD_F(0x0555918c) /* 0.333390759 */, 18 }, - /* 5084 */ { MAD_F(0x0555ed40) /* 0.333478214 */, 18 }, - /* 5085 */ { MAD_F(0x055648f6) /* 0.333565675 */, 18 }, - /* 5086 */ { MAD_F(0x0556a4ad) /* 0.333653142 */, 18 }, - /* 5087 */ { MAD_F(0x05570066) /* 0.333740615 */, 18 }, - - /* 5088 */ { MAD_F(0x05575c20) /* 0.333828093 */, 18 }, - /* 5089 */ { MAD_F(0x0557b7dc) /* 0.333915577 */, 18 }, - /* 5090 */ { MAD_F(0x05581399) /* 0.334003067 */, 18 }, - /* 5091 */ { MAD_F(0x05586f58) /* 0.334090562 */, 18 }, - /* 5092 */ { MAD_F(0x0558cb19) /* 0.334178063 */, 18 }, - /* 5093 */ { MAD_F(0x055926db) /* 0.334265570 */, 18 }, - /* 5094 */ { MAD_F(0x0559829e) /* 0.334353083 */, 18 }, - /* 5095 */ { MAD_F(0x0559de63) /* 0.334440601 */, 18 }, - /* 5096 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 18 }, - /* 5097 */ { MAD_F(0x055a95f2) /* 0.334615655 */, 18 }, - /* 5098 */ { MAD_F(0x055af1bb) /* 0.334703191 */, 18 }, - /* 5099 */ { MAD_F(0x055b4d87) /* 0.334790732 */, 18 }, - /* 5100 */ { MAD_F(0x055ba953) /* 0.334878279 */, 18 }, - /* 5101 */ { MAD_F(0x055c0522) /* 0.334965832 */, 18 }, - /* 5102 */ { MAD_F(0x055c60f1) /* 0.335053391 */, 18 }, - /* 5103 */ { MAD_F(0x055cbcc3) /* 0.335140955 */, 18 }, - - /* 5104 */ { MAD_F(0x055d1896) /* 0.335228525 */, 18 }, - /* 5105 */ { MAD_F(0x055d746a) /* 0.335316100 */, 18 }, - /* 5106 */ { MAD_F(0x055dd040) /* 0.335403682 */, 18 }, - /* 5107 */ { MAD_F(0x055e2c17) /* 0.335491269 */, 18 }, - /* 5108 */ { MAD_F(0x055e87f0) /* 0.335578861 */, 18 }, - /* 5109 */ { MAD_F(0x055ee3cb) /* 0.335666460 */, 18 }, - /* 5110 */ { MAD_F(0x055f3fa7) /* 0.335754064 */, 18 }, - /* 5111 */ { MAD_F(0x055f9b85) /* 0.335841674 */, 18 }, - /* 5112 */ { MAD_F(0x055ff764) /* 0.335929290 */, 18 }, - /* 5113 */ { MAD_F(0x05605344) /* 0.336016911 */, 18 }, - /* 5114 */ { MAD_F(0x0560af27) /* 0.336104538 */, 18 }, - /* 5115 */ { MAD_F(0x05610b0a) /* 0.336192171 */, 18 }, - /* 5116 */ { MAD_F(0x056166f0) /* 0.336279809 */, 18 }, - /* 5117 */ { MAD_F(0x0561c2d7) /* 0.336367453 */, 18 }, - /* 5118 */ { MAD_F(0x05621ebf) /* 0.336455103 */, 18 }, - /* 5119 */ { MAD_F(0x05627aa9) /* 0.336542759 */, 18 }, - - /* 5120 */ { MAD_F(0x0562d694) /* 0.336630420 */, 18 }, - /* 5121 */ { MAD_F(0x05633281) /* 0.336718087 */, 18 }, - /* 5122 */ { MAD_F(0x05638e70) /* 0.336805760 */, 18 }, - /* 5123 */ { MAD_F(0x0563ea60) /* 0.336893439 */, 18 }, - /* 5124 */ { MAD_F(0x05644651) /* 0.336981123 */, 18 }, - /* 5125 */ { MAD_F(0x0564a244) /* 0.337068813 */, 18 }, - /* 5126 */ { MAD_F(0x0564fe39) /* 0.337156508 */, 18 }, - /* 5127 */ { MAD_F(0x05655a2f) /* 0.337244209 */, 18 }, - /* 5128 */ { MAD_F(0x0565b627) /* 0.337331916 */, 18 }, - /* 5129 */ { MAD_F(0x05661220) /* 0.337419629 */, 18 }, - /* 5130 */ { MAD_F(0x05666e1a) /* 0.337507347 */, 18 }, - /* 5131 */ { MAD_F(0x0566ca17) /* 0.337595071 */, 18 }, - /* 5132 */ { MAD_F(0x05672614) /* 0.337682801 */, 18 }, - /* 5133 */ { MAD_F(0x05678214) /* 0.337770537 */, 18 }, - /* 5134 */ { MAD_F(0x0567de15) /* 0.337858278 */, 18 }, - /* 5135 */ { MAD_F(0x05683a17) /* 0.337946025 */, 18 }, - - /* 5136 */ { MAD_F(0x0568961b) /* 0.338033777 */, 18 }, - /* 5137 */ { MAD_F(0x0568f220) /* 0.338121535 */, 18 }, - /* 5138 */ { MAD_F(0x05694e27) /* 0.338209299 */, 18 }, - /* 5139 */ { MAD_F(0x0569aa30) /* 0.338297069 */, 18 }, - /* 5140 */ { MAD_F(0x056a063a) /* 0.338384844 */, 18 }, - /* 5141 */ { MAD_F(0x056a6245) /* 0.338472625 */, 18 }, - /* 5142 */ { MAD_F(0x056abe52) /* 0.338560412 */, 18 }, - /* 5143 */ { MAD_F(0x056b1a61) /* 0.338648204 */, 18 }, - /* 5144 */ { MAD_F(0x056b7671) /* 0.338736002 */, 18 }, - /* 5145 */ { MAD_F(0x056bd283) /* 0.338823806 */, 18 }, - /* 5146 */ { MAD_F(0x056c2e96) /* 0.338911616 */, 18 }, - /* 5147 */ { MAD_F(0x056c8aab) /* 0.338999431 */, 18 }, - /* 5148 */ { MAD_F(0x056ce6c1) /* 0.339087252 */, 18 }, - /* 5149 */ { MAD_F(0x056d42d9) /* 0.339175078 */, 18 }, - /* 5150 */ { MAD_F(0x056d9ef2) /* 0.339262910 */, 18 }, - /* 5151 */ { MAD_F(0x056dfb0d) /* 0.339350748 */, 18 }, - - /* 5152 */ { MAD_F(0x056e5729) /* 0.339438592 */, 18 }, - /* 5153 */ { MAD_F(0x056eb347) /* 0.339526441 */, 18 }, - /* 5154 */ { MAD_F(0x056f0f66) /* 0.339614296 */, 18 }, - /* 5155 */ { MAD_F(0x056f6b87) /* 0.339702157 */, 18 }, - /* 5156 */ { MAD_F(0x056fc7aa) /* 0.339790023 */, 18 }, - /* 5157 */ { MAD_F(0x057023cd) /* 0.339877895 */, 18 }, - /* 5158 */ { MAD_F(0x05707ff3) /* 0.339965773 */, 18 }, - /* 5159 */ { MAD_F(0x0570dc1a) /* 0.340053656 */, 18 }, - /* 5160 */ { MAD_F(0x05713843) /* 0.340141545 */, 18 }, - /* 5161 */ { MAD_F(0x0571946d) /* 0.340229440 */, 18 }, - /* 5162 */ { MAD_F(0x0571f098) /* 0.340317340 */, 18 }, - /* 5163 */ { MAD_F(0x05724cc5) /* 0.340405246 */, 18 }, - /* 5164 */ { MAD_F(0x0572a8f4) /* 0.340493158 */, 18 }, - /* 5165 */ { MAD_F(0x05730524) /* 0.340581075 */, 18 }, - /* 5166 */ { MAD_F(0x05736156) /* 0.340668999 */, 18 }, - /* 5167 */ { MAD_F(0x0573bd89) /* 0.340756927 */, 18 }, - - /* 5168 */ { MAD_F(0x057419be) /* 0.340844862 */, 18 }, - /* 5169 */ { MAD_F(0x057475f4) /* 0.340932802 */, 18 }, - /* 5170 */ { MAD_F(0x0574d22c) /* 0.341020748 */, 18 }, - /* 5171 */ { MAD_F(0x05752e65) /* 0.341108699 */, 18 }, - /* 5172 */ { MAD_F(0x05758aa0) /* 0.341196656 */, 18 }, - /* 5173 */ { MAD_F(0x0575e6dc) /* 0.341284619 */, 18 }, - /* 5174 */ { MAD_F(0x0576431a) /* 0.341372587 */, 18 }, - /* 5175 */ { MAD_F(0x05769f59) /* 0.341460562 */, 18 }, - /* 5176 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 18 }, - /* 5177 */ { MAD_F(0x057757dd) /* 0.341636527 */, 18 }, - /* 5178 */ { MAD_F(0x0577b421) /* 0.341724518 */, 18 }, - /* 5179 */ { MAD_F(0x05781066) /* 0.341812515 */, 18 }, - /* 5180 */ { MAD_F(0x05786cad) /* 0.341900517 */, 18 }, - /* 5181 */ { MAD_F(0x0578c8f5) /* 0.341988525 */, 18 }, - /* 5182 */ { MAD_F(0x0579253f) /* 0.342076539 */, 18 }, - /* 5183 */ { MAD_F(0x0579818b) /* 0.342164558 */, 18 }, - - /* 5184 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 18 }, - /* 5185 */ { MAD_F(0x057a3a27) /* 0.342340614 */, 18 }, - /* 5186 */ { MAD_F(0x057a9677) /* 0.342428651 */, 18 }, - /* 5187 */ { MAD_F(0x057af2c8) /* 0.342516693 */, 18 }, - /* 5188 */ { MAD_F(0x057b4f1c) /* 0.342604741 */, 18 }, - /* 5189 */ { MAD_F(0x057bab70) /* 0.342692794 */, 18 }, - /* 5190 */ { MAD_F(0x057c07c6) /* 0.342780853 */, 18 }, - /* 5191 */ { MAD_F(0x057c641e) /* 0.342868918 */, 18 }, - /* 5192 */ { MAD_F(0x057cc077) /* 0.342956988 */, 18 }, - /* 5193 */ { MAD_F(0x057d1cd2) /* 0.343045064 */, 18 }, - /* 5194 */ { MAD_F(0x057d792e) /* 0.343133146 */, 18 }, - /* 5195 */ { MAD_F(0x057dd58c) /* 0.343221233 */, 18 }, - /* 5196 */ { MAD_F(0x057e31eb) /* 0.343309326 */, 18 }, - /* 5197 */ { MAD_F(0x057e8e4c) /* 0.343397425 */, 18 }, - /* 5198 */ { MAD_F(0x057eeaae) /* 0.343485529 */, 18 }, - /* 5199 */ { MAD_F(0x057f4712) /* 0.343573639 */, 18 }, - - /* 5200 */ { MAD_F(0x057fa378) /* 0.343661754 */, 18 }, - /* 5201 */ { MAD_F(0x057fffde) /* 0.343749876 */, 18 }, - /* 5202 */ { MAD_F(0x05805c47) /* 0.343838003 */, 18 }, - /* 5203 */ { MAD_F(0x0580b8b1) /* 0.343926135 */, 18 }, - /* 5204 */ { MAD_F(0x0581151c) /* 0.344014273 */, 18 }, - /* 5205 */ { MAD_F(0x05817189) /* 0.344102417 */, 18 }, - /* 5206 */ { MAD_F(0x0581cdf7) /* 0.344190566 */, 18 }, - /* 5207 */ { MAD_F(0x05822a67) /* 0.344278722 */, 18 }, - /* 5208 */ { MAD_F(0x058286d9) /* 0.344366882 */, 18 }, - /* 5209 */ { MAD_F(0x0582e34c) /* 0.344455049 */, 18 }, - /* 5210 */ { MAD_F(0x05833fc0) /* 0.344543221 */, 18 }, - /* 5211 */ { MAD_F(0x05839c36) /* 0.344631398 */, 18 }, - /* 5212 */ { MAD_F(0x0583f8ae) /* 0.344719582 */, 18 }, - /* 5213 */ { MAD_F(0x05845527) /* 0.344807771 */, 18 }, - /* 5214 */ { MAD_F(0x0584b1a1) /* 0.344895965 */, 18 }, - /* 5215 */ { MAD_F(0x05850e1e) /* 0.344984165 */, 18 }, - - /* 5216 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 18 }, - /* 5217 */ { MAD_F(0x0585c71a) /* 0.345160583 */, 18 }, - /* 5218 */ { MAD_F(0x0586239b) /* 0.345248800 */, 18 }, - /* 5219 */ { MAD_F(0x0586801d) /* 0.345337023 */, 18 }, - /* 5220 */ { MAD_F(0x0586dca1) /* 0.345425251 */, 18 }, - /* 5221 */ { MAD_F(0x05873926) /* 0.345513485 */, 18 }, - /* 5222 */ { MAD_F(0x058795ac) /* 0.345601725 */, 18 }, - /* 5223 */ { MAD_F(0x0587f235) /* 0.345689970 */, 18 }, - /* 5224 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 18 }, - /* 5225 */ { MAD_F(0x0588ab49) /* 0.345866478 */, 18 }, - /* 5226 */ { MAD_F(0x058907d6) /* 0.345954740 */, 18 }, - /* 5227 */ { MAD_F(0x05896464) /* 0.346043008 */, 18 }, - /* 5228 */ { MAD_F(0x0589c0f4) /* 0.346131281 */, 18 }, - /* 5229 */ { MAD_F(0x058a1d85) /* 0.346219560 */, 18 }, - /* 5230 */ { MAD_F(0x058a7a18) /* 0.346307845 */, 18 }, - /* 5231 */ { MAD_F(0x058ad6ac) /* 0.346396135 */, 18 }, - - /* 5232 */ { MAD_F(0x058b3342) /* 0.346484431 */, 18 }, - /* 5233 */ { MAD_F(0x058b8fd9) /* 0.346572733 */, 18 }, - /* 5234 */ { MAD_F(0x058bec72) /* 0.346661040 */, 18 }, - /* 5235 */ { MAD_F(0x058c490c) /* 0.346749353 */, 18 }, - /* 5236 */ { MAD_F(0x058ca5a8) /* 0.346837671 */, 18 }, - /* 5237 */ { MAD_F(0x058d0246) /* 0.346925996 */, 18 }, - /* 5238 */ { MAD_F(0x058d5ee4) /* 0.347014325 */, 18 }, - /* 5239 */ { MAD_F(0x058dbb85) /* 0.347102661 */, 18 }, - /* 5240 */ { MAD_F(0x058e1827) /* 0.347191002 */, 18 }, - /* 5241 */ { MAD_F(0x058e74ca) /* 0.347279348 */, 18 }, - /* 5242 */ { MAD_F(0x058ed16f) /* 0.347367700 */, 18 }, - /* 5243 */ { MAD_F(0x058f2e15) /* 0.347456058 */, 18 }, - /* 5244 */ { MAD_F(0x058f8abd) /* 0.347544422 */, 18 }, - /* 5245 */ { MAD_F(0x058fe766) /* 0.347632791 */, 18 }, - /* 5246 */ { MAD_F(0x05904411) /* 0.347721165 */, 18 }, - /* 5247 */ { MAD_F(0x0590a0be) /* 0.347809546 */, 18 }, - - /* 5248 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 18 }, - /* 5249 */ { MAD_F(0x05915a1b) /* 0.347986323 */, 18 }, - /* 5250 */ { MAD_F(0x0591b6cc) /* 0.348074720 */, 18 }, - /* 5251 */ { MAD_F(0x0592137e) /* 0.348163123 */, 18 }, - /* 5252 */ { MAD_F(0x05927032) /* 0.348251531 */, 18 }, - /* 5253 */ { MAD_F(0x0592cce8) /* 0.348339945 */, 18 }, - /* 5254 */ { MAD_F(0x0593299f) /* 0.348428365 */, 18 }, - /* 5255 */ { MAD_F(0x05938657) /* 0.348516790 */, 18 }, - /* 5256 */ { MAD_F(0x0593e311) /* 0.348605221 */, 18 }, - /* 5257 */ { MAD_F(0x05943fcd) /* 0.348693657 */, 18 }, - /* 5258 */ { MAD_F(0x05949c8a) /* 0.348782099 */, 18 }, - /* 5259 */ { MAD_F(0x0594f948) /* 0.348870547 */, 18 }, - /* 5260 */ { MAD_F(0x05955608) /* 0.348959000 */, 18 }, - /* 5261 */ { MAD_F(0x0595b2ca) /* 0.349047459 */, 18 }, - /* 5262 */ { MAD_F(0x05960f8c) /* 0.349135923 */, 18 }, - /* 5263 */ { MAD_F(0x05966c51) /* 0.349224393 */, 18 }, - - /* 5264 */ { MAD_F(0x0596c917) /* 0.349312869 */, 18 }, - /* 5265 */ { MAD_F(0x059725de) /* 0.349401350 */, 18 }, - /* 5266 */ { MAD_F(0x059782a7) /* 0.349489837 */, 18 }, - /* 5267 */ { MAD_F(0x0597df72) /* 0.349578329 */, 18 }, - /* 5268 */ { MAD_F(0x05983c3e) /* 0.349666827 */, 18 }, - /* 5269 */ { MAD_F(0x0598990c) /* 0.349755331 */, 18 }, - /* 5270 */ { MAD_F(0x0598f5db) /* 0.349843840 */, 18 }, - /* 5271 */ { MAD_F(0x059952ab) /* 0.349932355 */, 18 }, - /* 5272 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 18 }, - /* 5273 */ { MAD_F(0x059a0c51) /* 0.350109402 */, 18 }, - /* 5274 */ { MAD_F(0x059a6926) /* 0.350197933 */, 18 }, - /* 5275 */ { MAD_F(0x059ac5fc) /* 0.350286470 */, 18 }, - /* 5276 */ { MAD_F(0x059b22d4) /* 0.350375013 */, 18 }, - /* 5277 */ { MAD_F(0x059b7fae) /* 0.350463562 */, 18 }, - /* 5278 */ { MAD_F(0x059bdc89) /* 0.350552116 */, 18 }, - /* 5279 */ { MAD_F(0x059c3965) /* 0.350640675 */, 18 }, - - /* 5280 */ { MAD_F(0x059c9643) /* 0.350729240 */, 18 }, - /* 5281 */ { MAD_F(0x059cf323) /* 0.350817811 */, 18 }, - /* 5282 */ { MAD_F(0x059d5004) /* 0.350906388 */, 18 }, - /* 5283 */ { MAD_F(0x059dace6) /* 0.350994970 */, 18 }, - /* 5284 */ { MAD_F(0x059e09cb) /* 0.351083557 */, 18 }, - /* 5285 */ { MAD_F(0x059e66b0) /* 0.351172150 */, 18 }, - /* 5286 */ { MAD_F(0x059ec397) /* 0.351260749 */, 18 }, - /* 5287 */ { MAD_F(0x059f2080) /* 0.351349353 */, 18 }, - /* 5288 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 18 }, - /* 5289 */ { MAD_F(0x059fda55) /* 0.351526579 */, 18 }, - /* 5290 */ { MAD_F(0x05a03742) /* 0.351615200 */, 18 }, - /* 5291 */ { MAD_F(0x05a09431) /* 0.351703827 */, 18 }, - /* 5292 */ { MAD_F(0x05a0f121) /* 0.351792459 */, 18 }, - /* 5293 */ { MAD_F(0x05a14e12) /* 0.351881097 */, 18 }, - /* 5294 */ { MAD_F(0x05a1ab05) /* 0.351969740 */, 18 }, - /* 5295 */ { MAD_F(0x05a207fa) /* 0.352058389 */, 18 }, - - /* 5296 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 18 }, - /* 5297 */ { MAD_F(0x05a2c1e7) /* 0.352235704 */, 18 }, - /* 5298 */ { MAD_F(0x05a31ee1) /* 0.352324369 */, 18 }, - /* 5299 */ { MAD_F(0x05a37bdb) /* 0.352413041 */, 18 }, - /* 5300 */ { MAD_F(0x05a3d8d7) /* 0.352501718 */, 18 }, - /* 5301 */ { MAD_F(0x05a435d5) /* 0.352590400 */, 18 }, - /* 5302 */ { MAD_F(0x05a492d4) /* 0.352679088 */, 18 }, - /* 5303 */ { MAD_F(0x05a4efd4) /* 0.352767782 */, 18 }, - /* 5304 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 18 }, - /* 5305 */ { MAD_F(0x05a5a9da) /* 0.352945186 */, 18 }, - /* 5306 */ { MAD_F(0x05a606df) /* 0.353033896 */, 18 }, - /* 5307 */ { MAD_F(0x05a663e5) /* 0.353122612 */, 18 }, - /* 5308 */ { MAD_F(0x05a6c0ed) /* 0.353211333 */, 18 }, - /* 5309 */ { MAD_F(0x05a71df7) /* 0.353300061 */, 18 }, - /* 5310 */ { MAD_F(0x05a77b02) /* 0.353388793 */, 18 }, - /* 5311 */ { MAD_F(0x05a7d80e) /* 0.353477531 */, 18 }, - - /* 5312 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 18 }, - /* 5313 */ { MAD_F(0x05a8922c) /* 0.353655024 */, 18 }, - /* 5314 */ { MAD_F(0x05a8ef3c) /* 0.353743779 */, 18 }, - /* 5315 */ { MAD_F(0x05a94c4f) /* 0.353832540 */, 18 }, - /* 5316 */ { MAD_F(0x05a9a963) /* 0.353921306 */, 18 }, - /* 5317 */ { MAD_F(0x05aa0678) /* 0.354010077 */, 18 }, - /* 5318 */ { MAD_F(0x05aa638f) /* 0.354098855 */, 18 }, - /* 5319 */ { MAD_F(0x05aac0a8) /* 0.354187637 */, 18 }, - /* 5320 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 18 }, - /* 5321 */ { MAD_F(0x05ab7add) /* 0.354365220 */, 18 }, - /* 5322 */ { MAD_F(0x05abd7fa) /* 0.354454019 */, 18 }, - /* 5323 */ { MAD_F(0x05ac3518) /* 0.354542824 */, 18 }, - /* 5324 */ { MAD_F(0x05ac9238) /* 0.354631635 */, 18 }, - /* 5325 */ { MAD_F(0x05acef5a) /* 0.354720451 */, 18 }, - /* 5326 */ { MAD_F(0x05ad4c7d) /* 0.354809272 */, 18 }, - /* 5327 */ { MAD_F(0x05ada9a1) /* 0.354898100 */, 18 }, - - /* 5328 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 18 }, - /* 5329 */ { MAD_F(0x05ae63ee) /* 0.355075771 */, 18 }, - /* 5330 */ { MAD_F(0x05aec117) /* 0.355164615 */, 18 }, - /* 5331 */ { MAD_F(0x05af1e41) /* 0.355253464 */, 18 }, - /* 5332 */ { MAD_F(0x05af7b6d) /* 0.355342319 */, 18 }, - /* 5333 */ { MAD_F(0x05afd89b) /* 0.355431180 */, 18 }, - /* 5334 */ { MAD_F(0x05b035c9) /* 0.355520046 */, 18 }, - /* 5335 */ { MAD_F(0x05b092fa) /* 0.355608917 */, 18 }, - /* 5336 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 18 }, - /* 5337 */ { MAD_F(0x05b14d5f) /* 0.355786677 */, 18 }, - /* 5338 */ { MAD_F(0x05b1aa94) /* 0.355875566 */, 18 }, - /* 5339 */ { MAD_F(0x05b207ca) /* 0.355964460 */, 18 }, - /* 5340 */ { MAD_F(0x05b26502) /* 0.356053359 */, 18 }, - /* 5341 */ { MAD_F(0x05b2c23b) /* 0.356142264 */, 18 }, - /* 5342 */ { MAD_F(0x05b31f76) /* 0.356231175 */, 18 }, - /* 5343 */ { MAD_F(0x05b37cb2) /* 0.356320091 */, 18 }, - - /* 5344 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 18 }, - /* 5345 */ { MAD_F(0x05b4372f) /* 0.356497940 */, 18 }, - /* 5346 */ { MAD_F(0x05b4946f) /* 0.356586872 */, 18 }, - /* 5347 */ { MAD_F(0x05b4f1b2) /* 0.356675811 */, 18 }, - /* 5348 */ { MAD_F(0x05b54ef5) /* 0.356764754 */, 18 }, - /* 5349 */ { MAD_F(0x05b5ac3a) /* 0.356853704 */, 18 }, - /* 5350 */ { MAD_F(0x05b60981) /* 0.356942659 */, 18 }, - /* 5351 */ { MAD_F(0x05b666c9) /* 0.357031619 */, 18 }, - /* 5352 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 18 }, - /* 5353 */ { MAD_F(0x05b7215e) /* 0.357209557 */, 18 }, - /* 5354 */ { MAD_F(0x05b77eab) /* 0.357298534 */, 18 }, - /* 5355 */ { MAD_F(0x05b7dbf9) /* 0.357387516 */, 18 }, - /* 5356 */ { MAD_F(0x05b83948) /* 0.357476504 */, 18 }, - /* 5357 */ { MAD_F(0x05b89699) /* 0.357565498 */, 18 }, - /* 5358 */ { MAD_F(0x05b8f3ec) /* 0.357654497 */, 18 }, - /* 5359 */ { MAD_F(0x05b95140) /* 0.357743502 */, 18 }, - - /* 5360 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 18 }, - /* 5361 */ { MAD_F(0x05ba0bec) /* 0.357921528 */, 18 }, - /* 5362 */ { MAD_F(0x05ba6945) /* 0.358010550 */, 18 }, - /* 5363 */ { MAD_F(0x05bac69f) /* 0.358099576 */, 18 }, - /* 5364 */ { MAD_F(0x05bb23fa) /* 0.358188609 */, 18 }, - /* 5365 */ { MAD_F(0x05bb8157) /* 0.358277647 */, 18 }, - /* 5366 */ { MAD_F(0x05bbdeb6) /* 0.358366690 */, 18 }, - /* 5367 */ { MAD_F(0x05bc3c16) /* 0.358455739 */, 18 }, - /* 5368 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 18 }, - /* 5369 */ { MAD_F(0x05bcf6da) /* 0.358633854 */, 18 }, - /* 5370 */ { MAD_F(0x05bd543e) /* 0.358722920 */, 18 }, - /* 5371 */ { MAD_F(0x05bdb1a4) /* 0.358811991 */, 18 }, - /* 5372 */ { MAD_F(0x05be0f0b) /* 0.358901067 */, 18 }, - /* 5373 */ { MAD_F(0x05be6c74) /* 0.358990150 */, 18 }, - /* 5374 */ { MAD_F(0x05bec9df) /* 0.359079237 */, 18 }, - /* 5375 */ { MAD_F(0x05bf274a) /* 0.359168331 */, 18 }, - - /* 5376 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 18 }, - /* 5377 */ { MAD_F(0x05bfe226) /* 0.359346534 */, 18 }, - /* 5378 */ { MAD_F(0x05c03f97) /* 0.359435644 */, 18 }, - /* 5379 */ { MAD_F(0x05c09d08) /* 0.359524759 */, 18 }, - /* 5380 */ { MAD_F(0x05c0fa7c) /* 0.359613880 */, 18 }, - /* 5381 */ { MAD_F(0x05c157f0) /* 0.359703006 */, 18 }, - /* 5382 */ { MAD_F(0x05c1b566) /* 0.359792138 */, 18 }, - /* 5383 */ { MAD_F(0x05c212de) /* 0.359881276 */, 18 }, - /* 5384 */ { MAD_F(0x05c27057) /* 0.359970419 */, 18 }, - /* 5385 */ { MAD_F(0x05c2cdd2) /* 0.360059567 */, 18 }, - /* 5386 */ { MAD_F(0x05c32b4e) /* 0.360148721 */, 18 }, - /* 5387 */ { MAD_F(0x05c388cb) /* 0.360237881 */, 18 }, - /* 5388 */ { MAD_F(0x05c3e64b) /* 0.360327046 */, 18 }, - /* 5389 */ { MAD_F(0x05c443cb) /* 0.360416216 */, 18 }, - /* 5390 */ { MAD_F(0x05c4a14d) /* 0.360505392 */, 18 }, - /* 5391 */ { MAD_F(0x05c4fed1) /* 0.360594574 */, 18 }, - - /* 5392 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 18 }, - /* 5393 */ { MAD_F(0x05c5b9dc) /* 0.360772953 */, 18 }, - /* 5394 */ { MAD_F(0x05c61764) /* 0.360862152 */, 18 }, - /* 5395 */ { MAD_F(0x05c674ed) /* 0.360951355 */, 18 }, - /* 5396 */ { MAD_F(0x05c6d278) /* 0.361040564 */, 18 }, - /* 5397 */ { MAD_F(0x05c73005) /* 0.361129779 */, 18 }, - /* 5398 */ { MAD_F(0x05c78d93) /* 0.361218999 */, 18 }, - /* 5399 */ { MAD_F(0x05c7eb22) /* 0.361308225 */, 18 }, - /* 5400 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 18 }, - /* 5401 */ { MAD_F(0x05c8a645) /* 0.361486693 */, 18 }, - /* 5402 */ { MAD_F(0x05c903d9) /* 0.361575935 */, 18 }, - /* 5403 */ { MAD_F(0x05c9616e) /* 0.361665183 */, 18 }, - /* 5404 */ { MAD_F(0x05c9bf05) /* 0.361754436 */, 18 }, - /* 5405 */ { MAD_F(0x05ca1c9d) /* 0.361843695 */, 18 }, - /* 5406 */ { MAD_F(0x05ca7a37) /* 0.361932959 */, 18 }, - /* 5407 */ { MAD_F(0x05cad7d2) /* 0.362022229 */, 18 }, - - /* 5408 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 18 }, - /* 5409 */ { MAD_F(0x05cb930d) /* 0.362200785 */, 18 }, - /* 5410 */ { MAD_F(0x05cbf0ac) /* 0.362290071 */, 18 }, - /* 5411 */ { MAD_F(0x05cc4e4d) /* 0.362379362 */, 18 }, - /* 5412 */ { MAD_F(0x05ccabf0) /* 0.362468660 */, 18 }, - /* 5413 */ { MAD_F(0x05cd0994) /* 0.362557962 */, 18 }, - /* 5414 */ { MAD_F(0x05cd6739) /* 0.362647271 */, 18 }, - /* 5415 */ { MAD_F(0x05cdc4e0) /* 0.362736584 */, 18 }, - /* 5416 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 18 }, - /* 5417 */ { MAD_F(0x05ce8033) /* 0.362915228 */, 18 }, - /* 5418 */ { MAD_F(0x05ceddde) /* 0.363004559 */, 18 }, - /* 5419 */ { MAD_F(0x05cf3b8b) /* 0.363093894 */, 18 }, - /* 5420 */ { MAD_F(0x05cf9939) /* 0.363183236 */, 18 }, - /* 5421 */ { MAD_F(0x05cff6e9) /* 0.363272582 */, 18 }, - /* 5422 */ { MAD_F(0x05d0549a) /* 0.363361935 */, 18 }, - /* 5423 */ { MAD_F(0x05d0b24d) /* 0.363451292 */, 18 }, - - /* 5424 */ { MAD_F(0x05d11001) /* 0.363540655 */, 18 }, - /* 5425 */ { MAD_F(0x05d16db7) /* 0.363630024 */, 18 }, - /* 5426 */ { MAD_F(0x05d1cb6e) /* 0.363719398 */, 18 }, - /* 5427 */ { MAD_F(0x05d22927) /* 0.363808778 */, 18 }, - /* 5428 */ { MAD_F(0x05d286e1) /* 0.363898163 */, 18 }, - /* 5429 */ { MAD_F(0x05d2e49d) /* 0.363987554 */, 18 }, - /* 5430 */ { MAD_F(0x05d3425a) /* 0.364076950 */, 18 }, - /* 5431 */ { MAD_F(0x05d3a018) /* 0.364166352 */, 18 }, - /* 5432 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 18 }, - /* 5433 */ { MAD_F(0x05d45b9a) /* 0.364345171 */, 18 }, - /* 5434 */ { MAD_F(0x05d4b95d) /* 0.364434589 */, 18 }, - /* 5435 */ { MAD_F(0x05d51721) /* 0.364524013 */, 18 }, - /* 5436 */ { MAD_F(0x05d574e7) /* 0.364613442 */, 18 }, - /* 5437 */ { MAD_F(0x05d5d2af) /* 0.364702877 */, 18 }, - /* 5438 */ { MAD_F(0x05d63078) /* 0.364792317 */, 18 }, - /* 5439 */ { MAD_F(0x05d68e42) /* 0.364881762 */, 18 }, - - /* 5440 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 18 }, - /* 5441 */ { MAD_F(0x05d749db) /* 0.365060669 */, 18 }, - /* 5442 */ { MAD_F(0x05d7a7aa) /* 0.365150131 */, 18 }, - /* 5443 */ { MAD_F(0x05d8057a) /* 0.365239599 */, 18 }, - /* 5444 */ { MAD_F(0x05d8634c) /* 0.365329072 */, 18 }, - /* 5445 */ { MAD_F(0x05d8c11f) /* 0.365418550 */, 18 }, - /* 5446 */ { MAD_F(0x05d91ef4) /* 0.365508034 */, 18 }, - /* 5447 */ { MAD_F(0x05d97cca) /* 0.365597523 */, 18 }, - /* 5448 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 18 }, - /* 5449 */ { MAD_F(0x05da387a) /* 0.365776518 */, 18 }, - /* 5450 */ { MAD_F(0x05da9655) /* 0.365866024 */, 18 }, - /* 5451 */ { MAD_F(0x05daf431) /* 0.365955536 */, 18 }, - /* 5452 */ { MAD_F(0x05db520e) /* 0.366045052 */, 18 }, - /* 5453 */ { MAD_F(0x05dbafed) /* 0.366134574 */, 18 }, - /* 5454 */ { MAD_F(0x05dc0dce) /* 0.366224102 */, 18 }, - /* 5455 */ { MAD_F(0x05dc6baf) /* 0.366313635 */, 18 }, - - /* 5456 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 18 }, - /* 5457 */ { MAD_F(0x05dd2778) /* 0.366492718 */, 18 }, - /* 5458 */ { MAD_F(0x05dd855e) /* 0.366582267 */, 18 }, - /* 5459 */ { MAD_F(0x05dde346) /* 0.366671822 */, 18 }, - /* 5460 */ { MAD_F(0x05de412f) /* 0.366761383 */, 18 }, - /* 5461 */ { MAD_F(0x05de9f1a) /* 0.366850949 */, 18 }, - /* 5462 */ { MAD_F(0x05defd06) /* 0.366940520 */, 18 }, - /* 5463 */ { MAD_F(0x05df5af3) /* 0.367030097 */, 18 }, - /* 5464 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 18 }, - /* 5465 */ { MAD_F(0x05e016d3) /* 0.367209267 */, 18 }, - /* 5466 */ { MAD_F(0x05e074c5) /* 0.367298861 */, 18 }, - /* 5467 */ { MAD_F(0x05e0d2b8) /* 0.367388459 */, 18 }, - /* 5468 */ { MAD_F(0x05e130ad) /* 0.367478064 */, 18 }, - /* 5469 */ { MAD_F(0x05e18ea4) /* 0.367567673 */, 18 }, - /* 5470 */ { MAD_F(0x05e1ec9c) /* 0.367657288 */, 18 }, - /* 5471 */ { MAD_F(0x05e24a95) /* 0.367746909 */, 18 }, - - /* 5472 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 18 }, - /* 5473 */ { MAD_F(0x05e3068c) /* 0.367926167 */, 18 }, - /* 5474 */ { MAD_F(0x05e3648a) /* 0.368015804 */, 18 }, - /* 5475 */ { MAD_F(0x05e3c289) /* 0.368105446 */, 18 }, - /* 5476 */ { MAD_F(0x05e4208a) /* 0.368195094 */, 18 }, - /* 5477 */ { MAD_F(0x05e47e8c) /* 0.368284747 */, 18 }, - /* 5478 */ { MAD_F(0x05e4dc8f) /* 0.368374406 */, 18 }, - /* 5479 */ { MAD_F(0x05e53a94) /* 0.368464070 */, 18 }, - /* 5480 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 18 }, - /* 5481 */ { MAD_F(0x05e5f6a3) /* 0.368643415 */, 18 }, - /* 5482 */ { MAD_F(0x05e654ac) /* 0.368733096 */, 18 }, - /* 5483 */ { MAD_F(0x05e6b2b7) /* 0.368822782 */, 18 }, - /* 5484 */ { MAD_F(0x05e710c4) /* 0.368912473 */, 18 }, - /* 5485 */ { MAD_F(0x05e76ed2) /* 0.369002170 */, 18 }, - /* 5486 */ { MAD_F(0x05e7cce1) /* 0.369091873 */, 18 }, - /* 5487 */ { MAD_F(0x05e82af2) /* 0.369181581 */, 18 }, - - /* 5488 */ { MAD_F(0x05e88904) /* 0.369271294 */, 18 }, - /* 5489 */ { MAD_F(0x05e8e718) /* 0.369361013 */, 18 }, - /* 5490 */ { MAD_F(0x05e9452d) /* 0.369450737 */, 18 }, - /* 5491 */ { MAD_F(0x05e9a343) /* 0.369540467 */, 18 }, - /* 5492 */ { MAD_F(0x05ea015c) /* 0.369630202 */, 18 }, - /* 5493 */ { MAD_F(0x05ea5f75) /* 0.369719942 */, 18 }, - /* 5494 */ { MAD_F(0x05eabd90) /* 0.369809688 */, 18 }, - /* 5495 */ { MAD_F(0x05eb1bad) /* 0.369899440 */, 18 }, - /* 5496 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 18 }, - /* 5497 */ { MAD_F(0x05ebd7ea) /* 0.370078959 */, 18 }, - /* 5498 */ { MAD_F(0x05ec360b) /* 0.370168727 */, 18 }, - /* 5499 */ { MAD_F(0x05ec942d) /* 0.370258500 */, 18 }, - /* 5500 */ { MAD_F(0x05ecf251) /* 0.370348279 */, 18 }, - /* 5501 */ { MAD_F(0x05ed5076) /* 0.370438063 */, 18 }, - /* 5502 */ { MAD_F(0x05edae9d) /* 0.370527853 */, 18 }, - /* 5503 */ { MAD_F(0x05ee0cc5) /* 0.370617648 */, 18 }, - - /* 5504 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 18 }, - /* 5505 */ { MAD_F(0x05eec91a) /* 0.370797254 */, 18 }, - /* 5506 */ { MAD_F(0x05ef2746) /* 0.370887065 */, 18 }, - /* 5507 */ { MAD_F(0x05ef8574) /* 0.370976882 */, 18 }, - /* 5508 */ { MAD_F(0x05efe3a4) /* 0.371066704 */, 18 }, - /* 5509 */ { MAD_F(0x05f041d5) /* 0.371156532 */, 18 }, - /* 5510 */ { MAD_F(0x05f0a007) /* 0.371246365 */, 18 }, - /* 5511 */ { MAD_F(0x05f0fe3b) /* 0.371336203 */, 18 }, - /* 5512 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 18 }, - /* 5513 */ { MAD_F(0x05f1baa7) /* 0.371515897 */, 18 }, - /* 5514 */ { MAD_F(0x05f218df) /* 0.371605751 */, 18 }, - /* 5515 */ { MAD_F(0x05f27719) /* 0.371695612 */, 18 }, - /* 5516 */ { MAD_F(0x05f2d554) /* 0.371785477 */, 18 }, - /* 5517 */ { MAD_F(0x05f33390) /* 0.371875348 */, 18 }, - /* 5518 */ { MAD_F(0x05f391cf) /* 0.371965225 */, 18 }, - /* 5519 */ { MAD_F(0x05f3f00e) /* 0.372055107 */, 18 }, - - /* 5520 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 18 }, - /* 5521 */ { MAD_F(0x05f4ac91) /* 0.372234887 */, 18 }, - /* 5522 */ { MAD_F(0x05f50ad5) /* 0.372324785 */, 18 }, - /* 5523 */ { MAD_F(0x05f5691b) /* 0.372414689 */, 18 }, - /* 5524 */ { MAD_F(0x05f5c761) /* 0.372504598 */, 18 }, - /* 5525 */ { MAD_F(0x05f625aa) /* 0.372594513 */, 18 }, - /* 5526 */ { MAD_F(0x05f683f3) /* 0.372684433 */, 18 }, - /* 5527 */ { MAD_F(0x05f6e23f) /* 0.372774358 */, 18 }, - /* 5528 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 18 }, - /* 5529 */ { MAD_F(0x05f79ed9) /* 0.372954225 */, 18 }, - /* 5530 */ { MAD_F(0x05f7fd29) /* 0.373044167 */, 18 }, - /* 5531 */ { MAD_F(0x05f85b7a) /* 0.373134114 */, 18 }, - /* 5532 */ { MAD_F(0x05f8b9cc) /* 0.373224066 */, 18 }, - /* 5533 */ { MAD_F(0x05f91820) /* 0.373314024 */, 18 }, - /* 5534 */ { MAD_F(0x05f97675) /* 0.373403987 */, 18 }, - /* 5535 */ { MAD_F(0x05f9d4cc) /* 0.373493956 */, 18 }, - - /* 5536 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 18 }, - /* 5537 */ { MAD_F(0x05fa917e) /* 0.373673910 */, 18 }, - /* 5538 */ { MAD_F(0x05faefd9) /* 0.373763895 */, 18 }, - /* 5539 */ { MAD_F(0x05fb4e36) /* 0.373853885 */, 18 }, - /* 5540 */ { MAD_F(0x05fbac94) /* 0.373943881 */, 18 }, - /* 5541 */ { MAD_F(0x05fc0af3) /* 0.374033882 */, 18 }, - /* 5542 */ { MAD_F(0x05fc6954) /* 0.374123889 */, 18 }, - /* 5543 */ { MAD_F(0x05fcc7b7) /* 0.374213901 */, 18 }, - /* 5544 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 18 }, - /* 5545 */ { MAD_F(0x05fd8480) /* 0.374393941 */, 18 }, - /* 5546 */ { MAD_F(0x05fde2e7) /* 0.374483970 */, 18 }, - /* 5547 */ { MAD_F(0x05fe414f) /* 0.374574003 */, 18 }, - /* 5548 */ { MAD_F(0x05fe9fb9) /* 0.374664042 */, 18 }, - /* 5549 */ { MAD_F(0x05fefe24) /* 0.374754087 */, 18 }, - /* 5550 */ { MAD_F(0x05ff5c91) /* 0.374844137 */, 18 }, - /* 5551 */ { MAD_F(0x05ffbaff) /* 0.374934192 */, 18 }, - - /* 5552 */ { MAD_F(0x0600196e) /* 0.375024253 */, 18 }, - /* 5553 */ { MAD_F(0x060077df) /* 0.375114319 */, 18 }, - /* 5554 */ { MAD_F(0x0600d651) /* 0.375204391 */, 18 }, - /* 5555 */ { MAD_F(0x060134c5) /* 0.375294468 */, 18 }, - /* 5556 */ { MAD_F(0x0601933b) /* 0.375384550 */, 18 }, - /* 5557 */ { MAD_F(0x0601f1b1) /* 0.375474638 */, 18 }, - /* 5558 */ { MAD_F(0x0602502a) /* 0.375564731 */, 18 }, - /* 5559 */ { MAD_F(0x0602aea3) /* 0.375654830 */, 18 }, - /* 5560 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 18 }, - /* 5561 */ { MAD_F(0x06036b9b) /* 0.375835043 */, 18 }, - /* 5562 */ { MAD_F(0x0603ca19) /* 0.375925158 */, 18 }, - /* 5563 */ { MAD_F(0x06042898) /* 0.376015278 */, 18 }, - /* 5564 */ { MAD_F(0x06048719) /* 0.376105404 */, 18 }, - /* 5565 */ { MAD_F(0x0604e59c) /* 0.376195535 */, 18 }, - /* 5566 */ { MAD_F(0x0605441f) /* 0.376285671 */, 18 }, - /* 5567 */ { MAD_F(0x0605a2a5) /* 0.376375813 */, 18 }, - - /* 5568 */ { MAD_F(0x0606012b) /* 0.376465960 */, 18 }, - /* 5569 */ { MAD_F(0x06065fb4) /* 0.376556113 */, 18 }, - /* 5570 */ { MAD_F(0x0606be3d) /* 0.376646271 */, 18 }, - /* 5571 */ { MAD_F(0x06071cc8) /* 0.376736434 */, 18 }, - /* 5572 */ { MAD_F(0x06077b55) /* 0.376826603 */, 18 }, - /* 5573 */ { MAD_F(0x0607d9e3) /* 0.376916777 */, 18 }, - /* 5574 */ { MAD_F(0x06083872) /* 0.377006957 */, 18 }, - /* 5575 */ { MAD_F(0x06089703) /* 0.377097141 */, 18 }, - /* 5576 */ { MAD_F(0x0608f595) /* 0.377187332 */, 18 }, - /* 5577 */ { MAD_F(0x06095429) /* 0.377277528 */, 18 }, - /* 5578 */ { MAD_F(0x0609b2be) /* 0.377367729 */, 18 }, - /* 5579 */ { MAD_F(0x060a1155) /* 0.377457935 */, 18 }, - /* 5580 */ { MAD_F(0x060a6fed) /* 0.377548147 */, 18 }, - /* 5581 */ { MAD_F(0x060ace86) /* 0.377638364 */, 18 }, - /* 5582 */ { MAD_F(0x060b2d21) /* 0.377728587 */, 18 }, - /* 5583 */ { MAD_F(0x060b8bbe) /* 0.377818815 */, 18 }, - - /* 5584 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 18 }, - /* 5585 */ { MAD_F(0x060c48fb) /* 0.377999288 */, 18 }, - /* 5586 */ { MAD_F(0x060ca79c) /* 0.378089532 */, 18 }, - /* 5587 */ { MAD_F(0x060d063e) /* 0.378179781 */, 18 }, - /* 5588 */ { MAD_F(0x060d64e1) /* 0.378270036 */, 18 }, - /* 5589 */ { MAD_F(0x060dc387) /* 0.378360297 */, 18 }, - /* 5590 */ { MAD_F(0x060e222d) /* 0.378450563 */, 18 }, - /* 5591 */ { MAD_F(0x060e80d5) /* 0.378540834 */, 18 }, - /* 5592 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 18 }, - /* 5593 */ { MAD_F(0x060f3e29) /* 0.378721392 */, 18 }, - /* 5594 */ { MAD_F(0x060f9cd6) /* 0.378811680 */, 18 }, - /* 5595 */ { MAD_F(0x060ffb83) /* 0.378901972 */, 18 }, - /* 5596 */ { MAD_F(0x06105a33) /* 0.378992270 */, 18 }, - /* 5597 */ { MAD_F(0x0610b8e3) /* 0.379082574 */, 18 }, - /* 5598 */ { MAD_F(0x06111795) /* 0.379172883 */, 18 }, - /* 5599 */ { MAD_F(0x06117649) /* 0.379263197 */, 18 }, - - /* 5600 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 18 }, - /* 5601 */ { MAD_F(0x061233b4) /* 0.379443841 */, 18 }, - /* 5602 */ { MAD_F(0x0612926c) /* 0.379534172 */, 18 }, - /* 5603 */ { MAD_F(0x0612f125) /* 0.379624507 */, 18 }, - /* 5604 */ { MAD_F(0x06134fe0) /* 0.379714848 */, 18 }, - /* 5605 */ { MAD_F(0x0613ae9c) /* 0.379805195 */, 18 }, - /* 5606 */ { MAD_F(0x06140d5a) /* 0.379895547 */, 18 }, - /* 5607 */ { MAD_F(0x06146c19) /* 0.379985904 */, 18 }, - /* 5608 */ { MAD_F(0x0614cada) /* 0.380076266 */, 18 }, - /* 5609 */ { MAD_F(0x0615299c) /* 0.380166634 */, 18 }, - /* 5610 */ { MAD_F(0x0615885f) /* 0.380257008 */, 18 }, - /* 5611 */ { MAD_F(0x0615e724) /* 0.380347386 */, 18 }, - /* 5612 */ { MAD_F(0x061645ea) /* 0.380437770 */, 18 }, - /* 5613 */ { MAD_F(0x0616a4b2) /* 0.380528160 */, 18 }, - /* 5614 */ { MAD_F(0x0617037b) /* 0.380618555 */, 18 }, - /* 5615 */ { MAD_F(0x06176246) /* 0.380708955 */, 18 }, - - /* 5616 */ { MAD_F(0x0617c112) /* 0.380799360 */, 18 }, - /* 5617 */ { MAD_F(0x06181fdf) /* 0.380889771 */, 18 }, - /* 5618 */ { MAD_F(0x06187eae) /* 0.380980187 */, 18 }, - /* 5619 */ { MAD_F(0x0618dd7e) /* 0.381070609 */, 18 }, - /* 5620 */ { MAD_F(0x06193c50) /* 0.381161036 */, 18 }, - /* 5621 */ { MAD_F(0x06199b24) /* 0.381251468 */, 18 }, - /* 5622 */ { MAD_F(0x0619f9f8) /* 0.381341906 */, 18 }, - /* 5623 */ { MAD_F(0x061a58ce) /* 0.381432349 */, 18 }, - /* 5624 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 18 }, - /* 5625 */ { MAD_F(0x061b167f) /* 0.381613251 */, 18 }, - /* 5626 */ { MAD_F(0x061b7559) /* 0.381703711 */, 18 }, - /* 5627 */ { MAD_F(0x061bd435) /* 0.381794175 */, 18 }, - /* 5628 */ { MAD_F(0x061c3313) /* 0.381884645 */, 18 }, - /* 5629 */ { MAD_F(0x061c91f1) /* 0.381975120 */, 18 }, - /* 5630 */ { MAD_F(0x061cf0d2) /* 0.382065601 */, 18 }, - /* 5631 */ { MAD_F(0x061d4fb3) /* 0.382156087 */, 18 }, - - /* 5632 */ { MAD_F(0x061dae96) /* 0.382246578 */, 18 }, - /* 5633 */ { MAD_F(0x061e0d7b) /* 0.382337075 */, 18 }, - /* 5634 */ { MAD_F(0x061e6c61) /* 0.382427577 */, 18 }, - /* 5635 */ { MAD_F(0x061ecb48) /* 0.382518084 */, 18 }, - /* 5636 */ { MAD_F(0x061f2a31) /* 0.382608597 */, 18 }, - /* 5637 */ { MAD_F(0x061f891b) /* 0.382699115 */, 18 }, - /* 5638 */ { MAD_F(0x061fe807) /* 0.382789638 */, 18 }, - /* 5639 */ { MAD_F(0x062046f4) /* 0.382880167 */, 18 }, - /* 5640 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 18 }, - /* 5641 */ { MAD_F(0x062104d3) /* 0.383061241 */, 18 }, - /* 5642 */ { MAD_F(0x062163c4) /* 0.383151786 */, 18 }, - /* 5643 */ { MAD_F(0x0621c2b7) /* 0.383242336 */, 18 }, - /* 5644 */ { MAD_F(0x062221ab) /* 0.383332891 */, 18 }, - /* 5645 */ { MAD_F(0x062280a1) /* 0.383423452 */, 18 }, - /* 5646 */ { MAD_F(0x0622df98) /* 0.383514018 */, 18 }, - /* 5647 */ { MAD_F(0x06233e91) /* 0.383604590 */, 18 }, - - /* 5648 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 18 }, - /* 5649 */ { MAD_F(0x0623fc86) /* 0.383785749 */, 18 }, - /* 5650 */ { MAD_F(0x06245b83) /* 0.383876337 */, 18 }, - /* 5651 */ { MAD_F(0x0624ba82) /* 0.383966930 */, 18 }, - /* 5652 */ { MAD_F(0x06251981) /* 0.384057528 */, 18 }, - /* 5653 */ { MAD_F(0x06257883) /* 0.384148132 */, 18 }, - /* 5654 */ { MAD_F(0x0625d785) /* 0.384238741 */, 18 }, - /* 5655 */ { MAD_F(0x06263689) /* 0.384329355 */, 18 }, - /* 5656 */ { MAD_F(0x0626958f) /* 0.384419975 */, 18 }, - /* 5657 */ { MAD_F(0x0626f496) /* 0.384510600 */, 18 }, - /* 5658 */ { MAD_F(0x0627539e) /* 0.384601230 */, 18 }, - /* 5659 */ { MAD_F(0x0627b2a8) /* 0.384691866 */, 18 }, - /* 5660 */ { MAD_F(0x062811b3) /* 0.384782507 */, 18 }, - /* 5661 */ { MAD_F(0x062870c0) /* 0.384873153 */, 18 }, - /* 5662 */ { MAD_F(0x0628cfce) /* 0.384963805 */, 18 }, - /* 5663 */ { MAD_F(0x06292ede) /* 0.385054462 */, 18 }, - - /* 5664 */ { MAD_F(0x06298def) /* 0.385145124 */, 18 }, - /* 5665 */ { MAD_F(0x0629ed01) /* 0.385235792 */, 18 }, - /* 5666 */ { MAD_F(0x062a4c15) /* 0.385326465 */, 18 }, - /* 5667 */ { MAD_F(0x062aab2a) /* 0.385417143 */, 18 }, - /* 5668 */ { MAD_F(0x062b0a41) /* 0.385507827 */, 18 }, - /* 5669 */ { MAD_F(0x062b6959) /* 0.385598516 */, 18 }, - /* 5670 */ { MAD_F(0x062bc873) /* 0.385689211 */, 18 }, - /* 5671 */ { MAD_F(0x062c278e) /* 0.385779910 */, 18 }, - /* 5672 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 18 }, - /* 5673 */ { MAD_F(0x062ce5c8) /* 0.385961326 */, 18 }, - /* 5674 */ { MAD_F(0x062d44e8) /* 0.386052041 */, 18 }, - /* 5675 */ { MAD_F(0x062da408) /* 0.386142762 */, 18 }, - /* 5676 */ { MAD_F(0x062e032a) /* 0.386233489 */, 18 }, - /* 5677 */ { MAD_F(0x062e624e) /* 0.386324221 */, 18 }, - /* 5678 */ { MAD_F(0x062ec173) /* 0.386414958 */, 18 }, - /* 5679 */ { MAD_F(0x062f209a) /* 0.386505700 */, 18 }, - - /* 5680 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 18 }, - /* 5681 */ { MAD_F(0x062fdeeb) /* 0.386687201 */, 18 }, - /* 5682 */ { MAD_F(0x06303e16) /* 0.386777959 */, 18 }, - /* 5683 */ { MAD_F(0x06309d42) /* 0.386868723 */, 18 }, - /* 5684 */ { MAD_F(0x0630fc6f) /* 0.386959492 */, 18 }, - /* 5685 */ { MAD_F(0x06315b9e) /* 0.387050266 */, 18 }, - /* 5686 */ { MAD_F(0x0631bacf) /* 0.387141045 */, 18 }, - /* 5687 */ { MAD_F(0x06321a01) /* 0.387231830 */, 18 }, - /* 5688 */ { MAD_F(0x06327934) /* 0.387322621 */, 18 }, - /* 5689 */ { MAD_F(0x0632d869) /* 0.387413416 */, 18 }, - /* 5690 */ { MAD_F(0x0633379f) /* 0.387504217 */, 18 }, - /* 5691 */ { MAD_F(0x063396d7) /* 0.387595023 */, 18 }, - /* 5692 */ { MAD_F(0x0633f610) /* 0.387685835 */, 18 }, - /* 5693 */ { MAD_F(0x0634554a) /* 0.387776652 */, 18 }, - /* 5694 */ { MAD_F(0x0634b486) /* 0.387867474 */, 18 }, - /* 5695 */ { MAD_F(0x063513c3) /* 0.387958301 */, 18 }, - - /* 5696 */ { MAD_F(0x06357302) /* 0.388049134 */, 18 }, - /* 5697 */ { MAD_F(0x0635d242) /* 0.388139972 */, 18 }, - /* 5698 */ { MAD_F(0x06363184) /* 0.388230816 */, 18 }, - /* 5699 */ { MAD_F(0x063690c7) /* 0.388321665 */, 18 }, - /* 5700 */ { MAD_F(0x0636f00b) /* 0.388412519 */, 18 }, - /* 5701 */ { MAD_F(0x06374f51) /* 0.388503378 */, 18 }, - /* 5702 */ { MAD_F(0x0637ae99) /* 0.388594243 */, 18 }, - /* 5703 */ { MAD_F(0x06380de1) /* 0.388685113 */, 18 }, - /* 5704 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 18 }, - /* 5705 */ { MAD_F(0x0638cc77) /* 0.388866869 */, 18 }, - /* 5706 */ { MAD_F(0x06392bc4) /* 0.388957755 */, 18 }, - /* 5707 */ { MAD_F(0x06398b12) /* 0.389048646 */, 18 }, - /* 5708 */ { MAD_F(0x0639ea62) /* 0.389139542 */, 18 }, - /* 5709 */ { MAD_F(0x063a49b4) /* 0.389230444 */, 18 }, - /* 5710 */ { MAD_F(0x063aa906) /* 0.389321352 */, 18 }, - /* 5711 */ { MAD_F(0x063b085a) /* 0.389412264 */, 18 }, - - /* 5712 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 18 }, - /* 5713 */ { MAD_F(0x063bc707) /* 0.389594105 */, 18 }, - /* 5714 */ { MAD_F(0x063c265f) /* 0.389685033 */, 18 }, - /* 5715 */ { MAD_F(0x063c85b9) /* 0.389775967 */, 18 }, - /* 5716 */ { MAD_F(0x063ce514) /* 0.389866906 */, 18 }, - /* 5717 */ { MAD_F(0x063d4471) /* 0.389957850 */, 18 }, - /* 5718 */ { MAD_F(0x063da3cf) /* 0.390048800 */, 18 }, - /* 5719 */ { MAD_F(0x063e032f) /* 0.390139755 */, 18 }, - /* 5720 */ { MAD_F(0x063e6290) /* 0.390230715 */, 18 }, - /* 5721 */ { MAD_F(0x063ec1f2) /* 0.390321681 */, 18 }, - /* 5722 */ { MAD_F(0x063f2156) /* 0.390412651 */, 18 }, - /* 5723 */ { MAD_F(0x063f80bb) /* 0.390503628 */, 18 }, - /* 5724 */ { MAD_F(0x063fe022) /* 0.390594609 */, 18 }, - /* 5725 */ { MAD_F(0x06403f8a) /* 0.390685596 */, 18 }, - /* 5726 */ { MAD_F(0x06409ef3) /* 0.390776588 */, 18 }, - /* 5727 */ { MAD_F(0x0640fe5e) /* 0.390867585 */, 18 }, - - /* 5728 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 18 }, - /* 5729 */ { MAD_F(0x0641bd38) /* 0.391049596 */, 18 }, - /* 5730 */ { MAD_F(0x06421ca7) /* 0.391140609 */, 18 }, - /* 5731 */ { MAD_F(0x06427c18) /* 0.391231627 */, 18 }, - /* 5732 */ { MAD_F(0x0642db8a) /* 0.391322651 */, 18 }, - /* 5733 */ { MAD_F(0x06433afd) /* 0.391413680 */, 18 }, - /* 5734 */ { MAD_F(0x06439a72) /* 0.391504714 */, 18 }, - /* 5735 */ { MAD_F(0x0643f9e9) /* 0.391595754 */, 18 }, - /* 5736 */ { MAD_F(0x06445960) /* 0.391686799 */, 18 }, - /* 5737 */ { MAD_F(0x0644b8d9) /* 0.391777849 */, 18 }, - /* 5738 */ { MAD_F(0x06451854) /* 0.391868905 */, 18 }, - /* 5739 */ { MAD_F(0x064577d0) /* 0.391959966 */, 18 }, - /* 5740 */ { MAD_F(0x0645d74d) /* 0.392051032 */, 18 }, - /* 5741 */ { MAD_F(0x064636cc) /* 0.392142103 */, 18 }, - /* 5742 */ { MAD_F(0x0646964c) /* 0.392233180 */, 18 }, - /* 5743 */ { MAD_F(0x0646f5ce) /* 0.392324262 */, 18 }, - - /* 5744 */ { MAD_F(0x06475551) /* 0.392415349 */, 18 }, - /* 5745 */ { MAD_F(0x0647b4d5) /* 0.392506442 */, 18 }, - /* 5746 */ { MAD_F(0x0648145b) /* 0.392597540 */, 18 }, - /* 5747 */ { MAD_F(0x064873e3) /* 0.392688643 */, 18 }, - /* 5748 */ { MAD_F(0x0648d36b) /* 0.392779751 */, 18 }, - /* 5749 */ { MAD_F(0x064932f6) /* 0.392870865 */, 18 }, - /* 5750 */ { MAD_F(0x06499281) /* 0.392961984 */, 18 }, - /* 5751 */ { MAD_F(0x0649f20e) /* 0.393053108 */, 18 }, - /* 5752 */ { MAD_F(0x064a519c) /* 0.393144238 */, 18 }, - /* 5753 */ { MAD_F(0x064ab12c) /* 0.393235372 */, 18 }, - /* 5754 */ { MAD_F(0x064b10be) /* 0.393326513 */, 18 }, - /* 5755 */ { MAD_F(0x064b7050) /* 0.393417658 */, 18 }, - /* 5756 */ { MAD_F(0x064bcfe4) /* 0.393508809 */, 18 }, - /* 5757 */ { MAD_F(0x064c2f7a) /* 0.393599965 */, 18 }, - /* 5758 */ { MAD_F(0x064c8f11) /* 0.393691126 */, 18 }, - /* 5759 */ { MAD_F(0x064ceea9) /* 0.393782292 */, 18 }, - - /* 5760 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 18 }, - /* 5761 */ { MAD_F(0x064dadde) /* 0.393964641 */, 18 }, - /* 5762 */ { MAD_F(0x064e0d7a) /* 0.394055823 */, 18 }, - /* 5763 */ { MAD_F(0x064e6d18) /* 0.394147011 */, 18 }, - /* 5764 */ { MAD_F(0x064eccb8) /* 0.394238204 */, 18 }, - /* 5765 */ { MAD_F(0x064f2c59) /* 0.394329402 */, 18 }, - /* 5766 */ { MAD_F(0x064f8bfb) /* 0.394420605 */, 18 }, - /* 5767 */ { MAD_F(0x064feb9e) /* 0.394511814 */, 18 }, - /* 5768 */ { MAD_F(0x06504b44) /* 0.394603028 */, 18 }, - /* 5769 */ { MAD_F(0x0650aaea) /* 0.394694247 */, 18 }, - /* 5770 */ { MAD_F(0x06510a92) /* 0.394785472 */, 18 }, - /* 5771 */ { MAD_F(0x06516a3b) /* 0.394876702 */, 18 }, - /* 5772 */ { MAD_F(0x0651c9e6) /* 0.394967937 */, 18 }, - /* 5773 */ { MAD_F(0x06522992) /* 0.395059177 */, 18 }, - /* 5774 */ { MAD_F(0x06528940) /* 0.395150423 */, 18 }, - /* 5775 */ { MAD_F(0x0652e8ef) /* 0.395241673 */, 18 }, - - /* 5776 */ { MAD_F(0x0653489f) /* 0.395332930 */, 18 }, - /* 5777 */ { MAD_F(0x0653a851) /* 0.395424191 */, 18 }, - /* 5778 */ { MAD_F(0x06540804) /* 0.395515458 */, 18 }, - /* 5779 */ { MAD_F(0x065467b9) /* 0.395606730 */, 18 }, - /* 5780 */ { MAD_F(0x0654c76f) /* 0.395698007 */, 18 }, - /* 5781 */ { MAD_F(0x06552726) /* 0.395789289 */, 18 }, - /* 5782 */ { MAD_F(0x065586df) /* 0.395880577 */, 18 }, - /* 5783 */ { MAD_F(0x0655e699) /* 0.395971870 */, 18 }, - /* 5784 */ { MAD_F(0x06564655) /* 0.396063168 */, 18 }, - /* 5785 */ { MAD_F(0x0656a612) /* 0.396154472 */, 18 }, - /* 5786 */ { MAD_F(0x065705d0) /* 0.396245780 */, 18 }, - /* 5787 */ { MAD_F(0x06576590) /* 0.396337094 */, 18 }, - /* 5788 */ { MAD_F(0x0657c552) /* 0.396428414 */, 18 }, - /* 5789 */ { MAD_F(0x06582514) /* 0.396519738 */, 18 }, - /* 5790 */ { MAD_F(0x065884d9) /* 0.396611068 */, 18 }, - /* 5791 */ { MAD_F(0x0658e49e) /* 0.396702403 */, 18 }, - - /* 5792 */ { MAD_F(0x06594465) /* 0.396793743 */, 18 }, - /* 5793 */ { MAD_F(0x0659a42e) /* 0.396885089 */, 18 }, - /* 5794 */ { MAD_F(0x065a03f7) /* 0.396976440 */, 18 }, - /* 5795 */ { MAD_F(0x065a63c3) /* 0.397067796 */, 18 }, - /* 5796 */ { MAD_F(0x065ac38f) /* 0.397159157 */, 18 }, - /* 5797 */ { MAD_F(0x065b235d) /* 0.397250524 */, 18 }, - /* 5798 */ { MAD_F(0x065b832d) /* 0.397341896 */, 18 }, - /* 5799 */ { MAD_F(0x065be2fe) /* 0.397433273 */, 18 }, - /* 5800 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 18 }, - /* 5801 */ { MAD_F(0x065ca2a3) /* 0.397616043 */, 18 }, - /* 5802 */ { MAD_F(0x065d0279) /* 0.397707436 */, 18 }, - /* 5803 */ { MAD_F(0x065d624f) /* 0.397798834 */, 18 }, - /* 5804 */ { MAD_F(0x065dc227) /* 0.397890237 */, 18 }, - /* 5805 */ { MAD_F(0x065e2200) /* 0.397981646 */, 18 }, - /* 5806 */ { MAD_F(0x065e81db) /* 0.398073059 */, 18 }, - /* 5807 */ { MAD_F(0x065ee1b7) /* 0.398164479 */, 18 }, - - /* 5808 */ { MAD_F(0x065f4195) /* 0.398255903 */, 18 }, - /* 5809 */ { MAD_F(0x065fa174) /* 0.398347333 */, 18 }, - /* 5810 */ { MAD_F(0x06600154) /* 0.398438767 */, 18 }, - /* 5811 */ { MAD_F(0x06606136) /* 0.398530207 */, 18 }, - /* 5812 */ { MAD_F(0x0660c119) /* 0.398621653 */, 18 }, - /* 5813 */ { MAD_F(0x066120fd) /* 0.398713103 */, 18 }, - /* 5814 */ { MAD_F(0x066180e3) /* 0.398804559 */, 18 }, - /* 5815 */ { MAD_F(0x0661e0cb) /* 0.398896020 */, 18 }, - /* 5816 */ { MAD_F(0x066240b4) /* 0.398987487 */, 18 }, - /* 5817 */ { MAD_F(0x0662a09e) /* 0.399078958 */, 18 }, - /* 5818 */ { MAD_F(0x06630089) /* 0.399170435 */, 18 }, - /* 5819 */ { MAD_F(0x06636077) /* 0.399261917 */, 18 }, - /* 5820 */ { MAD_F(0x0663c065) /* 0.399353404 */, 18 }, - /* 5821 */ { MAD_F(0x06642055) /* 0.399444897 */, 18 }, - /* 5822 */ { MAD_F(0x06648046) /* 0.399536395 */, 18 }, - /* 5823 */ { MAD_F(0x0664e039) /* 0.399627898 */, 18 }, - - /* 5824 */ { MAD_F(0x0665402d) /* 0.399719406 */, 18 }, - /* 5825 */ { MAD_F(0x0665a022) /* 0.399810919 */, 18 }, - /* 5826 */ { MAD_F(0x06660019) /* 0.399902438 */, 18 }, - /* 5827 */ { MAD_F(0x06666011) /* 0.399993962 */, 18 }, - /* 5828 */ { MAD_F(0x0666c00b) /* 0.400085491 */, 18 }, - /* 5829 */ { MAD_F(0x06672006) /* 0.400177026 */, 18 }, - /* 5830 */ { MAD_F(0x06678003) /* 0.400268565 */, 18 }, - /* 5831 */ { MAD_F(0x0667e000) /* 0.400360110 */, 18 }, - /* 5832 */ { MAD_F(0x06684000) /* 0.400451660 */, 18 }, - /* 5833 */ { MAD_F(0x0668a000) /* 0.400543216 */, 18 }, - /* 5834 */ { MAD_F(0x06690003) /* 0.400634776 */, 18 }, - /* 5835 */ { MAD_F(0x06696006) /* 0.400726342 */, 18 }, - /* 5836 */ { MAD_F(0x0669c00b) /* 0.400817913 */, 18 }, - /* 5837 */ { MAD_F(0x066a2011) /* 0.400909489 */, 18 }, - /* 5838 */ { MAD_F(0x066a8019) /* 0.401001071 */, 18 }, - /* 5839 */ { MAD_F(0x066ae022) /* 0.401092657 */, 18 }, - - /* 5840 */ { MAD_F(0x066b402d) /* 0.401184249 */, 18 }, - /* 5841 */ { MAD_F(0x066ba039) /* 0.401275847 */, 18 }, - /* 5842 */ { MAD_F(0x066c0046) /* 0.401367449 */, 18 }, - /* 5843 */ { MAD_F(0x066c6055) /* 0.401459057 */, 18 }, - /* 5844 */ { MAD_F(0x066cc065) /* 0.401550670 */, 18 }, - /* 5845 */ { MAD_F(0x066d2076) /* 0.401642288 */, 18 }, - /* 5846 */ { MAD_F(0x066d8089) /* 0.401733911 */, 18 }, - /* 5847 */ { MAD_F(0x066de09e) /* 0.401825540 */, 18 }, - /* 5848 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 18 }, - /* 5849 */ { MAD_F(0x066ea0cb) /* 0.402008812 */, 18 }, - /* 5850 */ { MAD_F(0x066f00e3) /* 0.402100457 */, 18 }, - /* 5851 */ { MAD_F(0x066f60fd) /* 0.402192106 */, 18 }, - /* 5852 */ { MAD_F(0x066fc118) /* 0.402283761 */, 18 }, - /* 5853 */ { MAD_F(0x06702135) /* 0.402375420 */, 18 }, - /* 5854 */ { MAD_F(0x06708153) /* 0.402467086 */, 18 }, - /* 5855 */ { MAD_F(0x0670e173) /* 0.402558756 */, 18 }, - - /* 5856 */ { MAD_F(0x06714194) /* 0.402650431 */, 18 }, - /* 5857 */ { MAD_F(0x0671a1b6) /* 0.402742112 */, 18 }, - /* 5858 */ { MAD_F(0x067201da) /* 0.402833798 */, 18 }, - /* 5859 */ { MAD_F(0x067261ff) /* 0.402925489 */, 18 }, - /* 5860 */ { MAD_F(0x0672c226) /* 0.403017186 */, 18 }, - /* 5861 */ { MAD_F(0x0673224e) /* 0.403108887 */, 18 }, - /* 5862 */ { MAD_F(0x06738277) /* 0.403200594 */, 18 }, - /* 5863 */ { MAD_F(0x0673e2a2) /* 0.403292306 */, 18 }, - /* 5864 */ { MAD_F(0x067442ce) /* 0.403384024 */, 18 }, - /* 5865 */ { MAD_F(0x0674a2fc) /* 0.403475746 */, 18 }, - /* 5866 */ { MAD_F(0x0675032b) /* 0.403567474 */, 18 }, - /* 5867 */ { MAD_F(0x0675635b) /* 0.403659207 */, 18 }, - /* 5868 */ { MAD_F(0x0675c38d) /* 0.403750945 */, 18 }, - /* 5869 */ { MAD_F(0x067623c0) /* 0.403842688 */, 18 }, - /* 5870 */ { MAD_F(0x067683f4) /* 0.403934437 */, 18 }, - /* 5871 */ { MAD_F(0x0676e42a) /* 0.404026190 */, 18 }, - - /* 5872 */ { MAD_F(0x06774462) /* 0.404117949 */, 18 }, - /* 5873 */ { MAD_F(0x0677a49b) /* 0.404209714 */, 18 }, - /* 5874 */ { MAD_F(0x067804d5) /* 0.404301483 */, 18 }, - /* 5875 */ { MAD_F(0x06786510) /* 0.404393258 */, 18 }, - /* 5876 */ { MAD_F(0x0678c54d) /* 0.404485037 */, 18 }, - /* 5877 */ { MAD_F(0x0679258c) /* 0.404576822 */, 18 }, - /* 5878 */ { MAD_F(0x067985cb) /* 0.404668613 */, 18 }, - /* 5879 */ { MAD_F(0x0679e60c) /* 0.404760408 */, 18 }, - /* 5880 */ { MAD_F(0x067a464f) /* 0.404852209 */, 18 }, - /* 5881 */ { MAD_F(0x067aa693) /* 0.404944014 */, 18 }, - /* 5882 */ { MAD_F(0x067b06d8) /* 0.405035825 */, 18 }, - /* 5883 */ { MAD_F(0x067b671f) /* 0.405127642 */, 18 }, - /* 5884 */ { MAD_F(0x067bc767) /* 0.405219463 */, 18 }, - /* 5885 */ { MAD_F(0x067c27b1) /* 0.405311290 */, 18 }, - /* 5886 */ { MAD_F(0x067c87fc) /* 0.405403122 */, 18 }, - /* 5887 */ { MAD_F(0x067ce848) /* 0.405494959 */, 18 }, - - /* 5888 */ { MAD_F(0x067d4896) /* 0.405586801 */, 18 }, - /* 5889 */ { MAD_F(0x067da8e5) /* 0.405678648 */, 18 }, - /* 5890 */ { MAD_F(0x067e0935) /* 0.405770501 */, 18 }, - /* 5891 */ { MAD_F(0x067e6987) /* 0.405862359 */, 18 }, - /* 5892 */ { MAD_F(0x067ec9da) /* 0.405954222 */, 18 }, - /* 5893 */ { MAD_F(0x067f2a2f) /* 0.406046090 */, 18 }, - /* 5894 */ { MAD_F(0x067f8a85) /* 0.406137963 */, 18 }, - /* 5895 */ { MAD_F(0x067feadd) /* 0.406229842 */, 18 }, - /* 5896 */ { MAD_F(0x06804b36) /* 0.406321726 */, 18 }, - /* 5897 */ { MAD_F(0x0680ab90) /* 0.406413615 */, 18 }, - /* 5898 */ { MAD_F(0x06810beb) /* 0.406505509 */, 18 }, - /* 5899 */ { MAD_F(0x06816c49) /* 0.406597408 */, 18 }, - /* 5900 */ { MAD_F(0x0681cca7) /* 0.406689313 */, 18 }, - /* 5901 */ { MAD_F(0x06822d07) /* 0.406781223 */, 18 }, - /* 5902 */ { MAD_F(0x06828d68) /* 0.406873138 */, 18 }, - /* 5903 */ { MAD_F(0x0682edcb) /* 0.406965058 */, 18 }, - - /* 5904 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 18 }, - /* 5905 */ { MAD_F(0x0683ae94) /* 0.407148914 */, 18 }, - /* 5906 */ { MAD_F(0x06840efb) /* 0.407240850 */, 18 }, - /* 5907 */ { MAD_F(0x06846f63) /* 0.407332791 */, 18 }, - /* 5908 */ { MAD_F(0x0684cfcd) /* 0.407424737 */, 18 }, - /* 5909 */ { MAD_F(0x06853038) /* 0.407516688 */, 18 }, - /* 5910 */ { MAD_F(0x068590a4) /* 0.407608645 */, 18 }, - /* 5911 */ { MAD_F(0x0685f112) /* 0.407700606 */, 18 }, - /* 5912 */ { MAD_F(0x06865181) /* 0.407792573 */, 18 }, - /* 5913 */ { MAD_F(0x0686b1f2) /* 0.407884545 */, 18 }, - /* 5914 */ { MAD_F(0x06871264) /* 0.407976522 */, 18 }, - /* 5915 */ { MAD_F(0x068772d7) /* 0.408068505 */, 18 }, - /* 5916 */ { MAD_F(0x0687d34c) /* 0.408160492 */, 18 }, - /* 5917 */ { MAD_F(0x068833c2) /* 0.408252485 */, 18 }, - /* 5918 */ { MAD_F(0x06889439) /* 0.408344483 */, 18 }, - /* 5919 */ { MAD_F(0x0688f4b2) /* 0.408436486 */, 18 }, - - /* 5920 */ { MAD_F(0x0689552c) /* 0.408528495 */, 18 }, - /* 5921 */ { MAD_F(0x0689b5a8) /* 0.408620508 */, 18 }, - /* 5922 */ { MAD_F(0x068a1625) /* 0.408712527 */, 18 }, - /* 5923 */ { MAD_F(0x068a76a4) /* 0.408804551 */, 18 }, - /* 5924 */ { MAD_F(0x068ad724) /* 0.408896580 */, 18 }, - /* 5925 */ { MAD_F(0x068b37a5) /* 0.408988614 */, 18 }, - /* 5926 */ { MAD_F(0x068b9827) /* 0.409080653 */, 18 }, - /* 5927 */ { MAD_F(0x068bf8ac) /* 0.409172698 */, 18 }, - /* 5928 */ { MAD_F(0x068c5931) /* 0.409264748 */, 18 }, - /* 5929 */ { MAD_F(0x068cb9b8) /* 0.409356803 */, 18 }, - /* 5930 */ { MAD_F(0x068d1a40) /* 0.409448863 */, 18 }, - /* 5931 */ { MAD_F(0x068d7aca) /* 0.409540928 */, 18 }, - /* 5932 */ { MAD_F(0x068ddb54) /* 0.409632999 */, 18 }, - /* 5933 */ { MAD_F(0x068e3be1) /* 0.409725074 */, 18 }, - /* 5934 */ { MAD_F(0x068e9c6f) /* 0.409817155 */, 18 }, - /* 5935 */ { MAD_F(0x068efcfe) /* 0.409909241 */, 18 }, - - /* 5936 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 18 }, - /* 5937 */ { MAD_F(0x068fbe20) /* 0.410093428 */, 18 }, - /* 5938 */ { MAD_F(0x06901eb4) /* 0.410185530 */, 18 }, - /* 5939 */ { MAD_F(0x06907f48) /* 0.410277637 */, 18 }, - /* 5940 */ { MAD_F(0x0690dfde) /* 0.410369748 */, 18 }, - /* 5941 */ { MAD_F(0x06914076) /* 0.410461865 */, 18 }, - /* 5942 */ { MAD_F(0x0691a10f) /* 0.410553988 */, 18 }, - /* 5943 */ { MAD_F(0x069201a9) /* 0.410646115 */, 18 }, - /* 5944 */ { MAD_F(0x06926245) /* 0.410738247 */, 18 }, - /* 5945 */ { MAD_F(0x0692c2e2) /* 0.410830385 */, 18 }, - /* 5946 */ { MAD_F(0x06932380) /* 0.410922528 */, 18 }, - /* 5947 */ { MAD_F(0x06938420) /* 0.411014676 */, 18 }, - /* 5948 */ { MAD_F(0x0693e4c1) /* 0.411106829 */, 18 }, - /* 5949 */ { MAD_F(0x06944563) /* 0.411198987 */, 18 }, - /* 5950 */ { MAD_F(0x0694a607) /* 0.411291151 */, 18 }, - /* 5951 */ { MAD_F(0x069506ad) /* 0.411383320 */, 18 }, - - /* 5952 */ { MAD_F(0x06956753) /* 0.411475493 */, 18 }, - /* 5953 */ { MAD_F(0x0695c7fc) /* 0.411567672 */, 18 }, - /* 5954 */ { MAD_F(0x069628a5) /* 0.411659857 */, 18 }, - /* 5955 */ { MAD_F(0x06968950) /* 0.411752046 */, 18 }, - /* 5956 */ { MAD_F(0x0696e9fc) /* 0.411844240 */, 18 }, - /* 5957 */ { MAD_F(0x06974aaa) /* 0.411936440 */, 18 }, - /* 5958 */ { MAD_F(0x0697ab59) /* 0.412028645 */, 18 }, - /* 5959 */ { MAD_F(0x06980c09) /* 0.412120855 */, 18 }, - /* 5960 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 18 }, - /* 5961 */ { MAD_F(0x0698cd6e) /* 0.412305290 */, 18 }, - /* 5962 */ { MAD_F(0x06992e23) /* 0.412397516 */, 18 }, - /* 5963 */ { MAD_F(0x06998ed9) /* 0.412489746 */, 18 }, - /* 5964 */ { MAD_F(0x0699ef90) /* 0.412581982 */, 18 }, - /* 5965 */ { MAD_F(0x069a5049) /* 0.412674223 */, 18 }, - /* 5966 */ { MAD_F(0x069ab103) /* 0.412766469 */, 18 }, - /* 5967 */ { MAD_F(0x069b11bf) /* 0.412858720 */, 18 }, - - /* 5968 */ { MAD_F(0x069b727b) /* 0.412950976 */, 18 }, - /* 5969 */ { MAD_F(0x069bd33a) /* 0.413043238 */, 18 }, - /* 5970 */ { MAD_F(0x069c33f9) /* 0.413135505 */, 18 }, - /* 5971 */ { MAD_F(0x069c94ba) /* 0.413227776 */, 18 }, - /* 5972 */ { MAD_F(0x069cf57d) /* 0.413320053 */, 18 }, - /* 5973 */ { MAD_F(0x069d5641) /* 0.413412335 */, 18 }, - /* 5974 */ { MAD_F(0x069db706) /* 0.413504623 */, 18 }, - /* 5975 */ { MAD_F(0x069e17cc) /* 0.413596915 */, 18 }, - /* 5976 */ { MAD_F(0x069e7894) /* 0.413689213 */, 18 }, - /* 5977 */ { MAD_F(0x069ed95e) /* 0.413781515 */, 18 }, - /* 5978 */ { MAD_F(0x069f3a28) /* 0.413873823 */, 18 }, - /* 5979 */ { MAD_F(0x069f9af4) /* 0.413966136 */, 18 }, - /* 5980 */ { MAD_F(0x069ffbc2) /* 0.414058454 */, 18 }, - /* 5981 */ { MAD_F(0x06a05c91) /* 0.414150778 */, 18 }, - /* 5982 */ { MAD_F(0x06a0bd61) /* 0.414243106 */, 18 }, - /* 5983 */ { MAD_F(0x06a11e32) /* 0.414335440 */, 18 }, - - /* 5984 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 18 }, - /* 5985 */ { MAD_F(0x06a1dfda) /* 0.414520122 */, 18 }, - /* 5986 */ { MAD_F(0x06a240b0) /* 0.414612471 */, 18 }, - /* 5987 */ { MAD_F(0x06a2a187) /* 0.414704826 */, 18 }, - /* 5988 */ { MAD_F(0x06a3025f) /* 0.414797185 */, 18 }, - /* 5989 */ { MAD_F(0x06a36339) /* 0.414889549 */, 18 }, - /* 5990 */ { MAD_F(0x06a3c414) /* 0.414981919 */, 18 }, - /* 5991 */ { MAD_F(0x06a424f1) /* 0.415074294 */, 18 }, - /* 5992 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 18 }, - /* 5993 */ { MAD_F(0x06a4e6ae) /* 0.415259059 */, 18 }, - /* 5994 */ { MAD_F(0x06a5478f) /* 0.415351449 */, 18 }, - /* 5995 */ { MAD_F(0x06a5a871) /* 0.415443844 */, 18 }, - /* 5996 */ { MAD_F(0x06a60955) /* 0.415536244 */, 18 }, - /* 5997 */ { MAD_F(0x06a66a3a) /* 0.415628650 */, 18 }, - /* 5998 */ { MAD_F(0x06a6cb20) /* 0.415721061 */, 18 }, - /* 5999 */ { MAD_F(0x06a72c08) /* 0.415813476 */, 18 }, - - /* 6000 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 18 }, - /* 6001 */ { MAD_F(0x06a7eddb) /* 0.415998324 */, 18 }, - /* 6002 */ { MAD_F(0x06a84ec7) /* 0.416090755 */, 18 }, - /* 6003 */ { MAD_F(0x06a8afb4) /* 0.416183191 */, 18 }, - /* 6004 */ { MAD_F(0x06a910a3) /* 0.416275633 */, 18 }, - /* 6005 */ { MAD_F(0x06a97193) /* 0.416368079 */, 18 }, - /* 6006 */ { MAD_F(0x06a9d284) /* 0.416460531 */, 18 }, - /* 6007 */ { MAD_F(0x06aa3377) /* 0.416552988 */, 18 }, - /* 6008 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 18 }, - /* 6009 */ { MAD_F(0x06aaf561) /* 0.416737917 */, 18 }, - /* 6010 */ { MAD_F(0x06ab5657) /* 0.416830389 */, 18 }, - /* 6011 */ { MAD_F(0x06abb750) /* 0.416922867 */, 18 }, - /* 6012 */ { MAD_F(0x06ac1849) /* 0.417015349 */, 18 }, - /* 6013 */ { MAD_F(0x06ac7944) /* 0.417107837 */, 18 }, - /* 6014 */ { MAD_F(0x06acda41) /* 0.417200330 */, 18 }, - /* 6015 */ { MAD_F(0x06ad3b3e) /* 0.417292828 */, 18 }, - - /* 6016 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 18 }, - /* 6017 */ { MAD_F(0x06adfd3e) /* 0.417477839 */, 18 }, - /* 6018 */ { MAD_F(0x06ae5e40) /* 0.417570352 */, 18 }, - /* 6019 */ { MAD_F(0x06aebf43) /* 0.417662871 */, 18 }, - /* 6020 */ { MAD_F(0x06af2047) /* 0.417755394 */, 18 }, - /* 6021 */ { MAD_F(0x06af814d) /* 0.417847923 */, 18 }, - /* 6022 */ { MAD_F(0x06afe255) /* 0.417940457 */, 18 }, - /* 6023 */ { MAD_F(0x06b0435e) /* 0.418032996 */, 18 }, - /* 6024 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 18 }, - /* 6025 */ { MAD_F(0x06b10573) /* 0.418218089 */, 18 }, - /* 6026 */ { MAD_F(0x06b16680) /* 0.418310643 */, 18 }, - /* 6027 */ { MAD_F(0x06b1c78e) /* 0.418403203 */, 18 }, - /* 6028 */ { MAD_F(0x06b2289e) /* 0.418495767 */, 18 }, - /* 6029 */ { MAD_F(0x06b289af) /* 0.418588337 */, 18 }, - /* 6030 */ { MAD_F(0x06b2eac1) /* 0.418680911 */, 18 }, - /* 6031 */ { MAD_F(0x06b34bd5) /* 0.418773491 */, 18 }, - - /* 6032 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 18 }, - /* 6033 */ { MAD_F(0x06b40e00) /* 0.418958666 */, 18 }, - /* 6034 */ { MAD_F(0x06b46f18) /* 0.419051262 */, 18 }, - /* 6035 */ { MAD_F(0x06b4d031) /* 0.419143862 */, 18 }, - /* 6036 */ { MAD_F(0x06b5314c) /* 0.419236467 */, 18 }, - /* 6037 */ { MAD_F(0x06b59268) /* 0.419329078 */, 18 }, - /* 6038 */ { MAD_F(0x06b5f385) /* 0.419421694 */, 18 }, - /* 6039 */ { MAD_F(0x06b654a4) /* 0.419514314 */, 18 }, - /* 6040 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 18 }, - /* 6041 */ { MAD_F(0x06b716e6) /* 0.419699571 */, 18 }, - /* 6042 */ { MAD_F(0x06b77808) /* 0.419792208 */, 18 }, - /* 6043 */ { MAD_F(0x06b7d92d) /* 0.419884849 */, 18 }, - /* 6044 */ { MAD_F(0x06b83a52) /* 0.419977495 */, 18 }, - /* 6045 */ { MAD_F(0x06b89b79) /* 0.420070147 */, 18 }, - /* 6046 */ { MAD_F(0x06b8fca1) /* 0.420162803 */, 18 }, - /* 6047 */ { MAD_F(0x06b95dcb) /* 0.420255465 */, 18 }, - - /* 6048 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 18 }, - /* 6049 */ { MAD_F(0x06ba2023) /* 0.420440803 */, 18 }, - /* 6050 */ { MAD_F(0x06ba8150) /* 0.420533481 */, 18 }, - /* 6051 */ { MAD_F(0x06bae280) /* 0.420626163 */, 18 }, - /* 6052 */ { MAD_F(0x06bb43b0) /* 0.420718850 */, 18 }, - /* 6053 */ { MAD_F(0x06bba4e2) /* 0.420811542 */, 18 }, - /* 6054 */ { MAD_F(0x06bc0615) /* 0.420904240 */, 18 }, - /* 6055 */ { MAD_F(0x06bc674a) /* 0.420996942 */, 18 }, - /* 6056 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 18 }, - /* 6057 */ { MAD_F(0x06bd29b7) /* 0.421182362 */, 18 }, - /* 6058 */ { MAD_F(0x06bd8af0) /* 0.421275080 */, 18 }, - /* 6059 */ { MAD_F(0x06bdec2a) /* 0.421367803 */, 18 }, - /* 6060 */ { MAD_F(0x06be4d66) /* 0.421460531 */, 18 }, - /* 6061 */ { MAD_F(0x06beaea3) /* 0.421553264 */, 18 }, - /* 6062 */ { MAD_F(0x06bf0fe1) /* 0.421646003 */, 18 }, - /* 6063 */ { MAD_F(0x06bf7120) /* 0.421738746 */, 18 }, - - /* 6064 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 18 }, - /* 6065 */ { MAD_F(0x06c033a4) /* 0.421924248 */, 18 }, - /* 6066 */ { MAD_F(0x06c094e7) /* 0.422017007 */, 18 }, - /* 6067 */ { MAD_F(0x06c0f62c) /* 0.422109770 */, 18 }, - /* 6068 */ { MAD_F(0x06c15773) /* 0.422202539 */, 18 }, - /* 6069 */ { MAD_F(0x06c1b8bb) /* 0.422295313 */, 18 }, - /* 6070 */ { MAD_F(0x06c21a04) /* 0.422388092 */, 18 }, - /* 6071 */ { MAD_F(0x06c27b4e) /* 0.422480876 */, 18 }, - /* 6072 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 18 }, - /* 6073 */ { MAD_F(0x06c33de8) /* 0.422666460 */, 18 }, - /* 6074 */ { MAD_F(0x06c39f36) /* 0.422759259 */, 18 }, - /* 6075 */ { MAD_F(0x06c40086) /* 0.422852064 */, 18 }, - /* 6076 */ { MAD_F(0x06c461d8) /* 0.422944873 */, 18 }, - /* 6077 */ { MAD_F(0x06c4c32a) /* 0.423037688 */, 18 }, - /* 6078 */ { MAD_F(0x06c5247f) /* 0.423130508 */, 18 }, - /* 6079 */ { MAD_F(0x06c585d4) /* 0.423223333 */, 18 }, - - /* 6080 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 18 }, - /* 6081 */ { MAD_F(0x06c64883) /* 0.423408997 */, 18 }, - /* 6082 */ { MAD_F(0x06c6a9dd) /* 0.423501838 */, 18 }, - /* 6083 */ { MAD_F(0x06c70b38) /* 0.423594683 */, 18 }, - /* 6084 */ { MAD_F(0x06c76c94) /* 0.423687533 */, 18 }, - /* 6085 */ { MAD_F(0x06c7cdf2) /* 0.423780389 */, 18 }, - /* 6086 */ { MAD_F(0x06c82f51) /* 0.423873249 */, 18 }, - /* 6087 */ { MAD_F(0x06c890b1) /* 0.423966115 */, 18 }, - /* 6088 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 18 }, - /* 6089 */ { MAD_F(0x06c95376) /* 0.424151861 */, 18 }, - /* 6090 */ { MAD_F(0x06c9b4da) /* 0.424244742 */, 18 }, - /* 6091 */ { MAD_F(0x06ca1640) /* 0.424337628 */, 18 }, - /* 6092 */ { MAD_F(0x06ca77a8) /* 0.424430519 */, 18 }, - /* 6093 */ { MAD_F(0x06cad910) /* 0.424523415 */, 18 }, - /* 6094 */ { MAD_F(0x06cb3a7a) /* 0.424616316 */, 18 }, - /* 6095 */ { MAD_F(0x06cb9be5) /* 0.424709222 */, 18 }, - - /* 6096 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 18 }, - /* 6097 */ { MAD_F(0x06cc5ec0) /* 0.424895050 */, 18 }, - /* 6098 */ { MAD_F(0x06ccc030) /* 0.424987971 */, 18 }, - /* 6099 */ { MAD_F(0x06cd21a0) /* 0.425080898 */, 18 }, - /* 6100 */ { MAD_F(0x06cd8313) /* 0.425173829 */, 18 }, - /* 6101 */ { MAD_F(0x06cde486) /* 0.425266766 */, 18 }, - /* 6102 */ { MAD_F(0x06ce45fb) /* 0.425359708 */, 18 }, - /* 6103 */ { MAD_F(0x06cea771) /* 0.425452655 */, 18 }, - /* 6104 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 18 }, - /* 6105 */ { MAD_F(0x06cf6a62) /* 0.425638564 */, 18 }, - /* 6106 */ { MAD_F(0x06cfcbdc) /* 0.425731526 */, 18 }, - /* 6107 */ { MAD_F(0x06d02d58) /* 0.425824493 */, 18 }, - /* 6108 */ { MAD_F(0x06d08ed5) /* 0.425917465 */, 18 }, - /* 6109 */ { MAD_F(0x06d0f053) /* 0.426010443 */, 18 }, - /* 6110 */ { MAD_F(0x06d151d3) /* 0.426103425 */, 18 }, - /* 6111 */ { MAD_F(0x06d1b354) /* 0.426196412 */, 18 }, - - /* 6112 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 18 }, - /* 6113 */ { MAD_F(0x06d2765a) /* 0.426382403 */, 18 }, - /* 6114 */ { MAD_F(0x06d2d7e0) /* 0.426475405 */, 18 }, - /* 6115 */ { MAD_F(0x06d33966) /* 0.426568413 */, 18 }, - /* 6116 */ { MAD_F(0x06d39aee) /* 0.426661426 */, 18 }, - /* 6117 */ { MAD_F(0x06d3fc77) /* 0.426754444 */, 18 }, - /* 6118 */ { MAD_F(0x06d45e02) /* 0.426847467 */, 18 }, - /* 6119 */ { MAD_F(0x06d4bf8e) /* 0.426940495 */, 18 }, - /* 6120 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 18 }, - /* 6121 */ { MAD_F(0x06d582aa) /* 0.427126566 */, 18 }, - /* 6122 */ { MAD_F(0x06d5e43a) /* 0.427219609 */, 18 }, - /* 6123 */ { MAD_F(0x06d645cc) /* 0.427312657 */, 18 }, - /* 6124 */ { MAD_F(0x06d6a75f) /* 0.427405711 */, 18 }, - /* 6125 */ { MAD_F(0x06d708f3) /* 0.427498769 */, 18 }, - /* 6126 */ { MAD_F(0x06d76a88) /* 0.427591833 */, 18 }, - /* 6127 */ { MAD_F(0x06d7cc1f) /* 0.427684901 */, 18 }, - - /* 6128 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 18 }, - /* 6129 */ { MAD_F(0x06d88f51) /* 0.427871054 */, 18 }, - /* 6130 */ { MAD_F(0x06d8f0ec) /* 0.427964137 */, 18 }, - /* 6131 */ { MAD_F(0x06d95288) /* 0.428057226 */, 18 }, - /* 6132 */ { MAD_F(0x06d9b426) /* 0.428150320 */, 18 }, - /* 6133 */ { MAD_F(0x06da15c5) /* 0.428243419 */, 18 }, - /* 6134 */ { MAD_F(0x06da7766) /* 0.428336523 */, 18 }, - /* 6135 */ { MAD_F(0x06dad907) /* 0.428429632 */, 18 }, - /* 6136 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 18 }, - /* 6137 */ { MAD_F(0x06db9c4f) /* 0.428615865 */, 18 }, - /* 6138 */ { MAD_F(0x06dbfdf5) /* 0.428708989 */, 18 }, - /* 6139 */ { MAD_F(0x06dc5f9c) /* 0.428802119 */, 18 }, - /* 6140 */ { MAD_F(0x06dcc145) /* 0.428895253 */, 18 }, - /* 6141 */ { MAD_F(0x06dd22ee) /* 0.428988392 */, 18 }, - /* 6142 */ { MAD_F(0x06dd849a) /* 0.429081537 */, 18 }, - /* 6143 */ { MAD_F(0x06dde646) /* 0.429174686 */, 18 }, - - /* 6144 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 18 }, - /* 6145 */ { MAD_F(0x06dea9a4) /* 0.429361001 */, 18 }, - /* 6146 */ { MAD_F(0x06df0b54) /* 0.429454165 */, 18 }, - /* 6147 */ { MAD_F(0x06df6d06) /* 0.429547335 */, 18 }, - /* 6148 */ { MAD_F(0x06dfceba) /* 0.429640510 */, 18 }, - /* 6149 */ { MAD_F(0x06e0306f) /* 0.429733690 */, 18 }, - /* 6150 */ { MAD_F(0x06e09225) /* 0.429826874 */, 18 }, - /* 6151 */ { MAD_F(0x06e0f3dc) /* 0.429920064 */, 18 }, - /* 6152 */ { MAD_F(0x06e15595) /* 0.430013259 */, 18 }, - /* 6153 */ { MAD_F(0x06e1b74f) /* 0.430106459 */, 18 }, - /* 6154 */ { MAD_F(0x06e2190b) /* 0.430199664 */, 18 }, - /* 6155 */ { MAD_F(0x06e27ac8) /* 0.430292875 */, 18 }, - /* 6156 */ { MAD_F(0x06e2dc86) /* 0.430386090 */, 18 }, - /* 6157 */ { MAD_F(0x06e33e46) /* 0.430479310 */, 18 }, - /* 6158 */ { MAD_F(0x06e3a007) /* 0.430572535 */, 18 }, - /* 6159 */ { MAD_F(0x06e401c9) /* 0.430665765 */, 18 }, - - /* 6160 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 18 }, - /* 6161 */ { MAD_F(0x06e4c552) /* 0.430852241 */, 18 }, - /* 6162 */ { MAD_F(0x06e52718) /* 0.430945487 */, 18 }, - /* 6163 */ { MAD_F(0x06e588e0) /* 0.431038737 */, 18 }, - /* 6164 */ { MAD_F(0x06e5eaa9) /* 0.431131993 */, 18 }, - /* 6165 */ { MAD_F(0x06e64c73) /* 0.431225253 */, 18 }, - /* 6166 */ { MAD_F(0x06e6ae3f) /* 0.431318519 */, 18 }, - /* 6167 */ { MAD_F(0x06e7100c) /* 0.431411790 */, 18 }, - /* 6168 */ { MAD_F(0x06e771db) /* 0.431505065 */, 18 }, - /* 6169 */ { MAD_F(0x06e7d3ab) /* 0.431598346 */, 18 }, - /* 6170 */ { MAD_F(0x06e8357c) /* 0.431691632 */, 18 }, - /* 6171 */ { MAD_F(0x06e8974e) /* 0.431784923 */, 18 }, - /* 6172 */ { MAD_F(0x06e8f922) /* 0.431878218 */, 18 }, - /* 6173 */ { MAD_F(0x06e95af8) /* 0.431971519 */, 18 }, - /* 6174 */ { MAD_F(0x06e9bcce) /* 0.432064825 */, 18 }, - /* 6175 */ { MAD_F(0x06ea1ea6) /* 0.432158136 */, 18 }, - - /* 6176 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 18 }, - /* 6177 */ { MAD_F(0x06eae25a) /* 0.432344773 */, 18 }, - /* 6178 */ { MAD_F(0x06eb4436) /* 0.432438099 */, 18 }, - /* 6179 */ { MAD_F(0x06eba614) /* 0.432531431 */, 18 }, - /* 6180 */ { MAD_F(0x06ec07f2) /* 0.432624767 */, 18 }, - /* 6181 */ { MAD_F(0x06ec69d2) /* 0.432718108 */, 18 }, - /* 6182 */ { MAD_F(0x06eccbb4) /* 0.432811454 */, 18 }, - /* 6183 */ { MAD_F(0x06ed2d97) /* 0.432904805 */, 18 }, - /* 6184 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 18 }, - /* 6185 */ { MAD_F(0x06edf160) /* 0.433091523 */, 18 }, - /* 6186 */ { MAD_F(0x06ee5347) /* 0.433184889 */, 18 }, - /* 6187 */ { MAD_F(0x06eeb52f) /* 0.433278261 */, 18 }, - /* 6188 */ { MAD_F(0x06ef1719) /* 0.433371637 */, 18 }, - /* 6189 */ { MAD_F(0x06ef7904) /* 0.433465019 */, 18 }, - /* 6190 */ { MAD_F(0x06efdaf0) /* 0.433558405 */, 18 }, - /* 6191 */ { MAD_F(0x06f03cde) /* 0.433651797 */, 18 }, - - /* 6192 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 18 }, - /* 6193 */ { MAD_F(0x06f100bd) /* 0.433838595 */, 18 }, - /* 6194 */ { MAD_F(0x06f162ae) /* 0.433932001 */, 18 }, - /* 6195 */ { MAD_F(0x06f1c4a1) /* 0.434025413 */, 18 }, - /* 6196 */ { MAD_F(0x06f22696) /* 0.434118830 */, 18 }, - /* 6197 */ { MAD_F(0x06f2888b) /* 0.434212251 */, 18 }, - /* 6198 */ { MAD_F(0x06f2ea82) /* 0.434305678 */, 18 }, - /* 6199 */ { MAD_F(0x06f34c7b) /* 0.434399110 */, 18 }, - /* 6200 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 18 }, - /* 6201 */ { MAD_F(0x06f41070) /* 0.434585988 */, 18 }, - /* 6202 */ { MAD_F(0x06f4726c) /* 0.434679435 */, 18 }, - /* 6203 */ { MAD_F(0x06f4d46a) /* 0.434772887 */, 18 }, - /* 6204 */ { MAD_F(0x06f53669) /* 0.434866344 */, 18 }, - /* 6205 */ { MAD_F(0x06f59869) /* 0.434959806 */, 18 }, - /* 6206 */ { MAD_F(0x06f5fa6b) /* 0.435053272 */, 18 }, - /* 6207 */ { MAD_F(0x06f65c6e) /* 0.435146744 */, 18 }, - - /* 6208 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 18 }, - /* 6209 */ { MAD_F(0x06f72079) /* 0.435333703 */, 18 }, - /* 6210 */ { MAD_F(0x06f78280) /* 0.435427190 */, 18 }, - /* 6211 */ { MAD_F(0x06f7e489) /* 0.435520682 */, 18 }, - /* 6212 */ { MAD_F(0x06f84693) /* 0.435614179 */, 18 }, - /* 6213 */ { MAD_F(0x06f8a89e) /* 0.435707681 */, 18 }, - /* 6214 */ { MAD_F(0x06f90aaa) /* 0.435801188 */, 18 }, - /* 6215 */ { MAD_F(0x06f96cb8) /* 0.435894700 */, 18 }, - /* 6216 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 18 }, - /* 6217 */ { MAD_F(0x06fa30d8) /* 0.436081739 */, 18 }, - /* 6218 */ { MAD_F(0x06fa92ea) /* 0.436175266 */, 18 }, - /* 6219 */ { MAD_F(0x06faf4fe) /* 0.436268799 */, 18 }, - /* 6220 */ { MAD_F(0x06fb5712) /* 0.436362336 */, 18 }, - /* 6221 */ { MAD_F(0x06fbb928) /* 0.436455878 */, 18 }, - /* 6222 */ { MAD_F(0x06fc1b40) /* 0.436549425 */, 18 }, - /* 6223 */ { MAD_F(0x06fc7d58) /* 0.436642977 */, 18 }, - - /* 6224 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 18 }, - /* 6225 */ { MAD_F(0x06fd418e) /* 0.436830096 */, 18 }, - /* 6226 */ { MAD_F(0x06fda3ab) /* 0.436923664 */, 18 }, - /* 6227 */ { MAD_F(0x06fe05c9) /* 0.437017236 */, 18 }, - /* 6228 */ { MAD_F(0x06fe67e8) /* 0.437110813 */, 18 }, - /* 6229 */ { MAD_F(0x06feca09) /* 0.437204395 */, 18 }, - /* 6230 */ { MAD_F(0x06ff2c2b) /* 0.437297982 */, 18 }, - /* 6231 */ { MAD_F(0x06ff8e4f) /* 0.437391575 */, 18 }, - /* 6232 */ { MAD_F(0x06fff073) /* 0.437485172 */, 18 }, - /* 6233 */ { MAD_F(0x0700529a) /* 0.437578774 */, 18 }, - /* 6234 */ { MAD_F(0x0700b4c1) /* 0.437672381 */, 18 }, - /* 6235 */ { MAD_F(0x070116ea) /* 0.437765994 */, 18 }, - /* 6236 */ { MAD_F(0x07017914) /* 0.437859611 */, 18 }, - /* 6237 */ { MAD_F(0x0701db40) /* 0.437953233 */, 18 }, - /* 6238 */ { MAD_F(0x07023d6c) /* 0.438046860 */, 18 }, - /* 6239 */ { MAD_F(0x07029f9b) /* 0.438140493 */, 18 }, - - /* 6240 */ { MAD_F(0x070301ca) /* 0.438234130 */, 18 }, - /* 6241 */ { MAD_F(0x070363fb) /* 0.438327772 */, 18 }, - /* 6242 */ { MAD_F(0x0703c62d) /* 0.438421419 */, 18 }, - /* 6243 */ { MAD_F(0x07042861) /* 0.438515072 */, 18 }, - /* 6244 */ { MAD_F(0x07048a96) /* 0.438608729 */, 18 }, - /* 6245 */ { MAD_F(0x0704eccc) /* 0.438702391 */, 18 }, - /* 6246 */ { MAD_F(0x07054f04) /* 0.438796059 */, 18 }, - /* 6247 */ { MAD_F(0x0705b13d) /* 0.438889731 */, 18 }, - /* 6248 */ { MAD_F(0x07061377) /* 0.438983408 */, 18 }, - /* 6249 */ { MAD_F(0x070675b3) /* 0.439077090 */, 18 }, - /* 6250 */ { MAD_F(0x0706d7f0) /* 0.439170778 */, 18 }, - /* 6251 */ { MAD_F(0x07073a2e) /* 0.439264470 */, 18 }, - /* 6252 */ { MAD_F(0x07079c6e) /* 0.439358167 */, 18 }, - /* 6253 */ { MAD_F(0x0707feaf) /* 0.439451869 */, 18 }, - /* 6254 */ { MAD_F(0x070860f1) /* 0.439545577 */, 18 }, - /* 6255 */ { MAD_F(0x0708c335) /* 0.439639289 */, 18 }, - - /* 6256 */ { MAD_F(0x0709257a) /* 0.439733006 */, 18 }, - /* 6257 */ { MAD_F(0x070987c0) /* 0.439826728 */, 18 }, - /* 6258 */ { MAD_F(0x0709ea08) /* 0.439920456 */, 18 }, - /* 6259 */ { MAD_F(0x070a4c51) /* 0.440014188 */, 18 }, - /* 6260 */ { MAD_F(0x070aae9b) /* 0.440107925 */, 18 }, - /* 6261 */ { MAD_F(0x070b10e7) /* 0.440201667 */, 18 }, - /* 6262 */ { MAD_F(0x070b7334) /* 0.440295414 */, 18 }, - /* 6263 */ { MAD_F(0x070bd583) /* 0.440389167 */, 18 }, - /* 6264 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 18 }, - /* 6265 */ { MAD_F(0x070c9a23) /* 0.440576686 */, 18 }, - /* 6266 */ { MAD_F(0x070cfc76) /* 0.440670453 */, 18 }, - /* 6267 */ { MAD_F(0x070d5eca) /* 0.440764225 */, 18 }, - /* 6268 */ { MAD_F(0x070dc11f) /* 0.440858002 */, 18 }, - /* 6269 */ { MAD_F(0x070e2375) /* 0.440951784 */, 18 }, - /* 6270 */ { MAD_F(0x070e85cd) /* 0.441045572 */, 18 }, - /* 6271 */ { MAD_F(0x070ee826) /* 0.441139364 */, 18 }, - - /* 6272 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 18 }, - /* 6273 */ { MAD_F(0x070facdc) /* 0.441326963 */, 18 }, - /* 6274 */ { MAD_F(0x07100f39) /* 0.441420770 */, 18 }, - /* 6275 */ { MAD_F(0x07107198) /* 0.441514582 */, 18 }, - /* 6276 */ { MAD_F(0x0710d3f8) /* 0.441608399 */, 18 }, - /* 6277 */ { MAD_F(0x07113659) /* 0.441702221 */, 18 }, - /* 6278 */ { MAD_F(0x071198bb) /* 0.441796048 */, 18 }, - /* 6279 */ { MAD_F(0x0711fb1f) /* 0.441889880 */, 18 }, - /* 6280 */ { MAD_F(0x07125d84) /* 0.441983717 */, 18 }, - /* 6281 */ { MAD_F(0x0712bfeb) /* 0.442077559 */, 18 }, - /* 6282 */ { MAD_F(0x07132253) /* 0.442171406 */, 18 }, - /* 6283 */ { MAD_F(0x071384bc) /* 0.442265257 */, 18 }, - /* 6284 */ { MAD_F(0x0713e726) /* 0.442359114 */, 18 }, - /* 6285 */ { MAD_F(0x07144992) /* 0.442452976 */, 18 }, - /* 6286 */ { MAD_F(0x0714abff) /* 0.442546843 */, 18 }, - /* 6287 */ { MAD_F(0x07150e6e) /* 0.442640715 */, 18 }, - - /* 6288 */ { MAD_F(0x071570de) /* 0.442734592 */, 18 }, - /* 6289 */ { MAD_F(0x0715d34f) /* 0.442828473 */, 18 }, - /* 6290 */ { MAD_F(0x071635c1) /* 0.442922360 */, 18 }, - /* 6291 */ { MAD_F(0x07169835) /* 0.443016252 */, 18 }, - /* 6292 */ { MAD_F(0x0716faaa) /* 0.443110148 */, 18 }, - /* 6293 */ { MAD_F(0x07175d21) /* 0.443204050 */, 18 }, - /* 6294 */ { MAD_F(0x0717bf99) /* 0.443297957 */, 18 }, - /* 6295 */ { MAD_F(0x07182212) /* 0.443391868 */, 18 }, - /* 6296 */ { MAD_F(0x0718848d) /* 0.443485785 */, 18 }, - /* 6297 */ { MAD_F(0x0718e709) /* 0.443579706 */, 18 }, - /* 6298 */ { MAD_F(0x07194986) /* 0.443673633 */, 18 }, - /* 6299 */ { MAD_F(0x0719ac04) /* 0.443767564 */, 18 }, - /* 6300 */ { MAD_F(0x071a0e84) /* 0.443861501 */, 18 }, - /* 6301 */ { MAD_F(0x071a7105) /* 0.443955442 */, 18 }, - /* 6302 */ { MAD_F(0x071ad388) /* 0.444049389 */, 18 }, - /* 6303 */ { MAD_F(0x071b360c) /* 0.444143340 */, 18 }, - - /* 6304 */ { MAD_F(0x071b9891) /* 0.444237296 */, 18 }, - /* 6305 */ { MAD_F(0x071bfb18) /* 0.444331258 */, 18 }, - /* 6306 */ { MAD_F(0x071c5d9f) /* 0.444425224 */, 18 }, - /* 6307 */ { MAD_F(0x071cc029) /* 0.444519195 */, 18 }, - /* 6308 */ { MAD_F(0x071d22b3) /* 0.444613171 */, 18 }, - /* 6309 */ { MAD_F(0x071d853f) /* 0.444707153 */, 18 }, - /* 6310 */ { MAD_F(0x071de7cc) /* 0.444801139 */, 18 }, - /* 6311 */ { MAD_F(0x071e4a5b) /* 0.444895130 */, 18 }, - /* 6312 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 18 }, - /* 6313 */ { MAD_F(0x071f0f7c) /* 0.445083127 */, 18 }, - /* 6314 */ { MAD_F(0x071f720e) /* 0.445177133 */, 18 }, - /* 6315 */ { MAD_F(0x071fd4a2) /* 0.445271144 */, 18 }, - /* 6316 */ { MAD_F(0x07203737) /* 0.445365160 */, 18 }, - /* 6317 */ { MAD_F(0x072099ce) /* 0.445459181 */, 18 }, - /* 6318 */ { MAD_F(0x0720fc66) /* 0.445553206 */, 18 }, - /* 6319 */ { MAD_F(0x07215eff) /* 0.445647237 */, 18 }, - - /* 6320 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 18 }, - /* 6321 */ { MAD_F(0x07222436) /* 0.445835314 */, 18 }, - /* 6322 */ { MAD_F(0x072286d3) /* 0.445929359 */, 18 }, - /* 6323 */ { MAD_F(0x0722e971) /* 0.446023410 */, 18 }, - /* 6324 */ { MAD_F(0x07234c11) /* 0.446117466 */, 18 }, - /* 6325 */ { MAD_F(0x0723aeb2) /* 0.446211526 */, 18 }, - /* 6326 */ { MAD_F(0x07241155) /* 0.446305592 */, 18 }, - /* 6327 */ { MAD_F(0x072473f9) /* 0.446399662 */, 18 }, - /* 6328 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 18 }, - /* 6329 */ { MAD_F(0x07253944) /* 0.446587818 */, 18 }, - /* 6330 */ { MAD_F(0x07259bec) /* 0.446681903 */, 18 }, - /* 6331 */ { MAD_F(0x0725fe95) /* 0.446775994 */, 18 }, - /* 6332 */ { MAD_F(0x07266140) /* 0.446870089 */, 18 }, - /* 6333 */ { MAD_F(0x0726c3ec) /* 0.446964189 */, 18 }, - /* 6334 */ { MAD_F(0x07272699) /* 0.447058294 */, 18 }, - /* 6335 */ { MAD_F(0x07278947) /* 0.447152404 */, 18 }, - - /* 6336 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 18 }, - /* 6337 */ { MAD_F(0x07284ea8) /* 0.447340639 */, 18 }, - /* 6338 */ { MAD_F(0x0728b15b) /* 0.447434764 */, 18 }, - /* 6339 */ { MAD_F(0x0729140f) /* 0.447528894 */, 18 }, - /* 6340 */ { MAD_F(0x072976c4) /* 0.447623029 */, 18 }, - /* 6341 */ { MAD_F(0x0729d97a) /* 0.447717169 */, 18 }, - /* 6342 */ { MAD_F(0x072a3c32) /* 0.447811314 */, 18 }, - /* 6343 */ { MAD_F(0x072a9eeb) /* 0.447905463 */, 18 }, - /* 6344 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 18 }, - /* 6345 */ { MAD_F(0x072b6461) /* 0.448093778 */, 18 }, - /* 6346 */ { MAD_F(0x072bc71e) /* 0.448187942 */, 18 }, - /* 6347 */ { MAD_F(0x072c29dd) /* 0.448282112 */, 18 }, - /* 6348 */ { MAD_F(0x072c8c9d) /* 0.448376286 */, 18 }, - /* 6349 */ { MAD_F(0x072cef5e) /* 0.448470466 */, 18 }, - /* 6350 */ { MAD_F(0x072d5220) /* 0.448564650 */, 18 }, - /* 6351 */ { MAD_F(0x072db4e4) /* 0.448658839 */, 18 }, - - /* 6352 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 18 }, - /* 6353 */ { MAD_F(0x072e7a6f) /* 0.448847233 */, 18 }, - /* 6354 */ { MAD_F(0x072edd37) /* 0.448941437 */, 18 }, - /* 6355 */ { MAD_F(0x072f4000) /* 0.449035646 */, 18 }, - /* 6356 */ { MAD_F(0x072fa2ca) /* 0.449129860 */, 18 }, - /* 6357 */ { MAD_F(0x07300596) /* 0.449224079 */, 18 }, - /* 6358 */ { MAD_F(0x07306863) /* 0.449318303 */, 18 }, - /* 6359 */ { MAD_F(0x0730cb32) /* 0.449412531 */, 18 }, - /* 6360 */ { MAD_F(0x07312e01) /* 0.449506765 */, 18 }, - /* 6361 */ { MAD_F(0x073190d2) /* 0.449601004 */, 18 }, - /* 6362 */ { MAD_F(0x0731f3a5) /* 0.449695247 */, 18 }, - /* 6363 */ { MAD_F(0x07325678) /* 0.449789496 */, 18 }, - /* 6364 */ { MAD_F(0x0732b94d) /* 0.449883749 */, 18 }, - /* 6365 */ { MAD_F(0x07331c23) /* 0.449978008 */, 18 }, - /* 6366 */ { MAD_F(0x07337efb) /* 0.450072271 */, 18 }, - /* 6367 */ { MAD_F(0x0733e1d4) /* 0.450166540 */, 18 }, - - /* 6368 */ { MAD_F(0x073444ae) /* 0.450260813 */, 18 }, - /* 6369 */ { MAD_F(0x0734a78a) /* 0.450355091 */, 18 }, - /* 6370 */ { MAD_F(0x07350a67) /* 0.450449374 */, 18 }, - /* 6371 */ { MAD_F(0x07356d45) /* 0.450543662 */, 18 }, - /* 6372 */ { MAD_F(0x0735d025) /* 0.450637955 */, 18 }, - /* 6373 */ { MAD_F(0x07363306) /* 0.450732253 */, 18 }, - /* 6374 */ { MAD_F(0x073695e8) /* 0.450826556 */, 18 }, - /* 6375 */ { MAD_F(0x0736f8cb) /* 0.450920864 */, 18 }, - /* 6376 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 18 }, - /* 6377 */ { MAD_F(0x0737be96) /* 0.451109494 */, 18 }, - /* 6378 */ { MAD_F(0x0738217e) /* 0.451203817 */, 18 }, - /* 6379 */ { MAD_F(0x07388467) /* 0.451298144 */, 18 }, - /* 6380 */ { MAD_F(0x0738e751) /* 0.451392477 */, 18 }, - /* 6381 */ { MAD_F(0x07394a3d) /* 0.451486814 */, 18 }, - /* 6382 */ { MAD_F(0x0739ad29) /* 0.451581156 */, 18 }, - /* 6383 */ { MAD_F(0x073a1017) /* 0.451675503 */, 18 }, - - /* 6384 */ { MAD_F(0x073a7307) /* 0.451769856 */, 18 }, - /* 6385 */ { MAD_F(0x073ad5f8) /* 0.451864213 */, 18 }, - /* 6386 */ { MAD_F(0x073b38ea) /* 0.451958575 */, 18 }, - /* 6387 */ { MAD_F(0x073b9bdd) /* 0.452052942 */, 18 }, - /* 6388 */ { MAD_F(0x073bfed2) /* 0.452147313 */, 18 }, - /* 6389 */ { MAD_F(0x073c61c8) /* 0.452241690 */, 18 }, - /* 6390 */ { MAD_F(0x073cc4bf) /* 0.452336072 */, 18 }, - /* 6391 */ { MAD_F(0x073d27b8) /* 0.452430458 */, 18 }, - /* 6392 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 18 }, - /* 6393 */ { MAD_F(0x073dedae) /* 0.452619246 */, 18 }, - /* 6394 */ { MAD_F(0x073e50aa) /* 0.452713648 */, 18 }, - /* 6395 */ { MAD_F(0x073eb3a8) /* 0.452808054 */, 18 }, - /* 6396 */ { MAD_F(0x073f16a8) /* 0.452902465 */, 18 }, - /* 6397 */ { MAD_F(0x073f79a8) /* 0.452996882 */, 18 }, - /* 6398 */ { MAD_F(0x073fdcaa) /* 0.453091303 */, 18 }, - /* 6399 */ { MAD_F(0x07403fad) /* 0.453185729 */, 18 }, - - /* 6400 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 18 }, - /* 6401 */ { MAD_F(0x074105b8) /* 0.453374595 */, 18 }, - /* 6402 */ { MAD_F(0x074168bf) /* 0.453469036 */, 18 }, - /* 6403 */ { MAD_F(0x0741cbc8) /* 0.453563482 */, 18 }, - /* 6404 */ { MAD_F(0x07422ed2) /* 0.453657932 */, 18 }, - /* 6405 */ { MAD_F(0x074291dd) /* 0.453752388 */, 18 }, - /* 6406 */ { MAD_F(0x0742f4e9) /* 0.453846848 */, 18 }, - /* 6407 */ { MAD_F(0x074357f7) /* 0.453941314 */, 18 }, - /* 6408 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 18 }, - /* 6409 */ { MAD_F(0x07441e17) /* 0.454130259 */, 18 }, - /* 6410 */ { MAD_F(0x07448129) /* 0.454224739 */, 18 }, - /* 6411 */ { MAD_F(0x0744e43c) /* 0.454319224 */, 18 }, - /* 6412 */ { MAD_F(0x07454750) /* 0.454413714 */, 18 }, - /* 6413 */ { MAD_F(0x0745aa66) /* 0.454508209 */, 18 }, - /* 6414 */ { MAD_F(0x07460d7d) /* 0.454602708 */, 18 }, - /* 6415 */ { MAD_F(0x07467095) /* 0.454697213 */, 18 }, - - /* 6416 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 18 }, - /* 6417 */ { MAD_F(0x074736ca) /* 0.454886237 */, 18 }, - /* 6418 */ { MAD_F(0x074799e7) /* 0.454980756 */, 18 }, - /* 6419 */ { MAD_F(0x0747fd04) /* 0.455075281 */, 18 }, - /* 6420 */ { MAD_F(0x07486023) /* 0.455169810 */, 18 }, - /* 6421 */ { MAD_F(0x0748c344) /* 0.455264344 */, 18 }, - /* 6422 */ { MAD_F(0x07492665) /* 0.455358883 */, 18 }, - /* 6423 */ { MAD_F(0x07498988) /* 0.455453427 */, 18 }, - /* 6424 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 18 }, - /* 6425 */ { MAD_F(0x074a4fd2) /* 0.455642529 */, 18 }, - /* 6426 */ { MAD_F(0x074ab2f9) /* 0.455737088 */, 18 }, - /* 6427 */ { MAD_F(0x074b1621) /* 0.455831652 */, 18 }, - /* 6428 */ { MAD_F(0x074b794b) /* 0.455926220 */, 18 }, - /* 6429 */ { MAD_F(0x074bdc75) /* 0.456020793 */, 18 }, - /* 6430 */ { MAD_F(0x074c3fa1) /* 0.456115372 */, 18 }, - /* 6431 */ { MAD_F(0x074ca2cf) /* 0.456209955 */, 18 }, - - /* 6432 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 18 }, - /* 6433 */ { MAD_F(0x074d692e) /* 0.456399136 */, 18 }, - /* 6434 */ { MAD_F(0x074dcc5f) /* 0.456493733 */, 18 }, - /* 6435 */ { MAD_F(0x074e2f92) /* 0.456588336 */, 18 }, - /* 6436 */ { MAD_F(0x074e92c6) /* 0.456682944 */, 18 }, - /* 6437 */ { MAD_F(0x074ef5fb) /* 0.456777556 */, 18 }, - /* 6438 */ { MAD_F(0x074f5932) /* 0.456872174 */, 18 }, - /* 6439 */ { MAD_F(0x074fbc6a) /* 0.456966796 */, 18 }, - /* 6440 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 18 }, - /* 6441 */ { MAD_F(0x075082de) /* 0.457156056 */, 18 }, - /* 6442 */ { MAD_F(0x0750e61a) /* 0.457250693 */, 18 }, - /* 6443 */ { MAD_F(0x07514957) /* 0.457345335 */, 18 }, - /* 6444 */ { MAD_F(0x0751ac96) /* 0.457439981 */, 18 }, - /* 6445 */ { MAD_F(0x07520fd6) /* 0.457534633 */, 18 }, - /* 6446 */ { MAD_F(0x07527317) /* 0.457629290 */, 18 }, - /* 6447 */ { MAD_F(0x0752d659) /* 0.457723951 */, 18 }, - - /* 6448 */ { MAD_F(0x0753399d) /* 0.457818618 */, 18 }, - /* 6449 */ { MAD_F(0x07539ce2) /* 0.457913289 */, 18 }, - /* 6450 */ { MAD_F(0x07540029) /* 0.458007965 */, 18 }, - /* 6451 */ { MAD_F(0x07546371) /* 0.458102646 */, 18 }, - /* 6452 */ { MAD_F(0x0754c6ba) /* 0.458197332 */, 18 }, - /* 6453 */ { MAD_F(0x07552a04) /* 0.458292023 */, 18 }, - /* 6454 */ { MAD_F(0x07558d50) /* 0.458386719 */, 18 }, - /* 6455 */ { MAD_F(0x0755f09d) /* 0.458481420 */, 18 }, - /* 6456 */ { MAD_F(0x075653eb) /* 0.458576125 */, 18 }, - /* 6457 */ { MAD_F(0x0756b73b) /* 0.458670836 */, 18 }, - /* 6458 */ { MAD_F(0x07571a8c) /* 0.458765551 */, 18 }, - /* 6459 */ { MAD_F(0x07577dde) /* 0.458860271 */, 18 }, - /* 6460 */ { MAD_F(0x0757e131) /* 0.458954996 */, 18 }, - /* 6461 */ { MAD_F(0x07584486) /* 0.459049726 */, 18 }, - /* 6462 */ { MAD_F(0x0758a7dd) /* 0.459144461 */, 18 }, - /* 6463 */ { MAD_F(0x07590b34) /* 0.459239201 */, 18 }, - - /* 6464 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 18 }, - /* 6465 */ { MAD_F(0x0759d1e7) /* 0.459428695 */, 18 }, - /* 6466 */ { MAD_F(0x075a3542) /* 0.459523450 */, 18 }, - /* 6467 */ { MAD_F(0x075a989f) /* 0.459618209 */, 18 }, - /* 6468 */ { MAD_F(0x075afbfd) /* 0.459712973 */, 18 }, - /* 6469 */ { MAD_F(0x075b5f5d) /* 0.459807742 */, 18 }, - /* 6470 */ { MAD_F(0x075bc2bd) /* 0.459902516 */, 18 }, - /* 6471 */ { MAD_F(0x075c261f) /* 0.459997295 */, 18 }, - /* 6472 */ { MAD_F(0x075c8983) /* 0.460092079 */, 18 }, - /* 6473 */ { MAD_F(0x075cece7) /* 0.460186867 */, 18 }, - /* 6474 */ { MAD_F(0x075d504d) /* 0.460281661 */, 18 }, - /* 6475 */ { MAD_F(0x075db3b5) /* 0.460376459 */, 18 }, - /* 6476 */ { MAD_F(0x075e171d) /* 0.460471262 */, 18 }, - /* 6477 */ { MAD_F(0x075e7a87) /* 0.460566071 */, 18 }, - /* 6478 */ { MAD_F(0x075eddf2) /* 0.460660884 */, 18 }, - /* 6479 */ { MAD_F(0x075f415f) /* 0.460755701 */, 18 }, - - /* 6480 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 18 }, - /* 6481 */ { MAD_F(0x0760083b) /* 0.460945352 */, 18 }, - /* 6482 */ { MAD_F(0x07606bac) /* 0.461040184 */, 18 }, - /* 6483 */ { MAD_F(0x0760cf1e) /* 0.461135022 */, 18 }, - /* 6484 */ { MAD_F(0x07613291) /* 0.461229864 */, 18 }, - /* 6485 */ { MAD_F(0x07619605) /* 0.461324711 */, 18 }, - /* 6486 */ { MAD_F(0x0761f97b) /* 0.461419563 */, 18 }, - /* 6487 */ { MAD_F(0x07625cf2) /* 0.461514420 */, 18 }, - /* 6488 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 18 }, - /* 6489 */ { MAD_F(0x076323e3) /* 0.461704149 */, 18 }, - /* 6490 */ { MAD_F(0x0763875e) /* 0.461799020 */, 18 }, - /* 6491 */ { MAD_F(0x0763eadb) /* 0.461893897 */, 18 }, - /* 6492 */ { MAD_F(0x07644e58) /* 0.461988778 */, 18 }, - /* 6493 */ { MAD_F(0x0764b1d7) /* 0.462083664 */, 18 }, - /* 6494 */ { MAD_F(0x07651557) /* 0.462178555 */, 18 }, - /* 6495 */ { MAD_F(0x076578d8) /* 0.462273451 */, 18 }, - - /* 6496 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 18 }, - /* 6497 */ { MAD_F(0x07663fdf) /* 0.462463257 */, 18 }, - /* 6498 */ { MAD_F(0x0766a364) /* 0.462558168 */, 18 }, - /* 6499 */ { MAD_F(0x076706eb) /* 0.462653083 */, 18 }, - /* 6500 */ { MAD_F(0x07676a73) /* 0.462748003 */, 18 }, - /* 6501 */ { MAD_F(0x0767cdfc) /* 0.462842928 */, 18 }, - /* 6502 */ { MAD_F(0x07683187) /* 0.462937858 */, 18 }, - /* 6503 */ { MAD_F(0x07689513) /* 0.463032793 */, 18 }, - /* 6504 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 18 }, - /* 6505 */ { MAD_F(0x07695c2e) /* 0.463222678 */, 18 }, - /* 6506 */ { MAD_F(0x0769bfbe) /* 0.463317627 */, 18 }, - /* 6507 */ { MAD_F(0x076a234f) /* 0.463412581 */, 18 }, - /* 6508 */ { MAD_F(0x076a86e2) /* 0.463507540 */, 18 }, - /* 6509 */ { MAD_F(0x076aea75) /* 0.463602504 */, 18 }, - /* 6510 */ { MAD_F(0x076b4e0a) /* 0.463697473 */, 18 }, - /* 6511 */ { MAD_F(0x076bb1a1) /* 0.463792447 */, 18 }, - - /* 6512 */ { MAD_F(0x076c1538) /* 0.463887426 */, 18 }, - /* 6513 */ { MAD_F(0x076c78d1) /* 0.463982409 */, 18 }, - /* 6514 */ { MAD_F(0x076cdc6c) /* 0.464077398 */, 18 }, - /* 6515 */ { MAD_F(0x076d4007) /* 0.464172391 */, 18 }, - /* 6516 */ { MAD_F(0x076da3a4) /* 0.464267389 */, 18 }, - /* 6517 */ { MAD_F(0x076e0742) /* 0.464362392 */, 18 }, - /* 6518 */ { MAD_F(0x076e6ae2) /* 0.464457399 */, 18 }, - /* 6519 */ { MAD_F(0x076ece82) /* 0.464552412 */, 18 }, - /* 6520 */ { MAD_F(0x076f3224) /* 0.464647430 */, 18 }, - /* 6521 */ { MAD_F(0x076f95c8) /* 0.464742452 */, 18 }, - /* 6522 */ { MAD_F(0x076ff96c) /* 0.464837479 */, 18 }, - /* 6523 */ { MAD_F(0x07705d12) /* 0.464932511 */, 18 }, - /* 6524 */ { MAD_F(0x0770c0ba) /* 0.465027548 */, 18 }, - /* 6525 */ { MAD_F(0x07712462) /* 0.465122590 */, 18 }, - /* 6526 */ { MAD_F(0x0771880c) /* 0.465217637 */, 18 }, - /* 6527 */ { MAD_F(0x0771ebb7) /* 0.465312688 */, 18 }, - - /* 6528 */ { MAD_F(0x07724f64) /* 0.465407744 */, 18 }, - /* 6529 */ { MAD_F(0x0772b312) /* 0.465502806 */, 18 }, - /* 6530 */ { MAD_F(0x077316c1) /* 0.465597872 */, 18 }, - /* 6531 */ { MAD_F(0x07737a71) /* 0.465692943 */, 18 }, - /* 6532 */ { MAD_F(0x0773de23) /* 0.465788018 */, 18 }, - /* 6533 */ { MAD_F(0x077441d6) /* 0.465883099 */, 18 }, - /* 6534 */ { MAD_F(0x0774a58a) /* 0.465978184 */, 18 }, - /* 6535 */ { MAD_F(0x07750940) /* 0.466073275 */, 18 }, - /* 6536 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 18 }, - /* 6537 */ { MAD_F(0x0775d0af) /* 0.466263470 */, 18 }, - /* 6538 */ { MAD_F(0x07763468) /* 0.466358575 */, 18 }, - /* 6539 */ { MAD_F(0x07769823) /* 0.466453684 */, 18 }, - /* 6540 */ { MAD_F(0x0776fbdf) /* 0.466548799 */, 18 }, - /* 6541 */ { MAD_F(0x07775f9d) /* 0.466643918 */, 18 }, - /* 6542 */ { MAD_F(0x0777c35c) /* 0.466739043 */, 18 }, - /* 6543 */ { MAD_F(0x0778271c) /* 0.466834172 */, 18 }, - - /* 6544 */ { MAD_F(0x07788add) /* 0.466929306 */, 18 }, - /* 6545 */ { MAD_F(0x0778ee9f) /* 0.467024445 */, 18 }, - /* 6546 */ { MAD_F(0x07795263) /* 0.467119588 */, 18 }, - /* 6547 */ { MAD_F(0x0779b629) /* 0.467214737 */, 18 }, - /* 6548 */ { MAD_F(0x077a19ef) /* 0.467309890 */, 18 }, - /* 6549 */ { MAD_F(0x077a7db7) /* 0.467405048 */, 18 }, - /* 6550 */ { MAD_F(0x077ae180) /* 0.467500211 */, 18 }, - /* 6551 */ { MAD_F(0x077b454b) /* 0.467595379 */, 18 }, - /* 6552 */ { MAD_F(0x077ba916) /* 0.467690552 */, 18 }, - /* 6553 */ { MAD_F(0x077c0ce3) /* 0.467785729 */, 18 }, - /* 6554 */ { MAD_F(0x077c70b2) /* 0.467880912 */, 18 }, - /* 6555 */ { MAD_F(0x077cd481) /* 0.467976099 */, 18 }, - /* 6556 */ { MAD_F(0x077d3852) /* 0.468071291 */, 18 }, - /* 6557 */ { MAD_F(0x077d9c24) /* 0.468166488 */, 18 }, - /* 6558 */ { MAD_F(0x077dfff8) /* 0.468261690 */, 18 }, - /* 6559 */ { MAD_F(0x077e63cd) /* 0.468356896 */, 18 }, - - /* 6560 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 18 }, - /* 6561 */ { MAD_F(0x077f2b7a) /* 0.468547324 */, 18 }, - /* 6562 */ { MAD_F(0x077f8f53) /* 0.468642545 */, 18 }, - /* 6563 */ { MAD_F(0x077ff32d) /* 0.468737771 */, 18 }, - /* 6564 */ { MAD_F(0x07805708) /* 0.468833002 */, 18 }, - /* 6565 */ { MAD_F(0x0780bae5) /* 0.468928237 */, 18 }, - /* 6566 */ { MAD_F(0x07811ec3) /* 0.469023478 */, 18 }, - /* 6567 */ { MAD_F(0x078182a2) /* 0.469118723 */, 18 }, - /* 6568 */ { MAD_F(0x0781e683) /* 0.469213973 */, 18 }, - /* 6569 */ { MAD_F(0x07824a64) /* 0.469309228 */, 18 }, - /* 6570 */ { MAD_F(0x0782ae47) /* 0.469404488 */, 18 }, - /* 6571 */ { MAD_F(0x0783122c) /* 0.469499752 */, 18 }, - /* 6572 */ { MAD_F(0x07837612) /* 0.469595022 */, 18 }, - /* 6573 */ { MAD_F(0x0783d9f9) /* 0.469690296 */, 18 }, - /* 6574 */ { MAD_F(0x07843de1) /* 0.469785575 */, 18 }, - /* 6575 */ { MAD_F(0x0784a1ca) /* 0.469880859 */, 18 }, - - /* 6576 */ { MAD_F(0x078505b5) /* 0.469976148 */, 18 }, - /* 6577 */ { MAD_F(0x078569a2) /* 0.470071442 */, 18 }, - /* 6578 */ { MAD_F(0x0785cd8f) /* 0.470166740 */, 18 }, - /* 6579 */ { MAD_F(0x0786317e) /* 0.470262043 */, 18 }, - /* 6580 */ { MAD_F(0x0786956e) /* 0.470357351 */, 18 }, - /* 6581 */ { MAD_F(0x0786f95f) /* 0.470452664 */, 18 }, - /* 6582 */ { MAD_F(0x07875d52) /* 0.470547982 */, 18 }, - /* 6583 */ { MAD_F(0x0787c146) /* 0.470643305 */, 18 }, - /* 6584 */ { MAD_F(0x0788253b) /* 0.470738632 */, 18 }, - /* 6585 */ { MAD_F(0x07888932) /* 0.470833964 */, 18 }, - /* 6586 */ { MAD_F(0x0788ed2a) /* 0.470929301 */, 18 }, - /* 6587 */ { MAD_F(0x07895123) /* 0.471024643 */, 18 }, - /* 6588 */ { MAD_F(0x0789b51d) /* 0.471119990 */, 18 }, - /* 6589 */ { MAD_F(0x078a1919) /* 0.471215341 */, 18 }, - /* 6590 */ { MAD_F(0x078a7d16) /* 0.471310698 */, 18 }, - /* 6591 */ { MAD_F(0x078ae114) /* 0.471406059 */, 18 }, - - /* 6592 */ { MAD_F(0x078b4514) /* 0.471501425 */, 18 }, - /* 6593 */ { MAD_F(0x078ba915) /* 0.471596796 */, 18 }, - /* 6594 */ { MAD_F(0x078c0d17) /* 0.471692171 */, 18 }, - /* 6595 */ { MAD_F(0x078c711a) /* 0.471787552 */, 18 }, - /* 6596 */ { MAD_F(0x078cd51f) /* 0.471882937 */, 18 }, - /* 6597 */ { MAD_F(0x078d3925) /* 0.471978327 */, 18 }, - /* 6598 */ { MAD_F(0x078d9d2d) /* 0.472073722 */, 18 }, - /* 6599 */ { MAD_F(0x078e0135) /* 0.472169122 */, 18 }, - /* 6600 */ { MAD_F(0x078e653f) /* 0.472264527 */, 18 }, - /* 6601 */ { MAD_F(0x078ec94b) /* 0.472359936 */, 18 }, - /* 6602 */ { MAD_F(0x078f2d57) /* 0.472455350 */, 18 }, - /* 6603 */ { MAD_F(0x078f9165) /* 0.472550769 */, 18 }, - /* 6604 */ { MAD_F(0x078ff574) /* 0.472646193 */, 18 }, - /* 6605 */ { MAD_F(0x07905985) /* 0.472741622 */, 18 }, - /* 6606 */ { MAD_F(0x0790bd96) /* 0.472837055 */, 18 }, - /* 6607 */ { MAD_F(0x079121a9) /* 0.472932493 */, 18 }, - - /* 6608 */ { MAD_F(0x079185be) /* 0.473027937 */, 18 }, - /* 6609 */ { MAD_F(0x0791e9d3) /* 0.473123384 */, 18 }, - /* 6610 */ { MAD_F(0x07924dea) /* 0.473218837 */, 18 }, - /* 6611 */ { MAD_F(0x0792b202) /* 0.473314295 */, 18 }, - /* 6612 */ { MAD_F(0x0793161c) /* 0.473409757 */, 18 }, - /* 6613 */ { MAD_F(0x07937a37) /* 0.473505224 */, 18 }, - /* 6614 */ { MAD_F(0x0793de53) /* 0.473600696 */, 18 }, - /* 6615 */ { MAD_F(0x07944270) /* 0.473696173 */, 18 }, - /* 6616 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 18 }, - /* 6617 */ { MAD_F(0x07950aaf) /* 0.473887141 */, 18 }, - /* 6618 */ { MAD_F(0x07956ed0) /* 0.473982632 */, 18 }, - /* 6619 */ { MAD_F(0x0795d2f2) /* 0.474078128 */, 18 }, - /* 6620 */ { MAD_F(0x07963716) /* 0.474173629 */, 18 }, - /* 6621 */ { MAD_F(0x07969b3b) /* 0.474269135 */, 18 }, - /* 6622 */ { MAD_F(0x0796ff62) /* 0.474364645 */, 18 }, - /* 6623 */ { MAD_F(0x07976389) /* 0.474460161 */, 18 }, - - /* 6624 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 18 }, - /* 6625 */ { MAD_F(0x07982bdd) /* 0.474651205 */, 18 }, - /* 6626 */ { MAD_F(0x07989008) /* 0.474746735 */, 18 }, - /* 6627 */ { MAD_F(0x0798f435) /* 0.474842270 */, 18 }, - /* 6628 */ { MAD_F(0x07995863) /* 0.474937809 */, 18 }, - /* 6629 */ { MAD_F(0x0799bc92) /* 0.475033353 */, 18 }, - /* 6630 */ { MAD_F(0x079a20c3) /* 0.475128902 */, 18 }, - /* 6631 */ { MAD_F(0x079a84f5) /* 0.475224456 */, 18 }, - /* 6632 */ { MAD_F(0x079ae929) /* 0.475320014 */, 18 }, - /* 6633 */ { MAD_F(0x079b4d5d) /* 0.475415578 */, 18 }, - /* 6634 */ { MAD_F(0x079bb193) /* 0.475511146 */, 18 }, - /* 6635 */ { MAD_F(0x079c15ca) /* 0.475606719 */, 18 }, - /* 6636 */ { MAD_F(0x079c7a03) /* 0.475702296 */, 18 }, - /* 6637 */ { MAD_F(0x079cde3c) /* 0.475797879 */, 18 }, - /* 6638 */ { MAD_F(0x079d4277) /* 0.475893466 */, 18 }, - /* 6639 */ { MAD_F(0x079da6b4) /* 0.475989058 */, 18 }, - - /* 6640 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 18 }, - /* 6641 */ { MAD_F(0x079e6f30) /* 0.476180257 */, 18 }, - /* 6642 */ { MAD_F(0x079ed370) /* 0.476275863 */, 18 }, - /* 6643 */ { MAD_F(0x079f37b2) /* 0.476371475 */, 18 }, - /* 6644 */ { MAD_F(0x079f9bf5) /* 0.476467091 */, 18 }, - /* 6645 */ { MAD_F(0x07a00039) /* 0.476562712 */, 18 }, - /* 6646 */ { MAD_F(0x07a0647e) /* 0.476658338 */, 18 }, - /* 6647 */ { MAD_F(0x07a0c8c5) /* 0.476753968 */, 18 }, - /* 6648 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 18 }, - /* 6649 */ { MAD_F(0x07a19156) /* 0.476945243 */, 18 }, - /* 6650 */ { MAD_F(0x07a1f5a0) /* 0.477040888 */, 18 }, - /* 6651 */ { MAD_F(0x07a259ec) /* 0.477136538 */, 18 }, - /* 6652 */ { MAD_F(0x07a2be39) /* 0.477232193 */, 18 }, - /* 6653 */ { MAD_F(0x07a32287) /* 0.477327852 */, 18 }, - /* 6654 */ { MAD_F(0x07a386d7) /* 0.477423516 */, 18 }, - /* 6655 */ { MAD_F(0x07a3eb28) /* 0.477519185 */, 18 }, - - /* 6656 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 18 }, - /* 6657 */ { MAD_F(0x07a4b3ce) /* 0.477710537 */, 18 }, - /* 6658 */ { MAD_F(0x07a51822) /* 0.477806220 */, 18 }, - /* 6659 */ { MAD_F(0x07a57c78) /* 0.477901908 */, 18 }, - /* 6660 */ { MAD_F(0x07a5e0d0) /* 0.477997601 */, 18 }, - /* 6661 */ { MAD_F(0x07a64528) /* 0.478093299 */, 18 }, - /* 6662 */ { MAD_F(0x07a6a982) /* 0.478189001 */, 18 }, - /* 6663 */ { MAD_F(0x07a70ddd) /* 0.478284708 */, 18 }, - /* 6664 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 18 }, - /* 6665 */ { MAD_F(0x07a7d698) /* 0.478476137 */, 18 }, - /* 6666 */ { MAD_F(0x07a83af7) /* 0.478571858 */, 18 }, - /* 6667 */ { MAD_F(0x07a89f57) /* 0.478667585 */, 18 }, - /* 6668 */ { MAD_F(0x07a903b9) /* 0.478763316 */, 18 }, - /* 6669 */ { MAD_F(0x07a9681c) /* 0.478859052 */, 18 }, - /* 6670 */ { MAD_F(0x07a9cc80) /* 0.478954793 */, 18 }, - /* 6671 */ { MAD_F(0x07aa30e5) /* 0.479050538 */, 18 }, - - /* 6672 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 18 }, - /* 6673 */ { MAD_F(0x07aaf9b4) /* 0.479242043 */, 18 }, - /* 6674 */ { MAD_F(0x07ab5e1e) /* 0.479337803 */, 18 }, - /* 6675 */ { MAD_F(0x07abc288) /* 0.479433568 */, 18 }, - /* 6676 */ { MAD_F(0x07ac26f4) /* 0.479529337 */, 18 }, - /* 6677 */ { MAD_F(0x07ac8b61) /* 0.479625111 */, 18 }, - /* 6678 */ { MAD_F(0x07acefd0) /* 0.479720890 */, 18 }, - /* 6679 */ { MAD_F(0x07ad543f) /* 0.479816674 */, 18 }, - /* 6680 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 18 }, - /* 6681 */ { MAD_F(0x07ae1d23) /* 0.480008256 */, 18 }, - /* 6682 */ { MAD_F(0x07ae8196) /* 0.480104054 */, 18 }, - /* 6683 */ { MAD_F(0x07aee60b) /* 0.480199857 */, 18 }, - /* 6684 */ { MAD_F(0x07af4a81) /* 0.480295664 */, 18 }, - /* 6685 */ { MAD_F(0x07afaef9) /* 0.480391477 */, 18 }, - /* 6686 */ { MAD_F(0x07b01372) /* 0.480487294 */, 18 }, - /* 6687 */ { MAD_F(0x07b077ec) /* 0.480583116 */, 18 }, - - /* 6688 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 18 }, - /* 6689 */ { MAD_F(0x07b140e4) /* 0.480774774 */, 18 }, - /* 6690 */ { MAD_F(0x07b1a561) /* 0.480870611 */, 18 }, - /* 6691 */ { MAD_F(0x07b209e1) /* 0.480966452 */, 18 }, - /* 6692 */ { MAD_F(0x07b26e61) /* 0.481062298 */, 18 }, - /* 6693 */ { MAD_F(0x07b2d2e3) /* 0.481158148 */, 18 }, - /* 6694 */ { MAD_F(0x07b33766) /* 0.481254004 */, 18 }, - /* 6695 */ { MAD_F(0x07b39bea) /* 0.481349864 */, 18 }, - /* 6696 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 18 }, - /* 6697 */ { MAD_F(0x07b464f6) /* 0.481541598 */, 18 }, - /* 6698 */ { MAD_F(0x07b4c97e) /* 0.481637473 */, 18 }, - /* 6699 */ { MAD_F(0x07b52e08) /* 0.481733352 */, 18 }, - /* 6700 */ { MAD_F(0x07b59292) /* 0.481829236 */, 18 }, - /* 6701 */ { MAD_F(0x07b5f71e) /* 0.481925125 */, 18 }, - /* 6702 */ { MAD_F(0x07b65bac) /* 0.482021019 */, 18 }, - /* 6703 */ { MAD_F(0x07b6c03a) /* 0.482116917 */, 18 }, - - /* 6704 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 18 }, - /* 6705 */ { MAD_F(0x07b7895b) /* 0.482308728 */, 18 }, - /* 6706 */ { MAD_F(0x07b7eded) /* 0.482404640 */, 18 }, - /* 6707 */ { MAD_F(0x07b85281) /* 0.482500558 */, 18 }, - /* 6708 */ { MAD_F(0x07b8b716) /* 0.482596480 */, 18 }, - /* 6709 */ { MAD_F(0x07b91bac) /* 0.482692407 */, 18 }, - /* 6710 */ { MAD_F(0x07b98044) /* 0.482788339 */, 18 }, - /* 6711 */ { MAD_F(0x07b9e4dc) /* 0.482884275 */, 18 }, - /* 6712 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 18 }, - /* 6713 */ { MAD_F(0x07baae12) /* 0.483076162 */, 18 }, - /* 6714 */ { MAD_F(0x07bb12ae) /* 0.483172113 */, 18 }, - /* 6715 */ { MAD_F(0x07bb774c) /* 0.483268069 */, 18 }, - /* 6716 */ { MAD_F(0x07bbdbeb) /* 0.483364029 */, 18 }, - /* 6717 */ { MAD_F(0x07bc408c) /* 0.483459994 */, 18 }, - /* 6718 */ { MAD_F(0x07bca52d) /* 0.483555964 */, 18 }, - /* 6719 */ { MAD_F(0x07bd09d0) /* 0.483651939 */, 18 }, - - /* 6720 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 18 }, - /* 6721 */ { MAD_F(0x07bdd31a) /* 0.483843902 */, 18 }, - /* 6722 */ { MAD_F(0x07be37c1) /* 0.483939891 */, 18 }, - /* 6723 */ { MAD_F(0x07be9c69) /* 0.484035885 */, 18 }, - /* 6724 */ { MAD_F(0x07bf0113) /* 0.484131883 */, 18 }, - /* 6725 */ { MAD_F(0x07bf65bd) /* 0.484227886 */, 18 }, - /* 6726 */ { MAD_F(0x07bfca69) /* 0.484323894 */, 18 }, - /* 6727 */ { MAD_F(0x07c02f16) /* 0.484419907 */, 18 }, - /* 6728 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 18 }, - /* 6729 */ { MAD_F(0x07c0f875) /* 0.484611946 */, 18 }, - /* 6730 */ { MAD_F(0x07c15d26) /* 0.484707973 */, 18 }, - /* 6731 */ { MAD_F(0x07c1c1d8) /* 0.484804005 */, 18 }, - /* 6732 */ { MAD_F(0x07c2268b) /* 0.484900041 */, 18 }, - /* 6733 */ { MAD_F(0x07c28b40) /* 0.484996083 */, 18 }, - /* 6734 */ { MAD_F(0x07c2eff6) /* 0.485092128 */, 18 }, - /* 6735 */ { MAD_F(0x07c354ae) /* 0.485188179 */, 18 }, - - /* 6736 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 18 }, - /* 6737 */ { MAD_F(0x07c41e21) /* 0.485380295 */, 18 }, - /* 6738 */ { MAD_F(0x07c482dc) /* 0.485476360 */, 18 }, - /* 6739 */ { MAD_F(0x07c4e798) /* 0.485572430 */, 18 }, - /* 6740 */ { MAD_F(0x07c54c56) /* 0.485668504 */, 18 }, - /* 6741 */ { MAD_F(0x07c5b115) /* 0.485764583 */, 18 }, - /* 6742 */ { MAD_F(0x07c615d6) /* 0.485860667 */, 18 }, - /* 6743 */ { MAD_F(0x07c67a97) /* 0.485956756 */, 18 }, - /* 6744 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 18 }, - /* 6745 */ { MAD_F(0x07c7441e) /* 0.486148948 */, 18 }, - /* 6746 */ { MAD_F(0x07c7a8e4) /* 0.486245051 */, 18 }, - /* 6747 */ { MAD_F(0x07c80daa) /* 0.486341158 */, 18 }, - /* 6748 */ { MAD_F(0x07c87272) /* 0.486437271 */, 18 }, - /* 6749 */ { MAD_F(0x07c8d73c) /* 0.486533388 */, 18 }, - /* 6750 */ { MAD_F(0x07c93c06) /* 0.486629510 */, 18 }, - /* 6751 */ { MAD_F(0x07c9a0d2) /* 0.486725637 */, 18 }, - - /* 6752 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 18 }, - /* 6753 */ { MAD_F(0x07ca6a6d) /* 0.486917905 */, 18 }, - /* 6754 */ { MAD_F(0x07cacf3d) /* 0.487014045 */, 18 }, - /* 6755 */ { MAD_F(0x07cb340e) /* 0.487110191 */, 18 }, - /* 6756 */ { MAD_F(0x07cb98e0) /* 0.487206342 */, 18 }, - /* 6757 */ { MAD_F(0x07cbfdb4) /* 0.487302497 */, 18 }, - /* 6758 */ { MAD_F(0x07cc6288) /* 0.487398657 */, 18 }, - /* 6759 */ { MAD_F(0x07ccc75e) /* 0.487494821 */, 18 }, - /* 6760 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 18 }, - /* 6761 */ { MAD_F(0x07cd910e) /* 0.487687165 */, 18 }, - /* 6762 */ { MAD_F(0x07cdf5e8) /* 0.487783344 */, 18 }, - /* 6763 */ { MAD_F(0x07ce5ac3) /* 0.487879528 */, 18 }, - /* 6764 */ { MAD_F(0x07cebfa0) /* 0.487975716 */, 18 }, - /* 6765 */ { MAD_F(0x07cf247d) /* 0.488071909 */, 18 }, - /* 6766 */ { MAD_F(0x07cf895c) /* 0.488168107 */, 18 }, - /* 6767 */ { MAD_F(0x07cfee3c) /* 0.488264310 */, 18 }, - - /* 6768 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 18 }, - /* 6769 */ { MAD_F(0x07d0b801) /* 0.488456729 */, 18 }, - /* 6770 */ { MAD_F(0x07d11ce5) /* 0.488552946 */, 18 }, - /* 6771 */ { MAD_F(0x07d181ca) /* 0.488649167 */, 18 }, - /* 6772 */ { MAD_F(0x07d1e6b0) /* 0.488745394 */, 18 }, - /* 6773 */ { MAD_F(0x07d24b98) /* 0.488841625 */, 18 }, - /* 6774 */ { MAD_F(0x07d2b081) /* 0.488937860 */, 18 }, - /* 6775 */ { MAD_F(0x07d3156c) /* 0.489034101 */, 18 }, - /* 6776 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 18 }, - /* 6777 */ { MAD_F(0x07d3df44) /* 0.489226596 */, 18 }, - /* 6778 */ { MAD_F(0x07d44432) /* 0.489322851 */, 18 }, - /* 6779 */ { MAD_F(0x07d4a922) /* 0.489419110 */, 18 }, - /* 6780 */ { MAD_F(0x07d50e13) /* 0.489515375 */, 18 }, - /* 6781 */ { MAD_F(0x07d57305) /* 0.489611643 */, 18 }, - /* 6782 */ { MAD_F(0x07d5d7f8) /* 0.489707917 */, 18 }, - /* 6783 */ { MAD_F(0x07d63cec) /* 0.489804195 */, 18 }, - - /* 6784 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 18 }, - /* 6785 */ { MAD_F(0x07d706d9) /* 0.489996766 */, 18 }, - /* 6786 */ { MAD_F(0x07d76bd2) /* 0.490093059 */, 18 }, - /* 6787 */ { MAD_F(0x07d7d0cb) /* 0.490189356 */, 18 }, - /* 6788 */ { MAD_F(0x07d835c6) /* 0.490285658 */, 18 }, - /* 6789 */ { MAD_F(0x07d89ac2) /* 0.490381965 */, 18 }, - /* 6790 */ { MAD_F(0x07d8ffc0) /* 0.490478277 */, 18 }, - /* 6791 */ { MAD_F(0x07d964be) /* 0.490574593 */, 18 }, - /* 6792 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 18 }, - /* 6793 */ { MAD_F(0x07da2ebf) /* 0.490767239 */, 18 }, - /* 6794 */ { MAD_F(0x07da93c2) /* 0.490863570 */, 18 }, - /* 6795 */ { MAD_F(0x07daf8c6) /* 0.490959905 */, 18 }, - /* 6796 */ { MAD_F(0x07db5dcb) /* 0.491056245 */, 18 }, - /* 6797 */ { MAD_F(0x07dbc2d1) /* 0.491152589 */, 18 }, - /* 6798 */ { MAD_F(0x07dc27d9) /* 0.491248939 */, 18 }, - /* 6799 */ { MAD_F(0x07dc8ce1) /* 0.491345293 */, 18 }, - - /* 6800 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 18 }, - /* 6801 */ { MAD_F(0x07dd56f7) /* 0.491538015 */, 18 }, - /* 6802 */ { MAD_F(0x07ddbc04) /* 0.491634383 */, 18 }, - /* 6803 */ { MAD_F(0x07de2111) /* 0.491730756 */, 18 }, - /* 6804 */ { MAD_F(0x07de8621) /* 0.491827134 */, 18 }, - /* 6805 */ { MAD_F(0x07deeb31) /* 0.491923516 */, 18 }, - /* 6806 */ { MAD_F(0x07df5043) /* 0.492019903 */, 18 }, - /* 6807 */ { MAD_F(0x07dfb556) /* 0.492116295 */, 18 }, - /* 6808 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 18 }, - /* 6809 */ { MAD_F(0x07e07f80) /* 0.492309093 */, 18 }, - /* 6810 */ { MAD_F(0x07e0e496) /* 0.492405499 */, 18 }, - /* 6811 */ { MAD_F(0x07e149ae) /* 0.492501909 */, 18 }, - /* 6812 */ { MAD_F(0x07e1aec8) /* 0.492598325 */, 18 }, - /* 6813 */ { MAD_F(0x07e213e2) /* 0.492694745 */, 18 }, - /* 6814 */ { MAD_F(0x07e278fe) /* 0.492791170 */, 18 }, - /* 6815 */ { MAD_F(0x07e2de1b) /* 0.492887599 */, 18 }, - - /* 6816 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 18 }, - /* 6817 */ { MAD_F(0x07e3a859) /* 0.493080472 */, 18 }, - /* 6818 */ { MAD_F(0x07e40d7a) /* 0.493176916 */, 18 }, - /* 6819 */ { MAD_F(0x07e4729c) /* 0.493273365 */, 18 }, - /* 6820 */ { MAD_F(0x07e4d7c0) /* 0.493369818 */, 18 }, - /* 6821 */ { MAD_F(0x07e53ce4) /* 0.493466275 */, 18 }, - /* 6822 */ { MAD_F(0x07e5a20a) /* 0.493562738 */, 18 }, - /* 6823 */ { MAD_F(0x07e60732) /* 0.493659205 */, 18 }, - /* 6824 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 18 }, - /* 6825 */ { MAD_F(0x07e6d184) /* 0.493852154 */, 18 }, - /* 6826 */ { MAD_F(0x07e736af) /* 0.493948635 */, 18 }, - /* 6827 */ { MAD_F(0x07e79bdb) /* 0.494045122 */, 18 }, - /* 6828 */ { MAD_F(0x07e80109) /* 0.494141612 */, 18 }, - /* 6829 */ { MAD_F(0x07e86638) /* 0.494238108 */, 18 }, - /* 6830 */ { MAD_F(0x07e8cb68) /* 0.494334608 */, 18 }, - /* 6831 */ { MAD_F(0x07e93099) /* 0.494431113 */, 18 }, - - /* 6832 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 18 }, - /* 6833 */ { MAD_F(0x07e9fb00) /* 0.494624137 */, 18 }, - /* 6834 */ { MAD_F(0x07ea6035) /* 0.494720656 */, 18 }, - /* 6835 */ { MAD_F(0x07eac56b) /* 0.494817180 */, 18 }, - /* 6836 */ { MAD_F(0x07eb2aa3) /* 0.494913709 */, 18 }, - /* 6837 */ { MAD_F(0x07eb8fdc) /* 0.495010242 */, 18 }, - /* 6838 */ { MAD_F(0x07ebf516) /* 0.495106780 */, 18 }, - /* 6839 */ { MAD_F(0x07ec5a51) /* 0.495203322 */, 18 }, - /* 6840 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 18 }, - /* 6841 */ { MAD_F(0x07ed24cc) /* 0.495396422 */, 18 }, - /* 6842 */ { MAD_F(0x07ed8a0b) /* 0.495492978 */, 18 }, - /* 6843 */ { MAD_F(0x07edef4c) /* 0.495589540 */, 18 }, - /* 6844 */ { MAD_F(0x07ee548e) /* 0.495686106 */, 18 }, - /* 6845 */ { MAD_F(0x07eeb9d1) /* 0.495782677 */, 18 }, - /* 6846 */ { MAD_F(0x07ef1f15) /* 0.495879252 */, 18 }, - /* 6847 */ { MAD_F(0x07ef845b) /* 0.495975833 */, 18 }, - - /* 6848 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 18 }, - /* 6849 */ { MAD_F(0x07f04ee9) /* 0.496169007 */, 18 }, - /* 6850 */ { MAD_F(0x07f0b433) /* 0.496265602 */, 18 }, - /* 6851 */ { MAD_F(0x07f1197d) /* 0.496362201 */, 18 }, - /* 6852 */ { MAD_F(0x07f17ec9) /* 0.496458804 */, 18 }, - /* 6853 */ { MAD_F(0x07f1e416) /* 0.496555413 */, 18 }, - /* 6854 */ { MAD_F(0x07f24965) /* 0.496652026 */, 18 }, - /* 6855 */ { MAD_F(0x07f2aeb5) /* 0.496748644 */, 18 }, - /* 6856 */ { MAD_F(0x07f31405) /* 0.496845266 */, 18 }, - /* 6857 */ { MAD_F(0x07f37958) /* 0.496941894 */, 18 }, - /* 6858 */ { MAD_F(0x07f3deab) /* 0.497038526 */, 18 }, - /* 6859 */ { MAD_F(0x07f44400) /* 0.497135162 */, 18 }, - /* 6860 */ { MAD_F(0x07f4a956) /* 0.497231804 */, 18 }, - /* 6861 */ { MAD_F(0x07f50ead) /* 0.497328450 */, 18 }, - /* 6862 */ { MAD_F(0x07f57405) /* 0.497425100 */, 18 }, - /* 6863 */ { MAD_F(0x07f5d95f) /* 0.497521756 */, 18 }, - - /* 6864 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 18 }, - /* 6865 */ { MAD_F(0x07f6a416) /* 0.497715081 */, 18 }, - /* 6866 */ { MAD_F(0x07f70974) /* 0.497811750 */, 18 }, - /* 6867 */ { MAD_F(0x07f76ed3) /* 0.497908425 */, 18 }, - /* 6868 */ { MAD_F(0x07f7d433) /* 0.498005103 */, 18 }, - /* 6869 */ { MAD_F(0x07f83994) /* 0.498101787 */, 18 }, - /* 6870 */ { MAD_F(0x07f89ef7) /* 0.498198475 */, 18 }, - /* 6871 */ { MAD_F(0x07f9045a) /* 0.498295168 */, 18 }, - /* 6872 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 18 }, - /* 6873 */ { MAD_F(0x07f9cf26) /* 0.498488568 */, 18 }, - /* 6874 */ { MAD_F(0x07fa348e) /* 0.498585275 */, 18 }, - /* 6875 */ { MAD_F(0x07fa99f6) /* 0.498681987 */, 18 }, - /* 6876 */ { MAD_F(0x07faff60) /* 0.498778704 */, 18 }, - /* 6877 */ { MAD_F(0x07fb64cc) /* 0.498875425 */, 18 }, - /* 6878 */ { MAD_F(0x07fbca38) /* 0.498972150 */, 18 }, - /* 6879 */ { MAD_F(0x07fc2fa6) /* 0.499068881 */, 18 }, - - /* 6880 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 18 }, - /* 6881 */ { MAD_F(0x07fcfa86) /* 0.499262356 */, 18 }, - /* 6882 */ { MAD_F(0x07fd5ff8) /* 0.499359101 */, 18 }, - /* 6883 */ { MAD_F(0x07fdc56b) /* 0.499455850 */, 18 }, - /* 6884 */ { MAD_F(0x07fe2adf) /* 0.499552604 */, 18 }, - /* 6885 */ { MAD_F(0x07fe9054) /* 0.499649362 */, 18 }, - /* 6886 */ { MAD_F(0x07fef5cb) /* 0.499746126 */, 18 }, - /* 6887 */ { MAD_F(0x07ff5b43) /* 0.499842894 */, 18 }, - /* 6888 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 18 }, - /* 6889 */ { MAD_F(0x0400131b) /* 0.250018222 */, 19 }, - /* 6890 */ { MAD_F(0x040045d9) /* 0.250066613 */, 19 }, - /* 6891 */ { MAD_F(0x04007897) /* 0.250115006 */, 19 }, - /* 6892 */ { MAD_F(0x0400ab57) /* 0.250163402 */, 19 }, - /* 6893 */ { MAD_F(0x0400de16) /* 0.250211800 */, 19 }, - /* 6894 */ { MAD_F(0x040110d7) /* 0.250260200 */, 19 }, - /* 6895 */ { MAD_F(0x04014398) /* 0.250308603 */, 19 }, - - /* 6896 */ { MAD_F(0x04017659) /* 0.250357008 */, 19 }, - /* 6897 */ { MAD_F(0x0401a91c) /* 0.250405415 */, 19 }, - /* 6898 */ { MAD_F(0x0401dbdf) /* 0.250453825 */, 19 }, - /* 6899 */ { MAD_F(0x04020ea2) /* 0.250502237 */, 19 }, - /* 6900 */ { MAD_F(0x04024166) /* 0.250550652 */, 19 }, - /* 6901 */ { MAD_F(0x0402742b) /* 0.250599068 */, 19 }, - /* 6902 */ { MAD_F(0x0402a6f0) /* 0.250647488 */, 19 }, - /* 6903 */ { MAD_F(0x0402d9b6) /* 0.250695909 */, 19 }, - /* 6904 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 19 }, - /* 6905 */ { MAD_F(0x04033f44) /* 0.250792759 */, 19 }, - /* 6906 */ { MAD_F(0x0403720c) /* 0.250841187 */, 19 }, - /* 6907 */ { MAD_F(0x0403a4d5) /* 0.250889618 */, 19 }, - /* 6908 */ { MAD_F(0x0403d79e) /* 0.250938051 */, 19 }, - /* 6909 */ { MAD_F(0x04040a68) /* 0.250986487 */, 19 }, - /* 6910 */ { MAD_F(0x04043d32) /* 0.251034924 */, 19 }, - /* 6911 */ { MAD_F(0x04046ffd) /* 0.251083365 */, 19 }, - - /* 6912 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 19 }, - /* 6913 */ { MAD_F(0x0404d595) /* 0.251180252 */, 19 }, - /* 6914 */ { MAD_F(0x04050862) /* 0.251228699 */, 19 }, - /* 6915 */ { MAD_F(0x04053b30) /* 0.251277148 */, 19 }, - /* 6916 */ { MAD_F(0x04056dfe) /* 0.251325600 */, 19 }, - /* 6917 */ { MAD_F(0x0405a0cd) /* 0.251374054 */, 19 }, - /* 6918 */ { MAD_F(0x0405d39c) /* 0.251422511 */, 19 }, - /* 6919 */ { MAD_F(0x0406066c) /* 0.251470970 */, 19 }, - /* 6920 */ { MAD_F(0x0406393d) /* 0.251519431 */, 19 }, - /* 6921 */ { MAD_F(0x04066c0e) /* 0.251567894 */, 19 }, - /* 6922 */ { MAD_F(0x04069ee0) /* 0.251616360 */, 19 }, - /* 6923 */ { MAD_F(0x0406d1b3) /* 0.251664828 */, 19 }, - /* 6924 */ { MAD_F(0x04070486) /* 0.251713299 */, 19 }, - /* 6925 */ { MAD_F(0x0407375a) /* 0.251761772 */, 19 }, - /* 6926 */ { MAD_F(0x04076a2e) /* 0.251810247 */, 19 }, - /* 6927 */ { MAD_F(0x04079d03) /* 0.251858724 */, 19 }, - - /* 6928 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 19 }, - /* 6929 */ { MAD_F(0x040802af) /* 0.251955686 */, 19 }, - /* 6930 */ { MAD_F(0x04083586) /* 0.252004171 */, 19 }, - /* 6931 */ { MAD_F(0x0408685e) /* 0.252052658 */, 19 }, - /* 6932 */ { MAD_F(0x04089b36) /* 0.252101147 */, 19 }, - /* 6933 */ { MAD_F(0x0408ce0f) /* 0.252149638 */, 19 }, - /* 6934 */ { MAD_F(0x040900e8) /* 0.252198132 */, 19 }, - /* 6935 */ { MAD_F(0x040933c2) /* 0.252246628 */, 19 }, - /* 6936 */ { MAD_F(0x0409669d) /* 0.252295127 */, 19 }, - /* 6937 */ { MAD_F(0x04099978) /* 0.252343627 */, 19 }, - /* 6938 */ { MAD_F(0x0409cc54) /* 0.252392131 */, 19 }, - /* 6939 */ { MAD_F(0x0409ff31) /* 0.252440636 */, 19 }, - /* 6940 */ { MAD_F(0x040a320e) /* 0.252489144 */, 19 }, - /* 6941 */ { MAD_F(0x040a64ec) /* 0.252537654 */, 19 }, - /* 6942 */ { MAD_F(0x040a97cb) /* 0.252586166 */, 19 }, - /* 6943 */ { MAD_F(0x040acaaa) /* 0.252634681 */, 19 }, - - /* 6944 */ { MAD_F(0x040afd89) /* 0.252683198 */, 19 }, - /* 6945 */ { MAD_F(0x040b306a) /* 0.252731718 */, 19 }, - /* 6946 */ { MAD_F(0x040b634b) /* 0.252780240 */, 19 }, - /* 6947 */ { MAD_F(0x040b962c) /* 0.252828764 */, 19 }, - /* 6948 */ { MAD_F(0x040bc90e) /* 0.252877290 */, 19 }, - /* 6949 */ { MAD_F(0x040bfbf1) /* 0.252925819 */, 19 }, - /* 6950 */ { MAD_F(0x040c2ed5) /* 0.252974350 */, 19 }, - /* 6951 */ { MAD_F(0x040c61b9) /* 0.253022883 */, 19 }, - /* 6952 */ { MAD_F(0x040c949e) /* 0.253071419 */, 19 }, - /* 6953 */ { MAD_F(0x040cc783) /* 0.253119957 */, 19 }, - /* 6954 */ { MAD_F(0x040cfa69) /* 0.253168498 */, 19 }, - /* 6955 */ { MAD_F(0x040d2d4f) /* 0.253217040 */, 19 }, - /* 6956 */ { MAD_F(0x040d6037) /* 0.253265585 */, 19 }, - /* 6957 */ { MAD_F(0x040d931e) /* 0.253314133 */, 19 }, - /* 6958 */ { MAD_F(0x040dc607) /* 0.253362682 */, 19 }, - /* 6959 */ { MAD_F(0x040df8f0) /* 0.253411234 */, 19 }, - - /* 6960 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 19 }, - /* 6961 */ { MAD_F(0x040e5ec4) /* 0.253508345 */, 19 }, - /* 6962 */ { MAD_F(0x040e91af) /* 0.253556904 */, 19 }, - /* 6963 */ { MAD_F(0x040ec49b) /* 0.253605466 */, 19 }, - /* 6964 */ { MAD_F(0x040ef787) /* 0.253654029 */, 19 }, - /* 6965 */ { MAD_F(0x040f2a74) /* 0.253702595 */, 19 }, - /* 6966 */ { MAD_F(0x040f5d61) /* 0.253751164 */, 19 }, - /* 6967 */ { MAD_F(0x040f904f) /* 0.253799734 */, 19 }, - /* 6968 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 19 }, - /* 6969 */ { MAD_F(0x040ff62d) /* 0.253896883 */, 19 }, - /* 6970 */ { MAD_F(0x0410291d) /* 0.253945460 */, 19 }, - /* 6971 */ { MAD_F(0x04105c0e) /* 0.253994040 */, 19 }, - /* 6972 */ { MAD_F(0x04108eff) /* 0.254042622 */, 19 }, - /* 6973 */ { MAD_F(0x0410c1f1) /* 0.254091207 */, 19 }, - /* 6974 */ { MAD_F(0x0410f4e3) /* 0.254139794 */, 19 }, - /* 6975 */ { MAD_F(0x041127d6) /* 0.254188383 */, 19 }, - - /* 6976 */ { MAD_F(0x04115aca) /* 0.254236974 */, 19 }, - /* 6977 */ { MAD_F(0x04118dbe) /* 0.254285568 */, 19 }, - /* 6978 */ { MAD_F(0x0411c0b3) /* 0.254334165 */, 19 }, - /* 6979 */ { MAD_F(0x0411f3a9) /* 0.254382763 */, 19 }, - /* 6980 */ { MAD_F(0x0412269f) /* 0.254431364 */, 19 }, - /* 6981 */ { MAD_F(0x04125996) /* 0.254479967 */, 19 }, - /* 6982 */ { MAD_F(0x04128c8d) /* 0.254528572 */, 19 }, - /* 6983 */ { MAD_F(0x0412bf85) /* 0.254577180 */, 19 }, - /* 6984 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 19 }, - /* 6985 */ { MAD_F(0x04132577) /* 0.254674403 */, 19 }, - /* 6986 */ { MAD_F(0x04135871) /* 0.254723017 */, 19 }, - /* 6987 */ { MAD_F(0x04138b6c) /* 0.254771635 */, 19 }, - /* 6988 */ { MAD_F(0x0413be67) /* 0.254820254 */, 19 }, - /* 6989 */ { MAD_F(0x0413f163) /* 0.254868876 */, 19 }, - /* 6990 */ { MAD_F(0x0414245f) /* 0.254917500 */, 19 }, - /* 6991 */ { MAD_F(0x0414575c) /* 0.254966126 */, 19 }, - - /* 6992 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 19 }, - /* 6993 */ { MAD_F(0x0414bd58) /* 0.255063386 */, 19 }, - /* 6994 */ { MAD_F(0x0414f057) /* 0.255112019 */, 19 }, - /* 6995 */ { MAD_F(0x04152356) /* 0.255160655 */, 19 }, - /* 6996 */ { MAD_F(0x04155657) /* 0.255209292 */, 19 }, - /* 6997 */ { MAD_F(0x04158957) /* 0.255257933 */, 19 }, - /* 6998 */ { MAD_F(0x0415bc59) /* 0.255306575 */, 19 }, - /* 6999 */ { MAD_F(0x0415ef5b) /* 0.255355220 */, 19 }, - /* 7000 */ { MAD_F(0x0416225d) /* 0.255403867 */, 19 }, - /* 7001 */ { MAD_F(0x04165561) /* 0.255452517 */, 19 }, - /* 7002 */ { MAD_F(0x04168864) /* 0.255501169 */, 19 }, - /* 7003 */ { MAD_F(0x0416bb69) /* 0.255549823 */, 19 }, - /* 7004 */ { MAD_F(0x0416ee6e) /* 0.255598479 */, 19 }, - /* 7005 */ { MAD_F(0x04172174) /* 0.255647138 */, 19 }, - /* 7006 */ { MAD_F(0x0417547a) /* 0.255695799 */, 19 }, - /* 7007 */ { MAD_F(0x04178781) /* 0.255744463 */, 19 }, - - /* 7008 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 19 }, - /* 7009 */ { MAD_F(0x0417ed91) /* 0.255841796 */, 19 }, - /* 7010 */ { MAD_F(0x0418209a) /* 0.255890467 */, 19 }, - /* 7011 */ { MAD_F(0x041853a3) /* 0.255939139 */, 19 }, - /* 7012 */ { MAD_F(0x041886ad) /* 0.255987814 */, 19 }, - /* 7013 */ { MAD_F(0x0418b9b8) /* 0.256036492 */, 19 }, - /* 7014 */ { MAD_F(0x0418ecc3) /* 0.256085171 */, 19 }, - /* 7015 */ { MAD_F(0x04191fcf) /* 0.256133853 */, 19 }, - /* 7016 */ { MAD_F(0x041952dc) /* 0.256182537 */, 19 }, - /* 7017 */ { MAD_F(0x041985e9) /* 0.256231224 */, 19 }, - /* 7018 */ { MAD_F(0x0419b8f7) /* 0.256279913 */, 19 }, - /* 7019 */ { MAD_F(0x0419ec05) /* 0.256328604 */, 19 }, - /* 7020 */ { MAD_F(0x041a1f15) /* 0.256377297 */, 19 }, - /* 7021 */ { MAD_F(0x041a5224) /* 0.256425993 */, 19 }, - /* 7022 */ { MAD_F(0x041a8534) /* 0.256474691 */, 19 }, - /* 7023 */ { MAD_F(0x041ab845) /* 0.256523392 */, 19 }, - - /* 7024 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 19 }, - /* 7025 */ { MAD_F(0x041b1e69) /* 0.256620800 */, 19 }, - /* 7026 */ { MAD_F(0x041b517c) /* 0.256669507 */, 19 }, - /* 7027 */ { MAD_F(0x041b848f) /* 0.256718217 */, 19 }, - /* 7028 */ { MAD_F(0x041bb7a3) /* 0.256766929 */, 19 }, - /* 7029 */ { MAD_F(0x041beab8) /* 0.256815643 */, 19 }, - /* 7030 */ { MAD_F(0x041c1dcd) /* 0.256864359 */, 19 }, - /* 7031 */ { MAD_F(0x041c50e3) /* 0.256913078 */, 19 }, - /* 7032 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 19 }, - /* 7033 */ { MAD_F(0x041cb711) /* 0.257010523 */, 19 }, - /* 7034 */ { MAD_F(0x041cea28) /* 0.257059249 */, 19 }, - /* 7035 */ { MAD_F(0x041d1d41) /* 0.257107977 */, 19 }, - /* 7036 */ { MAD_F(0x041d505a) /* 0.257156708 */, 19 }, - /* 7037 */ { MAD_F(0x041d8373) /* 0.257205440 */, 19 }, - /* 7038 */ { MAD_F(0x041db68e) /* 0.257254175 */, 19 }, - /* 7039 */ { MAD_F(0x041de9a8) /* 0.257302913 */, 19 }, - - /* 7040 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 19 }, - /* 7041 */ { MAD_F(0x041e4fe0) /* 0.257400394 */, 19 }, - /* 7042 */ { MAD_F(0x041e82fd) /* 0.257449139 */, 19 }, - /* 7043 */ { MAD_F(0x041eb61a) /* 0.257497885 */, 19 }, - /* 7044 */ { MAD_F(0x041ee938) /* 0.257546634 */, 19 }, - /* 7045 */ { MAD_F(0x041f1c57) /* 0.257595386 */, 19 }, - /* 7046 */ { MAD_F(0x041f4f76) /* 0.257644139 */, 19 }, - /* 7047 */ { MAD_F(0x041f8296) /* 0.257692895 */, 19 }, - /* 7048 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 19 }, - /* 7049 */ { MAD_F(0x041fe8d7) /* 0.257790414 */, 19 }, - /* 7050 */ { MAD_F(0x04201bf9) /* 0.257839176 */, 19 }, - /* 7051 */ { MAD_F(0x04204f1b) /* 0.257887941 */, 19 }, - /* 7052 */ { MAD_F(0x0420823e) /* 0.257936709 */, 19 }, - /* 7053 */ { MAD_F(0x0420b561) /* 0.257985478 */, 19 }, - /* 7054 */ { MAD_F(0x0420e885) /* 0.258034250 */, 19 }, - /* 7055 */ { MAD_F(0x04211baa) /* 0.258083025 */, 19 }, - - /* 7056 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 19 }, - /* 7057 */ { MAD_F(0x042181f6) /* 0.258180580 */, 19 }, - /* 7058 */ { MAD_F(0x0421b51c) /* 0.258229361 */, 19 }, - /* 7059 */ { MAD_F(0x0421e843) /* 0.258278145 */, 19 }, - /* 7060 */ { MAD_F(0x04221b6b) /* 0.258326931 */, 19 }, - /* 7061 */ { MAD_F(0x04224e94) /* 0.258375719 */, 19 }, - /* 7062 */ { MAD_F(0x042281bd) /* 0.258424509 */, 19 }, - /* 7063 */ { MAD_F(0x0422b4e6) /* 0.258473302 */, 19 }, - /* 7064 */ { MAD_F(0x0422e811) /* 0.258522097 */, 19 }, - /* 7065 */ { MAD_F(0x04231b3c) /* 0.258570894 */, 19 }, - /* 7066 */ { MAD_F(0x04234e67) /* 0.258619694 */, 19 }, - /* 7067 */ { MAD_F(0x04238193) /* 0.258668496 */, 19 }, - /* 7068 */ { MAD_F(0x0423b4c0) /* 0.258717300 */, 19 }, - /* 7069 */ { MAD_F(0x0423e7ee) /* 0.258766106 */, 19 }, - /* 7070 */ { MAD_F(0x04241b1c) /* 0.258814915 */, 19 }, - /* 7071 */ { MAD_F(0x04244e4a) /* 0.258863726 */, 19 }, - - /* 7072 */ { MAD_F(0x04248179) /* 0.258912540 */, 19 }, - /* 7073 */ { MAD_F(0x0424b4a9) /* 0.258961356 */, 19 }, - /* 7074 */ { MAD_F(0x0424e7da) /* 0.259010174 */, 19 }, - /* 7075 */ { MAD_F(0x04251b0b) /* 0.259058994 */, 19 }, - /* 7076 */ { MAD_F(0x04254e3d) /* 0.259107817 */, 19 }, - /* 7077 */ { MAD_F(0x0425816f) /* 0.259156642 */, 19 }, - /* 7078 */ { MAD_F(0x0425b4a2) /* 0.259205469 */, 19 }, - /* 7079 */ { MAD_F(0x0425e7d6) /* 0.259254298 */, 19 }, - /* 7080 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 19 }, - /* 7081 */ { MAD_F(0x04264e3f) /* 0.259351964 */, 19 }, - /* 7082 */ { MAD_F(0x04268174) /* 0.259400801 */, 19 }, - /* 7083 */ { MAD_F(0x0426b4aa) /* 0.259449639 */, 19 }, - /* 7084 */ { MAD_F(0x0426e7e1) /* 0.259498480 */, 19 }, - /* 7085 */ { MAD_F(0x04271b18) /* 0.259547324 */, 19 }, - /* 7086 */ { MAD_F(0x04274e50) /* 0.259596169 */, 19 }, - /* 7087 */ { MAD_F(0x04278188) /* 0.259645017 */, 19 }, - - /* 7088 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 19 }, - /* 7089 */ { MAD_F(0x0427e7fb) /* 0.259742720 */, 19 }, - /* 7090 */ { MAD_F(0x04281b36) /* 0.259791575 */, 19 }, - /* 7091 */ { MAD_F(0x04284e71) /* 0.259840432 */, 19 }, - /* 7092 */ { MAD_F(0x042881ac) /* 0.259889291 */, 19 }, - /* 7093 */ { MAD_F(0x0428b4e8) /* 0.259938153 */, 19 }, - /* 7094 */ { MAD_F(0x0428e825) /* 0.259987017 */, 19 }, - /* 7095 */ { MAD_F(0x04291b63) /* 0.260035883 */, 19 }, - /* 7096 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 19 }, - /* 7097 */ { MAD_F(0x042981df) /* 0.260133623 */, 19 }, - /* 7098 */ { MAD_F(0x0429b51f) /* 0.260182496 */, 19 }, - /* 7099 */ { MAD_F(0x0429e85f) /* 0.260231372 */, 19 }, - /* 7100 */ { MAD_F(0x042a1b9f) /* 0.260280249 */, 19 }, - /* 7101 */ { MAD_F(0x042a4ee0) /* 0.260329129 */, 19 }, - /* 7102 */ { MAD_F(0x042a8222) /* 0.260378012 */, 19 }, - /* 7103 */ { MAD_F(0x042ab564) /* 0.260426896 */, 19 }, - - /* 7104 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 19 }, - /* 7105 */ { MAD_F(0x042b1beb) /* 0.260524673 */, 19 }, - /* 7106 */ { MAD_F(0x042b4f2f) /* 0.260573564 */, 19 }, - /* 7107 */ { MAD_F(0x042b8274) /* 0.260622458 */, 19 }, - /* 7108 */ { MAD_F(0x042bb5ba) /* 0.260671354 */, 19 }, - /* 7109 */ { MAD_F(0x042be900) /* 0.260720252 */, 19 }, - /* 7110 */ { MAD_F(0x042c1c46) /* 0.260769153 */, 19 }, - /* 7111 */ { MAD_F(0x042c4f8e) /* 0.260818056 */, 19 }, - /* 7112 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 19 }, - /* 7113 */ { MAD_F(0x042cb61e) /* 0.260915869 */, 19 }, - /* 7114 */ { MAD_F(0x042ce967) /* 0.260964779 */, 19 }, - /* 7115 */ { MAD_F(0x042d1cb1) /* 0.261013691 */, 19 }, - /* 7116 */ { MAD_F(0x042d4ffb) /* 0.261062606 */, 19 }, - /* 7117 */ { MAD_F(0x042d8346) /* 0.261111522 */, 19 }, - /* 7118 */ { MAD_F(0x042db692) /* 0.261160441 */, 19 }, - /* 7119 */ { MAD_F(0x042de9de) /* 0.261209363 */, 19 }, - - /* 7120 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 19 }, - /* 7121 */ { MAD_F(0x042e5078) /* 0.261307212 */, 19 }, - /* 7122 */ { MAD_F(0x042e83c6) /* 0.261356140 */, 19 }, - /* 7123 */ { MAD_F(0x042eb715) /* 0.261405071 */, 19 }, - /* 7124 */ { MAD_F(0x042eea64) /* 0.261454004 */, 19 }, - /* 7125 */ { MAD_F(0x042f1db4) /* 0.261502939 */, 19 }, - /* 7126 */ { MAD_F(0x042f5105) /* 0.261551876 */, 19 }, - /* 7127 */ { MAD_F(0x042f8456) /* 0.261600816 */, 19 }, - /* 7128 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 19 }, - /* 7129 */ { MAD_F(0x042feafa) /* 0.261698702 */, 19 }, - /* 7130 */ { MAD_F(0x04301e4d) /* 0.261747649 */, 19 }, - /* 7131 */ { MAD_F(0x043051a1) /* 0.261796597 */, 19 }, - /* 7132 */ { MAD_F(0x043084f5) /* 0.261845548 */, 19 }, - /* 7133 */ { MAD_F(0x0430b84a) /* 0.261894502 */, 19 }, - /* 7134 */ { MAD_F(0x0430eb9f) /* 0.261943458 */, 19 }, - /* 7135 */ { MAD_F(0x04311ef5) /* 0.261992416 */, 19 }, - - /* 7136 */ { MAD_F(0x0431524c) /* 0.262041376 */, 19 }, - /* 7137 */ { MAD_F(0x043185a3) /* 0.262090338 */, 19 }, - /* 7138 */ { MAD_F(0x0431b8fb) /* 0.262139303 */, 19 }, - /* 7139 */ { MAD_F(0x0431ec54) /* 0.262188270 */, 19 }, - /* 7140 */ { MAD_F(0x04321fad) /* 0.262237240 */, 19 }, - /* 7141 */ { MAD_F(0x04325306) /* 0.262286211 */, 19 }, - /* 7142 */ { MAD_F(0x04328661) /* 0.262335185 */, 19 }, - /* 7143 */ { MAD_F(0x0432b9bc) /* 0.262384162 */, 19 }, - /* 7144 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 19 }, - /* 7145 */ { MAD_F(0x04332074) /* 0.262482121 */, 19 }, - /* 7146 */ { MAD_F(0x043353d0) /* 0.262531104 */, 19 }, - /* 7147 */ { MAD_F(0x0433872e) /* 0.262580089 */, 19 }, - /* 7148 */ { MAD_F(0x0433ba8c) /* 0.262629077 */, 19 }, - /* 7149 */ { MAD_F(0x0433edea) /* 0.262678067 */, 19 }, - /* 7150 */ { MAD_F(0x0434214a) /* 0.262727059 */, 19 }, - /* 7151 */ { MAD_F(0x043454aa) /* 0.262776054 */, 19 }, - - /* 7152 */ { MAD_F(0x0434880a) /* 0.262825051 */, 19 }, - /* 7153 */ { MAD_F(0x0434bb6b) /* 0.262874050 */, 19 }, - /* 7154 */ { MAD_F(0x0434eecd) /* 0.262923051 */, 19 }, - /* 7155 */ { MAD_F(0x0435222f) /* 0.262972055 */, 19 }, - /* 7156 */ { MAD_F(0x04355592) /* 0.263021061 */, 19 }, - /* 7157 */ { MAD_F(0x043588f6) /* 0.263070069 */, 19 }, - /* 7158 */ { MAD_F(0x0435bc5a) /* 0.263119079 */, 19 }, - /* 7159 */ { MAD_F(0x0435efbf) /* 0.263168092 */, 19 }, - /* 7160 */ { MAD_F(0x04362324) /* 0.263217107 */, 19 }, - /* 7161 */ { MAD_F(0x0436568a) /* 0.263266125 */, 19 }, - /* 7162 */ { MAD_F(0x043689f1) /* 0.263315144 */, 19 }, - /* 7163 */ { MAD_F(0x0436bd58) /* 0.263364166 */, 19 }, - /* 7164 */ { MAD_F(0x0436f0c0) /* 0.263413191 */, 19 }, - /* 7165 */ { MAD_F(0x04372428) /* 0.263462217 */, 19 }, - /* 7166 */ { MAD_F(0x04375791) /* 0.263511246 */, 19 }, - /* 7167 */ { MAD_F(0x04378afb) /* 0.263560277 */, 19 }, - - /* 7168 */ { MAD_F(0x0437be65) /* 0.263609310 */, 19 }, - /* 7169 */ { MAD_F(0x0437f1d0) /* 0.263658346 */, 19 }, - /* 7170 */ { MAD_F(0x0438253c) /* 0.263707384 */, 19 }, - /* 7171 */ { MAD_F(0x043858a8) /* 0.263756424 */, 19 }, - /* 7172 */ { MAD_F(0x04388c14) /* 0.263805466 */, 19 }, - /* 7173 */ { MAD_F(0x0438bf82) /* 0.263854511 */, 19 }, - /* 7174 */ { MAD_F(0x0438f2f0) /* 0.263903558 */, 19 }, - /* 7175 */ { MAD_F(0x0439265e) /* 0.263952607 */, 19 }, - /* 7176 */ { MAD_F(0x043959cd) /* 0.264001659 */, 19 }, - /* 7177 */ { MAD_F(0x04398d3d) /* 0.264050713 */, 19 }, - /* 7178 */ { MAD_F(0x0439c0ae) /* 0.264099769 */, 19 }, - /* 7179 */ { MAD_F(0x0439f41f) /* 0.264148827 */, 19 }, - /* 7180 */ { MAD_F(0x043a2790) /* 0.264197888 */, 19 }, - /* 7181 */ { MAD_F(0x043a5b02) /* 0.264246951 */, 19 }, - /* 7182 */ { MAD_F(0x043a8e75) /* 0.264296016 */, 19 }, - /* 7183 */ { MAD_F(0x043ac1e9) /* 0.264345084 */, 19 }, - - /* 7184 */ { MAD_F(0x043af55d) /* 0.264394153 */, 19 }, - /* 7185 */ { MAD_F(0x043b28d2) /* 0.264443225 */, 19 }, - /* 7186 */ { MAD_F(0x043b5c47) /* 0.264492300 */, 19 }, - /* 7187 */ { MAD_F(0x043b8fbd) /* 0.264541376 */, 19 }, - /* 7188 */ { MAD_F(0x043bc333) /* 0.264590455 */, 19 }, - /* 7189 */ { MAD_F(0x043bf6aa) /* 0.264639536 */, 19 }, - /* 7190 */ { MAD_F(0x043c2a22) /* 0.264688620 */, 19 }, - /* 7191 */ { MAD_F(0x043c5d9a) /* 0.264737706 */, 19 }, - /* 7192 */ { MAD_F(0x043c9113) /* 0.264786794 */, 19 }, - /* 7193 */ { MAD_F(0x043cc48d) /* 0.264835884 */, 19 }, - /* 7194 */ { MAD_F(0x043cf807) /* 0.264884976 */, 19 }, - /* 7195 */ { MAD_F(0x043d2b82) /* 0.264934071 */, 19 }, - /* 7196 */ { MAD_F(0x043d5efd) /* 0.264983168 */, 19 }, - /* 7197 */ { MAD_F(0x043d9279) /* 0.265032268 */, 19 }, - /* 7198 */ { MAD_F(0x043dc5f6) /* 0.265081369 */, 19 }, - /* 7199 */ { MAD_F(0x043df973) /* 0.265130473 */, 19 }, - - /* 7200 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 19 }, - /* 7201 */ { MAD_F(0x043e6070) /* 0.265228688 */, 19 }, - /* 7202 */ { MAD_F(0x043e93ef) /* 0.265277799 */, 19 }, - /* 7203 */ { MAD_F(0x043ec76e) /* 0.265326912 */, 19 }, - /* 7204 */ { MAD_F(0x043efaef) /* 0.265376027 */, 19 }, - /* 7205 */ { MAD_F(0x043f2e6f) /* 0.265425145 */, 19 }, - /* 7206 */ { MAD_F(0x043f61f1) /* 0.265474264 */, 19 }, - /* 7207 */ { MAD_F(0x043f9573) /* 0.265523387 */, 19 }, - /* 7208 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 19 }, - /* 7209 */ { MAD_F(0x043ffc79) /* 0.265621638 */, 19 }, - /* 7210 */ { MAD_F(0x04402ffd) /* 0.265670766 */, 19 }, - /* 7211 */ { MAD_F(0x04406382) /* 0.265719898 */, 19 }, - /* 7212 */ { MAD_F(0x04409707) /* 0.265769031 */, 19 }, - /* 7213 */ { MAD_F(0x0440ca8d) /* 0.265818167 */, 19 }, - /* 7214 */ { MAD_F(0x0440fe13) /* 0.265867305 */, 19 }, - /* 7215 */ { MAD_F(0x0441319a) /* 0.265916445 */, 19 }, - - /* 7216 */ { MAD_F(0x04416522) /* 0.265965588 */, 19 }, - /* 7217 */ { MAD_F(0x044198aa) /* 0.266014732 */, 19 }, - /* 7218 */ { MAD_F(0x0441cc33) /* 0.266063880 */, 19 }, - /* 7219 */ { MAD_F(0x0441ffbc) /* 0.266113029 */, 19 }, - /* 7220 */ { MAD_F(0x04423346) /* 0.266162181 */, 19 }, - /* 7221 */ { MAD_F(0x044266d1) /* 0.266211334 */, 19 }, - /* 7222 */ { MAD_F(0x04429a5c) /* 0.266260491 */, 19 }, - /* 7223 */ { MAD_F(0x0442cde8) /* 0.266309649 */, 19 }, - /* 7224 */ { MAD_F(0x04430174) /* 0.266358810 */, 19 }, - /* 7225 */ { MAD_F(0x04433501) /* 0.266407973 */, 19 }, - /* 7226 */ { MAD_F(0x0443688f) /* 0.266457138 */, 19 }, - /* 7227 */ { MAD_F(0x04439c1d) /* 0.266506305 */, 19 }, - /* 7228 */ { MAD_F(0x0443cfac) /* 0.266555475 */, 19 }, - /* 7229 */ { MAD_F(0x0444033c) /* 0.266604647 */, 19 }, - /* 7230 */ { MAD_F(0x044436cc) /* 0.266653822 */, 19 }, - /* 7231 */ { MAD_F(0x04446a5d) /* 0.266702998 */, 19 }, - - /* 7232 */ { MAD_F(0x04449dee) /* 0.266752177 */, 19 }, - /* 7233 */ { MAD_F(0x0444d180) /* 0.266801358 */, 19 }, - /* 7234 */ { MAD_F(0x04450513) /* 0.266850541 */, 19 }, - /* 7235 */ { MAD_F(0x044538a6) /* 0.266899727 */, 19 }, - /* 7236 */ { MAD_F(0x04456c39) /* 0.266948915 */, 19 }, - /* 7237 */ { MAD_F(0x04459fce) /* 0.266998105 */, 19 }, - /* 7238 */ { MAD_F(0x0445d363) /* 0.267047298 */, 19 }, - /* 7239 */ { MAD_F(0x044606f8) /* 0.267096492 */, 19 }, - /* 7240 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 19 }, - /* 7241 */ { MAD_F(0x04466e25) /* 0.267194888 */, 19 }, - /* 7242 */ { MAD_F(0x0446a1bd) /* 0.267244090 */, 19 }, - /* 7243 */ { MAD_F(0x0446d555) /* 0.267293294 */, 19 }, - /* 7244 */ { MAD_F(0x044708ee) /* 0.267342500 */, 19 }, - /* 7245 */ { MAD_F(0x04473c87) /* 0.267391708 */, 19 }, - /* 7246 */ { MAD_F(0x04477021) /* 0.267440919 */, 19 }, - /* 7247 */ { MAD_F(0x0447a3bb) /* 0.267490131 */, 19 }, - - /* 7248 */ { MAD_F(0x0447d756) /* 0.267539347 */, 19 }, - /* 7249 */ { MAD_F(0x04480af2) /* 0.267588564 */, 19 }, - /* 7250 */ { MAD_F(0x04483e8e) /* 0.267637783 */, 19 }, - /* 7251 */ { MAD_F(0x0448722b) /* 0.267687005 */, 19 }, - /* 7252 */ { MAD_F(0x0448a5c9) /* 0.267736229 */, 19 }, - /* 7253 */ { MAD_F(0x0448d967) /* 0.267785456 */, 19 }, - /* 7254 */ { MAD_F(0x04490d05) /* 0.267834685 */, 19 }, - /* 7255 */ { MAD_F(0x044940a5) /* 0.267883915 */, 19 }, - /* 7256 */ { MAD_F(0x04497445) /* 0.267933149 */, 19 }, - /* 7257 */ { MAD_F(0x0449a7e5) /* 0.267982384 */, 19 }, - /* 7258 */ { MAD_F(0x0449db86) /* 0.268031622 */, 19 }, - /* 7259 */ { MAD_F(0x044a0f28) /* 0.268080862 */, 19 }, - /* 7260 */ { MAD_F(0x044a42ca) /* 0.268130104 */, 19 }, - /* 7261 */ { MAD_F(0x044a766d) /* 0.268179349 */, 19 }, - /* 7262 */ { MAD_F(0x044aaa11) /* 0.268228595 */, 19 }, - /* 7263 */ { MAD_F(0x044addb5) /* 0.268277844 */, 19 }, - - /* 7264 */ { MAD_F(0x044b115a) /* 0.268327096 */, 19 }, - /* 7265 */ { MAD_F(0x044b44ff) /* 0.268376349 */, 19 }, - /* 7266 */ { MAD_F(0x044b78a5) /* 0.268425605 */, 19 }, - /* 7267 */ { MAD_F(0x044bac4c) /* 0.268474863 */, 19 }, - /* 7268 */ { MAD_F(0x044bdff3) /* 0.268524123 */, 19 }, - /* 7269 */ { MAD_F(0x044c139b) /* 0.268573386 */, 19 }, - /* 7270 */ { MAD_F(0x044c4743) /* 0.268622651 */, 19 }, - /* 7271 */ { MAD_F(0x044c7aec) /* 0.268671918 */, 19 }, - /* 7272 */ { MAD_F(0x044cae96) /* 0.268721187 */, 19 }, - /* 7273 */ { MAD_F(0x044ce240) /* 0.268770459 */, 19 }, - /* 7274 */ { MAD_F(0x044d15eb) /* 0.268819733 */, 19 }, - /* 7275 */ { MAD_F(0x044d4997) /* 0.268869009 */, 19 }, - /* 7276 */ { MAD_F(0x044d7d43) /* 0.268918287 */, 19 }, - /* 7277 */ { MAD_F(0x044db0ef) /* 0.268967568 */, 19 }, - /* 7278 */ { MAD_F(0x044de49d) /* 0.269016851 */, 19 }, - /* 7279 */ { MAD_F(0x044e184b) /* 0.269066136 */, 19 }, - - /* 7280 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 19 }, - /* 7281 */ { MAD_F(0x044e7fa8) /* 0.269164713 */, 19 }, - /* 7282 */ { MAD_F(0x044eb358) /* 0.269214005 */, 19 }, - /* 7283 */ { MAD_F(0x044ee708) /* 0.269263299 */, 19 }, - /* 7284 */ { MAD_F(0x044f1ab9) /* 0.269312595 */, 19 }, - /* 7285 */ { MAD_F(0x044f4e6b) /* 0.269361894 */, 19 }, - /* 7286 */ { MAD_F(0x044f821d) /* 0.269411195 */, 19 }, - /* 7287 */ { MAD_F(0x044fb5cf) /* 0.269460498 */, 19 }, - /* 7288 */ { MAD_F(0x044fe983) /* 0.269509804 */, 19 }, - /* 7289 */ { MAD_F(0x04501d37) /* 0.269559111 */, 19 }, - /* 7290 */ { MAD_F(0x045050eb) /* 0.269608421 */, 19 }, - /* 7291 */ { MAD_F(0x045084a0) /* 0.269657734 */, 19 }, - /* 7292 */ { MAD_F(0x0450b856) /* 0.269707048 */, 19 }, - /* 7293 */ { MAD_F(0x0450ec0d) /* 0.269756365 */, 19 }, - /* 7294 */ { MAD_F(0x04511fc4) /* 0.269805684 */, 19 }, - /* 7295 */ { MAD_F(0x0451537b) /* 0.269855005 */, 19 }, - - /* 7296 */ { MAD_F(0x04518733) /* 0.269904329 */, 19 }, - /* 7297 */ { MAD_F(0x0451baec) /* 0.269953654 */, 19 }, - /* 7298 */ { MAD_F(0x0451eea5) /* 0.270002982 */, 19 }, - /* 7299 */ { MAD_F(0x0452225f) /* 0.270052313 */, 19 }, - /* 7300 */ { MAD_F(0x0452561a) /* 0.270101645 */, 19 }, - /* 7301 */ { MAD_F(0x045289d5) /* 0.270150980 */, 19 }, - /* 7302 */ { MAD_F(0x0452bd91) /* 0.270200317 */, 19 }, - /* 7303 */ { MAD_F(0x0452f14d) /* 0.270249656 */, 19 }, - /* 7304 */ { MAD_F(0x0453250a) /* 0.270298998 */, 19 }, - /* 7305 */ { MAD_F(0x045358c8) /* 0.270348341 */, 19 }, - /* 7306 */ { MAD_F(0x04538c86) /* 0.270397687 */, 19 }, - /* 7307 */ { MAD_F(0x0453c045) /* 0.270447036 */, 19 }, - /* 7308 */ { MAD_F(0x0453f405) /* 0.270496386 */, 19 }, - /* 7309 */ { MAD_F(0x045427c5) /* 0.270545739 */, 19 }, - /* 7310 */ { MAD_F(0x04545b85) /* 0.270595094 */, 19 }, - /* 7311 */ { MAD_F(0x04548f46) /* 0.270644451 */, 19 }, - - /* 7312 */ { MAD_F(0x0454c308) /* 0.270693811 */, 19 }, - /* 7313 */ { MAD_F(0x0454f6cb) /* 0.270743173 */, 19 }, - /* 7314 */ { MAD_F(0x04552a8e) /* 0.270792537 */, 19 }, - /* 7315 */ { MAD_F(0x04555e51) /* 0.270841903 */, 19 }, - /* 7316 */ { MAD_F(0x04559216) /* 0.270891271 */, 19 }, - /* 7317 */ { MAD_F(0x0455c5db) /* 0.270940642 */, 19 }, - /* 7318 */ { MAD_F(0x0455f9a0) /* 0.270990015 */, 19 }, - /* 7319 */ { MAD_F(0x04562d66) /* 0.271039390 */, 19 }, - /* 7320 */ { MAD_F(0x0456612d) /* 0.271088768 */, 19 }, - /* 7321 */ { MAD_F(0x045694f4) /* 0.271138148 */, 19 }, - /* 7322 */ { MAD_F(0x0456c8bc) /* 0.271187530 */, 19 }, - /* 7323 */ { MAD_F(0x0456fc84) /* 0.271236914 */, 19 }, - /* 7324 */ { MAD_F(0x0457304e) /* 0.271286301 */, 19 }, - /* 7325 */ { MAD_F(0x04576417) /* 0.271335689 */, 19 }, - /* 7326 */ { MAD_F(0x045797e2) /* 0.271385080 */, 19 }, - /* 7327 */ { MAD_F(0x0457cbac) /* 0.271434474 */, 19 }, - - /* 7328 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 19 }, - /* 7329 */ { MAD_F(0x04583344) /* 0.271533267 */, 19 }, - /* 7330 */ { MAD_F(0x04586711) /* 0.271582667 */, 19 }, - /* 7331 */ { MAD_F(0x04589ade) /* 0.271632069 */, 19 }, - /* 7332 */ { MAD_F(0x0458ceac) /* 0.271681474 */, 19 }, - /* 7333 */ { MAD_F(0x0459027b) /* 0.271730880 */, 19 }, - /* 7334 */ { MAD_F(0x0459364a) /* 0.271780289 */, 19 }, - /* 7335 */ { MAD_F(0x04596a19) /* 0.271829701 */, 19 }, - /* 7336 */ { MAD_F(0x04599dea) /* 0.271879114 */, 19 }, - /* 7337 */ { MAD_F(0x0459d1bb) /* 0.271928530 */, 19 }, - /* 7338 */ { MAD_F(0x045a058c) /* 0.271977948 */, 19 }, - /* 7339 */ { MAD_F(0x045a395e) /* 0.272027368 */, 19 }, - /* 7340 */ { MAD_F(0x045a6d31) /* 0.272076790 */, 19 }, - /* 7341 */ { MAD_F(0x045aa104) /* 0.272126215 */, 19 }, - /* 7342 */ { MAD_F(0x045ad4d8) /* 0.272175642 */, 19 }, - /* 7343 */ { MAD_F(0x045b08ad) /* 0.272225071 */, 19 }, - - /* 7344 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 19 }, - /* 7345 */ { MAD_F(0x045b7058) /* 0.272323936 */, 19 }, - /* 7346 */ { MAD_F(0x045ba42e) /* 0.272373372 */, 19 }, - /* 7347 */ { MAD_F(0x045bd805) /* 0.272422810 */, 19 }, - /* 7348 */ { MAD_F(0x045c0bdd) /* 0.272472251 */, 19 }, - /* 7349 */ { MAD_F(0x045c3fb5) /* 0.272521693 */, 19 }, - /* 7350 */ { MAD_F(0x045c738e) /* 0.272571138 */, 19 }, - /* 7351 */ { MAD_F(0x045ca767) /* 0.272620585 */, 19 }, - /* 7352 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 19 }, - /* 7353 */ { MAD_F(0x045d0f1b) /* 0.272719486 */, 19 }, - /* 7354 */ { MAD_F(0x045d42f7) /* 0.272768940 */, 19 }, - /* 7355 */ { MAD_F(0x045d76d2) /* 0.272818396 */, 19 }, - /* 7356 */ { MAD_F(0x045daaaf) /* 0.272867855 */, 19 }, - /* 7357 */ { MAD_F(0x045dde8c) /* 0.272917315 */, 19 }, - /* 7358 */ { MAD_F(0x045e1269) /* 0.272966778 */, 19 }, - /* 7359 */ { MAD_F(0x045e4647) /* 0.273016243 */, 19 }, - - /* 7360 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 19 }, - /* 7361 */ { MAD_F(0x045eae06) /* 0.273115180 */, 19 }, - /* 7362 */ { MAD_F(0x045ee1e6) /* 0.273164652 */, 19 }, - /* 7363 */ { MAD_F(0x045f15c6) /* 0.273214126 */, 19 }, - /* 7364 */ { MAD_F(0x045f49a7) /* 0.273263602 */, 19 }, - /* 7365 */ { MAD_F(0x045f7d89) /* 0.273313081 */, 19 }, - /* 7366 */ { MAD_F(0x045fb16c) /* 0.273362561 */, 19 }, - /* 7367 */ { MAD_F(0x045fe54f) /* 0.273412044 */, 19 }, - /* 7368 */ { MAD_F(0x04601932) /* 0.273461530 */, 19 }, - /* 7369 */ { MAD_F(0x04604d16) /* 0.273511017 */, 19 }, - /* 7370 */ { MAD_F(0x046080fb) /* 0.273560507 */, 19 }, - /* 7371 */ { MAD_F(0x0460b4e1) /* 0.273609999 */, 19 }, - /* 7372 */ { MAD_F(0x0460e8c7) /* 0.273659493 */, 19 }, - /* 7373 */ { MAD_F(0x04611cad) /* 0.273708989 */, 19 }, - /* 7374 */ { MAD_F(0x04615094) /* 0.273758488 */, 19 }, - /* 7375 */ { MAD_F(0x0461847c) /* 0.273807989 */, 19 }, - - /* 7376 */ { MAD_F(0x0461b864) /* 0.273857492 */, 19 }, - /* 7377 */ { MAD_F(0x0461ec4d) /* 0.273906997 */, 19 }, - /* 7378 */ { MAD_F(0x04622037) /* 0.273956505 */, 19 }, - /* 7379 */ { MAD_F(0x04625421) /* 0.274006015 */, 19 }, - /* 7380 */ { MAD_F(0x0462880c) /* 0.274055527 */, 19 }, - /* 7381 */ { MAD_F(0x0462bbf7) /* 0.274105041 */, 19 }, - /* 7382 */ { MAD_F(0x0462efe3) /* 0.274154558 */, 19 }, - /* 7383 */ { MAD_F(0x046323d0) /* 0.274204076 */, 19 }, - /* 7384 */ { MAD_F(0x046357bd) /* 0.274253597 */, 19 }, - /* 7385 */ { MAD_F(0x04638bab) /* 0.274303121 */, 19 }, - /* 7386 */ { MAD_F(0x0463bf99) /* 0.274352646 */, 19 }, - /* 7387 */ { MAD_F(0x0463f388) /* 0.274402174 */, 19 }, - /* 7388 */ { MAD_F(0x04642778) /* 0.274451704 */, 19 }, - /* 7389 */ { MAD_F(0x04645b68) /* 0.274501236 */, 19 }, - /* 7390 */ { MAD_F(0x04648f59) /* 0.274550771 */, 19 }, - /* 7391 */ { MAD_F(0x0464c34a) /* 0.274600307 */, 19 }, - - /* 7392 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 19 }, - /* 7393 */ { MAD_F(0x04652b2f) /* 0.274699387 */, 19 }, - /* 7394 */ { MAD_F(0x04655f22) /* 0.274748931 */, 19 }, - /* 7395 */ { MAD_F(0x04659316) /* 0.274798476 */, 19 }, - /* 7396 */ { MAD_F(0x0465c70a) /* 0.274848024 */, 19 }, - /* 7397 */ { MAD_F(0x0465faff) /* 0.274897574 */, 19 }, - /* 7398 */ { MAD_F(0x04662ef5) /* 0.274947126 */, 19 }, - /* 7399 */ { MAD_F(0x046662eb) /* 0.274996681 */, 19 }, - /* 7400 */ { MAD_F(0x046696e2) /* 0.275046238 */, 19 }, - /* 7401 */ { MAD_F(0x0466cad9) /* 0.275095797 */, 19 }, - /* 7402 */ { MAD_F(0x0466fed1) /* 0.275145358 */, 19 }, - /* 7403 */ { MAD_F(0x046732ca) /* 0.275194921 */, 19 }, - /* 7404 */ { MAD_F(0x046766c3) /* 0.275244487 */, 19 }, - /* 7405 */ { MAD_F(0x04679abd) /* 0.275294055 */, 19 }, - /* 7406 */ { MAD_F(0x0467ceb7) /* 0.275343625 */, 19 }, - /* 7407 */ { MAD_F(0x046802b2) /* 0.275393198 */, 19 }, - - /* 7408 */ { MAD_F(0x046836ae) /* 0.275442772 */, 19 }, - /* 7409 */ { MAD_F(0x04686aaa) /* 0.275492349 */, 19 }, - /* 7410 */ { MAD_F(0x04689ea7) /* 0.275541928 */, 19 }, - /* 7411 */ { MAD_F(0x0468d2a4) /* 0.275591509 */, 19 }, - /* 7412 */ { MAD_F(0x046906a2) /* 0.275641093 */, 19 }, - /* 7413 */ { MAD_F(0x04693aa1) /* 0.275690679 */, 19 }, - /* 7414 */ { MAD_F(0x04696ea0) /* 0.275740267 */, 19 }, - /* 7415 */ { MAD_F(0x0469a2a0) /* 0.275789857 */, 19 }, - /* 7416 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 19 }, - /* 7417 */ { MAD_F(0x046a0aa1) /* 0.275889044 */, 19 }, - /* 7418 */ { MAD_F(0x046a3ea3) /* 0.275938641 */, 19 }, - /* 7419 */ { MAD_F(0x046a72a5) /* 0.275988240 */, 19 }, - /* 7420 */ { MAD_F(0x046aa6a8) /* 0.276037842 */, 19 }, - /* 7421 */ { MAD_F(0x046adaab) /* 0.276087445 */, 19 }, - /* 7422 */ { MAD_F(0x046b0eaf) /* 0.276137051 */, 19 }, - /* 7423 */ { MAD_F(0x046b42b3) /* 0.276186659 */, 19 }, - - /* 7424 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 19 }, - /* 7425 */ { MAD_F(0x046baabe) /* 0.276285882 */, 19 }, - /* 7426 */ { MAD_F(0x046bdec5) /* 0.276335497 */, 19 }, - /* 7427 */ { MAD_F(0x046c12cc) /* 0.276385113 */, 19 }, - /* 7428 */ { MAD_F(0x046c46d3) /* 0.276434733 */, 19 }, - /* 7429 */ { MAD_F(0x046c7adb) /* 0.276484354 */, 19 }, - /* 7430 */ { MAD_F(0x046caee4) /* 0.276533978 */, 19 }, - /* 7431 */ { MAD_F(0x046ce2ee) /* 0.276583604 */, 19 }, - /* 7432 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 19 }, - /* 7433 */ { MAD_F(0x046d4b02) /* 0.276682862 */, 19 }, - /* 7434 */ { MAD_F(0x046d7f0d) /* 0.276732495 */, 19 }, - /* 7435 */ { MAD_F(0x046db319) /* 0.276782129 */, 19 }, - /* 7436 */ { MAD_F(0x046de725) /* 0.276831766 */, 19 }, - /* 7437 */ { MAD_F(0x046e1b32) /* 0.276881406 */, 19 }, - /* 7438 */ { MAD_F(0x046e4f40) /* 0.276931047 */, 19 }, - /* 7439 */ { MAD_F(0x046e834e) /* 0.276980691 */, 19 }, - - /* 7440 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 19 }, - /* 7441 */ { MAD_F(0x046eeb6c) /* 0.277079985 */, 19 }, - /* 7442 */ { MAD_F(0x046f1f7c) /* 0.277129635 */, 19 }, - /* 7443 */ { MAD_F(0x046f538c) /* 0.277179288 */, 19 }, - /* 7444 */ { MAD_F(0x046f879d) /* 0.277228942 */, 19 }, - /* 7445 */ { MAD_F(0x046fbbaf) /* 0.277278600 */, 19 }, - /* 7446 */ { MAD_F(0x046fefc1) /* 0.277328259 */, 19 }, - /* 7447 */ { MAD_F(0x047023d4) /* 0.277377920 */, 19 }, - /* 7448 */ { MAD_F(0x047057e8) /* 0.277427584 */, 19 }, - /* 7449 */ { MAD_F(0x04708bfc) /* 0.277477250 */, 19 }, - /* 7450 */ { MAD_F(0x0470c011) /* 0.277526918 */, 19 }, - /* 7451 */ { MAD_F(0x0470f426) /* 0.277576588 */, 19 }, - /* 7452 */ { MAD_F(0x0471283c) /* 0.277626261 */, 19 }, - /* 7453 */ { MAD_F(0x04715c52) /* 0.277675936 */, 19 }, - /* 7454 */ { MAD_F(0x04719069) /* 0.277725613 */, 19 }, - /* 7455 */ { MAD_F(0x0471c481) /* 0.277775292 */, 19 }, - - /* 7456 */ { MAD_F(0x0471f899) /* 0.277824973 */, 19 }, - /* 7457 */ { MAD_F(0x04722cb2) /* 0.277874657 */, 19 }, - /* 7458 */ { MAD_F(0x047260cc) /* 0.277924343 */, 19 }, - /* 7459 */ { MAD_F(0x047294e6) /* 0.277974031 */, 19 }, - /* 7460 */ { MAD_F(0x0472c900) /* 0.278023722 */, 19 }, - /* 7461 */ { MAD_F(0x0472fd1b) /* 0.278073414 */, 19 }, - /* 7462 */ { MAD_F(0x04733137) /* 0.278123109 */, 19 }, - /* 7463 */ { MAD_F(0x04736554) /* 0.278172806 */, 19 }, - /* 7464 */ { MAD_F(0x04739971) /* 0.278222505 */, 19 }, - /* 7465 */ { MAD_F(0x0473cd8e) /* 0.278272207 */, 19 }, - /* 7466 */ { MAD_F(0x047401ad) /* 0.278321910 */, 19 }, - /* 7467 */ { MAD_F(0x047435cb) /* 0.278371616 */, 19 }, - /* 7468 */ { MAD_F(0x047469eb) /* 0.278421324 */, 19 }, - /* 7469 */ { MAD_F(0x04749e0b) /* 0.278471035 */, 19 }, - /* 7470 */ { MAD_F(0x0474d22c) /* 0.278520747 */, 19 }, - /* 7471 */ { MAD_F(0x0475064d) /* 0.278570462 */, 19 }, - - /* 7472 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 19 }, - /* 7473 */ { MAD_F(0x04756e91) /* 0.278669898 */, 19 }, - /* 7474 */ { MAD_F(0x0475a2b4) /* 0.278719619 */, 19 }, - /* 7475 */ { MAD_F(0x0475d6d7) /* 0.278769343 */, 19 }, - /* 7476 */ { MAD_F(0x04760afc) /* 0.278819069 */, 19 }, - /* 7477 */ { MAD_F(0x04763f20) /* 0.278868797 */, 19 }, - /* 7478 */ { MAD_F(0x04767346) /* 0.278918527 */, 19 }, - /* 7479 */ { MAD_F(0x0476a76c) /* 0.278968260 */, 19 }, - /* 7480 */ { MAD_F(0x0476db92) /* 0.279017995 */, 19 }, - /* 7481 */ { MAD_F(0x04770fba) /* 0.279067731 */, 19 }, - /* 7482 */ { MAD_F(0x047743e1) /* 0.279117471 */, 19 }, - /* 7483 */ { MAD_F(0x0477780a) /* 0.279167212 */, 19 }, - /* 7484 */ { MAD_F(0x0477ac33) /* 0.279216956 */, 19 }, - /* 7485 */ { MAD_F(0x0477e05c) /* 0.279266701 */, 19 }, - /* 7486 */ { MAD_F(0x04781486) /* 0.279316449 */, 19 }, - /* 7487 */ { MAD_F(0x047848b1) /* 0.279366200 */, 19 }, - - /* 7488 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 19 }, - /* 7489 */ { MAD_F(0x0478b108) /* 0.279465707 */, 19 }, - /* 7490 */ { MAD_F(0x0478e535) /* 0.279515464 */, 19 }, - /* 7491 */ { MAD_F(0x04791962) /* 0.279565223 */, 19 }, - /* 7492 */ { MAD_F(0x04794d8f) /* 0.279614984 */, 19 }, - /* 7493 */ { MAD_F(0x047981be) /* 0.279664748 */, 19 }, - /* 7494 */ { MAD_F(0x0479b5ed) /* 0.279714513 */, 19 }, - /* 7495 */ { MAD_F(0x0479ea1c) /* 0.279764281 */, 19 }, - /* 7496 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 19 }, - /* 7497 */ { MAD_F(0x047a527d) /* 0.279863824 */, 19 }, - /* 7498 */ { MAD_F(0x047a86ae) /* 0.279913598 */, 19 }, - /* 7499 */ { MAD_F(0x047abae0) /* 0.279963375 */, 19 }, - /* 7500 */ { MAD_F(0x047aef12) /* 0.280013154 */, 19 }, - /* 7501 */ { MAD_F(0x047b2346) /* 0.280062935 */, 19 }, - /* 7502 */ { MAD_F(0x047b5779) /* 0.280112719 */, 19 }, - /* 7503 */ { MAD_F(0x047b8bad) /* 0.280162504 */, 19 }, - - /* 7504 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 19 }, - /* 7505 */ { MAD_F(0x047bf418) /* 0.280262082 */, 19 }, - /* 7506 */ { MAD_F(0x047c284e) /* 0.280311875 */, 19 }, - /* 7507 */ { MAD_F(0x047c5c84) /* 0.280361669 */, 19 }, - /* 7508 */ { MAD_F(0x047c90bb) /* 0.280411466 */, 19 }, - /* 7509 */ { MAD_F(0x047cc4f3) /* 0.280461265 */, 19 }, - /* 7510 */ { MAD_F(0x047cf92c) /* 0.280511066 */, 19 }, - /* 7511 */ { MAD_F(0x047d2d65) /* 0.280560869 */, 19 }, - /* 7512 */ { MAD_F(0x047d619e) /* 0.280610675 */, 19 }, - /* 7513 */ { MAD_F(0x047d95d8) /* 0.280660483 */, 19 }, - /* 7514 */ { MAD_F(0x047dca13) /* 0.280710292 */, 19 }, - /* 7515 */ { MAD_F(0x047dfe4e) /* 0.280760105 */, 19 }, - /* 7516 */ { MAD_F(0x047e328a) /* 0.280809919 */, 19 }, - /* 7517 */ { MAD_F(0x047e66c7) /* 0.280859736 */, 19 }, - /* 7518 */ { MAD_F(0x047e9b04) /* 0.280909554 */, 19 }, - /* 7519 */ { MAD_F(0x047ecf42) /* 0.280959375 */, 19 }, - - /* 7520 */ { MAD_F(0x047f0380) /* 0.281009199 */, 19 }, - /* 7521 */ { MAD_F(0x047f37bf) /* 0.281059024 */, 19 }, - /* 7522 */ { MAD_F(0x047f6bff) /* 0.281108852 */, 19 }, - /* 7523 */ { MAD_F(0x047fa03f) /* 0.281158682 */, 19 }, - /* 7524 */ { MAD_F(0x047fd47f) /* 0.281208514 */, 19 }, - /* 7525 */ { MAD_F(0x048008c1) /* 0.281258348 */, 19 }, - /* 7526 */ { MAD_F(0x04803d02) /* 0.281308184 */, 19 }, - /* 7527 */ { MAD_F(0x04807145) /* 0.281358023 */, 19 }, - /* 7528 */ { MAD_F(0x0480a588) /* 0.281407864 */, 19 }, - /* 7529 */ { MAD_F(0x0480d9cc) /* 0.281457707 */, 19 }, - /* 7530 */ { MAD_F(0x04810e10) /* 0.281507552 */, 19 }, - /* 7531 */ { MAD_F(0x04814255) /* 0.281557400 */, 19 }, - /* 7532 */ { MAD_F(0x0481769a) /* 0.281607250 */, 19 }, - /* 7533 */ { MAD_F(0x0481aae0) /* 0.281657101 */, 19 }, - /* 7534 */ { MAD_F(0x0481df27) /* 0.281706956 */, 19 }, - /* 7535 */ { MAD_F(0x0482136e) /* 0.281756812 */, 19 }, - - /* 7536 */ { MAD_F(0x048247b6) /* 0.281806670 */, 19 }, - /* 7537 */ { MAD_F(0x04827bfe) /* 0.281856531 */, 19 }, - /* 7538 */ { MAD_F(0x0482b047) /* 0.281906394 */, 19 }, - /* 7539 */ { MAD_F(0x0482e491) /* 0.281956259 */, 19 }, - /* 7540 */ { MAD_F(0x048318db) /* 0.282006127 */, 19 }, - /* 7541 */ { MAD_F(0x04834d26) /* 0.282055996 */, 19 }, - /* 7542 */ { MAD_F(0x04838171) /* 0.282105868 */, 19 }, - /* 7543 */ { MAD_F(0x0483b5bd) /* 0.282155742 */, 19 }, - /* 7544 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 19 }, - /* 7545 */ { MAD_F(0x04841e57) /* 0.282255496 */, 19 }, - /* 7546 */ { MAD_F(0x048452a4) /* 0.282305377 */, 19 }, - /* 7547 */ { MAD_F(0x048486f3) /* 0.282355260 */, 19 }, - /* 7548 */ { MAD_F(0x0484bb42) /* 0.282405145 */, 19 }, - /* 7549 */ { MAD_F(0x0484ef91) /* 0.282455032 */, 19 }, - /* 7550 */ { MAD_F(0x048523e1) /* 0.282504921 */, 19 }, - /* 7551 */ { MAD_F(0x04855832) /* 0.282554813 */, 19 }, - - /* 7552 */ { MAD_F(0x04858c83) /* 0.282604707 */, 19 }, - /* 7553 */ { MAD_F(0x0485c0d5) /* 0.282654603 */, 19 }, - /* 7554 */ { MAD_F(0x0485f527) /* 0.282704501 */, 19 }, - /* 7555 */ { MAD_F(0x0486297a) /* 0.282754401 */, 19 }, - /* 7556 */ { MAD_F(0x04865dce) /* 0.282804304 */, 19 }, - /* 7557 */ { MAD_F(0x04869222) /* 0.282854209 */, 19 }, - /* 7558 */ { MAD_F(0x0486c677) /* 0.282904116 */, 19 }, - /* 7559 */ { MAD_F(0x0486facc) /* 0.282954025 */, 19 }, - /* 7560 */ { MAD_F(0x04872f22) /* 0.283003936 */, 19 }, - /* 7561 */ { MAD_F(0x04876379) /* 0.283053850 */, 19 }, - /* 7562 */ { MAD_F(0x048797d0) /* 0.283103766 */, 19 }, - /* 7563 */ { MAD_F(0x0487cc28) /* 0.283153684 */, 19 }, - /* 7564 */ { MAD_F(0x04880080) /* 0.283203604 */, 19 }, - /* 7565 */ { MAD_F(0x048834d9) /* 0.283253527 */, 19 }, - /* 7566 */ { MAD_F(0x04886933) /* 0.283303451 */, 19 }, - /* 7567 */ { MAD_F(0x04889d8d) /* 0.283353378 */, 19 }, - - /* 7568 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 19 }, - /* 7569 */ { MAD_F(0x04890643) /* 0.283453238 */, 19 }, - /* 7570 */ { MAD_F(0x04893a9f) /* 0.283503172 */, 19 }, - /* 7571 */ { MAD_F(0x04896efb) /* 0.283553107 */, 19 }, - /* 7572 */ { MAD_F(0x0489a358) /* 0.283603045 */, 19 }, - /* 7573 */ { MAD_F(0x0489d7b6) /* 0.283652985 */, 19 }, - /* 7574 */ { MAD_F(0x048a0c14) /* 0.283702927 */, 19 }, - /* 7575 */ { MAD_F(0x048a4073) /* 0.283752872 */, 19 }, - /* 7576 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 19 }, - /* 7577 */ { MAD_F(0x048aa933) /* 0.283852767 */, 19 }, - /* 7578 */ { MAD_F(0x048add93) /* 0.283902718 */, 19 }, - /* 7579 */ { MAD_F(0x048b11f5) /* 0.283952671 */, 19 }, - /* 7580 */ { MAD_F(0x048b4656) /* 0.284002627 */, 19 }, - /* 7581 */ { MAD_F(0x048b7ab9) /* 0.284052584 */, 19 }, - /* 7582 */ { MAD_F(0x048baf1c) /* 0.284102544 */, 19 }, - /* 7583 */ { MAD_F(0x048be37f) /* 0.284152506 */, 19 }, - - /* 7584 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 19 }, - /* 7585 */ { MAD_F(0x048c4c48) /* 0.284252436 */, 19 }, - /* 7586 */ { MAD_F(0x048c80ad) /* 0.284302405 */, 19 }, - /* 7587 */ { MAD_F(0x048cb513) /* 0.284352376 */, 19 }, - /* 7588 */ { MAD_F(0x048ce97a) /* 0.284402349 */, 19 }, - /* 7589 */ { MAD_F(0x048d1de1) /* 0.284452324 */, 19 }, - /* 7590 */ { MAD_F(0x048d5249) /* 0.284502301 */, 19 }, - /* 7591 */ { MAD_F(0x048d86b1) /* 0.284552281 */, 19 }, - /* 7592 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 19 }, - /* 7593 */ { MAD_F(0x048def83) /* 0.284652246 */, 19 }, - /* 7594 */ { MAD_F(0x048e23ed) /* 0.284702233 */, 19 }, - /* 7595 */ { MAD_F(0x048e5858) /* 0.284752221 */, 19 }, - /* 7596 */ { MAD_F(0x048e8cc3) /* 0.284802211 */, 19 }, - /* 7597 */ { MAD_F(0x048ec12f) /* 0.284852204 */, 19 }, - /* 7598 */ { MAD_F(0x048ef59b) /* 0.284902199 */, 19 }, - /* 7599 */ { MAD_F(0x048f2a08) /* 0.284952196 */, 19 }, - - /* 7600 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 19 }, - /* 7601 */ { MAD_F(0x048f92e4) /* 0.285052197 */, 19 }, - /* 7602 */ { MAD_F(0x048fc753) /* 0.285102201 */, 19 }, - /* 7603 */ { MAD_F(0x048ffbc2) /* 0.285152206 */, 19 }, - /* 7604 */ { MAD_F(0x04903032) /* 0.285202214 */, 19 }, - /* 7605 */ { MAD_F(0x049064a3) /* 0.285252225 */, 19 }, - /* 7606 */ { MAD_F(0x04909914) /* 0.285302237 */, 19 }, - /* 7607 */ { MAD_F(0x0490cd86) /* 0.285352252 */, 19 }, - /* 7608 */ { MAD_F(0x049101f8) /* 0.285402269 */, 19 }, - /* 7609 */ { MAD_F(0x0491366b) /* 0.285452288 */, 19 }, - /* 7610 */ { MAD_F(0x04916ade) /* 0.285502309 */, 19 }, - /* 7611 */ { MAD_F(0x04919f52) /* 0.285552332 */, 19 }, - /* 7612 */ { MAD_F(0x0491d3c7) /* 0.285602358 */, 19 }, - /* 7613 */ { MAD_F(0x0492083c) /* 0.285652386 */, 19 }, - /* 7614 */ { MAD_F(0x04923cb2) /* 0.285702416 */, 19 }, - /* 7615 */ { MAD_F(0x04927128) /* 0.285752448 */, 19 }, - - /* 7616 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 19 }, - /* 7617 */ { MAD_F(0x0492da17) /* 0.285852519 */, 19 }, - /* 7618 */ { MAD_F(0x04930e8f) /* 0.285902557 */, 19 }, - /* 7619 */ { MAD_F(0x04934308) /* 0.285952598 */, 19 }, - /* 7620 */ { MAD_F(0x04937781) /* 0.286002641 */, 19 }, - /* 7621 */ { MAD_F(0x0493abfb) /* 0.286052687 */, 19 }, - /* 7622 */ { MAD_F(0x0493e076) /* 0.286102734 */, 19 }, - /* 7623 */ { MAD_F(0x049414f1) /* 0.286152784 */, 19 }, - /* 7624 */ { MAD_F(0x0494496c) /* 0.286202836 */, 19 }, - /* 7625 */ { MAD_F(0x04947de9) /* 0.286252890 */, 19 }, - /* 7626 */ { MAD_F(0x0494b266) /* 0.286302946 */, 19 }, - /* 7627 */ { MAD_F(0x0494e6e3) /* 0.286353005 */, 19 }, - /* 7628 */ { MAD_F(0x04951b61) /* 0.286403065 */, 19 }, - /* 7629 */ { MAD_F(0x04954fe0) /* 0.286453128 */, 19 }, - /* 7630 */ { MAD_F(0x0495845f) /* 0.286503193 */, 19 }, - /* 7631 */ { MAD_F(0x0495b8df) /* 0.286553260 */, 19 }, - - /* 7632 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 19 }, - /* 7633 */ { MAD_F(0x049621e0) /* 0.286653401 */, 19 }, - /* 7634 */ { MAD_F(0x04965662) /* 0.286703475 */, 19 }, - /* 7635 */ { MAD_F(0x04968ae4) /* 0.286753551 */, 19 }, - /* 7636 */ { MAD_F(0x0496bf67) /* 0.286803629 */, 19 }, - /* 7637 */ { MAD_F(0x0496f3ea) /* 0.286853709 */, 19 }, - /* 7638 */ { MAD_F(0x0497286e) /* 0.286903792 */, 19 }, - /* 7639 */ { MAD_F(0x04975cf2) /* 0.286953876 */, 19 }, - /* 7640 */ { MAD_F(0x04979177) /* 0.287003963 */, 19 }, - /* 7641 */ { MAD_F(0x0497c5fd) /* 0.287054052 */, 19 }, - /* 7642 */ { MAD_F(0x0497fa83) /* 0.287104143 */, 19 }, - /* 7643 */ { MAD_F(0x04982f0a) /* 0.287154237 */, 19 }, - /* 7644 */ { MAD_F(0x04986392) /* 0.287204332 */, 19 }, - /* 7645 */ { MAD_F(0x0498981a) /* 0.287254430 */, 19 }, - /* 7646 */ { MAD_F(0x0498cca2) /* 0.287304530 */, 19 }, - /* 7647 */ { MAD_F(0x0499012c) /* 0.287354632 */, 19 }, - - /* 7648 */ { MAD_F(0x049935b5) /* 0.287404737 */, 19 }, - /* 7649 */ { MAD_F(0x04996a40) /* 0.287454843 */, 19 }, - /* 7650 */ { MAD_F(0x04999ecb) /* 0.287504952 */, 19 }, - /* 7651 */ { MAD_F(0x0499d356) /* 0.287555063 */, 19 }, - /* 7652 */ { MAD_F(0x049a07e2) /* 0.287605176 */, 19 }, - /* 7653 */ { MAD_F(0x049a3c6f) /* 0.287655291 */, 19 }, - /* 7654 */ { MAD_F(0x049a70fc) /* 0.287705409 */, 19 }, - /* 7655 */ { MAD_F(0x049aa58a) /* 0.287755528 */, 19 }, - /* 7656 */ { MAD_F(0x049ada19) /* 0.287805650 */, 19 }, - /* 7657 */ { MAD_F(0x049b0ea8) /* 0.287855774 */, 19 }, - /* 7658 */ { MAD_F(0x049b4337) /* 0.287905900 */, 19 }, - /* 7659 */ { MAD_F(0x049b77c8) /* 0.287956028 */, 19 }, - /* 7660 */ { MAD_F(0x049bac58) /* 0.288006159 */, 19 }, - /* 7661 */ { MAD_F(0x049be0ea) /* 0.288056292 */, 19 }, - /* 7662 */ { MAD_F(0x049c157c) /* 0.288106427 */, 19 }, - /* 7663 */ { MAD_F(0x049c4a0e) /* 0.288156564 */, 19 }, - - /* 7664 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 19 }, - /* 7665 */ { MAD_F(0x049cb335) /* 0.288256844 */, 19 }, - /* 7666 */ { MAD_F(0x049ce7ca) /* 0.288306988 */, 19 }, - /* 7667 */ { MAD_F(0x049d1c5e) /* 0.288357134 */, 19 }, - /* 7668 */ { MAD_F(0x049d50f4) /* 0.288407282 */, 19 }, - /* 7669 */ { MAD_F(0x049d858a) /* 0.288457432 */, 19 }, - /* 7670 */ { MAD_F(0x049dba21) /* 0.288507584 */, 19 }, - /* 7671 */ { MAD_F(0x049deeb8) /* 0.288557739 */, 19 }, - /* 7672 */ { MAD_F(0x049e2350) /* 0.288607895 */, 19 }, - /* 7673 */ { MAD_F(0x049e57e8) /* 0.288658054 */, 19 }, - /* 7674 */ { MAD_F(0x049e8c81) /* 0.288708215 */, 19 }, - /* 7675 */ { MAD_F(0x049ec11b) /* 0.288758379 */, 19 }, - /* 7676 */ { MAD_F(0x049ef5b5) /* 0.288808544 */, 19 }, - /* 7677 */ { MAD_F(0x049f2a50) /* 0.288858712 */, 19 }, - /* 7678 */ { MAD_F(0x049f5eeb) /* 0.288908881 */, 19 }, - /* 7679 */ { MAD_F(0x049f9387) /* 0.288959053 */, 19 }, - - /* 7680 */ { MAD_F(0x049fc824) /* 0.289009227 */, 19 }, - /* 7681 */ { MAD_F(0x049ffcc1) /* 0.289059404 */, 19 }, - /* 7682 */ { MAD_F(0x04a0315e) /* 0.289109582 */, 19 }, - /* 7683 */ { MAD_F(0x04a065fd) /* 0.289159763 */, 19 }, - /* 7684 */ { MAD_F(0x04a09a9b) /* 0.289209946 */, 19 }, - /* 7685 */ { MAD_F(0x04a0cf3b) /* 0.289260131 */, 19 }, - /* 7686 */ { MAD_F(0x04a103db) /* 0.289310318 */, 19 }, - /* 7687 */ { MAD_F(0x04a1387b) /* 0.289360507 */, 19 }, - /* 7688 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 19 }, - /* 7689 */ { MAD_F(0x04a1a1be) /* 0.289460893 */, 19 }, - /* 7690 */ { MAD_F(0x04a1d661) /* 0.289511088 */, 19 }, - /* 7691 */ { MAD_F(0x04a20b04) /* 0.289561287 */, 19 }, - /* 7692 */ { MAD_F(0x04a23fa7) /* 0.289611487 */, 19 }, - /* 7693 */ { MAD_F(0x04a2744b) /* 0.289661689 */, 19 }, - /* 7694 */ { MAD_F(0x04a2a8f0) /* 0.289711894 */, 19 }, - /* 7695 */ { MAD_F(0x04a2dd95) /* 0.289762101 */, 19 }, - - /* 7696 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 19 }, - /* 7697 */ { MAD_F(0x04a346e2) /* 0.289862521 */, 19 }, - /* 7698 */ { MAD_F(0x04a37b89) /* 0.289912734 */, 19 }, - /* 7699 */ { MAD_F(0x04a3b030) /* 0.289962949 */, 19 }, - /* 7700 */ { MAD_F(0x04a3e4d8) /* 0.290013167 */, 19 }, - /* 7701 */ { MAD_F(0x04a41981) /* 0.290063387 */, 19 }, - /* 7702 */ { MAD_F(0x04a44e2b) /* 0.290113609 */, 19 }, - /* 7703 */ { MAD_F(0x04a482d5) /* 0.290163833 */, 19 }, - /* 7704 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 19 }, - /* 7705 */ { MAD_F(0x04a4ec2a) /* 0.290264288 */, 19 }, - /* 7706 */ { MAD_F(0x04a520d6) /* 0.290314519 */, 19 }, - /* 7707 */ { MAD_F(0x04a55582) /* 0.290364751 */, 19 }, - /* 7708 */ { MAD_F(0x04a58a2f) /* 0.290414986 */, 19 }, - /* 7709 */ { MAD_F(0x04a5bedd) /* 0.290465224 */, 19 }, - /* 7710 */ { MAD_F(0x04a5f38b) /* 0.290515463 */, 19 }, - /* 7711 */ { MAD_F(0x04a62839) /* 0.290565705 */, 19 }, - - /* 7712 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 19 }, - /* 7713 */ { MAD_F(0x04a69198) /* 0.290666194 */, 19 }, - /* 7714 */ { MAD_F(0x04a6c648) /* 0.290716442 */, 19 }, - /* 7715 */ { MAD_F(0x04a6faf9) /* 0.290766692 */, 19 }, - /* 7716 */ { MAD_F(0x04a72fab) /* 0.290816945 */, 19 }, - /* 7717 */ { MAD_F(0x04a7645d) /* 0.290867199 */, 19 }, - /* 7718 */ { MAD_F(0x04a79910) /* 0.290917456 */, 19 }, - /* 7719 */ { MAD_F(0x04a7cdc3) /* 0.290967715 */, 19 }, - /* 7720 */ { MAD_F(0x04a80277) /* 0.291017976 */, 19 }, - /* 7721 */ { MAD_F(0x04a8372b) /* 0.291068239 */, 19 }, - /* 7722 */ { MAD_F(0x04a86be0) /* 0.291118505 */, 19 }, - /* 7723 */ { MAD_F(0x04a8a096) /* 0.291168772 */, 19 }, - /* 7724 */ { MAD_F(0x04a8d54c) /* 0.291219042 */, 19 }, - /* 7725 */ { MAD_F(0x04a90a03) /* 0.291269314 */, 19 }, - /* 7726 */ { MAD_F(0x04a93eba) /* 0.291319588 */, 19 }, - /* 7727 */ { MAD_F(0x04a97372) /* 0.291369865 */, 19 }, - - /* 7728 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 19 }, - /* 7729 */ { MAD_F(0x04a9dce4) /* 0.291470424 */, 19 }, - /* 7730 */ { MAD_F(0x04aa119d) /* 0.291520706 */, 19 }, - /* 7731 */ { MAD_F(0x04aa4658) /* 0.291570991 */, 19 }, - /* 7732 */ { MAD_F(0x04aa7b13) /* 0.291621278 */, 19 }, - /* 7733 */ { MAD_F(0x04aaafce) /* 0.291671568 */, 19 }, - /* 7734 */ { MAD_F(0x04aae48a) /* 0.291721859 */, 19 }, - /* 7735 */ { MAD_F(0x04ab1947) /* 0.291772153 */, 19 }, - /* 7736 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 19 }, - /* 7737 */ { MAD_F(0x04ab82c2) /* 0.291872747 */, 19 }, - /* 7738 */ { MAD_F(0x04abb780) /* 0.291923047 */, 19 }, - /* 7739 */ { MAD_F(0x04abec3f) /* 0.291973349 */, 19 }, - /* 7740 */ { MAD_F(0x04ac20fe) /* 0.292023653 */, 19 }, - /* 7741 */ { MAD_F(0x04ac55be) /* 0.292073960 */, 19 }, - /* 7742 */ { MAD_F(0x04ac8a7f) /* 0.292124269 */, 19 }, - /* 7743 */ { MAD_F(0x04acbf40) /* 0.292174580 */, 19 }, - - /* 7744 */ { MAD_F(0x04acf402) /* 0.292224893 */, 19 }, - /* 7745 */ { MAD_F(0x04ad28c5) /* 0.292275208 */, 19 }, - /* 7746 */ { MAD_F(0x04ad5d88) /* 0.292325526 */, 19 }, - /* 7747 */ { MAD_F(0x04ad924b) /* 0.292375845 */, 19 }, - /* 7748 */ { MAD_F(0x04adc70f) /* 0.292426167 */, 19 }, - /* 7749 */ { MAD_F(0x04adfbd4) /* 0.292476491 */, 19 }, - /* 7750 */ { MAD_F(0x04ae3099) /* 0.292526817 */, 19 }, - /* 7751 */ { MAD_F(0x04ae655f) /* 0.292577145 */, 19 }, - /* 7752 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 19 }, - /* 7753 */ { MAD_F(0x04aeceed) /* 0.292677808 */, 19 }, - /* 7754 */ { MAD_F(0x04af03b4) /* 0.292728143 */, 19 }, - /* 7755 */ { MAD_F(0x04af387d) /* 0.292778480 */, 19 }, - /* 7756 */ { MAD_F(0x04af6d45) /* 0.292828819 */, 19 }, - /* 7757 */ { MAD_F(0x04afa20f) /* 0.292879160 */, 19 }, - /* 7758 */ { MAD_F(0x04afd6d9) /* 0.292929504 */, 19 }, - /* 7759 */ { MAD_F(0x04b00ba3) /* 0.292979849 */, 19 }, - - /* 7760 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 19 }, - /* 7761 */ { MAD_F(0x04b0753a) /* 0.293080547 */, 19 }, - /* 7762 */ { MAD_F(0x04b0aa06) /* 0.293130899 */, 19 }, - /* 7763 */ { MAD_F(0x04b0ded3) /* 0.293181253 */, 19 }, - /* 7764 */ { MAD_F(0x04b113a1) /* 0.293231610 */, 19 }, - /* 7765 */ { MAD_F(0x04b1486f) /* 0.293281968 */, 19 }, - /* 7766 */ { MAD_F(0x04b17d3d) /* 0.293332329 */, 19 }, - /* 7767 */ { MAD_F(0x04b1b20c) /* 0.293382692 */, 19 }, - /* 7768 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 19 }, - /* 7769 */ { MAD_F(0x04b21bad) /* 0.293483424 */, 19 }, - /* 7770 */ { MAD_F(0x04b2507d) /* 0.293533794 */, 19 }, - /* 7771 */ { MAD_F(0x04b2854f) /* 0.293584165 */, 19 }, - /* 7772 */ { MAD_F(0x04b2ba21) /* 0.293634539 */, 19 }, - /* 7773 */ { MAD_F(0x04b2eef4) /* 0.293684915 */, 19 }, - /* 7774 */ { MAD_F(0x04b323c7) /* 0.293735293 */, 19 }, - /* 7775 */ { MAD_F(0x04b3589b) /* 0.293785673 */, 19 }, - - /* 7776 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 19 }, - /* 7777 */ { MAD_F(0x04b3c244) /* 0.293886440 */, 19 }, - /* 7778 */ { MAD_F(0x04b3f71a) /* 0.293936826 */, 19 }, - /* 7779 */ { MAD_F(0x04b42bf0) /* 0.293987215 */, 19 }, - /* 7780 */ { MAD_F(0x04b460c7) /* 0.294037606 */, 19 }, - /* 7781 */ { MAD_F(0x04b4959e) /* 0.294087999 */, 19 }, - /* 7782 */ { MAD_F(0x04b4ca76) /* 0.294138395 */, 19 }, - /* 7783 */ { MAD_F(0x04b4ff4e) /* 0.294188792 */, 19 }, - /* 7784 */ { MAD_F(0x04b53427) /* 0.294239192 */, 19 }, - /* 7785 */ { MAD_F(0x04b56901) /* 0.294289593 */, 19 }, - /* 7786 */ { MAD_F(0x04b59ddb) /* 0.294339997 */, 19 }, - /* 7787 */ { MAD_F(0x04b5d2b6) /* 0.294390403 */, 19 }, - /* 7788 */ { MAD_F(0x04b60791) /* 0.294440812 */, 19 }, - /* 7789 */ { MAD_F(0x04b63c6d) /* 0.294491222 */, 19 }, - /* 7790 */ { MAD_F(0x04b6714a) /* 0.294541635 */, 19 }, - /* 7791 */ { MAD_F(0x04b6a627) /* 0.294592049 */, 19 }, - - /* 7792 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 19 }, - /* 7793 */ { MAD_F(0x04b70fe3) /* 0.294692885 */, 19 }, - /* 7794 */ { MAD_F(0x04b744c2) /* 0.294743306 */, 19 }, - /* 7795 */ { MAD_F(0x04b779a1) /* 0.294793730 */, 19 }, - /* 7796 */ { MAD_F(0x04b7ae81) /* 0.294844155 */, 19 }, - /* 7797 */ { MAD_F(0x04b7e362) /* 0.294894583 */, 19 }, - /* 7798 */ { MAD_F(0x04b81843) /* 0.294945013 */, 19 }, - /* 7799 */ { MAD_F(0x04b84d24) /* 0.294995445 */, 19 }, - /* 7800 */ { MAD_F(0x04b88207) /* 0.295045879 */, 19 }, - /* 7801 */ { MAD_F(0x04b8b6ea) /* 0.295096315 */, 19 }, - /* 7802 */ { MAD_F(0x04b8ebcd) /* 0.295146753 */, 19 }, - /* 7803 */ { MAD_F(0x04b920b1) /* 0.295197194 */, 19 }, - /* 7804 */ { MAD_F(0x04b95596) /* 0.295247637 */, 19 }, - /* 7805 */ { MAD_F(0x04b98a7b) /* 0.295298082 */, 19 }, - /* 7806 */ { MAD_F(0x04b9bf61) /* 0.295348529 */, 19 }, - /* 7807 */ { MAD_F(0x04b9f447) /* 0.295398978 */, 19 }, - - /* 7808 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 19 }, - /* 7809 */ { MAD_F(0x04ba5e16) /* 0.295499883 */, 19 }, - /* 7810 */ { MAD_F(0x04ba92fe) /* 0.295550338 */, 19 }, - /* 7811 */ { MAD_F(0x04bac7e6) /* 0.295600796 */, 19 }, - /* 7812 */ { MAD_F(0x04bafcd0) /* 0.295651256 */, 19 }, - /* 7813 */ { MAD_F(0x04bb31b9) /* 0.295701718 */, 19 }, - /* 7814 */ { MAD_F(0x04bb66a4) /* 0.295752183 */, 19 }, - /* 7815 */ { MAD_F(0x04bb9b8f) /* 0.295802649 */, 19 }, - /* 7816 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 19 }, - /* 7817 */ { MAD_F(0x04bc0566) /* 0.295903588 */, 19 }, - /* 7818 */ { MAD_F(0x04bc3a53) /* 0.295954061 */, 19 }, - /* 7819 */ { MAD_F(0x04bc6f40) /* 0.296004536 */, 19 }, - /* 7820 */ { MAD_F(0x04bca42e) /* 0.296055013 */, 19 }, - /* 7821 */ { MAD_F(0x04bcd91d) /* 0.296105493 */, 19 }, - /* 7822 */ { MAD_F(0x04bd0e0c) /* 0.296155974 */, 19 }, - /* 7823 */ { MAD_F(0x04bd42fb) /* 0.296206458 */, 19 }, - - /* 7824 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 19 }, - /* 7825 */ { MAD_F(0x04bdacdc) /* 0.296307432 */, 19 }, - /* 7826 */ { MAD_F(0x04bde1ce) /* 0.296357922 */, 19 }, - /* 7827 */ { MAD_F(0x04be16c0) /* 0.296408414 */, 19 }, - /* 7828 */ { MAD_F(0x04be4bb2) /* 0.296458908 */, 19 }, - /* 7829 */ { MAD_F(0x04be80a5) /* 0.296509405 */, 19 }, - /* 7830 */ { MAD_F(0x04beb599) /* 0.296559904 */, 19 }, - /* 7831 */ { MAD_F(0x04beea8d) /* 0.296610404 */, 19 }, - /* 7832 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 19 }, - /* 7833 */ { MAD_F(0x04bf5477) /* 0.296711413 */, 19 }, - /* 7834 */ { MAD_F(0x04bf896d) /* 0.296761920 */, 19 }, - /* 7835 */ { MAD_F(0x04bfbe64) /* 0.296812429 */, 19 }, - /* 7836 */ { MAD_F(0x04bff35b) /* 0.296862941 */, 19 }, - /* 7837 */ { MAD_F(0x04c02852) /* 0.296913455 */, 19 }, - /* 7838 */ { MAD_F(0x04c05d4b) /* 0.296963971 */, 19 }, - /* 7839 */ { MAD_F(0x04c09243) /* 0.297014489 */, 19 }, - - /* 7840 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 19 }, - /* 7841 */ { MAD_F(0x04c0fc37) /* 0.297115531 */, 19 }, - /* 7842 */ { MAD_F(0x04c13131) /* 0.297166056 */, 19 }, - /* 7843 */ { MAD_F(0x04c1662d) /* 0.297216582 */, 19 }, - /* 7844 */ { MAD_F(0x04c19b28) /* 0.297267111 */, 19 }, - /* 7845 */ { MAD_F(0x04c1d025) /* 0.297317642 */, 19 }, - /* 7846 */ { MAD_F(0x04c20521) /* 0.297368175 */, 19 }, - /* 7847 */ { MAD_F(0x04c23a1f) /* 0.297418710 */, 19 }, - /* 7848 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 19 }, - /* 7849 */ { MAD_F(0x04c2a41b) /* 0.297519787 */, 19 }, - /* 7850 */ { MAD_F(0x04c2d91b) /* 0.297570329 */, 19 }, - /* 7851 */ { MAD_F(0x04c30e1a) /* 0.297620873 */, 19 }, - /* 7852 */ { MAD_F(0x04c3431b) /* 0.297671418 */, 19 }, - /* 7853 */ { MAD_F(0x04c3781c) /* 0.297721967 */, 19 }, - /* 7854 */ { MAD_F(0x04c3ad1d) /* 0.297772517 */, 19 }, - /* 7855 */ { MAD_F(0x04c3e21f) /* 0.297823069 */, 19 }, - - /* 7856 */ { MAD_F(0x04c41722) /* 0.297873624 */, 19 }, - /* 7857 */ { MAD_F(0x04c44c25) /* 0.297924180 */, 19 }, - /* 7858 */ { MAD_F(0x04c48129) /* 0.297974739 */, 19 }, - /* 7859 */ { MAD_F(0x04c4b62d) /* 0.298025300 */, 19 }, - /* 7860 */ { MAD_F(0x04c4eb32) /* 0.298075863 */, 19 }, - /* 7861 */ { MAD_F(0x04c52038) /* 0.298126429 */, 19 }, - /* 7862 */ { MAD_F(0x04c5553e) /* 0.298176996 */, 19 }, - /* 7863 */ { MAD_F(0x04c58a44) /* 0.298227565 */, 19 }, - /* 7864 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 19 }, - /* 7865 */ { MAD_F(0x04c5f453) /* 0.298328711 */, 19 }, - /* 7866 */ { MAD_F(0x04c6295c) /* 0.298379287 */, 19 }, - /* 7867 */ { MAD_F(0x04c65e65) /* 0.298429865 */, 19 }, - /* 7868 */ { MAD_F(0x04c6936e) /* 0.298480445 */, 19 }, - /* 7869 */ { MAD_F(0x04c6c878) /* 0.298531028 */, 19 }, - /* 7870 */ { MAD_F(0x04c6fd83) /* 0.298581612 */, 19 }, - /* 7871 */ { MAD_F(0x04c7328e) /* 0.298632199 */, 19 }, - - /* 7872 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 19 }, - /* 7873 */ { MAD_F(0x04c79ca7) /* 0.298733379 */, 19 }, - /* 7874 */ { MAD_F(0x04c7d1b4) /* 0.298783972 */, 19 }, - /* 7875 */ { MAD_F(0x04c806c1) /* 0.298834567 */, 19 }, - /* 7876 */ { MAD_F(0x04c83bcf) /* 0.298885165 */, 19 }, - /* 7877 */ { MAD_F(0x04c870de) /* 0.298935764 */, 19 }, - /* 7878 */ { MAD_F(0x04c8a5ed) /* 0.298986366 */, 19 }, - /* 7879 */ { MAD_F(0x04c8dafd) /* 0.299036970 */, 19 }, - /* 7880 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 19 }, - /* 7881 */ { MAD_F(0x04c9451e) /* 0.299138184 */, 19 }, - /* 7882 */ { MAD_F(0x04c97a30) /* 0.299188794 */, 19 }, - /* 7883 */ { MAD_F(0x04c9af42) /* 0.299239406 */, 19 }, - /* 7884 */ { MAD_F(0x04c9e455) /* 0.299290021 */, 19 }, - /* 7885 */ { MAD_F(0x04ca1968) /* 0.299340638 */, 19 }, - /* 7886 */ { MAD_F(0x04ca4e7c) /* 0.299391256 */, 19 }, - /* 7887 */ { MAD_F(0x04ca8391) /* 0.299441877 */, 19 }, - - /* 7888 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 19 }, - /* 7889 */ { MAD_F(0x04caedbb) /* 0.299543126 */, 19 }, - /* 7890 */ { MAD_F(0x04cb22d1) /* 0.299593753 */, 19 }, - /* 7891 */ { MAD_F(0x04cb57e8) /* 0.299644382 */, 19 }, - /* 7892 */ { MAD_F(0x04cb8d00) /* 0.299695014 */, 19 }, - /* 7893 */ { MAD_F(0x04cbc217) /* 0.299745648 */, 19 }, - /* 7894 */ { MAD_F(0x04cbf730) /* 0.299796284 */, 19 }, - /* 7895 */ { MAD_F(0x04cc2c49) /* 0.299846922 */, 19 }, - /* 7896 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 19 }, - /* 7897 */ { MAD_F(0x04cc967d) /* 0.299948204 */, 19 }, - /* 7898 */ { MAD_F(0x04cccb98) /* 0.299998849 */, 19 }, - /* 7899 */ { MAD_F(0x04cd00b3) /* 0.300049495 */, 19 }, - /* 7900 */ { MAD_F(0x04cd35cf) /* 0.300100144 */, 19 }, - /* 7901 */ { MAD_F(0x04cd6aeb) /* 0.300150795 */, 19 }, - /* 7902 */ { MAD_F(0x04cda008) /* 0.300201448 */, 19 }, - /* 7903 */ { MAD_F(0x04cdd526) /* 0.300252103 */, 19 }, - - /* 7904 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 19 }, - /* 7905 */ { MAD_F(0x04ce3f63) /* 0.300353420 */, 19 }, - /* 7906 */ { MAD_F(0x04ce7482) /* 0.300404082 */, 19 }, - /* 7907 */ { MAD_F(0x04cea9a2) /* 0.300454745 */, 19 }, - /* 7908 */ { MAD_F(0x04cedec3) /* 0.300505411 */, 19 }, - /* 7909 */ { MAD_F(0x04cf13e4) /* 0.300556079 */, 19 }, - /* 7910 */ { MAD_F(0x04cf4906) /* 0.300606749 */, 19 }, - /* 7911 */ { MAD_F(0x04cf7e28) /* 0.300657421 */, 19 }, - /* 7912 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 19 }, - /* 7913 */ { MAD_F(0x04cfe86e) /* 0.300758772 */, 19 }, - /* 7914 */ { MAD_F(0x04d01d92) /* 0.300809451 */, 19 }, - /* 7915 */ { MAD_F(0x04d052b6) /* 0.300860132 */, 19 }, - /* 7916 */ { MAD_F(0x04d087db) /* 0.300910815 */, 19 }, - /* 7917 */ { MAD_F(0x04d0bd01) /* 0.300961500 */, 19 }, - /* 7918 */ { MAD_F(0x04d0f227) /* 0.301012187 */, 19 }, - /* 7919 */ { MAD_F(0x04d1274e) /* 0.301062876 */, 19 }, - - /* 7920 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 19 }, - /* 7921 */ { MAD_F(0x04d1919e) /* 0.301164261 */, 19 }, - /* 7922 */ { MAD_F(0x04d1c6c6) /* 0.301214957 */, 19 }, - /* 7923 */ { MAD_F(0x04d1fbef) /* 0.301265655 */, 19 }, - /* 7924 */ { MAD_F(0x04d23119) /* 0.301316355 */, 19 }, - /* 7925 */ { MAD_F(0x04d26643) /* 0.301367057 */, 19 }, - /* 7926 */ { MAD_F(0x04d29b6e) /* 0.301417761 */, 19 }, - /* 7927 */ { MAD_F(0x04d2d099) /* 0.301468468 */, 19 }, - /* 7928 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 19 }, - /* 7929 */ { MAD_F(0x04d33af2) /* 0.301569887 */, 19 }, - /* 7930 */ { MAD_F(0x04d3701f) /* 0.301620599 */, 19 }, - /* 7931 */ { MAD_F(0x04d3a54d) /* 0.301671314 */, 19 }, - /* 7932 */ { MAD_F(0x04d3da7b) /* 0.301722031 */, 19 }, - /* 7933 */ { MAD_F(0x04d40faa) /* 0.301772751 */, 19 }, - /* 7934 */ { MAD_F(0x04d444d9) /* 0.301823472 */, 19 }, - /* 7935 */ { MAD_F(0x04d47a09) /* 0.301874195 */, 19 }, - - /* 7936 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 19 }, - /* 7937 */ { MAD_F(0x04d4e46b) /* 0.301975649 */, 19 }, - /* 7938 */ { MAD_F(0x04d5199c) /* 0.302026378 */, 19 }, - /* 7939 */ { MAD_F(0x04d54ecf) /* 0.302077110 */, 19 }, - /* 7940 */ { MAD_F(0x04d58401) /* 0.302127845 */, 19 }, - /* 7941 */ { MAD_F(0x04d5b935) /* 0.302178581 */, 19 }, - /* 7942 */ { MAD_F(0x04d5ee69) /* 0.302229319 */, 19 }, - /* 7943 */ { MAD_F(0x04d6239d) /* 0.302280060 */, 19 }, - /* 7944 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 19 }, - /* 7945 */ { MAD_F(0x04d68e08) /* 0.302381547 */, 19 }, - /* 7946 */ { MAD_F(0x04d6c33e) /* 0.302432294 */, 19 }, - /* 7947 */ { MAD_F(0x04d6f875) /* 0.302483043 */, 19 }, - /* 7948 */ { MAD_F(0x04d72dad) /* 0.302533794 */, 19 }, - /* 7949 */ { MAD_F(0x04d762e5) /* 0.302584547 */, 19 }, - /* 7950 */ { MAD_F(0x04d7981d) /* 0.302635303 */, 19 }, - /* 7951 */ { MAD_F(0x04d7cd56) /* 0.302686060 */, 19 }, - - /* 7952 */ { MAD_F(0x04d80290) /* 0.302736820 */, 19 }, - /* 7953 */ { MAD_F(0x04d837ca) /* 0.302787581 */, 19 }, - /* 7954 */ { MAD_F(0x04d86d05) /* 0.302838345 */, 19 }, - /* 7955 */ { MAD_F(0x04d8a240) /* 0.302889111 */, 19 }, - /* 7956 */ { MAD_F(0x04d8d77c) /* 0.302939879 */, 19 }, - /* 7957 */ { MAD_F(0x04d90cb9) /* 0.302990650 */, 19 }, - /* 7958 */ { MAD_F(0x04d941f6) /* 0.303041422 */, 19 }, - /* 7959 */ { MAD_F(0x04d97734) /* 0.303092197 */, 19 }, - /* 7960 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 19 }, - /* 7961 */ { MAD_F(0x04d9e1b1) /* 0.303193752 */, 19 }, - /* 7962 */ { MAD_F(0x04da16f0) /* 0.303244533 */, 19 }, - /* 7963 */ { MAD_F(0x04da4c30) /* 0.303295316 */, 19 }, - /* 7964 */ { MAD_F(0x04da8171) /* 0.303346101 */, 19 }, - /* 7965 */ { MAD_F(0x04dab6b2) /* 0.303396889 */, 19 }, - /* 7966 */ { MAD_F(0x04daebf4) /* 0.303447678 */, 19 }, - /* 7967 */ { MAD_F(0x04db2136) /* 0.303498469 */, 19 }, - - /* 7968 */ { MAD_F(0x04db5679) /* 0.303549263 */, 19 }, - /* 7969 */ { MAD_F(0x04db8bbc) /* 0.303600059 */, 19 }, - /* 7970 */ { MAD_F(0x04dbc100) /* 0.303650857 */, 19 }, - /* 7971 */ { MAD_F(0x04dbf644) /* 0.303701657 */, 19 }, - /* 7972 */ { MAD_F(0x04dc2b8a) /* 0.303752459 */, 19 }, - /* 7973 */ { MAD_F(0x04dc60cf) /* 0.303803263 */, 19 }, - /* 7974 */ { MAD_F(0x04dc9616) /* 0.303854070 */, 19 }, - /* 7975 */ { MAD_F(0x04dccb5c) /* 0.303904878 */, 19 }, - /* 7976 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 19 }, - /* 7977 */ { MAD_F(0x04dd35ec) /* 0.304006502 */, 19 }, - /* 7978 */ { MAD_F(0x04dd6b34) /* 0.304057317 */, 19 }, - /* 7979 */ { MAD_F(0x04dda07d) /* 0.304108134 */, 19 }, - /* 7980 */ { MAD_F(0x04ddd5c7) /* 0.304158953 */, 19 }, - /* 7981 */ { MAD_F(0x04de0b11) /* 0.304209774 */, 19 }, - /* 7982 */ { MAD_F(0x04de405c) /* 0.304260597 */, 19 }, - /* 7983 */ { MAD_F(0x04de75a7) /* 0.304311423 */, 19 }, - - /* 7984 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 19 }, - /* 7985 */ { MAD_F(0x04dee040) /* 0.304413080 */, 19 }, - /* 7986 */ { MAD_F(0x04df158d) /* 0.304463912 */, 19 }, - /* 7987 */ { MAD_F(0x04df4adb) /* 0.304514746 */, 19 }, - /* 7988 */ { MAD_F(0x04df8029) /* 0.304565582 */, 19 }, - /* 7989 */ { MAD_F(0x04dfb578) /* 0.304616421 */, 19 }, - /* 7990 */ { MAD_F(0x04dfeac7) /* 0.304667261 */, 19 }, - /* 7991 */ { MAD_F(0x04e02017) /* 0.304718103 */, 19 }, - /* 7992 */ { MAD_F(0x04e05567) /* 0.304768948 */, 19 }, - /* 7993 */ { MAD_F(0x04e08ab8) /* 0.304819795 */, 19 }, - /* 7994 */ { MAD_F(0x04e0c00a) /* 0.304870644 */, 19 }, - /* 7995 */ { MAD_F(0x04e0f55c) /* 0.304921495 */, 19 }, - /* 7996 */ { MAD_F(0x04e12aaf) /* 0.304972348 */, 19 }, - /* 7997 */ { MAD_F(0x04e16002) /* 0.305023203 */, 19 }, - /* 7998 */ { MAD_F(0x04e19556) /* 0.305074060 */, 19 }, - /* 7999 */ { MAD_F(0x04e1caab) /* 0.305124920 */, 19 }, - - /* 8000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 19 }, - /* 8001 */ { MAD_F(0x04e23555) /* 0.305226645 */, 19 }, - /* 8002 */ { MAD_F(0x04e26aac) /* 0.305277511 */, 19 }, - /* 8003 */ { MAD_F(0x04e2a002) /* 0.305328379 */, 19 }, - /* 8004 */ { MAD_F(0x04e2d55a) /* 0.305379249 */, 19 }, - /* 8005 */ { MAD_F(0x04e30ab2) /* 0.305430121 */, 19 }, - /* 8006 */ { MAD_F(0x04e3400a) /* 0.305480995 */, 19 }, - /* 8007 */ { MAD_F(0x04e37563) /* 0.305531872 */, 19 }, - /* 8008 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 19 }, - /* 8009 */ { MAD_F(0x04e3e017) /* 0.305633631 */, 19 }, - /* 8010 */ { MAD_F(0x04e41572) /* 0.305684513 */, 19 }, - /* 8011 */ { MAD_F(0x04e44acd) /* 0.305735398 */, 19 }, - /* 8012 */ { MAD_F(0x04e48029) /* 0.305786285 */, 19 }, - /* 8013 */ { MAD_F(0x04e4b585) /* 0.305837174 */, 19 }, - /* 8014 */ { MAD_F(0x04e4eae2) /* 0.305888066 */, 19 }, - /* 8015 */ { MAD_F(0x04e52040) /* 0.305938959 */, 19 }, - - /* 8016 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 19 }, - /* 8017 */ { MAD_F(0x04e58afd) /* 0.306040752 */, 19 }, - /* 8018 */ { MAD_F(0x04e5c05c) /* 0.306091652 */, 19 }, - /* 8019 */ { MAD_F(0x04e5f5bc) /* 0.306142554 */, 19 }, - /* 8020 */ { MAD_F(0x04e62b1c) /* 0.306193457 */, 19 }, - /* 8021 */ { MAD_F(0x04e6607d) /* 0.306244364 */, 19 }, - /* 8022 */ { MAD_F(0x04e695df) /* 0.306295272 */, 19 }, - /* 8023 */ { MAD_F(0x04e6cb41) /* 0.306346182 */, 19 }, - /* 8024 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 19 }, - /* 8025 */ { MAD_F(0x04e73607) /* 0.306448009 */, 19 }, - /* 8026 */ { MAD_F(0x04e76b6b) /* 0.306498925 */, 19 }, - /* 8027 */ { MAD_F(0x04e7a0cf) /* 0.306549844 */, 19 }, - /* 8028 */ { MAD_F(0x04e7d634) /* 0.306600765 */, 19 }, - /* 8029 */ { MAD_F(0x04e80b99) /* 0.306651688 */, 19 }, - /* 8030 */ { MAD_F(0x04e84100) /* 0.306702613 */, 19 }, - /* 8031 */ { MAD_F(0x04e87666) /* 0.306753540 */, 19 }, - - /* 8032 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 19 }, - /* 8033 */ { MAD_F(0x04e8e135) /* 0.306855401 */, 19 }, - /* 8034 */ { MAD_F(0x04e9169e) /* 0.306906334 */, 19 }, - /* 8035 */ { MAD_F(0x04e94c07) /* 0.306957270 */, 19 }, - /* 8036 */ { MAD_F(0x04e98170) /* 0.307008208 */, 19 }, - /* 8037 */ { MAD_F(0x04e9b6da) /* 0.307059148 */, 19 }, - /* 8038 */ { MAD_F(0x04e9ec45) /* 0.307110090 */, 19 }, - /* 8039 */ { MAD_F(0x04ea21b0) /* 0.307161034 */, 19 }, - /* 8040 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 19 }, - /* 8041 */ { MAD_F(0x04ea8c88) /* 0.307262928 */, 19 }, - /* 8042 */ { MAD_F(0x04eac1f5) /* 0.307313879 */, 19 }, - /* 8043 */ { MAD_F(0x04eaf762) /* 0.307364831 */, 19 }, - /* 8044 */ { MAD_F(0x04eb2cd0) /* 0.307415786 */, 19 }, - /* 8045 */ { MAD_F(0x04eb623f) /* 0.307466743 */, 19 }, - /* 8046 */ { MAD_F(0x04eb97ae) /* 0.307517702 */, 19 }, - /* 8047 */ { MAD_F(0x04ebcd1e) /* 0.307568663 */, 19 }, - - /* 8048 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 19 }, - /* 8049 */ { MAD_F(0x04ec37ff) /* 0.307670591 */, 19 }, - /* 8050 */ { MAD_F(0x04ec6d71) /* 0.307721558 */, 19 }, - /* 8051 */ { MAD_F(0x04eca2e3) /* 0.307772528 */, 19 }, - /* 8052 */ { MAD_F(0x04ecd855) /* 0.307823499 */, 19 }, - /* 8053 */ { MAD_F(0x04ed0dc8) /* 0.307874473 */, 19 }, - /* 8054 */ { MAD_F(0x04ed433c) /* 0.307925449 */, 19 }, - /* 8055 */ { MAD_F(0x04ed78b0) /* 0.307976426 */, 19 }, - /* 8056 */ { MAD_F(0x04edae25) /* 0.308027406 */, 19 }, - /* 8057 */ { MAD_F(0x04ede39a) /* 0.308078389 */, 19 }, - /* 8058 */ { MAD_F(0x04ee1910) /* 0.308129373 */, 19 }, - /* 8059 */ { MAD_F(0x04ee4e87) /* 0.308180359 */, 19 }, - /* 8060 */ { MAD_F(0x04ee83fe) /* 0.308231347 */, 19 }, - /* 8061 */ { MAD_F(0x04eeb976) /* 0.308282338 */, 19 }, - /* 8062 */ { MAD_F(0x04eeeeee) /* 0.308333331 */, 19 }, - /* 8063 */ { MAD_F(0x04ef2467) /* 0.308384325 */, 19 }, - - /* 8064 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 19 }, - /* 8065 */ { MAD_F(0x04ef8f5a) /* 0.308486321 */, 19 }, - /* 8066 */ { MAD_F(0x04efc4d5) /* 0.308537322 */, 19 }, - /* 8067 */ { MAD_F(0x04effa50) /* 0.308588325 */, 19 }, - /* 8068 */ { MAD_F(0x04f02fcb) /* 0.308639331 */, 19 }, - /* 8069 */ { MAD_F(0x04f06547) /* 0.308690338 */, 19 }, - /* 8070 */ { MAD_F(0x04f09ac4) /* 0.308741348 */, 19 }, - /* 8071 */ { MAD_F(0x04f0d041) /* 0.308792359 */, 19 }, - /* 8072 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 19 }, - /* 8073 */ { MAD_F(0x04f13b3e) /* 0.308894389 */, 19 }, - /* 8074 */ { MAD_F(0x04f170bd) /* 0.308945407 */, 19 }, - /* 8075 */ { MAD_F(0x04f1a63c) /* 0.308996427 */, 19 }, - /* 8076 */ { MAD_F(0x04f1dbbd) /* 0.309047449 */, 19 }, - /* 8077 */ { MAD_F(0x04f2113d) /* 0.309098473 */, 19 }, - /* 8078 */ { MAD_F(0x04f246bf) /* 0.309149499 */, 19 }, - /* 8079 */ { MAD_F(0x04f27c40) /* 0.309200528 */, 19 }, - - /* 8080 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 19 }, - /* 8081 */ { MAD_F(0x04f2e746) /* 0.309302591 */, 19 }, - /* 8082 */ { MAD_F(0x04f31cc9) /* 0.309353626 */, 19 }, - /* 8083 */ { MAD_F(0x04f3524d) /* 0.309404663 */, 19 }, - /* 8084 */ { MAD_F(0x04f387d2) /* 0.309455702 */, 19 }, - /* 8085 */ { MAD_F(0x04f3bd57) /* 0.309506743 */, 19 }, - /* 8086 */ { MAD_F(0x04f3f2dd) /* 0.309557786 */, 19 }, - /* 8087 */ { MAD_F(0x04f42864) /* 0.309608831 */, 19 }, - /* 8088 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 19 }, - /* 8089 */ { MAD_F(0x04f49372) /* 0.309710928 */, 19 }, - /* 8090 */ { MAD_F(0x04f4c8fa) /* 0.309761980 */, 19 }, - /* 8091 */ { MAD_F(0x04f4fe83) /* 0.309813033 */, 19 }, - /* 8092 */ { MAD_F(0x04f5340c) /* 0.309864089 */, 19 }, - /* 8093 */ { MAD_F(0x04f56996) /* 0.309915147 */, 19 }, - /* 8094 */ { MAD_F(0x04f59f20) /* 0.309966207 */, 19 }, - /* 8095 */ { MAD_F(0x04f5d4ab) /* 0.310017269 */, 19 }, - - /* 8096 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 19 }, - /* 8097 */ { MAD_F(0x04f63fc2) /* 0.310119400 */, 19 }, - /* 8098 */ { MAD_F(0x04f6754f) /* 0.310170468 */, 19 }, - /* 8099 */ { MAD_F(0x04f6aadc) /* 0.310221539 */, 19 }, - /* 8100 */ { MAD_F(0x04f6e06a) /* 0.310272611 */, 19 }, - /* 8101 */ { MAD_F(0x04f715f8) /* 0.310323686 */, 19 }, - /* 8102 */ { MAD_F(0x04f74b87) /* 0.310374763 */, 19 }, - /* 8103 */ { MAD_F(0x04f78116) /* 0.310425842 */, 19 }, - /* 8104 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 19 }, - /* 8105 */ { MAD_F(0x04f7ec37) /* 0.310528006 */, 19 }, - /* 8106 */ { MAD_F(0x04f821c8) /* 0.310579091 */, 19 }, - /* 8107 */ { MAD_F(0x04f85759) /* 0.310630179 */, 19 }, - /* 8108 */ { MAD_F(0x04f88cec) /* 0.310681268 */, 19 }, - /* 8109 */ { MAD_F(0x04f8c27e) /* 0.310732360 */, 19 }, - /* 8110 */ { MAD_F(0x04f8f812) /* 0.310783453 */, 19 }, - /* 8111 */ { MAD_F(0x04f92da6) /* 0.310834549 */, 19 }, - - /* 8112 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 19 }, - /* 8113 */ { MAD_F(0x04f998cf) /* 0.310936747 */, 19 }, - /* 8114 */ { MAD_F(0x04f9ce65) /* 0.310987849 */, 19 }, - /* 8115 */ { MAD_F(0x04fa03fb) /* 0.311038953 */, 19 }, - /* 8116 */ { MAD_F(0x04fa3992) /* 0.311090059 */, 19 }, - /* 8117 */ { MAD_F(0x04fa6f29) /* 0.311141168 */, 19 }, - /* 8118 */ { MAD_F(0x04faa4c1) /* 0.311192278 */, 19 }, - /* 8119 */ { MAD_F(0x04fada59) /* 0.311243390 */, 19 }, - /* 8120 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 19 }, - /* 8121 */ { MAD_F(0x04fb458c) /* 0.311345622 */, 19 }, - /* 8122 */ { MAD_F(0x04fb7b26) /* 0.311396741 */, 19 }, - /* 8123 */ { MAD_F(0x04fbb0c1) /* 0.311447862 */, 19 }, - /* 8124 */ { MAD_F(0x04fbe65c) /* 0.311498985 */, 19 }, - /* 8125 */ { MAD_F(0x04fc1bf8) /* 0.311550110 */, 19 }, - /* 8126 */ { MAD_F(0x04fc5194) /* 0.311601237 */, 19 }, - /* 8127 */ { MAD_F(0x04fc8731) /* 0.311652366 */, 19 }, - - /* 8128 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 19 }, - /* 8129 */ { MAD_F(0x04fcf26c) /* 0.311754631 */, 19 }, - /* 8130 */ { MAD_F(0x04fd280b) /* 0.311805767 */, 19 }, - /* 8131 */ { MAD_F(0x04fd5daa) /* 0.311856905 */, 19 }, - /* 8132 */ { MAD_F(0x04fd934a) /* 0.311908044 */, 19 }, - /* 8133 */ { MAD_F(0x04fdc8ea) /* 0.311959186 */, 19 }, - /* 8134 */ { MAD_F(0x04fdfe8b) /* 0.312010330 */, 19 }, - /* 8135 */ { MAD_F(0x04fe342c) /* 0.312061476 */, 19 }, - /* 8136 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 19 }, - /* 8137 */ { MAD_F(0x04fe9f71) /* 0.312163775 */, 19 }, - /* 8138 */ { MAD_F(0x04fed514) /* 0.312214927 */, 19 }, - /* 8139 */ { MAD_F(0x04ff0ab8) /* 0.312266082 */, 19 }, - /* 8140 */ { MAD_F(0x04ff405c) /* 0.312317238 */, 19 }, - /* 8141 */ { MAD_F(0x04ff7601) /* 0.312368397 */, 19 }, - /* 8142 */ { MAD_F(0x04ffaba6) /* 0.312419558 */, 19 }, - /* 8143 */ { MAD_F(0x04ffe14c) /* 0.312470720 */, 19 }, - - /* 8144 */ { MAD_F(0x050016f3) /* 0.312521885 */, 19 }, - /* 8145 */ { MAD_F(0x05004c9a) /* 0.312573052 */, 19 }, - /* 8146 */ { MAD_F(0x05008241) /* 0.312624222 */, 19 }, - /* 8147 */ { MAD_F(0x0500b7e9) /* 0.312675393 */, 19 }, - /* 8148 */ { MAD_F(0x0500ed92) /* 0.312726566 */, 19 }, - /* 8149 */ { MAD_F(0x0501233b) /* 0.312777742 */, 19 }, - /* 8150 */ { MAD_F(0x050158e5) /* 0.312828919 */, 19 }, - /* 8151 */ { MAD_F(0x05018e90) /* 0.312880099 */, 19 }, - /* 8152 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 19 }, - /* 8153 */ { MAD_F(0x0501f9e6) /* 0.312982464 */, 19 }, - /* 8154 */ { MAD_F(0x05022f92) /* 0.313033650 */, 19 }, - /* 8155 */ { MAD_F(0x0502653f) /* 0.313084838 */, 19 }, - /* 8156 */ { MAD_F(0x05029aec) /* 0.313136028 */, 19 }, - /* 8157 */ { MAD_F(0x0502d09a) /* 0.313187220 */, 19 }, - /* 8158 */ { MAD_F(0x05030648) /* 0.313238414 */, 19 }, - /* 8159 */ { MAD_F(0x05033bf7) /* 0.313289611 */, 19 }, - - /* 8160 */ { MAD_F(0x050371a7) /* 0.313340809 */, 19 }, - /* 8161 */ { MAD_F(0x0503a757) /* 0.313392010 */, 19 }, - /* 8162 */ { MAD_F(0x0503dd07) /* 0.313443212 */, 19 }, - /* 8163 */ { MAD_F(0x050412b9) /* 0.313494417 */, 19 }, - /* 8164 */ { MAD_F(0x0504486a) /* 0.313545624 */, 19 }, - /* 8165 */ { MAD_F(0x05047e1d) /* 0.313596833 */, 19 }, - /* 8166 */ { MAD_F(0x0504b3cf) /* 0.313648044 */, 19 }, - /* 8167 */ { MAD_F(0x0504e983) /* 0.313699257 */, 19 }, - /* 8168 */ { MAD_F(0x05051f37) /* 0.313750472 */, 19 }, - /* 8169 */ { MAD_F(0x050554eb) /* 0.313801689 */, 19 }, - /* 8170 */ { MAD_F(0x05058aa0) /* 0.313852909 */, 19 }, - /* 8171 */ { MAD_F(0x0505c056) /* 0.313904130 */, 19 }, - /* 8172 */ { MAD_F(0x0505f60c) /* 0.313955354 */, 19 }, - /* 8173 */ { MAD_F(0x05062bc3) /* 0.314006579 */, 19 }, - /* 8174 */ { MAD_F(0x0506617a) /* 0.314057807 */, 19 }, - /* 8175 */ { MAD_F(0x05069732) /* 0.314109037 */, 19 }, - - /* 8176 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 19 }, - /* 8177 */ { MAD_F(0x050702a4) /* 0.314211502 */, 19 }, - /* 8178 */ { MAD_F(0x0507385d) /* 0.314262739 */, 19 }, - /* 8179 */ { MAD_F(0x05076e17) /* 0.314313977 */, 19 }, - /* 8180 */ { MAD_F(0x0507a3d2) /* 0.314365217 */, 19 }, - /* 8181 */ { MAD_F(0x0507d98d) /* 0.314416459 */, 19 }, - /* 8182 */ { MAD_F(0x05080f49) /* 0.314467704 */, 19 }, - /* 8183 */ { MAD_F(0x05084506) /* 0.314518950 */, 19 }, - /* 8184 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 19 }, - /* 8185 */ { MAD_F(0x0508b080) /* 0.314621449 */, 19 }, - /* 8186 */ { MAD_F(0x0508e63e) /* 0.314672702 */, 19 }, - /* 8187 */ { MAD_F(0x05091bfd) /* 0.314723957 */, 19 }, - /* 8188 */ { MAD_F(0x050951bc) /* 0.314775214 */, 19 }, - /* 8189 */ { MAD_F(0x0509877c) /* 0.314826473 */, 19 }, - /* 8190 */ { MAD_F(0x0509bd3c) /* 0.314877734 */, 19 }, - /* 8191 */ { MAD_F(0x0509f2fd) /* 0.314928997 */, 19 }, - - /* 8192 */ { MAD_F(0x050a28be) /* 0.314980262 */, 19 }, - /* 8193 */ { MAD_F(0x050a5e80) /* 0.315031530 */, 19 }, - /* 8194 */ { MAD_F(0x050a9443) /* 0.315082799 */, 19 }, - /* 8195 */ { MAD_F(0x050aca06) /* 0.315134071 */, 19 }, - /* 8196 */ { MAD_F(0x050affc9) /* 0.315185344 */, 19 }, - /* 8197 */ { MAD_F(0x050b358e) /* 0.315236620 */, 19 }, - /* 8198 */ { MAD_F(0x050b6b52) /* 0.315287898 */, 19 }, - /* 8199 */ { MAD_F(0x050ba118) /* 0.315339178 */, 19 }, - /* 8200 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 19 }, - /* 8201 */ { MAD_F(0x050c0ca4) /* 0.315441744 */, 19 }, - /* 8202 */ { MAD_F(0x050c426b) /* 0.315493030 */, 19 }, - /* 8203 */ { MAD_F(0x050c7833) /* 0.315544318 */, 19 }, - /* 8204 */ { MAD_F(0x050cadfb) /* 0.315595608 */, 19 }, - /* 8205 */ { MAD_F(0x050ce3c4) /* 0.315646901 */, 19 }, - /* 8206 */ { MAD_F(0x050d198d) /* 0.315698195 */, 19 } diff --git a/src/lib/dl/ext/libmad/sf_table.dat b/src/lib/dl/ext/libmad/sf_table.dat deleted file mode 100755 index db1484a0..00000000 --- a/src/lib/dl/ext/libmad/sf_table.dat +++ /dev/null @@ -1,106 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: sf_table.dat,v 1.7 2004/01/23 09:41:33 rob Exp $ - */ - -/* - * These are the scalefactor values for Layer I and Layer II. - * The values are from Table B.1 of ISO/IEC 11172-3. - * - * There is some error introduced by the 32-bit fixed-point representation; - * the amount of error is shown. For 16-bit PCM output, this shouldn't be - * too much of a problem. - * - * Strictly speaking, Table B.1 has only 63 entries (0-62), thus a strict - * interpretation of ISO/IEC 11172-3 would suggest that a scalefactor index of - * 63 is invalid. However, for better compatibility with current practices, we - * add a 64th entry. - */ - - MAD_F(0x20000000), /* 2.000000000000 => 2.000000000000, e 0.000000000000 */ - MAD_F(0x1965fea5), /* 1.587401051968 => 1.587401051074, e 0.000000000894 */ - MAD_F(0x1428a2fa), /* 1.259921049895 => 1.259921051562, e -0.000000001667 */ - MAD_F(0x10000000), /* 1.000000000000 => 1.000000000000, e 0.000000000000 */ - MAD_F(0x0cb2ff53), /* 0.793700525984 => 0.793700527400, e -0.000000001416 */ - MAD_F(0x0a14517d), /* 0.629960524947 => 0.629960525781, e -0.000000000833 */ - MAD_F(0x08000000), /* 0.500000000000 => 0.500000000000, e 0.000000000000 */ - MAD_F(0x06597fa9), /* 0.396850262992 => 0.396850261837, e 0.000000001155 */ - - MAD_F(0x050a28be), /* 0.314980262474 => 0.314980261028, e 0.000000001446 */ - MAD_F(0x04000000), /* 0.250000000000 => 0.250000000000, e 0.000000000000 */ - MAD_F(0x032cbfd5), /* 0.198425131496 => 0.198425132781, e -0.000000001285 */ - MAD_F(0x0285145f), /* 0.157490131237 => 0.157490130514, e 0.000000000723 */ - MAD_F(0x02000000), /* 0.125000000000 => 0.125000000000, e 0.000000000000 */ - MAD_F(0x01965fea), /* 0.099212565748 => 0.099212564528, e 0.000000001220 */ - MAD_F(0x01428a30), /* 0.078745065618 => 0.078745067120, e -0.000000001501 */ - MAD_F(0x01000000), /* 0.062500000000 => 0.062500000000, e 0.000000000000 */ - - MAD_F(0x00cb2ff5), /* 0.049606282874 => 0.049606282264, e 0.000000000610 */ - MAD_F(0x00a14518), /* 0.039372532809 => 0.039372533560, e -0.000000000751 */ - MAD_F(0x00800000), /* 0.031250000000 => 0.031250000000, e 0.000000000000 */ - MAD_F(0x006597fb), /* 0.024803141437 => 0.024803142995, e -0.000000001558 */ - MAD_F(0x0050a28c), /* 0.019686266405 => 0.019686266780, e -0.000000000375 */ - MAD_F(0x00400000), /* 0.015625000000 => 0.015625000000, e 0.000000000000 */ - MAD_F(0x0032cbfd), /* 0.012401570719 => 0.012401569635, e 0.000000001084 */ - MAD_F(0x00285146), /* 0.009843133202 => 0.009843133390, e -0.000000000188 */ - - MAD_F(0x00200000), /* 0.007812500000 => 0.007812500000, e 0.000000000000 */ - MAD_F(0x001965ff), /* 0.006200785359 => 0.006200786680, e -0.000000001321 */ - MAD_F(0x001428a3), /* 0.004921566601 => 0.004921566695, e -0.000000000094 */ - MAD_F(0x00100000), /* 0.003906250000 => 0.003906250000, e 0.000000000000 */ - MAD_F(0x000cb2ff), /* 0.003100392680 => 0.003100391477, e 0.000000001202 */ - MAD_F(0x000a1451), /* 0.002460783301 => 0.002460781485, e 0.000000001816 */ - MAD_F(0x00080000), /* 0.001953125000 => 0.001953125000, e 0.000000000000 */ - MAD_F(0x00065980), /* 0.001550196340 => 0.001550197601, e -0.000000001262 */ - - MAD_F(0x00050a29), /* 0.001230391650 => 0.001230392605, e -0.000000000955 */ - MAD_F(0x00040000), /* 0.000976562500 => 0.000976562500, e 0.000000000000 */ - MAD_F(0x00032cc0), /* 0.000775098170 => 0.000775098801, e -0.000000000631 */ - MAD_F(0x00028514), /* 0.000615195825 => 0.000615194440, e 0.000000001385 */ - MAD_F(0x00020000), /* 0.000488281250 => 0.000488281250, e 0.000000000000 */ - MAD_F(0x00019660), /* 0.000387549085 => 0.000387549400, e -0.000000000315 */ - MAD_F(0x0001428a), /* 0.000307597913 => 0.000307597220, e 0.000000000693 */ - MAD_F(0x00010000), /* 0.000244140625 => 0.000244140625, e 0.000000000000 */ - - MAD_F(0x0000cb30), /* 0.000193774542 => 0.000193774700, e -0.000000000158 */ - MAD_F(0x0000a145), /* 0.000153798956 => 0.000153798610, e 0.000000000346 */ - MAD_F(0x00008000), /* 0.000122070313 => 0.000122070313, e 0.000000000000 */ - MAD_F(0x00006598), /* 0.000096887271 => 0.000096887350, e -0.000000000079 */ - MAD_F(0x000050a3), /* 0.000076899478 => 0.000076901168, e -0.000000001689 */ - MAD_F(0x00004000), /* 0.000061035156 => 0.000061035156, e 0.000000000000 */ - MAD_F(0x000032cc), /* 0.000048443636 => 0.000048443675, e -0.000000000039 */ - MAD_F(0x00002851), /* 0.000038449739 => 0.000038448721, e 0.000000001018 */ - - MAD_F(0x00002000), /* 0.000030517578 => 0.000030517578, e 0.000000000000 */ - MAD_F(0x00001966), /* 0.000024221818 => 0.000024221838, e -0.000000000020 */ - MAD_F(0x00001429), /* 0.000019224870 => 0.000019226223, e -0.000000001354 */ - MAD_F(0x00001000), /* 0.000015258789 => 0.000015258789, e -0.000000000000 */ - MAD_F(0x00000cb3), /* 0.000012110909 => 0.000012110919, e -0.000000000010 */ - MAD_F(0x00000a14), /* 0.000009612435 => 0.000009611249, e 0.000000001186 */ - MAD_F(0x00000800), /* 0.000007629395 => 0.000007629395, e -0.000000000000 */ - MAD_F(0x00000659), /* 0.000006055454 => 0.000006053597, e 0.000000001858 */ - - MAD_F(0x0000050a), /* 0.000004806217 => 0.000004805624, e 0.000000000593 */ - MAD_F(0x00000400), /* 0.000003814697 => 0.000003814697, e 0.000000000000 */ - MAD_F(0x0000032d), /* 0.000003027727 => 0.000003028661, e -0.000000000934 */ - MAD_F(0x00000285), /* 0.000002403109 => 0.000002402812, e 0.000000000296 */ - MAD_F(0x00000200), /* 0.000001907349 => 0.000001907349, e -0.000000000000 */ - MAD_F(0x00000196), /* 0.000001513864 => 0.000001512468, e 0.000000001396 */ - MAD_F(0x00000143), /* 0.000001201554 => 0.000001203269, e -0.000000001714 */ - MAD_F(0x00000000) /* this compatibility entry is not part of Table B.1 */ diff --git a/src/lib/dl/ext/libmad/stream.c b/src/lib/dl/ext/libmad/stream.c deleted file mode 100755 index 8bb4d6a4..00000000 --- a/src/lib/dl/ext/libmad/stream.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: stream.c,v 1.12 2004/02/05 09:02:39 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include <stdlib.h> - -# include "bit.h" -# include "stream.h" - -/* - * NAME: stream->init() - * DESCRIPTION: initialize stream struct - */ -void mad_stream_init(struct mad_stream *stream) -{ - stream->buffer = 0; - stream->bufend = 0; - stream->skiplen = 0; - - stream->sync = 0; - stream->freerate = 0; - - stream->this_frame = 0; - stream->next_frame = 0; - mad_bit_init(&stream->ptr, 0); - - mad_bit_init(&stream->anc_ptr, 0); - stream->anc_bitlen = 0; - - stream->main_data = 0; - stream->md_len = 0; - - stream->options = 0; - stream->error = MAD_ERROR_NONE; -} - -/* - * NAME: stream->finish() - * DESCRIPTION: deallocate any dynamic memory associated with stream - */ -void mad_stream_finish(struct mad_stream *stream) -{ - if (stream->main_data) { - free(stream->main_data); - stream->main_data = 0; - } - - mad_bit_finish(&stream->anc_ptr); - mad_bit_finish(&stream->ptr); -} - -/* - * NAME: stream->buffer() - * DESCRIPTION: set stream buffer pointers - */ -void mad_stream_buffer(struct mad_stream *stream, - unsigned char const *buffer, unsigned long length) -{ - stream->buffer = buffer; - stream->bufend = buffer + length; - - stream->this_frame = buffer; - stream->next_frame = buffer; - - stream->sync = 1; - - mad_bit_init(&stream->ptr, buffer); -} - -/* - * NAME: stream->skip() - * DESCRIPTION: arrange to skip bytes before the next frame - */ -void mad_stream_skip(struct mad_stream *stream, unsigned long length) -{ - stream->skiplen += length; -} - -/* - * NAME: stream->sync() - * DESCRIPTION: locate the next stream sync word - */ -int mad_stream_sync(struct mad_stream *stream) -{ - register unsigned char const *ptr, *end; - - ptr = mad_bit_nextbyte(&stream->ptr); - end = stream->bufend; - - while (ptr < end - 1 && - !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) - ++ptr; - - if (end - ptr < MAD_BUFFER_GUARD) - return -1; - - mad_bit_init(&stream->ptr, ptr); - - return 0; -} - -/* - * NAME: stream->errorstr() - * DESCRIPTION: return a string description of the current error condition - */ -char const *mad_stream_errorstr(struct mad_stream const *stream) -{ - switch (stream->error) { - case MAD_ERROR_NONE: return "no error"; - - case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; - case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; - - case MAD_ERROR_NOMEM: return "not enough memory"; - - case MAD_ERROR_LOSTSYNC: return "lost synchronization"; - case MAD_ERROR_BADLAYER: return "reserved header layer value"; - case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; - case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; - case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; - - case MAD_ERROR_BADCRC: return "CRC check failed"; - case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; - case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; - case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; - case MAD_ERROR_BADFRAMELEN: return "bad frame length"; - case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; - case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; - case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; - case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; - case MAD_ERROR_BADPART3LEN: return "bad audio data length"; - case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; - case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; - case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; - } - - return 0; -} diff --git a/src/lib/dl/ext/libmad/stream.h b/src/lib/dl/ext/libmad/stream.h deleted file mode 100755 index 8bff8b49..00000000 --- a/src/lib/dl/ext/libmad/stream.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp $ - */ - -# ifndef LIBMAD_STREAM_H -# define LIBMAD_STREAM_H - -# include "bit.h" - -# define MAD_BUFFER_GUARD 8 -# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) - -enum mad_error { - MAD_ERROR_NONE = 0x0000, /* no error */ - - MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */ - MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */ - - MAD_ERROR_NOMEM = 0x0031, /* not enough memory */ - - MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ - MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ - MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ - MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */ - MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */ - - MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ - MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ - MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ - MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ - MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ - MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ - MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ - MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ - MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ - MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ - MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ - MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ - MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ -}; - -# define MAD_RECOVERABLE(error) ((error) & 0xff00) - -struct mad_stream { - unsigned char const *buffer; /* input bitstream buffer */ - unsigned char const *bufend; /* end of buffer */ - unsigned long skiplen; /* bytes to skip before next frame */ - - int sync; /* stream sync found */ - unsigned long freerate; /* free bitrate (fixed) */ - - unsigned char const *this_frame; /* start of current frame */ - unsigned char const *next_frame; /* start of next frame */ - struct mad_bitptr ptr; /* current processing bit pointer */ - - struct mad_bitptr anc_ptr; /* ancillary bits pointer */ - unsigned int anc_bitlen; /* number of ancillary bits */ - - unsigned char (*main_data)[MAD_BUFFER_MDLEN]; - /* Layer III main_data() */ - unsigned int md_len; /* bytes in main_data */ - - int options; /* decoding options (see below) */ - enum mad_error error; /* error code (see above) */ -}; - -enum { - MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */ - MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */ -# if 0 /* not yet implemented */ - MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */ - MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */ - MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */ -# endif -}; - -void mad_stream_init(struct mad_stream *); -void mad_stream_finish(struct mad_stream *); - -# define mad_stream_options(stream, opts) \ - ((void) ((stream)->options = (opts))) - -void mad_stream_buffer(struct mad_stream *, - unsigned char const *, unsigned long); -void mad_stream_skip(struct mad_stream *, unsigned long); - -int mad_stream_sync(struct mad_stream *); - -char const *mad_stream_errorstr(struct mad_stream const *); - -# endif diff --git a/src/lib/dl/ext/libmad/synth.c b/src/lib/dl/ext/libmad/synth.c deleted file mode 100755 index 375e386b..00000000 --- a/src/lib/dl/ext/libmad/synth.c +++ /dev/null @@ -1,857 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: synth.c,v 1.25 2004/01/23 09:41:33 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include "fixed.h" -# include "frame.h" -# include "synth.h" - -/* - * NAME: synth->init() - * DESCRIPTION: initialize synth struct - */ -void mad_synth_init(struct mad_synth *synth) -{ - mad_synth_mute(synth); - - synth->phase = 0; - - synth->pcm.samplerate = 0; - synth->pcm.channels = 0; - synth->pcm.length = 0; -} - -/* - * NAME: synth->mute() - * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis - */ -void mad_synth_mute(struct mad_synth *synth) -{ - unsigned int ch, s, v; - - for (ch = 0; ch < 2; ++ch) { - for (s = 0; s < 16; ++s) { - for (v = 0; v < 8; ++v) { - synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] = - synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0; - } - } - } -} - -/* - * An optional optimization called here the Subband Synthesis Optimization - * (SSO) improves the performance of subband synthesis at the expense of - * accuracy. - * - * The idea is to simplify 32x32->64-bit multiplication to 32x32->32 such - * that extra scaling and rounding are not necessary. This often allows the - * compiler to use faster 32-bit multiply-accumulate instructions instead of - * explicit 64-bit multiply, shift, and add instructions. - * - * SSO works like this: a full 32x32->64-bit multiply of two mad_fixed_t - * values requires the result to be right-shifted 28 bits to be properly - * scaled to the same fixed-point format. Right shifts can be applied at any - * time to either operand or to the result, so the optimization involves - * careful placement of these shifts to minimize the loss of accuracy. - * - * First, a 14-bit shift is applied with rounding at compile-time to the D[] - * table of coefficients for the subband synthesis window. This only loses 2 - * bits of accuracy because the lower 12 bits are always zero. A second - * 12-bit shift occurs after the DCT calculation. This loses 12 bits of - * accuracy. Finally, a third 2-bit shift occurs just before the sample is - * saved in the PCM buffer. 14 + 12 + 2 == 28 bits. - */ - -/* FPM_DEFAULT without OPT_SSO will actually lose accuracy and performance */ - -# if defined(FPM_DEFAULT) && !defined(OPT_SSO) -# define OPT_SSO -# endif - -/* second SSO shift, with rounding */ - -# if defined(OPT_SSO) -# define SHIFT(x) (((x) + (1L << 11)) >> 12) -# else -# define SHIFT(x) (x) -# endif - -/* possible DCT speed optimization */ - -# if defined(OPT_SPEED) && defined(MAD_F_MLX) -# define OPT_DCTO -# define MUL(x, y) \ - ({ mad_fixed64hi_t hi; \ - mad_fixed64lo_t lo; \ - MAD_F_MLX(hi, lo, (x), (y)); \ - hi << (32 - MAD_F_SCALEBITS - 3); \ - }) -# else -# undef OPT_DCTO -# define MUL(x, y) mad_f_mul((x), (y)) -# endif - -/* - * NAME: dct32() - * DESCRIPTION: perform fast in[32]->out[32] DCT - */ -static -void dct32(mad_fixed_t const in[32], unsigned int slot, - mad_fixed_t lo[16][8], mad_fixed_t hi[16][8]) -{ - mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7; - mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15; - mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23; - mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31; - mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39; - mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47; - mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55; - mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63; - mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71; - mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79; - mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87; - mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95; - mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103; - mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111; - mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119; - mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127; - mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135; - mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143; - mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151; - mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159; - mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167; - mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175; - mad_fixed_t t176; - - /* costab[i] = cos(PI / (2 * 32) * i) */ - -# if defined(OPT_DCTO) -# define costab1 MAD_F(0x7fd8878e) -# define costab2 MAD_F(0x7f62368f) -# define costab3 MAD_F(0x7e9d55fc) -# define costab4 MAD_F(0x7d8a5f40) -# define costab5 MAD_F(0x7c29fbee) -# define costab6 MAD_F(0x7a7d055b) -# define costab7 MAD_F(0x78848414) -# define costab8 MAD_F(0x7641af3d) -# define costab9 MAD_F(0x73b5ebd1) -# define costab10 MAD_F(0x70e2cbc6) -# define costab11 MAD_F(0x6dca0d14) -# define costab12 MAD_F(0x6a6d98a4) -# define costab13 MAD_F(0x66cf8120) -# define costab14 MAD_F(0x62f201ac) -# define costab15 MAD_F(0x5ed77c8a) -# define costab16 MAD_F(0x5a82799a) -# define costab17 MAD_F(0x55f5a4d2) -# define costab18 MAD_F(0x5133cc94) -# define costab19 MAD_F(0x4c3fdff4) -# define costab20 MAD_F(0x471cece7) -# define costab21 MAD_F(0x41ce1e65) -# define costab22 MAD_F(0x3c56ba70) -# define costab23 MAD_F(0x36ba2014) -# define costab24 MAD_F(0x30fbc54d) -# define costab25 MAD_F(0x2b1f34eb) -# define costab26 MAD_F(0x25280c5e) -# define costab27 MAD_F(0x1f19f97b) -# define costab28 MAD_F(0x18f8b83c) -# define costab29 MAD_F(0x12c8106f) -# define costab30 MAD_F(0x0c8bd35e) -# define costab31 MAD_F(0x0647d97c) -# else -# define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */ -# define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */ -# define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */ -# define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */ -# define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */ -# define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */ -# define costab7 MAD_F(0x0f109082) /* 0.941544065 */ -# define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */ -# define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */ -# define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */ -# define costab11 MAD_F(0x0db941a3) /* 0.857728610 */ -# define costab12 MAD_F(0x0d4db315) /* 0.831469612 */ -# define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */ -# define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */ -# define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */ -# define costab16 MAD_F(0x0b504f33) /* 0.707106781 */ -# define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */ -# define costab18 MAD_F(0x0a267993) /* 0.634393284 */ -# define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */ -# define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */ -# define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */ -# define costab22 MAD_F(0x078ad74e) /* 0.471396737 */ -# define costab23 MAD_F(0x06d74402) /* 0.427555093 */ -# define costab24 MAD_F(0x061f78aa) /* 0.382683432 */ -# define costab25 MAD_F(0x0563e69d) /* 0.336889853 */ -# define costab26 MAD_F(0x04a5018c) /* 0.290284677 */ -# define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */ -# define costab28 MAD_F(0x031f1708) /* 0.195090322 */ -# define costab29 MAD_F(0x0259020e) /* 0.146730474 */ -# define costab30 MAD_F(0x01917a6c) /* 0.098017140 */ -# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */ -# endif - - t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1); - t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31); - - t41 = t16 + t17; - t59 = MUL(t16 - t17, costab2); - t33 = t0 + t1; - t50 = MUL(t0 - t1, costab2); - - t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15); - t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17); - - t42 = t18 + t19; - t60 = MUL(t18 - t19, costab30); - t34 = t2 + t3; - t51 = MUL(t2 - t3, costab30); - - t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7); - t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25); - - t43 = t20 + t21; - t61 = MUL(t20 - t21, costab14); - t35 = t4 + t5; - t52 = MUL(t4 - t5, costab14); - - t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9); - t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23); - - t44 = t22 + t23; - t62 = MUL(t22 - t23, costab18); - t36 = t6 + t7; - t53 = MUL(t6 - t7, costab18); - - t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3); - t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29); - - t45 = t24 + t25; - t63 = MUL(t24 - t25, costab6); - t37 = t8 + t9; - t54 = MUL(t8 - t9, costab6); - - t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13); - t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19); - - t46 = t26 + t27; - t64 = MUL(t26 - t27, costab26); - t38 = t10 + t11; - t55 = MUL(t10 - t11, costab26); - - t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5); - t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27); - - t47 = t28 + t29; - t65 = MUL(t28 - t29, costab10); - t39 = t12 + t13; - t56 = MUL(t12 - t13, costab10); - - t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11); - t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21); - - t48 = t30 + t31; - t66 = MUL(t30 - t31, costab22); - t40 = t14 + t15; - t57 = MUL(t14 - t15, costab22); - - t69 = t33 + t34; t89 = MUL(t33 - t34, costab4); - t70 = t35 + t36; t90 = MUL(t35 - t36, costab28); - t71 = t37 + t38; t91 = MUL(t37 - t38, costab12); - t72 = t39 + t40; t92 = MUL(t39 - t40, costab20); - t73 = t41 + t42; t94 = MUL(t41 - t42, costab4); - t74 = t43 + t44; t95 = MUL(t43 - t44, costab28); - t75 = t45 + t46; t96 = MUL(t45 - t46, costab12); - t76 = t47 + t48; t97 = MUL(t47 - t48, costab20); - - t78 = t50 + t51; t100 = MUL(t50 - t51, costab4); - t79 = t52 + t53; t101 = MUL(t52 - t53, costab28); - t80 = t54 + t55; t102 = MUL(t54 - t55, costab12); - t81 = t56 + t57; t103 = MUL(t56 - t57, costab20); - - t83 = t59 + t60; t106 = MUL(t59 - t60, costab4); - t84 = t61 + t62; t107 = MUL(t61 - t62, costab28); - t85 = t63 + t64; t108 = MUL(t63 - t64, costab12); - t86 = t65 + t66; t109 = MUL(t65 - t66, costab20); - - t113 = t69 + t70; - t114 = t71 + t72; - - /* 0 */ hi[15][slot] = SHIFT(t113 + t114); - /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16)); - - t115 = t73 + t74; - t116 = t75 + t76; - - t32 = t115 + t116; - - /* 1 */ hi[14][slot] = SHIFT(t32); - - t118 = t78 + t79; - t119 = t80 + t81; - - t58 = t118 + t119; - - /* 2 */ hi[13][slot] = SHIFT(t58); - - t121 = t83 + t84; - t122 = t85 + t86; - - t67 = t121 + t122; - - t49 = (t67 * 2) - t32; - - /* 3 */ hi[12][slot] = SHIFT(t49); - - t125 = t89 + t90; - t126 = t91 + t92; - - t93 = t125 + t126; - - /* 4 */ hi[11][slot] = SHIFT(t93); - - t128 = t94 + t95; - t129 = t96 + t97; - - t98 = t128 + t129; - - t68 = (t98 * 2) - t49; - - /* 5 */ hi[10][slot] = SHIFT(t68); - - t132 = t100 + t101; - t133 = t102 + t103; - - t104 = t132 + t133; - - t82 = (t104 * 2) - t58; - - /* 6 */ hi[ 9][slot] = SHIFT(t82); - - t136 = t106 + t107; - t137 = t108 + t109; - - t110 = t136 + t137; - - t87 = (t110 * 2) - t67; - - t77 = (t87 * 2) - t68; - - /* 7 */ hi[ 8][slot] = SHIFT(t77); - - t141 = MUL(t69 - t70, costab8); - t142 = MUL(t71 - t72, costab24); - t143 = t141 + t142; - - /* 8 */ hi[ 7][slot] = SHIFT(t143); - /* 24 */ lo[ 8][slot] = - SHIFT((MUL(t141 - t142, costab16) * 2) - t143); - - t144 = MUL(t73 - t74, costab8); - t145 = MUL(t75 - t76, costab24); - t146 = t144 + t145; - - t88 = (t146 * 2) - t77; - - /* 9 */ hi[ 6][slot] = SHIFT(t88); - - t148 = MUL(t78 - t79, costab8); - t149 = MUL(t80 - t81, costab24); - t150 = t148 + t149; - - t105 = (t150 * 2) - t82; - - /* 10 */ hi[ 5][slot] = SHIFT(t105); - - t152 = MUL(t83 - t84, costab8); - t153 = MUL(t85 - t86, costab24); - t154 = t152 + t153; - - t111 = (t154 * 2) - t87; - - t99 = (t111 * 2) - t88; - - /* 11 */ hi[ 4][slot] = SHIFT(t99); - - t157 = MUL(t89 - t90, costab8); - t158 = MUL(t91 - t92, costab24); - t159 = t157 + t158; - - t127 = (t159 * 2) - t93; - - /* 12 */ hi[ 3][slot] = SHIFT(t127); - - t160 = (MUL(t125 - t126, costab16) * 2) - t127; - - /* 20 */ lo[ 4][slot] = SHIFT(t160); - /* 28 */ lo[12][slot] = - SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160); - - t161 = MUL(t94 - t95, costab8); - t162 = MUL(t96 - t97, costab24); - t163 = t161 + t162; - - t130 = (t163 * 2) - t98; - - t112 = (t130 * 2) - t99; - - /* 13 */ hi[ 2][slot] = SHIFT(t112); - - t164 = (MUL(t128 - t129, costab16) * 2) - t130; - - t166 = MUL(t100 - t101, costab8); - t167 = MUL(t102 - t103, costab24); - t168 = t166 + t167; - - t134 = (t168 * 2) - t104; - - t120 = (t134 * 2) - t105; - - /* 14 */ hi[ 1][slot] = SHIFT(t120); - - t135 = (MUL(t118 - t119, costab16) * 2) - t120; - - /* 18 */ lo[ 2][slot] = SHIFT(t135); - - t169 = (MUL(t132 - t133, costab16) * 2) - t134; - - t151 = (t169 * 2) - t135; - - /* 22 */ lo[ 6][slot] = SHIFT(t151); - - t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151; - - /* 26 */ lo[10][slot] = SHIFT(t170); - /* 30 */ lo[14][slot] = - SHIFT((((((MUL(t166 - t167, costab16) * 2) - - t168) * 2) - t169) * 2) - t170); - - t171 = MUL(t106 - t107, costab8); - t172 = MUL(t108 - t109, costab24); - t173 = t171 + t172; - - t138 = (t173 * 2) - t110; - - t123 = (t138 * 2) - t111; - - t139 = (MUL(t121 - t122, costab16) * 2) - t123; - - t117 = (t123 * 2) - t112; - - /* 15 */ hi[ 0][slot] = SHIFT(t117); - - t124 = (MUL(t115 - t116, costab16) * 2) - t117; - - /* 17 */ lo[ 1][slot] = SHIFT(t124); - - t131 = (t139 * 2) - t124; - - /* 19 */ lo[ 3][slot] = SHIFT(t131); - - t140 = (t164 * 2) - t131; - - /* 21 */ lo[ 5][slot] = SHIFT(t140); - - t174 = (MUL(t136 - t137, costab16) * 2) - t138; - - t155 = (t174 * 2) - t139; - - t147 = (t155 * 2) - t140; - - /* 23 */ lo[ 7][slot] = SHIFT(t147); - - t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147; - - /* 25 */ lo[ 9][slot] = SHIFT(t156); - - t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155; - - t165 = (t175 * 2) - t156; - - /* 27 */ lo[11][slot] = SHIFT(t165); - - t176 = (((((MUL(t161 - t162, costab16) * 2) - - t163) * 2) - t164) * 2) - t165; - - /* 29 */ lo[13][slot] = SHIFT(t176); - /* 31 */ lo[15][slot] = - SHIFT((((((((MUL(t171 - t172, costab16) * 2) - - t173) * 2) - t174) * 2) - t175) * 2) - t176); - - /* - * Totals: - * 80 multiplies - * 80 additions - * 119 subtractions - * 49 shifts (not counting SSO) - */ -} - -# undef MUL -# undef SHIFT - -/* third SSO shift and/or D[] optimization preshift */ - -# if defined(OPT_SSO) -# if MAD_F_FRACBITS != 28 -# error "MAD_F_FRACBITS must be 28 to use OPT_SSO" -# endif -# define ML0(hi, lo, x, y) ((lo) = (x) * (y)) -# define MLA(hi, lo, x, y) ((lo) += (x) * (y)) -# define MLN(hi, lo) ((lo) = -(lo)) -# define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) -# define SHIFT(x) ((x) >> 2) -# define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14) -# else -# define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y)) -# define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y)) -# define MLN(hi, lo) MAD_F_MLN((hi), (lo)) -# define MLZ(hi, lo) MAD_F_MLZ((hi), (lo)) -# define SHIFT(x) (x) -# if defined(MAD_F_SCALEBITS) -# undef MAD_F_SCALEBITS -# define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12) -# define PRESHIFT(x) (MAD_F(x) >> 12) -# else -# define PRESHIFT(x) MAD_F(x) -# endif -# endif - -static -mad_fixed_t const D[17][32] = { -# include "d.dat" -}; - -# if defined(ASO_SYNTH) -void synth_full(struct mad_synth *, struct mad_frame const *, - unsigned int, unsigned int); -# else -/* - * NAME: synth->full() - * DESCRIPTION: perform full frequency PCM synthesis - */ -static -void synth_full(struct mad_synth *synth, struct mad_frame const *frame, - unsigned int nch, unsigned int ns) -{ - unsigned int phase, ch, s, sb, pe, po; - mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; - mad_fixed_t const (*sbsample)[36][32]; - register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; - register mad_fixed_t const (*Dptr)[32], *ptr; - register mad_fixed64hi_t hi; - register mad_fixed64lo_t lo; - - for (ch = 0; ch < nch; ++ch) { - sbsample = &frame->sbsample[ch]; - filter = &synth->filter[ch]; - phase = synth->phase; - pcm1 = synth->pcm.samples[ch]; - - for (s = 0; s < ns; ++s) { - dct32((*sbsample)[s], phase >> 1, - (*filter)[0][phase & 1], (*filter)[1][phase & 1]); - - pe = phase & ~1; - po = ((phase - 1) & 0xf) | 1; - - /* calculate 32 samples */ - - fe = &(*filter)[0][ phase & 1][0]; - fx = &(*filter)[0][~phase & 1][0]; - fo = &(*filter)[1][~phase & 1][0]; - - Dptr = &D[0]; - - ptr = *Dptr + po; - ML0(hi, lo, (*fx)[0], ptr[ 0]); - MLA(hi, lo, (*fx)[1], ptr[14]); - MLA(hi, lo, (*fx)[2], ptr[12]); - MLA(hi, lo, (*fx)[3], ptr[10]); - MLA(hi, lo, (*fx)[4], ptr[ 8]); - MLA(hi, lo, (*fx)[5], ptr[ 6]); - MLA(hi, lo, (*fx)[6], ptr[ 4]); - MLA(hi, lo, (*fx)[7], ptr[ 2]); - MLN(hi, lo); - - ptr = *Dptr + pe; - MLA(hi, lo, (*fe)[0], ptr[ 0]); - MLA(hi, lo, (*fe)[1], ptr[14]); - MLA(hi, lo, (*fe)[2], ptr[12]); - MLA(hi, lo, (*fe)[3], ptr[10]); - MLA(hi, lo, (*fe)[4], ptr[ 8]); - MLA(hi, lo, (*fe)[5], ptr[ 6]); - MLA(hi, lo, (*fe)[6], ptr[ 4]); - MLA(hi, lo, (*fe)[7], ptr[ 2]); - - *pcm1++ = SHIFT(MLZ(hi, lo)); - - pcm2 = pcm1 + 30; - - for (sb = 1; sb < 16; ++sb) { - ++fe; - ++Dptr; - - /* D[32 - sb][i] == -D[sb][31 - i] */ - - ptr = *Dptr + po; - ML0(hi, lo, (*fo)[0], ptr[ 0]); - MLA(hi, lo, (*fo)[1], ptr[14]); - MLA(hi, lo, (*fo)[2], ptr[12]); - MLA(hi, lo, (*fo)[3], ptr[10]); - MLA(hi, lo, (*fo)[4], ptr[ 8]); - MLA(hi, lo, (*fo)[5], ptr[ 6]); - MLA(hi, lo, (*fo)[6], ptr[ 4]); - MLA(hi, lo, (*fo)[7], ptr[ 2]); - MLN(hi, lo); - - ptr = *Dptr + pe; - MLA(hi, lo, (*fe)[7], ptr[ 2]); - MLA(hi, lo, (*fe)[6], ptr[ 4]); - MLA(hi, lo, (*fe)[5], ptr[ 6]); - MLA(hi, lo, (*fe)[4], ptr[ 8]); - MLA(hi, lo, (*fe)[3], ptr[10]); - MLA(hi, lo, (*fe)[2], ptr[12]); - MLA(hi, lo, (*fe)[1], ptr[14]); - MLA(hi, lo, (*fe)[0], ptr[ 0]); - - *pcm1++ = SHIFT(MLZ(hi, lo)); - - ptr = *Dptr - pe; - ML0(hi, lo, (*fe)[0], ptr[31 - 16]); - MLA(hi, lo, (*fe)[1], ptr[31 - 14]); - MLA(hi, lo, (*fe)[2], ptr[31 - 12]); - MLA(hi, lo, (*fe)[3], ptr[31 - 10]); - MLA(hi, lo, (*fe)[4], ptr[31 - 8]); - MLA(hi, lo, (*fe)[5], ptr[31 - 6]); - MLA(hi, lo, (*fe)[6], ptr[31 - 4]); - MLA(hi, lo, (*fe)[7], ptr[31 - 2]); - - ptr = *Dptr - po; - MLA(hi, lo, (*fo)[7], ptr[31 - 2]); - MLA(hi, lo, (*fo)[6], ptr[31 - 4]); - MLA(hi, lo, (*fo)[5], ptr[31 - 6]); - MLA(hi, lo, (*fo)[4], ptr[31 - 8]); - MLA(hi, lo, (*fo)[3], ptr[31 - 10]); - MLA(hi, lo, (*fo)[2], ptr[31 - 12]); - MLA(hi, lo, (*fo)[1], ptr[31 - 14]); - MLA(hi, lo, (*fo)[0], ptr[31 - 16]); - - *pcm2-- = SHIFT(MLZ(hi, lo)); - - ++fo; - } - - ++Dptr; - - ptr = *Dptr + po; - ML0(hi, lo, (*fo)[0], ptr[ 0]); - MLA(hi, lo, (*fo)[1], ptr[14]); - MLA(hi, lo, (*fo)[2], ptr[12]); - MLA(hi, lo, (*fo)[3], ptr[10]); - MLA(hi, lo, (*fo)[4], ptr[ 8]); - MLA(hi, lo, (*fo)[5], ptr[ 6]); - MLA(hi, lo, (*fo)[6], ptr[ 4]); - MLA(hi, lo, (*fo)[7], ptr[ 2]); - - *pcm1 = SHIFT(-MLZ(hi, lo)); - pcm1 += 16; - - phase = (phase + 1) % 16; - } - } -} -# endif - -/* - * NAME: synth->half() - * DESCRIPTION: perform half frequency PCM synthesis - */ -static -void synth_half(struct mad_synth *synth, struct mad_frame const *frame, - unsigned int nch, unsigned int ns) -{ - unsigned int phase, ch, s, sb, pe, po; - mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8]; - mad_fixed_t const (*sbsample)[36][32]; - register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8]; - register mad_fixed_t const (*Dptr)[32], *ptr; - register mad_fixed64hi_t hi; - register mad_fixed64lo_t lo; - - for (ch = 0; ch < nch; ++ch) { - sbsample = &frame->sbsample[ch]; - filter = &synth->filter[ch]; - phase = synth->phase; - pcm1 = synth->pcm.samples[ch]; - - for (s = 0; s < ns; ++s) { - dct32((*sbsample)[s], phase >> 1, - (*filter)[0][phase & 1], (*filter)[1][phase & 1]); - - pe = phase & ~1; - po = ((phase - 1) & 0xf) | 1; - - /* calculate 16 samples */ - - fe = &(*filter)[0][ phase & 1][0]; - fx = &(*filter)[0][~phase & 1][0]; - fo = &(*filter)[1][~phase & 1][0]; - - Dptr = &D[0]; - - ptr = *Dptr + po; - ML0(hi, lo, (*fx)[0], ptr[ 0]); - MLA(hi, lo, (*fx)[1], ptr[14]); - MLA(hi, lo, (*fx)[2], ptr[12]); - MLA(hi, lo, (*fx)[3], ptr[10]); - MLA(hi, lo, (*fx)[4], ptr[ 8]); - MLA(hi, lo, (*fx)[5], ptr[ 6]); - MLA(hi, lo, (*fx)[6], ptr[ 4]); - MLA(hi, lo, (*fx)[7], ptr[ 2]); - MLN(hi, lo); - - ptr = *Dptr + pe; - MLA(hi, lo, (*fe)[0], ptr[ 0]); - MLA(hi, lo, (*fe)[1], ptr[14]); - MLA(hi, lo, (*fe)[2], ptr[12]); - MLA(hi, lo, (*fe)[3], ptr[10]); - MLA(hi, lo, (*fe)[4], ptr[ 8]); - MLA(hi, lo, (*fe)[5], ptr[ 6]); - MLA(hi, lo, (*fe)[6], ptr[ 4]); - MLA(hi, lo, (*fe)[7], ptr[ 2]); - - *pcm1++ = SHIFT(MLZ(hi, lo)); - - pcm2 = pcm1 + 14; - - for (sb = 1; sb < 16; ++sb) { - ++fe; - ++Dptr; - - /* D[32 - sb][i] == -D[sb][31 - i] */ - - if (!(sb & 1)) { - ptr = *Dptr + po; - ML0(hi, lo, (*fo)[0], ptr[ 0]); - MLA(hi, lo, (*fo)[1], ptr[14]); - MLA(hi, lo, (*fo)[2], ptr[12]); - MLA(hi, lo, (*fo)[3], ptr[10]); - MLA(hi, lo, (*fo)[4], ptr[ 8]); - MLA(hi, lo, (*fo)[5], ptr[ 6]); - MLA(hi, lo, (*fo)[6], ptr[ 4]); - MLA(hi, lo, (*fo)[7], ptr[ 2]); - MLN(hi, lo); - - ptr = *Dptr + pe; - MLA(hi, lo, (*fe)[7], ptr[ 2]); - MLA(hi, lo, (*fe)[6], ptr[ 4]); - MLA(hi, lo, (*fe)[5], ptr[ 6]); - MLA(hi, lo, (*fe)[4], ptr[ 8]); - MLA(hi, lo, (*fe)[3], ptr[10]); - MLA(hi, lo, (*fe)[2], ptr[12]); - MLA(hi, lo, (*fe)[1], ptr[14]); - MLA(hi, lo, (*fe)[0], ptr[ 0]); - - *pcm1++ = SHIFT(MLZ(hi, lo)); - - ptr = *Dptr - po; - ML0(hi, lo, (*fo)[7], ptr[31 - 2]); - MLA(hi, lo, (*fo)[6], ptr[31 - 4]); - MLA(hi, lo, (*fo)[5], ptr[31 - 6]); - MLA(hi, lo, (*fo)[4], ptr[31 - 8]); - MLA(hi, lo, (*fo)[3], ptr[31 - 10]); - MLA(hi, lo, (*fo)[2], ptr[31 - 12]); - MLA(hi, lo, (*fo)[1], ptr[31 - 14]); - MLA(hi, lo, (*fo)[0], ptr[31 - 16]); - - ptr = *Dptr - pe; - MLA(hi, lo, (*fe)[0], ptr[31 - 16]); - MLA(hi, lo, (*fe)[1], ptr[31 - 14]); - MLA(hi, lo, (*fe)[2], ptr[31 - 12]); - MLA(hi, lo, (*fe)[3], ptr[31 - 10]); - MLA(hi, lo, (*fe)[4], ptr[31 - 8]); - MLA(hi, lo, (*fe)[5], ptr[31 - 6]); - MLA(hi, lo, (*fe)[6], ptr[31 - 4]); - MLA(hi, lo, (*fe)[7], ptr[31 - 2]); - - *pcm2-- = SHIFT(MLZ(hi, lo)); - } - - ++fo; - } - - ++Dptr; - - ptr = *Dptr + po; - ML0(hi, lo, (*fo)[0], ptr[ 0]); - MLA(hi, lo, (*fo)[1], ptr[14]); - MLA(hi, lo, (*fo)[2], ptr[12]); - MLA(hi, lo, (*fo)[3], ptr[10]); - MLA(hi, lo, (*fo)[4], ptr[ 8]); - MLA(hi, lo, (*fo)[5], ptr[ 6]); - MLA(hi, lo, (*fo)[6], ptr[ 4]); - MLA(hi, lo, (*fo)[7], ptr[ 2]); - - *pcm1 = SHIFT(-MLZ(hi, lo)); - pcm1 += 8; - - phase = (phase + 1) % 16; - } - } -} - -/* - * NAME: synth->frame() - * DESCRIPTION: perform PCM synthesis of frame subband samples - */ -void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame) -{ - unsigned int nch, ns; - void (*synth_frame)(struct mad_synth *, struct mad_frame const *, - unsigned int, unsigned int); - - nch = MAD_NCHANNELS(&frame->header); - ns = MAD_NSBSAMPLES(&frame->header); - - synth->pcm.samplerate = frame->header.samplerate; - synth->pcm.channels = nch; - synth->pcm.length = 32 * ns; - - synth_frame = synth_full; - - if (frame->options & MAD_OPTION_HALFSAMPLERATE) { - synth->pcm.samplerate /= 2; - synth->pcm.length /= 2; - - synth_frame = synth_half; - } - - synth_frame(synth, frame, nch, ns); - - synth->phase = (synth->phase + ns) % 16; -} diff --git a/src/lib/dl/ext/libmad/synth.h b/src/lib/dl/ext/libmad/synth.h deleted file mode 100755 index 8ae4bc95..00000000 --- a/src/lib/dl/ext/libmad/synth.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp $ - */ - -# ifndef LIBMAD_SYNTH_H -# define LIBMAD_SYNTH_H - -# include "fixed.h" -# include "frame.h" - -struct mad_pcm { - unsigned int samplerate; /* sampling frequency (Hz) */ - unsigned short channels; /* number of channels */ - unsigned short length; /* number of samples per channel */ - mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */ -}; - -struct mad_synth { - mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */ - /* [ch][eo][peo][s][v] */ - - unsigned int phase; /* current processing phase */ - - struct mad_pcm pcm; /* PCM output */ -}; - -/* single channel PCM selector */ -enum { - MAD_PCM_CHANNEL_SINGLE = 0 -}; - -/* dual channel PCM selector */ -enum { - MAD_PCM_CHANNEL_DUAL_1 = 0, - MAD_PCM_CHANNEL_DUAL_2 = 1 -}; - -/* stereo PCM selector */ -enum { - MAD_PCM_CHANNEL_STEREO_LEFT = 0, - MAD_PCM_CHANNEL_STEREO_RIGHT = 1 -}; - -void mad_synth_init(struct mad_synth *); - -# define mad_synth_finish(synth) /* nothing */ - -void mad_synth_mute(struct mad_synth *); - -void mad_synth_frame(struct mad_synth *, struct mad_frame const *); - -# endif diff --git a/src/lib/dl/ext/libmad/timer.c b/src/lib/dl/ext/libmad/timer.c deleted file mode 100755 index 4b909aba..00000000 --- a/src/lib/dl/ext/libmad/timer.c +++ /dev/null @@ -1,485 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: timer.c,v 1.18 2004/01/23 09:41:33 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include <stdio.h> - -# ifdef HAVE_ASSERT_H -# include <assert.h> -# endif - -# include "timer.h" - -mad_timer_t const mad_timer_zero = { 0, 0 }; - -/* - * NAME: timer->compare() - * DESCRIPTION: indicate relative order of two timers - */ -int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2) -{ - signed long diff; - - diff = timer1.seconds - timer2.seconds; - if (diff < 0) - return -1; - else if (diff > 0) - return +1; - - diff = timer1.fraction - timer2.fraction; - if (diff < 0) - return -1; - else if (diff > 0) - return +1; - - return 0; -} - -/* - * NAME: timer->negate() - * DESCRIPTION: invert the sign of a timer - */ -void mad_timer_negate(mad_timer_t *timer) -{ - timer->seconds = -timer->seconds; - - if (timer->fraction) { - timer->seconds -= 1; - timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction; - } -} - -/* - * NAME: timer->abs() - * DESCRIPTION: return the absolute value of a timer - */ -mad_timer_t mad_timer_abs(mad_timer_t timer) -{ - if (timer.seconds < 0) - mad_timer_negate(&timer); - - return timer; -} - -/* - * NAME: reduce_timer() - * DESCRIPTION: carry timer fraction into seconds - */ -static -void reduce_timer(mad_timer_t *timer) -{ - timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION; - timer->fraction %= MAD_TIMER_RESOLUTION; -} - -/* - * NAME: gcd() - * DESCRIPTION: compute greatest common denominator - */ -static -unsigned long gcd(unsigned long num1, unsigned long num2) -{ - unsigned long tmp; - - while (num2) { - tmp = num2; - num2 = num1 % num2; - num1 = tmp; - } - - return num1; -} - -/* - * NAME: reduce_rational() - * DESCRIPTION: convert rational expression to lowest terms - */ -static -void reduce_rational(unsigned long *numer, unsigned long *denom) -{ - unsigned long factor; - - factor = gcd(*numer, *denom); - - assert(factor != 0); - - *numer /= factor; - *denom /= factor; -} - -/* - * NAME: scale_rational() - * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing - */ -static -unsigned long scale_rational(unsigned long numer, unsigned long denom, - unsigned long scale) -{ - reduce_rational(&numer, &denom); - reduce_rational(&scale, &denom); - - assert(denom != 0); - - if (denom < scale) - return numer * (scale / denom) + numer * (scale % denom) / denom; - if (denom < numer) - return scale * (numer / denom) + scale * (numer % denom) / denom; - - return numer * scale / denom; -} - -/* - * NAME: timer->set() - * DESCRIPTION: set timer to specific (positive) value - */ -void mad_timer_set(mad_timer_t *timer, unsigned long seconds, - unsigned long numer, unsigned long denom) -{ - timer->seconds = seconds; - if (numer >= denom && denom > 0) { - timer->seconds += numer / denom; - numer %= denom; - } - - switch (denom) { - case 0: - case 1: - timer->fraction = 0; - break; - - case MAD_TIMER_RESOLUTION: - timer->fraction = numer; - break; - - case 1000: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000); - break; - - case 8000: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000); - break; - - case 11025: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025); - break; - - case 12000: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000); - break; - - case 16000: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000); - break; - - case 22050: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050); - break; - - case 24000: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000); - break; - - case 32000: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000); - break; - - case 44100: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100); - break; - - case 48000: - timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000); - break; - - default: - timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION); - break; - } - - if (timer->fraction >= MAD_TIMER_RESOLUTION) - reduce_timer(timer); -} - -/* - * NAME: timer->add() - * DESCRIPTION: add one timer to another - */ -void mad_timer_add(mad_timer_t *timer, mad_timer_t incr) -{ - timer->seconds += incr.seconds; - timer->fraction += incr.fraction; - - if (timer->fraction >= MAD_TIMER_RESOLUTION) - reduce_timer(timer); -} - -/* - * NAME: timer->multiply() - * DESCRIPTION: multiply a timer by a scalar value - */ -void mad_timer_multiply(mad_timer_t *timer, signed long scalar) -{ - mad_timer_t addend; - unsigned long factor; - - factor = scalar; - if (scalar < 0) { - factor = -scalar; - mad_timer_negate(timer); - } - - addend = *timer; - *timer = mad_timer_zero; - - while (factor) { - if (factor & 1) - mad_timer_add(timer, addend); - - mad_timer_add(&addend, addend); - factor >>= 1; - } -} - -/* - * NAME: timer->count() - * DESCRIPTION: return timer value in selected units - */ -signed long mad_timer_count(mad_timer_t timer, enum mad_units units) -{ - switch (units) { - case MAD_UNITS_HOURS: - return timer.seconds / 60 / 60; - - case MAD_UNITS_MINUTES: - return timer.seconds / 60; - - case MAD_UNITS_SECONDS: - return timer.seconds; - - case MAD_UNITS_DECISECONDS: - case MAD_UNITS_CENTISECONDS: - case MAD_UNITS_MILLISECONDS: - - case MAD_UNITS_8000_HZ: - case MAD_UNITS_11025_HZ: - case MAD_UNITS_12000_HZ: - case MAD_UNITS_16000_HZ: - case MAD_UNITS_22050_HZ: - case MAD_UNITS_24000_HZ: - case MAD_UNITS_32000_HZ: - case MAD_UNITS_44100_HZ: - case MAD_UNITS_48000_HZ: - - case MAD_UNITS_24_FPS: - case MAD_UNITS_25_FPS: - case MAD_UNITS_30_FPS: - case MAD_UNITS_48_FPS: - case MAD_UNITS_50_FPS: - case MAD_UNITS_60_FPS: - case MAD_UNITS_75_FPS: - return timer.seconds * (signed long) units + - (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, - units); - - case MAD_UNITS_23_976_FPS: - case MAD_UNITS_24_975_FPS: - case MAD_UNITS_29_97_FPS: - case MAD_UNITS_47_952_FPS: - case MAD_UNITS_49_95_FPS: - case MAD_UNITS_59_94_FPS: - return (mad_timer_count(timer, -units) + 1) * 1000 / 1001; - } - - /* unsupported units */ - return 0; -} - -/* - * NAME: timer->fraction() - * DESCRIPTION: return fractional part of timer in arbitrary terms - */ -unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom) -{ - timer = mad_timer_abs(timer); - - switch (denom) { - case 0: - return timer.fraction ? - MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1; - - case MAD_TIMER_RESOLUTION: - return timer.fraction; - - default: - return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom); - } -} - -/* - * NAME: timer->string() - * DESCRIPTION: write a string representation of a timer using a template - */ -void mad_timer_string(mad_timer_t timer, - char *dest, char const *format, enum mad_units units, - enum mad_units fracunits, unsigned long subparts) -{ - unsigned long hours, minutes, seconds, sub; - unsigned int frac; - - timer = mad_timer_abs(timer); - - seconds = timer.seconds; - frac = sub = 0; - - switch (fracunits) { - case MAD_UNITS_HOURS: - case MAD_UNITS_MINUTES: - case MAD_UNITS_SECONDS: - break; - - case MAD_UNITS_DECISECONDS: - case MAD_UNITS_CENTISECONDS: - case MAD_UNITS_MILLISECONDS: - - case MAD_UNITS_8000_HZ: - case MAD_UNITS_11025_HZ: - case MAD_UNITS_12000_HZ: - case MAD_UNITS_16000_HZ: - case MAD_UNITS_22050_HZ: - case MAD_UNITS_24000_HZ: - case MAD_UNITS_32000_HZ: - case MAD_UNITS_44100_HZ: - case MAD_UNITS_48000_HZ: - - case MAD_UNITS_24_FPS: - case MAD_UNITS_25_FPS: - case MAD_UNITS_30_FPS: - case MAD_UNITS_48_FPS: - case MAD_UNITS_50_FPS: - case MAD_UNITS_60_FPS: - case MAD_UNITS_75_FPS: - { - unsigned long denom; - - denom = MAD_TIMER_RESOLUTION / fracunits; - - frac = timer.fraction / denom; - sub = scale_rational(timer.fraction % denom, denom, subparts); - } - break; - - case MAD_UNITS_23_976_FPS: - case MAD_UNITS_24_975_FPS: - case MAD_UNITS_29_97_FPS: - case MAD_UNITS_47_952_FPS: - case MAD_UNITS_49_95_FPS: - case MAD_UNITS_59_94_FPS: - /* drop-frame encoding */ - /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */ - { - unsigned long frame, cycle, d, m; - - frame = mad_timer_count(timer, fracunits); - - cycle = -fracunits * 60 * 10 - (10 - 1) * 2; - - d = frame / cycle; - m = frame % cycle; - frame += (10 - 1) * 2 * d; - if (m > 2) - frame += 2 * ((m - 2) / (cycle / 10)); - - frac = frame % -fracunits; - seconds = frame / -fracunits; - } - break; - } - - switch (units) { - case MAD_UNITS_HOURS: - minutes = seconds / 60; - hours = minutes / 60; - - sprintf(dest, format, - hours, - (unsigned int) (minutes % 60), - (unsigned int) (seconds % 60), - frac, sub); - break; - - case MAD_UNITS_MINUTES: - minutes = seconds / 60; - - sprintf(dest, format, - minutes, - (unsigned int) (seconds % 60), - frac, sub); - break; - - case MAD_UNITS_SECONDS: - sprintf(dest, format, - seconds, - frac, sub); - break; - - case MAD_UNITS_23_976_FPS: - case MAD_UNITS_24_975_FPS: - case MAD_UNITS_29_97_FPS: - case MAD_UNITS_47_952_FPS: - case MAD_UNITS_49_95_FPS: - case MAD_UNITS_59_94_FPS: - if (fracunits < 0) { - /* not yet implemented */ - sub = 0; - } - - /* fall through */ - - case MAD_UNITS_DECISECONDS: - case MAD_UNITS_CENTISECONDS: - case MAD_UNITS_MILLISECONDS: - - case MAD_UNITS_8000_HZ: - case MAD_UNITS_11025_HZ: - case MAD_UNITS_12000_HZ: - case MAD_UNITS_16000_HZ: - case MAD_UNITS_22050_HZ: - case MAD_UNITS_24000_HZ: - case MAD_UNITS_32000_HZ: - case MAD_UNITS_44100_HZ: - case MAD_UNITS_48000_HZ: - - case MAD_UNITS_24_FPS: - case MAD_UNITS_25_FPS: - case MAD_UNITS_30_FPS: - case MAD_UNITS_48_FPS: - case MAD_UNITS_50_FPS: - case MAD_UNITS_60_FPS: - case MAD_UNITS_75_FPS: - sprintf(dest, format, mad_timer_count(timer, units), sub); - break; - } -} diff --git a/src/lib/dl/ext/libmad/timer.h b/src/lib/dl/ext/libmad/timer.h deleted file mode 100755 index eb4542bb..00000000 --- a/src/lib/dl/ext/libmad/timer.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp $ - */ - -# ifndef LIBMAD_TIMER_H -# define LIBMAD_TIMER_H - -typedef struct { - signed long seconds; /* whole seconds */ - unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ -} mad_timer_t; - -extern mad_timer_t const mad_timer_zero; - -# define MAD_TIMER_RESOLUTION 352800000UL - -enum mad_units { - MAD_UNITS_HOURS = -2, - MAD_UNITS_MINUTES = -1, - MAD_UNITS_SECONDS = 0, - - /* metric units */ - - MAD_UNITS_DECISECONDS = 10, - MAD_UNITS_CENTISECONDS = 100, - MAD_UNITS_MILLISECONDS = 1000, - - /* audio sample units */ - - MAD_UNITS_8000_HZ = 8000, - MAD_UNITS_11025_HZ = 11025, - MAD_UNITS_12000_HZ = 12000, - - MAD_UNITS_16000_HZ = 16000, - MAD_UNITS_22050_HZ = 22050, - MAD_UNITS_24000_HZ = 24000, - - MAD_UNITS_32000_HZ = 32000, - MAD_UNITS_44100_HZ = 44100, - MAD_UNITS_48000_HZ = 48000, - - /* video frame/field units */ - - MAD_UNITS_24_FPS = 24, - MAD_UNITS_25_FPS = 25, - MAD_UNITS_30_FPS = 30, - MAD_UNITS_48_FPS = 48, - MAD_UNITS_50_FPS = 50, - MAD_UNITS_60_FPS = 60, - - /* CD audio frames */ - - MAD_UNITS_75_FPS = 75, - - /* video drop-frame units */ - - MAD_UNITS_23_976_FPS = -24, - MAD_UNITS_24_975_FPS = -25, - MAD_UNITS_29_97_FPS = -30, - MAD_UNITS_47_952_FPS = -48, - MAD_UNITS_49_95_FPS = -50, - MAD_UNITS_59_94_FPS = -60 -}; - -# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero)) - -int mad_timer_compare(mad_timer_t, mad_timer_t); - -# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero) - -void mad_timer_negate(mad_timer_t *); -mad_timer_t mad_timer_abs(mad_timer_t); - -void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long); -void mad_timer_add(mad_timer_t *, mad_timer_t); -void mad_timer_multiply(mad_timer_t *, signed long); - -signed long mad_timer_count(mad_timer_t, enum mad_units); -unsigned long mad_timer_fraction(mad_timer_t, unsigned long); -void mad_timer_string(mad_timer_t, char *, char const *, - enum mad_units, enum mad_units, unsigned long); - -# endif diff --git a/src/lib/dl/ext/libmad/version.c b/src/lib/dl/ext/libmad/version.c deleted file mode 100755 index e643fa71..00000000 --- a/src/lib/dl/ext/libmad/version.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: version.c,v 1.15 2004/01/23 09:41:33 rob Exp $ - */ - -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# include "global.h" - -# include "version.h" - -char const mad_version[] = "MPEG Audio Decoder " MAD_VERSION; -char const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR; -char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">"; - -char const mad_build[] = "" -# if defined(DEBUG) - "DEBUG " -# elif defined(NDEBUG) - "NDEBUG " -# endif - -# if defined(EXPERIMENTAL) - "EXPERIMENTAL " -# endif - -# if defined(FPM_64BIT) - "FPM_64BIT " -# elif defined(FPM_INTEL) - "FPM_INTEL " -# elif defined(FPM_ARM) - "FPM_ARM " -# elif defined(FPM_MIPS) - "FPM_MIPS " -# elif defined(FPM_SPARC) - "FPM_SPARC " -# elif defined(FPM_PPC) - "FPM_PPC " -# elif defined(FPM_DEFAULT) - "FPM_DEFAULT " -# endif - -# if defined(ASO_IMDCT) - "ASO_IMDCT " -# endif -# if defined(ASO_INTERLEAVE1) - "ASO_INTERLEAVE1 " -# endif -# if defined(ASO_INTERLEAVE2) - "ASO_INTERLEAVE2 " -# endif -# if defined(ASO_ZEROCHECK) - "ASO_ZEROCHECK " -# endif - -# if defined(OPT_SPEED) - "OPT_SPEED " -# elif defined(OPT_ACCURACY) - "OPT_ACCURACY " -# endif - -# if defined(OPT_SSO) - "OPT_SSO " -# endif - -# if defined(OPT_DCTO) /* never defined here */ - "OPT_DCTO " -# endif - -# if defined(OPT_STRICT) - "OPT_STRICT " -# endif -; diff --git a/src/lib/dl/ext/libmad/version.h b/src/lib/dl/ext/libmad/version.h deleted file mode 100755 index d215d4c1..00000000 --- a/src/lib/dl/ext/libmad/version.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * libmad - MPEG audio decoder library - * Copyright (C) 2000-2004 Underbit Technologies, Inc. - * - * 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: version.h,v 1.26 2004/01/23 09:41:33 rob Exp $ - */ - -# ifndef LIBMAD_VERSION_H -# define LIBMAD_VERSION_H - -# define MAD_VERSION_MAJOR 0 -# define MAD_VERSION_MINOR 15 -# define MAD_VERSION_PATCH 1 -# define MAD_VERSION_EXTRA " (beta)" - -# define MAD_VERSION_STRINGIZE(str) #str -# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) - -# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ - MAD_VERSION_STRING(MAD_VERSION_PATCH) \ - MAD_VERSION_EXTRA - -# define MAD_PUBLISHYEAR "2000-2004" -# define MAD_AUTHOR "Underbit Technologies, Inc." -# define MAD_EMAIL "info@underbit.com" - -extern char const mad_version[]; -extern char const mad_copyright[]; -extern char const mad_author[]; -extern char const mad_build[]; - -# endif diff --git a/src/lib/dl/ext/libogg/CLEAN.BAT b/src/lib/dl/ext/libogg/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/libogg/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/libogg/MAKE.BAT b/src/lib/dl/ext/libogg/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/libogg/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/libogg/bitwise.c b/src/lib/dl/ext/libogg/bitwise.c deleted file mode 100755 index f62f2818..00000000 --- a/src/lib/dl/ext/libogg/bitwise.c +++ /dev/null @@ -1,857 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE Ogg CONTAINER 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-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: packing variable sized words into an octet stream - last mod: $Id: bitwise.c 18051 2011-08-04 17:56:39Z giles $ - - ********************************************************************/ - -/* We're 'LSb' endian; if we write a word but read individual bits, - then we'll read the lsb first */ - -#include <string.h> -#include <stdlib.h> -#include <limits.h> -#include <ext/libogg/ogg.h> - -#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); -} - -int oggpack_writecheck(oggpack_buffer *b){ - if(!b->ptr || !b->storage)return -1; - return 0; -} - -int oggpackB_writecheck(oggpack_buffer *b){ - return oggpack_writecheck(b); -} - -void oggpack_writetrunc(oggpack_buffer *b,long bits){ - long bytes=bits>>3; - if(b->ptr){ - 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; - if(b->ptr){ - 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(bits<0 || bits>32) goto err; - if(b->endbyte>=b->storage-4){ - void *ret; - if(!b->ptr)return; - if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err; - ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); - if(!ret) goto err; - b->buffer=ret; - b->storage+=BUFFER_INCREMENT; - b->ptr=b->buffer+b->endbyte; - } - - value&=mask[bits]; - bits+=b->endbit; - - b->ptr[0]|=value<<b->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; - return; - err: - oggpack_writeclear(b); -} - -/* Takes only up to 32 bits. */ -void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){ - if(bits<0 || bits>32) goto err; - if(b->endbyte>=b->storage-4){ - void *ret; - if(!b->ptr)return; - if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err; - ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); - if(!ret) goto err; - b->buffer=ret; - 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; - return; - err: - oggpack_writeclear(b); -} - -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;i<bytes;i++) - w(b,(unsigned long)(ptr[i]),8); - }else{ - /* aligned block copy */ - if(b->endbyte+bytes+1>=b->storage){ - void *ret; - if(!b->ptr) goto err; - if(b->endbyte+bytes+BUFFER_INCREMENT>b->storage) goto err; - b->storage=b->endbyte+bytes+BUFFER_INCREMENT; - ret=_ogg_realloc(b->buffer,b->storage); - if(!ret) goto err; - b->buffer=ret; - 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); - } - return; - err: - oggpack_writeclear(b); -} - -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){ - if(!b->ptr)return; - 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){ - if(b->buffer)_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; - - if(bits<0 || bits>32) return -1; - m=mask[bits]; - bits+=b->endbit; - - if(b->endbyte >= b->storage-4){ - /* not the main path */ - if(b->endbyte > b->storage-((bits+7)>>3)) return -1; - /* special case to avoid reading b->ptr[0], which might be past the end of - the buffer; also skips some useless accounting */ - else if(!bits)return(0L); - } - - 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; - - if(m<0 || m>32) return -1; - bits+=b->endbit; - - if(b->endbyte >= b->storage-4){ - /* not the main path */ - if(b->endbyte > b->storage-((bits+7)>>3)) return -1; - /* special case to avoid reading b->ptr[0], which might be past the end of - the buffer; also skips some useless accounting */ - else if(!bits)return(0L); - } - - 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; - - if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow; - - b->ptr+=bits/8; - b->endbyte+=bits/8; - b->endbit=bits&7; - return; - - overflow: - b->ptr=NULL; - b->endbyte=b->storage; - b->endbit=1; -} - -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; - - if(bits<0 || bits>32) goto err; - m=mask[bits]; - bits+=b->endbit; - - if(b->endbyte >= b->storage-4){ - /* not the main path */ - if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow; - /* special case to avoid reading b->ptr[0], which might be past the end of - the buffer; also skips some useless accounting */ - else if(!bits)return(0L); - } - - 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; - b->ptr+=bits/8; - b->endbyte+=bits/8; - b->endbit=bits&7; - return ret; - - overflow: - err: - b->ptr=NULL; - b->endbyte=b->storage; - b->endbit=1; - return -1L; -} - -/* bits <= 32 */ -long oggpackB_read(oggpack_buffer *b,int bits){ - long ret; - long m=32-bits; - - if(m<0 || m>32) goto err; - bits+=b->endbit; - - if(b->endbyte+4>=b->storage){ - /* not the main path */ - if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow; - /* special case to avoid reading b->ptr[0], which might be past the end of - the buffer; also skips some useless accounting */ - else if(!bits)return(0L); - } - - 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); - - b->ptr+=bits/8; - b->endbyte+=bits/8; - b->endbit=bits&7; - return ret; - - overflow: - err: - b->ptr=NULL; - b->endbyte=b->storage; - b->endbit=1; - return -1L; -} - -long oggpack_read1(oggpack_buffer *b){ - long ret; - - if(b->endbyte >= b->storage) goto overflow; - ret=(b->ptr[0]>>b->endbit)&1; - - b->endbit++; - if(b->endbit>7){ - b->endbit=0; - b->ptr++; - b->endbyte++; - } - return ret; - - overflow: - b->ptr=NULL; - b->endbyte=b->storage; - b->endbit=1; - return -1L; -} - -long oggpackB_read1(oggpack_buffer *b){ - long ret; - - if(b->endbyte >= b->storage) goto overflow; - ret=(b->ptr[0]>>(7-b->endbit))&1; - - b->endbit++; - if(b->endbit>7){ - b->endbit=0; - b->ptr++; - b->endbyte++; - } - return ret; - - overflow: - b->ptr=NULL; - b->endbyte=b->storage; - b->endbit=1; - return -1L; -} - -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 <stdio.h> - -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<vals;i++) - oggpack_write(&o,b[i],bits?bits:ilog(b[i])); - buffer=oggpack_get_buffer(&o); - bytes=oggpack_bytes(&o); - if(bytes!=compsize)report("wrong number of bytes!\n"); - for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){ - for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]); - report("wrote incorrect value!\n"); - } - oggpack_readinit(&r,buffer,bytes); - for(i=0;i<vals;i++){ - int tbit=bits?bits:ilog(b[i]); - if(oggpack_look(&r,tbit)==-1) - report("out of data!\n"); - if(oggpack_look(&r,tbit)!=(b[i]&mask[tbit])) - report("looked at incorrect value!\n"); - if(tbit==1) - if(oggpack_look1(&r)!=(b[i]&mask[tbit])) - report("looked at single bit incorrect value!\n"); - if(tbit==1){ - if(oggpack_read1(&r)!=(b[i]&mask[tbit])) - report("read incorrect single bit value!\n"); - }else{ - if(oggpack_read(&r,tbit)!=(b[i]&mask[tbit])) - report("read incorrect value!\n"); - } - } - if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n"); -} - -void cliptestB(unsigned long *b,int vals,int bits,int *comp,int compsize){ - long bytes,i; - unsigned char *buffer; - - oggpackB_reset(&o); - for(i=0;i<vals;i++) - oggpackB_write(&o,b[i],bits?bits:ilog(b[i])); - buffer=oggpackB_get_buffer(&o); - bytes=oggpackB_bytes(&o); - if(bytes!=compsize)report("wrong number of bytes!\n"); - for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){ - for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]); - report("wrote incorrect value!\n"); - } - oggpackB_readinit(&r,buffer,bytes); - for(i=0;i<vals;i++){ - int tbit=bits?bits:ilog(b[i]); - if(oggpackB_look(&r,tbit)==-1) - report("out of data!\n"); - if(oggpackB_look(&r,tbit)!=(b[i]&mask[tbit])) - report("looked at incorrect value!\n"); - if(tbit==1) - if(oggpackB_look1(&r)!=(b[i]&mask[tbit])) - report("looked at single bit incorrect value!\n"); - if(tbit==1){ - if(oggpackB_read1(&r)!=(b[i]&mask[tbit])) - report("read incorrect single bit value!\n"); - }else{ - if(oggpackB_read(&r,tbit)!=(b[i]&mask[tbit])) - report("read incorrect value!\n"); - } - } - if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n"); -} - -int main(void){ - unsigned char *buffer; - long bytes,i; - static unsigned long testbuffer1[]= - {18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7, - 567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4}; - int test1size=43; - - static unsigned long testbuffer2[]= - {216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212, - 1233432,534,5,346435231,14436467,7869299,76326614,167548585, - 85525151,0,12321,1,349528352}; - int test2size=21; - - static unsigned long testbuffer3[]= - {1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1, - 0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1}; - int test3size=56; - - static unsigned long large[]= - {2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212, - 1233432,534,5,2146435231,14436467,7869299,76326614,167548585, - 85525151,0,12321,1,2146528352}; - - int onesize=33; - static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40, - 34,242,223,136,35,222,211,86,171,50,225,135,214,75,172, - 223,4}; - static int oneB[33]={150,101,131,33,203,15,204,216,105,193,156,65,84,85,222, - 8,139,145,227,126,34,55,244,171,85,100,39,195,173,18, - 245,251,128}; - - int twosize=6; - static int two[6]={61,255,255,251,231,29}; - static int twoB[6]={247,63,255,253,249,120}; - - int threesize=54; - static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254, - 142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83, - 58,135,196,61,55,129,183,54,101,100,170,37,127,126,10, - 100,52,4,14,18,86,77,1}; - static int threeB[54]={206,128,42,153,57,8,183,251,13,89,36,30,32,144,183, - 130,59,240,121,59,85,223,19,228,180,134,33,107,74,98, - 233,253,196,135,63,2,110,114,50,155,90,127,37,170,104, - 200,20,254,4,58,106,176,144,0}; - - int foursize=38; - static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72, - 132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169, - 28,2,133,0,1}; - static int fourB[38]={36,48,102,83,243,24,52,7,4,35,132,10,145,21,2,93,2,41, - 1,219,184,16,33,184,54,149,170,132,18,30,29,98,229,67, - 129,10,4,32}; - - int fivesize=45; - static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62, - 241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169, - 84,75,159,2,1,0,132,192,8,0,0,18,22}; - static int fiveB[45]={1,84,145,111,245,100,128,8,56,36,40,71,126,78,213,226, - 124,105,12,0,133,128,0,162,233,242,67,152,77,205,77, - 172,150,169,129,79,128,0,6,4,32,0,27,9,0}; - - int sixsize=7; - static int six[7]={17,177,170,242,169,19,148}; - static int sixB[7]={136,141,85,79,149,200,41}; - - /* Test read/write together */ - /* Later we test against pregenerated bitstreams */ - oggpack_writeinit(&o); - - fprintf(stderr,"\nSmall preclipped packing (LSb): "); - cliptest(testbuffer1,test1size,0,one,onesize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nNull bit call (LSb): "); - cliptest(testbuffer3,test3size,0,two,twosize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nLarge preclipped packing (LSb): "); - cliptest(testbuffer2,test2size,0,three,threesize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\n32 bit preclipped packing (LSb): "); - oggpack_reset(&o); - for(i=0;i<test2size;i++) - oggpack_write(&o,large[i],32); - buffer=oggpack_get_buffer(&o); - bytes=oggpack_bytes(&o); - oggpack_readinit(&r,buffer,bytes); - for(i=0;i<test2size;i++){ - if(oggpack_look(&r,32)==-1)report("out of data. failed!"); - if(oggpack_look(&r,32)!=large[i]){ - fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpack_look(&r,32),large[i], - oggpack_look(&r,32),large[i]); - report("read incorrect value!\n"); - } - oggpack_adv(&r,32); - } - if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n"); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nSmall unclipped packing (LSb): "); - cliptest(testbuffer1,test1size,7,four,foursize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nLarge unclipped packing (LSb): "); - cliptest(testbuffer2,test2size,17,five,fivesize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nSingle bit unclipped packing (LSb): "); - cliptest(testbuffer3,test3size,1,six,sixsize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nTesting read past end (LSb): "); - oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8); - for(i=0;i<64;i++){ - if(oggpack_read(&r,1)!=0){ - fprintf(stderr,"failed; got -1 prematurely.\n"); - exit(1); - } - } - if(oggpack_look(&r,1)!=-1 || - oggpack_read(&r,1)!=-1){ - fprintf(stderr,"failed; read past end without -1.\n"); - exit(1); - } - oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8); - if(oggpack_read(&r,30)!=0 || oggpack_read(&r,16)!=0){ - fprintf(stderr,"failed 2; got -1 prematurely.\n"); - exit(1); - } - - if(oggpack_look(&r,18)!=0 || - oggpack_look(&r,18)!=0){ - fprintf(stderr,"failed 3; got -1 prematurely.\n"); - exit(1); - } - if(oggpack_look(&r,19)!=-1 || - oggpack_look(&r,19)!=-1){ - fprintf(stderr,"failed; read past end without -1.\n"); - exit(1); - } - if(oggpack_look(&r,32)!=-1 || - oggpack_look(&r,32)!=-1){ - fprintf(stderr,"failed; read past end without -1.\n"); - exit(1); - } - oggpack_writeclear(&o); - fprintf(stderr,"ok.\n"); - - /********** lazy, cut-n-paste retest with MSb packing ***********/ - - /* Test read/write together */ - /* Later we test against pregenerated bitstreams */ - oggpackB_writeinit(&o); - - fprintf(stderr,"\nSmall preclipped packing (MSb): "); - cliptestB(testbuffer1,test1size,0,oneB,onesize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nNull bit call (MSb): "); - cliptestB(testbuffer3,test3size,0,twoB,twosize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nLarge preclipped packing (MSb): "); - cliptestB(testbuffer2,test2size,0,threeB,threesize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\n32 bit preclipped packing (MSb): "); - oggpackB_reset(&o); - for(i=0;i<test2size;i++) - oggpackB_write(&o,large[i],32); - buffer=oggpackB_get_buffer(&o); - bytes=oggpackB_bytes(&o); - oggpackB_readinit(&r,buffer,bytes); - for(i=0;i<test2size;i++){ - if(oggpackB_look(&r,32)==-1)report("out of data. failed!"); - if(oggpackB_look(&r,32)!=large[i]){ - fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpackB_look(&r,32),large[i], - oggpackB_look(&r,32),large[i]); - report("read incorrect value!\n"); - } - oggpackB_adv(&r,32); - } - if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n"); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nSmall unclipped packing (MSb): "); - cliptestB(testbuffer1,test1size,7,fourB,foursize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nLarge unclipped packing (MSb): "); - cliptestB(testbuffer2,test2size,17,fiveB,fivesize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nSingle bit unclipped packing (MSb): "); - cliptestB(testbuffer3,test3size,1,sixB,sixsize); - fprintf(stderr,"ok."); - - fprintf(stderr,"\nTesting read past end (MSb): "); - oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8); - for(i=0;i<64;i++){ - if(oggpackB_read(&r,1)!=0){ - fprintf(stderr,"failed; got -1 prematurely.\n"); - exit(1); - } - } - if(oggpackB_look(&r,1)!=-1 || - oggpackB_read(&r,1)!=-1){ - fprintf(stderr,"failed; read past end without -1.\n"); - exit(1); - } - oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8); - if(oggpackB_read(&r,30)!=0 || oggpackB_read(&r,16)!=0){ - fprintf(stderr,"failed 2; got -1 prematurely.\n"); - exit(1); - } - - if(oggpackB_look(&r,18)!=0 || - oggpackB_look(&r,18)!=0){ - fprintf(stderr,"failed 3; got -1 prematurely.\n"); - exit(1); - } - if(oggpackB_look(&r,19)!=-1 || - oggpackB_look(&r,19)!=-1){ - fprintf(stderr,"failed; read past end without -1.\n"); - exit(1); - } - if(oggpackB_look(&r,32)!=-1 || - oggpackB_look(&r,32)!=-1){ - fprintf(stderr,"failed; read past end without -1.\n"); - exit(1); - } - oggpackB_writeclear(&o); - fprintf(stderr,"ok.\n\n"); - - - return(0); -} -#endif /* _V_SELFTEST */ - -#undef BUFFER_INCREMENT diff --git a/src/lib/dl/ext/libogg/common.mak b/src/lib/dl/ext/libogg/common.mak deleted file mode 100755 index d51e89b6..00000000 --- a/src/lib/dl/ext/libogg/common.mak +++ /dev/null @@ -1,29 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_LIBOGG_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)bitwise.obj $(SUBDIR)$(HPS)framing.obj - -!ifdef EXT_LIBOGG_LIB -$(EXT_LIBOGG_LIB): $(OBJS) - wlib -q -b -c $(EXT_LIBOGG_LIB) -+$(SUBDIR)$(HPS)bitwise.obj -+$(SUBDIR)$(HPS)framing.obj -!endif - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_LIBOGG_LIB) .symbolic - -exe: .symbolic - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/libogg/config.h b/src/lib/dl/ext/libogg/config.h deleted file mode 100755 index 66c6bdc9..00000000 --- a/src/lib/dl/ext/libogg/config.h +++ /dev/null @@ -1,102 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - -/* Name of package */ -#define PACKAGE "libogg" - -/* 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 home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `int16_t', as computed by sizeof. */ -#define SIZEOF_INT16_T 2 - -/* The size of `int32_t', as computed by sizeof. */ -#define SIZEOF_INT32_T 4 - -/* The size of `int64_t', as computed by sizeof. */ -#define SIZEOF_INT64_T 8 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `uint16_t', as computed by sizeof. */ -#define SIZEOF_UINT16_T 2 - -/* The size of `uint32_t', as computed by sizeof. */ -#define SIZEOF_UINT32_T 4 - -/* The size of `u_int16_t', as computed by sizeof. */ -#define SIZEOF_U_INT16_T 2 - -/* The size of `u_int32_t', as computed by sizeof. */ -#define SIZEOF_U_INT32_T 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.3.0" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ diff --git a/src/lib/dl/ext/libogg/config_types.h b/src/lib/dl/ext/libogg/config_types.h deleted file mode 100755 index 1e7d4909..00000000 --- a/src/lib/dl/ext/libogg/config_types.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __CONFIG_TYPES_H__ -#define __CONFIG_TYPES_H__ - -/* these are filled in by configure */ -#define INCLUDE_INTTYPES_H 1 -#define INCLUDE_STDINT_H 1 -#define INCLUDE_SYS_TYPES_H 1 - -#if INCLUDE_INTTYPES_H -# include <inttypes.h> -#endif -#if INCLUDE_STDINT_H -# include <stdint.h> -#endif -#if INCLUDE_SYS_TYPES_H -# include <sys/types.h> -#endif - -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; - -#endif diff --git a/src/lib/dl/ext/libogg/framing.c b/src/lib/dl/ext/libogg/framing.c deleted file mode 100755 index b02c364d..00000000 --- a/src/lib/dl/ext/libogg/framing.c +++ /dev/null @@ -1,2093 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE Ogg CONTAINER 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-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: code raw packets into framed OggSquish stream and - decode Ogg streams back into raw packets - last mod: $Id: framing.c 18052 2011-08-04 17:57:02Z giles $ - - note: The CRC code is directly derived from public domain code by - Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html - for details. - - ********************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <ext/libogg/ogg.h> - -/* A complete description of Ogg framing exists in docs/framing.html */ - -int ogg_page_version(const ogg_page *og){ - return((int)(og->header[4])); -} - -int ogg_page_continued(const ogg_page *og){ - return((int)(og->header[5]&0x01)); -} - -int ogg_page_bos(const ogg_page *og){ - return((int)(og->header[5]&0x02)); -} - -int ogg_page_eos(const ogg_page *og){ - return((int)(og->header[5]&0x04)); -} - -ogg_int64_t ogg_page_granulepos(const 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(const ogg_page *og){ - return(og->header[14] | - (og->header[15]<<8) | - (og->header[16]<<16) | - (og->header[17]<<24)); -} - -long ogg_page_pageno(const 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(const ogg_page *og){ - int i,n=og->header[26],count=0; - for(i=0;i<n;i++) - if(og->header[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->lacing_storage=1024; - - os->body_data=_ogg_malloc(os->body_storage*sizeof(*os->body_data)); - os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->lacing_vals)); - os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->granule_vals)); - - if(!os->body_data || !os->lacing_vals || !os->granule_vals){ - ogg_stream_clear(os); - return -1; - } - - os->serialno=serialno; - - return(0); - } - return(-1); -} - -/* async/delayed error detection for the ogg_stream_state */ -int ogg_stream_check(ogg_stream_state *os){ - if(!os || !os->body_data) return -1; - return 0; -} - -/* _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 int _os_body_expand(ogg_stream_state *os,int needed){ - if(os->body_storage<=os->body_fill+needed){ - void *ret; - ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)* - sizeof(*os->body_data)); - if(!ret){ - ogg_stream_clear(os); - return -1; - } - os->body_storage+=(needed+1024); - os->body_data=ret; - } - return 0; -} - -static int _os_lacing_expand(ogg_stream_state *os,int needed){ - if(os->lacing_storage<=os->lacing_fill+needed){ - void *ret; - ret=_ogg_realloc(os->lacing_vals,(os->lacing_storage+needed+32)* - sizeof(*os->lacing_vals)); - if(!ret){ - ogg_stream_clear(os); - return -1; - } - os->lacing_vals=ret; - ret=_ogg_realloc(os->granule_vals,(os->lacing_storage+needed+32)* - sizeof(*os->granule_vals)); - if(!ret){ - ogg_stream_clear(os); - return -1; - } - os->granule_vals=ret; - os->lacing_storage+=(needed+32); - } - return 0; -} - -/* checksum the page */ -/* Direct table CRC; note that this will be faster in the future if we - perform the checksum simultaneously 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;i<og->header_len;i++) - crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]]; - for(i=0;i<og->body_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_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count, - long e_o_s, ogg_int64_t granulepos){ - - int bytes = 0, lacing_vals, i; - - if(ogg_stream_check(os)) return -1; - if(!iov) return 0; - - for (i = 0; i < count; ++i) bytes += (int)iov[i].iov_len; - lacing_vals=bytes/255+1; - - 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 */ - if(_os_body_expand(os,bytes) || _os_lacing_expand(os,lacing_vals)) - return -1; - - /* 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 */ - - for (i = 0; i < count; ++i) { - memcpy(os->body_data+os->body_fill, iov[i].iov_base, iov[i].iov_len); - os->body_fill += (int)iov[i].iov_len; - } - - /* Store lacing vals for this packet */ - for(i=0;i<lacing_vals-1;i++){ - os->lacing_vals[os->lacing_fill+i]=255; - os->granule_vals[os->lacing_fill+i]=os->granulepos; - } - os->lacing_vals[os->lacing_fill+i]=bytes%255; - os->granulepos=os->granule_vals[os->lacing_fill+i]=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(e_o_s)os->e_o_s=1; - - return(0); -} - -int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){ - ogg_iovec_t iov; - iov.iov_base = op->packet; - iov.iov_len = op->bytes; - return ogg_stream_iovecin(os, &iov, 1, op->e_o_s, op->granulepos); -} - -/* Conditionally flush a page; force==0 will only flush nominal-size - pages, force==1 forces us to flush a page regardless of page size - so long as there's any data available at all. */ -static int ogg_stream_flush_i(ogg_stream_state *os,ogg_page *og, int force, int nfill){ - 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=-1; - - if(ogg_stream_check(os)) return(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;vals<maxvals;vals++){ - if((os->lacing_vals[vals]&0x0ff)<255){ - vals++; - break; - } - } - }else{ - - /* The extra packets_done, packet_just_done logic here attempts to do two things: - 1) Don't unneccessarily span pages. - 2) Unless necessary, don't flush pages if there are less than four packets on - them; this expands page size to reduce unneccessary overhead if incoming packets - are large. - These are not necessary behaviors, just 'always better than naive flushing' - without requiring an application to explicitly request a specific optimized - behavior. We'll want an explicit behavior setup pathway eventually as well. */ - - int packets_done=0; - int packet_just_done=0; - for(vals=0;vals<maxvals;vals++){ - if(acc>nfill && packet_just_done>=4){ - force=1; - break; - } - acc+=os->lacing_vals[vals]&0x0ff; - if((os->lacing_vals[vals]&0xff)<255){ - granule_pos=os->granule_vals[vals]; - packet_just_done=++packets_done; - }else - packet_just_done=0; - } - if(vals==255)force=1; - } - - if(!force) return(0); - - /* 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;i<vals;i++) - bytes+=os->header[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 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 - a page regardless of size in the middle of a stream. */ - -int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){ - return ogg_stream_flush_i(os,og,1,4096); -} - -/* Like the above, but an argument is provided to adjust the nominal - page size for applications which are smart enough to provide their - own delay based flushing */ - -int ogg_stream_flush_fill(ogg_stream_state *os,ogg_page *og, int nfill){ - return ogg_stream_flush_i(os,og,1,nfill); -} - -/* 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){ - int force=0; - if(ogg_stream_check(os)) return 0; - - if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */ - (os->lacing_fill&&!os->b_o_s)) /* 'initial header page' case */ - force=1; - - return(ogg_stream_flush_i(os,og,force,4096)); -} - -/* Like the above, but an argument is provided to adjust the nominal -page size for applications which are smart enough to provide their -own delay based flushing */ - -int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill){ - int force=0; - if(ogg_stream_check(os)) return 0; - - if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */ - (os->lacing_fill&&!os->b_o_s)) /* 'initial header page' case */ - force=1; - - return(ogg_stream_flush_i(os,og,force,nfill)); -} - -int ogg_stream_eos(ogg_stream_state *os){ - if(ogg_stream_check(os)) return 1; - 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. */ - -/* initialize the struct to a known state */ -int ogg_sync_init(ogg_sync_state *oy){ - if(oy){ - oy->storage = -1; /* used as a readiness flag */ - 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); - memset(oy,0,sizeof(*oy)); - } - return(0); -} - -int ogg_sync_destroy(ogg_sync_state *oy){ - if(oy){ - ogg_sync_clear(oy); - _ogg_free(oy); - } - return(0); -} - -int ogg_sync_check(ogg_sync_state *oy){ - if(oy->storage<0) return -1; - return 0; -} - -char *ogg_sync_buffer(ogg_sync_state *oy, long size){ - if(ogg_sync_check(oy)) return NULL; - - /* 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 */ - void *ret; - - if(oy->data) - ret=_ogg_realloc(oy->data,newsize); - else - ret=_ogg_malloc(newsize); - if(!ret){ - ogg_sync_clear(oy); - return NULL; - } - oy->data=ret; - 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(ogg_sync_check(oy))return -1; - 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(ogg_sync_check(oy))return 0; - - 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(bytes<headerbytes)return(0); /* not enough for header + seg table */ - - /* count up body length in the segment table */ - - for(i=0;i<page[26];i++) - oy->bodybytes+=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=(int)(next-oy->data); - return((long)-(next-page)); -} - -/* sync the stream and get a page. Keep trying until we find a page. - Suppress '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){ - - if(ogg_sync_check(oy))return 0; - - /* 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]; - - if(ogg_stream_check(os)) return -1; - - /* 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); - - if(_os_lacing_expand(os,segments+1)) return -1; - - /* are we in sequence? */ - if(pageno!=os->pageno){ - int i; - - /* unroll previous partial packet (if any) */ - for(i=os->lacing_packet;i<os->lacing_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(;segptr<segments;segptr++){ - int val=header[27+segptr]; - body+=val; - bodysize-=val; - if(val<255){ - segptr++; - break; - } - } - } - } - - if(bodysize){ - if(_os_body_expand(os,bodysize)) return -1; - memcpy(os->body_data+os->body_fill,body,bodysize); - os->body_fill+=bodysize; - } - - { - int saved=-1; - while(segptr<segments){ - int val=header[27+segptr]; - os->lacing_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){ - if(ogg_sync_check(oy))return -1; - - 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){ - if(ogg_stream_check(os)) return -1; - - 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){ - if(ogg_stream_check(os)) return -1; - 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; - long 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){ - if(ogg_stream_check(os)) return 0; - return _packetout(os,op,1); -} - -int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){ - if(ogg_stream_check(os)) return 0; - 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 <stdio.h> - -ogg_stream_state os_en, os_de; -ogg_sync_state oy; - -void checkpacket(ogg_packet *op,long len, int no, long pos){ - long j; - static int sequence=0; - static int lastno=0; - - if(op->bytes!=len){ - fprintf(stderr,"incorrect packet length (%ld != %ld)!\n",op->bytes,len); - exit(1); - } - if(op->granulepos!=pos){ - fprintf(stderr,"incorrect packet granpos (%ld != %ld)!\n",(long)op->granulepos,pos); - 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;j<op->bytes;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;j<og->body_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;j<og->header_len;j++){ - if(og->header[j]!=header[j]){ - fprintf(stderr,"header content mismatch at pos %ld:\n",j); - for(j=0;j<header[26]+27;j++) - fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[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;j<og->header_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, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x01,0x02,0x03,0x04,1,0,0,0, - 0xf8,0x3c,0x19,0x79, - 255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,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, - 0x38,0xe6,0xb6,0x28, - 6, - 255,220,255,4,255,0}; - - -/* spill expansion test */ -const int head1_4b[] = {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_4b[] = {0x4f,0x67,0x67,0x53,0,0x00, - 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x02,0x03,0x04,1,0,0,0, - 0xce,0x8f,0x17,0x1a, - 23, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,10,255,4,255,0,0}; - - -const int head3_4b[] = {0x4f,0x67,0x67,0x53,0,0x04, - 0x07,0x14,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x02,0x03,0x04,2,0,0,0, - 0x9b,0xb2,0x50,0xa1, - 1, - 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, - 0x68,0x22,0x7c,0x3d, - 255, - 100, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,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, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x01,0x02,0x03,0x04,2,0,0,0, - 0xf4,0x87,0xba,0xf3, - 255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,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, - 0xf7,0x2f,0x6c,0x60, - 5, - 254,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, - 0x68,0x22,0x7c,0x3d, - 255, - 100, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,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;packets<packetskip;packets++) - depacket+=pl[packets]; - - for(packets=0;;packets++)if(pl[packets]==-1)break; - - for(i=0;i<packets;i++){ - /* construct a test packet */ - 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=granule_pos; - - granule_pos+=1024; - - for(j=0;j<len;j++)data[inptr++]=i+j; - - /* submit the test packet */ - ogg_stream_packetin(&os_en,&op); - - /* retrieve any finished pages */ - { - ogg_page og; - - while(ogg_stream_pageout(&os_en,&og)){ - /* We have a page. Check it carefully */ - - fprintf(stderr,"%ld, ",pageno); - - if(headers[pageno]==NULL){ - fprintf(stderr,"coded too many pages!\n"); - exit(1); - } - - check_page(data+outptr,headers[pageno],&og); - - outptr+=og.body_len; - pageno++; - if(pageskip){ - bosflag=1; - pageskip--; - deptr+=og.body_len; - } - - /* have a complete page; submit it to sync/decode */ - - { - ogg_page og_de; - ogg_packet op_de,op_de2; - char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len); - char *next=buf; - byteskipcount+=og.header_len; - if(byteskipcount>byteskip){ - 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,"(%d), ",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; with page spill expansion, we have to - overflow the lacing table. */ - const int packets[]={0,65500,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); - } - - { - /* spill expand packet test */ - const int packets[]={0,4345,259,255,0,0,-1}; - const int *headret[]={head1_4b,head2_4b,head3_4b,NULL}; - - fprintf(stderr,"testing page spill expansion... "); - 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,130049,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,130049,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,64770,-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, 1,1,98,4079, 1,1,2954,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;j<len;j++)data[inptr++]=i+j; - ogg_stream_packetin(&os_en,&op); - } - - _ogg_free(data); - - /* retrieve finished pages */ - for(i=0;i<5;i++){ - if(ogg_stream_pageout(&os_en,&og[i])==0){ - fprintf(stderr,"Too few pages output building sync tests!\n"); - exit(1); - } - copy_page(&og[i]); - } - - /* Test lost pages on pagein/packetout: no rollback */ - { - ogg_page temp; - ogg_packet test; - - fprintf(stderr,"Testing loss of pages... "); - - ogg_sync_reset(&oy); - ogg_stream_reset(&os_de); - for(i=0;i<5;i++){ - memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header, - og[i].header_len); - ogg_sync_wrote(&oy,og[i].header_len); - memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len); - ogg_sync_wrote(&oy,og[i].body_len); - } - - ogg_sync_pageout(&oy,&temp); - ogg_stream_pagein(&os_de,&temp); - ogg_sync_pageout(&oy,&temp); - ogg_stream_pagein(&os_de,&temp); - ogg_sync_pageout(&oy,&temp); - /* skip */ - ogg_sync_pageout(&oy,&temp); - ogg_stream_pagein(&os_de,&temp); - - /* do we get the expected results/packets? */ - - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,0,0,0); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,1,1,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,1,2,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,98,3,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,4079,4,5000); - if(ogg_stream_packetout(&os_de,&test)!=-1){ - fprintf(stderr,"Error: loss of page did not return error\n"); - exit(1); - } - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,76,9,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,34,10,-1); - fprintf(stderr,"ok.\n"); - } - - /* Test lost pages on pagein/packetout: rollback with continuation */ - { - ogg_page temp; - ogg_packet test; - - fprintf(stderr,"Testing loss of pages (rollback required)... "); - - ogg_sync_reset(&oy); - ogg_stream_reset(&os_de); - for(i=0;i<5;i++){ - memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header, - og[i].header_len); - ogg_sync_wrote(&oy,og[i].header_len); - memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len); - ogg_sync_wrote(&oy,og[i].body_len); - } - - ogg_sync_pageout(&oy,&temp); - ogg_stream_pagein(&os_de,&temp); - ogg_sync_pageout(&oy,&temp); - ogg_stream_pagein(&os_de,&temp); - ogg_sync_pageout(&oy,&temp); - ogg_stream_pagein(&os_de,&temp); - ogg_sync_pageout(&oy,&temp); - /* skip */ - ogg_sync_pageout(&oy,&temp); - ogg_stream_pagein(&os_de,&temp); - - /* do we get the expected results/packets? */ - - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,0,0,0); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,1,1,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,1,2,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,98,3,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,4079,4,5000); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,1,5,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,1,6,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,2954,7,-1); - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,2057,8,9000); - if(ogg_stream_packetout(&os_de,&test)!=-1){ - fprintf(stderr,"Error: loss of page did not return error\n"); - exit(1); - } - if(ogg_stream_packetout(&os_de,&test)!=1)error(); - checkpacket(&test,300,17,18000); - fprintf(stderr,"ok.\n"); - } - - /* the rest only test sync */ - { - ogg_page og_de; - /* Test fractional page inputs: incomplete capture */ - fprintf(stderr,"Testing sync on partial inputs... "); - ogg_sync_reset(&oy); - memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, - 3); - ogg_sync_wrote(&oy,3); - if(ogg_sync_pageout(&oy,&og_de)>0)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/src/lib/dl/ext/libogg/ogg.h b/src/lib/dl/ext/libogg/ogg.h deleted file mode 100755 index 4d3c54b8..00000000 --- a/src/lib/dl/ext/libogg/ogg.h +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel libogg include - last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $ - - ********************************************************************/ -#ifndef _OGG_H -#define _OGG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stddef.h> -#include <ext/libogg/os_types.h> - -typedef struct { - void *iov_base; - size_t iov_len; -} ogg_iovec_t; - -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 separate 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 separate 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 int oggpack_writecheck(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 int oggpackB_writecheck(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_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, - int count, long e_o_s, ogg_int64_t granulepos); -extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill); -extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill); - -/* 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 int ogg_sync_check(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_check(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(const ogg_page *og); -extern int ogg_page_continued(const ogg_page *og); -extern int ogg_page_bos(const ogg_page *og); -extern int ogg_page_eos(const ogg_page *og); -extern ogg_int64_t ogg_page_granulepos(const ogg_page *og); -extern int ogg_page_serialno(const ogg_page *og); -extern long ogg_page_pageno(const ogg_page *og); -extern int ogg_page_packets(const ogg_page *og); - -extern void ogg_packet_clear(ogg_packet *op); - - -#ifdef __cplusplus -} -#endif - -#endif /* _OGG_H */ diff --git a/src/lib/dl/ext/libogg/os_types.h b/src/lib/dl/ext/libogg/os_types.h deleted file mode 100755 index d457e654..00000000 --- a/src/lib/dl/ext/libogg/os_types.h +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************** - * * - * 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: os_types.h 17712 2010-12-03 17:10:02Z xiphmont $ - - ********************************************************************/ -#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 <stdint.h> - typedef int16_t ogg_int16_t; - typedef uint16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef uint32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - typedef uint64_t ogg_uint64_t; -# elif defined(__MINGW32__) -# include <sys/types.h> - 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 <sys/types.h> - 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(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ - -# include <inttypes.h> - typedef int16_t ogg_int16_t; - typedef uint16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef uint32_t ogg_uint32_t; - typedef int64_t ogg_int64_t; - -#elif defined(__HAIKU__) - - /* Haiku */ -# include <sys/types.h> - 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(__BEOS__) - - /* Be */ -# include <inttypes.h> - typedef int16_t ogg_int16_t; - typedef uint16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; - typedef uint32_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; - -#elif defined(__TMS320C6X__) - - /* TI C64x compiler */ - 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 <ext/libogg/config_types.h> - -#endif - -#endif /* _OS_TYPES_H */ diff --git a/src/lib/dl/ext/readme b/src/lib/dl/ext/readme deleted file mode 100755 index 47fc1a1e..00000000 --- a/src/lib/dl/ext/readme +++ /dev/null @@ -1,16 +0,0 @@ -The 'ext' directory contains external code incorporated into this project. -The projects in question are open source projects that carry their own -licenses. - -bzip2 ............... Bzip2 compression/decompression library -faad ................ FAAD MPEG-4 AAC audio decoder library -flac ................ Free Lossless Audio Codec library -jpeg ................ JPEG image compression/decompression library -lame ................ LAME MP3 audio encoder library -libmad .............. MAD MPEG audio decoder library -libogg .............. Xiph OGG bitstream reader/writer library -speex ............... Xiph Speex codec library -vorbis .............. Xiph Vorbis codec library -vorbtool ............ Xiph Vorbis tools -zlib ................ ZLIB compression/decompression library - diff --git a/src/lib/dl/ext/speex/CLEAN.BAT b/src/lib/dl/ext/speex/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/speex/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/speex/MAKE.BAT b/src/lib/dl/ext/speex/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/speex/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/speex/_kiss_fft_guts.h b/src/lib/dl/ext/speex/_kiss_fft_guts.h deleted file mode 100755 index 6571e79c..00000000 --- a/src/lib/dl/ext/speex/_kiss_fft_guts.h +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright (c) 2003-2004, Mark Borgerding - -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. -*/ - -#define MIN(a,b) ((a)<(b) ? (a):(b)) -#define MAX(a,b) ((a)>(b) ? (a):(b)) - -/* kiss_fft.h - defines kiss_fft_scalar as either short or a float type - and defines - typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */ -#include "kiss_fft.h" -#include "math_approx.h" - -#define MAXFACTORS 32 -/* e.g. an fft of length 128 has 4 factors - as far as kissfft is concerned - 4*4*4*2 - */ - -struct kiss_fft_state{ - int nfft; - int inverse; - int factors[2*MAXFACTORS]; - kiss_fft_cpx twiddles[1]; -}; - -/* - Explanation of macros dealing with complex math: - - C_MUL(m,a,b) : m = a*b - C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise - C_SUB( res, a,b) : res = a - b - C_SUBFROM( res , a) : res -= a - C_ADDTO( res , a) : res += a - * */ -#ifdef FIXED_POINT -#include "arch.h" -# define FRACBITS 15 -# define SAMPPROD spx_int32_t -#define SAMP_MAX 32767 - -#define SAMP_MIN -SAMP_MAX - -#if defined(CHECK_OVERFLOW) -# define CHECK_OVERFLOW_OP(a,op,b) \ - if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \ - fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); } -#endif - - -# define smul(a,b) ( (SAMPPROD)(a)*(b) ) -# define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS ) - -# define S_MUL(a,b) sround( smul(a,b) ) - -# define C_MUL(m,a,b) \ - do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ - (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) - -# define C_MUL4(m,a,b) \ - do{ (m).r = PSHR32( smul((a).r,(b).r) - smul((a).i,(b).i),17 ); \ - (m).i = PSHR32( smul((a).r,(b).i) + smul((a).i,(b).r),17 ); }while(0) - -# define DIVSCALAR(x,k) \ - (x) = sround( smul( x, SAMP_MAX/k ) ) - -# define C_FIXDIV(c,div) \ - do { DIVSCALAR( (c).r , div); \ - DIVSCALAR( (c).i , div); }while (0) - -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r = sround( smul( (c).r , s ) ) ;\ - (c).i = sround( smul( (c).i , s ) ) ; }while(0) - -#else /* not FIXED_POINT*/ - -# define S_MUL(a,b) ( (a)*(b) ) -#define C_MUL(m,a,b) \ - do{ (m).r = (a).r*(b).r - (a).i*(b).i;\ - (m).i = (a).r*(b).i + (a).i*(b).r; }while(0) - -#define C_MUL4(m,a,b) C_MUL(m,a,b) - -# define C_FIXDIV(c,div) /* NOOP */ -# define C_MULBYSCALAR( c, s ) \ - do{ (c).r *= (s);\ - (c).i *= (s); }while(0) -#endif - -#ifndef CHECK_OVERFLOW_OP -# define CHECK_OVERFLOW_OP(a,op,b) /* noop */ -#endif - -#define C_ADD( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,+,(b).r)\ - CHECK_OVERFLOW_OP((a).i,+,(b).i)\ - (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \ - }while(0) -#define C_SUB( res, a,b)\ - do { \ - CHECK_OVERFLOW_OP((a).r,-,(b).r)\ - CHECK_OVERFLOW_OP((a).i,-,(b).i)\ - (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \ - }while(0) -#define C_ADDTO( res , a)\ - do { \ - CHECK_OVERFLOW_OP((res).r,+,(a).r)\ - CHECK_OVERFLOW_OP((res).i,+,(a).i)\ - (res).r += (a).r; (res).i += (a).i;\ - }while(0) - -#define C_SUBFROM( res , a)\ - do {\ - CHECK_OVERFLOW_OP((res).r,-,(a).r)\ - CHECK_OVERFLOW_OP((res).i,-,(a).i)\ - (res).r -= (a).r; (res).i -= (a).i; \ - }while(0) - - -#ifdef FIXED_POINT -# define KISS_FFT_COS(phase) floor(MIN(32767,MAX(-32767,.5+32768 * cos (phase)))) -# define KISS_FFT_SIN(phase) floor(MIN(32767,MAX(-32767,.5+32768 * sin (phase)))) -# define HALF_OF(x) ((x)>>1) -#elif defined(USE_SIMD) -# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) ) -# define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) ) -# define HALF_OF(x) ((x)*_mm_set1_ps(.5)) -#else -# define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase) -# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase) -# define HALF_OF(x) ((x)*.5) -#endif - -#define kf_cexp(x,phase) \ - do{ \ - (x)->r = KISS_FFT_COS(phase);\ - (x)->i = KISS_FFT_SIN(phase);\ - }while(0) -#define kf_cexp2(x,phase) \ - do{ \ - (x)->r = spx_cos_norm((phase));\ - (x)->i = spx_cos_norm((phase)-32768);\ -}while(0) - - -/* a debugging function */ -#define pcpx(c)\ - fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) ) diff --git a/src/lib/dl/ext/speex/arch.h b/src/lib/dl/ext/speex/arch.h deleted file mode 100755 index d38c36ce..00000000 --- a/src/lib/dl/ext/speex/arch.h +++ /dev/null @@ -1,239 +0,0 @@ -/* Copyright (C) 2003 Jean-Marc Valin */ -/** - @file arch.h - @brief Various architecture definitions Speex -*/ -/* - 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 ARCH_H -#define ARCH_H - -#ifndef SPEEX_VERSION -#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */ -#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */ -#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */ -#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */ -#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */ -#endif - -/* A couple test to catch stupid option combinations */ -#ifdef FIXED_POINT - -#ifdef FLOATING_POINT -#error You cannot compile as floating point and fixed point at the same time -#endif -#ifdef _USE_SSE -#error SSE is only for floating-point -#endif -#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM)) -#error Make up your mind. What CPU do you have? -#endif -#ifdef VORBIS_PSYCHO -#error Vorbis-psy model currently not implemented in fixed-point -#endif - -#else - -#ifndef FLOATING_POINT -#error You now need to define either FIXED_POINT or FLOATING_POINT -#endif -#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM) -#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions? -#endif -#ifdef FIXED_POINT_DEBUG -#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?" -#endif - - -#endif - -#ifndef OUTSIDE_SPEEX -#include "speex/speex_types.h" -#endif - -#define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */ -#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */ -#define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */ -#define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */ -#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */ -#define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 32-bit value. */ -#define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */ - -#ifdef FIXED_POINT - -typedef spx_int16_t spx_word16_t; -typedef spx_int32_t spx_word32_t; -typedef spx_word32_t spx_mem_t; -typedef spx_word16_t spx_coef_t; -typedef spx_word16_t spx_lsp_t; -typedef spx_word32_t spx_sig_t; - -#define Q15ONE 32767 - -#define LPC_SCALING 8192 -#define SIG_SCALING 16384 -#define LSP_SCALING 8192. -#define GAMMA_SCALING 32768. -#define GAIN_SCALING 64 -#define GAIN_SCALING_1 0.015625 - -#define LPC_SHIFT 13 -#define LSP_SHIFT 13 -#define SIG_SHIFT 14 -#define GAIN_SHIFT 6 - -#define VERY_SMALL 0 -#define VERY_LARGE32 ((spx_word32_t)2147483647) -#define VERY_LARGE16 ((spx_word16_t)32767) -#define Q15_ONE ((spx_word16_t)32767) - - -#ifdef FIXED_DEBUG -#include "fixed_debug.h" -#else - -#include "fixed_generic.h" - -#ifdef ARM5E_ASM -#include "fixed_arm5e.h" -#elif defined (ARM4_ASM) -#include "fixed_arm4.h" -#elif defined (BFIN_ASM) -#include "fixed_bfin.h" -#endif - -#endif - - -#else - -typedef float spx_mem_t; -typedef float spx_coef_t; -typedef float spx_lsp_t; -typedef float spx_sig_t; -typedef float spx_word16_t; -typedef float spx_word32_t; - -#define Q15ONE 1.0f -#define LPC_SCALING 1.f -#define SIG_SCALING 1.f -#define LSP_SCALING 1.f -#define GAMMA_SCALING 1.f -#define GAIN_SCALING 1.f -#define GAIN_SCALING_1 1.f - - -#define VERY_SMALL 1e-15f -#define VERY_LARGE32 1e15f -#define VERY_LARGE16 1e15f -#define Q15_ONE ((spx_word16_t)1.f) - -#define QCONST16(x,bits) (x) -#define QCONST32(x,bits) (x) - -#define NEG16(x) (-(x)) -#define NEG32(x) (-(x)) -#define EXTRACT16(x) (x) -#define EXTEND32(x) (x) -#define SHR16(a,shift) (a) -#define SHL16(a,shift) (a) -#define SHR32(a,shift) (a) -#define SHL32(a,shift) (a) -#define PSHR16(a,shift) (a) -#define PSHR32(a,shift) (a) -#define VSHR32(a,shift) (a) -#define SATURATE16(x,a) (x) -#define SATURATE32(x,a) (x) - -#define PSHR(a,shift) (a) -#define SHR(a,shift) (a) -#define SHL(a,shift) (a) -#define SATURATE(x,a) (x) - -#define ADD16(a,b) ((a)+(b)) -#define SUB16(a,b) ((a)-(b)) -#define ADD32(a,b) ((a)+(b)) -#define SUB32(a,b) ((a)-(b)) -#define MULT16_16_16(a,b) ((a)*(b)) -#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b)) -#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b)) - -#define MULT16_32_Q11(a,b) ((a)*(b)) -#define MULT16_32_Q13(a,b) ((a)*(b)) -#define MULT16_32_Q14(a,b) ((a)*(b)) -#define MULT16_32_Q15(a,b) ((a)*(b)) -#define MULT16_32_P15(a,b) ((a)*(b)) - -#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b)) -#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) - -#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b)) -#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b)) -#define MAC16_16_P13(c,a,b) ((c)+(a)*(b)) -#define MULT16_16_Q11_32(a,b) ((a)*(b)) -#define MULT16_16_Q13(a,b) ((a)*(b)) -#define MULT16_16_Q14(a,b) ((a)*(b)) -#define MULT16_16_Q15(a,b) ((a)*(b)) -#define MULT16_16_P15(a,b) ((a)*(b)) -#define MULT16_16_P13(a,b) ((a)*(b)) -#define MULT16_16_P14(a,b) ((a)*(b)) - -#define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b)) -#define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b)) -#define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b)) -#define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b)) - - -#endif - - -#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) - -/* 2 on TI C5x DSP */ -#define BYTES_PER_CHAR 2 -#define BITS_PER_CHAR 16 -#define LOG2_BITS_PER_CHAR 4 - -#else - -#define BYTES_PER_CHAR 1 -#define BITS_PER_CHAR 8 -#define LOG2_BITS_PER_CHAR 3 - -#endif - - - -#ifdef FIXED_DEBUG -extern long long spx_mips; -#endif - - -#endif diff --git a/src/lib/dl/ext/speex/bits.c b/src/lib/dl/ext/speex/bits.c deleted file mode 100755 index 3ef7c6c1..00000000 --- a/src/lib/dl/ext/speex/bits.c +++ /dev/null @@ -1,372 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: speex_bits.c - - Handles bit packing/unpacking - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex_bits.h> -#include "arch.h" -#include "os_support.h" - -/* Maximum size of the bit-stream (for fixed-size allocation) */ -#ifndef MAX_CHARS_PER_FRAME -#define MAX_CHARS_PER_FRAME (2000/BYTES_PER_CHAR) -#endif - -EXPORT void speex_bits_init(SpeexBits *bits) -{ - bits->chars = (char*)speex_alloc(MAX_CHARS_PER_FRAME); - if (!bits->chars) - return; - - bits->buf_size = MAX_CHARS_PER_FRAME; - - bits->owner=1; - - speex_bits_reset(bits); -} - -EXPORT void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size) -{ - bits->chars = (char*)buff; - bits->buf_size = buf_size; - - bits->owner=0; - - speex_bits_reset(bits); -} - -EXPORT void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size) -{ - bits->chars = (char*)buff; - bits->buf_size = buf_size; - - bits->owner=0; - - bits->nbBits=buf_size<<LOG2_BITS_PER_CHAR; - bits->charPtr=0; - bits->bitPtr=0; - bits->overflow=0; - -} - -EXPORT void speex_bits_destroy(SpeexBits *bits) -{ - if (bits->owner) - speex_free(bits->chars); - /* Will do something once the allocation is dynamic */ -} - -EXPORT void speex_bits_reset(SpeexBits *bits) -{ - /* We only need to clear the first byte now */ - bits->chars[0]=0; - bits->nbBits=0; - bits->charPtr=0; - bits->bitPtr=0; - bits->overflow=0; -} - -EXPORT void speex_bits_rewind(SpeexBits *bits) -{ - bits->charPtr=0; - bits->bitPtr=0; - bits->overflow=0; -} - -EXPORT void speex_bits_read_from(SpeexBits *bits, char *chars, int len) -{ - int i; - int nchars = len / BYTES_PER_CHAR; - if (nchars > bits->buf_size) - { - speex_notify("Packet is larger than allocated buffer"); - if (bits->owner) - { - char *tmp = (char*)speex_realloc(bits->chars, nchars); - if (tmp) - { - bits->buf_size=nchars; - bits->chars=tmp; - } else { - nchars=bits->buf_size; - speex_warning("Could not resize input buffer: truncating input"); - } - } else { - speex_warning("Do not own input buffer: truncating oversize input"); - nchars=bits->buf_size; - } - } -#if (BYTES_PER_CHAR==2) -/* Swap bytes to proper endian order (could be done externally) */ -#define HTOLS(A) ((((A) >> 8)&0xff)|(((A) & 0xff)<<8)) -#else -#define HTOLS(A) (A) -#endif - for (i=0;i<nchars;i++) - bits->chars[i]=HTOLS(chars[i]); - - bits->nbBits=nchars<<LOG2_BITS_PER_CHAR; - bits->charPtr=0; - bits->bitPtr=0; - bits->overflow=0; -} - -static void speex_bits_flush(SpeexBits *bits) -{ - int nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR); - if (bits->charPtr>0) - SPEEX_MOVE(bits->chars, &bits->chars[bits->charPtr], nchars-bits->charPtr); - bits->nbBits -= bits->charPtr<<LOG2_BITS_PER_CHAR; - bits->charPtr=0; -} - -EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes) -{ - int i,pos; - int nchars = nbytes/BYTES_PER_CHAR; - - if (((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR)+nchars > bits->buf_size) - { - /* Packet is larger than allocated buffer */ - if (bits->owner) - { - char *tmp = (char*)speex_realloc(bits->chars, (bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1); - if (tmp) - { - bits->buf_size=(bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1; - bits->chars=tmp; - } else { - nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1; - speex_warning("Could not resize input buffer: truncating oversize input"); - } - } else { - speex_warning("Do not own input buffer: truncating oversize input"); - nchars=bits->buf_size; - } - } - - speex_bits_flush(bits); - pos=bits->nbBits>>LOG2_BITS_PER_CHAR; - for (i=0;i<nchars;i++) - bits->chars[pos+i]=HTOLS(chars[i]); - bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR; -} - -EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes) -{ - int i; - int max_nchars = max_nbytes/BYTES_PER_CHAR; - int charPtr, bitPtr, nbBits; - - /* Insert terminator, but save the data so we can put it back after */ - bitPtr=bits->bitPtr; - charPtr=bits->charPtr; - nbBits=bits->nbBits; - speex_bits_insert_terminator(bits); - bits->bitPtr=bitPtr; - bits->charPtr=charPtr; - bits->nbBits=nbBits; - - if (max_nchars > ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR)) - max_nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR); - - for (i=0;i<max_nchars;i++) - chars[i]=HTOLS(bits->chars[i]); - return max_nchars*BYTES_PER_CHAR; -} - -EXPORT int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes) -{ - int max_nchars = max_nbytes/BYTES_PER_CHAR; - int i; - if (max_nchars > ((bits->nbBits)>>LOG2_BITS_PER_CHAR)) - max_nchars = ((bits->nbBits)>>LOG2_BITS_PER_CHAR); - for (i=0;i<max_nchars;i++) - chars[i]=HTOLS(bits->chars[i]); - - if (bits->bitPtr>0) - bits->chars[0]=bits->chars[max_nchars]; - else - bits->chars[0]=0; - bits->charPtr=0; - bits->nbBits &= (BITS_PER_CHAR-1); - return max_nchars*BYTES_PER_CHAR; -} - -EXPORT void speex_bits_pack(SpeexBits *bits, int data, int nbBits) -{ - unsigned int d=data; - - if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size) - { - speex_notify("Buffer too small to pack bits"); - if (bits->owner) - { - int new_nchars = ((bits->buf_size+5)*3)>>1; - char *tmp = (char*)speex_realloc(bits->chars, new_nchars); - if (tmp) - { - bits->buf_size=new_nchars; - bits->chars=tmp; - } else { - speex_warning("Could not resize input buffer: not packing"); - return; - } - } else { - speex_warning("Do not own input buffer: not packing"); - return; - } - } - - while(nbBits) - { - int bit; - bit = (d>>(nbBits-1))&1; - bits->chars[bits->charPtr] |= bit<<(BITS_PER_CHAR-1-bits->bitPtr); - bits->bitPtr++; - - if (bits->bitPtr==BITS_PER_CHAR) - { - bits->bitPtr=0; - bits->charPtr++; - bits->chars[bits->charPtr] = 0; - } - bits->nbBits++; - nbBits--; - } -} - -EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits) -{ - unsigned int d=speex_bits_unpack_unsigned(bits,nbBits); - /* If number is negative */ - if (d>>(nbBits-1)) - { - d |= (-1)<<nbBits; - } - return d; -} - -EXPORT unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits) -{ - unsigned int d=0; - if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits) - bits->overflow=1; - if (bits->overflow) - return 0; - while(nbBits) - { - d<<=1; - d |= (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1; - bits->bitPtr++; - if (bits->bitPtr==BITS_PER_CHAR) - { - bits->bitPtr=0; - bits->charPtr++; - } - nbBits--; - } - return d; -} - -EXPORT unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits) -{ - unsigned int d=0; - int bitPtr, charPtr; - char *chars; - - if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits) - bits->overflow=1; - if (bits->overflow) - return 0; - - bitPtr=bits->bitPtr; - charPtr=bits->charPtr; - chars = bits->chars; - while(nbBits) - { - d<<=1; - d |= (chars[charPtr]>>(BITS_PER_CHAR-1 - bitPtr))&1; - bitPtr++; - if (bitPtr==BITS_PER_CHAR) - { - bitPtr=0; - charPtr++; - } - nbBits--; - } - return d; -} - -EXPORT int speex_bits_peek(SpeexBits *bits) -{ - if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+1>bits->nbBits) - bits->overflow=1; - if (bits->overflow) - return 0; - return (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1; -} - -EXPORT void speex_bits_advance(SpeexBits *bits, int n) -{ - if (((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+n>bits->nbBits) || bits->overflow){ - bits->overflow=1; - return; - } - bits->charPtr += (bits->bitPtr+n) >> LOG2_BITS_PER_CHAR; /* divide by BITS_PER_CHAR */ - bits->bitPtr = (bits->bitPtr+n) & (BITS_PER_CHAR-1); /* modulo by BITS_PER_CHAR */ -} - -EXPORT int speex_bits_remaining(SpeexBits *bits) -{ - if (bits->overflow) - return -1; - else - return bits->nbBits-((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr); -} - -EXPORT int speex_bits_nbytes(SpeexBits *bits) -{ - return ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR); -} - -EXPORT void speex_bits_insert_terminator(SpeexBits *bits) -{ - if (bits->bitPtr) - speex_bits_pack(bits, 0, 1); - while (bits->bitPtr) - speex_bits_pack(bits, 1, 1); -} diff --git a/src/lib/dl/ext/speex/buffer.c b/src/lib/dl/ext/speex/buffer.c deleted file mode 100755 index 6cfd5a34..00000000 --- a/src/lib/dl/ext/speex/buffer.c +++ /dev/null @@ -1,176 +0,0 @@ -/* Copyright (C) 2007 Jean-Marc Valin - - File: buffer.c - This is a very simple ring buffer implementation. It is not thread-safe - so you need to do your own locking. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - - -#include "os_support.h" -#include "arch.h" -#include <speex/speex_buffer.h> - -struct SpeexBuffer_ { - char *data; - int size; - int read_ptr; - int write_ptr; - int available; -}; - -EXPORT SpeexBuffer *speex_buffer_init(int size) -{ - SpeexBuffer *st = speex_alloc(sizeof(SpeexBuffer)); - st->data = speex_alloc(size); - st->size = size; - st->read_ptr = 0; - st->write_ptr = 0; - st->available = 0; - return st; -} - -EXPORT void speex_buffer_destroy(SpeexBuffer *st) -{ - speex_free(st->data); - speex_free(st); -} - -EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len) -{ - int end; - int end1; - char *data = _data; - if (len > st->size) - { - data += len-st->size; - len = st->size; - } - end = st->write_ptr + len; - end1 = end; - if (end1 > st->size) - end1 = st->size; - SPEEX_COPY(st->data + st->write_ptr, data, end1 - st->write_ptr); - if (end > st->size) - { - end -= st->size; - SPEEX_COPY(st->data, data+end1 - st->write_ptr, end); - } - st->available += len; - if (st->available > st->size) - { - st->available = st->size; - st->read_ptr = st->write_ptr; - } - st->write_ptr += len; - if (st->write_ptr > st->size) - st->write_ptr -= st->size; - return len; -} - -EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len) -{ - /* This is almost the same as for speex_buffer_write() but using - SPEEX_MEMSET() instead of SPEEX_COPY(). Update accordingly. */ - int end; - int end1; - if (len > st->size) - { - len = st->size; - } - end = st->write_ptr + len; - end1 = end; - if (end1 > st->size) - end1 = st->size; - SPEEX_MEMSET(st->data + st->write_ptr, 0, end1 - st->write_ptr); - if (end > st->size) - { - end -= st->size; - SPEEX_MEMSET(st->data, 0, end); - } - st->available += len; - if (st->available > st->size) - { - st->available = st->size; - st->read_ptr = st->write_ptr; - } - st->write_ptr += len; - if (st->write_ptr > st->size) - st->write_ptr -= st->size; - return len; -} - -EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len) -{ - int end, end1; - char *data = _data; - if (len > st->available) - { - SPEEX_MEMSET(data+st->available, 0, st->size-st->available); - len = st->available; - } - end = st->read_ptr + len; - end1 = end; - if (end1 > st->size) - end1 = st->size; - SPEEX_COPY(data, st->data + st->read_ptr, end1 - st->read_ptr); - - if (end > st->size) - { - end -= st->size; - SPEEX_COPY(data+end1 - st->read_ptr, st->data, end); - } - st->available -= len; - st->read_ptr += len; - if (st->read_ptr > st->size) - st->read_ptr -= st->size; - return len; -} - -EXPORT int speex_buffer_get_available(SpeexBuffer *st) -{ - return st->available; -} - -EXPORT int speex_buffer_resize(SpeexBuffer *st, int len) -{ - int old_len = st->size; - if (len > old_len) - { - st->data = speex_realloc(st->data, len); - /* FIXME: move data/pointers properly for growing the buffer */ - } else { - /* FIXME: move data/pointers properly for shrinking the buffer */ - st->data = speex_realloc(st->data, len); - } - return len; -} diff --git a/src/lib/dl/ext/speex/cb_search.c b/src/lib/dl/ext/speex/cb_search.c deleted file mode 100755 index 63f4c6a4..00000000 --- a/src/lib/dl/ext/speex/cb_search.c +++ /dev/null @@ -1,612 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: cb_search.c - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "cb_search.h" -#include "filters.h" -#include "stack_alloc.h" -#include "vq.h" -#include "arch.h" -#include "math_approx.h" -#include "os_support.h" - -#ifdef _USE_SSE -#include "cb_search_sse.h" -#elif defined(ARM4_ASM) || defined(ARM5E_ASM) -#include "cb_search_arm4.h" -#elif defined(BFIN_ASM) -#include "cb_search_bfin.h" -#endif - -#ifndef OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK -static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack) -{ - int i, j, k; - VARDECL(spx_word16_t *shape); - ALLOC(shape, subvect_size, spx_word16_t); - for (i=0;i<shape_cb_size;i++) - { - spx_word16_t *res; - - res = resp+i*subvect_size; - for (k=0;k<subvect_size;k++) - shape[k] = (spx_word16_t)shape_cb[i*subvect_size+k]; - E[i]=0; - - /* Compute codeword response using convolution with impulse response */ - for(j=0;j<subvect_size;j++) - { - spx_word32_t resj=0; - spx_word16_t res16; - for (k=0;k<=j;k++) - resj = MAC16_16(resj,shape[k],r[j-k]); -#ifdef FIXED_POINT - res16 = EXTRACT16(SHR32(resj, 13)); -#else - res16 = 0.03125f*resj; -#endif - /* Compute codeword energy */ - E[i]=MAC16_16(E[i],res16,res16); - res[j] = res16; - /*printf ("%d\n", (int)res[j]);*/ - } - } - -} -#endif - -#ifndef OVERRIDE_TARGET_UPDATE -static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len) -{ - int n; - for (n=0;n<len;n++) - t[n] = SUB16(t[n],PSHR32(MULT16_16(g,r[n]),13)); -} -#endif - - - -static void split_cb_search_shape_sign_N1( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ -const void *par, /* Codebook/search parameters*/ -int p, /* number of LPC coeffs */ -int nsf, /* number of samples in subframe */ -spx_sig_t *exc, -spx_word16_t *r, -SpeexBits *bits, -char *stack, -int update_target -) -{ - int i,j,m,q; - VARDECL(spx_word16_t *resp); -#ifdef _USE_SSE - VARDECL(__m128 *resp2); - VARDECL(__m128 *E); -#else - spx_word16_t *resp2; - VARDECL(spx_word32_t *E); -#endif - VARDECL(spx_word16_t *t); - VARDECL(spx_sig_t *e); - const signed char *shape_cb; - int shape_cb_size, subvect_size, nb_subvect; - const split_cb_params *params; - int best_index; - spx_word32_t best_dist; - int have_sign; - - params = (const split_cb_params *) par; - subvect_size = params->subvect_size; - nb_subvect = params->nb_subvect; - shape_cb_size = 1<<params->shape_bits; - shape_cb = params->shape_cb; - have_sign = params->have_sign; - ALLOC(resp, shape_cb_size*subvect_size, spx_word16_t); -#ifdef _USE_SSE - ALLOC(resp2, (shape_cb_size*subvect_size)>>2, __m128); - ALLOC(E, shape_cb_size>>2, __m128); -#else - resp2 = resp; - ALLOC(E, shape_cb_size, spx_word32_t); -#endif - ALLOC(t, nsf, spx_word16_t); - ALLOC(e, nsf, spx_sig_t); - - /* FIXME: Do we still need to copy the target? */ - SPEEX_COPY(t, target, nsf); - - compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack); - - for (i=0;i<nb_subvect;i++) - { - spx_word16_t *x=t+subvect_size*i; - /*Find new n-best based on previous n-best j*/ - if (have_sign) - vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack); - else - vq_nbest(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack); - - speex_bits_pack(bits,best_index,params->shape_bits+have_sign); - - { - int rind; - spx_word16_t *res; - spx_word16_t sign=1; - rind = best_index; - if (rind>=shape_cb_size) - { - sign=-1; - rind-=shape_cb_size; - } - res = resp+rind*subvect_size; - if (sign>0) - for (m=0;m<subvect_size;m++) - t[subvect_size*i+m] = SUB16(t[subvect_size*i+m], res[m]); - else - for (m=0;m<subvect_size;m++) - t[subvect_size*i+m] = ADD16(t[subvect_size*i+m], res[m]); - -#ifdef FIXED_POINT - if (sign==1) - { - for (j=0;j<subvect_size;j++) - e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5); - } else { - for (j=0;j<subvect_size;j++) - e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5)); - } -#else - for (j=0;j<subvect_size;j++) - e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j]; -#endif - - } - - for (m=0;m<subvect_size;m++) - { - spx_word16_t g; - int rind; - spx_word16_t sign=1; - rind = best_index; - if (rind>=shape_cb_size) - { - sign=-1; - rind-=shape_cb_size; - } - - q=subvect_size-m; -#ifdef FIXED_POINT - g=sign*shape_cb[rind*subvect_size+m]; -#else - g=sign*0.03125*shape_cb[rind*subvect_size+m]; -#endif - target_update(t+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1)); - } - } - - /* Update excitation */ - /* FIXME: We could update the excitation directly above */ - for (j=0;j<nsf;j++) - exc[j]=ADD32(exc[j],e[j]); - - /* Update target: only update target if necessary */ - if (update_target) - { - VARDECL(spx_word16_t *r2); - ALLOC(r2, nsf, spx_word16_t); - for (j=0;j<nsf;j++) - r2[j] = EXTRACT16(PSHR32(e[j] ,6)); - syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack); - for (j=0;j<nsf;j++) - target[j]=SUB16(target[j],PSHR16(r2[j],2)); - } -} - - - -void split_cb_search_shape_sign( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ -const void *par, /* Codebook/search parameters*/ -int p, /* number of LPC coeffs */ -int nsf, /* number of samples in subframe */ -spx_sig_t *exc, -spx_word16_t *r, -SpeexBits *bits, -char *stack, -int complexity, -int update_target -) -{ - int i,j,k,m,n,q; - VARDECL(spx_word16_t *resp); -#ifdef _USE_SSE - VARDECL(__m128 *resp2); - VARDECL(__m128 *E); -#else - spx_word16_t *resp2; - VARDECL(spx_word32_t *E); -#endif - VARDECL(spx_word16_t *t); - VARDECL(spx_sig_t *e); - VARDECL(spx_word16_t *tmp); - VARDECL(spx_word32_t *ndist); - VARDECL(spx_word32_t *odist); - VARDECL(int *itmp); - VARDECL(spx_word16_t **ot2); - VARDECL(spx_word16_t **nt2); - spx_word16_t **ot, **nt; - VARDECL(int **nind); - VARDECL(int **oind); - VARDECL(int *ind); - const signed char *shape_cb; - int shape_cb_size, subvect_size, nb_subvect; - const split_cb_params *params; - int N=2; - VARDECL(int *best_index); - VARDECL(spx_word32_t *best_dist); - VARDECL(int *best_nind); - VARDECL(int *best_ntarget); - int have_sign; - N=complexity; - if (N>10) - N=10; - /* Complexity isn't as important for the codebooks as it is for the pitch */ - N=(2*N)/3; - if (N<1) - N=1; - if (N==1) - { - split_cb_search_shape_sign_N1(target,ak,awk1,awk2,par,p,nsf,exc,r,bits,stack,update_target); - return; - } - ALLOC(ot2, N, spx_word16_t*); - ALLOC(nt2, N, spx_word16_t*); - ALLOC(oind, N, int*); - ALLOC(nind, N, int*); - - params = (const split_cb_params *) par; - subvect_size = params->subvect_size; - nb_subvect = params->nb_subvect; - shape_cb_size = 1<<params->shape_bits; - shape_cb = params->shape_cb; - have_sign = params->have_sign; - ALLOC(resp, shape_cb_size*subvect_size, spx_word16_t); -#ifdef _USE_SSE - ALLOC(resp2, (shape_cb_size*subvect_size)>>2, __m128); - ALLOC(E, shape_cb_size>>2, __m128); -#else - resp2 = resp; - ALLOC(E, shape_cb_size, spx_word32_t); -#endif - ALLOC(t, nsf, spx_word16_t); - ALLOC(e, nsf, spx_sig_t); - ALLOC(ind, nb_subvect, int); - - ALLOC(tmp, 2*N*nsf, spx_word16_t); - for (i=0;i<N;i++) - { - ot2[i]=tmp+2*i*nsf; - nt2[i]=tmp+(2*i+1)*nsf; - } - ot=ot2; - nt=nt2; - ALLOC(best_index, N, int); - ALLOC(best_dist, N, spx_word32_t); - ALLOC(best_nind, N, int); - ALLOC(best_ntarget, N, int); - ALLOC(ndist, N, spx_word32_t); - ALLOC(odist, N, spx_word32_t); - - ALLOC(itmp, 2*N*nb_subvect, int); - for (i=0;i<N;i++) - { - nind[i]=itmp+2*i*nb_subvect; - oind[i]=itmp+(2*i+1)*nb_subvect; - } - - SPEEX_COPY(t, target, nsf); - - for (j=0;j<N;j++) - SPEEX_COPY(&ot[j][0], t, nsf); - - /* Pre-compute codewords response and energy */ - compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack); - - for (j=0;j<N;j++) - odist[j]=0; - - /*For all subvectors*/ - for (i=0;i<nb_subvect;i++) - { - /*"erase" nbest list*/ - for (j=0;j<N;j++) - ndist[j]=VERY_LARGE32; - /* This is not strictly necessary, but it provides an additonal safety - to prevent crashes in case something goes wrong in the previous - steps (e.g. NaNs) */ - for (j=0;j<N;j++) - best_nind[j] = best_ntarget[j] = 0; - /*For all n-bests of previous subvector*/ - for (j=0;j<N;j++) - { - spx_word16_t *x=ot[j]+subvect_size*i; - spx_word32_t tener = 0; - for (m=0;m<subvect_size;m++) - tener = MAC16_16(tener, x[m],x[m]); -#ifdef FIXED_POINT - tener = SHR32(tener,1); -#else - tener *= .5; -#endif - /*Find new n-best based on previous n-best j*/ - if (have_sign) - vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist, stack); - else - vq_nbest(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist, stack); - - /*For all new n-bests*/ - for (k=0;k<N;k++) - { - /* Compute total distance (including previous sub-vectors */ - spx_word32_t err = ADD32(ADD32(odist[j],best_dist[k]),tener); - - /*update n-best list*/ - if (err<ndist[N-1]) - { - for (m=0;m<N;m++) - { - if (err < ndist[m]) - { - for (n=N-1;n>m;n--) - { - ndist[n] = ndist[n-1]; - best_nind[n] = best_nind[n-1]; - best_ntarget[n] = best_ntarget[n-1]; - } - /* n is equal to m here, so they're interchangeable */ - ndist[m] = err; - best_nind[n] = best_index[k]; - best_ntarget[n] = j; - break; - } - } - } - } - if (i==0) - break; - } - for (j=0;j<N;j++) - { - /*previous target (we don't care what happened before*/ - for (m=(i+1)*subvect_size;m<nsf;m++) - nt[j][m]=ot[best_ntarget[j]][m]; - - /* New code: update the rest of the target only if it's worth it */ - for (m=0;m<subvect_size;m++) - { - spx_word16_t g; - int rind; - spx_word16_t sign=1; - rind = best_nind[j]; - if (rind>=shape_cb_size) - { - sign=-1; - rind-=shape_cb_size; - } - - q=subvect_size-m; -#ifdef FIXED_POINT - g=sign*shape_cb[rind*subvect_size+m]; -#else - g=sign*0.03125*shape_cb[rind*subvect_size+m]; -#endif - target_update(nt[j]+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1)); - } - - for (q=0;q<nb_subvect;q++) - nind[j][q]=oind[best_ntarget[j]][q]; - nind[j][i]=best_nind[j]; - } - - /*update old-new data*/ - /* just swap pointers instead of a long copy */ - { - spx_word16_t **tmp2; - tmp2=ot; - ot=nt; - nt=tmp2; - } - for (j=0;j<N;j++) - for (m=0;m<nb_subvect;m++) - oind[j][m]=nind[j][m]; - for (j=0;j<N;j++) - odist[j]=ndist[j]; - } - - /*save indices*/ - for (i=0;i<nb_subvect;i++) - { - ind[i]=nind[0][i]; - speex_bits_pack(bits,ind[i],params->shape_bits+have_sign); - } - - /* Put everything back together */ - for (i=0;i<nb_subvect;i++) - { - int rind; - spx_word16_t sign=1; - rind = ind[i]; - if (rind>=shape_cb_size) - { - sign=-1; - rind-=shape_cb_size; - } -#ifdef FIXED_POINT - if (sign==1) - { - for (j=0;j<subvect_size;j++) - e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5); - } else { - for (j=0;j<subvect_size;j++) - e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5)); - } -#else - for (j=0;j<subvect_size;j++) - e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j]; -#endif - } - /* Update excitation */ - for (j=0;j<nsf;j++) - exc[j]=ADD32(exc[j],e[j]); - - /* Update target: only update target if necessary */ - if (update_target) - { - VARDECL(spx_word16_t *r2); - ALLOC(r2, nsf, spx_word16_t); - for (j=0;j<nsf;j++) - r2[j] = EXTRACT16(PSHR32(e[j] ,6)); - syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack); - for (j=0;j<nsf;j++) - target[j]=SUB16(target[j],PSHR16(r2[j],2)); - } -} - - -void split_cb_shape_sign_unquant( -spx_sig_t *exc, -const void *par, /* non-overlapping codebook */ -int nsf, /* number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_int32_t *seed -) -{ - int i,j; - VARDECL(int *ind); - VARDECL(int *signs); - const signed char *shape_cb; - int shape_cb_size, subvect_size, nb_subvect; - const split_cb_params *params; - int have_sign; - - params = (const split_cb_params *) par; - subvect_size = params->subvect_size; - nb_subvect = params->nb_subvect; - shape_cb_size = 1<<params->shape_bits; - shape_cb = params->shape_cb; - have_sign = params->have_sign; - - ALLOC(ind, nb_subvect, int); - ALLOC(signs, nb_subvect, int); - - /* Decode codewords and gains */ - for (i=0;i<nb_subvect;i++) - { - if (have_sign) - signs[i] = speex_bits_unpack_unsigned(bits, 1); - else - signs[i] = 0; - ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits); - } - /* Compute decoded excitation */ - for (i=0;i<nb_subvect;i++) - { - spx_word16_t s=1; - if (signs[i]) - s=-1; -#ifdef FIXED_POINT - if (s==1) - { - for (j=0;j<subvect_size;j++) - exc[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5); - } else { - for (j=0;j<subvect_size;j++) - exc[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5)); - } -#else - for (j=0;j<subvect_size;j++) - exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j]; -#endif - } -} - -void noise_codebook_quant( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ -const void *par, /* Codebook/search parameters*/ -int p, /* number of LPC coeffs */ -int nsf, /* number of samples in subframe */ -spx_sig_t *exc, -spx_word16_t *r, -SpeexBits *bits, -char *stack, -int complexity, -int update_target -) -{ - int i; - VARDECL(spx_word16_t *tmp); - ALLOC(tmp, nsf, spx_word16_t); - residue_percep_zero16(target, ak, awk1, awk2, tmp, nsf, p, stack); - - for (i=0;i<nsf;i++) - exc[i]+=SHL32(EXTEND32(tmp[i]),8); - SPEEX_MEMSET(target, 0, nsf); -} - - -void noise_codebook_unquant( -spx_sig_t *exc, -const void *par, /* non-overlapping codebook */ -int nsf, /* number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_int32_t *seed -) -{ - int i; - /* FIXME: This is bad, but I don't think the function ever gets called anyway */ - for (i=0;i<nsf;i++) - exc[i]=SHL32(EXTEND32(speex_rand(1, seed)),SIG_SHIFT); -} diff --git a/src/lib/dl/ext/speex/cb_search.h b/src/lib/dl/ext/speex/cb_search.h deleted file mode 100755 index 7687b453..00000000 --- a/src/lib/dl/ext/speex/cb_search.h +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin & David Rowe */ -/** - @file cb_search.h - @brief Overlapped codebook search -*/ -/* - 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 CB_SEARCH_H -#define CB_SEARCH_H - -#include <speex/speex_bits.h> -#include "arch.h" - -/** Split codebook parameters. */ -typedef struct split_cb_params { - int subvect_size; - int nb_subvect; - const signed char *shape_cb; - int shape_bits; - int have_sign; -} split_cb_params; - - -void split_cb_search_shape_sign( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ -const void *par, /* Codebook/search parameters */ -int p, /* number of LPC coeffs */ -int nsf, /* number of samples in subframe */ -spx_sig_t *exc, -spx_word16_t *r, -SpeexBits *bits, -char *stack, -int complexity, -int update_target -); - -void split_cb_shape_sign_unquant( -spx_sig_t *exc, -const void *par, /* non-overlapping codebook */ -int nsf, /* number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_int32_t *seed -); - - -void noise_codebook_quant( -spx_word16_t target[], /* target vector */ -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs for this subframe */ -const void *par, /* Codebook/search parameters */ -int p, /* number of LPC coeffs */ -int nsf, /* number of samples in subframe */ -spx_sig_t *exc, -spx_word16_t *r, -SpeexBits *bits, -char *stack, -int complexity, -int update_target -); - - -void noise_codebook_unquant( -spx_sig_t *exc, -const void *par, /* non-overlapping codebook */ -int nsf, /* number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_int32_t *seed -); - -#endif diff --git a/src/lib/dl/ext/speex/cb_search_arm4.h b/src/lib/dl/ext/speex/cb_search_arm4.h deleted file mode 100755 index 19b752a4..00000000 --- a/src/lib/dl/ext/speex/cb_search_arm4.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Copyright (C) 2004 Jean-Marc Valin */ -/** - @file cb_search_arm4.h - @brief Fixed codebook functions (ARM4 version) -*/ -/* - 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. -*/ - -/* This optimization is temporaly disabled until it is fixed to account for the fact - that "r" is now a 16-bit array */ -#if 0 -#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK -static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack) -{ - int i, j, k; - //const signed char *shape; - for (i=0;i<shape_cb_size;i+=4) - { - - //shape = shape_cb; - E[0]=0; - E[1]=0; - E[2]=0; - E[3]=0; - - /* Compute codeword response using convolution with impulse response */ - for(j=0;j<subvect_size;j++) - { -#if 1 - spx_word16_t *res; - res = resp+j; - spx_word32_t resj0,resj1,resj2,resj3; - spx_word32_t dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8; - __asm__ __volatile__ ( - "mov %0, #0 \n\t" - "mov %1, #0 \n\t" - "mov %2, #0 \n\t" - "mov %3, #0 \n\t" - ".weighted%=: \n\t" - "ldrsb %8, [%6] \n\t" - "ldr %10, [%5], #-4 \n\t" - "mov %9, %6 \n\t" - "ldrsb %11, [%9, %7]! \n\t" - "mla %0, %10, %8, %0 \n\t" - "ldrsb %8, [%9, %7]! \n\t" - "mla %1, %10, %11, %1 \n\t" - "ldrsb %11, [%9, %7]! \n\t" - "mla %2, %10, %8, %2 \n\t" - "subs %4, %4, #1 \n\t" - "mla %3, %10, %11, %3 \n\t" - "add %6, %6, #1 \n\t" - "bne .weighted%= \n\t" - : "=r" (resj0), "=r" (resj1), "=r" (resj2), "=r" (resj3), - "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4), - "=r" (dead5), "=r" (dead6), "=r" (dead7), "=r" (dead8) - : "4" (j+1), "5" (r+j), "6" (shape_cb), "7" (subvect_size) - : "cc", "memory"); -#else - spx_word16_t *res; - res = resp+j; - spx_word32_t resj0=0; - spx_word32_t resj1=0; - spx_word32_t resj2=0; - spx_word32_t resj3=0; - for (k=0;k<=j;k++) - { - const signed char *shape=shape_cb+k; - resj0 = MAC16_16(resj0,*shape,r[j-k]); - shape += subvect_size; - resj1 = MAC16_16(resj1,*shape,r[j-k]); - shape += subvect_size; - resj2 = MAC16_16(resj2,*shape,r[j-k]); - shape += subvect_size; - resj3 = MAC16_16(resj3,*shape,r[j-k]); - shape += subvect_size; - } -#endif - -#ifdef FIXED_POINT - resj0 = SHR(resj0, 11); - resj1 = SHR(resj1, 11); - resj2 = SHR(resj2, 11); - resj3 = SHR(resj3, 11); -#else - resj0 *= 0.03125; - resj1 *= 0.03125; - resj2 *= 0.03125; - resj3 *= 0.03125; -#endif - - /* Compute codeword energy */ - E[0]=ADD32(E[0],MULT16_16(resj0,resj0)); - E[1]=ADD32(E[1],MULT16_16(resj1,resj1)); - E[2]=ADD32(E[2],MULT16_16(resj2,resj2)); - E[3]=ADD32(E[3],MULT16_16(resj3,resj3)); - *res = resj0; - res += subvect_size; - *res = resj1; - res += subvect_size; - *res = resj2; - res += subvect_size; - *res = resj3; - res += subvect_size; - } - resp += subvect_size<<2; - shape_cb += subvect_size<<2; - E+=4; - } - -} -#endif diff --git a/src/lib/dl/ext/speex/cb_search_bfin.h b/src/lib/dl/ext/speex/cb_search_bfin.h deleted file mode 100755 index ae9cf834..00000000 --- a/src/lib/dl/ext/speex/cb_search_bfin.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright (C) 2005 Analog Devices */ -/** - @author Jean-Marc Valin - @file cb_search_bfin.h - @brief Fixed codebook functions (Blackfin version) -*/ -/* - 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. -*/ - -#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK -void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack) -{ - int i; - for (i=0;i<shape_cb_size;i++) - { - __asm__ __volatile__ ( - "P0 = %0;\n\t" - "LC0 = P0;\n\t" - "P1 = %1;\n\t" - "P2 = %2;\n\t" - "P3 = %3;\n\t" - "P0 = 1;\n\t" - "L0 = 0;\n\t" - "L1 = 0;\n\t" - "R2 = 0;\n\t" - "A1 = 0;\n\t" - "LOOP outter%= LC0;\n\t" - "LOOP_BEGIN outter%=;\n\t" - "A0 = 0;\n\t" - "P4 = P1;\n\t" - "I1 = P2;\n\t" - "R0 = B[P4++] (X) || R1.L = W[I1--];\n\t" - "LOOP inner%= LC1 = P0;\n\t" - "LOOP_BEGIN inner%=;\n\t" - "A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t" - "LOOP_END inner%=;\n\t" - "R0 = A0;\n\t" - "R0 >>>= 13;\n\t" - "A1 += R0.L*R0.L (IS);\n\t" - "W[P3++] = R0;\n\t" - "P0 += 1;\n\t" - "P2 += 2;\n\t" - "LOOP_END outter%=;\n\t" - "P4 = %4;\n\t" - "R1 = A1;\n\t" - "[P4] = R1;\n\t" - : - : "m" (subvect_size), "m" (shape_cb), "m" (r), "m" (resp), "m" (E) - : "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0", - "L1", "A0", "A1", "memory" -#if !(__GNUC__ == 3) - , "LC0", "LC1" /* gcc 3.4 doesn't know about LC registers */ -#endif - ); - shape_cb += subvect_size; - resp += subvect_size; - E++; - } -} - -#define OVERRIDE_TARGET_UPDATE -static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len) -{ - if (!len) - return; - __asm__ __volatile__ - ( - "I0 = %0;\n\t" - "I1 = %1;\n\t" - "L0 = 0;\n\t" - "L1 = 0;\n\t" - "R2 = 4096;\n\t" - "LOOP tupdate%= LC0 = %3;\n\t" - "LOOP_BEGIN tupdate%=;\n\t" - "R0.L = W[I0] || R1.L = W[I1++];\n\t" - "R1 = (A1 = R1.L*%2.L) (IS);\n\t" - "R1 = R1 + R2;\n\t" - "R1 >>>= 13;\n\t" - "R0.L = R0.L - R1.L;\n\t" - "W[I0++] = R0.L;\n\t" - "LOOP_END tupdate%=;\n\t" - : - : "a" (t), "a" (r), "d" (g), "a" (len) - : "R0", "R1", "R2", "A1", "I0", "I1", "L0", "L1" - ); -} diff --git a/src/lib/dl/ext/speex/cb_search_sse.h b/src/lib/dl/ext/speex/cb_search_sse.h deleted file mode 100755 index 8b039686..00000000 --- a/src/lib/dl/ext/speex/cb_search_sse.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (C) 2004 Jean-Marc Valin */ -/** - @file cb_search_sse.h - @brief Fixed codebook functions (SSE version) -*/ -/* - 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 <xmmintrin.h> - -static inline void _spx_mm_getr_ps (__m128 U, float *__Z, float *__Y, float *__X, float *__W) -{ - union { - float __a[4]; - __m128 __v; - } __u; - - __u.__v = U; - - *__Z = __u.__a[0]; - *__Y = __u.__a[1]; - *__X = __u.__a[2]; - *__W = __u.__a[3]; - -} - -#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK -static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *_r, float *resp, __m128 *resp2, __m128 *E, int shape_cb_size, int subvect_size, char *stack) -{ - int i, j, k; - __m128 resj, EE; - VARDECL(__m128 *r); - VARDECL(__m128 *shape); - ALLOC(r, subvect_size, __m128); - ALLOC(shape, subvect_size, __m128); - for(j=0;j<subvect_size;j++) - r[j] = _mm_load_ps1(_r+j); - for (i=0;i<shape_cb_size;i+=4) - { - float *_res = resp+i*subvect_size; - const signed char *_shape = shape_cb+i*subvect_size; - EE = _mm_setzero_ps(); - for(j=0;j<subvect_size;j++) - { - shape[j] = _mm_setr_ps(0.03125*_shape[j], 0.03125*_shape[subvect_size+j], 0.03125*_shape[2*subvect_size+j], 0.03125*_shape[3*subvect_size+j]); - } - for(j=0;j<subvect_size;j++) - { - resj = _mm_setzero_ps(); - for (k=0;k<=j;k++) - resj = _mm_add_ps(resj, _mm_mul_ps(shape[k],r[j-k])); - _spx_mm_getr_ps(resj, _res+j, _res+subvect_size+j, _res+2*subvect_size+j, _res+3*subvect_size+j); - *resp2++ = resj; - EE = _mm_add_ps(EE, _mm_mul_ps(resj, resj)); - } - E[i>>2] = EE; - } -} diff --git a/src/lib/dl/ext/speex/common.mak b/src/lib/dl/ext/speex/common.mak deleted file mode 100755 index d6b4d282..00000000 --- a/src/lib/dl/ext/speex/common.mak +++ /dev/null @@ -1,43 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_SPEEX_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)bits.obj $(SUBDIR)$(HPS)buffer.obj $(SUBDIR)$(HPS)cb_search.obj $(SUBDIR)$(HPS)exc_10_16_table.obj $(SUBDIR)$(HPS)exc_10_32_table.obj $(SUBDIR)$(HPS)exc_20_32_table.obj $(SUBDIR)$(HPS)exc_5_256_table.obj $(SUBDIR)$(HPS)exc_5_64_table.obj $(SUBDIR)$(HPS)exc_8_128_table.obj $(SUBDIR)$(HPS)fftwrap.obj $(SUBDIR)$(HPS)filterbank.obj $(SUBDIR)$(HPS)filters.obj $(SUBDIR)$(HPS)gain_table.obj $(SUBDIR)$(HPS)gain_table_lbr.obj $(SUBDIR)$(HPS)hexc_10_32_table.obj $(SUBDIR)$(HPS)hexc_table.obj $(SUBDIR)$(HPS)high_lsp_tables.obj $(SUBDIR)$(HPS)jitter.obj $(SUBDIR)$(HPS)kiss_fft.obj $(SUBDIR)$(HPS)kiss_fftr.obj $(SUBDIR)$(HPS)lpc.obj $(SUBDIR)$(HPS)lsp.obj $(SUBDIR)$(HPS)lsp_tables_nb.obj $(SUBDIR)$(HPS)ltp.obj $(SUBDIR)$(HPS)mdf.obj $(SUBDIR)$(HPS)modes.obj $(SUBDIR)$(HPS)modes_wb.obj $(SUBDIR)$(HPS)nb_celp.obj $(SUBDIR)$(HPS)preprocess.obj $(SUBDIR)$(HPS)quant_lsp.obj $(SUBDIR)$(HPS)resample.obj $(SUBDIR)$(HPS)sb_celp.obj $(SUBDIR)$(HPS)scal.obj $(SUBDIR)$(HPS)smallft.obj $(SUBDIR)$(HPS)speex.obj $(SUBDIR)$(HPS)speex_callbacks.obj $(SUBDIR)$(HPS)speex_header.obj $(SUBDIR)$(HPS)stereo.obj $(SUBDIR)$(HPS)testdenoise.obj $(SUBDIR)$(HPS)testecho.obj $(SUBDIR)$(HPS)testenc.obj $(SUBDIR)$(HPS)testenc_uwb.obj $(SUBDIR)$(HPS)testenc_wb.obj $(SUBDIR)$(HPS)testjitter.obj $(SUBDIR)$(HPS)vbr.obj $(SUBDIR)$(HPS)vq.obj $(SUBDIR)$(HPS)window.obj - -!ifdef EXT_SPEEX_SPEEXDEC_EXE -$(EXT_SPEEX_SPEEXDEC_EXE): $(EXT_LIBOGG_LIB) $(EXT_SPEEX_LIB) $(SUBDIR)$(HPS)speexdec.obj $(SUBDIR)$(HPS)getopt.obj $(SUBDIR)$(HPS)getopt1.obj $(SUBDIR)$(HPS)wav_io.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)speexdec.obj file $(SUBDIR)$(HPS)getopt.obj file $(SUBDIR)$(HPS)getopt1.obj file $(SUBDIR)$(HPS)wav_io.obj $(EXT_LIBOGG_LIB_WLINK_LIBRARIES) library $(EXT_SPEEX_LIB) name $(EXT_SPEEX_SPEEXDEC_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifdef EXT_SPEEX_SPEEXENC_EXE -$(EXT_SPEEX_SPEEXENC_EXE): $(EXT_LIBOGG_LIB) $(EXT_SPEEX_LIB) $(SUBDIR)$(HPS)speexenc.obj $(SUBDIR)$(HPS)getopt.obj $(SUBDIR)$(HPS)getopt1.obj $(SUBDIR)$(HPS)wav_io.obj $(SUBDIR)$(HPS)wave_out.obj $(SUBDIR)$(HPS)skeleton.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)speexenc.obj file $(SUBDIR)$(HPS)getopt.obj file $(SUBDIR)$(HPS)getopt1.obj file $(SUBDIR)$(HPS)wav_io.obj file $(SUBDIR)$(HPS)wave_out.obj file $(SUBDIR)$(HPS)skeleton.obj $(EXT_LIBOGG_LIB_WLINK_LIBRARIES) library $(EXT_SPEEX_LIB) name $(EXT_SPEEX_SPEEXENC_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifdef EXT_SPEEX_LIB -$(EXT_SPEEX_LIB): $(OBJS) - wlib -q -b -c $(EXT_SPEEX_LIB) -+$(SUBDIR)$(HPS)bits.obj -+$(SUBDIR)$(HPS)buffer.obj -+$(SUBDIR)$(HPS)cb_search.obj -+$(SUBDIR)$(HPS)exc_10_16_table.obj -+$(SUBDIR)$(HPS)exc_10_32_table.obj -+$(SUBDIR)$(HPS)exc_20_32_table.obj -+$(SUBDIR)$(HPS)exc_5_256_table.obj -+$(SUBDIR)$(HPS)exc_5_64_table.obj -+$(SUBDIR)$(HPS)exc_8_128_table.obj -+$(SUBDIR)$(HPS)fftwrap.obj -+$(SUBDIR)$(HPS)filterbank.obj -+$(SUBDIR)$(HPS)filters.obj -+$(SUBDIR)$(HPS)gain_table.obj -+$(SUBDIR)$(HPS)gain_table_lbr.obj -+$(SUBDIR)$(HPS)hexc_10_32_table.obj -+$(SUBDIR)$(HPS)hexc_table.obj -+$(SUBDIR)$(HPS)high_lsp_tables.obj -+$(SUBDIR)$(HPS)jitter.obj -+$(SUBDIR)$(HPS)kiss_fft.obj -+$(SUBDIR)$(HPS)kiss_fftr.obj -+$(SUBDIR)$(HPS)lpc.obj -+$(SUBDIR)$(HPS)lsp.obj -+$(SUBDIR)$(HPS)lsp_tables_nb.obj -+$(SUBDIR)$(HPS)ltp.obj -+$(SUBDIR)$(HPS)mdf.obj -+$(SUBDIR)$(HPS)modes.obj -+$(SUBDIR)$(HPS)modes_wb.obj -+$(SUBDIR)$(HPS)nb_celp.obj -+$(SUBDIR)$(HPS)preprocess.obj -+$(SUBDIR)$(HPS)quant_lsp.obj -+$(SUBDIR)$(HPS)resample.obj -+$(SUBDIR)$(HPS)sb_celp.obj -+$(SUBDIR)$(HPS)scal.obj -+$(SUBDIR)$(HPS)smallft.obj -+$(SUBDIR)$(HPS)speex.obj -+$(SUBDIR)$(HPS)speex_callbacks.obj -+$(SUBDIR)$(HPS)speex_header.obj -+$(SUBDIR)$(HPS)stereo.obj -+$(SUBDIR)$(HPS)testdenoise.obj -+$(SUBDIR)$(HPS)testecho.obj -+$(SUBDIR)$(HPS)testenc.obj -+$(SUBDIR)$(HPS)testenc_uwb.obj -+$(SUBDIR)$(HPS)testenc_wb.obj -+$(SUBDIR)$(HPS)testjitter.obj -+$(SUBDIR)$(HPS)vbr.obj -+$(SUBDIR)$(HPS)vq.obj -+$(SUBDIR)$(HPS)window.obj -!endif - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_SPEEX_LIB) .symbolic - -exe: $(EXT_SPEEX_SPEEXDEC_EXE) $(EXT_SPEEX_SPEEXENC_EXE) .symbolic - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/speex/config.h b/src/lib/dl/ext/speex/config.h deleted file mode 100755 index a2edf9c1..00000000 --- a/src/lib/dl/ext/speex/config.h +++ /dev/null @@ -1,166 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Make use of ARM4 assembly optimizations */ -/* #undef ARM4_ASM */ - -/* Make use of ARM5E assembly optimizations */ -/* #undef ARM5E_ASM */ - -/* Make use of Blackfin assembly optimizations */ -/* #undef BFIN_ASM */ - -/* Disable all parts of the API that are using floats */ -/* #undef DISABLE_FLOAT_API */ - -/* Disable VBR and VAD from the codec */ -/* #undef DISABLE_VBR */ - -/* Enable valgrind extra checks */ -/* #undef ENABLE_VALGRIND */ - -/* Symbol visibility prefix */ -#define EXPORT - -/* Debug fixed-point implementation */ -/* #undef FIXED_DEBUG */ - -/* Compile as fixed-point */ -#undef FIXED_POINT - -/* Compile as floating-point */ -#define FLOATING_POINT - -/* Define to 1 if you have the <alloca.h> header file. */ -#define HAVE_ALLOCA_H 1 - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the <getopt.h> header file. */ -#define HAVE_GETOPT_H 1 - -/* Define to 1 if you have the `getopt_long' function. */ -#define HAVE_GETOPT_LONG 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the `winmm' library (-lwinmm). */ -/* #undef HAVE_LIBWINMM */ - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/audioio.h> header file. */ -/* #undef HAVE_SYS_AUDIOIO_H */ - -/* Define to 1 if you have the <sys/soundcard.h> header file. */ -#undef HAVE_SYS_SOUNDCARD_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* 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 `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* Version extra */ -#define SPEEX_EXTRA_VERSION "" - -/* Version major */ -#define SPEEX_MAJOR_VERSION 1 - -/* Version micro */ -#define SPEEX_MICRO_VERSION 16 - -/* Version minor */ -#define SPEEX_MINOR_VERSION 1 - -/* Complete version string */ -#define SPEEX_VERSION "1.2rc1" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Enable support for TI C55X DSP */ -/* #undef TI_C55X */ - -/* Make use of alloca */ -/* #undef USE_ALLOCA */ - -/* Use FFTW3 for FFT */ -/* #undef USE_GPL_FFTW3 */ - -/* Use Intel Math Kernel Library for FFT */ -/* #undef USE_INTEL_MKL */ - -/* Use KISS Fast Fourier Transform */ -/* #undef USE_KISS_FFT */ - -/* Use FFT from OggVorbis */ -#define USE_SMALLFT - -/* Use C99 variable-size arrays */ -#undef VAR_ARRAYS - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Enable SSE support */ -/* #undef _USE_SSE */ - -/* 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 equivalent of C99 restrict keyword, or to nothing if this is not - supported. Do not define if restrict is supported directly. */ -#define restrict __restrict diff --git a/src/lib/dl/ext/speex/exc_10_16_table.c b/src/lib/dl/ext/speex/exc_10_16_table.c deleted file mode 100755 index 98ae357d..00000000 --- a/src/lib/dl/ext/speex/exc_10_16_table.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: exc_10_16_table.c - Codebook for excitation in narrowband CELP mode (3200 bps) - - 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. -*/ - - -const signed char exc_10_16_table[160] = { -22,39,14,44,11,35,-2,23,-4,6, -46,-28,13,-27,-23,12,4,20,-5,9, -37,-18,-23,23,0,9,-6,-20,4,-1, --17,-5,-4,17,0,1,9,-2,1,2, -2,-12,8,-25,39,15,9,16,-55,-11, -9,11,5,10,-2,-60,8,13,-6,11, --16,27,-47,-12,11,1,16,-7,9,-3, --29,9,-14,25,-19,34,36,12,40,-10, --3,-24,-14,-37,-21,-35,-2,-36,3,-6, -67,28,6,-17,-3,-12,-16,-15,-17,-7, --59,-36,-13,1,7,1,2,10,2,11, -13,10,8,-2,7,3,5,4,2,2, --3,-8,4,-5,6,7,-42,15,35,-2, --46,38,28,-20,-9,1,7,-3,0,-2, -0,0,0,0,0,0,0,0,0,0, --15,-28,52,32,5,-5,-17,-20,-10,-1}; diff --git a/src/lib/dl/ext/speex/exc_10_32_table.c b/src/lib/dl/ext/speex/exc_10_32_table.c deleted file mode 100755 index 1ee56a25..00000000 --- a/src/lib/dl/ext/speex/exc_10_32_table.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: exc_10_32_table.c - Codebook for excitation in narrowband CELP mode (4000 bps) - - 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. -*/ - - -const signed char exc_10_32_table[320] = { -7,17,17,27,25,22,12,4,-3,0, -28,-36,39,-24,-15,3,-9,15,-5,10, -31,-28,11,31,-21,9,-11,-11,-2,-7, --25,14,-22,31,4,-14,19,-12,14,-5, -4,-7,4,-5,9,0,-2,42,-47,-16, -1,8,0,9,23,-57,0,28,-11,6, --31,55,-45,3,-5,4,2,-2,4,-7, --3,6,-2,7,-3,12,5,8,54,-10, -8,-7,-8,-24,-25,-27,-14,-5,8,5, -44,23,5,-9,-11,-11,-13,-9,-12,-8, --29,-8,-22,6,-15,3,-12,-1,-5,-3, -34,-1,29,-16,17,-4,12,2,1,4, --2,-4,2,-1,11,-3,-52,28,30,-9, --32,25,44,-20,-24,4,6,-1,0,0, -0,0,0,0,0,0,0,0,0,0, --25,-10,22,29,13,-13,-22,-13,-4,0, --4,-16,10,15,-36,-24,28,25,-1,-3, -66,-33,-11,-15,6,0,3,4,-2,5, -24,-20,-47,29,19,-2,-4,-1,0,-1, --2,3,1,8,-11,5,5,-57,28,28, -0,-16,4,-4,12,-6,-1,2,-20,61, --9,24,-22,-42,29,6,17,8,4,2, --65,15,8,10,5,6,5,3,2,-2, --3,5,-9,4,-5,23,13,23,-3,-63, -3,-5,-4,-6,0,-3,23,-36,-46,9, -5,5,8,4,9,-5,1,-3,10,1, --6,10,-11,24,-47,31,22,-12,14,-10, -6,11,-7,-7,7,-31,51,-12,-6,7, -6,-17,9,-11,-20,52,-19,3,-6,-6, --8,-5,23,-41,37,1,-21,10,-14,8, -7,5,-15,-15,23,39,-26,-33,7,2, --32,-30,-21,-8,4,12,17,15,14,11}; diff --git a/src/lib/dl/ext/speex/exc_20_32_table.c b/src/lib/dl/ext/speex/exc_20_32_table.c deleted file mode 100755 index e4098b8d..00000000 --- a/src/lib/dl/ext/speex/exc_20_32_table.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: exc_20_32_table.c - Codebook for excitation in narrowband CELP mode (2000 bps) - - 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. -*/ - - -const signed char exc_20_32_table[640] = { -12,32,25,46,36,33,9,14,-3,6,1,-8,0,-10,-5,-7,-7,-7,-5,-5, -31,-27,24,-32,-4,10,-11,21,-3,19,23,-9,22,24,-10,-1,-10,-13,-7,-11, -42,-33,31,19,-8,0,-10,-16,1,-21,-17,10,-8,14,8,4,11,-2,5,-2, --33,11,-16,33,11,-4,9,-4,11,2,6,-5,8,-5,11,-4,-6,26,-36,-16, -0,4,-2,-8,12,6,-1,34,-46,-22,9,9,21,9,5,-66,-5,26,2,10, -13,2,19,9,12,-81,3,13,13,0,-14,22,-35,6,-7,-4,6,-6,10,-6, --31,38,-33,0,-10,-11,5,-12,12,-17,5,0,-6,13,-9,10,8,25,33,2, --12,8,-6,10,-2,21,7,17,43,5,11,-7,-9,-20,-36,-20,-23,-4,-4,-3, -27,-9,-9,-49,-39,-38,-11,-9,6,5,23,25,5,3,3,4,1,2,-3,-1, -87,39,17,-21,-9,-19,-9,-15,-13,-14,-17,-11,-10,-11,-8,-6,-1,-3,-3,-1, --54,-34,-27,-8,-11,-4,-5,0,0,4,8,6,9,7,9,7,6,5,5,5, -48,10,19,-10,12,-1,9,-3,2,5,-3,2,-2,-2,0,-2,-26,6,9,-7, --16,-9,2,7,7,-5,-43,11,22,-11,-9,34,37,-15,-13,-6,1,-1,1,1, --64,56,52,-11,-27,5,4,3,1,2,1,3,-1,-4,-4,-10,-7,-4,-4,2, --1,-7,-7,-12,-10,-15,-9,-5,-5,-11,-16,-13,6,16,4,-13,-16,-10,-4,2, --47,-13,25,47,19,-14,-20,-8,-17,0,-3,-13,1,6,-17,-14,15,1,10,6, --24,0,-10,19,-69,-8,14,49,17,-5,33,-29,3,-4,0,2,-8,5,-6,2, -120,-56,-12,-47,23,-9,6,-5,1,2,-5,1,-10,4,-1,-1,4,-1,0,-3, -30,-52,-67,30,22,11,-1,-4,3,0,7,2,0,1,-10,-4,-8,-13,5,1, -1,-1,5,13,-9,-3,-10,-62,22,48,-4,-6,2,3,5,1,1,4,1,13, -3,-20,10,-9,13,-2,-4,9,-20,44,-1,20,-32,-67,19,0,28,11,8,2, --11,15,-19,-53,31,2,34,10,6,-4,-58,8,10,13,14,1,12,2,0,0, --128,37,-8,44,-9,26,-3,18,2,6,11,-1,9,1,5,3,0,1,1,2, -12,3,-2,-3,7,25,9,18,-6,-37,3,-8,-16,3,-10,-7,17,-34,-44,11, -17,-15,-3,-16,-1,-13,11,-46,-65,-2,8,13,2,4,4,5,15,5,9,6, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, --9,19,-12,12,-28,38,29,-1,12,2,5,23,-10,3,4,-15,21,-4,3,3, -6,17,-9,-4,-8,-20,26,5,-10,6,1,-19,18,-15,-12,47,-6,-2,-7,-9, --1,-17,-2,-2,-14,30,-14,2,-7,-4,-1,-12,11,-25,16,-3,-12,11,-7,7, --17,1,19,-28,31,-7,-10,7,-10,3,12,5,-16,6,24,41,-29,-54,0,1, -7,-1,5,-6,13,10,-4,-8,8,-9,-27,-53,-38,-1,10,19,17,16,12,12, -0,3,-7,-4,13,12,-31,-14,6,-5,3,5,17,43,50,25,10,1,-6,-2}; diff --git a/src/lib/dl/ext/speex/exc_5_256_table.c b/src/lib/dl/ext/speex/exc_5_256_table.c deleted file mode 100755 index 4137996d..00000000 --- a/src/lib/dl/ext/speex/exc_5_256_table.c +++ /dev/null @@ -1,290 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: exc_5_256_table.c - Codebook for excitation in narrowband CELP mode (12800 bps) - - 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. -*/ - - -const signed char exc_5_256_table[1280] = { --8,-37,5,-43,5, -73,61,39,12,-3, --61,-32,2,42,30, --3,17,-27,9,34, -20,-1,-5,2,23, --7,-46,26,53,-47, -20,-2,-33,-89,-51, --64,27,11,15,-34, --5,-56,25,-9,-1, --29,1,40,67,-23, --16,16,33,19,7, -14,85,22,-10,-10, --12,-7,-1,52,89, -29,11,-20,-37,-46, --15,17,-24,-28,24, -2,1,0,23,-101, -23,14,-1,-23,-18, -9,5,-13,38,1, --28,-28,4,27,51, --26,34,-40,35,47, -54,38,-54,-26,-6, -42,-25,13,-30,-36, -18,41,-4,-33,23, --32,-7,-4,51,-3, -17,-52,56,-47,36, --2,-21,36,10,8, --33,31,19,9,-5, --40,10,-9,-21,19, -18,-78,-18,-5,0, --26,-36,-47,-51,-44, -18,40,27,-2,29, -49,-26,2,32,-54, -30,-73,54,3,-5, -36,22,53,10,-1, --84,-53,-29,-5,3, --44,53,-51,4,22, -71,-35,-1,33,-5, --27,-7,36,17,-23, --39,16,-9,-55,-15, --20,39,-35,6,-39, --14,18,48,-64,-17, --15,9,39,81,37, --68,37,47,-21,-6, --104,13,6,9,-2, -35,8,-23,18,42, -45,21,33,-5,-49, -9,-6,-43,-56,39, -2,-16,-25,87,1, --3,-9,17,-25,-11, --9,-1,10,2,-14, --14,4,-1,-10,28, --23,40,-32,26,-9, -26,4,-27,-23,3, -42,-60,1,49,-3, -27,10,-52,-40,-2, -18,45,-23,17,-44, -3,-3,17,-46,52, --40,-47,25,75,31, --49,53,30,-30,-32, --36,38,-6,-15,-16, -54,-27,-48,3,38, --29,-32,-22,-14,-4, --23,-13,32,-39,9, -8,-45,-13,34,-16, -49,40,32,31,28, -23,23,32,47,59, --68,8,62,44,25, --14,-24,-65,-16,36, -67,-25,-38,-21,4, --33,-2,42,5,-63, -40,11,26,-42,-23, --61,79,-31,23,-20, -10,-32,53,-25,-36, -10,-26,-5,3,0, --71,5,-10,-37,1, --24,21,-54,-17,1, --29,-25,-15,-27,32, -68,45,-16,-37,-18, --5,1,0,-77,71, --6,3,-20,71,-67, -29,-35,10,-30,19, -4,16,17,5,0, --14,19,2,28,26, -59,3,2,24,39, -55,-50,-45,-18,-17, -33,-35,14,-1,1, -8,87,-35,-29,0, --27,13,-7,23,-13, -37,-40,50,-35,14, -19,-7,-14,49,54, --5,22,-2,-29,-8, --27,38,13,27,48, -12,-41,-21,-15,28, -7,-16,-24,-19,-20, -11,-20,9,2,13, -23,-20,11,27,-27, -71,-69,8,2,-6, -22,12,16,16,9, --16,-8,-17,1,25, -1,40,-37,-33,66, -94,53,4,-22,-25, --41,-42,25,35,-16, --15,57,31,-29,-32, -21,16,-60,45,15, --1,7,57,-26,-47, --29,11,8,15,19, --105,-8,54,27,10, --17,6,-12,-1,-10, -4,0,23,-10,31, -13,11,10,12,-64, -23,-3,-8,-19,16, -52,24,-40,16,10, -40,5,9,0,-13, --7,-21,-8,-6,-7, --21,59,16,-53,18, --60,11,-47,14,-18, -25,-13,-24,4,-39, -16,-28,54,26,-67, -30,27,-20,-52,20, --12,55,12,18,-16, -39,-14,-6,-26,56, --88,-55,12,25,26, --37,6,75,0,-34, --81,54,-30,1,-7, -49,-23,-14,21,10, --62,-58,-57,-47,-34, -15,-4,34,-78,31, -25,-11,7,50,-10, -42,-63,14,-36,-4, -57,55,57,53,42, --42,-1,15,40,37, -15,25,-11,6,1, -31,-2,-6,-1,-7, --64,34,28,30,-1, -3,21,0,-88,-12, --56,25,-28,40,8, --28,-14,9,12,2, --6,-17,22,49,-6, --26,14,28,-20,4, --12,50,35,40,13, --38,-58,-29,17,30, -22,60,26,-54,-39, --12,58,-28,-63,10, --21,-8,-12,26,-62, -6,-10,-11,-22,-6, --7,4,1,18,2, --70,11,14,4,13, -19,-24,-34,24,67, -17,51,-21,13,23, -54,-30,48,1,-13, -80,26,-16,-2,13, --4,6,-30,29,-24, -73,-58,30,-27,20, --2,-21,41,45,30, --27,-3,-5,-18,-20, --49,-3,-35,10,42, --19,-67,-53,-11,9, -13,-15,-33,-51,-30, -15,7,25,-30,4, -28,-22,-34,54,-29, -39,-46,20,16,34, --4,47,75,1,-44, --55,-24,7,-1,9, --42,50,-8,-36,41, -68,0,-4,-10,-23, --15,-50,64,36,-9, --27,12,25,-38,-47, --37,32,-49,51,-36, -2,-4,69,-26,19, -7,45,67,46,13, --63,46,15,-47,4, --41,13,-6,5,-21, -37,26,-55,-7,33, --1,-28,10,-17,-64, --14,0,-36,-17,93, --3,-9,-66,44,-21, -3,-12,38,-6,-13, --12,19,13,43,-43, --10,-12,6,-5,9, --49,32,-5,2,4, -5,15,-16,10,-21, -8,-62,-8,64,8, -79,-1,-66,-49,-18, -5,40,-5,-30,-45, -1,-6,21,-32,93, --18,-30,-21,32,21, --18,22,8,5,-41, --54,80,22,-10,-7, --8,-23,-64,66,56, --14,-30,-41,-46,-14, --29,-37,27,-14,42, --2,-9,-29,34,14, -33,-14,22,4,10, -26,26,28,32,23, --72,-32,3,0,-14, -35,-42,-78,-32,6, -29,-18,-45,-5,7, --33,-45,-3,-22,-34, -8,-8,4,-51,-25, --9,59,-78,21,-5, --25,-48,66,-15,-17, --24,-49,-13,25,-23, --64,-6,40,-24,-19, --11,57,-33,-8,1, -10,-52,-54,28,39, -49,34,-11,-61,-41, --43,10,15,-15,51, -30,15,-51,32,-34, --2,-34,14,18,16, -1,1,-3,-3,1, -1,-18,6,16,48, -12,-5,-42,7,36, -48,7,-20,-10,7, -12,2,54,39,-38, -37,54,4,-11,-8, --46,-10,5,-10,-34, -46,-12,29,-37,39, -36,-11,24,56,17, -14,20,25,0,-25, --28,55,-7,-5,27, -3,9,-26,-8,6, --24,-10,-30,-31,-34, -18,4,22,21,40, --1,-29,-37,-8,-21, -92,-29,11,-3,11, -73,23,22,7,4, --44,-9,-11,21,-13, -11,9,-78,-1,47, -114,-12,-37,-19,-5, --11,-22,19,12,-30, -7,38,45,-21,-8, --9,55,-45,56,-21, -7,17,46,-57,-87, --6,27,31,31,7, --56,-12,46,21,-5, --12,36,3,3,-21, -43,19,12,-7,9, --14,0,-9,-33,-91, -7,26,3,-11,64, -83,-31,-46,25,2, -9,5,2,2,-1, -20,-17,10,-5,-27, --8,20,8,-19,16, --21,-13,-31,5,5, -42,24,9,34,-20, -28,-61,22,11,-39, -64,-20,-1,-30,-9, --20,24,-25,-24,-29, -22,-60,6,-5,41, --9,-87,14,34,15, --57,52,69,15,-3, --102,58,16,3,6, -60,-75,-32,26,7, --57,-27,-32,-24,-21, --29,-16,62,-46,31, -30,-27,-15,7,15}; diff --git a/src/lib/dl/ext/speex/exc_5_64_table.c b/src/lib/dl/ext/speex/exc_5_64_table.c deleted file mode 100755 index 2c66d518..00000000 --- a/src/lib/dl/ext/speex/exc_5_64_table.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: exc_5_64_table.c - Codebook for excitation in narrowband CELP mode (9600 bps) - - 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. -*/ - - -const signed char exc_5_64_table[320]={ -1,5,-15,49,-66, --48,-4,50,-44,7, -37,16,-18,25,-26, --26,-15,19,19,-27, --47,28,57,5,-17, --32,-41,68,21,-2, -64,56,8,-16,-13, --26,-9,-16,11,6, --39,25,-19,22,-31, -20,-45,55,-43,10, --16,47,-40,40,-20, --51,3,-17,-14,-15, --24,53,-20,-46,46, -27,-68,32,3,-18, --5,9,-31,16,-9, --10,-1,-23,48,95, -47,25,-41,-32,-3, -15,-25,-55,36,41, --27,20,5,13,14, --22,5,2,-23,18, -46,-15,17,-18,-34, --5,-8,27,-55,73, -16,2,-1,-17,40, --78,33,0,2,19, -4,53,-16,-15,-16, --28,-3,-13,49,8, --7,-29,27,-13,32, -20,32,-61,16,14, -41,44,40,24,20, -7,4,48,-60,-77, -17,-6,-48,65,-15, -32,-30,-71,-10,-3, --6,10,-2,-7,-29, --56,67,-30,7,-5, -86,-6,-10,0,5, --31,60,34,-38,-3, -24,10,-2,30,23, -24,-41,12,70,-43, -15,-17,6,13,16, --13,8,30,-15,-8, -5,23,-34,-98,-4, --13,13,-48,-31,70, -12,31,25,24,-24, -26,-7,33,-16,8, -5,-11,-14,-8,-65, -13,10,-2,-9,0, --3,-68,5,35,7, -0,-31,-1,-17,-9, --9,16,-37,-18,-1, -69,-48,-28,22,-21, --11,5,49,55,23, --86,-36,16,2,13, -63,-51,30,-11,13, -24,-18,-6,14,-19, -1,41,9,-5,27, --36,-44,-34,-37,-21, --26,31,-39,15,43, -5,-8,29,20,-8, --20,-52,-28,-1,13, -26,-34,-10,-9,27, --8,8,27,-66,4, -12,-22,49,10,-77, -32,-18,3,-38,12, --3,-1,2,2,0}; diff --git a/src/lib/dl/ext/speex/exc_8_128_table.c b/src/lib/dl/ext/speex/exc_8_128_table.c deleted file mode 100755 index 17ee64b9..00000000 --- a/src/lib/dl/ext/speex/exc_8_128_table.c +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: exc_8_128_table.c - Codebook for excitation in narrowband CELP mode (7000 bps) - - 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. -*/ - - -const signed char exc_8_128_table[1024] = { --14,9,13,-32,2,-10,31,-10, --8,-8,6,-4,-1,10,-64,23, -6,20,13,6,8,-22,16,34, -7,42,-49,-28,5,26,4,-15, -41,34,41,32,33,24,23,14, -8,40,34,4,-24,-41,-19,-15, -13,-13,33,-54,24,27,-44,33, -27,-15,-15,24,-19,14,-36,14, --9,24,-12,-4,37,-5,16,-34, -5,10,33,-15,-54,-16,12,25, -12,1,2,0,3,-1,-4,-4, -11,2,-56,54,27,-20,13,-6, --46,-41,-33,-11,-5,7,12,14, --14,-5,8,20,6,3,4,-8, --5,-42,11,8,-14,25,-2,2, -13,11,-22,39,-9,9,5,-45, --9,7,-9,12,-7,34,-17,-102, -7,2,-42,18,35,-9,-34,11, --5,-2,3,22,46,-52,-25,-9, --94,8,11,-5,-5,-5,4,-7, --35,-7,54,5,-32,3,24,-9, --22,8,65,37,-1,-12,-23,-6, --9,-28,55,-33,14,-3,2,18, --60,41,-17,8,-16,17,-11,0, --11,29,-28,37,9,-53,33,-14, --9,7,-25,-7,-11,26,-32,-8, -24,-21,22,-19,19,-10,29,-14, -0,0,0,0,0,0,0,0, --5,-52,10,41,6,-30,-4,16, -32,22,-27,-22,32,-3,-28,-3, -3,-35,6,17,23,21,8,2, -4,-45,-17,14,23,-4,-31,-11, --3,14,1,19,-11,2,61,-8, -9,-12,7,-10,12,-3,-24,99, --48,23,50,-37,-5,-23,0,8, --14,35,-64,-5,46,-25,13,-1, --49,-19,-15,9,34,50,25,11, --6,-9,-16,-20,-32,-33,-32,-27, -10,-8,12,-15,56,-14,-32,33, -3,-9,1,65,-9,-9,-10,-2, --6,-23,9,17,3,-28,13,-32, -4,-2,-10,4,-16,76,12,-52, -6,13,33,-6,4,-14,-9,-3, -1,-15,-16,28,1,-15,11,16, -9,4,-21,-37,-40,-6,22,12, --15,-23,-14,-17,-16,-9,-10,-9, -13,-39,41,5,-9,16,-38,25, -46,-47,4,49,-14,17,-2,6, -18,5,-6,-33,-22,44,50,-2, -1,3,-6,7,7,-3,-21,38, --18,34,-14,-41,60,-13,6,16, --24,35,19,-13,-36,24,3,-17, --14,-10,36,44,-44,-29,-3,3, --54,-8,12,55,26,4,-2,-5, -2,-11,22,-23,2,22,1,-25, --39,66,-49,21,-8,-2,10,-14, --60,25,6,10,27,-25,16,5, --2,-9,26,-13,-20,58,-2,7, -52,-9,2,5,-4,-15,23,-1, --38,23,8,27,-6,0,-27,-7, -39,-10,-14,26,11,-45,-12,9, --5,34,4,-35,10,43,-22,-11, -56,-7,20,1,10,1,-26,9, -94,11,-27,-14,-13,1,-11,0, -14,-5,-6,-10,-4,-15,-8,-41, -21,-5,1,-28,-8,22,-9,33, --23,-4,-4,-12,39,4,-7,3, --60,80,8,-17,2,-6,12,-5, -1,9,15,27,31,30,27,23, -61,47,26,10,-5,-8,-12,-13, -5,-18,25,-15,-4,-15,-11,12, --2,-2,-16,-2,-6,24,12,11, --4,9,1,-9,14,-45,57,12, -20,-35,26,11,-64,32,-10,-10, -42,-4,-9,-16,32,24,7,10, -52,-11,-57,29,0,8,0,-6, -17,-17,-56,-40,7,20,18,12, --6,16,5,7,-1,9,1,10, -29,12,16,13,-2,23,7,9, --3,-4,-5,18,-64,13,55,-25, -9,-9,24,14,-25,15,-11,-40, --30,37,1,-19,22,-5,-31,13, --2,0,7,-4,16,-67,12,66, --36,24,-8,18,-15,-23,19,0, --45,-7,4,3,-13,13,35,5, -13,33,10,27,23,0,-7,-11, -43,-74,36,-12,2,5,-8,6, --33,11,-16,-14,-5,-7,-3,17, --34,27,-16,11,-9,15,33,-31, -8,-16,7,-6,-7,63,-55,-17, -11,-1,20,-46,34,-30,6,9, -19,28,-9,5,-24,-8,-23,-2, -31,-19,-16,-5,-15,-18,0,26, -18,37,-5,-15,-2,17,5,-27, -21,-33,44,12,-27,-9,17,11, -25,-21,-31,-7,13,33,-8,-25, --7,7,-10,4,-6,-9,48,-82, --23,-8,6,11,-23,3,-3,49, --29,25,31,4,14,16,9,-4, --18,10,-26,3,5,-44,-9,9, --47,-55,15,9,28,1,4,-3, -46,6,-6,-38,-29,-31,-15,-6, -3,0,14,-6,8,-54,-50,33, --5,1,-14,33,-48,26,-4,-5, --3,-5,-3,-5,-28,-22,77,55, --1,2,10,10,-9,-14,-66,-49, -11,-36,-6,-20,10,-10,16,12, -4,-1,-16,45,-44,-50,31,-2, -25,42,23,-32,-22,0,11,20, --40,-35,-40,-36,-32,-26,-21,-13, -52,-22,6,-24,-20,17,-5,-8, -36,-25,-11,21,-26,6,34,-8, -7,20,-3,5,-25,-8,18,-5, --9,-4,1,-9,20,20,39,48, --24,9,5,-65,22,29,4,3, --43,-11,32,-6,9,19,-27,-10, --47,-14,24,10,-7,-36,-7,-1, --4,-5,-5,16,53,25,-26,-29, --4,-12,45,-58,-34,33,-5,2, --1,27,-48,31,-15,22,-5,4, -7,7,-25,-3,11,-22,16,-12, -8,-3,7,-11,45,14,-73,-19, -56,-46,24,-20,28,-12,-2,-1, --36,-3,-33,19,-6,7,2,-15, -5,-31,-45,8,35,13,20,0, --9,48,-13,-43,-3,-13,2,-5, -72,-68,-27,2,1,-2,-7,5, -36,33,-40,-12,-4,-5,23,19}; diff --git a/src/lib/dl/ext/speex/fftwrap.c b/src/lib/dl/ext/speex/fftwrap.c deleted file mode 100755 index 4f37e1b3..00000000 --- a/src/lib/dl/ext/speex/fftwrap.c +++ /dev/null @@ -1,397 +0,0 @@ -/* Copyright (C) 2005-2006 Jean-Marc Valin - File: fftwrap.c - - Wrapper for various FFTs - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "arch.h" -#include "os_support.h" - -#define MAX_FFT_SIZE 2048 - -#ifdef FIXED_POINT -static int maximize_range(spx_word16_t *in, spx_word16_t *out, spx_word16_t bound, int len) -{ - int i, shift; - spx_word16_t max_val = 0; - for (i=0;i<len;i++) - { - if (in[i]>max_val) - max_val = in[i]; - if (-in[i]>max_val) - max_val = -in[i]; - } - shift=0; - while (max_val <= (bound>>1) && max_val != 0) - { - max_val <<= 1; - shift++; - } - for (i=0;i<len;i++) - { - out[i] = SHL16(in[i], shift); - } - return shift; -} - -static void renorm_range(spx_word16_t *in, spx_word16_t *out, int shift, int len) -{ - int i; - for (i=0;i<len;i++) - { - out[i] = PSHR16(in[i], shift); - } -} -#endif - -#ifdef USE_SMALLFT - -#include "smallft.h" -#include <math.h> - -void *spx_fft_init(int size) -{ - struct drft_lookup *table; - table = speex_alloc(sizeof(struct drft_lookup)); - spx_drft_init((struct drft_lookup *)table, size); - return (void*)table; -} - -void spx_fft_destroy(void *table) -{ - spx_drft_clear(table); - speex_free(table); -} - -void spx_fft(void *table, float *in, float *out) -{ - if (in==out) - { - int i; - float scale = 1./((struct drft_lookup *)table)->n; - speex_warning("FFT should not be done in-place"); - for (i=0;i<((struct drft_lookup *)table)->n;i++) - out[i] = scale*in[i]; - } else { - int i; - float scale = 1./((struct drft_lookup *)table)->n; - for (i=0;i<((struct drft_lookup *)table)->n;i++) - out[i] = scale*in[i]; - } - spx_drft_forward((struct drft_lookup *)table, out); -} - -void spx_ifft(void *table, float *in, float *out) -{ - if (in==out) - { - speex_warning("FFT should not be done in-place"); - } else { - int i; - for (i=0;i<((struct drft_lookup *)table)->n;i++) - out[i] = in[i]; - } - spx_drft_backward((struct drft_lookup *)table, out); -} - -#elif defined(USE_INTEL_MKL) -#include <mkl.h> - -struct mkl_config { - DFTI_DESCRIPTOR_HANDLE desc; - int N; -}; - -void *spx_fft_init(int size) -{ - struct mkl_config *table = (struct mkl_config *) speex_alloc(sizeof(struct mkl_config)); - table->N = size; - DftiCreateDescriptor(&table->desc, DFTI_SINGLE, DFTI_REAL, 1, size); - DftiSetValue(table->desc, DFTI_PACKED_FORMAT, DFTI_PACK_FORMAT); - DftiSetValue(table->desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE); - DftiSetValue(table->desc, DFTI_FORWARD_SCALE, 1.0f / size); - DftiCommitDescriptor(table->desc); - return table; -} - -void spx_fft_destroy(void *table) -{ - struct mkl_config *t = (struct mkl_config *) table; - DftiFreeDescriptor(t->desc); - speex_free(table); -} - -void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) -{ - struct mkl_config *t = (struct mkl_config *) table; - DftiComputeForward(t->desc, in, out); -} - -void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) -{ - struct mkl_config *t = (struct mkl_config *) table; - DftiComputeBackward(t->desc, in, out); -} - -#elif defined(USE_GPL_FFTW3) - -#include <fftw3.h> - -struct fftw_config { - float *in; - float *out; - fftwf_plan fft; - fftwf_plan ifft; - int N; -}; - -void *spx_fft_init(int size) -{ - struct fftw_config *table = (struct fftw_config *) speex_alloc(sizeof(struct fftw_config)); - table->in = fftwf_malloc(sizeof(float) * (size+2)); - table->out = fftwf_malloc(sizeof(float) * (size+2)); - - table->fft = fftwf_plan_dft_r2c_1d(size, table->in, (fftwf_complex *) table->out, FFTW_PATIENT); - table->ifft = fftwf_plan_dft_c2r_1d(size, (fftwf_complex *) table->in, table->out, FFTW_PATIENT); - - table->N = size; - return table; -} - -void spx_fft_destroy(void *table) -{ - struct fftw_config *t = (struct fftw_config *) table; - fftwf_destroy_plan(t->fft); - fftwf_destroy_plan(t->ifft); - fftwf_free(t->in); - fftwf_free(t->out); - speex_free(table); -} - - -void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) -{ - int i; - struct fftw_config *t = (struct fftw_config *) table; - const int N = t->N; - float *iptr = t->in; - float *optr = t->out; - const float m = 1.0 / N; - for(i=0;i<N;++i) - iptr[i]=in[i] * m; - - fftwf_execute(t->fft); - - out[0] = optr[0]; - for(i=1;i<N;++i) - out[i] = optr[i+1]; -} - -void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) -{ - int i; - struct fftw_config *t = (struct fftw_config *) table; - const int N = t->N; - float *iptr = t->in; - float *optr = t->out; - - iptr[0] = in[0]; - iptr[1] = 0.0f; - for(i=1;i<N;++i) - iptr[i+1] = in[i]; - iptr[N+1] = 0.0f; - - fftwf_execute(t->ifft); - - for(i=0;i<N;++i) - out[i] = optr[i]; -} - -#elif defined(USE_KISS_FFT) - -#include "kiss_fftr.h" -#include "kiss_fft.h" - -struct kiss_config { - kiss_fftr_cfg forward; - kiss_fftr_cfg backward; - int N; -}; - -void *spx_fft_init(int size) -{ - struct kiss_config *table; - table = (struct kiss_config*)speex_alloc(sizeof(struct kiss_config)); - table->forward = kiss_fftr_alloc(size,0,NULL,NULL); - table->backward = kiss_fftr_alloc(size,1,NULL,NULL); - table->N = size; - return table; -} - -void spx_fft_destroy(void *table) -{ - struct kiss_config *t = (struct kiss_config *)table; - kiss_fftr_free(t->forward); - kiss_fftr_free(t->backward); - speex_free(table); -} - -#ifdef FIXED_POINT - -void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) -{ - int shift; - struct kiss_config *t = (struct kiss_config *)table; - shift = maximize_range(in, in, 32000, t->N); - kiss_fftr2(t->forward, in, out); - renorm_range(in, in, shift, t->N); - renorm_range(out, out, shift, t->N); -} - -#else - -void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) -{ - int i; - float scale; - struct kiss_config *t = (struct kiss_config *)table; - scale = 1./t->N; - kiss_fftr2(t->forward, in, out); - for (i=0;i<t->N;i++) - out[i] *= scale; -} -#endif - -void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) -{ - struct kiss_config *t = (struct kiss_config *)table; - kiss_fftri2(t->backward, in, out); -} - - -#else - -#error No other FFT implemented - -#endif - - -#ifdef FIXED_POINT -/*#include "smallft.h"*/ - - -void spx_fft_float(void *table, float *in, float *out) -{ - int i; -#ifdef USE_SMALLFT - int N = ((struct drft_lookup *)table)->n; -#elif defined(USE_KISS_FFT) - int N = ((struct kiss_config *)table)->N; -#else -#endif -#ifdef VAR_ARRAYS - spx_word16_t _in[N]; - spx_word16_t _out[N]; -#else - spx_word16_t _in[MAX_FFT_SIZE]; - spx_word16_t _out[MAX_FFT_SIZE]; -#endif - for (i=0;i<N;i++) - _in[i] = (int)floor(.5+in[i]); - spx_fft(table, _in, _out); - for (i=0;i<N;i++) - out[i] = _out[i]; -#if 0 - if (!fixed_point) - { - float scale; - struct drft_lookup t; - spx_drft_init(&t, ((struct kiss_config *)table)->N); - scale = 1./((struct kiss_config *)table)->N; - for (i=0;i<((struct kiss_config *)table)->N;i++) - out[i] = scale*in[i]; - spx_drft_forward(&t, out); - spx_drft_clear(&t); - } -#endif -} - -void spx_ifft_float(void *table, float *in, float *out) -{ - int i; -#ifdef USE_SMALLFT - int N = ((struct drft_lookup *)table)->n; -#elif defined(USE_KISS_FFT) - int N = ((struct kiss_config *)table)->N; -#else -#endif -#ifdef VAR_ARRAYS - spx_word16_t _in[N]; - spx_word16_t _out[N]; -#else - spx_word16_t _in[MAX_FFT_SIZE]; - spx_word16_t _out[MAX_FFT_SIZE]; -#endif - for (i=0;i<N;i++) - _in[i] = (int)floor(.5+in[i]); - spx_ifft(table, _in, _out); - for (i=0;i<N;i++) - out[i] = _out[i]; -#if 0 - if (!fixed_point) - { - int i; - struct drft_lookup t; - spx_drft_init(&t, ((struct kiss_config *)table)->N); - for (i=0;i<((struct kiss_config *)table)->N;i++) - out[i] = in[i]; - spx_drft_backward(&t, out); - spx_drft_clear(&t); - } -#endif -} - -#else - -void spx_fft_float(void *table, float *in, float *out) -{ - spx_fft(table, in, out); -} -void spx_ifft_float(void *table, float *in, float *out) -{ - spx_ifft(table, in, out); -} - -#endif diff --git a/src/lib/dl/ext/speex/fftwrap.h b/src/lib/dl/ext/speex/fftwrap.h deleted file mode 100755 index dfaf4894..00000000 --- a/src/lib/dl/ext/speex/fftwrap.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2005 Jean-Marc Valin - File: fftwrap.h - - Wrapper for various FFTs - - 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 FFTWRAP_H -#define FFTWRAP_H - -#include "arch.h" - -/** Compute tables for an FFT */ -void *spx_fft_init(int size); - -/** Destroy tables for an FFT */ -void spx_fft_destroy(void *table); - -/** Forward (real to half-complex) transform */ -void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out); - -/** Backward (half-complex to real) transform */ -void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out); - -/** Forward (real to half-complex) transform of float data */ -void spx_fft_float(void *table, float *in, float *out); - -/** Backward (half-complex to real) transform of float data */ -void spx_ifft_float(void *table, float *in, float *out); - -#endif diff --git a/src/lib/dl/ext/speex/filterbank.c b/src/lib/dl/ext/speex/filterbank.c deleted file mode 100755 index e2fb71d4..00000000 --- a/src/lib/dl/ext/speex/filterbank.c +++ /dev/null @@ -1,227 +0,0 @@ -/* Copyright (C) 2006 Jean-Marc Valin */ -/** - @file filterbank.c - @brief Converting between psd and filterbank - */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "filterbank.h" -#include "arch.h" -#include <math.h> -#include "math_approx.h" -#include "os_support.h" - -#ifdef FIXED_POINT - -#define toBARK(n) (MULT16_16(26829,spx_atan(SHR32(MULT16_16(97,n),2))) + MULT16_16(4588,spx_atan(MULT16_32_Q15(20,MULT16_16(n,n)))) + MULT16_16(3355,n)) - -#else -#define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n)) -#endif - -#define toMEL(n) (2595.f*log10(1.f+(n)/700.f)) - -FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type) -{ - FilterBank *bank; - spx_word32_t df; - spx_word32_t max_mel, mel_interval; - int i; - int id1; - int id2; - df = DIV32(SHL32(sampling,15),MULT16_16(2,len)); - max_mel = toBARK(EXTRACT16(sampling/2)); - mel_interval = PDIV32(max_mel,banks-1); - - bank = (FilterBank*)speex_alloc(sizeof(FilterBank)); - bank->nb_banks = banks; - bank->len = len; - bank->bank_left = (int*)speex_alloc(len*sizeof(int)); - bank->bank_right = (int*)speex_alloc(len*sizeof(int)); - bank->filter_left = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t)); - bank->filter_right = (spx_word16_t*)speex_alloc(len*sizeof(spx_word16_t)); - /* Think I can safely disable normalisation that for fixed-point (and probably float as well) */ -#ifndef FIXED_POINT - bank->scaling = (float*)speex_alloc(banks*sizeof(float)); -#endif - for (i=0;i<len;i++) - { - spx_word16_t curr_freq; - spx_word32_t mel; - spx_word16_t val; - curr_freq = EXTRACT16(MULT16_32_P15(i,df)); - mel = toBARK(curr_freq); - if (mel > max_mel) - break; -#ifdef FIXED_POINT - id1 = DIV32(mel,mel_interval); -#else - id1 = (int)(floor(mel/mel_interval)); -#endif - if (id1>banks-2) - { - id1 = banks-2; - val = Q15_ONE; - } else { - val = DIV32_16(mel - id1*mel_interval,EXTRACT16(PSHR32(mel_interval,15))); - } - id2 = id1+1; - bank->bank_left[i] = id1; - bank->filter_left[i] = SUB16(Q15_ONE,val); - bank->bank_right[i] = id2; - bank->filter_right[i] = val; - } - - /* Think I can safely disable normalisation for fixed-point (and probably float as well) */ -#ifndef FIXED_POINT - for (i=0;i<bank->nb_banks;i++) - bank->scaling[i] = 0; - for (i=0;i<bank->len;i++) - { - int id = bank->bank_left[i]; - bank->scaling[id] += bank->filter_left[i]; - id = bank->bank_right[i]; - bank->scaling[id] += bank->filter_right[i]; - } - for (i=0;i<bank->nb_banks;i++) - bank->scaling[i] = Q15_ONE/(bank->scaling[i]); -#endif - return bank; -} - -void filterbank_destroy(FilterBank *bank) -{ - speex_free(bank->bank_left); - speex_free(bank->bank_right); - speex_free(bank->filter_left); - speex_free(bank->filter_right); -#ifndef FIXED_POINT - speex_free(bank->scaling); -#endif - speex_free(bank); -} - -void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel) -{ - int i; - for (i=0;i<bank->nb_banks;i++) - mel[i] = 0; - - for (i=0;i<bank->len;i++) - { - int id; - id = bank->bank_left[i]; - mel[id] += MULT16_32_P15(bank->filter_left[i],ps[i]); - id = bank->bank_right[i]; - mel[id] += MULT16_32_P15(bank->filter_right[i],ps[i]); - } - /* Think I can safely disable normalisation that for fixed-point (and probably float as well) */ -#ifndef FIXED_POINT - /*for (i=0;i<bank->nb_banks;i++) - mel[i] = MULT16_32_P15(Q15(bank->scaling[i]),mel[i]); - */ -#endif -} - -void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *ps) -{ - int i; - for (i=0;i<bank->len;i++) - { - spx_word32_t tmp; - int id1, id2; - id1 = bank->bank_left[i]; - id2 = bank->bank_right[i]; - tmp = MULT16_16(mel[id1],bank->filter_left[i]); - tmp += MULT16_16(mel[id2],bank->filter_right[i]); - ps[i] = EXTRACT16(PSHR32(tmp,15)); - } -} - - -#ifndef FIXED_POINT -void filterbank_compute_bank(FilterBank *bank, float *ps, float *mel) -{ - int i; - for (i=0;i<bank->nb_banks;i++) - mel[i] = 0; - - for (i=0;i<bank->len;i++) - { - int id = bank->bank_left[i]; - mel[id] += bank->filter_left[i]*ps[i]; - id = bank->bank_right[i]; - mel[id] += bank->filter_right[i]*ps[i]; - } - for (i=0;i<bank->nb_banks;i++) - mel[i] *= bank->scaling[i]; -} - -void filterbank_compute_psd(FilterBank *bank, float *mel, float *ps) -{ - int i; - for (i=0;i<bank->len;i++) - { - int id = bank->bank_left[i]; - ps[i] = mel[id]*bank->filter_left[i]; - id = bank->bank_right[i]; - ps[i] += mel[id]*bank->filter_right[i]; - } -} - -void filterbank_psy_smooth(FilterBank *bank, float *ps, float *mask) -{ - /* Low freq slope: 14 dB/Bark*/ - /* High freq slope: 9 dB/Bark*/ - /* Noise vs tone: 5 dB difference */ - /* FIXME: Temporary kludge */ - float bark[100]; - int i; - /* Assumes 1/3 Bark resolution */ - float decay_low = 0.34145f; - float decay_high = 0.50119f; - filterbank_compute_bank(bank, ps, bark); - for (i=1;i<bank->nb_banks;i++) - { - /*float decay_high = 13-1.6*log10(bark[i-1]); - decay_high = pow(10,(-decay_high/30.f));*/ - bark[i] = bark[i] + decay_high*bark[i-1]; - } - for (i=bank->nb_banks-2;i>=0;i--) - { - bark[i] = bark[i] + decay_low*bark[i+1]; - } - filterbank_compute_psd(bank, bark, mask); -} - -#endif diff --git a/src/lib/dl/ext/speex/filterbank.h b/src/lib/dl/ext/speex/filterbank.h deleted file mode 100755 index 3e889a22..00000000 --- a/src/lib/dl/ext/speex/filterbank.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2006 Jean-Marc Valin */ -/** - @file filterbank.h - @brief Converting between psd and filterbank - */ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 FILTERBANK_H -#define FILTERBANK_H - -#include "arch.h" - -typedef struct { - int *bank_left; - int *bank_right; - spx_word16_t *filter_left; - spx_word16_t *filter_right; -#ifndef FIXED_POINT - float *scaling; -#endif - int nb_banks; - int len; -} FilterBank; - - -FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type); - -void filterbank_destroy(FilterBank *bank); - -void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel); - -void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *psd); - -#ifndef FIXED_POINT -void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel); -void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd); -#endif - - -#endif diff --git a/src/lib/dl/ext/speex/filters.c b/src/lib/dl/ext/speex/filters.c deleted file mode 100755 index 36ef4f69..00000000 --- a/src/lib/dl/ext/speex/filters.c +++ /dev/null @@ -1,821 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: filters.c - Various analysis/synthesis filters - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "filters.h" -#include "stack_alloc.h" -#include "arch.h" -#include "math_approx.h" -#include "ltp.h" -#include <math.h> - -#ifdef _USE_SSE -#include "filters_sse.h" -#elif defined (ARM4_ASM) || defined(ARM5E_ASM) -#include "filters_arm4.h" -#elif defined (BFIN_ASM) -#include "filters_bfin.h" -#endif - - - -void bw_lpc(spx_word16_t gamma, const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order) -{ - int i; - spx_word16_t tmp=gamma; - for (i=0;i<order;i++) - { - lpc_out[i] = MULT16_16_P15(tmp,lpc_in[i]); - tmp = MULT16_16_P15(tmp, gamma); - } -} - -void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len) -{ - int i; - for (i=0;i<len;i++) - { - /* It's important we do the test that way so we can catch NaNs, which are neither greater nor smaller */ - if (!(vec[i]>=min_val && vec[i] <= max_val)) - { - if (vec[i] < min_val) - vec[i] = min_val; - else if (vec[i] > max_val) - vec[i] = max_val; - else /* Has to be NaN */ - vec[i] = 0; - } - } -} - -void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem) -{ - int i; -#ifdef FIXED_POINT - const spx_word16_t Pcoef[5][3] = {{16384, -31313, 14991}, {16384, -31569, 15249}, {16384, -31677, 15328}, {16384, -32313, 15947}, {16384, -22446, 6537}}; - const spx_word16_t Zcoef[5][3] = {{15672, -31344, 15672}, {15802, -31601, 15802}, {15847, -31694, 15847}, {16162, -32322, 16162}, {14418, -28836, 14418}}; -#else - const spx_word16_t Pcoef[5][3] = {{1.00000f, -1.91120f, 0.91498f}, {1.00000f, -1.92683f, 0.93071f}, {1.00000f, -1.93338f, 0.93553f}, {1.00000f, -1.97226f, 0.97332f}, {1.00000f, -1.37000f, 0.39900f}}; - const spx_word16_t Zcoef[5][3] = {{0.95654f, -1.91309f, 0.95654f}, {0.96446f, -1.92879f, 0.96446f}, {0.96723f, -1.93445f, 0.96723f}, {0.98645f, -1.97277f, 0.98645f}, {0.88000f, -1.76000f, 0.88000f}}; -#endif - const spx_word16_t *den, *num; - if (filtID>4) - filtID=4; - - den = Pcoef[filtID]; num = Zcoef[filtID]; - /*return;*/ - for (i=0;i<len;i++) - { - spx_word16_t yi; - spx_word32_t vout = ADD32(MULT16_16(num[0], x[i]),mem[0]); - yi = EXTRACT16(SATURATE(PSHR32(vout,14),32767)); - mem[0] = ADD32(MAC16_16(mem[1], num[1],x[i]), SHL32(MULT16_32_Q15(-den[1],vout),1)); - mem[1] = ADD32(MULT16_16(num[2],x[i]), SHL32(MULT16_32_Q15(-den[2],vout),1)); - y[i] = yi; - } -} - -#ifdef FIXED_POINT - -/* FIXME: These functions are ugly and probably introduce too much error */ -void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len) -{ - int i; - for (i=0;i<len;i++) - { - y[i] = SHL32(MULT16_32_Q14(EXTRACT16(SHR32(x[i],7)),scale),7); - } -} - -void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len) -{ - int i; - if (scale > SHL32(EXTEND32(SIG_SCALING), 8)) - { - spx_word16_t scale_1; - scale = PSHR32(scale, SIG_SHIFT); - scale_1 = EXTRACT16(PDIV32_16(SHL32(EXTEND32(SIG_SCALING),7),scale)); - for (i=0;i<len;i++) - { - y[i] = MULT16_16_P15(scale_1, x[i]); - } - } else if (scale > SHR32(EXTEND32(SIG_SCALING), 2)) { - spx_word16_t scale_1; - scale = PSHR32(scale, SIG_SHIFT-5); - scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale); - for (i=0;i<len;i++) - { - y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),8); - } - } else { - spx_word16_t scale_1; - scale = PSHR32(scale, SIG_SHIFT-7); - if (scale < 5) - scale = 5; - scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale); - for (i=0;i<len;i++) - { - y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),6); - } - } -} - -#else - -void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len) -{ - int i; - for (i=0;i<len;i++) - y[i] = scale*x[i]; -} - -void signal_div(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len) -{ - int i; - float scale_1 = 1/scale; - for (i=0;i<len;i++) - y[i] = scale_1*x[i]; -} -#endif - - - -#ifdef FIXED_POINT - - - -spx_word16_t compute_rms(const spx_sig_t *x, int len) -{ - int i; - spx_word32_t sum=0; - spx_sig_t max_val=1; - int sig_shift; - - for (i=0;i<len;i++) - { - spx_sig_t tmp = x[i]; - if (tmp<0) - tmp = -tmp; - if (tmp > max_val) - max_val = tmp; - } - - sig_shift=0; - while (max_val>16383) - { - sig_shift++; - max_val >>= 1; - } - - for (i=0;i<len;i+=4) - { - spx_word32_t sum2=0; - spx_word16_t tmp; - tmp = EXTRACT16(SHR32(x[i],sig_shift)); - sum2 = MAC16_16(sum2,tmp,tmp); - tmp = EXTRACT16(SHR32(x[i+1],sig_shift)); - sum2 = MAC16_16(sum2,tmp,tmp); - tmp = EXTRACT16(SHR32(x[i+2],sig_shift)); - sum2 = MAC16_16(sum2,tmp,tmp); - tmp = EXTRACT16(SHR32(x[i+3],sig_shift)); - sum2 = MAC16_16(sum2,tmp,tmp); - sum = ADD32(sum,SHR32(sum2,6)); - } - - return EXTRACT16(PSHR32(SHL32(EXTEND32(spx_sqrt(DIV32(sum,len))),(sig_shift+3)),SIG_SHIFT)); -} - -spx_word16_t compute_rms16(const spx_word16_t *x, int len) -{ - int i; - spx_word16_t max_val=10; - - for (i=0;i<len;i++) - { - spx_sig_t tmp = x[i]; - if (tmp<0) - tmp = -tmp; - if (tmp > max_val) - max_val = tmp; - } - if (max_val>16383) - { - spx_word32_t sum=0; - for (i=0;i<len;i+=4) - { - spx_word32_t sum2=0; - sum2 = MAC16_16(sum2,SHR16(x[i],1),SHR16(x[i],1)); - sum2 = MAC16_16(sum2,SHR16(x[i+1],1),SHR16(x[i+1],1)); - sum2 = MAC16_16(sum2,SHR16(x[i+2],1),SHR16(x[i+2],1)); - sum2 = MAC16_16(sum2,SHR16(x[i+3],1),SHR16(x[i+3],1)); - sum = ADD32(sum,SHR32(sum2,6)); - } - return SHL16(spx_sqrt(DIV32(sum,len)),4); - } else { - spx_word32_t sum=0; - int sig_shift=0; - if (max_val < 8192) - sig_shift=1; - if (max_val < 4096) - sig_shift=2; - if (max_val < 2048) - sig_shift=3; - for (i=0;i<len;i+=4) - { - spx_word32_t sum2=0; - sum2 = MAC16_16(sum2,SHL16(x[i],sig_shift),SHL16(x[i],sig_shift)); - sum2 = MAC16_16(sum2,SHL16(x[i+1],sig_shift),SHL16(x[i+1],sig_shift)); - sum2 = MAC16_16(sum2,SHL16(x[i+2],sig_shift),SHL16(x[i+2],sig_shift)); - sum2 = MAC16_16(sum2,SHL16(x[i+3],sig_shift),SHL16(x[i+3],sig_shift)); - sum = ADD32(sum,SHR32(sum2,6)); - } - return SHL16(spx_sqrt(DIV32(sum,len)),3-sig_shift); - } -} - -#ifndef OVERRIDE_NORMALIZE16 -int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len) -{ - int i; - spx_sig_t max_val=1; - int sig_shift; - - for (i=0;i<len;i++) - { - spx_sig_t tmp = x[i]; - if (tmp<0) - tmp = NEG32(tmp); - if (tmp >= max_val) - max_val = tmp; - } - - sig_shift=0; - while (max_val>max_scale) - { - sig_shift++; - max_val >>= 1; - } - - for (i=0;i<len;i++) - y[i] = EXTRACT16(SHR32(x[i], sig_shift)); - - return sig_shift; -} -#endif - -#else - -spx_word16_t compute_rms(const spx_sig_t *x, int len) -{ - int i; - float sum=0; - for (i=0;i<len;i++) - { - sum += x[i]*x[i]; - } - return sqrt(.1+sum/len); -} -spx_word16_t compute_rms16(const spx_word16_t *x, int len) -{ - return compute_rms(x, len); -} -#endif - - - -#ifndef OVERRIDE_FILTER_MEM16 -void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) -{ - int i,j; - spx_word16_t xi,yi,nyi; - for (i=0;i<N;i++) - { - xi= x[i]; - yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767)); - nyi = NEG16(yi); - for (j=0;j<ord-1;j++) - { - mem[j] = MAC16_16(MAC16_16(mem[j+1], num[j],xi), den[j],nyi); - } - mem[ord-1] = ADD32(MULT16_16(num[ord-1],xi), MULT16_16(den[ord-1],nyi)); - y[i] = yi; - } -} -#endif - -#ifndef OVERRIDE_IIR_MEM16 -void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) -{ - int i,j; - spx_word16_t yi,nyi; - - for (i=0;i<N;i++) - { - yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767)); - nyi = NEG16(yi); - for (j=0;j<ord-1;j++) - { - mem[j] = MAC16_16(mem[j+1],den[j],nyi); - } - mem[ord-1] = MULT16_16(den[ord-1],nyi); - y[i] = yi; - } -} -#endif - -#ifndef OVERRIDE_FIR_MEM16 -void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) -{ - int i,j; - spx_word16_t xi,yi; - - for (i=0;i<N;i++) - { - xi=x[i]; - yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767)); - for (j=0;j<ord-1;j++) - { - mem[j] = MAC16_16(mem[j+1], num[j],xi); - } - mem[ord-1] = MULT16_16(num[ord-1],xi); - y[i] = yi; - } -} -#endif - - -void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack) -{ - int i; - VARDECL(spx_mem_t *mem); - ALLOC(mem, ord, spx_mem_t); - for (i=0;i<ord;i++) - mem[i]=0; - iir_mem16(xx, ak, y, N, ord, mem, stack); - for (i=0;i<ord;i++) - mem[i]=0; - filter_mem16(y, awk1, awk2, y, N, ord, mem, stack); -} -void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack) -{ - int i; - VARDECL(spx_mem_t *mem); - ALLOC(mem, ord, spx_mem_t); - for (i=0;i<ord;i++) - mem[i]=0; - filter_mem16(xx, ak, awk1, y, N, ord, mem, stack); - for (i=0;i<ord;i++) - mem[i]=0; - fir_mem16(y, awk2, y, N, ord, mem, stack); -} - - -#ifndef OVERRIDE_COMPUTE_IMPULSE_RESPONSE -void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack) -{ - int i,j; - spx_word16_t y1, ny1i, ny2i; - VARDECL(spx_mem_t *mem1); - VARDECL(spx_mem_t *mem2); - ALLOC(mem1, ord, spx_mem_t); - ALLOC(mem2, ord, spx_mem_t); - - y[0] = LPC_SCALING; - for (i=0;i<ord;i++) - y[i+1] = awk1[i]; - i++; - for (;i<N;i++) - y[i] = VERY_SMALL; - for (i=0;i<ord;i++) - mem1[i] = mem2[i] = 0; - for (i=0;i<N;i++) - { - y1 = ADD16(y[i], EXTRACT16(PSHR32(mem1[0],LPC_SHIFT))); - ny1i = NEG16(y1); - y[i] = PSHR32(ADD32(SHL32(EXTEND32(y1),LPC_SHIFT+1),mem2[0]),LPC_SHIFT); - ny2i = NEG16(y[i]); - for (j=0;j<ord-1;j++) - { - mem1[j] = MAC16_16(mem1[j+1], awk2[j],ny1i); - mem2[j] = MAC16_16(mem2[j+1], ak[j],ny2i); - } - mem1[ord-1] = MULT16_16(awk2[ord-1],ny1i); - mem2[ord-1] = MULT16_16(ak[ord-1],ny2i); - } -} -#endif - -/* Decomposes a signal into low-band and high-band using a QMF */ -void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *y1, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack) -{ - int i,j,k,M2; - VARDECL(spx_word16_t *a); - VARDECL(spx_word16_t *x); - spx_word16_t *x2; - - ALLOC(a, M, spx_word16_t); - ALLOC(x, N+M-1, spx_word16_t); - x2=x+M-1; - M2=M>>1; - for (i=0;i<M;i++) - a[M-i-1]= aa[i]; - for (i=0;i<M-1;i++) - x[i]=mem[M-i-2]; - for (i=0;i<N;i++) - x[i+M-1]=SHR16(xx[i],1); - for (i=0;i<M-1;i++) - mem[i]=SHR16(xx[N-i-1],1); - for (i=0,k=0;i<N;i+=2,k++) - { - spx_word32_t y1k=0, y2k=0; - for (j=0;j<M2;j++) - { - y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j]))); - y2k=SUB32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j]))); - j++; - y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j]))); - y2k=ADD32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j]))); - } - y1[k] = EXTRACT16(SATURATE(PSHR32(y1k,15),32767)); - y2[k] = EXTRACT16(SATURATE(PSHR32(y2k,15),32767)); - } -} - -/* Re-synthesised a signal from the QMF low-band and high-band signals */ -void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack) - /* assumptions: - all odd x[i] are zero -- well, actually they are left out of the array now - N and M are multiples of 4 */ -{ - int i, j; - int M2, N2; - VARDECL(spx_word16_t *xx1); - VARDECL(spx_word16_t *xx2); - - M2 = M>>1; - N2 = N>>1; - ALLOC(xx1, M2+N2, spx_word16_t); - ALLOC(xx2, M2+N2, spx_word16_t); - - for (i = 0; i < N2; i++) - xx1[i] = x1[N2-1-i]; - for (i = 0; i < M2; i++) - xx1[N2+i] = mem1[2*i+1]; - for (i = 0; i < N2; i++) - xx2[i] = x2[N2-1-i]; - for (i = 0; i < M2; i++) - xx2[N2+i] = mem2[2*i+1]; - - for (i = 0; i < N2; i += 2) { - spx_sig_t y0, y1, y2, y3; - spx_word16_t x10, x20; - - y0 = y1 = y2 = y3 = 0; - x10 = xx1[N2-2-i]; - x20 = xx2[N2-2-i]; - - for (j = 0; j < M2; j += 2) { - spx_word16_t x11, x21; - spx_word16_t a0, a1; - - a0 = a[2*j]; - a1 = a[2*j+1]; - x11 = xx1[N2-1+j-i]; - x21 = xx2[N2-1+j-i]; - -#ifdef FIXED_POINT - /* We multiply twice by the same coef to avoid overflows */ - y0 = MAC16_16(MAC16_16(y0, a0, x11), NEG16(a0), x21); - y1 = MAC16_16(MAC16_16(y1, a1, x11), a1, x21); - y2 = MAC16_16(MAC16_16(y2, a0, x10), NEG16(a0), x20); - y3 = MAC16_16(MAC16_16(y3, a1, x10), a1, x20); -#else - y0 = ADD32(y0,MULT16_16(a0, x11-x21)); - y1 = ADD32(y1,MULT16_16(a1, x11+x21)); - y2 = ADD32(y2,MULT16_16(a0, x10-x20)); - y3 = ADD32(y3,MULT16_16(a1, x10+x20)); -#endif - a0 = a[2*j+2]; - a1 = a[2*j+3]; - x10 = xx1[N2+j-i]; - x20 = xx2[N2+j-i]; - -#ifdef FIXED_POINT - /* We multiply twice by the same coef to avoid overflows */ - y0 = MAC16_16(MAC16_16(y0, a0, x10), NEG16(a0), x20); - y1 = MAC16_16(MAC16_16(y1, a1, x10), a1, x20); - y2 = MAC16_16(MAC16_16(y2, a0, x11), NEG16(a0), x21); - y3 = MAC16_16(MAC16_16(y3, a1, x11), a1, x21); -#else - y0 = ADD32(y0,MULT16_16(a0, x10-x20)); - y1 = ADD32(y1,MULT16_16(a1, x10+x20)); - y2 = ADD32(y2,MULT16_16(a0, x11-x21)); - y3 = ADD32(y3,MULT16_16(a1, x11+x21)); -#endif - } -#ifdef FIXED_POINT - y[2*i] = EXTRACT16(SATURATE32(PSHR32(y0,15),32767)); - y[2*i+1] = EXTRACT16(SATURATE32(PSHR32(y1,15),32767)); - y[2*i+2] = EXTRACT16(SATURATE32(PSHR32(y2,15),32767)); - y[2*i+3] = EXTRACT16(SATURATE32(PSHR32(y3,15),32767)); -#else - /* Normalize up explicitly if we're in float */ - y[2*i] = 2.f*y0; - y[2*i+1] = 2.f*y1; - y[2*i+2] = 2.f*y2; - y[2*i+3] = 2.f*y3; -#endif - } - - for (i = 0; i < M2; i++) - mem1[2*i+1] = xx1[i]; - for (i = 0; i < M2; i++) - mem2[2*i+1] = xx2[i]; -} - -#ifdef FIXED_POINT -#if 0 -const spx_word16_t shift_filt[3][7] = {{-33, 1043, -4551, 19959, 19959, -4551, 1043}, - {-98, 1133, -4425, 29179, 8895, -2328, 444}, - {444, -2328, 8895, 29179, -4425, 1133, -98}}; -#else -const spx_word16_t shift_filt[3][7] = {{-390, 1540, -4993, 20123, 20123, -4993, 1540}, - {-1064, 2817, -6694, 31589, 6837, -990, -209}, - {-209, -990, 6837, 31589, -6694, 2817, -1064}}; -#endif -#else -#if 0 -const float shift_filt[3][7] = {{-9.9369e-04, 3.1831e-02, -1.3889e-01, 6.0910e-01, 6.0910e-01, -1.3889e-01, 3.1831e-02}, - {-0.0029937, 0.0345613, -0.1350474, 0.8904793, 0.2714479, -0.0710304, 0.0135403}, - {0.0135403, -0.0710304, 0.2714479, 0.8904793, -0.1350474, 0.0345613, -0.0029937}}; -#else -const float shift_filt[3][7] = {{-0.011915f, 0.046995f, -0.152373f, 0.614108f, 0.614108f, -0.152373f, 0.046995f}, - {-0.0324855f, 0.0859768f, -0.2042986f, 0.9640297f, 0.2086420f, -0.0302054f, -0.0063646f}, - {-0.0063646f, -0.0302054f, 0.2086420f, 0.9640297f, -0.2042986f, 0.0859768f, -0.0324855f}}; -#endif -#endif - -int interp_pitch( -spx_word16_t *exc, /*decoded excitation*/ -spx_word16_t *interp, /*decoded excitation*/ -int pitch, /*pitch period*/ -int len -) -{ - int i,j,k; - spx_word32_t corr[4][7]; - spx_word32_t maxcorr; - int maxi, maxj; - for (i=0;i<7;i++) - { - corr[0][i] = inner_prod(exc, exc-pitch-3+i, len); - } - for (i=0;i<3;i++) - { - for (j=0;j<7;j++) - { - int i1, i2; - spx_word32_t tmp=0; - i1 = 3-j; - if (i1<0) - i1 = 0; - i2 = 10-j; - if (i2>7) - i2 = 7; - for (k=i1;k<i2;k++) - tmp += MULT16_32_Q15(shift_filt[i][k],corr[0][j+k-3]); - corr[i+1][j] = tmp; - } - } - maxi=maxj=0; - maxcorr = corr[0][0]; - for (i=0;i<4;i++) - { - for (j=0;j<7;j++) - { - if (corr[i][j] > maxcorr) - { - maxcorr = corr[i][j]; - maxi=i; - maxj=j; - } - } - } - for (i=0;i<len;i++) - { - spx_word32_t tmp = 0; - if (maxi>0) - { - for (k=0;k<7;k++) - { - tmp += MULT16_16(exc[i-(pitch-maxj+3)+k-3],shift_filt[maxi-1][k]); - } - } else { - tmp = SHL32(exc[i-(pitch-maxj+3)],15); - } - interp[i] = PSHR32(tmp,15); - } - return pitch-maxj+3; -} - -void multicomb( -spx_word16_t *exc, /*decoded excitation*/ -spx_word16_t *new_exc, /*enhanced excitation*/ -spx_coef_t *ak, /*LPC filter coefs*/ -int p, /*LPC order*/ -int nsf, /*sub-frame size*/ -int pitch, /*pitch period*/ -int max_pitch, -spx_word16_t comb_gain, /*gain of comb filter*/ -char *stack -) -{ - int i; - VARDECL(spx_word16_t *iexc); - spx_word16_t old_ener, new_ener; - int corr_pitch; - - spx_word16_t iexc0_mag, iexc1_mag, exc_mag; - spx_word32_t corr0, corr1; - spx_word16_t gain0, gain1; - spx_word16_t pgain1, pgain2; - spx_word16_t c1, c2; - spx_word16_t g1, g2; - spx_word16_t ngain; - spx_word16_t gg1, gg2; -#ifdef FIXED_POINT - int scaledown=0; -#endif -#if 0 /* Set to 1 to enable full pitch search */ - int nol_pitch[6]; - spx_word16_t nol_pitch_coef[6]; - spx_word16_t ol_pitch_coef; - open_loop_nbest_pitch(exc, 20, 120, nsf, - nol_pitch, nol_pitch_coef, 6, stack); - corr_pitch=nol_pitch[0]; - ol_pitch_coef = nol_pitch_coef[0]; - /*Try to remove pitch multiples*/ - for (i=1;i<6;i++) - { -#ifdef FIXED_POINT - if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],19661)) && -#else - if ((nol_pitch_coef[i]>.6*nol_pitch_coef[0]) && -#endif - (ABS(2*nol_pitch[i]-corr_pitch)<=2 || ABS(3*nol_pitch[i]-corr_pitch)<=3 || - ABS(4*nol_pitch[i]-corr_pitch)<=4 || ABS(5*nol_pitch[i]-corr_pitch)<=5)) - { - corr_pitch = nol_pitch[i]; - } - } -#else - corr_pitch = pitch; -#endif - - ALLOC(iexc, 2*nsf, spx_word16_t); - - interp_pitch(exc, iexc, corr_pitch, 80); - if (corr_pitch>max_pitch) - interp_pitch(exc, iexc+nsf, 2*corr_pitch, 80); - else - interp_pitch(exc, iexc+nsf, -corr_pitch, 80); - -#ifdef FIXED_POINT - for (i=0;i<nsf;i++) - { - if (ABS16(exc[i])>16383) - { - scaledown = 1; - break; - } - } - if (scaledown) - { - for (i=0;i<nsf;i++) - exc[i] = SHR16(exc[i],1); - for (i=0;i<2*nsf;i++) - iexc[i] = SHR16(iexc[i],1); - } -#endif - /*interp_pitch(exc, iexc+2*nsf, 2*corr_pitch, 80);*/ - - /*printf ("%d %d %f\n", pitch, corr_pitch, max_corr*ener_1);*/ - iexc0_mag = spx_sqrt(1000+inner_prod(iexc,iexc,nsf)); - iexc1_mag = spx_sqrt(1000+inner_prod(iexc+nsf,iexc+nsf,nsf)); - exc_mag = spx_sqrt(1+inner_prod(exc,exc,nsf)); - corr0 = inner_prod(iexc,exc,nsf); - if (corr0<0) - corr0=0; - corr1 = inner_prod(iexc+nsf,exc,nsf); - if (corr1<0) - corr1=0; -#ifdef FIXED_POINT - /* Doesn't cost much to limit the ratio and it makes the rest easier */ - if (SHL32(EXTEND32(iexc0_mag),6) < EXTEND32(exc_mag)) - iexc0_mag = ADD16(1,PSHR16(exc_mag,6)); - if (SHL32(EXTEND32(iexc1_mag),6) < EXTEND32(exc_mag)) - iexc1_mag = ADD16(1,PSHR16(exc_mag,6)); -#endif - if (corr0 > MULT16_16(iexc0_mag,exc_mag)) - pgain1 = QCONST16(1., 14); - else - pgain1 = PDIV32_16(SHL32(PDIV32(corr0, exc_mag),14),iexc0_mag); - if (corr1 > MULT16_16(iexc1_mag,exc_mag)) - pgain2 = QCONST16(1., 14); - else - pgain2 = PDIV32_16(SHL32(PDIV32(corr1, exc_mag),14),iexc1_mag); - gg1 = PDIV32_16(SHL32(EXTEND32(exc_mag),8), iexc0_mag); - gg2 = PDIV32_16(SHL32(EXTEND32(exc_mag),8), iexc1_mag); - if (comb_gain>0) - { -#ifdef FIXED_POINT - c1 = (MULT16_16_Q15(QCONST16(.4,15),comb_gain)+QCONST16(.07,15)); - c2 = QCONST16(.5,15)+MULT16_16_Q14(QCONST16(1.72,14),(c1-QCONST16(.07,15))); -#else - c1 = .4*comb_gain+.07; - c2 = .5+1.72*(c1-.07); -#endif - } else - { - c1=c2=0; - } -#ifdef FIXED_POINT - g1 = 32767 - MULT16_16_Q13(MULT16_16_Q15(c2, pgain1),pgain1); - g2 = 32767 - MULT16_16_Q13(MULT16_16_Q15(c2, pgain2),pgain2); -#else - g1 = 1-c2*pgain1*pgain1; - g2 = 1-c2*pgain2*pgain2; -#endif - if (g1<c1) - g1 = c1; - if (g2<c1) - g2 = c1; - g1 = (spx_word16_t)PDIV32_16(SHL32(EXTEND32(c1),14),(spx_word16_t)g1); - g2 = (spx_word16_t)PDIV32_16(SHL32(EXTEND32(c1),14),(spx_word16_t)g2); - if (corr_pitch>max_pitch) - { - gain0 = MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q14(g1,gg1)); - gain1 = MULT16_16_Q15(QCONST16(.3,15),MULT16_16_Q14(g2,gg2)); - } else { - gain0 = MULT16_16_Q15(QCONST16(.6,15),MULT16_16_Q14(g1,gg1)); - gain1 = MULT16_16_Q15(QCONST16(.6,15),MULT16_16_Q14(g2,gg2)); - } - for (i=0;i<nsf;i++) - new_exc[i] = ADD16(exc[i], EXTRACT16(PSHR32(ADD32(MULT16_16(gain0,iexc[i]), MULT16_16(gain1,iexc[i+nsf])),8))); - /* FIXME: compute_rms16 is currently not quite accurate enough (but close) */ - new_ener = compute_rms16(new_exc, nsf); - old_ener = compute_rms16(exc, nsf); - - if (old_ener < 1) - old_ener = 1; - if (new_ener < 1) - new_ener = 1; - if (old_ener > new_ener) - old_ener = new_ener; - ngain = PDIV32_16(SHL32(EXTEND32(old_ener),14),new_ener); - - for (i=0;i<nsf;i++) - new_exc[i] = MULT16_16_Q14(ngain, new_exc[i]); -#ifdef FIXED_POINT - if (scaledown) - { - for (i=0;i<nsf;i++) - exc[i] = SHL16(exc[i],1); - for (i=0;i<nsf;i++) - new_exc[i] = SHL16(SATURATE16(new_exc[i],16383),1); - } -#endif -} - diff --git a/src/lib/dl/ext/speex/filters.h b/src/lib/dl/ext/speex/filters.h deleted file mode 100755 index e3a5980e..00000000 --- a/src/lib/dl/ext/speex/filters.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file filters.h - @brief Various analysis/synthesis filters -*/ -/* - 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 FILTERS_H -#define FILTERS_H - -#include "arch.h" - -spx_word16_t compute_rms(const spx_sig_t *x, int len); -spx_word16_t compute_rms16(const spx_word16_t *x, int len); -void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len); -void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len); - -#ifdef FIXED_POINT - -int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len); - -#endif - - -#define HIGHPASS_NARROWBAND 0 -#define HIGHPASS_WIDEBAND 2 -#define HIGHPASS_INPUT 0 -#define HIGHPASS_OUTPUT 1 -#define HIGHPASS_IRS 4 - -void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem); - - -void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack); -void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack); - -void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); -void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); -void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack); - -/* Apply bandwidth expansion on LPC coef */ -void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order); -void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len); - - -void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); -void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); - -void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack); - -void multicomb( -spx_word16_t *exc, /*decoded excitation*/ -spx_word16_t *new_exc, /*enhanced excitation*/ -spx_coef_t *ak, /*LPC filter coefs*/ -int p, /*LPC order*/ -int nsf, /*sub-frame size*/ -int pitch, /*pitch period*/ -int max_pitch, /*pitch gain (3-tap)*/ -spx_word16_t comb_gain, /*gain of comb filter*/ -char *stack -); - -#endif diff --git a/src/lib/dl/ext/speex/filters_arm4.h b/src/lib/dl/ext/speex/filters_arm4.h deleted file mode 100755 index 7a740424..00000000 --- a/src/lib/dl/ext/speex/filters_arm4.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 2004 Jean-Marc Valin */ -/** - @file filters_arm4.h - @brief Various analysis/synthesis filters (ARM4 version) -*/ -/* - 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. -*/ - -#define OVERRIDE_NORMALIZE16 -int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len) -{ - spx_sig_t max_val=1; - int sig_shift; - int dead1, dead2, dead3, dead4, dead5, dead6; - - __asm__ __volatile__ ( - "\tmov %1, #1 \n" - "\tmov %3, #0 \n" - - ".normalize16loop1%=: \n" - - "\tldr %4, [%0], #4 \n" - "\tcmps %4, %1 \n" - "\tmovgt %1, %4 \n" - "\tcmps %4, %3 \n" - "\tmovlt %3, %4 \n" - - "\tsubs %2, %2, #1 \n" - "\tbne .normalize16loop1%=\n" - - "\trsb %3, %3, #0 \n" - "\tcmp %1, %3 \n" - "\tmovlt %1, %3 \n" - : "=r" (dead1), "=r" (max_val), "=r" (dead3), "=r" (dead4), - "=r" (dead5), "=r" (dead6) - : "0" (x), "2" (len) - : "cc"); - - sig_shift=0; - while (max_val>max_scale) - { - sig_shift++; - max_val >>= 1; - } - - __asm__ __volatile__ ( - ".normalize16loop%=: \n" - - "\tldr %4, [%0], #4 \n" - "\tldr %5, [%0], #4 \n" - "\tmov %4, %4, asr %3 \n" - "\tstrh %4, [%1], #2 \n" - "\tldr %4, [%0], #4 \n" - "\tmov %5, %5, asr %3 \n" - "\tstrh %5, [%1], #2 \n" - "\tldr %5, [%0], #4 \n" - "\tmov %4, %4, asr %3 \n" - "\tstrh %4, [%1], #2 \n" - "\tsubs %2, %2, #1 \n" - "\tmov %5, %5, asr %3 \n" - "\tstrh %5, [%1], #2 \n" - - "\tbgt .normalize16loop%=\n" - : "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4), - "=r" (dead5), "=r" (dead6) - : "0" (x), "1" (y), "2" (len>>2), "3" (sig_shift) - : "cc", "memory"); - return sig_shift; -} - diff --git a/src/lib/dl/ext/speex/filters_bfin.h b/src/lib/dl/ext/speex/filters_bfin.h deleted file mode 100755 index 1e433ee1..00000000 --- a/src/lib/dl/ext/speex/filters_bfin.h +++ /dev/null @@ -1,515 +0,0 @@ -/* Copyright (C) 2005 Analog Devices */ -/** - @file filters_bfin.h - @brief Various analysis/synthesis filters (Blackfin version) -*/ -/* - 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. -*/ - -#define OVERRIDE_NORMALIZE16 -int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len) -{ - spx_sig_t max_val=1; - int sig_shift; - __asm__ - ( - "%0 = 0;\n\t" - "I0 = %1;\n\t" - "L0 = 0;\n\t" - "R1 = [I0++];\n\t" - "LOOP norm_max%= LC0 = %2;\n\t" - "LOOP_BEGIN norm_max%=;\n\t" - "R2 = ABS R1 || R1 = [I0++];\n\t" - "%0 = MAX(%0, R2);\n\t" - "LOOP_END norm_max%=;\n\t" - : "=&d" (max_val) - : "a" (x), "a" (len) - : "R1", "R2" - ); - - sig_shift=0; - while (max_val>max_scale) - { - sig_shift++; - max_val >>= 1; - } - - __asm__ __volatile__ - ( - "I0 = %0;\n\t" - "L0 = 0;\n\t" - "P1 = %1;\n\t" - "R0 = [I0++];\n\t" - "LOOP norm_shift%= LC0 = %3;\n\t" - "LOOP_BEGIN norm_shift%=;\n\t" - "R1 = ASHIFT R0 by %2.L || R0 = [I0++];\n\t" - "W[P1++] = R1;\n\t" - "LOOP_END norm_shift%=;\n\t" - "R1 = ASHIFT R0 by %2.L;\n\t" - "W[P1++] = R1;\n\t" - : : "a" (x), "a" (y), "d" (-sig_shift), "a" (len-1) - : "I0", "L0", "P1", "R0", "R1", "memory" - ); - return sig_shift; -} - - - -#define OVERRIDE_FILTER_MEM16 -void filter_mem16(const spx_word16_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack) -{ - VARDECL(spx_word32_t *xy2); - VARDECL(spx_word32_t *numden_a); - spx_word32_t *xy; - spx_word16_t *numden; - int i; - - ALLOC(xy2, (N+1), spx_word32_t); - ALLOC(numden_a, (2*ord+2), spx_word32_t); - xy = xy2+1; - numden = (spx_word16_t*) numden_a; - - for (i=0;i<ord;i++) - { - numden[2*i] = num[i]; - numden[2*i+1] = den[i]; - } - __asm__ __volatile__ - ( - /* Register setup */ - "R0 = %5;\n\t" /*ord */ - - "P0 = %3;\n\t" - "I0 = P0;\n\t" - "B0 = P0;\n\t" /* numden */ - "L0 = 0;\n\t" - - "P2 = %0;\n\t" /* Fused xy */ - "I2 = P2;\n\t" - "L2 = 0;\n\t" - - "P4 = %6;\n\t" /* mem */ - "P0 = %1;\n\t" /* _x */ - "P1 = %2;\n\t" /* _y */ - - /* First sample */ - "R1 = [P4++];\n\t" - "R1 <<= 3;\n\t" /* shift mem */ - "R1.L = R1 (RND);\n\t" - "R2 = W[P0++];\n\t" /* load x[0] */ - "R1.L = R1.L + R2.L;\n\t" - "W[P1++] = R1;\n\t" /* store y[0] */ - "R2 = PACK(R1.L, R2.L);\n\t" /* pack x16 and y16 */ - "[P2] = R2;\n\t" - - /* Samples 1 to ord-1 (using memory) */ - "R0 += -1;\n\t" - "R3 = 0;\n\t" - "LC0 = R0;\n\t" - "LOOP filter_start%= LC0;\n\t" - "LOOP_BEGIN filter_start%=;\n\t" - "R3 += 1;\n\t" - "LC1 = R3;\n\t" - - "R1 = [P4++];\n\t" - "A1 = R1;\n\t" - "A0 = 0;\n\t" - "I0 = B0;\n\t" - "I2 = P2;\n\t" - "P2 += 4;\n\t" - "R4 = [I0++] || R5 = [I2--];\n\t" - "LOOP filter_start_inner%= LC1;\n\t" - "LOOP_BEGIN filter_start_inner%=;\n\t" - "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t" - "LOOP_END filter_start_inner%=;\n\t" - "A0 += A1;\n\t" - "R4 = A0;\n\t" - "R4 <<= 3;\n\t" /* shift mem */ - "R4.L = R4 (RND);\n\t" - "R2 = W[P0++];\n\t" /* load x */ - "R4.L = R4.L + R2.L;\n\t" - "W[P1++] = R4;\n\t" /* store y */ - //"R4 <<= 2;\n\t" - //"R2 <<= 2;\n\t" - "R2 = PACK(R4.L, R2.L);\n\t" /* pack x16 and y16 */ - "[P2] = R2;\n\t" - - "LOOP_END filter_start%=;\n\t" - - /* Samples ord to N*/ - "R0 = %5;\n\t" - "R0 <<= 1;\n\t" - "I0 = B0;\n\t" /* numden */ - "R0 <<= 1;\n\t" - "L0 = R0;\n\t" - - "R0 = %5;\n\t" /* org */ - "R2 = %4;\n\t" /* N */ - "R2 = R2 - R0;\n\t" - "R4 = [I0++];\n\t" /* numden */ - "LC0 = R2;\n\t" - "P3 = R0;\n\t" - "R0 <<= 2;\n\t" - "R0 += 8;\n\t" - "I2 = P2;\n\t" - "M0 = R0;\n\t" - "A1 = A0 = 0;\n\t" - "R5 = [I2--];\n\t" /* load xy */ - "LOOP filter_mid%= LC0;\n\t" - "LOOP_BEGIN filter_mid%=;\n\t" - "LOOP filter_mid_inner%= LC1=P3;\n\t" - "LOOP_BEGIN filter_mid_inner%=;\n\t" - "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t" - "LOOP_END filter_mid_inner%=;\n\t" - "R0 = (A0 += A1) || I2 += M0;\n\t" - "R0 = R0 << 3 || R5 = W[P0++];\n\t" /* load x */ - "R0.L = R0 (RND);\n\t" - "R0.L = R0.L + R5.L;\n\t" - "R5 = PACK(R0.L, R5.L) || W[P1++] = R0;\n\t" /* shift y | store y */ - "A1 = A0 = 0 || [I2--] = R5\n\t" - "LOOP_END filter_mid%=;\n\t" - "I2 += 4;\n\t" - "P2 = I2;\n\t" - /* Update memory */ - "P4 = %6;\n\t" - "R0 = %5;\n\t" - "LC0 = R0;\n\t" - "P0 = B0;\n\t" - "A1 = A0 = 0;\n\t" - "LOOP mem_update%= LC0;\n\t" - "LOOP_BEGIN mem_update%=;\n\t" - "I2 = P2;\n\t" - "I0 = P0;\n\t" - "P0 += 4;\n\t" - "R0 = LC0;\n\t" - "LC1 = R0;\n\t" - "R5 = [I2--] || R4 = [I0++];\n\t" - "LOOP mem_accum%= LC1;\n\t" - "LOOP_BEGIN mem_accum%=;\n\t" - "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t" - "LOOP_END mem_accum%=;\n\t" - "R0 = (A0 += A1);\n\t" - "A1 = A0 = 0 || [P4++] = R0;\n\t" - "LOOP_END mem_update%=;\n\t" - "L0 = 0;\n\t" - : : "m" (xy), "m" (_x), "m" (_y), "m" (numden), "m" (N), "m" (ord), "m" (mem) - : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B0", "I0", "I2", "L0", "L2", "M0", "memory" - ); - -} - - - -#define OVERRIDE_IIR_MEM16 -void iir_mem16(const spx_word16_t *_x, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack) -{ - VARDECL(spx_word16_t *y); - spx_word16_t *yy; - - ALLOC(y, (N+2), spx_word16_t); - yy = y+2; - - __asm__ __volatile__ - ( - /* Register setup */ - "R0 = %5;\n\t" /*ord */ - - "P1 = %3;\n\t" - "I1 = P1;\n\t" - "B1 = P1;\n\t" - "L1 = 0;\n\t" - - "P3 = %0;\n\t" - "I3 = P3;\n\t" - "L3 = 0;\n\t" - - "P4 = %6;\n\t" - "P0 = %1;\n\t" - "P1 = %2;\n\t" - - /* First sample */ - "R1 = [P4++];\n\t" - "R1 = R1 << 3 (S);\n\t" - "R1.L = R1 (RND);\n\t" - "R2 = W[P0++];\n\t" - "R1 = R1 + R2;\n\t" - "W[P1++] = R1;\n\t" - "W[P3] = R1;\n\t" - - /* Samples 1 to ord-1 (using memory) */ - "R0 += -1;\n\t" - "R3 = 0;\n\t" - "LC0 = R0;\n\t" - "LOOP filter_start%= LC0;\n\t" - "LOOP_BEGIN filter_start%=;\n\t" - "R3 += 1;\n\t" - "LC1 = R3;\n\t" - - "R1 = [P4++];\n\t" - "A1 = R1;\n\t" - "I1 = B1;\n\t" - "I3 = P3;\n\t" - "P3 += 2;\n\t" - "LOOP filter_start_inner%= LC1;\n\t" - "LOOP_BEGIN filter_start_inner%=;\n\t" - "R4.L = W[I1++];\n\t" - "R5.L = W[I3--];\n\t" - "A1 -= R4.L*R5.L (IS);\n\t" - "LOOP_END filter_start_inner%=;\n\t" - - "R1 = A1;\n\t" - "R1 <<= 3;\n\t" - "R1.L = R1 (RND);\n\t" - "R2 = W[P0++];\n\t" - "R1 = R1 + R2;\n\t" - "W[P1++] = R1;\n\t" - "W[P3] = R1;\n\t" - "LOOP_END filter_start%=;\n\t" - - /* Samples ord to N*/ - "R0 = %5;\n\t" - "R0 <<= 1;\n\t" - "I1 = B1;\n\t" - "L1 = R0;\n\t" - - "R0 = %5;\n\t" - "R2 = %4;\n\t" - "R2 = R2 - R0;\n\t" - "R4.L = W[I1++];\n\t" - "LC0 = R2;\n\t" - "LOOP filter_mid%= LC0;\n\t" - "LOOP_BEGIN filter_mid%=;\n\t" - "LC1 = R0;\n\t" - "A1 = 0;\n\t" - "I3 = P3;\n\t" - "P3 += 2;\n\t" - "R5.L = W[I3--];\n\t" - "LOOP filter_mid_inner%= LC1;\n\t" - "LOOP_BEGIN filter_mid_inner%=;\n\t" - "A1 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t" - "LOOP_END filter_mid_inner%=;\n\t" - "R1 = A1;\n\t" - "R1 = R1 << 3 || R2 = W[P0++];\n\t" - "R1.L = R1 (RND);\n\t" - "R1 = R1 + R2;\n\t" - "W[P1++] = R1;\n\t" - "W[P3] = R1;\n\t" - "LOOP_END filter_mid%=;\n\t" - - /* Update memory */ - "P4 = %6;\n\t" - "R0 = %5;\n\t" - "LC0 = R0;\n\t" - "P1 = B1;\n\t" - "LOOP mem_update%= LC0;\n\t" - "LOOP_BEGIN mem_update%=;\n\t" - "A0 = 0;\n\t" - "I3 = P3;\n\t" - "I1 = P1;\n\t" - "P1 += 2;\n\t" - "R0 = LC0;\n\t" - "LC1=R0;\n\t" - "R5.L = W[I3--] || R4.L = W[I1++];\n\t" - "LOOP mem_accum%= LC1;\n\t" - "LOOP_BEGIN mem_accum%=;\n\t" - "A0 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t" - "LOOP_END mem_accum%=;\n\t" - "R0 = A0;\n\t" - "[P4++] = R0;\n\t" - "LOOP_END mem_update%=;\n\t" - "L1 = 0;\n\t" - : : "m" (yy), "m" (_x), "m" (_y), "m" (den), "m" (N), "m" (ord), "m" (mem) - : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B1", "I1", "I3", "L1", "L3", "memory" - ); - -} - - -#define OVERRIDE_FIR_MEM16 -void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack) -{ - int i; - spx_coef_t den2[12]; - spx_coef_t *den; - den = (spx_coef_t*)((((int)den2)+4)&0xfffffffc); - for (i=0;i<10;i++) - den[i] = 0; - filter_mem16(x, num, den, y, N, ord, mem, stack); -} - - -#define OVERRIDE_COMPUTE_IMPULSE_RESPONSE -void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack) -{ - int i; - VARDECL(spx_word16_t *ytmp); - ALLOC(ytmp, N, spx_word16_t); - spx_word16_t *ytmp2 = ytmp; - y[0] = LPC_SCALING; - for (i=0;i<ord;i++) - y[i+1] = awk1[i]; - i++; - for (;i<N;i++) - y[i] = 0; - - N-=1; - __asm__ __volatile__ - ( - "I0 = %0;\n\t" - "I1 = %1;\n\t" - "L0 = 0;\n\t" - "L1 = 0;\n\t" - "L2 = 0;\n\t" - "L3 = 0;\n\t" - "R0 = 1;\n\t" - "R0 <<= 13;\n\t" - "W[I0] = R0.L;\n\t" - "R0 <<= 1;\n\t" - "W[I1] = R0.L;\n\t" - "R0 = %5;\n\t" - "LC0 = R0;\n\t" - "R2 = 0;\n\t" - "LOOP samples%= LC0;\n\t" - "LOOP_BEGIN samples%=;\n\t" - "R2 += 1;\n\t" - "R2 = MIN(R2, %4);\n\t" - "I0 = %0;\n\t" - "I1 = %1;\n\t" - "I2 = %2;\n\t" - "I3 = %3;\n\t" - "%0 += 2;\n\t" - "%1 += 2;\n\t" - "A1 = A0 = 0;\n\t" - "R0.L = W[I0--] || R1.L = W[I2++];\n\t" - "LC1 = R2;\n\t" - "LOOP filter%= LC1;\n\t" - "LOOP_BEGIN filter%=;\n\t" - "A0 -= R0.L*R1.L (IS) || R0.L = W[I1--] || R1.L = W[I3++];\n\t" - "A1 -= R0.L*R1.L (IS) || R0.L = W[I0--] || R1.L = W[I2++];\n\t" - "LOOP_END filter%=;\n\t" - "R0 = A0, R1 = A1;\n\t" - "R3 = W[%1] (X);\n\t" - "R3 <<= 13;\n\t" - "R0 = R0 + R3;\n\t" - "R3 = R0 >>> 13;\n\t" - "W[%0] = R3.L;\n\t" - "R0 <<= 1;\n\t" - "R1 = R1 + R0;\n\t" - "R1 >>>= 13;\n\t" - "W[%1] = R1.L;\n\t" - "LOOP_END samples%=;\n\t" - : "=a" (ytmp2), "=a" (y) - : "a" (awk2), "a" (ak), "d" (ord), "m" (N), "0" (ytmp2), "1" (y) - : "A0", "A1", "R0", "R1", "R2", "R3", "I0", "I1", "I2", "I3", "L0", "L1", "L2", "L3", "A0", "A1" - ); -} - - - -#if 0 /* Equivalent C function for filter_mem2 and compute_impulse_response */ -#define min(a,b) ((a)<(b) ? (a):(b)) - -void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack) -{ - int i,j; - VARDECL(spx_word16_t *ytmp); - ALLOC(ytmp, N, spx_word16_t); - - y[0] = LPC_SCALING; - for (i=0;i<ord;i++) - y[i+1] = awk1[i]; - i++; - for (;i<N;i++) - y[i] = 0; - - for (i=0;i<N;i++) - { - spx_word32_t yi = SHL32(EXTEND32(y[i]),LPC_SHIFT); - spx_word32_t yi2 = 0; - for (j=0;j<min(i,ord);j++) - { - yi = MAC16_16(yi, awk2[j], -ytmp[i-j-1]); - yi2 = MAC16_16(yi2, ak[j], -y[i-j-1]); - } - ytmp[i] = EXTRACT16(SHR32(yi,LPC_SHIFT)); - yi2 = ADD32(yi2,SHL32(yi,1)); - y[i] = EXTRACT16(SHR32(yi2,LPC_SHIFT)); - } - -} - - -void filter_mem2(const spx_sig_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem) -{ - int i,j; - spx_word16_t xi,yi,nyi; - spx_word16_t x[N],y[N]; - spx_word16_t *xx, *yy; - xx = x; - yy = y; - for (i=0;i<N;i++) - { - x[i] = EXTRACT16(SHR32(_x[i],SIG_SHIFT)); - } - - for (i=0;i<ord;i++) - { - spx_word32_t yi = mem[i]; - for (j=0;j<i;j++) - { - yi = MAC16_16(yi, num[j], x[i-j-1]); - yi = MAC16_16(yi, den[j], -y[i-j-1]); - } - _y[i] = ADD32(_x[i],SHL32(yi,1)); - y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT)); - } - for (i=ord;i<N;i++) - { - spx_word32_t yi = 0; - for (j=0;j<ord;j++) - { - yi = MAC16_16(yi, num[j], x[i-j-1]); - yi = MAC16_16(yi, den[j], -y[i-j-1]); - } - _y[i] = ADD32(_x[i],SHL32(yi,1)); - y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT)); - } - - for (i=0;i<ord;i++) - { - spx_mem_t m = 0; - for (j=0;j<ord-i;j++) - { - m = MAC16_16(m, x[N-1-j], num[j+i]); - m = MAC16_16(m, -y[N-1-j], den[j+i]); - } - mem[i] = m; - } -} -#endif diff --git a/src/lib/dl/ext/speex/filters_sse.h b/src/lib/dl/ext/speex/filters_sse.h deleted file mode 100755 index 4bb333da..00000000 --- a/src/lib/dl/ext/speex/filters_sse.h +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file filters_sse.h - @brief Various analysis/synthesis filters (SSE version) -*/ -/* - 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 <xmmintrin.h> - -void filter_mem16_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem) -{ - __m128 num[3], den[3], mem[3]; - - int i; - - /* Copy numerator, denominator and memory to aligned xmm */ - for (i=0;i<2;i++) - { - mem[i] = _mm_loadu_ps(_mem+4*i); - num[i] = _mm_loadu_ps(_num+4*i); - den[i] = _mm_loadu_ps(_den+4*i); - } - mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0); - num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0); - den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0); - - for (i=0;i<N;i++) - { - __m128 xx; - __m128 yy; - /* Compute next filter result */ - xx = _mm_load_ps1(x+i); - yy = _mm_add_ss(xx, mem[0]); - _mm_store_ss(y+i, yy); - yy = _mm_shuffle_ps(yy, yy, 0); - - /* Update memory */ - mem[0] = _mm_move_ss(mem[0], mem[1]); - mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39); - - mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0])); - mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0])); - - mem[1] = _mm_move_ss(mem[1], mem[2]); - mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39); - - mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1])); - mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1])); - - mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd); - - mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2])); - mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2])); - } - /* Put memory back in its place */ - _mm_storeu_ps(_mem, mem[0]); - _mm_storeu_ps(_mem+4, mem[1]); - _mm_store_ss(_mem+8, mem[2]); - mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55); - _mm_store_ss(_mem+9, mem[2]); -} - -void filter_mem16_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem) -{ - __m128 num[2], den[2], mem[2]; - - int i; - - /* Copy numerator, denominator and memory to aligned xmm */ - for (i=0;i<2;i++) - { - mem[i] = _mm_loadu_ps(_mem+4*i); - num[i] = _mm_loadu_ps(_num+4*i); - den[i] = _mm_loadu_ps(_den+4*i); - } - - for (i=0;i<N;i++) - { - __m128 xx; - __m128 yy; - /* Compute next filter result */ - xx = _mm_load_ps1(x+i); - yy = _mm_add_ss(xx, mem[0]); - _mm_store_ss(y+i, yy); - yy = _mm_shuffle_ps(yy, yy, 0); - - /* Update memory */ - mem[0] = _mm_move_ss(mem[0], mem[1]); - mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39); - - mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0])); - mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0])); - - mem[1] = _mm_sub_ss(mem[1], mem[1]); - mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39); - - mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1])); - mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1])); - } - /* Put memory back in its place */ - _mm_storeu_ps(_mem, mem[0]); - _mm_storeu_ps(_mem+4, mem[1]); -} - - -#define OVERRIDE_FILTER_MEM16 -void filter_mem16(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem, char *stack) -{ - if(ord==10) - filter_mem16_10(x, _num, _den, y, N, ord, _mem); - else if (ord==8) - filter_mem16_8(x, _num, _den, y, N, ord, _mem); -} - - - -void iir_mem16_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem) -{ - __m128 den[3], mem[3]; - - int i; - - /* Copy numerator, denominator and memory to aligned xmm */ - for (i=0;i<2;i++) - { - mem[i] = _mm_loadu_ps(_mem+4*i); - den[i] = _mm_loadu_ps(_den+4*i); - } - mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0); - den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0); - - for (i=0;i<N;i++) - { - __m128 xx; - __m128 yy; - /* Compute next filter result */ - xx = _mm_load_ps1(x+i); - yy = _mm_add_ss(xx, mem[0]); - _mm_store_ss(y+i, yy); - yy = _mm_shuffle_ps(yy, yy, 0); - - /* Update memory */ - mem[0] = _mm_move_ss(mem[0], mem[1]); - mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39); - - mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0])); - - mem[1] = _mm_move_ss(mem[1], mem[2]); - mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39); - - mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1])); - - mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd); - - mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2])); - } - /* Put memory back in its place */ - _mm_storeu_ps(_mem, mem[0]); - _mm_storeu_ps(_mem+4, mem[1]); - _mm_store_ss(_mem+8, mem[2]); - mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55); - _mm_store_ss(_mem+9, mem[2]); -} - - -void iir_mem16_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem) -{ - __m128 den[2], mem[2]; - - int i; - - /* Copy numerator, denominator and memory to aligned xmm */ - for (i=0;i<2;i++) - { - mem[i] = _mm_loadu_ps(_mem+4*i); - den[i] = _mm_loadu_ps(_den+4*i); - } - - for (i=0;i<N;i++) - { - __m128 xx; - __m128 yy; - /* Compute next filter result */ - xx = _mm_load_ps1(x+i); - yy = _mm_add_ss(xx, mem[0]); - _mm_store_ss(y+i, yy); - yy = _mm_shuffle_ps(yy, yy, 0); - - /* Update memory */ - mem[0] = _mm_move_ss(mem[0], mem[1]); - mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39); - - mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0])); - - mem[1] = _mm_sub_ss(mem[1], mem[1]); - mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39); - - mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1])); - } - /* Put memory back in its place */ - _mm_storeu_ps(_mem, mem[0]); - _mm_storeu_ps(_mem+4, mem[1]); -} - -#define OVERRIDE_IIR_MEM16 -void iir_mem16(const float *x, const float *_den, float *y, int N, int ord, float *_mem, char *stack) -{ - if(ord==10) - iir_mem16_10(x, _den, y, N, ord, _mem); - else if (ord==8) - iir_mem16_8(x, _den, y, N, ord, _mem); -} - - -void fir_mem16_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem) -{ - __m128 num[3], mem[3]; - - int i; - - /* Copy numerator, denominator and memory to aligned xmm */ - for (i=0;i<2;i++) - { - mem[i] = _mm_loadu_ps(_mem+4*i); - num[i] = _mm_loadu_ps(_num+4*i); - } - mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0); - num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0); - - for (i=0;i<N;i++) - { - __m128 xx; - __m128 yy; - /* Compute next filter result */ - xx = _mm_load_ps1(x+i); - yy = _mm_add_ss(xx, mem[0]); - _mm_store_ss(y+i, yy); - yy = _mm_shuffle_ps(yy, yy, 0); - - /* Update memory */ - mem[0] = _mm_move_ss(mem[0], mem[1]); - mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39); - - mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0])); - - mem[1] = _mm_move_ss(mem[1], mem[2]); - mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39); - - mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1])); - - mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd); - - mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2])); - } - /* Put memory back in its place */ - _mm_storeu_ps(_mem, mem[0]); - _mm_storeu_ps(_mem+4, mem[1]); - _mm_store_ss(_mem+8, mem[2]); - mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55); - _mm_store_ss(_mem+9, mem[2]); -} - -void fir_mem16_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem) -{ - __m128 num[2], mem[2]; - - int i; - - /* Copy numerator, denominator and memory to aligned xmm */ - for (i=0;i<2;i++) - { - mem[i] = _mm_loadu_ps(_mem+4*i); - num[i] = _mm_loadu_ps(_num+4*i); - } - - for (i=0;i<N;i++) - { - __m128 xx; - __m128 yy; - /* Compute next filter result */ - xx = _mm_load_ps1(x+i); - yy = _mm_add_ss(xx, mem[0]); - _mm_store_ss(y+i, yy); - yy = _mm_shuffle_ps(yy, yy, 0); - - /* Update memory */ - mem[0] = _mm_move_ss(mem[0], mem[1]); - mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39); - - mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0])); - - mem[1] = _mm_sub_ss(mem[1], mem[1]); - mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39); - - mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1])); - } - /* Put memory back in its place */ - _mm_storeu_ps(_mem, mem[0]); - _mm_storeu_ps(_mem+4, mem[1]); -} - -#define OVERRIDE_FIR_MEM16 -void fir_mem16(const float *x, const float *_num, float *y, int N, int ord, float *_mem, char *stack) -{ - if(ord==10) - fir_mem16_10(x, _num, y, N, ord, _mem); - else if (ord==8) - fir_mem16_8(x, _num, y, N, ord, _mem); -} diff --git a/src/lib/dl/ext/speex/fixed_arm4.h b/src/lib/dl/ext/speex/fixed_arm4.h deleted file mode 100755 index b6981cae..00000000 --- a/src/lib/dl/ext/speex/fixed_arm4.h +++ /dev/null @@ -1,148 +0,0 @@ -/* Copyright (C) 2004 Jean-Marc Valin */ -/** - @file fixed_arm4.h - @brief ARM4 fixed-point operations -*/ -/* - 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 FIXED_ARM4_H -#define FIXED_ARM4_H - -#undef MULT16_32_Q14 -static inline spx_word32_t MULT16_32_Q14(spx_word16_t x, spx_word32_t y) { - int res; - int dummy; - asm ( - "smull %0,%1,%2,%3 \n\t" - "mov %0, %0, lsr #14 \n\t" - "add %0, %0, %1, lsl #18 \n\t" - : "=&r"(res), "=&r" (dummy) - : "r"(y),"r"((int)x)); - return(res); -} - -#undef MULT16_32_Q15 -static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) { - int res; - int dummy; - asm ( - "smull %0,%1,%2,%3 \n\t" - "mov %0, %0, lsr #15 \n\t" - "add %0, %0, %1, lsl #17 \n\t" - : "=&r"(res), "=&r" (dummy) - : "r"(y),"r"((int)x)); - return(res); -} - -#undef DIV32_16 -static inline short DIV32_16(int a, int b) -{ - int res=0; - int dead1, dead2, dead3, dead4, dead5; - __asm__ __volatile__ ( - "\teor %5, %0, %1\n" - "\tmovs %4, %0\n" - "\trsbmi %0, %0, #0 \n" - "\tmovs %4, %1\n" - "\trsbmi %1, %1, #0 \n" - "\tmov %4, #1\n" - - "\tsubs %3, %0, %1, asl #14 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #14 \n" - - "\tsubs %3, %0, %1, asl #13 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #13 \n" - - "\tsubs %3, %0, %1, asl #12 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #12 \n" - - "\tsubs %3, %0, %1, asl #11 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #11 \n" - - "\tsubs %3, %0, %1, asl #10 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #10 \n" - - "\tsubs %3, %0, %1, asl #9 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #9 \n" - - "\tsubs %3, %0, %1, asl #8 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #8 \n" - - "\tsubs %3, %0, %1, asl #7 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #7 \n" - - "\tsubs %3, %0, %1, asl #6 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #6 \n" - - "\tsubs %3, %0, %1, asl #5 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #5 \n" - - "\tsubs %3, %0, %1, asl #4 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #4 \n" - - "\tsubs %3, %0, %1, asl #3 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #3 \n" - - "\tsubs %3, %0, %1, asl #2 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #2 \n" - - "\tsubs %3, %0, %1, asl #1 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4, asl #1 \n" - - "\tsubs %3, %0, %1 \n" - "\tmovpl %0, %3 \n" - "\torrpl %2, %2, %4 \n" - - "\tmovs %5, %5, lsr #31 \n" - "\trsbne %2, %2, #0 \n" - : "=r" (dead1), "=r" (dead2), "=r" (res), - "=r" (dead3), "=r" (dead4), "=r" (dead5) - : "0" (a), "1" (b), "2" (res) - : "cc" - ); - return res; -} - - -#endif diff --git a/src/lib/dl/ext/speex/fixed_arm5e.h b/src/lib/dl/ext/speex/fixed_arm5e.h deleted file mode 100755 index 9b4861c9..00000000 --- a/src/lib/dl/ext/speex/fixed_arm5e.h +++ /dev/null @@ -1,178 +0,0 @@ -/* Copyright (C) 2003 Jean-Marc Valin */ -/** - @file fixed_arm5e.h - @brief ARM-tuned fixed-point operations -*/ -/* - 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 FIXED_ARM5E_H -#define FIXED_ARM5E_H - -#undef MULT16_16 -static inline spx_word32_t MULT16_16(spx_word16_t x, spx_word16_t y) { - int res; - asm ("smulbb %0,%1,%2;\n" - : "=&r"(res) - : "%r"(x),"r"(y)); - return(res); -} - -#undef MAC16_16 -static inline spx_word32_t MAC16_16(spx_word32_t a, spx_word16_t x, spx_word32_t y) { - int res; - asm ("smlabb %0,%1,%2,%3;\n" - : "=&r"(res) - : "%r"(x),"r"(y),"r"(a)); - return(res); -} - -#undef MULT16_32_Q15 -static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) { - int res; - asm ("smulwb %0,%1,%2;\n" - : "=&r"(res) - : "%r"(y<<1),"r"(x)); - return(res); -} - -#undef MAC16_32_Q15 -static inline spx_word32_t MAC16_32_Q15(spx_word32_t a, spx_word16_t x, spx_word32_t y) { - int res; - asm ("smlawb %0,%1,%2,%3;\n" - : "=&r"(res) - : "%r"(y<<1),"r"(x),"r"(a)); - return(res); -} - -#undef MULT16_32_Q11 -static inline spx_word32_t MULT16_32_Q11(spx_word16_t x, spx_word32_t y) { - int res; - asm ("smulwb %0,%1,%2;\n" - : "=&r"(res) - : "%r"(y<<5),"r"(x)); - return(res); -} - -#undef MAC16_32_Q11 -static inline spx_word32_t MAC16_32_Q11(spx_word32_t a, spx_word16_t x, spx_word32_t y) { - int res; - asm ("smlawb %0,%1,%2,%3;\n" - : "=&r"(res) - : "%r"(y<<5),"r"(x),"r"(a)); - return(res); -} - -#undef DIV32_16 -static inline short DIV32_16(int a, int b) -{ - int res=0; - int dead1, dead2, dead3, dead4, dead5; - __asm__ __volatile__ ( - "\teor %5, %0, %1\n" - "\tmovs %4, %0\n" - "\trsbmi %0, %0, #0 \n" - "\tmovs %4, %1\n" - "\trsbmi %1, %1, #0 \n" - "\tmov %4, #1\n" - - "\tsubs %3, %0, %1, asl #14 \n" - "\torrpl %2, %2, %4, asl #14 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #13 \n" - "\torrpl %2, %2, %4, asl #13 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #12 \n" - "\torrpl %2, %2, %4, asl #12 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #11 \n" - "\torrpl %2, %2, %4, asl #11 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #10 \n" - "\torrpl %2, %2, %4, asl #10 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #9 \n" - "\torrpl %2, %2, %4, asl #9 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #8 \n" - "\torrpl %2, %2, %4, asl #8 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #7 \n" - "\torrpl %2, %2, %4, asl #7 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #6 \n" - "\torrpl %2, %2, %4, asl #6 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #5 \n" - "\torrpl %2, %2, %4, asl #5 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #4 \n" - "\torrpl %2, %2, %4, asl #4 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #3 \n" - "\torrpl %2, %2, %4, asl #3 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #2 \n" - "\torrpl %2, %2, %4, asl #2 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1, asl #1 \n" - "\torrpl %2, %2, %4, asl #1 \n" - "\tmovpl %0, %3 \n" - - "\tsubs %3, %0, %1 \n" - "\torrpl %2, %2, %4 \n" - "\tmovpl %0, %3 \n" - - "\tmovs %5, %5, lsr #31 \n" - "\trsbne %2, %2, #0 \n" - : "=r" (dead1), "=r" (dead2), "=r" (res), - "=r" (dead3), "=r" (dead4), "=r" (dead5) - : "0" (a), "1" (b), "2" (res) - : "memory", "cc" - ); - return res; -} - - - - -#endif diff --git a/src/lib/dl/ext/speex/fixed_bfin.h b/src/lib/dl/ext/speex/fixed_bfin.h deleted file mode 100755 index aa26f6a8..00000000 --- a/src/lib/dl/ext/speex/fixed_bfin.h +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright (C) 2005 Analog Devices - Author: Jean-Marc Valin */ -/** - @file fixed_bfin.h - @brief Blackfin fixed-point operations -*/ -/* - 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 FIXED_BFIN_H -#define FIXED_BFIN_H - -#undef PDIV32_16 -static inline spx_word16_t PDIV32_16(spx_word32_t a, spx_word16_t b) -{ - spx_word32_t res, bb; - bb = b; - a += b>>1; - __asm__ ( - "P0 = 15;\n\t" - "R0 = %1;\n\t" - "R1 = %2;\n\t" - //"R0 = R0 + R1;\n\t" - "R0 <<= 1;\n\t" - "DIVS (R0, R1);\n\t" - "LOOP divide%= LC0 = P0;\n\t" - "LOOP_BEGIN divide%=;\n\t" - "DIVQ (R0, R1);\n\t" - "LOOP_END divide%=;\n\t" - "R0 = R0.L;\n\t" - "%0 = R0;\n\t" - : "=m" (res) - : "m" (a), "m" (bb) - : "P0", "R0", "R1", "cc"); - return res; -} - -#undef DIV32_16 -static inline spx_word16_t DIV32_16(spx_word32_t a, spx_word16_t b) -{ - spx_word32_t res, bb; - bb = b; - /* Make the roundinf consistent with the C version - (do we need to do that?)*/ - if (a<0) - a += (b-1); - __asm__ ( - "P0 = 15;\n\t" - "R0 = %1;\n\t" - "R1 = %2;\n\t" - "R0 <<= 1;\n\t" - "DIVS (R0, R1);\n\t" - "LOOP divide%= LC0 = P0;\n\t" - "LOOP_BEGIN divide%=;\n\t" - "DIVQ (R0, R1);\n\t" - "LOOP_END divide%=;\n\t" - "R0 = R0.L;\n\t" - "%0 = R0;\n\t" - : "=m" (res) - : "m" (a), "m" (bb) - : "P0", "R0", "R1", "cc"); - return res; -} - -#undef MAX16 -static inline spx_word16_t MAX16(spx_word16_t a, spx_word16_t b) -{ - spx_word32_t res; - __asm__ ( - "%1 = %1.L (X);\n\t" - "%2 = %2.L (X);\n\t" - "%0 = MAX(%1,%2);" - : "=d" (res) - : "%d" (a), "d" (b) - ); - return res; -} - -#undef MULT16_32_Q15 -static inline spx_word32_t MULT16_32_Q15(spx_word16_t a, spx_word32_t b) -{ - spx_word32_t res; - __asm__ - ( - "A1 = %2.L*%1.L (M);\n\t" - "A1 = A1 >>> 15;\n\t" - "%0 = (A1 += %2.L*%1.H) ;\n\t" - : "=&W" (res), "=&d" (b) - : "d" (a), "1" (b) - : "A1" - ); - return res; -} - -#undef MAC16_32_Q15 -static inline spx_word32_t MAC16_32_Q15(spx_word32_t c, spx_word16_t a, spx_word32_t b) -{ - spx_word32_t res; - __asm__ - ( - "A1 = %2.L*%1.L (M);\n\t" - "A1 = A1 >>> 15;\n\t" - "%0 = (A1 += %2.L*%1.H);\n\t" - "%0 = %0 + %4;\n\t" - : "=&W" (res), "=&d" (b) - : "d" (a), "1" (b), "d" (c) - : "A1" - ); - return res; -} - -#undef MULT16_32_Q14 -static inline spx_word32_t MULT16_32_Q14(spx_word16_t a, spx_word32_t b) -{ - spx_word32_t res; - __asm__ - ( - "%2 <<= 1;\n\t" - "A1 = %1.L*%2.L (M);\n\t" - "A1 = A1 >>> 15;\n\t" - "%0 = (A1 += %1.L*%2.H);\n\t" - : "=W" (res), "=d" (a), "=d" (b) - : "1" (a), "2" (b) - : "A1" - ); - return res; -} - -#undef MAC16_32_Q14 -static inline spx_word32_t MAC16_32_Q14(spx_word32_t c, spx_word16_t a, spx_word32_t b) -{ - spx_word32_t res; - __asm__ - ( - "%1 <<= 1;\n\t" - "A1 = %2.L*%1.L (M);\n\t" - "A1 = A1 >>> 15;\n\t" - "%0 = (A1 += %2.L*%1.H);\n\t" - "%0 = %0 + %4;\n\t" - : "=&W" (res), "=&d" (b) - : "d" (a), "1" (b), "d" (c) - : "A1" - ); - return res; -} - -#endif diff --git a/src/lib/dl/ext/speex/fixed_debug.h b/src/lib/dl/ext/speex/fixed_debug.h deleted file mode 100755 index 54f3866e..00000000 --- a/src/lib/dl/ext/speex/fixed_debug.h +++ /dev/null @@ -1,487 +0,0 @@ -/* Copyright (C) 2003 Jean-Marc Valin */ -/** - @file fixed_debug.h - @brief Fixed-point operations with debugging -*/ -/* - 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 FIXED_DEBUG_H -#define FIXED_DEBUG_H - -#include <stdio.h> - -extern long long spx_mips; -#define MIPS_INC spx_mips++, - -#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) -#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) - - -#define VERIFY_SHORT(x) ((x)<=32767&&(x)>=-32768) -#define VERIFY_INT(x) ((x)<=2147483647LL&&(x)>=-2147483648LL) - -static inline short NEG16(int x) -{ - int res; - if (!VERIFY_SHORT(x)) - { - fprintf (stderr, "NEG16: input is not short: %d\n", (int)x); - } - res = -x; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "NEG16: output is not short: %d\n", (int)res); - spx_mips++; - return res; -} -static inline int NEG32(long long x) -{ - long long res; - if (!VERIFY_INT(x)) - { - fprintf (stderr, "NEG16: input is not int: %d\n", (int)x); - } - res = -x; - if (!VERIFY_INT(res)) - fprintf (stderr, "NEG16: output is not int: %d\n", (int)res); - spx_mips++; - return res; -} - -#define EXTRACT16(x) _EXTRACT16(x, __FILE__, __LINE__) -static inline short _EXTRACT16(int x, char *file, int line) -{ - int res; - if (!VERIFY_SHORT(x)) - { - fprintf (stderr, "EXTRACT16: input is not short: %d in %s: line %d\n", x, file, line); - } - res = x; - spx_mips++; - return res; -} - -#define EXTEND32(x) _EXTEND32(x, __FILE__, __LINE__) -static inline int _EXTEND32(int x, char *file, int line) -{ - int res; - if (!VERIFY_SHORT(x)) - { - fprintf (stderr, "EXTEND32: input is not short: %d in %s: line %d\n", x, file, line); - } - res = x; - spx_mips++; - return res; -} - -#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__) -static inline short _SHR16(int a, int shift, char *file, int line) -{ - int res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) - { - fprintf (stderr, "SHR16: inputs are not short: %d >> %d in %s: line %d\n", a, shift, file, line); - } - res = a>>shift; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "SHR16: output is not short: %d in %s: line %d\n", res, file, line); - spx_mips++; - return res; -} -#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__) -static inline short _SHL16(int a, int shift, char *file, int line) -{ - int res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) - { - fprintf (stderr, "SHL16: inputs are not short: %d %d in %s: line %d\n", a, shift, file, line); - } - res = a<<shift; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "SHL16: output is not short: %d in %s: line %d\n", res, file, line); - spx_mips++; - return res; -} - -static inline int SHR32(long long a, int shift) -{ - long long res; - if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) - { - fprintf (stderr, "SHR32: inputs are not int: %d %d\n", (int)a, shift); - } - res = a>>shift; - if (!VERIFY_INT(res)) - { - fprintf (stderr, "SHR32: output is not int: %d\n", (int)res); - } - spx_mips++; - return res; -} -static inline int SHL32(long long a, int shift) -{ - long long res; - if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) - { - fprintf (stderr, "SHL32: inputs are not int: %d %d\n", (int)a, shift); - } - res = a<<shift; - if (!VERIFY_INT(res)) - { - fprintf (stderr, "SHL32: output is not int: %d\n", (int)res); - } - spx_mips++; - return res; -} - -#define PSHR16(a,shift) (SHR16(ADD16((a),((1<<((shift))>>1))),shift)) -#define PSHR32(a,shift) (SHR32(ADD32((a),((EXTEND32(1)<<((shift))>>1))),shift)) -#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift))) - -#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) -#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) - -//#define SHR(a,shift) ((a) >> (shift)) -//#define SHL(a,shift) ((a) << (shift)) - -#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__) -static inline short _ADD16(int a, int b, char *file, int line) -{ - int res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "ADD16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line); - } - res = a+b; - if (!VERIFY_SHORT(res)) - { - fprintf (stderr, "ADD16: output is not short: %d+%d=%d in %s: line %d\n", a,b,res, file, line); - } - spx_mips++; - return res; -} - -#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__) -static inline short _SUB16(int a, int b, char *file, int line) -{ - int res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "SUB16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line); - } - res = a-b; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "SUB16: output is not short: %d in %s: line %d\n", res, file, line); - spx_mips++; - return res; -} - -#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__) -static inline int _ADD32(long long a, long long b, char *file, int line) -{ - long long res; - if (!VERIFY_INT(a) || !VERIFY_INT(b)) - { - fprintf (stderr, "ADD32: inputs are not int: %d %d in %s: line %d\n", (int)a, (int)b, file, line); - } - res = a+b; - if (!VERIFY_INT(res)) - { - fprintf (stderr, "ADD32: output is not int: %d in %s: line %d\n", (int)res, file, line); - } - spx_mips++; - return res; -} - -static inline int SUB32(long long a, long long b) -{ - long long res; - if (!VERIFY_INT(a) || !VERIFY_INT(b)) - { - fprintf (stderr, "SUB32: inputs are not int: %d %d\n", (int)a, (int)b); - } - res = a-b; - if (!VERIFY_INT(res)) - fprintf (stderr, "SUB32: output is not int: %d\n", (int)res); - spx_mips++; - return res; -} - -#define ADD64(a,b) (MIPS_INC(a)+(b)) - -/* result fits in 16 bits */ -static inline short MULT16_16_16(int a, int b) -{ - int res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_16: inputs are not short: %d %d\n", a, b); - } - res = a*b; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "MULT16_16_16: output is not short: %d\n", res); - spx_mips++; - return res; -} - -#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__) -static inline int _MULT16_16(int a, int b, char *file, int line) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line); - } - res = ((long long)a)*b; - if (!VERIFY_INT(res)) - fprintf (stderr, "MULT16_16: output is not int: %d in %s: line %d\n", (int)res, file, line); - spx_mips++; - return res; -} - -#define MAC16_16(c,a,b) (spx_mips--,ADD32((c),MULT16_16((a),(b)))) -#define MAC16_16_Q11(c,a,b) (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11))))) -#define MAC16_16_Q13(c,a,b) (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13))))) -#define MAC16_16_P13(c,a,b) (EXTRACT16(ADD32((c),SHR32(ADD32(4096,MULT16_16((a),(b))),13)))) - - -#define MULT16_32_QX(a, b, Q) _MULT16_32_QX(a, b, Q, __FILE__, __LINE__) -static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_INT(b)) - { - fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); - } - if (ABS32(b)>=(EXTEND32(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); - res = (((long long)a)*(long long)b) >> Q; - if (!VERIFY_INT(res)) - fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line); - spx_mips+=5; - return res; -} - -static inline int MULT16_32_PX(int a, long long b, int Q) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_INT(b)) - { - fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b); - } - if (ABS32(b)>=(EXTEND32(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); - res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<<Q)>>1))>> Q; - if (!VERIFY_INT(res)) - fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res); - spx_mips+=5; - return res; -} - - -#define MULT16_32_Q11(a,b) MULT16_32_QX(a,b,11) -#define MAC16_32_Q11(c,a,b) ADD32((c),MULT16_32_Q11((a),(b))) -#define MULT16_32_Q12(a,b) MULT16_32_QX(a,b,12) -#define MULT16_32_Q13(a,b) MULT16_32_QX(a,b,13) -#define MULT16_32_Q14(a,b) MULT16_32_QX(a,b,14) -#define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15) -#define MULT16_32_P15(a,b) MULT16_32_PX(a,b,15) -#define MAC16_32_Q15(c,a,b) ADD32((c),MULT16_32_Q15((a),(b))) - -static inline int SATURATE(int a, int b) -{ - if (a>b) - a=b; - if (a<-b) - a = -b; - return a; -} - -static inline int MULT16_16_Q11_32(int a, int b) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_Q11: inputs are not short: %d %d\n", a, b); - } - res = ((long long)a)*b; - res >>= 11; - if (!VERIFY_INT(res)) - fprintf (stderr, "MULT16_16_Q11: output is not short: %d*%d=%d\n", (int)a, (int)b, (int)res); - spx_mips+=3; - return res; -} -static inline short MULT16_16_Q13(int a, int b) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_Q13: inputs are not short: %d %d\n", a, b); - } - res = ((long long)a)*b; - res >>= 13; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "MULT16_16_Q13: output is not short: %d*%d=%d\n", a, b, (int)res); - spx_mips+=3; - return res; -} -static inline short MULT16_16_Q14(int a, int b) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_Q14: inputs are not short: %d %d\n", a, b); - } - res = ((long long)a)*b; - res >>= 14; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "MULT16_16_Q14: output is not short: %d\n", (int)res); - spx_mips+=3; - return res; -} -static inline short MULT16_16_Q15(int a, int b) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_Q15: inputs are not short: %d %d\n", a, b); - } - res = ((long long)a)*b; - res >>= 15; - if (!VERIFY_SHORT(res)) - { - fprintf (stderr, "MULT16_16_Q15: output is not short: %d\n", (int)res); - } - spx_mips+=3; - return res; -} - -static inline short MULT16_16_P13(int a, int b) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_P13: inputs are not short: %d %d\n", a, b); - } - res = ((long long)a)*b; - res += 4096; - if (!VERIFY_INT(res)) - fprintf (stderr, "MULT16_16_P13: overflow: %d*%d=%d\n", a, b, (int)res); - res >>= 13; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "MULT16_16_P13: output is not short: %d*%d=%d\n", a, b, (int)res); - spx_mips+=4; - return res; -} -static inline short MULT16_16_P14(int a, int b) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_P14: inputs are not short: %d %d\n", a, b); - } - res = ((long long)a)*b; - res += 8192; - if (!VERIFY_INT(res)) - fprintf (stderr, "MULT16_16_P14: overflow: %d*%d=%d\n", a, b, (int)res); - res >>= 14; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "MULT16_16_P14: output is not short: %d*%d=%d\n", a, b, (int)res); - spx_mips+=4; - return res; -} -static inline short MULT16_16_P15(int a, int b) -{ - long long res; - if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "MULT16_16_P15: inputs are not short: %d %d\n", a, b); - } - res = ((long long)a)*b; - res += 16384; - if (!VERIFY_INT(res)) - fprintf (stderr, "MULT16_16_P15: overflow: %d*%d=%d\n", a, b, (int)res); - res >>= 15; - if (!VERIFY_SHORT(res)) - fprintf (stderr, "MULT16_16_P15: output is not short: %d*%d=%d\n", a, b, (int)res); - spx_mips+=4; - return res; -} - -#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__) - -static inline int _DIV32_16(long long a, long long b, char *file, int line) -{ - long long res; - if (b==0) - { - fprintf(stderr, "DIV32_16: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line); - return 0; - } - if (!VERIFY_INT(a) || !VERIFY_SHORT(b)) - { - fprintf (stderr, "DIV32_16: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line); - } - res = a/b; - if (!VERIFY_SHORT(res)) - { - fprintf (stderr, "DIV32_16: output is not short: %d / %d = %d in %s: line %d\n", (int)a,(int)b,(int)res, file, line); - if (res>32767) - res = 32767; - if (res<-32768) - res = -32768; - } - spx_mips+=20; - return res; -} - -#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__) -static inline int _DIV32(long long a, long long b, char *file, int line) -{ - long long res; - if (b==0) - { - fprintf(stderr, "DIV32: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line); - return 0; - } - - if (!VERIFY_INT(a) || !VERIFY_INT(b)) - { - fprintf (stderr, "DIV32: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line); - } - res = a/b; - if (!VERIFY_INT(res)) - fprintf (stderr, "DIV32: output is not int: %d in %s: line %d\n", (int)res, file, line); - spx_mips+=36; - return res; -} -#define PDIV32(a,b) DIV32(ADD32((a),(b)>>1),b) -#define PDIV32_16(a,b) DIV32_16(ADD32((a),(b)>>1),b) - -#endif diff --git a/src/lib/dl/ext/speex/fixed_generic.h b/src/lib/dl/ext/speex/fixed_generic.h deleted file mode 100755 index 3fb096ed..00000000 --- a/src/lib/dl/ext/speex/fixed_generic.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (C) 2003 Jean-Marc Valin */ -/** - @file fixed_generic.h - @brief Generic fixed-point operations -*/ -/* - 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 FIXED_GENERIC_H -#define FIXED_GENERIC_H - -#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) -#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits)))) - -#define NEG16(x) (-(x)) -#define NEG32(x) (-(x)) -#define EXTRACT16(x) ((spx_word16_t)(x)) -#define EXTEND32(x) ((spx_word32_t)(x)) -#define SHR16(a,shift) ((a) >> (shift)) -#define SHL16(a,shift) ((a) << (shift)) -#define SHR32(a,shift) ((a) >> (shift)) -#define SHL32(a,shift) ((a) << (shift)) -#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift)) -#define PSHR32(a,shift) (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift)) -#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift))) -#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) -#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) - -#define SHR(a,shift) ((a) >> (shift)) -#define SHL(a,shift) ((spx_word32_t)(a) << (shift)) -#define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift)) -#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) - - -#define ADD16(a,b) ((spx_word16_t)((spx_word16_t)(a)+(spx_word16_t)(b))) -#define SUB16(a,b) ((spx_word16_t)(a)-(spx_word16_t)(b)) -#define ADD32(a,b) ((spx_word32_t)(a)+(spx_word32_t)(b)) -#define SUB32(a,b) ((spx_word32_t)(a)-(spx_word32_t)(b)) - - -/* result fits in 16 bits */ -#define MULT16_16_16(a,b) ((((spx_word16_t)(a))*((spx_word16_t)(b)))) - -/* (spx_word32_t)(spx_word16_t) gives TI compiler a hint that it's 16x16->32 multiply */ -#define MULT16_16(a,b) (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b))) - -#define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b)))) -#define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12)) -#define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13)) -#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14)) - -#define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)) -#define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))) - -#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15)) -#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)) -#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))) - - -#define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11))) -#define MAC16_16_Q13(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),13))) -#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13))) - -#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11)) -#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13)) -#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14)) -#define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15)) - -#define MULT16_16_P13(a,b) (SHR(ADD32(4096,MULT16_16((a),(b))),13)) -#define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14)) -#define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15)) - -#define MUL_16_32_R15(a,bh,bl) ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15)) - -#define DIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b)))) -#define PDIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b)))) -#define DIV32(a,b) (((spx_word32_t)(a))/((spx_word32_t)(b))) -#define PDIV32(a,b) (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b))) - -#endif diff --git a/src/lib/dl/ext/speex/gain_table.c b/src/lib/dl/ext/speex/gain_table.c deleted file mode 100755 index 00b82442..00000000 --- a/src/lib/dl/ext/speex/gain_table.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: gain_table.c - Codebook for 3-tap pitch prediction gain (128 entries) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -const signed char gain_cdbk_nb[512] = { --32, -32, -32, 0, --28, -67, -5, 33, --42, -6, -32, 18, --57, -10, -54, 35, --16, 27, -41, 42, -19, -19, -40, 36, --45, 24, -21, 40, --8, -14, -18, 28, -1, 14, -58, 53, --18, -88, -39, 39, --38, 21, -18, 37, --19, 20, -43, 38, -10, 17, -48, 54, --52, -58, -13, 33, --44, -1, -11, 32, --12, -11, -34, 22, -14, 0, -46, 46, --37, -35, -34, 5, --25, 44, -30, 43, -6, -4, -63, 49, --31, 43, -41, 43, --23, 30, -43, 41, --43, 26, -14, 44, --33, 1, -13, 27, --13, 18, -37, 37, --46, -73, -45, 34, --36, 24, -25, 34, --36, -11, -20, 19, --25, 12, -18, 33, --36, -69, -59, 34, --45, 6, 8, 46, --22, -14, -24, 18, --1, 13, -44, 44, --39, -48, -26, 15, --32, 31, -37, 34, --33, 15, -46, 31, --24, 30, -36, 37, --41, 31, -23, 41, --50, 22, -4, 50, --22, 2, -21, 28, --17, 30, -34, 40, --7, -60, -28, 29, --38, 42, -28, 42, --44, -11, 21, 43, --16, 8, -44, 34, --39, -55, -43, 21, --11, -35, 26, 41, --9, 0, -34, 29, --8, 121, -81, 113, -7, -16, -22, 33, --37, 33, -31, 36, --27, -7, -36, 17, --34, 70, -57, 65, --37, -11, -48, 21, --40, 17, -1, 44, --33, 6, -6, 33, --9, 0, -20, 34, --21, 69, -33, 57, --29, 33, -31, 35, --55, 12, -1, 49, --33, 27, -22, 35, --50, -33, -47, 17, --50, 54, 51, 94, --1, -5, -44, 35, --4, 22, -40, 45, --39, -66, -25, 24, --33, 1, -26, 20, --24, -23, -25, 12, --11, 21, -45, 44, --25, -45, -19, 17, --43, 105, -16, 82, -5, -21, 1, 41, --16, 11, -33, 30, --13, -99, -4, 57, --37, 33, -15, 44, --25, 37, -63, 54, --36, 24, -31, 31, --53, -56, -38, 26, --41, -4, 4, 37, --33, 13, -30, 24, -49, 52, -94, 114, --5, -30, -15, 23, -1, 38, -40, 56, --23, 12, -36, 29, --17, 40, -47, 51, --37, -41, -39, 11, --49, 34, 0, 58, --18, -7, -4, 34, --16, 17, -27, 35, -30, 5, -62, 65, -4, 48, -68, 76, --43, 11, -11, 38, --18, 19, -15, 41, --23, -62, -39, 23, --42, 10, -2, 41, --21, -13, -13, 25, --9, 13, -47, 42, --23, -62, -24, 24, --44, 60, -21, 58, --18, -3, -52, 32, --22, 22, -36, 34, --75, 57, 16, 90, --19, 3, 10, 45, --29, 23, -38, 32, --5, -62, -51, 38, --51, 40, -18, 53, --42, 13, -24, 32, --34, 14, -20, 30, --56, -75, -26, 37, --26, 32, 15, 59, --26, 17, -29, 29, --7, 28, -52, 53, --12, -30, 5, 30, --5, -48, -5, 35, -2, 2, -43, 40, -21, 16, 16, 75, --25, -45, -32, 10, --43, 18, -10, 42, -9, 0, -1, 52, --1, 7, -30, 36, -19, -48, -4, 48, --28, 25, -29, 32, --22, 0, -31, 22, --32, 17, -10, 36, --64, -41, -62, 36, --52, 15, 16, 58, --30, -22, -32, 6, --7, 9, -38, 36}; diff --git a/src/lib/dl/ext/speex/gain_table_lbr.c b/src/lib/dl/ext/speex/gain_table_lbr.c deleted file mode 100755 index 3c1c3dba..00000000 --- a/src/lib/dl/ext/speex/gain_table_lbr.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: gain_table_lbr.c - Codebook for 3-tap pitch prediction gain (32 entries) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -const signed char gain_cdbk_lbr[128] = { --32, -32, -32, 0, --31, -58, -16, 22, --41, -24, -43, 14, --56, -22, -55, 29, --13, 33, -41, 47, --4, -39, -9, 29, --41, 15, -12, 38, --8, -15, -12, 31, -1, 2, -44, 40, --22, -66, -42, 27, --38, 28, -23, 38, --21, 14, -37, 31, -0, 21, -50, 52, --53, -71, -27, 33, --37, -1, -19, 25, --19, -5, -28, 22, -6, 65, -44, 74, --33, -48, -33, 9, --40, 57, -14, 58, --17, 4, -45, 32, --31, 38, -33, 36, --23, 28, -40, 39, --43, 29, -12, 46, --34, 13, -23, 28, --16, 15, -27, 34, --14, -82, -15, 43, --31, 25, -32, 29, --21, 5, -5, 38, --47, -63, -51, 33, --46, 12, 3, 47, --28, -17, -29, 11, --10, 14, -40, 38}; diff --git a/src/lib/dl/ext/speex/getopt.c b/src/lib/dl/ext/speex/getopt.c deleted file mode 100755 index 33d299bd..00000000 --- a/src/lib/dl/ext/speex/getopt.c +++ /dev/null @@ -1,1047 +0,0 @@ -/* 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 <stdio.h>. - Ditto for AIX 3.2 and <stdlib.h>. */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include <stdio.h> - -/* 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 <gnu-versions.h> -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#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 <stdlib.h> -# include <unistd.h> -#endif /* GNU C library. */ - -#ifdef VMS -# include <unixlib.h> -# if HAVE_STRING_H - 0 -# include <string.h> -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include <libintl.h> -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `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 `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 "getopt_win.h" - -/* For communication from `getopt' to the caller. - When `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 *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 `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `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 optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* 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 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 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 `getopt' to return -1 with `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 <string.h> -# define my_index strchr -#else - -#include <string.h> - -/* 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,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 = 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 += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_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 = 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; -#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 `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `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 `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 `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `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 `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 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 -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[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[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[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 > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = 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 != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = 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 (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - 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 (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) - 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; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[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[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct 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 (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - 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) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[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[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - 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 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[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[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[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (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); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct 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') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = 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 (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - 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) - optarg = nameend + 1; - else - { - if (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 (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[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') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct 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 `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = 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", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/lib/dl/ext/speex/getopt.h b/src/lib/dl/ext/speex/getopt.h deleted file mode 100755 index 49c94f4b..00000000 --- a/src/lib/dl/ext/speex/getopt.h +++ /dev/null @@ -1,171 +0,0 @@ -/* 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 _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef DONT_DEFINE_GETOPT_VARS -/* For communication from `getopt' to the caller. - When `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 *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 `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; -#endif - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - 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 `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, `getopt' - returns the contents of the `val' field. */ - -struct 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 option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#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, `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 `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `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 - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# 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 getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/src/lib/dl/ext/speex/getopt1.c b/src/lib/dl/ext/speex/getopt1.c deleted file mode 100755 index 39f8383e..00000000 --- a/src/lib/dl/ext/speex/getopt1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* 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 "config.h" -#endif - -#include "getopt_win.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include <stdio.h> - -/* 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 <gnu-versions.h> -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include <stdlib.h> -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like 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 -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include <stdio.h> - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct 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 = 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 (optarg) - printf (" with arg %s", 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", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/lib/dl/ext/speex/getopt_win.h b/src/lib/dl/ext/speex/getopt_win.h deleted file mode 100755 index 91eb54e5..00000000 --- a/src/lib/dl/ext/speex/getopt_win.h +++ /dev/null @@ -1,169 +0,0 @@ -/* 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 _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `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 *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 `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - 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 `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, `getopt' - returns the contents of the `val' field. */ - -struct 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 option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#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, `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 `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `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 - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# 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 getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/src/lib/dl/ext/speex/hexc_10_32_table.c b/src/lib/dl/ext/speex/hexc_10_32_table.c deleted file mode 100755 index 8dd408f2..00000000 --- a/src/lib/dl/ext/speex/hexc_10_32_table.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: hexc_10_32_table.c - Codebook for high-band excitation in SB-CELP mode (4000 bps) - - 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. -*/ - -const signed char hexc_10_32_table[320] = { --3, -2, -1, 0, -4, 5, 35, -40, -9, 13, --44, 5, -27, -1, -7, 6, -11, 7, -8, 7, -19, -14, 15, -4, 9, -10, 10, -8, 10, -9, --1, 1, 0, 0, 2, 5, -18, 22, -53, 50, -1, -23, 50, -36, 15, 3, -13, 14, -10, 6, -1, 5, -3, 4, -2, 5, -32, 25, 5, -2, --1, -4, 1, 11, -29, 26, -6, -15, 30, -18, -0, 15, -17, 40, -41, 3, 9, -2, -2, 3, --3, -1, -5, 2, 21, -6, -16, -21, 23, 2, -60, 15, 16, -16, -9, 14, 9, -1, 7, -9, -0, 1, 1, 0, -1, -6, 17, -28, 54, -45, --1, 1, -1, -6, -6, 2, 11, 26, -29, -2, -46, -21, 34, 12, -23, 32, -23, 16, -10, 3, -66, 19, -20, 24, 7, 11, -3, 0, -3, -1, --50, -46, 2, -18, -3, 4, -1, -2, 3, -3, --19, 41, -36, 9, 11, -24, 21, -16, 9, -3, --25, -3, 10, 18, -9, -2, -5, -1, -5, 6, --4, -3, 2, -26, 21, -19, 35, -15, 7, -13, -17, -19, 39, -43, 48, -31, 16, -9, 7, -2, --5, 3, -4, 9, -19, 27, -55, 63, -35, 10, -26, -44, -2, 9, 4, 1, -6, 8, -9, 5, --8, -1, -3, -16, 45, -42, 5, 15, -16, 10, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, --16, 24, -55, 47, -38, 27, -19, 7, -3, 1, -16, 27, 20, -19, 18, 5, -7, 1, -5, 2, --6, 8, -22, 0, -3, -3, 8, -1, 7, -8, -1, -3, 5, 0, 17, -48, 58, -52, 29, -7, --2, 3, -10, 6, -26, 58, -31, 1, -6, 3, -93, -29, 39, 3, 17, 5, 6, -1, -1, -1, -27, 13, 10, 19, -7, -34, 12, 10, -4, 9, --76, 9, 8, -28, -2, -11, 2, -1, 3, 1, --83, 38, -39, 4, -16, -6, -2, -5, 5, -2, -}; diff --git a/src/lib/dl/ext/speex/hexc_table.c b/src/lib/dl/ext/speex/hexc_table.c deleted file mode 100755 index 268408a8..00000000 --- a/src/lib/dl/ext/speex/hexc_table.c +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: hexc_table.c - Codebook for high-band excitation in SB-CELP mode (8000 bps with sign) - - 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. -*/ - -const signed char hexc_table[1024] = { --24, 21, -20, 5, -5, -7, 14, -10, -2, -27, 16, -20, 0, -32, 26, 19, -8, -11, -41, 31, 28, -27, -32, 34, -42, 34, -17, 22, -10, 13, -29, 18, --12, -26, -24, 11, 22, 5, -5, -5, -54, -68, -43, 57, -25, 24, 4, 4, -26, -8, -12, -17, 54, 30, -45, 1, -10, -15, 18, -41, 11, 68, -67, 37, --16, -24, -16, 38, -22, 6, -29, 30, -66, -27, 5, 7, -16, 13, 2, -12, --7, -3, -20, 36, 4, -28, 9, 3, -32, 48, 26, 39, 3, 0, 7, -21, --13, 5, -82, -7, 73, -20, 34, -9, --5, 1, -1, 10, -5, -10, -1, 9, -1, -9, 10, 0, -14, 11, -1, -2, --1, 11, 20, 96, -81, -22, -12, -9, --58, 9, 24, -30, 26, -35, 27, -12, -13, -18, 56, -59, 15, -7, 23, -15, --1, 6, -25, 14, -22, -20, 47, -11, -16, 2, 38, -23, -19, -30, -9, 40, --11, 5, 4, -6, 8, 26, -21, -11, -127, 4, 1, 6, -9, 2, -7, -2, --3, 7, -5, 10, -19, 7, -106, 91, --3, 9, -4, 21, -8, 26, -80, 8, -1, -2, -10, -17, -17, -27, 32, 71, -6, -29, 11, -23, 54, -38, 29, -22, -39, 87, -31, -12, -20, 3, -2, -2, -2, 20, 0, -1, -35, 27, 9, -6, --12, 3, -12, -6, 13, 1, 14, -22, --59, -15, -17, -25, 13, -7, 7, 3, -0, 1, -7, 6, -3, 61, -37, -23, --23, -29, 38, -31, 27, 1, -8, 2, --27, 23, -26, 36, -34, 5, 24, -24, --6, 7, 3, -59, 78, -62, 44, -16, -1, 6, 0, 17, 8, 45, 0, -110, -6, 14, -2, 32, -77, -56, 62, -3, -3, -13, 4, -16, 102, -15, -36, -1, -9, -113, 6, 23, 0, 9, 9, 5, --8, -1, -14, 5, -12, 121, -53, -27, --8, -9, 22, -13, 3, 2, -3, 1, --2, -71, 95, 38, -19, 15, -16, -5, -71, 10, 2, -32, -13, -5, 15, -1, --2, -14, -85, 30, 29, 6, 3, 2, -0, 0, 0, 0, 0, 0, 0, 0, -2, -65, -56, -9, 18, 18, 23, -14, --2, 0, 12, -29, 26, -12, 1, 2, --12, -64, 90, -6, 4, 1, 5, -5, --110, -3, -31, 22, -29, 9, 0, 8, --40, -5, 21, -5, -5, 13, 10, -18, -40, 1, 35, -20, 30, -28, 11, -6, -19, 7, 14, 18, -64, 9, -6, 16, -51, 68, 8, 16, 12, -8, 0, -9, -20, -22, 25, 7, -4, -13, 41, -35, -93, -18, -54, 11, -1, 1, -9, 4, --66, 66, -31, 20, -22, 25, -23, 11, -10, 9, 19, 15, 11, -5, -31, -10, --23, -28, -6, -6, -3, -4, 5, 3, --28, 22, -11, -42, 25, -25, -16, 41, -34, 47, -6, 2, 42, -19, -22, 5, --39, 32, 6, -35, 22, 17, -30, 8, --26, -11, -11, 3, -12, 33, 33, -37, -21, -1, 6, -4, 3, 0, -5, 5, -12, -12, 57, 27, -61, -3, 20, -17, -2, 0, 4, 0, -2, -33, -58, 81, --23, 39, -10, -5, 2, 6, -7, 5, -4, -3, -2, -13, -23, -72, 107, 15, --5, 0, -7, -3, -6, 5, -4, 15, -47, 12, -31, 25, -16, 8, 22, -25, --62, -56, -18, 14, 28, 12, 2, -11, -74, -66, 41, -20, -7, 16, -20, 16, --8, 0, -16, 4, -19, 92, 12, -59, --14, -39, 49, -25, -16, 23, -27, 19, --3, -33, 19, 85, -29, 6, -7, -10, -16, -7, -12, 1, -6, 2, 4, -2, -64, 10, -25, 41, -2, -31, 15, 0, -110, 50, 69, 35, 28, 19, -10, 2, --43, -49, -56, -15, -16, 10, 3, 12, --1, -8, 1, 26, -12, -1, 7, -11, --27, 41, 25, 1, -11, -18, 22, -7, --1, -47, -8, 23, -3, -17, -7, 18, --125, 59, -5, 3, 18, 1, 2, 3, -27, -35, 65, -53, 50, -46, 37, -21, --28, 7, 14, -37, -5, -5, 12, 5, --8, 78, -19, 21, -6, -16, 8, -7, -5, 2, 7, 2, 10, -6, 12, -60, -44, 11, -36, -32, 31, 0, 2, -2, -2, 1, -3, 7, -10, 17, -21, 10, -6, -2, 19, -2, 59, -38, -86, 38, -8, -41, -30, -45, -33, 7, 15, 28, -29, -7, 24, -40, 7, 7, 5, -2, -9, 24, -23, -18, 6, -29, 30, 2, -28, 49, -11, -46, 10, 43, -13, -9, --1, -3, -7, -7, -17, -6, 97, -33, --21, 3, 5, 1, 12, -43, -8, 28, -7, -43, -7, 17, -20, 19, -1, 2, --13, 9, 54, 34, 9, -28, -11, -9, --17, 110, -59, 44, -26, 0, 3, -12, --47, 73, -34, -43, 38, -33, 16, -5, --46, -4, -6, -2, -25, 19, -29, 28, --13, 5, 14, 27, -40, -43, 4, 32, --13, -2, -35, -4, 112, -42, 9, -12, -37, -28, 17, 14, -19, 35, -39, 23, -3, -14, -1, -57, -5, 94, -9, 3, --39, 5, 30, -10, -32, 42, -13, -14, --97, -63, 30, -9, 1, -7, 12, 5, -20, 17, -9, -36, -30, 25, 47, -9, --15, 12, -22, 98, -8, -50, 15, -27, -21, -16, -11, 2, 12, -10, 10, -3, -33, 36, -96, 0, -17, 31, -9, 9, -3, -20, 13, -11, 8, -4, 10, -10, -9, 1, 112, -70, -27, 5, -21, 2, --57, -3, -29, 10, 19, -21, 21, -10, --66, -3, 91, -35, 30, -12, 0, -7, -59, -28, 26, 2, 14, -18, 1, 1, -11, 17, 20, -54, -59, 27, 4, 29, -32, 5, 19, 12, -4, 1, 7, -10, -5, -2, 10, 0, 23, -5, 28, -104, -46, 11, 16, 3, 29, 1, -8, -14, -1, 7, -50, 88, -62, 26, 8, -17, --14, 50, 0, 32, -12, -3, -27, 18, --8, -5, 8, 3, -20, -11, 37, -12, -9, 33, 46, -101, -1, -4, 1, 6, --1, 28, -42, -15, 16, 5, -1, -2, --55, 85, 38, -9, -4, 11, -2, -9, --6, 3, -20, -10, -77, 89, 24, -3, --104, -57, -26, -31, -20, -6, -9, 14, -20, -23, 46, -15, -31, 28, 1, -15, --2, 6, -2, 31, 45, -76, 23, -25, -}; diff --git a/src/lib/dl/ext/speex/high_lsp_tables.c b/src/lib/dl/ext/speex/high_lsp_tables.c deleted file mode 100755 index e82e8755..00000000 --- a/src/lib/dl/ext/speex/high_lsp_tables.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: high_lsp_tables.c - Codebooks for high-band LSPs in SB-CELP mode - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -const signed char high_lsp_cdbk[512]={ -39,12,-14,-20,-29,-61,-67,-76, --32,-71,-67,68,77,46,34,5, --13,-48,-46,-72,-81,-84,-60,-58, --40,-28,82,93,68,45,29,3, --19,-47,-28,-43,-35,-30,-8,-13, --39,-91,-91,-123,-96,10,10,-6, --18,-55,-60,-91,-56,-36,-27,-16, --48,-75,40,28,-10,-28,35,9, -37,19,1,-20,-31,-41,-18,-25, --35,-68,-80,45,27,-1,47,13, -0,-29,-35,-57,-50,-79,-73,-38, --19,5,35,14,-10,-23,16,-8, -5,-24,-40,-62,-23,-27,-22,-16, --18,-46,-72,-77,43,21,33,1, --80,-70,-70,-64,-56,-52,-39,-33, --31,-38,-19,-19,-15,32,33,-2, -7,-15,-15,-24,-23,-33,-41,-56, --24,-57,5,89,64,41,27,5, --9,-47,-60,-97,-97,-124,-20,-9, --44,-73,31,29,-4,64,48,7, --35,-57,0,-3,-26,-47,-3,-6, --40,-76,-79,-48,12,81,55,10, -9,-24,-43,-73,-57,-69,16,5, --28,-53,18,29,20,0,-4,-11, -6,-13,23,7,-17,-35,-37,-37, --30,-68,-63,6,24,-9,-14,3, -21,-13,-27,-57,-49,-80,-24,-41, --5,-16,-5,1,45,25,12,-7, -3,-15,-6,-16,-15,-8,6,-13, --42,-81,-80,-87,14,1,-10,-3, --43,-69,-46,-24,-28,-29,36,6, --43,-56,-12,12,54,79,43,9, -54,22,2,8,-12,-43,-46,-52, --38,-69,-89,-5,75,38,33,5, --13,-53,-62,-87,-89,-113,-99,-55, --34,-37,62,55,33,16,21,-2, --17,-46,-29,-38,-38,-48,-39,-42, --36,-75,-72,-88,-48,-30,21,2, --15,-57,-64,-98,-84,-76,25,1, --46,-80,-12,18,-7,3,34,6, -38,31,23,4,-1,20,14,-15, --43,-78,-91,-24,14,-3,54,16, -0,-27,-28,-44,-56,-83,-92,-89, --3,34,56,41,36,22,20,-8, --7,-35,-42,-62,-49,3,12,-10, --50,-87,-96,-66,92,70,38,9, --70,-71,-62,-42,-39,-43,-11,-7, --50,-79,-58,-50,-31,32,31,-6, --4,-25,7,-17,-38,-70,-58,-27, --43,-83,-28,59,36,20,31,2, --27,-71,-80,-109,-98,-75,-33,-32, --31,-2,33,15,-6,43,33,-5, -0,-22,-10,-27,-34,-49,-11,-20, --41,-91,-100,-121,-39,57,41,10, --19,-50,-38,-59,-60,-70,-18,-20, --8,-31,-8,-15,1,-14,-26,-25, -33,21,32,17,1,-19,-19,-26, --58,-81,-35,-22,45,30,11,-11, -3,-26,-48,-87,-67,-83,-58,3, --1,-26,-20,44,10,25,39,5, --9,-35,-27,-38,7,10,4,-9, --42,-85,-102,-127,52,44,28,10, --47,-61,-40,-39,-17,-1,-10,-33, --42,-74,-48,21,-4,70,52,10}; - - -const signed char high_lsp_cdbk2[512]={ --36,-62,6,-9,-10,-14,-56,23, -1,-26,23,-48,-17,12,8,-7, -23,29,-36,-28,-6,-29,-17,-5, -40,23,10,10,-46,-13,36,6, -4,-30,-29,62,32,-32,-1,22, --14,1,-4,-22,-45,2,54,4, --30,-57,-59,-12,27,-3,-31,8, --9,5,10,-14,32,66,19,9, -2,-25,-37,23,-15,18,-38,-31, -5,-9,-21,15,0,22,62,30, -15,-12,-14,-46,77,21,33,3, -34,29,-19,50,2,11,9,-38, --12,-37,62,1,-15,54,32,6, -2,-24,20,35,-21,2,19,24, --13,55,4,9,39,-19,30,-1, --21,73,54,33,8,18,3,15, -6,-19,-47,6,-3,-48,-50,1, -26,20,8,-23,-50,65,-14,-55, --17,-31,-37,-28,53,-1,-17,-53, -1,57,11,-8,-25,-30,-37,64, -5,-52,-45,15,23,31,15,14, --25,24,33,-2,-44,-56,-18,6, --21,-43,4,-12,17,-37,20,-10, -34,15,2,15,55,21,-11,-31, --6,46,25,16,-9,-25,-8,-62, -28,17,20,-32,-29,26,30,25, --19,2,-16,-17,26,-51,2,50, -42,19,-66,23,29,-2,3,19, --19,-37,32,15,6,30,-34,13, -11,-5,40,31,10,-42,4,-9, -26,-9,-70,17,-2,-23,20,-22, --55,51,-24,-31,22,-22,15,-13, -3,-10,-28,-16,56,4,-63,11, --18,-15,-18,-38,-35,16,-7,34, --1,-21,-49,-47,9,-37,7,8, -69,55,20,6,-33,-45,-10,-9, -6,-9,12,71,15,-3,-42,-7, --24,32,-35,-2,-42,-17,-5,0, --2,-33,-54,13,-12,-34,47,23, -19,55,7,-8,74,31,14,16, --23,-26,19,12,-18,-49,-28,-31, --20,2,-14,-20,-47,78,40,13, --23,-11,21,-6,18,1,47,5, -38,35,32,46,22,8,13,16, --14,18,51,19,40,39,11,-26, --1,-17,47,2,-53,-15,31,-22, -38,21,-15,-16,5,-33,53,15, --38,86,11,-3,-24,49,13,-4, --11,-18,28,20,-12,-27,-26,35, --25,-35,-3,-20,-61,30,10,-55, --12,-22,-52,-54,-14,19,-32,-12, -45,15,-8,-48,-9,11,-32,8, --16,-34,-13,51,18,38,-2,-32, --17,22,-2,-18,-28,-70,59,27, --28,-19,-10,-20,-9,-9,-8,-21, -21,-8,35,-2,45,-3,-9,12, -0,30,7,-39,43,27,-38,-91, -30,26,19,-55,-4,63,14,-17, -13,9,13,2,7,4,6,61, -72,-1,-17,29,-1,-22,-17,8, --28,-37,63,44,41,3,2,14, -9,-6,75,-8,-7,-12,-15,-12, -13,9,-4,30,-22,-65,15,0, --45,4,-4,1,5,22,11,23}; diff --git a/src/lib/dl/ext/speex/jitter.c b/src/lib/dl/ext/speex/jitter.c deleted file mode 100755 index 17bd044f..00000000 --- a/src/lib/dl/ext/speex/jitter.c +++ /dev/null @@ -1,843 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: speex_jitter.h - - Adaptive jitter buffer for Speex - - 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. - -*/ - -/* -TODO: -- Add short-term estimate -- Defensive programming - + warn when last returned < last desired (begative buffering) - + warn if update_delay not called between get() and tick() or is called twice in a row -- Linked list structure for holding the packets instead of the current fixed-size array - + return memory to a pool - + allow pre-allocation of the pool - + optional max number of elements -- Statistics - + drift - + loss - + late - + jitter - + buffering delay -*/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - - -#include "arch.h" -#include <speex/speex.h> -#include <speex/speex_bits.h> -#include <speex/speex_jitter.h> -#include "os_support.h" - -#ifndef NULL -#define NULL 0 -#endif - -#define SPEEX_JITTER_MAX_BUFFER_SIZE 200 /**< Maximum number of packets in jitter buffer */ - -#define TSUB(a,b) ((spx_int32_t)((a)-(b))) - -#define GT32(a,b) (((spx_int32_t)((a)-(b)))>0) -#define GE32(a,b) (((spx_int32_t)((a)-(b)))>=0) -#define LT32(a,b) (((spx_int32_t)((a)-(b)))<0) -#define LE32(a,b) (((spx_int32_t)((a)-(b)))<=0) - -#define ROUND_DOWN(x, step) ((x)<0 ? ((x)-(step)+1)/(step)*(step) : (x)/(step)*(step)) - -#define MAX_TIMINGS 40 -#define MAX_BUFFERS 3 -#define TOP_DELAY 40 - -/** Buffer that keeps the time of arrival of the latest packets */ -struct TimingBuffer { - int filled; /**< Number of entries occupied in "timing" and "counts"*/ - int curr_count; /**< Number of packet timings we got (including those we discarded) */ - spx_int32_t timing[MAX_TIMINGS]; /**< Sorted list of all timings ("latest" packets first) */ - spx_int16_t counts[MAX_TIMINGS]; /**< Order the packets were put in (will be used for short-term estimate) */ -}; - -static void tb_init(struct TimingBuffer *tb) -{ - tb->filled = 0; - tb->curr_count = 0; -} - -/* Add the timing of a new packet to the TimingBuffer */ -static void tb_add(struct TimingBuffer *tb, spx_int16_t timing) -{ - int pos; - /* Discard packet that won't make it into the list because they're too early */ - if (tb->filled >= MAX_TIMINGS && timing >= tb->timing[tb->filled-1]) - { - tb->curr_count++; - return; - } - - /* Find where the timing info goes in the sorted list */ - pos = 0; - /* FIXME: Do bisection instead of linear search */ - while (pos<tb->filled && timing >= tb->timing[pos]) - { - pos++; - } - - speex_assert(pos <= tb->filled && pos < MAX_TIMINGS); - - /* Shift everything so we can perform the insertion */ - if (pos < tb->filled) - { - int move_size = tb->filled-pos; - if (tb->filled == MAX_TIMINGS) - move_size -= 1; - SPEEX_MOVE(&tb->timing[pos+1], &tb->timing[pos], move_size); - SPEEX_MOVE(&tb->counts[pos+1], &tb->counts[pos], move_size); - } - /* Insert */ - tb->timing[pos] = timing; - tb->counts[pos] = tb->curr_count; - - tb->curr_count++; - if (tb->filled<MAX_TIMINGS) - tb->filled++; -} - - - -/** Jitter buffer structure */ -struct JitterBuffer_ { - spx_uint32_t pointer_timestamp; /**< Timestamp of what we will *get* next */ - spx_uint32_t last_returned_timestamp; /**< Useful for getting the next packet with the same timestamp (for fragmented media) */ - spx_uint32_t next_stop; /**< Estimated time the next get() will be called */ - - spx_int32_t buffered; /**< Amount of data we think is still buffered by the application (timestamp units)*/ - - JitterBufferPacket packets[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packets stored in the buffer */ - spx_uint32_t arrival[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packet arrival time (0 means it was late, even though it's a valid timestamp) */ - - void (*destroy) (void *); /**< Callback for destroying a packet */ - - spx_int32_t delay_step; /**< Size of the steps when adjusting buffering (timestamp units) */ - spx_int32_t concealment_size; /**< Size of the packet loss concealment "units" */ - int reset_state; /**< True if state was just reset */ - int buffer_margin; /**< How many frames we want to keep in the buffer (lower bound) */ - int late_cutoff; /**< How late must a packet be for it not to be considered at all */ - int interp_requested; /**< An interpolation is requested by speex_jitter_update_delay() */ - int auto_adjust; /**< Whether to automatically adjust the delay at any time */ - - struct TimingBuffer _tb[MAX_BUFFERS]; /**< Don't use those directly */ - struct TimingBuffer *timeBuffers[MAX_BUFFERS]; /**< Storing arrival time of latest frames so we can compute some stats */ - int window_size; /**< Total window over which the late frames are counted */ - int subwindow_size; /**< Sub-window size for faster computation */ - int max_late_rate; /**< Absolute maximum amount of late packets tolerable (in percent) */ - int latency_tradeoff; /**< Latency equivalent of losing one percent of packets */ - int auto_tradeoff; /**< Latency equivalent of losing one percent of packets (automatic default) */ - - int lost_count; /**< Number of consecutive lost packets */ -}; - -/** Based on available data, this computes the optimal delay for the jitter buffer. - The optimised function is in timestamp units and is: - cost = delay + late_factor*[number of frames that would be late if we used that delay] - @param tb Array of buffers - @param late_factor Equivalent cost of a late frame (in timestamp units) - */ -static spx_int16_t compute_opt_delay(JitterBuffer *jitter) -{ - int i; - spx_int16_t opt=0; - spx_int32_t best_cost=0x7fffffff; - int late = 0; - int pos[MAX_BUFFERS]; - int tot_count; - float late_factor; - int penalty_taken = 0; - int best = 0; - int worst = 0; - spx_int32_t deltaT; - struct TimingBuffer *tb; - - tb = jitter->_tb; - - /* Number of packet timings we have received (including those we didn't keep) */ - tot_count = 0; - for (i=0;i<MAX_BUFFERS;i++) - tot_count += tb[i].curr_count; - if (tot_count==0) - return 0; - - /* Compute cost for one lost packet */ - if (jitter->latency_tradeoff != 0) - late_factor = jitter->latency_tradeoff * 100.0f / tot_count; - else - late_factor = jitter->auto_tradeoff * jitter->window_size/tot_count; - - /*fprintf(stderr, "late_factor = %f\n", late_factor);*/ - for (i=0;i<MAX_BUFFERS;i++) - pos[i] = 0; - - /* Pick the TOP_DELAY "latest" packets (doesn't need to actually be late - for the current settings) */ - for (i=0;i<TOP_DELAY;i++) - { - int j; - int next=-1; - int latest = 32767; - /* Pick latest amoung all sub-windows */ - for (j=0;j<MAX_BUFFERS;j++) - { - if (pos[j] < tb[j].filled && tb[j].timing[pos[j]] < latest) - { - next = j; - latest = tb[j].timing[pos[j]]; - } - } - if (next != -1) - { - spx_int32_t cost; - - if (i==0) - worst = latest; - best = latest; - latest = ROUND_DOWN(latest, jitter->delay_step); - pos[next]++; - - /* Actual cost function that tells us how bad using this delay would be */ - cost = -latest + late_factor*late; - /*fprintf(stderr, "cost %d = %d + %f * %d\n", cost, -latest, late_factor, late);*/ - if (cost < best_cost) - { - best_cost = cost; - opt = latest; - } - } else { - break; - } - - /* For the next timing we will consider, there will be one more late packet to count */ - late++; - /* Two-frame penalty if we're going to increase the amount of late frames (hysteresis) */ - if (latest >= 0 && !penalty_taken) - { - penalty_taken = 1; - late+=4; - } - } - - deltaT = best-worst; - /* This is a default "automatic latency tradeoff" when none is provided */ - jitter->auto_tradeoff = 1 + deltaT/TOP_DELAY; - /*fprintf(stderr, "auto_tradeoff = %d (%d %d %d)\n", jitter->auto_tradeoff, best, worst, i);*/ - - /* FIXME: Compute a short-term estimate too and combine with the long-term one */ - - /* Prevents reducing the buffer size when we haven't really had much data */ - if (tot_count < TOP_DELAY && opt > 0) - return 0; - return opt; -} - - -/** Initialise jitter buffer */ -EXPORT JitterBuffer *jitter_buffer_init(int step_size) -{ - JitterBuffer *jitter = (JitterBuffer*)speex_alloc(sizeof(JitterBuffer)); - if (jitter) - { - int i; - spx_int32_t tmp; - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - jitter->packets[i].data=NULL; - jitter->delay_step = step_size; - jitter->concealment_size = step_size; - /*FIXME: Should this be 0 or 1?*/ - jitter->buffer_margin = 0; - jitter->late_cutoff = 50; - jitter->destroy = NULL; - jitter->latency_tradeoff = 0; - jitter->auto_adjust = 1; - tmp = 4; - jitter_buffer_ctl(jitter, JITTER_BUFFER_SET_MAX_LATE_RATE, &tmp); - jitter_buffer_reset(jitter); - } - return jitter; -} - -/** Reset jitter buffer */ -EXPORT void jitter_buffer_reset(JitterBuffer *jitter) -{ - int i; - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data) - { - if (jitter->destroy) - jitter->destroy(jitter->packets[i].data); - else - speex_free(jitter->packets[i].data); - jitter->packets[i].data = NULL; - } - } - /* Timestamp is actually undefined at this point */ - jitter->pointer_timestamp = 0; - jitter->next_stop = 0; - jitter->reset_state = 1; - jitter->lost_count = 0; - jitter->buffered = 0; - jitter->auto_tradeoff = 32000; - - for (i=0;i<MAX_BUFFERS;i++) - { - tb_init(&jitter->_tb[i]); - jitter->timeBuffers[i] = &jitter->_tb[i]; - } - /*fprintf (stderr, "reset\n");*/ -} - -/** Destroy jitter buffer */ -EXPORT void jitter_buffer_destroy(JitterBuffer *jitter) -{ - jitter_buffer_reset(jitter); - speex_free(jitter); -} - -/** Take the following timing into consideration for future calculations */ -static void update_timings(JitterBuffer *jitter, spx_int32_t timing) -{ - if (timing < -32767) - timing = -32767; - if (timing > 32767) - timing = 32767; - /* If the current sub-window is full, perform a rotation and discard oldest sub-widow */ - if (jitter->timeBuffers[0]->curr_count >= jitter->subwindow_size) - { - int i; - /*fprintf(stderr, "Rotate buffer\n");*/ - struct TimingBuffer *tmp = jitter->timeBuffers[MAX_BUFFERS-1]; - for (i=MAX_BUFFERS-1;i>=1;i--) - jitter->timeBuffers[i] = jitter->timeBuffers[i-1]; - jitter->timeBuffers[0] = tmp; - tb_init(jitter->timeBuffers[0]); - } - tb_add(jitter->timeBuffers[0], timing); -} - -/** Compensate all timings when we do an adjustment of the buffering */ -static void shift_timings(JitterBuffer *jitter, spx_int16_t amount) -{ - int i, j; - for (i=0;i<MAX_BUFFERS;i++) - { - for (j=0;j<jitter->timeBuffers[i]->filled;j++) - jitter->timeBuffers[i]->timing[j] += amount; - } -} - - -/** Put one packet into the jitter buffer */ -EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet) -{ - int i,j; - int late; - /*fprintf (stderr, "put packet %d %d\n", timestamp, span);*/ - - /* Cleanup buffer (remove old packets that weren't played) */ - if (!jitter->reset_state) - { - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - /* Make sure we don't discard a "just-late" packet in case we want to play it next (if we interpolate). */ - if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp + jitter->packets[i].span, jitter->pointer_timestamp)) - { - /*fprintf (stderr, "cleaned (not played)\n");*/ - if (jitter->destroy) - jitter->destroy(jitter->packets[i].data); - else - speex_free(jitter->packets[i].data); - jitter->packets[i].data = NULL; - } - } - } - - /*fprintf(stderr, "arrival: %d %d %d\n", packet->timestamp, jitter->next_stop, jitter->pointer_timestamp);*/ - /* Check if packet is late (could still be useful though) */ - if (!jitter->reset_state && LT32(packet->timestamp, jitter->next_stop)) - { - update_timings(jitter, ((spx_int32_t)packet->timestamp) - ((spx_int32_t)jitter->next_stop) - jitter->buffer_margin); - late = 1; - } else { - late = 0; - } - - /* For some reason, the consumer has failed the last 20 fetches. Make sure this packet is - * used to resync. */ - if (jitter->lost_count>20) - { - jitter_buffer_reset(jitter); - } - - /* Only insert the packet if it's not hopelessly late (i.e. totally useless) */ - if (jitter->reset_state || GE32(packet->timestamp+packet->span+jitter->delay_step, jitter->pointer_timestamp)) - { - - /*Find an empty slot in the buffer*/ - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data==NULL) - break; - } - - /*No place left in the buffer, need to make room for it by discarding the oldest packet */ - if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) - { - int earliest=jitter->packets[0].timestamp; - i=0; - for (j=1;j<SPEEX_JITTER_MAX_BUFFER_SIZE;j++) - { - if (!jitter->packets[i].data || LT32(jitter->packets[j].timestamp,earliest)) - { - earliest = jitter->packets[j].timestamp; - i=j; - } - } - if (jitter->destroy) - jitter->destroy(jitter->packets[i].data); - else - speex_free(jitter->packets[i].data); - jitter->packets[i].data=NULL; - /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/ - } - - /* Copy packet in buffer */ - if (jitter->destroy) - { - jitter->packets[i].data = packet->data; - } else { - jitter->packets[i].data=(char*)speex_alloc(packet->len); - for (j=0;j<packet->len;j++) - jitter->packets[i].data[j]=packet->data[j]; - } - jitter->packets[i].timestamp=packet->timestamp; - jitter->packets[i].span=packet->span; - jitter->packets[i].len=packet->len; - jitter->packets[i].sequence=packet->sequence; - jitter->packets[i].user_data=packet->user_data; - if (jitter->reset_state || late) - jitter->arrival[i] = 0; - else - jitter->arrival[i] = jitter->next_stop; - } - - -} - -/** Get one packet from the jitter buffer */ -EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset) -{ - int i; - unsigned int j; - int incomplete = 0; - spx_int16_t opt; - - if (start_offset != NULL) - *start_offset = 0; - - /* Syncing on the first call */ - if (jitter->reset_state) - { - int found = 0; - /* Find the oldest packet */ - spx_uint32_t oldest=0; - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data && (!found || LT32(jitter->packets[i].timestamp,oldest))) - { - oldest = jitter->packets[i].timestamp; - found = 1; - } - } - if (found) - { - jitter->reset_state=0; - jitter->pointer_timestamp = oldest; - jitter->next_stop = oldest; - } else { - packet->timestamp = 0; - packet->span = jitter->interp_requested; - return JITTER_BUFFER_MISSING; - } - } - - - jitter->last_returned_timestamp = jitter->pointer_timestamp; - - if (jitter->interp_requested != 0) - { - packet->timestamp = jitter->pointer_timestamp; - packet->span = jitter->interp_requested; - - /* Increment the pointer because it got decremented in the delay update */ - jitter->pointer_timestamp += jitter->interp_requested; - packet->len = 0; - /*fprintf (stderr, "Deferred interpolate\n");*/ - - jitter->interp_requested = 0; - - jitter->buffered = packet->span - desired_span; - - return JITTER_BUFFER_INSERTION; - } - - /* Searching for the packet that fits best */ - - /* Search the buffer for a packet with the right timestamp and spanning the whole current chunk */ - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data && jitter->packets[i].timestamp==jitter->pointer_timestamp && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span)) - break; - } - - /* If no match, try for an "older" packet that still spans (fully) the current chunk */ - if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) - { - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp, jitter->pointer_timestamp) && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span)) - break; - } - } - - /* If still no match, try for an "older" packet that spans part of the current chunk */ - if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) - { - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data && LE32(jitter->packets[i].timestamp, jitter->pointer_timestamp) && GT32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp)) - break; - } - } - - /* If still no match, try for earliest packet possible */ - if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) - { - int found = 0; - spx_uint32_t best_time=0; - int best_span=0; - int besti=0; - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - /* check if packet starts within current chunk */ - if (jitter->packets[i].data && LT32(jitter->packets[i].timestamp,jitter->pointer_timestamp+desired_span) && GE32(jitter->packets[i].timestamp,jitter->pointer_timestamp)) - { - if (!found || LT32(jitter->packets[i].timestamp,best_time) || (jitter->packets[i].timestamp==best_time && GT32(jitter->packets[i].span,best_span))) - { - best_time = jitter->packets[i].timestamp; - best_span = jitter->packets[i].span; - besti = i; - found = 1; - } - } - } - if (found) - { - i=besti; - incomplete = 1; - /*fprintf (stderr, "incomplete: %d %d %d %d\n", jitter->packets[i].timestamp, jitter->pointer_timestamp, chunk_size, jitter->packets[i].span);*/ - } - } - - /* If we find something */ - if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE) - { - spx_int32_t offset; - - /* We (obviously) haven't lost this packet */ - jitter->lost_count = 0; - - /* In this case, 0 isn't as a valid timestamp */ - if (jitter->arrival[i] != 0) - { - update_timings(jitter, ((spx_int32_t)jitter->packets[i].timestamp) - ((spx_int32_t)jitter->arrival[i]) - jitter->buffer_margin); - } - - - /* Copy packet */ - if (jitter->destroy) - { - packet->data = jitter->packets[i].data; - packet->len = jitter->packets[i].len; - } else { - if (jitter->packets[i].len > packet->len) - { - speex_warning_int("jitter_buffer_get(): packet too large to fit. Size is", jitter->packets[i].len); - } else { - packet->len = jitter->packets[i].len; - } - for (j=0;j<packet->len;j++) - packet->data[j] = jitter->packets[i].data[j]; - /* Remove packet */ - speex_free(jitter->packets[i].data); - } - jitter->packets[i].data = NULL; - /* Set timestamp and span (if requested) */ - offset = (spx_int32_t)jitter->packets[i].timestamp-(spx_int32_t)jitter->pointer_timestamp; - if (start_offset != NULL) - *start_offset = offset; - else if (offset != 0) - speex_warning_int("jitter_buffer_get() discarding non-zero start_offset", offset); - - packet->timestamp = jitter->packets[i].timestamp; - jitter->last_returned_timestamp = packet->timestamp; - - packet->span = jitter->packets[i].span; - packet->sequence = jitter->packets[i].sequence; - packet->user_data = jitter->packets[i].user_data; - /* Point to the end of the current packet */ - jitter->pointer_timestamp = jitter->packets[i].timestamp+jitter->packets[i].span; - - jitter->buffered = packet->span - desired_span; - - if (start_offset != NULL) - jitter->buffered += *start_offset; - - return JITTER_BUFFER_OK; - } - - - /* If we haven't found anything worth returning */ - - /*fprintf (stderr, "not found\n");*/ - jitter->lost_count++; - /*fprintf (stderr, "m");*/ - /*fprintf (stderr, "lost_count = %d\n", jitter->lost_count);*/ - - opt = compute_opt_delay(jitter); - - /* Should we force an increase in the buffer or just do normal interpolation? */ - if (opt < 0) - { - /* Need to increase buffering */ - - /* Shift histogram to compensate */ - shift_timings(jitter, -opt); - - packet->timestamp = jitter->pointer_timestamp; - packet->span = -opt; - /* Don't move the pointer_timestamp forward */ - packet->len = 0; - - jitter->buffered = packet->span - desired_span; - return JITTER_BUFFER_INSERTION; - /*jitter->pointer_timestamp -= jitter->delay_step;*/ - /*fprintf (stderr, "Forced to interpolate\n");*/ - } else { - /* Normal packet loss */ - packet->timestamp = jitter->pointer_timestamp; - - desired_span = ROUND_DOWN(desired_span, jitter->concealment_size); - packet->span = desired_span; - jitter->pointer_timestamp += desired_span; - packet->len = 0; - - jitter->buffered = packet->span - desired_span; - return JITTER_BUFFER_MISSING; - /*fprintf (stderr, "Normal loss\n");*/ - } - - -} - -EXPORT int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet) -{ - int i, j; - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data && jitter->packets[i].timestamp==jitter->last_returned_timestamp) - break; - } - if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE) - { - /* Copy packet */ - packet->len = jitter->packets[i].len; - if (jitter->destroy) - { - packet->data = jitter->packets[i].data; - } else { - for (j=0;j<packet->len;j++) - packet->data[j] = jitter->packets[i].data[j]; - /* Remove packet */ - speex_free(jitter->packets[i].data); - } - jitter->packets[i].data = NULL; - packet->timestamp = jitter->packets[i].timestamp; - packet->span = jitter->packets[i].span; - packet->sequence = jitter->packets[i].sequence; - packet->user_data = jitter->packets[i].user_data; - return JITTER_BUFFER_OK; - } else { - packet->data = NULL; - packet->len = 0; - packet->span = 0; - return JITTER_BUFFER_MISSING; - } -} - -/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */ -static int _jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset) -{ - spx_int16_t opt = compute_opt_delay(jitter); - /*fprintf(stderr, "opt adjustment is %d ", opt);*/ - - if (opt < 0) - { - shift_timings(jitter, -opt); - - jitter->pointer_timestamp += opt; - jitter->interp_requested = -opt; - /*fprintf (stderr, "Decision to interpolate %d samples\n", -opt);*/ - } else if (opt > 0) - { - shift_timings(jitter, -opt); - jitter->pointer_timestamp += opt; - /*fprintf (stderr, "Decision to drop %d samples\n", opt);*/ - } - - return opt; -} - -/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */ -EXPORT int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset) -{ - /* If the programmer calls jitter_buffer_update_delay() directly, - automatically disable auto-adjustment */ - jitter->auto_adjust = 0; - - return _jitter_buffer_update_delay(jitter, packet, start_offset); -} - -/** Get pointer timestamp of jitter buffer */ -EXPORT int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter) -{ - return jitter->pointer_timestamp; -} - -EXPORT void jitter_buffer_tick(JitterBuffer *jitter) -{ - /* Automatically-adjust the buffering delay if requested */ - if (jitter->auto_adjust) - _jitter_buffer_update_delay(jitter, NULL, NULL); - - if (jitter->buffered >= 0) - { - jitter->next_stop = jitter->pointer_timestamp - jitter->buffered; - } else { - jitter->next_stop = jitter->pointer_timestamp; - speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered); - } - jitter->buffered = 0; -} - -EXPORT void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem) -{ - /* Automatically-adjust the buffering delay if requested */ - if (jitter->auto_adjust) - _jitter_buffer_update_delay(jitter, NULL, NULL); - - if (jitter->buffered < 0) - speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered); - jitter->next_stop = jitter->pointer_timestamp - rem; -} - - -/* Used like the ioctl function to control the jitter buffer parameters */ -EXPORT int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr) -{ - int count, i; - switch(request) - { - case JITTER_BUFFER_SET_MARGIN: - jitter->buffer_margin = *(spx_int32_t*)ptr; - break; - case JITTER_BUFFER_GET_MARGIN: - *(spx_int32_t*)ptr = jitter->buffer_margin; - break; - case JITTER_BUFFER_GET_AVALIABLE_COUNT: - count = 0; - for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++) - { - if (jitter->packets[i].data && LE32(jitter->pointer_timestamp, jitter->packets[i].timestamp)) - { - count++; - } - } - *(spx_int32_t*)ptr = count; - break; - case JITTER_BUFFER_SET_DESTROY_CALLBACK: - jitter->destroy = (void (*) (void *))ptr; - break; - case JITTER_BUFFER_GET_DESTROY_CALLBACK: - *(void (**) (void *))ptr = jitter->destroy; - break; - case JITTER_BUFFER_SET_DELAY_STEP: - jitter->delay_step = *(spx_int32_t*)ptr; - break; - case JITTER_BUFFER_GET_DELAY_STEP: - *(spx_int32_t*)ptr = jitter->delay_step; - break; - case JITTER_BUFFER_SET_CONCEALMENT_SIZE: - jitter->concealment_size = *(spx_int32_t*)ptr; - break; - case JITTER_BUFFER_GET_CONCEALMENT_SIZE: - *(spx_int32_t*)ptr = jitter->concealment_size; - break; - case JITTER_BUFFER_SET_MAX_LATE_RATE: - jitter->max_late_rate = *(spx_int32_t*)ptr; - jitter->window_size = 100*TOP_DELAY/jitter->max_late_rate; - jitter->subwindow_size = jitter->window_size/MAX_BUFFERS; - break; - case JITTER_BUFFER_GET_MAX_LATE_RATE: - *(spx_int32_t*)ptr = jitter->max_late_rate; - break; - case JITTER_BUFFER_SET_LATE_COST: - jitter->latency_tradeoff = *(spx_int32_t*)ptr; - break; - case JITTER_BUFFER_GET_LATE_COST: - *(spx_int32_t*)ptr = jitter->latency_tradeoff; - break; - default: - speex_warning_int("Unknown jitter_buffer_ctl request: ", request); - return -1; - } - return 0; -} - diff --git a/src/lib/dl/ext/speex/kiss_fft.c b/src/lib/dl/ext/speex/kiss_fft.c deleted file mode 100755 index 67782810..00000000 --- a/src/lib/dl/ext/speex/kiss_fft.c +++ /dev/null @@ -1,523 +0,0 @@ -/* -Copyright (c) 2003-2004, Mark Borgerding -Copyright (c) 2005-2007, Jean-Marc Valin - -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. -*/ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "_kiss_fft_guts.h" -#include "arch.h" -#include "os_support.h" - -/* The guts header contains all the multiplication and addition macros that are defined for - fixed or floating point complex numbers. It also delares the kf_ internal functions. - */ - -static void kf_bfly2( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m, - int N, - int mm - ) -{ - kiss_fft_cpx * Fout2; - kiss_fft_cpx * tw1; - kiss_fft_cpx t; - if (!st->inverse) { - int i,j; - kiss_fft_cpx * Fout_beg = Fout; - for (i=0;i<N;i++) - { - Fout = Fout_beg + i*mm; - Fout2 = Fout + m; - tw1 = st->twiddles; - for(j=0;j<m;j++) - { - /* Almost the same as the code path below, except that we divide the input by two - (while keeping the best accuracy possible) */ - spx_word32_t tr, ti; - tr = SHR32(SUB32(MULT16_16(Fout2->r , tw1->r),MULT16_16(Fout2->i , tw1->i)), 1); - ti = SHR32(ADD32(MULT16_16(Fout2->i , tw1->r),MULT16_16(Fout2->r , tw1->i)), 1); - tw1 += fstride; - Fout2->r = PSHR32(SUB32(SHL32(EXTEND32(Fout->r), 14), tr), 15); - Fout2->i = PSHR32(SUB32(SHL32(EXTEND32(Fout->i), 14), ti), 15); - Fout->r = PSHR32(ADD32(SHL32(EXTEND32(Fout->r), 14), tr), 15); - Fout->i = PSHR32(ADD32(SHL32(EXTEND32(Fout->i), 14), ti), 15); - ++Fout2; - ++Fout; - } - } - } else { - int i,j; - kiss_fft_cpx * Fout_beg = Fout; - for (i=0;i<N;i++) - { - Fout = Fout_beg + i*mm; - Fout2 = Fout + m; - tw1 = st->twiddles; - for(j=0;j<m;j++) - { - C_MUL (t, *Fout2 , *tw1); - tw1 += fstride; - C_SUB( *Fout2 , *Fout , t ); - C_ADDTO( *Fout , t ); - ++Fout2; - ++Fout; - } - } - } -} - -static void kf_bfly4( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m, - int N, - int mm - ) -{ - kiss_fft_cpx *tw1,*tw2,*tw3; - kiss_fft_cpx scratch[6]; - const size_t m2=2*m; - const size_t m3=3*m; - int i, j; - - if (st->inverse) - { - kiss_fft_cpx * Fout_beg = Fout; - for (i=0;i<N;i++) - { - Fout = Fout_beg + i*mm; - tw3 = tw2 = tw1 = st->twiddles; - for (j=0;j<m;j++) - { - C_MUL(scratch[0],Fout[m] , *tw1 ); - C_MUL(scratch[1],Fout[m2] , *tw2 ); - C_MUL(scratch[2],Fout[m3] , *tw3 ); - - C_SUB( scratch[5] , *Fout, scratch[1] ); - C_ADDTO(*Fout, scratch[1]); - C_ADD( scratch[3] , scratch[0] , scratch[2] ); - C_SUB( scratch[4] , scratch[0] , scratch[2] ); - C_SUB( Fout[m2], *Fout, scratch[3] ); - tw1 += fstride; - tw2 += fstride*2; - tw3 += fstride*3; - C_ADDTO( *Fout , scratch[3] ); - - Fout[m].r = scratch[5].r - scratch[4].i; - Fout[m].i = scratch[5].i + scratch[4].r; - Fout[m3].r = scratch[5].r + scratch[4].i; - Fout[m3].i = scratch[5].i - scratch[4].r; - ++Fout; - } - } - } else - { - kiss_fft_cpx * Fout_beg = Fout; - for (i=0;i<N;i++) - { - Fout = Fout_beg + i*mm; - tw3 = tw2 = tw1 = st->twiddles; - for (j=0;j<m;j++) - { - C_MUL4(scratch[0],Fout[m] , *tw1 ); - C_MUL4(scratch[1],Fout[m2] , *tw2 ); - C_MUL4(scratch[2],Fout[m3] , *tw3 ); - - Fout->r = PSHR16(Fout->r, 2); - Fout->i = PSHR16(Fout->i, 2); - C_SUB( scratch[5] , *Fout, scratch[1] ); - C_ADDTO(*Fout, scratch[1]); - C_ADD( scratch[3] , scratch[0] , scratch[2] ); - C_SUB( scratch[4] , scratch[0] , scratch[2] ); - Fout[m2].r = PSHR16(Fout[m2].r, 2); - Fout[m2].i = PSHR16(Fout[m2].i, 2); - C_SUB( Fout[m2], *Fout, scratch[3] ); - tw1 += fstride; - tw2 += fstride*2; - tw3 += fstride*3; - C_ADDTO( *Fout , scratch[3] ); - - Fout[m].r = scratch[5].r + scratch[4].i; - Fout[m].i = scratch[5].i - scratch[4].r; - Fout[m3].r = scratch[5].r - scratch[4].i; - Fout[m3].i = scratch[5].i + scratch[4].r; - ++Fout; - } - } - } -} - -static void kf_bfly3( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - size_t m - ) -{ - size_t k=m; - const size_t m2 = 2*m; - kiss_fft_cpx *tw1,*tw2; - kiss_fft_cpx scratch[5]; - kiss_fft_cpx epi3; - epi3 = st->twiddles[fstride*m]; - - tw1=tw2=st->twiddles; - - do{ - if (!st->inverse) { - C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3); - } - - C_MUL(scratch[1],Fout[m] , *tw1); - C_MUL(scratch[2],Fout[m2] , *tw2); - - C_ADD(scratch[3],scratch[1],scratch[2]); - C_SUB(scratch[0],scratch[1],scratch[2]); - tw1 += fstride; - tw2 += fstride*2; - - Fout[m].r = Fout->r - HALF_OF(scratch[3].r); - Fout[m].i = Fout->i - HALF_OF(scratch[3].i); - - C_MULBYSCALAR( scratch[0] , epi3.i ); - - C_ADDTO(*Fout,scratch[3]); - - Fout[m2].r = Fout[m].r + scratch[0].i; - Fout[m2].i = Fout[m].i - scratch[0].r; - - Fout[m].r -= scratch[0].i; - Fout[m].i += scratch[0].r; - - ++Fout; - }while(--k); -} - -static void kf_bfly5( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m - ) -{ - kiss_fft_cpx *Fout0,*Fout1,*Fout2,*Fout3,*Fout4; - int u; - kiss_fft_cpx scratch[13]; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx *tw; - kiss_fft_cpx ya,yb; - ya = twiddles[fstride*m]; - yb = twiddles[fstride*2*m]; - - Fout0=Fout; - Fout1=Fout0+m; - Fout2=Fout0+2*m; - Fout3=Fout0+3*m; - Fout4=Fout0+4*m; - - tw=st->twiddles; - for ( u=0; u<m; ++u ) { - if (!st->inverse) { - C_FIXDIV( *Fout0,5); C_FIXDIV( *Fout1,5); C_FIXDIV( *Fout2,5); C_FIXDIV( *Fout3,5); C_FIXDIV( *Fout4,5); - } - scratch[0] = *Fout0; - - C_MUL(scratch[1] ,*Fout1, tw[u*fstride]); - C_MUL(scratch[2] ,*Fout2, tw[2*u*fstride]); - C_MUL(scratch[3] ,*Fout3, tw[3*u*fstride]); - C_MUL(scratch[4] ,*Fout4, tw[4*u*fstride]); - - C_ADD( scratch[7],scratch[1],scratch[4]); - C_SUB( scratch[10],scratch[1],scratch[4]); - C_ADD( scratch[8],scratch[2],scratch[3]); - C_SUB( scratch[9],scratch[2],scratch[3]); - - Fout0->r += scratch[7].r + scratch[8].r; - Fout0->i += scratch[7].i + scratch[8].i; - - scratch[5].r = scratch[0].r + S_MUL(scratch[7].r,ya.r) + S_MUL(scratch[8].r,yb.r); - scratch[5].i = scratch[0].i + S_MUL(scratch[7].i,ya.r) + S_MUL(scratch[8].i,yb.r); - - scratch[6].r = S_MUL(scratch[10].i,ya.i) + S_MUL(scratch[9].i,yb.i); - scratch[6].i = -S_MUL(scratch[10].r,ya.i) - S_MUL(scratch[9].r,yb.i); - - C_SUB(*Fout1,scratch[5],scratch[6]); - C_ADD(*Fout4,scratch[5],scratch[6]); - - scratch[11].r = scratch[0].r + S_MUL(scratch[7].r,yb.r) + S_MUL(scratch[8].r,ya.r); - scratch[11].i = scratch[0].i + S_MUL(scratch[7].i,yb.r) + S_MUL(scratch[8].i,ya.r); - scratch[12].r = - S_MUL(scratch[10].i,yb.i) + S_MUL(scratch[9].i,ya.i); - scratch[12].i = S_MUL(scratch[10].r,yb.i) - S_MUL(scratch[9].r,ya.i); - - C_ADD(*Fout2,scratch[11],scratch[12]); - C_SUB(*Fout3,scratch[11],scratch[12]); - - ++Fout0;++Fout1;++Fout2;++Fout3;++Fout4; - } -} - -/* perform the butterfly for one stage of a mixed radix FFT */ -static void kf_bfly_generic( - kiss_fft_cpx * Fout, - const size_t fstride, - const kiss_fft_cfg st, - int m, - int p - ) -{ - int u,k,q1,q; - kiss_fft_cpx * twiddles = st->twiddles; - kiss_fft_cpx t; - kiss_fft_cpx scratchbuf[17]; - int Norig = st->nfft; - - /*CHECKBUF(scratchbuf,nscratchbuf,p);*/ - if (p>17) - speex_fatal("KissFFT: max radix supported is 17"); - - for ( u=0; u<m; ++u ) { - k=u; - for ( q1=0 ; q1<p ; ++q1 ) { - scratchbuf[q1] = Fout[ k ]; - if (!st->inverse) { - C_FIXDIV(scratchbuf[q1],p); - } - k += m; - } - - k=u; - for ( q1=0 ; q1<p ; ++q1 ) { - int twidx=0; - Fout[ k ] = scratchbuf[0]; - for (q=1;q<p;++q ) { - twidx += fstride * k; - if (twidx>=Norig) twidx-=Norig; - C_MUL(t,scratchbuf[q] , twiddles[twidx] ); - C_ADDTO( Fout[ k ] ,t); - } - k += m; - } - } -} - -static -void kf_shuffle( - kiss_fft_cpx * Fout, - const kiss_fft_cpx * f, - const size_t fstride, - int in_stride, - int * factors, - const kiss_fft_cfg st - ) -{ - const int p=*factors++; /* the radix */ - const int m=*factors++; /* stage's fft length/p */ - - /*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/ - if (m==1) - { - int j; - for (j=0;j<p;j++) - { - Fout[j] = *f; - f += fstride*in_stride; - } - } else { - int j; - for (j=0;j<p;j++) - { - kf_shuffle( Fout , f, fstride*p, in_stride, factors,st); - f += fstride*in_stride; - Fout += m; - } - } -} - -static -void kf_work( - kiss_fft_cpx * Fout, - const kiss_fft_cpx * f, - const size_t fstride, - int in_stride, - int * factors, - const kiss_fft_cfg st, - int N, - int s2, - int m2 - ) -{ - int i; - kiss_fft_cpx * Fout_beg=Fout; - const int p=*factors++; /* the radix */ - const int m=*factors++; /* stage's fft length/p */ -#if 0 - /*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/ - if (m==1) - { - /* int j; - for (j=0;j<p;j++) - { - Fout[j] = *f; - f += fstride*in_stride; - }*/ - } else { - int j; - for (j=0;j<p;j++) - { - kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m); - f += fstride*in_stride; - Fout += m; - } - } - - Fout=Fout_beg; - - switch (p) { - case 2: kf_bfly2(Fout,fstride,st,m); break; - case 3: kf_bfly3(Fout,fstride,st,m); break; - case 4: kf_bfly4(Fout,fstride,st,m); break; - case 5: kf_bfly5(Fout,fstride,st,m); break; - default: kf_bfly_generic(Fout,fstride,st,m,p); break; - } -#else - /*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/ - if (m==1) - { - /*for (i=0;i<N;i++) - { - int j; - Fout = Fout_beg+i*m2; - const kiss_fft_cpx * f2 = f+i*s2; - for (j=0;j<p;j++) - { - *Fout++ = *f2; - f2 += fstride*in_stride; - } - }*/ - }else{ - kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m); - } - - - - - switch (p) { - case 2: kf_bfly2(Fout,fstride,st,m, N, m2); break; - case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break; - case 4: kf_bfly4(Fout,fstride,st,m, N, m2); break; - case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break; - default: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly_generic(Fout,fstride,st,m,p);} break; - } -#endif -} - -/* facbuf is populated by p1,m1,p2,m2, ... - where - p[i] * m[i] = m[i-1] - m0 = n */ -static -void kf_factor(int n,int * facbuf) -{ - int p=4; - - /*factor out powers of 4, powers of 2, then any remaining primes */ - do { - while (n % p) { - switch (p) { - case 4: p = 2; break; - case 2: p = 3; break; - default: p += 2; break; - } - if (p>32000 || (spx_int32_t)p*(spx_int32_t)p > n) - p = n; /* no more factors, skip to end */ - } - n /= p; - *facbuf++ = p; - *facbuf++ = n; - } while (n > 1); -} -/* - * - * User-callable function to allocate all necessary storage space for the fft. - * - * The return value is a contiguous block of memory, allocated with malloc. As such, - * It can be freed with free(), rather than a kiss_fft-specific function. - * */ -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem ) -{ - kiss_fft_cfg st=NULL; - size_t memneeded = sizeof(struct kiss_fft_state) - + sizeof(kiss_fft_cpx)*(nfft-1); /* twiddle factors*/ - - if ( lenmem==NULL ) { - st = ( kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); - }else{ - if (mem != NULL && *lenmem >= memneeded) - st = (kiss_fft_cfg)mem; - *lenmem = memneeded; - } - if (st) { - int i; - st->nfft=nfft; - st->inverse = inverse_fft; -#ifdef FIXED_POINT - for (i=0;i<nfft;++i) { - spx_word32_t phase = i; - if (!st->inverse) - phase = -phase; - kf_cexp2(st->twiddles+i, DIV32(SHL32(phase,17),nfft)); - } -#else - for (i=0;i<nfft;++i) { - const double pi=3.14159265358979323846264338327; - double phase = ( -2*pi /nfft ) * i; - if (st->inverse) - phase *= -1; - kf_cexp(st->twiddles+i, phase ); - } -#endif - kf_factor(nfft,st->factors); - } - return st; -} - - - - -void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride) -{ - if (fin == fout) - { - speex_fatal("In-place FFT not supported"); - /*CHECKBUF(tmpbuf,ntmpbuf,st->nfft); - kf_work(tmpbuf,fin,1,in_stride, st->factors,st); - SPEEX_MOVE(fout,tmpbuf,st->nfft);*/ - } else { - kf_shuffle( fout, fin, 1,in_stride, st->factors,st); - kf_work( fout, fin, 1,in_stride, st->factors,st, 1, in_stride, 1); - } -} - -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout) -{ - kiss_fft_stride(cfg,fin,fout,1); -} - diff --git a/src/lib/dl/ext/speex/kiss_fft.h b/src/lib/dl/ext/speex/kiss_fft.h deleted file mode 100755 index fa3f2c60..00000000 --- a/src/lib/dl/ext/speex/kiss_fft.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef KISS_FFT_H -#define KISS_FFT_H - -#include <stdlib.h> -#include <math.h> -#include "arch.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - ATTENTION! - If you would like a : - -- a utility that will handle the caching of fft objects - -- real-only (no imaginary time component ) FFT - -- a multi-dimensional FFT - -- a command-line utility to perform ffts - -- a command-line utility to perform fast-convolution filtering - - Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c - in the tools/ directory. -*/ - -#ifdef USE_SIMD -# include <xmmintrin.h> -# define kiss_fft_scalar __m128 -#define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes) -#else -#define KISS_FFT_MALLOC speex_alloc -#endif - - -#ifdef FIXED_POINT -#include "arch.h" -# define kiss_fft_scalar spx_int16_t -#else -# ifndef kiss_fft_scalar -/* default is float */ -# define kiss_fft_scalar float -# endif -#endif - -typedef struct { - kiss_fft_scalar r; - kiss_fft_scalar i; -}kiss_fft_cpx; - -typedef struct kiss_fft_state* kiss_fft_cfg; - -/* - * kiss_fft_alloc - * - * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. - * - * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); - * - * The return value from fft_alloc is a cfg buffer used internally - * by the fft routine or NULL. - * - * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. - * The returned value should be free()d when done to avoid memory leaks. - * - * The state can be placed in a user supplied buffer 'mem': - * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, - * then the function places the cfg in mem and the size used in *lenmem - * and returns mem. - * - * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), - * then the function returns NULL and places the minimum cfg - * buffer size in *lenmem. - * */ - -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); - -/* - * kiss_fft(cfg,in_out_buf) - * - * Perform an FFT on a complex input buffer. - * for a forward FFT, - * fin should be f[0] , f[1] , ... ,f[nfft-1] - * fout will be F[0] , F[1] , ... ,F[nfft-1] - * Note that each element is complex and can be accessed like - f[k].r and f[k].i - * */ -void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); - -/* - A more generic version of the above function. It reads its input from every Nth sample. - * */ -void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); - -/* If kiss_fft_alloc allocated a buffer, it is one contiguous - buffer and can be simply free()d when no longer needed*/ -#define kiss_fft_free speex_free - -/* - Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up - your compiler output to call this before you exit. -*/ -void kiss_fft_cleanup(void); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/speex/kiss_fftr.c b/src/lib/dl/ext/speex/kiss_fftr.c deleted file mode 100755 index f6275b87..00000000 --- a/src/lib/dl/ext/speex/kiss_fftr.c +++ /dev/null @@ -1,297 +0,0 @@ -/* -Copyright (c) 2003-2004, Mark Borgerding - -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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "os_support.h" -#include "kiss_fftr.h" -#include "_kiss_fft_guts.h" - -struct kiss_fftr_state{ - kiss_fft_cfg substate; - kiss_fft_cpx * tmpbuf; - kiss_fft_cpx * super_twiddles; -#ifdef USE_SIMD - long pad; -#endif -}; - -kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem) -{ - int i; - kiss_fftr_cfg st = NULL; - size_t subsize, memneeded; - - if (nfft & 1) { - speex_warning("Real FFT optimization must be even.\n"); - return NULL; - } - nfft >>= 1; - - kiss_fft_alloc (nfft, inverse_fft, NULL, &subsize); - memneeded = sizeof(struct kiss_fftr_state) + subsize + sizeof(kiss_fft_cpx) * ( nfft * 2); - - if (lenmem == NULL) { - st = (kiss_fftr_cfg) KISS_FFT_MALLOC (memneeded); - } else { - if (*lenmem >= memneeded) - st = (kiss_fftr_cfg) mem; - *lenmem = memneeded; - } - if (!st) - return NULL; - - st->substate = (kiss_fft_cfg) (st + 1); /*just beyond kiss_fftr_state struct */ - st->tmpbuf = (kiss_fft_cpx *) (((char *) st->substate) + subsize); - st->super_twiddles = st->tmpbuf + nfft; - kiss_fft_alloc(nfft, inverse_fft, st->substate, &subsize); - -#ifdef FIXED_POINT - for (i=0;i<nfft;++i) { - spx_word32_t phase = i+(nfft>>1); - if (!inverse_fft) - phase = -phase; - kf_cexp2(st->super_twiddles+i, DIV32(SHL32(phase,16),nfft)); - } -#else - for (i=0;i<nfft;++i) { - const double pi=3.14159265358979323846264338327; - double phase = pi*(((double)i) /nfft + .5); - if (!inverse_fft) - phase = -phase; - kf_cexp(st->super_twiddles+i, phase ); - } -#endif - return st; -} - -void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata) -{ - /* input buffer timedata is stored row-wise */ - int k,ncfft; - kiss_fft_cpx fpnk,fpk,f1k,f2k,tw,tdc; - - if ( st->substate->inverse) { - speex_fatal("kiss fft usage error: improper alloc\n"); - } - - ncfft = st->substate->nfft; - - /*perform the parallel fft of two real signals packed in real,imag*/ - kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf ); - /* The real part of the DC element of the frequency spectrum in st->tmpbuf - * contains the sum of the even-numbered elements of the input time sequence - * The imag part is the sum of the odd-numbered elements - * - * The sum of tdc.r and tdc.i is the sum of the input time sequence. - * yielding DC of input time sequence - * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... - * yielding Nyquist bin of input time sequence - */ - - tdc.r = st->tmpbuf[0].r; - tdc.i = st->tmpbuf[0].i; - C_FIXDIV(tdc,2); - CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i); - CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i); - freqdata[0].r = tdc.r + tdc.i; - freqdata[ncfft].r = tdc.r - tdc.i; -#ifdef USE_SIMD - freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0); -#else - freqdata[ncfft].i = freqdata[0].i = 0; -#endif - - for ( k=1;k <= ncfft/2 ; ++k ) { - fpk = st->tmpbuf[k]; - fpnk.r = st->tmpbuf[ncfft-k].r; - fpnk.i = - st->tmpbuf[ncfft-k].i; - C_FIXDIV(fpk,2); - C_FIXDIV(fpnk,2); - - C_ADD( f1k, fpk , fpnk ); - C_SUB( f2k, fpk , fpnk ); - C_MUL( tw , f2k , st->super_twiddles[k]); - - freqdata[k].r = HALF_OF(f1k.r + tw.r); - freqdata[k].i = HALF_OF(f1k.i + tw.i); - freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r); - freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i); - } -} - -void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata, kiss_fft_scalar *timedata) -{ - /* input buffer timedata is stored row-wise */ - int k, ncfft; - - if (st->substate->inverse == 0) { - speex_fatal("kiss fft usage error: improper alloc\n"); - } - - ncfft = st->substate->nfft; - - st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r; - st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r; - /*C_FIXDIV(st->tmpbuf[0],2);*/ - - for (k = 1; k <= ncfft / 2; ++k) { - kiss_fft_cpx fk, fnkc, fek, fok, tmp; - fk = freqdata[k]; - fnkc.r = freqdata[ncfft - k].r; - fnkc.i = -freqdata[ncfft - k].i; - /*C_FIXDIV( fk , 2 ); - C_FIXDIV( fnkc , 2 );*/ - - C_ADD (fek, fk, fnkc); - C_SUB (tmp, fk, fnkc); - C_MUL (fok, tmp, st->super_twiddles[k]); - C_ADD (st->tmpbuf[k], fek, fok); - C_SUB (st->tmpbuf[ncfft - k], fek, fok); -#ifdef USE_SIMD - st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0); -#else - st->tmpbuf[ncfft - k].i *= -1; -#endif - } - kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata); -} - -void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata) -{ - /* input buffer timedata is stored row-wise */ - int k,ncfft; - kiss_fft_cpx f2k,tdc; - spx_word32_t f1kr, f1ki, twr, twi; - - if ( st->substate->inverse) { - speex_fatal("kiss fft usage error: improper alloc\n"); - } - - ncfft = st->substate->nfft; - - /*perform the parallel fft of two real signals packed in real,imag*/ - kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf ); - /* The real part of the DC element of the frequency spectrum in st->tmpbuf - * contains the sum of the even-numbered elements of the input time sequence - * The imag part is the sum of the odd-numbered elements - * - * The sum of tdc.r and tdc.i is the sum of the input time sequence. - * yielding DC of input time sequence - * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... - * yielding Nyquist bin of input time sequence - */ - - tdc.r = st->tmpbuf[0].r; - tdc.i = st->tmpbuf[0].i; - C_FIXDIV(tdc,2); - CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i); - CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i); - freqdata[0] = tdc.r + tdc.i; - freqdata[2*ncfft-1] = tdc.r - tdc.i; - - for ( k=1;k <= ncfft/2 ; ++k ) - { - /*fpk = st->tmpbuf[k]; - fpnk.r = st->tmpbuf[ncfft-k].r; - fpnk.i = - st->tmpbuf[ncfft-k].i; - C_FIXDIV(fpk,2); - C_FIXDIV(fpnk,2); - - C_ADD( f1k, fpk , fpnk ); - C_SUB( f2k, fpk , fpnk ); - - C_MUL( tw , f2k , st->super_twiddles[k]); - - freqdata[2*k-1] = HALF_OF(f1k.r + tw.r); - freqdata[2*k] = HALF_OF(f1k.i + tw.i); - freqdata[2*(ncfft-k)-1] = HALF_OF(f1k.r - tw.r); - freqdata[2*(ncfft-k)] = HALF_OF(tw.i - f1k.i); - */ - - /*f1k.r = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1); - f1k.i = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1); - f2k.r = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1); - f2k.i = SHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1); - - C_MUL( tw , f2k , st->super_twiddles[k]); - - freqdata[2*k-1] = HALF_OF(f1k.r + tw.r); - freqdata[2*k] = HALF_OF(f1k.i + tw.i); - freqdata[2*(ncfft-k)-1] = HALF_OF(f1k.r - tw.r); - freqdata[2*(ncfft-k)] = HALF_OF(tw.i - f1k.i); - */ - f2k.r = SHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1); - f2k.i = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1); - - f1kr = SHL32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),13); - f1ki = SHL32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),13); - - twr = SHR32(SUB32(MULT16_16(f2k.r,st->super_twiddles[k].r),MULT16_16(f2k.i,st->super_twiddles[k].i)), 1); - twi = SHR32(ADD32(MULT16_16(f2k.i,st->super_twiddles[k].r),MULT16_16(f2k.r,st->super_twiddles[k].i)), 1); - -#ifdef FIXED_POINT - freqdata[2*k-1] = PSHR32(f1kr + twr, 15); - freqdata[2*k] = PSHR32(f1ki + twi, 15); - freqdata[2*(ncfft-k)-1] = PSHR32(f1kr - twr, 15); - freqdata[2*(ncfft-k)] = PSHR32(twi - f1ki, 15); -#else - freqdata[2*k-1] = .5f*(f1kr + twr); - freqdata[2*k] = .5f*(f1ki + twi); - freqdata[2*(ncfft-k)-1] = .5f*(f1kr - twr); - freqdata[2*(ncfft-k)] = .5f*(twi - f1ki); - -#endif - } -} - -void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scalar *timedata) -{ - /* input buffer timedata is stored row-wise */ - int k, ncfft; - - if (st->substate->inverse == 0) { - speex_fatal ("kiss fft usage error: improper alloc\n"); - } - - ncfft = st->substate->nfft; - - st->tmpbuf[0].r = freqdata[0] + freqdata[2*ncfft-1]; - st->tmpbuf[0].i = freqdata[0] - freqdata[2*ncfft-1]; - /*C_FIXDIV(st->tmpbuf[0],2);*/ - - for (k = 1; k <= ncfft / 2; ++k) { - kiss_fft_cpx fk, fnkc, fek, fok, tmp; - fk.r = freqdata[2*k-1]; - fk.i = freqdata[2*k]; - fnkc.r = freqdata[2*(ncfft - k)-1]; - fnkc.i = -freqdata[2*(ncfft - k)]; - /*C_FIXDIV( fk , 2 ); - C_FIXDIV( fnkc , 2 );*/ - - C_ADD (fek, fk, fnkc); - C_SUB (tmp, fk, fnkc); - C_MUL (fok, tmp, st->super_twiddles[k]); - C_ADD (st->tmpbuf[k], fek, fok); - C_SUB (st->tmpbuf[ncfft - k], fek, fok); -#ifdef USE_SIMD - st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0); -#else - st->tmpbuf[ncfft - k].i *= -1; -#endif - } - kiss_fft (st->substate, st->tmpbuf, (kiss_fft_cpx *) timedata); -} diff --git a/src/lib/dl/ext/speex/kiss_fftr.h b/src/lib/dl/ext/speex/kiss_fftr.h deleted file mode 100755 index 7bfb4233..00000000 --- a/src/lib/dl/ext/speex/kiss_fftr.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef KISS_FTR_H -#define KISS_FTR_H - -#include "kiss_fft.h" -#ifdef __cplusplus -extern "C" { -#endif - - -/* - - Real optimized version can save about 45% cpu time vs. complex fft of a real seq. - - - - */ - -typedef struct kiss_fftr_state *kiss_fftr_cfg; - - -kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem); -/* - nfft must be even - - If you don't care to allocate space, use mem = lenmem = NULL -*/ - - -void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); -/* - input timedata has nfft scalar points - output freqdata has nfft/2+1 complex points -*/ - -void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata); - -void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); - -void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata, kiss_fft_scalar *timedata); - -/* - input freqdata has nfft/2+1 complex points - output timedata has nfft scalar points -*/ - -#define kiss_fftr_free speex_free - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/lib/dl/ext/speex/lpc.c b/src/lib/dl/ext/speex/lpc.c deleted file mode 100755 index fd5d3821..00000000 --- a/src/lib/dl/ext/speex/lpc.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - 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 - - - Code modified by Jean-Marc Valin - - Speex License: - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "lpc.h" - -#ifdef BFIN_ASM -#include "lpc_bfin.h" -#endif - -/* LPC analysis - * - * The next two functions calculate linear prediction coefficients - * and/or the related reflection coefficients from the first P_MAX+1 - * values of the autocorrelation function. - */ - -/* Invented by N. Levinson in 1947, modified by J. Durbin in 1959. - */ - -/* returns minimum mean square error */ -spx_word32_t _spx_lpc( -spx_coef_t *lpc, /* out: [0...p-1] LPC coefficients */ -const spx_word16_t *ac, /* in: [0...p] autocorrelation values */ -int p -) -{ - int i, j; - spx_word16_t r; - spx_word16_t error = ac[0]; - - if (ac[0] == 0) - { - for (i = 0; i < p; i++) - lpc[i] = 0; - return 0; - } - - for (i = 0; i < p; i++) { - - /* Sum up this iteration's reflection coefficient */ - spx_word32_t rr = NEG32(SHL32(EXTEND32(ac[i + 1]),13)); - for (j = 0; j < i; j++) - rr = SUB32(rr,MULT16_16(lpc[j],ac[i - j])); -#ifdef FIXED_POINT - r = DIV32_16(rr+PSHR32(error,1),ADD16(error,8)); -#else - r = rr/(error+.003*ac[0]); -#endif - /* Update LPC coefficients and total error */ - lpc[i] = r; - for (j = 0; j < i>>1; j++) - { - spx_word16_t tmp = lpc[j]; - lpc[j] = MAC16_16_P13(lpc[j],r,lpc[i-1-j]); - lpc[i-1-j] = MAC16_16_P13(lpc[i-1-j],r,tmp); - } - if (i & 1) - lpc[j] = MAC16_16_P13(lpc[j],lpc[j],r); - - error = SUB16(error,MULT16_16_Q13(r,MULT16_16_Q13(error,r))); - } - return error; -} - - -#ifdef FIXED_POINT - -/* Compute the autocorrelation - * ,--, - * ac(i) = > x(n) * x(n-i) for all n - * `--' - * for lags between 0 and lag-1, and x == 0 outside 0...n-1 - */ - -#ifndef OVERRIDE_SPEEX_AUTOCORR -void _spx_autocorr( -const spx_word16_t *x, /* in: [0...n-1] samples x */ -spx_word16_t *ac, /* out: [0...lag-1] ac values */ -int lag, -int n -) -{ - spx_word32_t d; - int i, j; - spx_word32_t ac0=1; - int shift, ac_shift; - - for (j=0;j<n;j++) - ac0 = ADD32(ac0,SHR32(MULT16_16(x[j],x[j]),8)); - ac0 = ADD32(ac0,n); - shift = 8; - while (shift && ac0<0x40000000) - { - shift--; - ac0 <<= 1; - } - ac_shift = 18; - while (ac_shift && ac0<0x40000000) - { - ac_shift--; - ac0 <<= 1; - } - - - for (i=0;i<lag;i++) - { - d=0; - for (j=i;j<n;j++) - { - d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift)); - } - - ac[i] = SHR32(d, ac_shift); - } -} -#endif - - -#else - - - -/* Compute the autocorrelation - * ,--, - * ac(i) = > x(n) * x(n-i) for all n - * `--' - * for lags between 0 and lag-1, and x == 0 outside 0...n-1 - */ -void _spx_autocorr( -const spx_word16_t *x, /* in: [0...n-1] samples x */ -float *ac, /* out: [0...lag-1] ac values */ -int lag, -int n -) -{ - float d; - int i; - while (lag--) - { - for (i = lag, d = 0; i < n; i++) - d += x[i] * x[i-lag]; - ac[lag] = d; - } - ac[0] += 10; -} - -#endif - - diff --git a/src/lib/dl/ext/speex/lpc.h b/src/lib/dl/ext/speex/lpc.h deleted file mode 100755 index 952ecdd9..00000000 --- a/src/lib/dl/ext/speex/lpc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file lpc.h - @brief Functions for LPC (Linear Prediction Coefficients) analysis -*/ -/* - 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 LPC_H -#define LPC_H - -#include "arch.h" - -void _spx_autocorr( - const spx_word16_t * x, /* in: [0...n-1] samples x */ - spx_word16_t *ac, /* out: [0...lag-1] ac values */ - int lag, int n); - -spx_word32_t /* returns minimum mean square error */ -_spx_lpc( - spx_coef_t * lpc, /* [0...p-1] LPC coefficients */ - const spx_word16_t * ac, /* in: [0...p] autocorrelation values */ - int p - ); - - -#endif diff --git a/src/lib/dl/ext/speex/lpc_bfin.h b/src/lib/dl/ext/speex/lpc_bfin.h deleted file mode 100755 index 7310ffba..00000000 --- a/src/lib/dl/ext/speex/lpc_bfin.h +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright (C) 2005 Analog Devices */ -/** - @file lpc_bfin.h - @author Jean-Marc Valin - @brief Functions for LPC (Linear Prediction Coefficients) analysis (Blackfin version) -*/ -/* - 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. -*/ - -#define OVERRIDE_SPEEX_AUTOCORR -void _spx_autocorr( -const spx_word16_t *x, /* in: [0...n-1] samples x */ -spx_word16_t *ac, /* out: [0...lag-1] ac values */ -int lag, -int n - ) -{ - spx_word32_t d; - const spx_word16_t *xs; - int i, j; - spx_word32_t ac0=1; - spx_word32_t ac32[11], *ac32top; - int shift, ac_shift; - ac32top = ac32+lag-1; - int lag_1, N_lag; - int nshift; - lag_1 = lag-1; - N_lag = n-lag_1; - for (j=0;j<n;j++) - ac0 = ADD32(ac0,SHR32(MULT16_16(x[j],x[j]),8)); - ac0 = ADD32(ac0,n); - shift = 8; - while (shift && ac0<0x40000000) - { - shift--; - ac0 <<= 1; - } - ac_shift = 18; - while (ac_shift && ac0<0x40000000) - { - ac_shift--; - ac0 <<= 1; - } - - xs = x+lag-1; - nshift = -shift; - __asm__ __volatile__ - ( - "P2 = %0;\n\t" - "I0 = P2;\n\t" /* x in I0 */ - "B0 = P2;\n\t" /* x in B0 */ - "R0 = %3;\n\t" /* len in R0 */ - "P3 = %3;\n\t" /* len in R0 */ - "P4 = %4;\n\t" /* nb_pitch in R0 */ - "R1 = R0 << 1;\n\t" /* number of bytes in x */ - "L0 = R1;\n\t" - "P0 = %1;\n\t" - "P1 = %2;\n\t" - "B1 = P1;\n\t" - "R4 = %5;\n\t" - "L1 = 0;\n\t" /*Disable looping on I1*/ - - "r0 = [I0++];\n\t" - "R2 = 0;R3=0;" - "LOOP pitch%= LC0 = P4 >> 1;\n\t" - "LOOP_BEGIN pitch%=;\n\t" - "I1 = P0;\n\t" - "A1 = A0 = 0;\n\t" - "R1 = [I1++];\n\t" - "LOOP inner_prod%= LC1 = P3 >> 1;\n\t" - "LOOP_BEGIN inner_prod%=;\n\t" - "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t" - "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R1.H = W[I1++] || R0 = [I0++];\n\t" - "LOOP_END inner_prod%=;\n\t" - "A0 = ASHIFT A0 by R4.L;\n\t" - "A1 = ASHIFT A1 by R4.L;\n\t" - - "R2 = A0, R3 = A1;\n\t" - "[P1--] = R2;\n\t" - "[P1--] = R3;\n\t" - "P0 += 4;\n\t" - "LOOP_END pitch%=;\n\t" - : : "m" (xs), "m" (x), "m" (ac32top), "m" (N_lag), "m" (lag_1), "m" (nshift) - : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "R4", "I0", "I1", "L0", "L1", "B0", "B1", "memory" - ); - d=0; - for (j=0;j<n;j++) - { - d = ADD32(d,SHR32(MULT16_16(x[j],x[j]), shift)); - } - ac32[0] = d; - - for (i=0;i<lag;i++) - { - d=0; - for (j=i;j<lag_1;j++) - { - d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift)); - } - if (i) - ac32[i] += d; - ac[i] = SHR32(ac32[i], ac_shift); - } -} - diff --git a/src/lib/dl/ext/speex/lsp.c b/src/lib/dl/ext/speex/lsp.c deleted file mode 100755 index a73d8835..00000000 --- a/src/lib/dl/ext/speex/lsp.c +++ /dev/null @@ -1,656 +0,0 @@ -/*---------------------------------------------------------------------------*\ -Original copyright - FILE........: lsp.c - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - -Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point, - optimizations, additional functions, ...) - - This file contains functions for converting Linear Prediction - Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the - LSP coefficients are not in radians format but in the x domain of the - unit circle. - - Speex License: - - 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. -*/ - -/*---------------------------------------------------------------------------*\ - - Introduction to Line Spectrum Pairs (LSPs) - ------------------------------------------ - - LSPs are used to encode the LPC filter coefficients {ak} for - transmission over the channel. LSPs have several properties (like - less sensitivity to quantisation noise) that make them superior to - direct quantisation of {ak}. - - A(z) is a polynomial of order lpcrdr with {ak} as the coefficients. - - A(z) is transformed to P(z) and Q(z) (using a substitution and some - algebra), to obtain something like: - - A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)] (1) - - As you can imagine A(z) has complex zeros all over the z-plane. P(z) - and Q(z) have the very neat property of only having zeros _on_ the - unit circle. So to find them we take a test point z=exp(jw) and - evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0 - and pi. - - The zeros (roots) of P(z) also happen to alternate, which is why we - swap coefficients as we find roots. So the process of finding the - LSP frequencies is basically finding the roots of 5th order - polynomials. - - The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence - the name Line Spectrum Pairs (LSPs). - - To convert back to ak we just evaluate (1), "clocking" an impulse - thru it lpcrdr times gives us the impulse response of A(z) which is - {ak}. - -\*---------------------------------------------------------------------------*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include "lsp.h" -#include "stack_alloc.h" -#include "math_approx.h" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#ifdef FIXED_POINT - -#define FREQ_SCALE 16384 - -/*#define ANGLE2X(a) (32768*cos(((a)/8192.)))*/ -#define ANGLE2X(a) (SHL16(spx_cos(a),2)) - -/*#define X2ANGLE(x) (acos(.00006103515625*(x))*LSP_SCALING)*/ -#define X2ANGLE(x) (spx_acos(x)) - -#ifdef BFIN_ASM -#include "lsp_bfin.h" -#endif - -#else - -/*#define C1 0.99940307 -#define C2 -0.49558072 -#define C3 0.03679168*/ - -#define FREQ_SCALE 1. -#define ANGLE2X(a) (spx_cos(a)) -#define X2ANGLE(x) (acos(x)) - -#endif - - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: cheb_poly_eva() - - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - This function evaluates a series of Chebyshev polynomials - -\*---------------------------------------------------------------------------*/ - -#ifdef FIXED_POINT - -#ifndef OVERRIDE_CHEB_POLY_EVA -static inline spx_word32_t cheb_poly_eva( - spx_word16_t *coef, /* P or Q coefs in Q13 format */ - spx_word16_t x, /* cos of freq (-1.0 to 1.0) in Q14 format */ - int m, /* LPC order/2 */ - char *stack -) -{ - int i; - spx_word16_t b0, b1; - spx_word32_t sum; - - /*Prevents overflows*/ - if (x>16383) - x = 16383; - if (x<-16383) - x = -16383; - - /* Initialise values */ - b1=16384; - b0=x; - - /* Evaluate Chebyshev series formulation usin g iterative approach */ - sum = ADD32(EXTEND32(coef[m]), EXTEND32(MULT16_16_P14(coef[m-1],x))); - for(i=2;i<=m;i++) - { - spx_word16_t tmp=b0; - b0 = SUB16(MULT16_16_Q13(x,b0), b1); - b1 = tmp; - sum = ADD32(sum, EXTEND32(MULT16_16_P14(coef[m-i],b0))); - } - - return sum; -} -#endif - -#else - -static float cheb_poly_eva(spx_word32_t *coef, spx_word16_t x, int m, char *stack) -{ - int k; - float b0, b1, tmp; - - /* Initial conditions */ - b0=0; /* b_(m+1) */ - b1=0; /* b_(m+2) */ - - x*=2; - - /* Calculate the b_(k) */ - for(k=m;k>0;k--) - { - tmp=b0; /* tmp holds the previous value of b0 */ - b0=x*b0-b1+coef[m-k]; /* b0 holds its new value based on b0 and b1 */ - b1=tmp; /* b1 holds the previous value of b0 */ - } - - return(-b1+.5*x*b0+coef[m]); -} -#endif - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: lpc_to_lsp() - - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - This function converts LPC coefficients to LSP - coefficients. - -\*---------------------------------------------------------------------------*/ - -#ifdef FIXED_POINT -#define SIGN_CHANGE(a,b) (((a)&0x70000000)^((b)&0x70000000)||(b==0)) -#else -#define SIGN_CHANGE(a,b) (((a)*(b))<0.0) -#endif - - -int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t delta, char *stack) -/* float *a lpc coefficients */ -/* int lpcrdr order of LPC coefficients (10) */ -/* float *freq LSP frequencies in the x domain */ -/* int nb number of sub-intervals (4) */ -/* float delta grid spacing interval (0.02) */ - - -{ - spx_word16_t temp_xr,xl,xr,xm=0; - spx_word32_t psuml,psumr,psumm,temp_psumr/*,temp_qsumr*/; - int i,j,m,flag,k; - VARDECL(spx_word32_t *Q); /* ptrs for memory allocation */ - VARDECL(spx_word32_t *P); - VARDECL(spx_word16_t *Q16); /* ptrs for memory allocation */ - VARDECL(spx_word16_t *P16); - spx_word32_t *px; /* ptrs of respective P'(z) & Q'(z) */ - spx_word32_t *qx; - spx_word32_t *p; - spx_word32_t *q; - spx_word16_t *pt; /* ptr used for cheb_poly_eval() - whether P' or Q' */ - int roots=0; /* DR 8/2/94: number of roots found */ - flag = 1; /* program is searching for a root when, - 1 else has found one */ - m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */ - - /* Allocate memory space for polynomials */ - ALLOC(Q, (m+1), spx_word32_t); - ALLOC(P, (m+1), spx_word32_t); - - /* determine P'(z)'s and Q'(z)'s coefficients where - P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ - - px = P; /* initialise ptrs */ - qx = Q; - p = px; - q = qx; - -#ifdef FIXED_POINT - *px++ = LPC_SCALING; - *qx++ = LPC_SCALING; - for(i=0;i<m;i++){ - *px++ = SUB32(ADD32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *p++); - *qx++ = ADD32(SUB32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *q++); - } - px = P; - qx = Q; - for(i=0;i<m;i++) - { - /*if (fabs(*px)>=32768) - speex_warning_int("px", *px); - if (fabs(*qx)>=32768) - speex_warning_int("qx", *qx);*/ - *px = PSHR32(*px,2); - *qx = PSHR32(*qx,2); - px++; - qx++; - } - /* The reason for this lies in the way cheb_poly_eva() is implemented for fixed-point */ - P[m] = PSHR32(P[m],3); - Q[m] = PSHR32(Q[m],3); -#else - *px++ = LPC_SCALING; - *qx++ = LPC_SCALING; - for(i=0;i<m;i++){ - *px++ = (a[i]+a[lpcrdr-1-i]) - *p++; - *qx++ = (a[i]-a[lpcrdr-1-i]) + *q++; - } - px = P; - qx = Q; - for(i=0;i<m;i++){ - *px = 2**px; - *qx = 2**qx; - px++; - qx++; - } -#endif - - px = P; /* re-initialise ptrs */ - qx = Q; - - /* now that we have computed P and Q convert to 16 bits to - speed up cheb_poly_eval */ - - ALLOC(P16, m+1, spx_word16_t); - ALLOC(Q16, m+1, spx_word16_t); - - for (i=0;i<m+1;i++) - { - P16[i] = P[i]; - Q16[i] = Q[i]; - } - - /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). - Keep alternating between the two polynomials as each zero is found */ - - xr = 0; /* initialise xr to zero */ - xl = FREQ_SCALE; /* start at point xl = 1 */ - - for(j=0;j<lpcrdr;j++){ - if(j&1) /* determines whether P' or Q' is eval. */ - pt = Q16; - else - pt = P16; - - psuml = cheb_poly_eva(pt,xl,m,stack); /* evals poly. at xl */ - flag = 1; - while(flag && (xr >= -FREQ_SCALE)){ - spx_word16_t dd; - /* Modified by JMV to provide smaller steps around x=+-1 */ -#ifdef FIXED_POINT - dd = MULT16_16_Q15(delta,SUB16(FREQ_SCALE, MULT16_16_Q14(MULT16_16_Q14(xl,xl),14000))); - if (psuml<512 && psuml>-512) - dd = PSHR16(dd,1); -#else - dd=delta*(1-.9*xl*xl); - if (fabs(psuml)<.2) - dd *= .5; -#endif - xr = SUB16(xl, dd); /* interval spacing */ - psumr = cheb_poly_eva(pt,xr,m,stack);/* poly(xl-delta_x) */ - temp_psumr = psumr; - temp_xr = xr; - - /* if no sign change increment xr and re-evaluate poly(xr). Repeat til - sign change. - if a sign change has occurred the interval is bisected and then - checked again for a sign change which determines in which - interval the zero lies in. - If there is no sign change between poly(xm) and poly(xl) set interval - between xm and xr else set interval between xl and xr and repeat till - root is located within the specified limits */ - - if(SIGN_CHANGE(psumr,psuml)) - { - roots++; - - psumm=psuml; - for(k=0;k<=nb;k++){ -#ifdef FIXED_POINT - xm = ADD16(PSHR16(xl,1),PSHR16(xr,1)); /* bisect the interval */ -#else - xm = .5*(xl+xr); /* bisect the interval */ -#endif - psumm=cheb_poly_eva(pt,xm,m,stack); - /*if(psumm*psuml>0.)*/ - if(!SIGN_CHANGE(psumm,psuml)) - { - psuml=psumm; - xl=xm; - } else { - psumr=psumm; - xr=xm; - } - } - - /* once zero is found, reset initial interval to xr */ - freq[j] = X2ANGLE(xm); - xl = xm; - flag = 0; /* reset flag for next search */ - } - else{ - psuml=temp_psumr; - xl=temp_xr; - } - } - } - return(roots); -} - -/*---------------------------------------------------------------------------*\ - - FUNCTION....: lsp_to_lpc() - - AUTHOR......: David Rowe - DATE CREATED: 24/2/93 - - Converts LSP coefficients to LPC coefficients. - -\*---------------------------------------------------------------------------*/ - -#ifdef FIXED_POINT - -void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) -/* float *freq array of LSP frequencies in the x domain */ -/* float *ak array of LPC coefficients */ -/* int lpcrdr order of LPC coefficients */ -{ - int i,j; - spx_word32_t xout1,xout2,xin; - spx_word32_t mult, a; - VARDECL(spx_word16_t *freqn); - VARDECL(spx_word32_t **xp); - VARDECL(spx_word32_t *xpmem); - VARDECL(spx_word32_t **xq); - VARDECL(spx_word32_t *xqmem); - int m = lpcrdr>>1; - - /* - - Reconstruct P(z) and Q(z) by cascading second order polynomials - in form 1 - 2cos(w)z(-1) + z(-2), where w is the LSP frequency. - In the time domain this is: - - y(n) = x(n) - 2cos(w)x(n-1) + x(n-2) - - This is what the ALLOCS below are trying to do: - - int xp[m+1][lpcrdr+1+2]; // P matrix in QIMP - int xq[m+1][lpcrdr+1+2]; // Q matrix in QIMP - - These matrices store the output of each stage on each row. The - final (m-th) row has the output of the final (m-th) cascaded - 2nd order filter. The first row is the impulse input to the - system (not written as it is known). - - The version below takes advantage of the fact that a lot of the - outputs are zero or known, for example if we put an inpulse - into the first section the "clock" it 10 times only the first 3 - outputs samples are non-zero (it's an FIR filter). - */ - - ALLOC(xp, (m+1), spx_word32_t*); - ALLOC(xpmem, (m+1)*(lpcrdr+1+2), spx_word32_t); - - ALLOC(xq, (m+1), spx_word32_t*); - ALLOC(xqmem, (m+1)*(lpcrdr+1+2), spx_word32_t); - - for(i=0; i<=m; i++) { - xp[i] = xpmem + i*(lpcrdr+1+2); - xq[i] = xqmem + i*(lpcrdr+1+2); - } - - /* work out 2cos terms in Q14 */ - - ALLOC(freqn, lpcrdr, spx_word16_t); - for (i=0;i<lpcrdr;i++) - freqn[i] = ANGLE2X(freq[i]); - - #define QIMP 21 /* scaling for impulse */ - - xin = SHL32(EXTEND32(1), (QIMP-1)); /* 0.5 in QIMP format */ - - /* first col and last non-zero values of each row are trivial */ - - for(i=0;i<=m;i++) { - xp[i][1] = 0; - xp[i][2] = xin; - xp[i][2+2*i] = xin; - xq[i][1] = 0; - xq[i][2] = xin; - xq[i][2+2*i] = xin; - } - - /* 2nd row (first output row) is trivial */ - - xp[1][3] = -MULT16_32_Q14(freqn[0],xp[0][2]); - xq[1][3] = -MULT16_32_Q14(freqn[1],xq[0][2]); - - xout1 = xout2 = 0; - - /* now generate remaining rows */ - - for(i=1;i<m;i++) { - - for(j=1;j<2*(i+1)-1;j++) { - mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]); - xp[i+1][j+2] = ADD32(SUB32(xp[i][j+2], mult), xp[i][j]); - mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]); - xq[i+1][j+2] = ADD32(SUB32(xq[i][j+2], mult), xq[i][j]); - } - - /* for last col xp[i][j+2] = xq[i][j+2] = 0 */ - - mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]); - xp[i+1][j+2] = SUB32(xp[i][j], mult); - mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]); - xq[i+1][j+2] = SUB32(xq[i][j], mult); - } - - /* process last row to extra a{k} */ - - for(j=1;j<=lpcrdr;j++) { - int shift = QIMP-13; - - /* final filter sections */ - a = PSHR32(xp[m][j+2] + xout1 + xq[m][j+2] - xout2, shift); - xout1 = xp[m][j+2]; - xout2 = xq[m][j+2]; - - /* hard limit ak's to +/- 32767 */ - - if (a < -32767) a = -32767; - if (a > 32767) a = 32767; - ak[j-1] = (short)a; - - } - -} - -#else - -void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack) -/* float *freq array of LSP frequencies in the x domain */ -/* float *ak array of LPC coefficients */ -/* int lpcrdr order of LPC coefficients */ - - -{ - int i,j; - float xout1,xout2,xin1,xin2; - VARDECL(float *Wp); - float *pw,*n1,*n2,*n3,*n4=NULL; - VARDECL(float *x_freq); - int m = lpcrdr>>1; - - ALLOC(Wp, 4*m+2, float); - pw = Wp; - - /* initialise contents of array */ - - for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */ - *pw++ = 0.0; - } - - /* Set pointers up */ - - pw = Wp; - xin1 = 1.0; - xin2 = 1.0; - - ALLOC(x_freq, lpcrdr, float); - for (i=0;i<lpcrdr;i++) - x_freq[i] = ANGLE2X(freq[i]); - - /* reconstruct P(z) and Q(z) by cascading second order - polynomials in form 1 - 2xz(-1) +z(-2), where x is the - LSP coefficient */ - - for(j=0;j<=lpcrdr;j++){ - int i2=0; - for(i=0;i<m;i++,i2+=2){ - n1 = pw+(i*4); - n2 = n1 + 1; - n3 = n2 + 1; - n4 = n3 + 1; - xout1 = xin1 - 2.f*x_freq[i2] * *n1 + *n2; - xout2 = xin2 - 2.f*x_freq[i2+1] * *n3 + *n4; - *n2 = *n1; - *n4 = *n3; - *n1 = xin1; - *n3 = xin2; - xin1 = xout1; - xin2 = xout2; - } - xout1 = xin1 + *(n4+1); - xout2 = xin2 - *(n4+2); - if (j>0) - ak[j-1] = (xout1 + xout2)*0.5f; - *(n4+1) = xin1; - *(n4+2) = xin2; - - xin1 = 0.0; - xin2 = 0.0; - } - -} -#endif - - -#ifdef FIXED_POINT - -/*Makes sure the LSPs are stable*/ -void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin) -{ - int i; - spx_word16_t m = margin; - spx_word16_t m2 = 25736-margin; - - if (lsp[0]<m) - lsp[0]=m; - if (lsp[len-1]>m2) - lsp[len-1]=m2; - for (i=1;i<len-1;i++) - { - if (lsp[i]<lsp[i-1]+m) - lsp[i]=lsp[i-1]+m; - - if (lsp[i]>lsp[i+1]-m) - lsp[i]= SHR16(lsp[i],1) + SHR16(lsp[i+1]-m,1); - } -} - - -void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes) -{ - int i; - spx_word16_t tmp = DIV32_16(SHL32(EXTEND32(1 + subframe),14),nb_subframes); - spx_word16_t tmp2 = 16384-tmp; - for (i=0;i<len;i++) - { - interp_lsp[i] = MULT16_16_P14(tmp2,old_lsp[i]) + MULT16_16_P14(tmp,new_lsp[i]); - } -} - -#else - -/*Makes sure the LSPs are stable*/ -void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin) -{ - int i; - if (lsp[0]<LSP_SCALING*margin) - lsp[0]=LSP_SCALING*margin; - if (lsp[len-1]>LSP_SCALING*(M_PI-margin)) - lsp[len-1]=LSP_SCALING*(M_PI-margin); - for (i=1;i<len-1;i++) - { - if (lsp[i]<lsp[i-1]+LSP_SCALING*margin) - lsp[i]=lsp[i-1]+LSP_SCALING*margin; - - if (lsp[i]>lsp[i+1]-LSP_SCALING*margin) - lsp[i]= .5f* (lsp[i] + lsp[i+1]-LSP_SCALING*margin); - } -} - - -void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes) -{ - int i; - float tmp = (1.0f + subframe)/nb_subframes; - for (i=0;i<len;i++) - { - interp_lsp[i] = (1-tmp)*old_lsp[i] + tmp*new_lsp[i]; - } -} - -#endif diff --git a/src/lib/dl/ext/speex/lsp.h b/src/lib/dl/ext/speex/lsp.h deleted file mode 100755 index 648652fb..00000000 --- a/src/lib/dl/ext/speex/lsp.h +++ /dev/null @@ -1,64 +0,0 @@ -/*---------------------------------------------------------------------------*\ -Original Copyright - FILE........: AK2LSPD.H - TYPE........: Turbo C header file - COMPANY.....: Voicetronix - AUTHOR......: James Whitehall - DATE CREATED: 21/11/95 - -Modified by Jean-Marc Valin - - This file contains functions for converting Linear Prediction - Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the - LSP coefficients are not in radians format but in the x domain of the - unit circle. - -\*---------------------------------------------------------------------------*/ -/** - @file lsp.h - @brief Line Spectral Pair (LSP) functions. -*/ -/* Speex License: - - 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 __AK2LSPD__ -#define __AK2LSPD__ - -#include "arch.h" - -int lpc_to_lsp (spx_coef_t *a, int lpcrdr, spx_lsp_t *freq, int nb, spx_word16_t delta, char *stack); -void lsp_to_lpc(spx_lsp_t *freq, spx_coef_t *ak, int lpcrdr, char *stack); - -/*Added by JMV*/ -void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin); - -void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes); - -#endif /* __AK2LSPD__ */ diff --git a/src/lib/dl/ext/speex/lsp_bfin.h b/src/lib/dl/ext/speex/lsp_bfin.h deleted file mode 100755 index 20e50528..00000000 --- a/src/lib/dl/ext/speex/lsp_bfin.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright (C) 2006 David Rowe */ -/** - @file lsp_bfin.h - @author David Rowe - @brief LSP routines optimised for the Blackfin -*/ -/* - 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. -*/ - -#define OVERRIDE_CHEB_POLY_EVA -#ifdef OVERRIDE_CHEB_POLY_EVA -static inline spx_word32_t cheb_poly_eva( - spx_word16_t *coef, /* P or Q coefs in Q13 format */ - spx_word16_t x, /* cos of freq (-1.0 to 1.0) in Q14 format */ - int m, /* LPC order/2 */ - char *stack -) -{ - spx_word32_t sum; - - __asm__ __volatile__ - ( - "P0 = %2;\n\t" /* P0: coef[m], coef[m-1],..., coef[0] */ - "R4 = 8192;\n\t" /* R4: rounding constant */ - "R2 = %1;\n\t" /* R2: x */ - - "R5 = -16383;\n\t" - "R2 = MAX(R2,R5);\n\t" - "R5 = 16383;\n\t" - "R2 = MIN(R2,R5);\n\t" - - "R3 = W[P0--] (X);\n\t" /* R3: sum */ - "R5 = W[P0--] (X);\n\t" - "R5 = R5.L * R2.L (IS);\n\t" - "R5 = R5 + R4;\n\t" - "R5 >>>= 14;\n\t" - "R3 = R3 + R5;\n\t" - - "R0 = R2;\n\t" /* R0: b0 */ - "R1 = 16384;\n\t" /* R1: b1 */ - "LOOP cpe%= LC0 = %3;\n\t" - "LOOP_BEGIN cpe%=;\n\t" - "P1 = R0;\n\t" - "R0 = R2.L * R0.L (IS) || R5 = W[P0--] (X);\n\t" - "R0 >>>= 13;\n\t" - "R0 = R0 - R1;\n\t" - "R1 = P1;\n\t" - "R5 = R5.L * R0.L (IS);\n\t" - "R5 = R5 + R4;\n\t" - "R5 >>>= 14;\n\t" - "R3 = R3 + R5;\n\t" - "LOOP_END cpe%=;\n\t" - "%0 = R3;\n\t" - : "=&d" (sum) - : "a" (x), "a" (&coef[m]), "a" (m-1) - : "R0", "R1", "R3", "R2", "R4", "R5", "P0", "P1" - ); - return sum; -} -#endif - - - diff --git a/src/lib/dl/ext/speex/lsp_tables_nb.c b/src/lib/dl/ext/speex/lsp_tables_nb.c deleted file mode 100755 index 16f2e1b6..00000000 --- a/src/lib/dl/ext/speex/lsp_tables_nb.c +++ /dev/null @@ -1,360 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: lsp_tables_nb.c - Codebooks for LSPs in narrowband CELP mode - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -const signed char cdbk_nb[640]={ -30,19,38,34,40,32,46,43,58,43, -5,-18,-25,-40,-33,-55,-52,20,34,28, --20,-63,-97,-92,61,53,47,49,53,75, --14,-53,-77,-79,0,-3,-5,19,22,26, --9,-53,-55,66,90,72,85,68,74,52, --4,-41,-58,-31,-18,-31,27,32,30,18, -24,3,8,5,-12,-3,26,28,74,63, --2,-39,-67,-77,-106,-74,59,59,73,65, -44,40,71,72,82,83,98,88,89,60, --6,-31,-47,-48,-13,-39,-9,7,2,79, --1,-39,-60,-17,87,81,65,50,45,19, --21,-67,-91,-87,-41,-50,7,18,39,74, -10,-31,-28,39,24,13,23,5,56,45, -29,10,-5,-13,-11,-35,-18,-8,-10,-8, --25,-71,-77,-21,2,16,50,63,87,87, -5,-32,-40,-51,-68,0,12,6,54,34, -5,-12,32,52,68,64,69,59,65,45, -14,-16,-31,-40,-65,-67,41,49,47,37, --11,-52,-75,-84,-4,57,48,42,42,33, --11,-51,-68,-6,13,0,8,-8,26,32, --23,-53,0,36,56,76,97,105,111,97, --1,-28,-39,-40,-43,-54,-44,-40,-18,35, -16,-20,-19,-28,-42,29,47,38,74,45, -3,-29,-48,-62,-80,-104,-33,56,59,59, -10,17,46,72,84,101,117,123,123,106, --7,-33,-49,-51,-70,-67,-27,-31,70,67, --16,-62,-85,-20,82,71,86,80,85,74, --19,-58,-75,-45,-29,-33,-18,-25,45,57, --12,-42,-5,12,28,36,52,64,81,82, -13,-9,-27,-28,22,3,2,22,26,6, --6,-44,-51,2,15,10,48,43,49,34, --19,-62,-84,-89,-102,-24,8,17,61,68, -39,24,23,19,16,-5,12,15,27,15, --8,-44,-49,-60,-18,-32,-28,52,54,62, --8,-48,-77,-70,66,101,83,63,61,37, --12,-50,-75,-64,33,17,13,25,15,77, -1,-42,-29,72,64,46,49,31,61,44, --8,-47,-54,-46,-30,19,20,-1,-16,0, -16,-12,-18,-9,-26,-27,-10,-22,53,45, --10,-47,-75,-82,-105,-109,8,25,49,77, -50,65,114,117,124,118,115,96,90,61, --9,-45,-63,-60,-75,-57,8,11,20,29, -0,-35,-49,-43,40,47,35,40,55,38, --24,-76,-103,-112,-27,3,23,34,52,75, -8,-29,-43,12,63,38,35,29,24,8, -25,11,1,-15,-18,-43,-7,37,40,21, --20,-56,-19,-19,-4,-2,11,29,51,63, --2,-44,-62,-75,-89,30,57,51,74,51, -50,46,68,64,65,52,63,55,65,43, -18,-9,-26,-35,-55,-69,3,6,8,17, --15,-61,-86,-97,1,86,93,74,78,67, --1,-38,-66,-48,48,39,29,25,17,-1, -13,13,29,39,50,51,69,82,97,98, --2,-36,-46,-27,-16,-30,-13,-4,-7,-4, -25,-5,-11,-6,-25,-21,33,12,31,29, --8,-38,-52,-63,-68,-89,-33,-1,10,74, --2,-15,59,91,105,105,101,87,84,62, --7,-33,-50,-35,-54,-47,25,17,82,81, --13,-56,-83,21,58,31,42,25,72,65, --24,-66,-91,-56,9,-2,21,10,69,75, -2,-24,11,22,25,28,38,34,48,33, -7,-29,-26,17,15,-1,14,0,-2,0, --6,-41,-67,6,-2,-9,19,2,85,74, --22,-67,-84,-71,-50,3,11,-9,2,62}; - -const signed char cdbk_nb_low1[320]={ --34,-52,-15,45,2, -23,21,52,24,-33, --9,-1,9,-44,-41, --13,-17,44,22,-17, --6,-4,-1,22,38, -26,16,2,50,27, --35,-34,-9,-41,6, -0,-16,-34,51,8, --14,-31,-49,15,-33, -45,49,33,-11,-37, --62,-54,45,11,-5, --72,11,-1,-12,-11, -24,27,-11,-43,46, -43,33,-12,-9,-1, -1,-4,-23,-57,-71, -11,8,16,17,-8, --20,-31,-41,53,48, --16,3,65,-24,-8, --23,-32,-37,-32,-49, --10,-17,6,38,5, --9,-17,-46,8,52, -3,6,45,40,39, --7,-6,-34,-74,31, -8,1,-16,43,68, --11,-19,-31,4,6, -0,-6,-17,-16,-38, --16,-30,2,9,-39, --16,-1,43,-10,48, -3,3,-16,-31,-3, -62,68,43,13,3, --10,8,20,-56,12, -12,-2,-18,22,-15, --40,-36,1,7,41, -0,1,46,-6,-62, --4,-12,-2,-11,-83, --13,-2,91,33,-10, -0,4,-11,-16,79, -32,37,14,9,51, --21,-28,-56,-34,0, -21,9,-26,11,28, --42,-54,-23,-2,-15, -31,30,8,-39,-66, --39,-36,31,-28,-40, --46,35,40,22,24, -33,48,23,-34,14, -40,32,17,27,-3, -25,26,-13,-61,-17, -11,4,31,60,-6, --26,-41,-64,13,16, --26,54,31,-11,-23, --9,-11,-34,-71,-21, --34,-35,55,50,29, --22,-27,-50,-38,57, -33,42,57,48,26, -11,0,-49,-31,26, --4,-14,5,78,37, -17,0,-49,-12,-23, -26,14,2,2,-43, --17,-12,10,-8,-4, -8,18,12,-6,20, --12,-6,-13,-25,34, -15,40,49,7,8, -13,20,20,-19,-22, --2,-8,2,51,-51}; - -const signed char cdbk_nb_low2[320]={ --6,53,-21,-24,4, -26,17,-4,-37,25, -17,-36,-13,31,3, --6,27,15,-10,31, -28,26,-10,-10,-40, -16,-7,15,13,41, --9,0,-4,50,-6, --7,14,38,22,0, --48,2,1,-13,-19, -32,-3,-60,11,-17, --1,-24,-34,-1,35, --5,-27,28,44,13, -25,15,42,-11,15, -51,35,-36,20,8, --4,-12,-29,19,-47, -49,-15,-4,16,-29, --39,14,-30,4,25, --9,-5,-51,-14,-3, --40,-32,38,5,-9, --8,-4,-1,-22,71, --3,14,26,-18,-22, -24,-41,-25,-24,6, -23,19,-10,39,-26, --27,65,45,2,-7, --26,-8,22,-12,16, -15,16,-35,-5,33, --21,-8,0,23,33, -34,6,21,36,6, --7,-22,8,-37,-14, -31,38,11,-4,-3, --39,-32,-8,32,-23, --6,-12,16,20,-28, --4,23,13,-52,-1, -22,6,-33,-40,-6, -4,-62,13,5,-26, -35,39,11,2,57, --11,9,-20,-28,-33, -52,-5,-6,-2,22, --14,-16,-48,35,1, --58,20,13,33,-1, --74,56,-18,-22,-31, -12,6,-14,4,-2, --9,-47,10,-3,29, --17,-5,61,14,47, --12,2,72,-39,-17, -92,64,-53,-51,-15, --30,-38,-41,-29,-28, -27,9,36,9,-35, --42,81,-21,20,25, --16,-5,-17,-35,21, -15,-28,48,2,-2, -9,-19,29,-40,30, --18,-18,18,-16,-57, -15,-20,-12,-15,-37, --15,33,-39,21,-22, --13,35,11,13,-38, --63,29,23,-27,32, -18,3,-26,42,33, --64,-66,-17,16,56, -2,36,3,31,21, --41,-39,8,-57,14, -37,-2,19,-36,-19, --23,-29,-16,1,-3, --8,-10,31,64,-65}; - -const signed char cdbk_nb_high1[320]={ --26,-8,29,21,4, -19,-39,33,-7,-36, -56,54,48,40,29, --4,-24,-42,-66,-43, --60,19,-2,37,41, --10,-37,-60,-64,18, --22,77,73,40,25, -4,19,-19,-66,-2, -11,5,21,14,26, --25,-86,-4,18,1, -26,-37,10,37,-1, -24,-12,-59,-11,20, --6,34,-16,-16,42, -19,-28,-51,53,32, -4,10,62,21,-12, --34,27,4,-48,-48, --50,-49,31,-7,-21, --42,-25,-4,-43,-22, -59,2,27,12,-9, --6,-16,-8,-32,-58, --16,-29,-5,41,23, --30,-33,-46,-13,-10, --38,52,52,1,-17, --9,10,26,-25,-6, -33,-20,53,55,25, --32,-5,-42,23,21, -66,5,-28,20,9, -75,29,-7,-42,-39, -15,3,-23,21,6, -11,1,-29,14,63, -10,54,26,-24,-51, --49,7,-23,-51,15, --66,1,60,25,10, -0,-30,-4,-15,17, -19,59,40,4,-5, -33,6,-22,-58,-70, --5,23,-6,60,44, --29,-16,-47,-29,52, --19,50,28,16,35, -31,36,0,-21,6, -21,27,22,42,7, --66,-40,-8,7,19, -46,0,-4,60,36, -45,-7,-29,-6,-32, --39,2,6,-9,33, -20,-51,-34,18,-6, -19,6,11,5,-19, --29,-2,42,-11,-45, --21,-55,57,37,2, --14,-67,-16,-27,-38, -69,48,19,2,-17, -20,-20,-16,-34,-17, --25,-61,10,73,45, -16,-40,-64,-17,-29, --22,56,17,-39,8, --11,8,-25,-18,-13, --19,8,54,57,36, --17,-26,-4,6,-21, -40,42,-4,20,31, -53,10,-34,-53,31, --17,35,0,15,-6, --20,-63,-73,22,25, -29,17,8,-29,-39, --69,18,15,-15,-5}; - -const signed char cdbk_nb_high2[320]={ -11,47,16,-9,-46, --32,26,-64,34,-5, -38,-7,47,20,2, --73,-99,-3,-45,20, -70,-52,15,-6,-7, --82,31,21,47,51, -39,-3,9,0,-41, --7,-15,-54,2,0, -27,-31,9,-45,-22, --38,-24,-24,8,-33, -23,5,50,-36,-17, --18,-51,-2,13,19, -43,12,-15,-12,61, -38,38,7,13,0, -6,-1,3,62,9, -27,22,-33,38,-35, --9,30,-43,-9,-32, --1,4,-4,1,-5, --11,-8,38,31,11, --10,-42,-21,-37,1, -43,15,-13,-35,-19, --18,15,23,-26,59, -1,-21,53,8,-41, --50,-14,-28,4,21, -25,-28,-40,5,-40, --41,4,51,-33,-8, --8,1,17,-60,12, -25,-41,17,34,43, -19,45,7,-37,24, --15,56,-2,35,-10, -48,4,-47,-2,5, --5,-54,5,-3,-33, --10,30,-2,-44,-24, --38,9,-9,42,4, -6,-56,44,-16,9, --40,-26,18,-20,10, -28,-41,-21,-4,13, --18,32,-30,-3,37, -15,22,28,50,-40, -3,-29,-64,7,51, --19,-11,17,-27,-40, --64,24,-12,-7,-27, -3,37,48,-1,2, --9,-38,-34,46,1, -27,-6,19,-13,26, -10,34,20,25,40, -50,-6,-7,30,9, --24,0,-23,71,-61, -22,58,-34,-4,2, --49,-33,25,30,-8, --6,-16,77,2,38, --8,-35,-6,-30,56, -78,31,33,-20,13, --39,20,22,4,21, --8,4,-6,10,-83, --41,9,-25,-43,15, --7,-12,-34,-39,-37, --33,19,30,16,-33, -42,-25,25,-68,44, --15,-11,-4,23,50, -14,4,-39,-43,20, --30,60,9,-20,7, -16,19,-33,37,29, -16,-35,7,38,-27}; diff --git a/src/lib/dl/ext/speex/ltp.c b/src/lib/dl/ext/speex/ltp.c deleted file mode 100755 index 0129c95f..00000000 --- a/src/lib/dl/ext/speex/ltp.c +++ /dev/null @@ -1,839 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: ltp.c - Long-Term Prediction functions - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include "ltp.h" -#include "stack_alloc.h" -#include "filters.h" -#include <speex/speex_bits.h> -#include "math_approx.h" -#include "os_support.h" - -#ifndef NULL -#define NULL 0 -#endif - - -#ifdef _USE_SSE -#include "ltp_sse.h" -#elif defined (ARM4_ASM) || defined(ARM5E_ASM) -#include "ltp_arm4.h" -#elif defined (BFIN_ASM) -#include "ltp_bfin.h" -#endif - -#ifndef OVERRIDE_INNER_PROD -spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) -{ - spx_word32_t sum=0; - len >>= 2; - while(len--) - { - spx_word32_t part=0; - part = MAC16_16(part,*x++,*y++); - part = MAC16_16(part,*x++,*y++); - part = MAC16_16(part,*x++,*y++); - part = MAC16_16(part,*x++,*y++); - /* HINT: If you had a 40-bit accumulator, you could shift only at the end */ - sum = ADD32(sum,SHR32(part,6)); - } - return sum; -} -#endif - -#ifndef OVERRIDE_PITCH_XCORR -#if 0 /* HINT: Enable this for machines with enough registers (i.e. not x86) */ -void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) -{ - int i,j; - for (i=0;i<nb_pitch;i+=4) - { - /* Compute correlation*/ - /*corr[nb_pitch-1-i]=inner_prod(x, _y+i, len);*/ - spx_word32_t sum1=0; - spx_word32_t sum2=0; - spx_word32_t sum3=0; - spx_word32_t sum4=0; - const spx_word16_t *y = _y+i; - const spx_word16_t *x = _x; - spx_word16_t y0, y1, y2, y3; - /*y0=y[0];y1=y[1];y2=y[2];y3=y[3];*/ - y0=*y++; - y1=*y++; - y2=*y++; - y3=*y++; - for (j=0;j<len;j+=4) - { - spx_word32_t part1; - spx_word32_t part2; - spx_word32_t part3; - spx_word32_t part4; - part1 = MULT16_16(*x,y0); - part2 = MULT16_16(*x,y1); - part3 = MULT16_16(*x,y2); - part4 = MULT16_16(*x,y3); - x++; - y0=*y++; - part1 = MAC16_16(part1,*x,y1); - part2 = MAC16_16(part2,*x,y2); - part3 = MAC16_16(part3,*x,y3); - part4 = MAC16_16(part4,*x,y0); - x++; - y1=*y++; - part1 = MAC16_16(part1,*x,y2); - part2 = MAC16_16(part2,*x,y3); - part3 = MAC16_16(part3,*x,y0); - part4 = MAC16_16(part4,*x,y1); - x++; - y2=*y++; - part1 = MAC16_16(part1,*x,y3); - part2 = MAC16_16(part2,*x,y0); - part3 = MAC16_16(part3,*x,y1); - part4 = MAC16_16(part4,*x,y2); - x++; - y3=*y++; - - sum1 = ADD32(sum1,SHR32(part1,6)); - sum2 = ADD32(sum2,SHR32(part2,6)); - sum3 = ADD32(sum3,SHR32(part3,6)); - sum4 = ADD32(sum4,SHR32(part4,6)); - } - corr[nb_pitch-1-i]=sum1; - corr[nb_pitch-2-i]=sum2; - corr[nb_pitch-3-i]=sum3; - corr[nb_pitch-4-i]=sum4; - } - -} -#else -void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) -{ - int i; - for (i=0;i<nb_pitch;i++) - { - /* Compute correlation*/ - corr[nb_pitch-1-i]=inner_prod(_x, _y+i, len); - } - -} -#endif -#endif - -#ifndef OVERRIDE_COMPUTE_PITCH_ERROR -static inline spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control) -{ - spx_word32_t sum = 0; - sum = ADD32(sum,MULT16_16(MULT16_16_16(g[0],pitch_control),C[0])); - sum = ADD32(sum,MULT16_16(MULT16_16_16(g[1],pitch_control),C[1])); - sum = ADD32(sum,MULT16_16(MULT16_16_16(g[2],pitch_control),C[2])); - sum = SUB32(sum,MULT16_16(MULT16_16_16(g[0],g[1]),C[3])); - sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[1]),C[4])); - sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[0]),C[5])); - sum = SUB32(sum,MULT16_16(MULT16_16_16(g[0],g[0]),C[6])); - sum = SUB32(sum,MULT16_16(MULT16_16_16(g[1],g[1]),C[7])); - sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[2]),C[8])); - return sum; -} -#endif - -#ifndef OVERRIDE_OPEN_LOOP_NBEST_PITCH -void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack) -{ - int i,j,k; - VARDECL(spx_word32_t *best_score); - VARDECL(spx_word32_t *best_ener); - spx_word32_t e0; - VARDECL(spx_word32_t *corr); -#ifdef FIXED_POINT - /* In fixed-point, we need only one (temporary) array of 32-bit values and two (corr16, ener16) - arrays for (normalized) 16-bit values */ - VARDECL(spx_word16_t *corr16); - VARDECL(spx_word16_t *ener16); - spx_word32_t *energy; - int cshift=0, eshift=0; - int scaledown = 0; - ALLOC(corr16, end-start+1, spx_word16_t); - ALLOC(ener16, end-start+1, spx_word16_t); - ALLOC(corr, end-start+1, spx_word32_t); - energy = corr; -#else - /* In floating-point, we need to float arrays and no normalized copies */ - VARDECL(spx_word32_t *energy); - spx_word16_t *corr16; - spx_word16_t *ener16; - ALLOC(energy, end-start+2, spx_word32_t); - ALLOC(corr, end-start+1, spx_word32_t); - corr16 = corr; - ener16 = energy; -#endif - - ALLOC(best_score, N, spx_word32_t); - ALLOC(best_ener, N, spx_word32_t); - for (i=0;i<N;i++) - { - best_score[i]=-1; - best_ener[i]=0; - pitch[i]=start; - } - -#ifdef FIXED_POINT - for (i=-end;i<len;i++) - { - if (ABS16(sw[i])>16383) - { - scaledown=1; - break; - } - } - /* If the weighted input is close to saturation, then we scale it down */ - if (scaledown) - { - for (i=-end;i<len;i++) - { - sw[i]=SHR16(sw[i],1); - } - } -#endif - energy[0]=inner_prod(sw-start, sw-start, len); - e0=inner_prod(sw, sw, len); - for (i=start;i<end;i++) - { - /* Update energy for next pitch*/ - energy[i-start+1] = SUB32(ADD32(energy[i-start],SHR32(MULT16_16(sw[-i-1],sw[-i-1]),6)), SHR32(MULT16_16(sw[-i+len-1],sw[-i+len-1]),6)); - if (energy[i-start+1] < 0) - energy[i-start+1] = 0; - } - -#ifdef FIXED_POINT - eshift = normalize16(energy, ener16, 32766, end-start+1); -#endif - - /* In fixed-point, this actually overrites the energy array (aliased to corr) */ - pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack); - -#ifdef FIXED_POINT - /* Normalize to 180 so we can square it and it still fits in 16 bits */ - cshift = normalize16(corr, corr16, 180, end-start+1); - /* If we scaled weighted input down, we need to scale it up again (OK, so we've just lost the LSB, who cares?) */ - if (scaledown) - { - for (i=-end;i<len;i++) - { - sw[i]=SHL16(sw[i],1); - } - } -#endif - - /* Search for the best pitch prediction gain */ - for (i=start;i<=end;i++) - { - spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]); - /* Instead of dividing the tmp by the energy, we multiply on the other side */ - if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start]))) - { - /* We can safely put it last and then check */ - best_score[N-1]=tmp; - best_ener[N-1]=ener16[i-start]+1; - pitch[N-1]=i; - /* Check if it comes in front of others */ - for (j=0;j<N-1;j++) - { - if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start]))) - { - for (k=N-1;k>j;k--) - { - best_score[k]=best_score[k-1]; - best_ener[k]=best_ener[k-1]; - pitch[k]=pitch[k-1]; - } - best_score[j]=tmp; - best_ener[j]=ener16[i-start]+1; - pitch[j]=i; - break; - } - } - } - } - - /* Compute open-loop gain if necessary */ - if (gain) - { - for (j=0;j<N;j++) - { - spx_word16_t g; - i=pitch[j]; - g = DIV32(SHL32(EXTEND32(corr16[i-start]),cshift), 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(SHL32(EXTEND32(ener16[i-start]),eshift))),6)); - /* FIXME: g = max(g,corr/energy) */ - if (g<0) - g = 0; - gain[j]=g; - } - } - - -} -#endif - -#ifndef OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ -static int pitch_gain_search_3tap_vq( - const signed char *gain_cdbk, - int gain_cdbk_size, - spx_word16_t *C16, - spx_word16_t max_gain -) -{ - const signed char *ptr=gain_cdbk; - int best_cdbk=0; - spx_word32_t best_sum=-VERY_LARGE32; - spx_word32_t sum=0; - spx_word16_t g[3]; - spx_word16_t pitch_control=64; - spx_word16_t gain_sum; - int i; - - for (i=0;i<gain_cdbk_size;i++) { - - ptr = gain_cdbk+4*i; - g[0]=ADD16((spx_word16_t)ptr[0],32); - g[1]=ADD16((spx_word16_t)ptr[1],32); - g[2]=ADD16((spx_word16_t)ptr[2],32); - gain_sum = (spx_word16_t)ptr[3]; - - sum = compute_pitch_error(C16, g, pitch_control); - - if (sum>best_sum && gain_sum<=max_gain) { - best_sum=sum; - best_cdbk=i; - } - } - - return best_cdbk; -} -#endif - -/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */ -static spx_word32_t pitch_gain_search_3tap( -const spx_word16_t target[], /* Target vector */ -const spx_coef_t ak[], /* LPCs for this subframe */ -const spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */ -const spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */ -spx_sig_t exc[], /* Excitation */ -const signed char *gain_cdbk, -int gain_cdbk_size, -int pitch, /* Pitch value */ -int p, /* Number of LPC coeffs */ -int nsf, /* Number of samples in subframe */ -SpeexBits *bits, -char *stack, -const spx_word16_t *exc2, -const spx_word16_t *r, -spx_word16_t *new_target, -int *cdbk_index, -int plc_tuning, -spx_word32_t cumul_gain, -int scaledown -) -{ - int i,j; - VARDECL(spx_word16_t *tmp1); - VARDECL(spx_word16_t *e); - spx_word16_t *x[3]; - spx_word32_t corr[3]; - spx_word32_t A[3][3]; - spx_word16_t gain[3]; - spx_word32_t err; - spx_word16_t max_gain=128; - int best_cdbk=0; - - ALLOC(tmp1, 3*nsf, spx_word16_t); - ALLOC(e, nsf, spx_word16_t); - - if (cumul_gain > 262144) - max_gain = 31; - - x[0]=tmp1; - x[1]=tmp1+nsf; - x[2]=tmp1+2*nsf; - - for (j=0;j<nsf;j++) - new_target[j] = target[j]; - - { - VARDECL(spx_mem_t *mm); - int pp=pitch-1; - ALLOC(mm, p, spx_mem_t); - for (j=0;j<nsf;j++) - { - if (j-pp<0) - e[j]=exc2[j-pp]; - else if (j-pp-pitch<0) - e[j]=exc2[j-pp-pitch]; - else - e[j]=0; - } -#ifdef FIXED_POINT - /* Scale target and excitation down if needed (avoiding overflow) */ - if (scaledown) - { - for (j=0;j<nsf;j++) - e[j] = SHR16(e[j],1); - for (j=0;j<nsf;j++) - new_target[j] = SHR16(new_target[j],1); - } -#endif - for (j=0;j<p;j++) - mm[j] = 0; - iir_mem16(e, ak, e, nsf, p, mm, stack); - for (j=0;j<p;j++) - mm[j] = 0; - filter_mem16(e, awk1, awk2, e, nsf, p, mm, stack); - for (j=0;j<nsf;j++) - x[2][j] = e[j]; - } - for (i=1;i>=0;i--) - { - spx_word16_t e0=exc2[-pitch-1+i]; -#ifdef FIXED_POINT - /* Scale excitation down if needed (avoiding overflow) */ - if (scaledown) - e0 = SHR16(e0,1); -#endif - x[i][0]=MULT16_16_Q14(r[0], e0); - for (j=0;j<nsf-1;j++) - x[i][j+1]=ADD32(x[i+1][j],MULT16_16_P14(r[j+1], e0)); - } - - for (i=0;i<3;i++) - corr[i]=inner_prod(x[i],new_target,nsf); - for (i=0;i<3;i++) - for (j=0;j<=i;j++) - A[i][j]=A[j][i]=inner_prod(x[i],x[j],nsf); - - { - spx_word32_t C[9]; -#ifdef FIXED_POINT - spx_word16_t C16[9]; -#else - spx_word16_t *C16=C; -#endif - C[0]=corr[2]; - C[1]=corr[1]; - C[2]=corr[0]; - C[3]=A[1][2]; - C[4]=A[0][1]; - C[5]=A[0][2]; - C[6]=A[2][2]; - C[7]=A[1][1]; - C[8]=A[0][0]; - - /*plc_tuning *= 2;*/ - if (plc_tuning<2) - plc_tuning=2; - if (plc_tuning>30) - plc_tuning=30; -#ifdef FIXED_POINT - C[0] = SHL32(C[0],1); - C[1] = SHL32(C[1],1); - C[2] = SHL32(C[2],1); - C[3] = SHL32(C[3],1); - C[4] = SHL32(C[4],1); - C[5] = SHL32(C[5],1); - C[6] = MAC16_32_Q15(C[6],MULT16_16_16(plc_tuning,655),C[6]); - C[7] = MAC16_32_Q15(C[7],MULT16_16_16(plc_tuning,655),C[7]); - C[8] = MAC16_32_Q15(C[8],MULT16_16_16(plc_tuning,655),C[8]); - normalize16(C, C16, 32767, 9); -#else - C[6]*=.5*(1+.02*plc_tuning); - C[7]*=.5*(1+.02*plc_tuning); - C[8]*=.5*(1+.02*plc_tuning); -#endif - - best_cdbk = pitch_gain_search_3tap_vq(gain_cdbk, gain_cdbk_size, C16, max_gain); - -#ifdef FIXED_POINT - gain[0] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4]); - gain[1] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4+1]); - gain[2] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4+2]); - /*printf ("%d %d %d %d\n",gain[0],gain[1],gain[2], best_cdbk);*/ -#else - gain[0] = 0.015625*gain_cdbk[best_cdbk*4] + .5; - gain[1] = 0.015625*gain_cdbk[best_cdbk*4+1]+ .5; - gain[2] = 0.015625*gain_cdbk[best_cdbk*4+2]+ .5; -#endif - *cdbk_index=best_cdbk; - } - - SPEEX_MEMSET(exc, 0, nsf); - for (i=0;i<3;i++) - { - int j; - int tmp1, tmp3; - int pp=pitch+1-i; - tmp1=nsf; - if (tmp1>pp) - tmp1=pp; - for (j=0;j<tmp1;j++) - exc[j]=MAC16_16(exc[j],SHL16(gain[2-i],7),exc2[j-pp]); - tmp3=nsf; - if (tmp3>pp+pitch) - tmp3=pp+pitch; - for (j=tmp1;j<tmp3;j++) - exc[j]=MAC16_16(exc[j],SHL16(gain[2-i],7),exc2[j-pp-pitch]); - } - for (i=0;i<nsf;i++) - { - spx_word32_t tmp = ADD32(ADD32(MULT16_16(gain[0],x[2][i]),MULT16_16(gain[1],x[1][i])), - MULT16_16(gain[2],x[0][i])); - new_target[i] = SUB16(new_target[i], EXTRACT16(PSHR32(tmp,6))); - } - err = inner_prod(new_target, new_target, nsf); - - return err; -} - -/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */ -int pitch_search_3tap( -spx_word16_t target[], /* Target vector */ -spx_word16_t *sw, -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */ -spx_sig_t exc[], /* Excitation */ -const void *par, -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -int p, /* Number of LPC coeffs */ -int nsf, /* Number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_word16_t *exc2, -spx_word16_t *r, -int complexity, -int cdbk_offset, -int plc_tuning, -spx_word32_t *cumul_gain -) -{ - int i; - int cdbk_index, pitch=0, best_gain_index=0; - VARDECL(spx_sig_t *best_exc); - VARDECL(spx_word16_t *new_target); - VARDECL(spx_word16_t *best_target); - int best_pitch=0; - spx_word32_t err, best_err=-1; - int N; - const ltp_params *params; - const signed char *gain_cdbk; - int gain_cdbk_size; - int scaledown=0; - - VARDECL(int *nbest); - - params = (const ltp_params*) par; - gain_cdbk_size = 1<<params->gain_bits; - gain_cdbk = params->gain_cdbk + 4*gain_cdbk_size*cdbk_offset; - - N=complexity; - if (N>10) - N=10; - if (N<1) - N=1; - - ALLOC(nbest, N, int); - params = (const ltp_params*) par; - - if (end<start) - { - speex_bits_pack(bits, 0, params->pitch_bits); - speex_bits_pack(bits, 0, params->gain_bits); - SPEEX_MEMSET(exc, 0, nsf); - return start; - } - -#ifdef FIXED_POINT - /* Check if we need to scale everything down in the pitch search to avoid overflows */ - for (i=0;i<nsf;i++) - { - if (ABS16(target[i])>16383) - { - scaledown=1; - break; - } - } - for (i=-end;i<nsf;i++) - { - if (ABS16(exc2[i])>16383) - { - scaledown=1; - break; - } - } -#endif - if (N>end-start+1) - N=end-start+1; - if (end != start) - open_loop_nbest_pitch(sw, start, end, nsf, nbest, NULL, N, stack); - else - nbest[0] = start; - - ALLOC(best_exc, nsf, spx_sig_t); - ALLOC(new_target, nsf, spx_word16_t); - ALLOC(best_target, nsf, spx_word16_t); - - for (i=0;i<N;i++) - { - pitch=nbest[i]; - SPEEX_MEMSET(exc, 0, nsf); - err=pitch_gain_search_3tap(target, ak, awk1, awk2, exc, gain_cdbk, gain_cdbk_size, pitch, p, nsf, - bits, stack, exc2, r, new_target, &cdbk_index, plc_tuning, *cumul_gain, scaledown); - if (err<best_err || best_err<0) - { - SPEEX_COPY(best_exc, exc, nsf); - SPEEX_COPY(best_target, new_target, nsf); - best_err=err; - best_pitch=pitch; - best_gain_index=cdbk_index; - } - } - /*printf ("pitch: %d %d\n", best_pitch, best_gain_index);*/ - speex_bits_pack(bits, best_pitch-start, params->pitch_bits); - speex_bits_pack(bits, best_gain_index, params->gain_bits); -#ifdef FIXED_POINT - *cumul_gain = MULT16_32_Q13(SHL16(params->gain_cdbk[4*best_gain_index+3],8), MAX32(1024,*cumul_gain)); -#else - *cumul_gain = 0.03125*MAX32(1024,*cumul_gain)*params->gain_cdbk[4*best_gain_index+3]; -#endif - /*printf ("%f\n", cumul_gain);*/ - /*printf ("encode pitch: %d %d\n", best_pitch, best_gain_index);*/ - SPEEX_COPY(exc, best_exc, nsf); - SPEEX_COPY(target, best_target, nsf); -#ifdef FIXED_POINT - /* Scale target back up if needed */ - if (scaledown) - { - for (i=0;i<nsf;i++) - target[i]=SHL16(target[i],1); - } -#endif - return pitch; -} - -void pitch_unquant_3tap( -spx_word16_t exc[], /* Input excitation */ -spx_word32_t exc_out[], /* Output excitation */ -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -const void *par, -int nsf, /* Number of samples in subframe */ -int *pitch_val, -spx_word16_t *gain_val, -SpeexBits *bits, -char *stack, -int count_lost, -int subframe_offset, -spx_word16_t last_pitch_gain, -int cdbk_offset -) -{ - int i; - int pitch; - int gain_index; - spx_word16_t gain[3]; - const signed char *gain_cdbk; - int gain_cdbk_size; - const ltp_params *params; - - params = (const ltp_params*) par; - gain_cdbk_size = 1<<params->gain_bits; - gain_cdbk = params->gain_cdbk + 4*gain_cdbk_size*cdbk_offset; - - pitch = speex_bits_unpack_unsigned(bits, params->pitch_bits); - pitch += start; - gain_index = speex_bits_unpack_unsigned(bits, params->gain_bits); - /*printf ("decode pitch: %d %d\n", pitch, gain_index);*/ -#ifdef FIXED_POINT - gain[0] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4]); - gain[1] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4+1]); - gain[2] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4+2]); -#else - gain[0] = 0.015625*gain_cdbk[gain_index*4]+.5; - gain[1] = 0.015625*gain_cdbk[gain_index*4+1]+.5; - gain[2] = 0.015625*gain_cdbk[gain_index*4+2]+.5; -#endif - - if (count_lost && pitch > subframe_offset) - { - spx_word16_t gain_sum; - if (1) { -#ifdef FIXED_POINT - spx_word16_t tmp = count_lost < 4 ? last_pitch_gain : SHR16(last_pitch_gain,1); - if (tmp>62) - tmp=62; -#else - spx_word16_t tmp = count_lost < 4 ? last_pitch_gain : 0.5 * last_pitch_gain; - if (tmp>.95) - tmp=.95; -#endif - gain_sum = gain_3tap_to_1tap(gain); - - if (gain_sum > tmp) - { - spx_word16_t fact = DIV32_16(SHL32(EXTEND32(tmp),14),gain_sum); - for (i=0;i<3;i++) - gain[i]=MULT16_16_Q14(fact,gain[i]); - } - - } - - } - - *pitch_val = pitch; - gain_val[0]=gain[0]; - gain_val[1]=gain[1]; - gain_val[2]=gain[2]; - gain[0] = SHL16(gain[0],7); - gain[1] = SHL16(gain[1],7); - gain[2] = SHL16(gain[2],7); - SPEEX_MEMSET(exc_out, 0, nsf); - for (i=0;i<3;i++) - { - int j; - int tmp1, tmp3; - int pp=pitch+1-i; - tmp1=nsf; - if (tmp1>pp) - tmp1=pp; - for (j=0;j<tmp1;j++) - exc_out[j]=MAC16_16(exc_out[j],gain[2-i],exc[j-pp]); - tmp3=nsf; - if (tmp3>pp+pitch) - tmp3=pp+pitch; - for (j=tmp1;j<tmp3;j++) - exc_out[j]=MAC16_16(exc_out[j],gain[2-i],exc[j-pp-pitch]); - } - /*for (i=0;i<nsf;i++) - exc[i]=PSHR32(exc32[i],13);*/ -} - - -/** Forced pitch delay and gain */ -int forced_pitch_quant( -spx_word16_t target[], /* Target vector */ -spx_word16_t *sw, -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */ -spx_sig_t exc[], /* Excitation */ -const void *par, -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -int p, /* Number of LPC coeffs */ -int nsf, /* Number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_word16_t *exc2, -spx_word16_t *r, -int complexity, -int cdbk_offset, -int plc_tuning, -spx_word32_t *cumul_gain -) -{ - int i; - VARDECL(spx_word16_t *res); - ALLOC(res, nsf, spx_word16_t); -#ifdef FIXED_POINT - if (pitch_coef>63) - pitch_coef=63; -#else - if (pitch_coef>.99) - pitch_coef=.99; -#endif - for (i=0;i<nsf&&i<start;i++) - { - exc[i]=MULT16_16(SHL16(pitch_coef, 7),exc2[i-start]); - } - for (;i<nsf;i++) - { - exc[i]=MULT16_32_Q15(SHL16(pitch_coef, 9),exc[i-start]); - } - for (i=0;i<nsf;i++) - res[i] = EXTRACT16(PSHR32(exc[i], SIG_SHIFT-1)); - syn_percep_zero16(res, ak, awk1, awk2, res, nsf, p, stack); - for (i=0;i<nsf;i++) - target[i]=EXTRACT16(SATURATE(SUB32(EXTEND32(target[i]),EXTEND32(res[i])),32700)); - return start; -} - -/** Unquantize forced pitch delay and gain */ -void forced_pitch_unquant( -spx_word16_t exc[], /* Input excitation */ -spx_word32_t exc_out[], /* Output excitation */ -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -const void *par, -int nsf, /* Number of samples in subframe */ -int *pitch_val, -spx_word16_t *gain_val, -SpeexBits *bits, -char *stack, -int count_lost, -int subframe_offset, -spx_word16_t last_pitch_gain, -int cdbk_offset -) -{ - int i; -#ifdef FIXED_POINT - if (pitch_coef>63) - pitch_coef=63; -#else - if (pitch_coef>.99) - pitch_coef=.99; -#endif - for (i=0;i<nsf;i++) - { - exc_out[i]=MULT16_16(exc[i-start],SHL16(pitch_coef,7)); - exc[i] = EXTRACT16(PSHR32(exc_out[i],13)); - } - *pitch_val = start; - gain_val[0]=gain_val[2]=0; - gain_val[1] = pitch_coef; -} diff --git a/src/lib/dl/ext/speex/ltp.h b/src/lib/dl/ext/speex/ltp.h deleted file mode 100755 index 1e435bc3..00000000 --- a/src/lib/dl/ext/speex/ltp.h +++ /dev/null @@ -1,141 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file ltp.h - @brief Long-Term Prediction functions -*/ -/* - 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 <speex/speex_bits.h> -#include "arch.h" - -/** LTP parameters. */ -typedef struct { - const signed char *gain_cdbk; - int gain_bits; - int pitch_bits; -} ltp_params; - -#ifdef FIXED_POINT -#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -SHR16(g[0],1)) + (g[2]>0 ? g[2] : -SHR16(g[2],1))) -#else -#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -.5*g[0]) + (g[2]>0 ? g[2] : -.5*g[2])) -#endif - -spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len); -void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack); - -void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack); - - -/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */ -int pitch_search_3tap( -spx_word16_t target[], /* Target vector */ -spx_word16_t *sw, -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */ -spx_sig_t exc[], /* Overlapping codebook */ -const void *par, -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -int p, /* Number of LPC coeffs */ -int nsf, /* Number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_word16_t *exc2, -spx_word16_t *r, -int complexity, -int cdbk_offset, -int plc_tuning, -spx_word32_t *cumul_gain -); - -/*Unquantize adaptive codebook and update pitch contribution*/ -void pitch_unquant_3tap( -spx_word16_t exc[], /* Input excitation */ -spx_word32_t exc_out[], /* Output excitation */ -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -const void *par, -int nsf, /* Number of samples in subframe */ -int *pitch_val, -spx_word16_t *gain_val, -SpeexBits *bits, -char *stack, -int lost, -int subframe_offset, -spx_word16_t last_pitch_gain, -int cdbk_offset -); - -/** Forced pitch delay and gain */ -int forced_pitch_quant( -spx_word16_t target[], /* Target vector */ -spx_word16_t *sw, -spx_coef_t ak[], /* LPCs for this subframe */ -spx_coef_t awk1[], /* Weighted LPCs #1 for this subframe */ -spx_coef_t awk2[], /* Weighted LPCs #2 for this subframe */ -spx_sig_t exc[], /* Excitation */ -const void *par, -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -int p, /* Number of LPC coeffs */ -int nsf, /* Number of samples in subframe */ -SpeexBits *bits, -char *stack, -spx_word16_t *exc2, -spx_word16_t *r, -int complexity, -int cdbk_offset, -int plc_tuning, -spx_word32_t *cumul_gain -); - -/** Unquantize forced pitch delay and gain */ -void forced_pitch_unquant( -spx_word16_t exc[], /* Input excitation */ -spx_word32_t exc_out[], /* Output excitation */ -int start, /* Smallest pitch value allowed */ -int end, /* Largest pitch value allowed */ -spx_word16_t pitch_coef, /* Voicing (pitch) coefficient */ -const void *par, -int nsf, /* Number of samples in subframe */ -int *pitch_val, -spx_word16_t *gain_val, -SpeexBits *bits, -char *stack, -int lost, -int subframe_offset, -spx_word16_t last_pitch_gain, -int cdbk_offset -); diff --git a/src/lib/dl/ext/speex/ltp_arm4.h b/src/lib/dl/ext/speex/ltp_arm4.h deleted file mode 100755 index cdb94e60..00000000 --- a/src/lib/dl/ext/speex/ltp_arm4.h +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright (C) 2004 Jean-Marc Valin */ -/** - @file ltp_arm4.h - @brief Long-Term Prediction functions (ARM4 version) -*/ -/* - 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. -*/ - -#define OVERRIDE_INNER_PROD -spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) -{ - spx_word32_t sum1=0,sum2=0; - spx_word16_t *deadx, *deady; - int deadlen, dead1, dead2, dead3, dead4, dead5, dead6; - __asm__ __volatile__ ( - "\tldrsh %5, [%0], #2 \n" - "\tldrsh %6, [%1], #2 \n" - ".inner_prod_loop%=:\n" - "\tsub %7, %7, %7\n" - "\tsub %10, %10, %10\n" - - "\tldrsh %8, [%0], #2 \n" - "\tldrsh %9, [%1], #2 \n" - "\tmla %7, %5, %6, %7\n" - "\tldrsh %5, [%0], #2 \n" - "\tldrsh %6, [%1], #2 \n" - "\tmla %10, %8, %9, %10\n" - "\tldrsh %8, [%0], #2 \n" - "\tldrsh %9, [%1], #2 \n" - "\tmla %7, %5, %6, %7\n" - "\tldrsh %5, [%0], #2 \n" - "\tldrsh %6, [%1], #2 \n" - "\tmla %10, %8, %9, %10\n" - - "\tldrsh %8, [%0], #2 \n" - "\tldrsh %9, [%1], #2 \n" - "\tmla %7, %5, %6, %7\n" - "\tldrsh %5, [%0], #2 \n" - "\tldrsh %6, [%1], #2 \n" - "\tmla %10, %8, %9, %10\n" - "\tldrsh %8, [%0], #2 \n" - "\tldrsh %9, [%1], #2 \n" - "\tmla %7, %5, %6, %7\n" - "\tldrsh %5, [%0], #2 \n" - "\tldrsh %6, [%1], #2 \n" - "\tmla %10, %8, %9, %10\n" - - "\tsubs %4, %4, #1\n" - "\tadd %2, %2, %7, asr #5\n" - "\tadd %3, %3, %10, asr #5\n" - "\tbne .inner_prod_loop%=\n" - : "=r" (deadx), "=r" (deady), "+r" (sum1), "+r" (sum2), - "=r" (deadlen), "=r" (dead1), "=r" (dead2), "=r" (dead3), - "=r" (dead4), "=r" (dead5), "=r" (dead6) - : "0" (x), "1" (y), "4" (len>>3) - : "cc" - ); - return (sum1+sum2)>>1; -} - -#define OVERRIDE_PITCH_XCORR -void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) -{ - int i,j; - for (i=0;i<nb_pitch;i+=4) - { - /* Compute correlation*/ - //corr[nb_pitch-1-i]=inner_prod(x, _y+i, len); - spx_word32_t sum1=0; - spx_word32_t sum2=0; - spx_word32_t sum3=0; - spx_word32_t sum4=0; - const spx_word16_t *y = _y+i; - const spx_word16_t *x = _x; - spx_word32_t y0, y1, y2, y3; - y0=*y++; - y1=*y++; - y2=*y++; - y3=*y++; - for (j=0;j<len;j+=4) - { - spx_word32_t part1, part2, part3, part4, x0; - spx_word32_t dead1; - __asm__ __volatile__ ( -#ifdef SHORTCUTS - "\tldrsh %10, [%8], #4 \n" - "\tmul %4, %10, %0 \n" - "\tldrsh %15, [%8], #4 \n" - "\tmul %5, %10, %1 \n" - "\tldrsh %0, [%9], #2 \n" - "\tmul %6, %10, %2 \n" - "\tldrsh %1, [%9], #2 \n" - "\tmul %7, %10, %3 \n" - - - "\tmla %4, %15, %2, %4 \n" - "\tldrsh %2, [%9], #2 \n" - "\tmla %5, %15, %3, %5 \n" - "\tldrsh %3, [%9], #2 \n" - "\tmla %6, %15, %0, %6 \n" - "\tmla %7, %15, %1, %7 \n" - -#else - "\tldrsh %10, [%8], #2 \n" - "\tmul %4, %10, %0 \n" - "\tmul %5, %10, %1 \n" - "\tmul %6, %10, %2 \n" - "\tmul %7, %10, %3 \n" - - "\tldrsh %10, [%8], #2 \n" - "\tldrsh %0, [%9], #2 \n" - "\tmla %4, %10, %1, %4 \n" - "\tmla %5, %10, %2, %5 \n" - "\tmla %6, %10, %3, %6 \n" - "\tmla %7, %10, %0, %7 \n" - - "\tldrsh %10, [%8], #2 \n" - "\tldrsh %1, [%9], #2 \n" - "\tmla %4, %10, %2, %4 \n" - "\tmla %5, %10, %3, %5 \n" - "\tmla %6, %10, %0, %6 \n" - "\tmla %7, %10, %1, %7 \n" - - "\tldrsh %10, [%8], #2 \n" - "\tldrsh %2, [%9], #2 \n" - "\tmla %4, %10, %3, %4 \n" - "\tmla %5, %10, %0, %5 \n" - "\tmla %6, %10, %1, %6 \n" - "\tmla %7, %10, %2, %7 \n" - - "\tldrsh %3, [%9], #2 \n" -#endif - - "\tldr %10, %11 \n" - "\tldr %15, %12 \n" - "\tadd %4, %10, %4, asr #6 \n" - "\tstr %4, %11 \n" - "\tldr %10, %13 \n" - "\tadd %5, %15, %5, asr #6 \n" - "\tstr %5, %12 \n" - "\tldr %15, %14 \n" - "\tadd %6, %10, %6, asr #6 \n" - "\tadd %7, %15, %7, asr #6 \n" - "\tstr %6, %13 \n" - "\tstr %7, %14 \n" - - : "+r" (y0), "+r" (y1), "+r" (y2), "+r" (y3), - "=r" (part1), "=r" (part2), "=r" (part3), "=r" (part4), - "+r" (x), "+r" (y), "=r" (x0), "+m" (sum1), - "+m" (sum2), "+m" (sum3), "+m" (sum4), "=r" (dead1) - : - : "cc", "memory" - ); - } - corr[nb_pitch-1-i]=sum1; - corr[nb_pitch-2-i]=sum2; - corr[nb_pitch-3-i]=sum3; - corr[nb_pitch-4-i]=sum4; - } - -} diff --git a/src/lib/dl/ext/speex/ltp_bfin.h b/src/lib/dl/ext/speex/ltp_bfin.h deleted file mode 100755 index b530f859..00000000 --- a/src/lib/dl/ext/speex/ltp_bfin.h +++ /dev/null @@ -1,419 +0,0 @@ -/* Copyright (C) 2005 Analog Devices */ -/** - @file ltp_bfin.h - @author Jean-Marc Valin - @brief Long-Term Prediction functions (Blackfin version) -*/ -/* - 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. -*/ - -#define OVERRIDE_INNER_PROD -spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) -{ - spx_word32_t sum=0; - __asm__ __volatile__ ( - "P0 = %3;\n\t" - "P1 = %1;\n\t" - "P2 = %2;\n\t" - "I0 = P1;\n\t" - "I1 = P2;\n\t" - "L0 = 0;\n\t" - "L1 = 0;\n\t" - "A0 = 0;\n\t" - "R0.L = W[I0++] || R1.L = W[I1++];\n\t" - "LOOP inner%= LC0 = P0;\n\t" - "LOOP_BEGIN inner%=;\n\t" - "A0 += R0.L*R1.L (IS) || R0.L = W[I0++] || R1.L = W[I1++];\n\t" - "LOOP_END inner%=;\n\t" - "A0 += R0.L*R1.L (IS);\n\t" - "A0 = A0 >>> 6;\n\t" - "R0 = A0;\n\t" - "%0 = R0;\n\t" - : "=m" (sum) - : "m" (x), "m" (y), "d" (len-1) - : "P0", "P1", "P2", "R0", "R1", "A0", "I0", "I1", "L0", "L1", "R3" - ); - return sum; -} - -#define OVERRIDE_PITCH_XCORR -void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack) -{ - corr += nb_pitch - 1; - __asm__ __volatile__ ( - "P2 = %0;\n\t" - "I0 = P2;\n\t" /* x in I0 */ - "B0 = P2;\n\t" /* x in B0 */ - "R0 = %3;\n\t" /* len in R0 */ - "P3 = %3;\n\t" - "P3 += -2;\n\t" /* len in R0 */ - "P4 = %4;\n\t" /* nb_pitch in R0 */ - "R1 = R0 << 1;\n\t" /* number of bytes in x */ - "L0 = R1;\n\t" - "P0 = %1;\n\t" - - "P1 = %2;\n\t" - "B1 = P1;\n\t" - "L1 = 0;\n\t" /*Disable looping on I1*/ - - "r0 = [I0++];\n\t" - "LOOP pitch%= LC0 = P4 >> 1;\n\t" - "LOOP_BEGIN pitch%=;\n\t" - "I1 = P0;\n\t" - "A1 = A0 = 0;\n\t" - "R1 = [I1++];\n\t" - "LOOP inner_prod%= LC1 = P3 >> 1;\n\t" - "LOOP_BEGIN inner_prod%=;\n\t" - "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t" - "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R1.H = W[I1++] || R0 = [I0++];\n\t" - "LOOP_END inner_prod%=;\n\t" - "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t" - "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R0 = [I0++];\n\t" - "A0 = A0 >>> 6;\n\t" - "A1 = A1 >>> 6;\n\t" - "R2 = A0, R3 = A1;\n\t" - "[P1--] = r2;\n\t" - "[P1--] = r3;\n\t" - "P0 += 4;\n\t" - "LOOP_END pitch%=;\n\t" - "L0 = 0;\n\t" - : : "m" (_x), "m" (_y), "m" (corr), "m" (len), "m" (nb_pitch) - : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "I0", "I1", "L0", "L1", "B0", "B1", "memory" - ); -} - -#define OVERRIDE_COMPUTE_PITCH_ERROR -static inline spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control) -{ - spx_word32_t sum; - __asm__ __volatile__ - ( - "A0 = 0;\n\t" - - "R0 = W[%1++];\n\t" - "R1.L = %2.L*%5.L (IS);\n\t" - "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %3.L*%5.L (IS);\n\t" - "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %4.L*%5.L (IS);\n\t" - "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %2.L*%3.L (IS);\n\t" - "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %4.L*%3.L (IS);\n\t" - "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %4.L*%2.L (IS);\n\t" - "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %2.L*%2.L (IS);\n\t" - "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %3.L*%3.L (IS);\n\t" - "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - - "R1.L = %4.L*%4.L (IS);\n\t" - "A0 -= R1.L*R0.L (IS);\n\t" - - "%0 = A0;\n\t" - : "=&D" (sum), "=a" (C) - : "d" (g[0]), "d" (g[1]), "d" (g[2]), "d" (pitch_control), "1" (C) - : "R0", "R1", "R2", "A0" - ); - return sum; -} - -#define OVERRIDE_OPEN_LOOP_NBEST_PITCH -#ifdef OVERRIDE_OPEN_LOOP_NBEST_PITCH -void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack) -{ - int i,j,k; - VARDECL(spx_word32_t *best_score); - VARDECL(spx_word32_t *best_ener); - spx_word32_t e0; - VARDECL(spx_word32_t *corr); - VARDECL(spx_word32_t *energy); - - ALLOC(best_score, N, spx_word32_t); - ALLOC(best_ener, N, spx_word32_t); - ALLOC(corr, end-start+1, spx_word32_t); - ALLOC(energy, end-start+2, spx_word32_t); - - for (i=0;i<N;i++) - { - best_score[i]=-1; - best_ener[i]=0; - pitch[i]=start; - } - - energy[0]=inner_prod(sw-start, sw-start, len); - e0=inner_prod(sw, sw, len); - - /* energy update -------------------------------------*/ - - __asm__ __volatile__ - ( -" P0 = %0;\n\t" -" I1 = %1;\n\t" -" L1 = 0;\n\t" -" I2 = %2;\n\t" -" L2 = 0;\n\t" -" R2 = [P0++];\n\t" -" R3 = 0;\n\t" -" LSETUP (eu1, eu2) LC1 = %3;\n\t" -"eu1: R1.L = W [I1--] || R0.L = W [I2--] ;\n\t" -" R1 = R1.L * R1.L (IS);\n\t" -" R0 = R0.L * R0.L (IS);\n\t" -" R1 >>>= 6;\n\t" -" R1 = R1 + R2;\n\t" -" R0 >>>= 6;\n\t" -" R1 = R1 - R0;\n\t" -" R2 = MAX(R1,R3);\n\t" -"eu2: [P0++] = R2;\n\t" - : : "d" (energy), "d" (&sw[-start-1]), "d" (&sw[-start+len-1]), - "a" (end-start) - : "P0", "I1", "I2", "R0", "R1", "R2", "R3" -#if (__GNUC__ == 4) - , "LC1" -#endif - ); - - pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack); - - /* FIXME: Fixed-point and floating-point code should be merged */ - { - VARDECL(spx_word16_t *corr16); - VARDECL(spx_word16_t *ener16); - ALLOC(corr16, end-start+1, spx_word16_t); - ALLOC(ener16, end-start+1, spx_word16_t); - /* Normalize to 180 so we can square it and it still fits in 16 bits */ - normalize16(corr, corr16, 180, end-start+1); - normalize16(energy, ener16, 180, end-start+1); - - if (N == 1) { - /* optimised asm to handle N==1 case */ - __asm__ __volatile__ - ( -" I0 = %1;\n\t" /* I0: corr16[] */ -" L0 = 0;\n\t" -" I1 = %2;\n\t" /* I1: energy */ -" L1 = 0;\n\t" -" R2 = -1;\n\t" /* R2: best score */ -" R3 = 0;\n\t" /* R3: best energy */ -" P0 = %4;\n\t" /* P0: best pitch */ -" P1 = %4;\n\t" /* P1: counter */ -" LSETUP (sl1, sl2) LC1 = %3;\n\t" -"sl1: R0.L = W [I0++] || R1.L = W [I1++];\n\t" -" R0 = R0.L * R0.L (IS);\n\t" -" R1 += 1;\n\t" -" R4 = R0.L * R3.L;\n\t" -" R5 = R2.L * R1.L;\n\t" -" cc = R5 < R4;\n\t" -" if cc R2 = R0;\n\t" -" if cc R3 = R1;\n\t" -" if cc P0 = P1;\n\t" -"sl2: P1 += 1;\n\t" -" %0 = P0;\n\t" - : "=&d" (pitch[0]) - : "a" (corr16), "a" (ener16), "a" (end+1-start), "d" (start) - : "P0", "P1", "I0", "I1", "R0", "R1", "R2", "R3", "R4", "R5" -#if (__GNUC__ == 4) - , "LC1" -#endif - ); - - } - else { - for (i=start;i<=end;i++) - { - spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]); - /* Instead of dividing the tmp by the energy, we multiply on the other side */ - if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start]))) - { - /* We can safely put it last and then check */ - best_score[N-1]=tmp; - best_ener[N-1]=ener16[i-start]+1; - pitch[N-1]=i; - /* Check if it comes in front of others */ - for (j=0;j<N-1;j++) - { - if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start]))) - { - for (k=N-1;k>j;k--) - { - best_score[k]=best_score[k-1]; - best_ener[k]=best_ener[k-1]; - pitch[k]=pitch[k-1]; - } - best_score[j]=tmp; - best_ener[j]=ener16[i-start]+1; - pitch[j]=i; - break; - } - } - } - } - } - } - - /* Compute open-loop gain */ - if (gain) - { - for (j=0;j<N;j++) - { - spx_word16_t g; - i=pitch[j]; - g = DIV32(corr[i-start], 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(energy[i-start])),6)); - /* FIXME: g = max(g,corr/energy) */ - if (g<0) - g = 0; - gain[j]=g; - } - } -} -#endif - -#define OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ -#ifdef OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ -static int pitch_gain_search_3tap_vq( - const signed char *gain_cdbk, - int gain_cdbk_size, - spx_word16_t *C16, - spx_word16_t max_gain -) -{ - const signed char *ptr=gain_cdbk; - int best_cdbk=0; - spx_word32_t best_sum=-VERY_LARGE32; - spx_word32_t sum=0; - spx_word16_t g[3]; - spx_word16_t pitch_control=64; - spx_word16_t gain_sum; - int i; - - /* fast asm version of VQ codebook search */ - - __asm__ __volatile__ - ( - -" P0 = %2;\n\t" /* P0: ptr to gain_cdbk */ -" L1 = 0;\n\t" /* no circ addr for L1 */ -" %0 = 0;\n\t" /* %0: best_sum */ -" %1 = 0;\n\t" /* %1: best_cbdk */ -" P1 = 0;\n\t" /* P1: loop counter */ - -" LSETUP (pgs1, pgs2) LC1 = %4;\n\t" -"pgs1: R2 = B [P0++] (X);\n\t" /* R2: g[0] */ -" R3 = B [P0++] (X);\n\t" /* R3: g[1] */ -" R4 = B [P0++] (X);\n\t" /* R4: g[2] */ -" R2 += 32;\n\t" -" R3 += 32;\n\t" -" R4 += 32;\n\t" -" R4.H = 64;\n\t" /* R4.H: pitch_control */ - -" R0 = B [P0++] (X);\n\t" -" B0 = R0;\n\t" /* BO: gain_sum */ - - /* compute_pitch_error() -------------------------------*/ - -" I1 = %3;\n\t" /* I1: ptr to C */ -" A0 = 0;\n\t" - -" R0.L = W[I1++];\n\t" -" R1.L = R2.L*R4.H (IS);\n\t" -" A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R3.L*R4.H (IS);\n\t" -" A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R4.L*R4.H (IS);\n\t" -" A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R2.L*R3.L (IS);\n\t" -" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R4.L*R3.L (IS);\n\t" -" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R4.L*R2.L (IS);\n\t" -" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R2.L*R2.L (IS);\n\t" -" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R3.L*R3.L (IS);\n\t" -" A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - -" R1.L = R4.L*R4.L (IS);\n\t" -" R0 = (A0 -= R1.L*R0.L) (IS);\n\t" - -/* - Re-arrange the if-then to code efficiently on the Blackfin: - - if (sum>best_sum && gain_sum<=max_gain) ------ (1) - - if (sum>best_sum && !(gain_sum>max_gain)) ------ (2) - - if (max_gain<=gain_sum) { ------ (3) - sum = -VERY_LARGE32; - } - if (best_sum<=sum) - - The blackin cc instructions are all of the form: - - cc = x < y (or cc = x <= y) -*/ -" R1 = B0\n\t" -" R2 = %5\n\t" -" R3 = %6\n\t" -" cc = R2 <= R1;\n\t" -" if cc R0 = R3;\n\t" -" cc = %0 <= R0;\n\t" -" if cc %0 = R0;\n\t" -" if cc %1 = P1;\n\t" - -"pgs2: P1 += 1;\n\t" - - : "=&d" (best_sum), "=&d" (best_cdbk) - : "a" (gain_cdbk), "a" (C16), "a" (gain_cdbk_size), "a" (max_gain), - "b" (-VERY_LARGE32) - : "R0", "R1", "R2", "R3", "R4", "P0", - "P1", "I1", "L1", "A0", "B0" -#if (__GNUC__ == 4) - , "LC1" -#endif - ); - - return best_cdbk; -} -#endif - diff --git a/src/lib/dl/ext/speex/ltp_sse.h b/src/lib/dl/ext/speex/ltp_sse.h deleted file mode 100755 index bed6eaac..00000000 --- a/src/lib/dl/ext/speex/ltp_sse.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file ltp_sse.h - @brief Long-Term Prediction functions (SSE version) -*/ -/* - 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 <xmmintrin.h> - -#define OVERRIDE_INNER_PROD -float inner_prod(const float *a, const float *b, int len) -{ - int i; - float ret; - __m128 sum = _mm_setzero_ps(); - for (i=0;i<(len>>2);i+=2) - { - sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+0), _mm_loadu_ps(b+0))); - sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+4), _mm_loadu_ps(b+4))); - a += 8; - b += 8; - } - sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum)); - sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55)); - _mm_store_ss(&ret, sum); - return ret; -} - -#define OVERRIDE_PITCH_XCORR -void pitch_xcorr(const float *_x, const float *_y, float *corr, int len, int nb_pitch, char *stack) -{ - int i, offset; - VARDECL(__m128 *x); - VARDECL(__m128 *y); - int N, L; - N = len>>2; - L = nb_pitch>>2; - ALLOC(x, N, __m128); - ALLOC(y, N+L, __m128); - for (i=0;i<N;i++) - x[i] = _mm_loadu_ps(_x+(i<<2)); - for (offset=0;offset<4;offset++) - { - for (i=0;i<N+L;i++) - y[i] = _mm_loadu_ps(_y+(i<<2)+offset); - for (i=0;i<L;i++) - { - int j; - __m128 sum, *xx, *yy; - sum = _mm_setzero_ps(); - yy = y+i; - xx = x; - for (j=0;j<N;j+=2) - { - sum = _mm_add_ps(sum, _mm_mul_ps(xx[0], yy[0])); - sum = _mm_add_ps(sum, _mm_mul_ps(xx[1], yy[1])); - xx += 2; - yy += 2; - } - sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum)); - sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55)); - _mm_store_ss(corr+nb_pitch-1-(i<<2)-offset, sum); - } - } -} diff --git a/src/lib/dl/ext/speex/math_approx.h b/src/lib/dl/ext/speex/math_approx.h deleted file mode 100755 index 9ca83075..00000000 --- a/src/lib/dl/ext/speex/math_approx.h +++ /dev/null @@ -1,332 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file math_approx.h - @brief Various math approximation functions for Speex -*/ -/* - 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 MATH_APPROX_H -#define MATH_APPROX_H - -#include "arch.h" - -#ifndef FIXED_POINT - -#define spx_sqrt sqrt -#define spx_acos acos -#define spx_exp exp -#define spx_cos_norm(x) (cos((.5f*M_PI)*(x))) -#define spx_atan atan - -/** Generate a pseudo-random number */ -static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed) -{ - const unsigned int jflone = 0x3f800000; - const unsigned int jflmsk = 0x007fffff; - union {int i; float f;} ran; - *seed = 1664525 * *seed + 1013904223; - ran.i = jflone | (jflmsk & *seed); - ran.f -= 1.5; - return 3.4642*std*ran.f; -} - - -#endif - - -static inline spx_int16_t spx_ilog2(spx_uint32_t x) -{ - int r=0; - if (x>=(spx_int32_t)65536) - { - x >>= 16; - r += 16; - } - if (x>=256) - { - x >>= 8; - r += 8; - } - if (x>=16) - { - x >>= 4; - r += 4; - } - if (x>=4) - { - x >>= 2; - r += 2; - } - if (x>=2) - { - r += 1; - } - return r; -} - -static inline spx_int16_t spx_ilog4(spx_uint32_t x) -{ - int r=0; - if (x>=(spx_int32_t)65536) - { - x >>= 16; - r += 8; - } - if (x>=256) - { - x >>= 8; - r += 4; - } - if (x>=16) - { - x >>= 4; - r += 2; - } - if (x>=4) - { - r += 1; - } - return r; -} - -#ifdef FIXED_POINT - -/** Generate a pseudo-random number */ -static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed) -{ - spx_word32_t res; - *seed = 1664525 * *seed + 1013904223; - res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std); - return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14)); -} - -/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25723*x^3 (for .25 < x < 1) */ -/*#define C0 3634 -#define C1 21173 -#define C2 -12627 -#define C3 4215*/ - -/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25659*x^3 (for .25 < x < 1) */ -#define C0 3634 -#define C1 21173 -#define C2 -12627 -#define C3 4204 - -static inline spx_word16_t spx_sqrt(spx_word32_t x) -{ - int k; - spx_word32_t rt; - k = spx_ilog4(x)-6; - x = VSHR32(x, (k<<1)); - rt = ADD16(C0, MULT16_16_Q14(x, ADD16(C1, MULT16_16_Q14(x, ADD16(C2, MULT16_16_Q14(x, (C3))))))); - rt = VSHR32(rt,7-k); - return rt; -} - -/* log(x) ~= -2.18151 + 4.20592*x - 2.88938*x^2 + 0.86535*x^3 (for .5 < x < 1) */ - - -#define A1 16469 -#define A2 2242 -#define A3 1486 - -static inline spx_word16_t spx_acos(spx_word16_t x) -{ - int s=0; - spx_word16_t ret; - spx_word16_t sq; - if (x<0) - { - s=1; - x = NEG16(x); - } - x = SUB16(16384,x); - - x = x >> 1; - sq = MULT16_16_Q13(x, ADD16(A1, MULT16_16_Q13(x, ADD16(A2, MULT16_16_Q13(x, (A3)))))); - ret = spx_sqrt(SHL32(EXTEND32(sq),13)); - - /*ret = spx_sqrt(67108864*(-1.6129e-04 + 2.0104e+00*f + 2.7373e-01*f*f + 1.8136e-01*f*f*f));*/ - if (s) - ret = SUB16(25736,ret); - return ret; -} - - -#define K1 8192 -#define K2 -4096 -#define K3 340 -#define K4 -10 - -static inline spx_word16_t spx_cos(spx_word16_t x) -{ - spx_word16_t x2; - - if (x<12868) - { - x2 = MULT16_16_P13(x,x); - return ADD32(K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2)))))); - } else { - x = SUB16(25736,x); - x2 = MULT16_16_P13(x,x); - return SUB32(-K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2)))))); - } -} - -#define L1 32767 -#define L2 -7651 -#define L3 8277 -#define L4 -626 - -static inline spx_word16_t _spx_cos_pi_2(spx_word16_t x) -{ - spx_word16_t x2; - - x2 = MULT16_16_P15(x,x); - return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2)))))))); -} - -static inline spx_word16_t spx_cos_norm(spx_word32_t x) -{ - x = x&0x0001ffff; - if (x>SHL32(EXTEND32(1), 16)) - x = SUB32(SHL32(EXTEND32(1), 17),x); - if (x&0x00007fff) - { - if (x<SHL32(EXTEND32(1), 15)) - { - return _spx_cos_pi_2(EXTRACT16(x)); - } else { - return NEG32(_spx_cos_pi_2(EXTRACT16(65536-x))); - } - } else { - if (x&0x0000ffff) - return 0; - else if (x&0x0001ffff) - return -32767; - else - return 32767; - } -} - -/* - K0 = 1 - K1 = log(2) - K2 = 3-4*log(2) - K3 = 3*log(2) - 2 -*/ -#define D0 16384 -#define D1 11356 -#define D2 3726 -#define D3 1301 -/* Input in Q11 format, output in Q16 */ -static inline spx_word32_t spx_exp2(spx_word16_t x) -{ - int integer; - spx_word16_t frac; - integer = SHR16(x,11); - if (integer>14) - return 0x7fffffff; - else if (integer < -15) - return 0; - frac = SHL16(x-SHL16(integer,11),3); - frac = ADD16(D0, MULT16_16_Q14(frac, ADD16(D1, MULT16_16_Q14(frac, ADD16(D2 , MULT16_16_Q14(D3,frac)))))); - return VSHR32(EXTEND32(frac), -integer-2); -} - -/* Input in Q11 format, output in Q16 */ -static inline spx_word32_t spx_exp(spx_word16_t x) -{ - if (x>21290) - return 0x7fffffff; - else if (x<-21290) - return 0; - else - return spx_exp2(MULT16_16_P14(23637,x)); -} -#define M1 32767 -#define M2 -21 -#define M3 -11943 -#define M4 4936 - -static inline spx_word16_t spx_atan01(spx_word16_t x) -{ - return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x))))))); -} - -#undef M1 -#undef M2 -#undef M3 -#undef M4 - -/* Input in Q15, output in Q14 */ -static inline spx_word16_t spx_atan(spx_word32_t x) -{ - if (x <= 32767) - { - return SHR16(spx_atan01(x),1); - } else { - int e = spx_ilog2(x); - if (e>=29) - return 25736; - x = DIV32_16(SHL32(EXTEND32(32767),29-e), EXTRACT16(SHR32(x, e-14))); - return SUB16(25736, SHR16(spx_atan01(x),1)); - } -} -#else - -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif - -#define C1 0.9999932946f -#define C2 -0.4999124376f -#define C3 0.0414877472f -#define C4 -0.0012712095f - - -#define SPX_PI_2 1.5707963268 -static inline spx_word16_t spx_cos(spx_word16_t x) -{ - if (x<SPX_PI_2) - { - x *= x; - return C1 + x*(C2+x*(C3+C4*x)); - } else { - x = M_PI-x; - x *= x; - return NEG16(C1 + x*(C2+x*(C3+C4*x))); - } -} - -#endif - - -#endif diff --git a/src/lib/dl/ext/speex/mdf.c b/src/lib/dl/ext/speex/mdf.c deleted file mode 100755 index 456ab847..00000000 --- a/src/lib/dl/ext/speex/mdf.c +++ /dev/null @@ -1,1285 +0,0 @@ -/* Copyright (C) 2003-2008 Jean-Marc Valin - - File: mdf.c - Echo canceller based on the MDF algorithm (see below) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -/* - The echo canceller is based on the MDF algorithm described in: - - J. S. Soo, K. K. Pang Multidelay block frequency adaptive filter, - IEEE Trans. Acoust. Speech Signal Process., Vol. ASSP-38, No. 2, - February 1990. - - We use the Alternatively Updated MDF (AUMDF) variant. Robustness to - double-talk is achieved using a variable learning rate as described in: - - Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo - Cancellation With Double-Talk. IEEE Transactions on Audio, - Speech and Language Processing, Vol. 15, No. 3, pp. 1030-1034, 2007. - http://people.xiph.org/~jm/papers/valin_taslp2006.pdf - - There is no explicit double-talk detection, but a continuous variation - in the learning rate based on residual echo, double-talk and background - noise. - - About the fixed-point version: - All the signals are represented with 16-bit words. The filter weights - are represented with 32-bit words, but only the top 16 bits are used - in most cases. The lower 16 bits are completely unreliable (due to the - fact that the update is done only on the top bits), but help in the - adaptation -- probably by removing a "threshold effect" due to - quantization (rounding going to zero) when the gradient is small. - - Another kludge that seems to work good: when performing the weight - update, we only move half the way toward the "goal" this seems to - reduce the effect of quantization noise in the update phase. This - can be seen as applying a gradient descent on a "soft constraint" - instead of having a hard constraint. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "arch.h" -#include "speex/speex_echo.h" -#include "fftwrap.h" -#include "pseudofloat.h" -#include "math_approx.h" -#include "os_support.h" - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#ifdef FIXED_POINT -#define WEIGHT_SHIFT 11 -#define NORMALIZE_SCALEDOWN 5 -#define NORMALIZE_SCALEUP 3 -#else -#define WEIGHT_SHIFT 0 -#endif - -#ifdef FIXED_POINT -#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x))) -#else -#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x)))) -#endif - -/* If enabled, the AEC will use a foreground filter and a background filter to be more robust to double-talk - and difficult signals in general. The cost is an extra FFT and a matrix-vector multiply */ -#define TWO_PATH - -#ifdef FIXED_POINT -static const spx_float_t MIN_LEAK = {20972, -22}; - -/* Constants for the two-path filter */ -static const spx_float_t VAR1_SMOOTH = {23593, -16}; -static const spx_float_t VAR2_SMOOTH = {23675, -15}; -static const spx_float_t VAR1_UPDATE = {16384, -15}; -static const spx_float_t VAR2_UPDATE = {16384, -16}; -static const spx_float_t VAR_BACKTRACK = {16384, -12}; -#define TOP16(x) ((x)>>16) - -#else - -static const spx_float_t MIN_LEAK = .005f; - -/* Constants for the two-path filter */ -static const spx_float_t VAR1_SMOOTH = .36f; -static const spx_float_t VAR2_SMOOTH = .7225f; -static const spx_float_t VAR1_UPDATE = .5f; -static const spx_float_t VAR2_UPDATE = .25f; -static const spx_float_t VAR_BACKTRACK = 4.f; -#define TOP16(x) (x) -#endif - - -#define PLAYBACK_DELAY 2 - -void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *Yout, int len); - - -/** Speex echo cancellation state. */ -struct SpeexEchoState_ { - int frame_size; /**< Number of samples processed each time */ - int window_size; - int M; - int cancel_count; - int adapted; - int saturated; - int screwed_up; - int C; /** Number of input channels (microphones) */ - int K; /** Number of output channels (loudspeakers) */ - spx_int32_t sampling_rate; - spx_word16_t spec_average; - spx_word16_t beta0; - spx_word16_t beta_max; - spx_word32_t sum_adapt; - spx_word16_t leak_estimate; - - spx_word16_t *e; /* scratch */ - spx_word16_t *x; /* Far-end input buffer (2N) */ - spx_word16_t *X; /* Far-end buffer (M+1 frames) in frequency domain */ - spx_word16_t *input; /* scratch */ - spx_word16_t *y; /* scratch */ - spx_word16_t *last_y; - spx_word16_t *Y; /* scratch */ - spx_word16_t *E; - spx_word32_t *PHI; /* scratch */ - spx_word32_t *W; /* (Background) filter weights */ -#ifdef TWO_PATH - spx_word16_t *foreground; /* Foreground filter weights */ - spx_word32_t Davg1; /* 1st recursive average of the residual power difference */ - spx_word32_t Davg2; /* 2nd recursive average of the residual power difference */ - spx_float_t Dvar1; /* Estimated variance of 1st estimator */ - spx_float_t Dvar2; /* Estimated variance of 2nd estimator */ -#endif - spx_word32_t *power; /* Power of the far-end signal */ - spx_float_t *power_1;/* Inverse power of far-end */ - spx_word16_t *wtmp; /* scratch */ -#ifdef FIXED_POINT - spx_word16_t *wtmp2; /* scratch */ -#endif - spx_word32_t *Rf; /* scratch */ - spx_word32_t *Yf; /* scratch */ - spx_word32_t *Xf; /* scratch */ - spx_word32_t *Eh; - spx_word32_t *Yh; - spx_float_t Pey; - spx_float_t Pyy; - spx_word16_t *window; - spx_word16_t *prop; - void *fft_table; - spx_word16_t *memX, *memD, *memE; - spx_word16_t preemph; - spx_word16_t notch_radius; - spx_mem_t *notch_mem; - - /* NOTE: If you only use speex_echo_cancel() and want to save some memory, remove this */ - spx_int16_t *play_buf; - int play_buf_pos; - int play_buf_started; -}; - -static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, spx_word16_t *out, int len, spx_mem_t *mem, int stride) -{ - int i; - spx_word16_t den2; -#ifdef FIXED_POINT - den2 = MULT16_16_Q15(radius,radius) + MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q15(32767-radius,32767-radius)); -#else - den2 = radius*radius + .7*(1-radius)*(1-radius); -#endif - /*printf ("%d %d %d %d %d %d\n", num[0], num[1], num[2], den[0], den[1], den[2]);*/ - for (i=0;i<len;i++) - { - spx_word16_t vin = in[i*stride]; - spx_word32_t vout = mem[0] + SHL32(EXTEND32(vin),15); -#ifdef FIXED_POINT - mem[0] = mem[1] + SHL32(SHL32(-EXTEND32(vin),15) + MULT16_32_Q15(radius,vout),1); -#else - mem[0] = mem[1] + 2*(-vin + radius*vout); -#endif - mem[1] = SHL32(EXTEND32(vin),15) - MULT16_32_Q15(den2,vout); - out[i] = SATURATE32(PSHR32(MULT16_32_Q15(radius,vout),15),32767); - } -} - -/* This inner product is slightly different from the codec version because of fixed-point */ -static inline spx_word32_t mdf_inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len) -{ - spx_word32_t sum=0; - len >>= 1; - while(len--) - { - spx_word32_t part=0; - part = MAC16_16(part,*x++,*y++); - part = MAC16_16(part,*x++,*y++); - /* HINT: If you had a 40-bit accumulator, you could shift only at the end */ - sum = ADD32(sum,SHR32(part,6)); - } - return sum; -} - -/** Compute power spectrum of a half-complex (packed) vector */ -static inline void power_spectrum(const spx_word16_t *X, spx_word32_t *ps, int N) -{ - int i, j; - ps[0]=MULT16_16(X[0],X[0]); - for (i=1,j=1;i<N-1;i+=2,j++) - { - ps[j] = MULT16_16(X[i],X[i]) + MULT16_16(X[i+1],X[i+1]); - } - ps[j]=MULT16_16(X[i],X[i]); -} - -/** Compute power spectrum of a half-complex (packed) vector and accumulate */ -static inline void power_spectrum_accum(const spx_word16_t *X, spx_word32_t *ps, int N) -{ - int i, j; - ps[0]+=MULT16_16(X[0],X[0]); - for (i=1,j=1;i<N-1;i+=2,j++) - { - ps[j] += MULT16_16(X[i],X[i]) + MULT16_16(X[i+1],X[i+1]); - } - ps[j]+=MULT16_16(X[i],X[i]); -} - -/** Compute cross-power spectrum of a half-complex (packed) vectors and add to acc */ -#ifdef FIXED_POINT -static inline void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M) -{ - int i,j; - spx_word32_t tmp1=0,tmp2=0; - for (j=0;j<M;j++) - { - tmp1 = MAC16_16(tmp1, X[j*N],TOP16(Y[j*N])); - } - acc[0] = PSHR32(tmp1,WEIGHT_SHIFT); - for (i=1;i<N-1;i+=2) - { - tmp1 = tmp2 = 0; - for (j=0;j<M;j++) - { - tmp1 = SUB32(MAC16_16(tmp1, X[j*N+i],TOP16(Y[j*N+i])), MULT16_16(X[j*N+i+1],TOP16(Y[j*N+i+1]))); - tmp2 = MAC16_16(MAC16_16(tmp2, X[j*N+i+1],TOP16(Y[j*N+i])), X[j*N+i], TOP16(Y[j*N+i+1])); - } - acc[i] = PSHR32(tmp1,WEIGHT_SHIFT); - acc[i+1] = PSHR32(tmp2,WEIGHT_SHIFT); - } - tmp1 = tmp2 = 0; - for (j=0;j<M;j++) - { - tmp1 = MAC16_16(tmp1, X[(j+1)*N-1],TOP16(Y[(j+1)*N-1])); - } - acc[N-1] = PSHR32(tmp1,WEIGHT_SHIFT); -} -static inline void spectral_mul_accum16(const spx_word16_t *X, const spx_word16_t *Y, spx_word16_t *acc, int N, int M) -{ - int i,j; - spx_word32_t tmp1=0,tmp2=0; - for (j=0;j<M;j++) - { - tmp1 = MAC16_16(tmp1, X[j*N],Y[j*N]); - } - acc[0] = PSHR32(tmp1,WEIGHT_SHIFT); - for (i=1;i<N-1;i+=2) - { - tmp1 = tmp2 = 0; - for (j=0;j<M;j++) - { - tmp1 = SUB32(MAC16_16(tmp1, X[j*N+i],Y[j*N+i]), MULT16_16(X[j*N+i+1],Y[j*N+i+1])); - tmp2 = MAC16_16(MAC16_16(tmp2, X[j*N+i+1],Y[j*N+i]), X[j*N+i], Y[j*N+i+1]); - } - acc[i] = PSHR32(tmp1,WEIGHT_SHIFT); - acc[i+1] = PSHR32(tmp2,WEIGHT_SHIFT); - } - tmp1 = tmp2 = 0; - for (j=0;j<M;j++) - { - tmp1 = MAC16_16(tmp1, X[(j+1)*N-1],Y[(j+1)*N-1]); - } - acc[N-1] = PSHR32(tmp1,WEIGHT_SHIFT); -} - -#else -static inline void spectral_mul_accum(const spx_word16_t *X, const spx_word32_t *Y, spx_word16_t *acc, int N, int M) -{ - int i,j; - for (i=0;i<N;i++) - acc[i] = 0; - for (j=0;j<M;j++) - { - acc[0] += X[0]*Y[0]; - for (i=1;i<N-1;i+=2) - { - acc[i] += (X[i]*Y[i] - X[i+1]*Y[i+1]); - acc[i+1] += (X[i+1]*Y[i] + X[i]*Y[i+1]); - } - acc[i] += X[i]*Y[i]; - X += N; - Y += N; - } -} -#define spectral_mul_accum16 spectral_mul_accum -#endif - -/** Compute weighted cross-power spectrum of a half-complex (packed) vector with conjugate */ -static inline void weighted_spectral_mul_conj(const spx_float_t *w, const spx_float_t p, const spx_word16_t *X, const spx_word16_t *Y, spx_word32_t *prod, int N) -{ - int i, j; - spx_float_t W; - W = FLOAT_AMULT(p, w[0]); - prod[0] = FLOAT_MUL32(W,MULT16_16(X[0],Y[0])); - for (i=1,j=1;i<N-1;i+=2,j++) - { - W = FLOAT_AMULT(p, w[j]); - prod[i] = FLOAT_MUL32(W,MAC16_16(MULT16_16(X[i],Y[i]), X[i+1],Y[i+1])); - prod[i+1] = FLOAT_MUL32(W,MAC16_16(MULT16_16(-X[i+1],Y[i]), X[i],Y[i+1])); - } - W = FLOAT_AMULT(p, w[j]); - prod[i] = FLOAT_MUL32(W,MULT16_16(X[i],Y[i])); -} - -static inline void mdf_adjust_prop(const spx_word32_t *W, int N, int M, int P, spx_word16_t *prop) -{ - int i, j, p; - spx_word16_t max_sum = 1; - spx_word32_t prop_sum = 1; - for (i=0;i<M;i++) - { - spx_word32_t tmp = 1; - for (p=0;p<P;p++) - for (j=0;j<N;j++) - tmp += MULT16_16(EXTRACT16(SHR32(W[p*N*M + i*N+j],18)), EXTRACT16(SHR32(W[p*N*M + i*N+j],18))); -#ifdef FIXED_POINT - /* Just a security in case an overflow were to occur */ - tmp = MIN32(ABS32(tmp), 536870912); -#endif - prop[i] = spx_sqrt(tmp); - if (prop[i] > max_sum) - max_sum = prop[i]; - } - for (i=0;i<M;i++) - { - prop[i] += MULT16_16_Q15(QCONST16(.1f,15),max_sum); - prop_sum += EXTEND32(prop[i]); - } - for (i=0;i<M;i++) - { - prop[i] = DIV32(MULT16_16(QCONST16(.99f,15), prop[i]),prop_sum); - /*printf ("%f ", prop[i]);*/ - } - /*printf ("\n");*/ -} - -#ifdef DUMP_ECHO_CANCEL_DATA -#include <stdio.h> -static FILE *rFile=NULL, *pFile=NULL, *oFile=NULL; - -static void dump_audio(const spx_int16_t *rec, const spx_int16_t *play, const spx_int16_t *out, int len) -{ - if (!(rFile && pFile && oFile)) - { - speex_fatal("Dump files not open"); - } - fwrite(rec, sizeof(spx_int16_t), len, rFile); - fwrite(play, sizeof(spx_int16_t), len, pFile); - fwrite(out, sizeof(spx_int16_t), len, oFile); -} -#endif - -/** Creates a new echo canceller state */ -EXPORT SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length) -{ - return speex_echo_state_init_mc(frame_size, filter_length, 1, 1); -} - -EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers) -{ - int i,N,M, C, K; - SpeexEchoState *st = (SpeexEchoState *)speex_alloc(sizeof(SpeexEchoState)); - - st->K = nb_speakers; - st->C = nb_mic; - C=st->C; - K=st->K; -#ifdef DUMP_ECHO_CANCEL_DATA - if (rFile || pFile || oFile) - speex_fatal("Opening dump files twice"); - rFile = fopen("aec_rec.sw", "wb"); - pFile = fopen("aec_play.sw", "wb"); - oFile = fopen("aec_out.sw", "wb"); -#endif - - st->frame_size = frame_size; - st->window_size = 2*frame_size; - N = st->window_size; - M = st->M = (filter_length+st->frame_size-1)/frame_size; - st->cancel_count=0; - st->sum_adapt = 0; - st->saturated = 0; - st->screwed_up = 0; - /* This is the default sampling rate */ - st->sampling_rate = 8000; - st->spec_average = DIV32_16(SHL32(EXTEND32(st->frame_size), 15), st->sampling_rate); -#ifdef FIXED_POINT - st->beta0 = DIV32_16(SHL32(EXTEND32(st->frame_size), 16), st->sampling_rate); - st->beta_max = DIV32_16(SHL32(EXTEND32(st->frame_size), 14), st->sampling_rate); -#else - st->beta0 = (2.0f*st->frame_size)/st->sampling_rate; - st->beta_max = (.5f*st->frame_size)/st->sampling_rate; -#endif - st->leak_estimate = 0; - - st->fft_table = spx_fft_init(N); - - st->e = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t)); - st->x = (spx_word16_t*)speex_alloc(K*N*sizeof(spx_word16_t)); - st->input = (spx_word16_t*)speex_alloc(C*st->frame_size*sizeof(spx_word16_t)); - st->y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t)); - st->last_y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t)); - st->Yf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t)); - st->Rf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t)); - st->Xf = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t)); - st->Yh = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t)); - st->Eh = (spx_word32_t*)speex_alloc((st->frame_size+1)*sizeof(spx_word32_t)); - - st->X = (spx_word16_t*)speex_alloc(K*(M+1)*N*sizeof(spx_word16_t)); - st->Y = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t)); - st->E = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t)); - st->W = (spx_word32_t*)speex_alloc(C*K*M*N*sizeof(spx_word32_t)); -#ifdef TWO_PATH - st->foreground = (spx_word16_t*)speex_alloc(M*N*C*K*sizeof(spx_word16_t)); -#endif - st->PHI = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t)); - st->power = (spx_word32_t*)speex_alloc((frame_size+1)*sizeof(spx_word32_t)); - st->power_1 = (spx_float_t*)speex_alloc((frame_size+1)*sizeof(spx_float_t)); - st->window = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t)); - st->prop = (spx_word16_t*)speex_alloc(M*sizeof(spx_word16_t)); - st->wtmp = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t)); -#ifdef FIXED_POINT - st->wtmp2 = (spx_word16_t*)speex_alloc(N*sizeof(spx_word16_t)); - for (i=0;i<N>>1;i++) - { - st->window[i] = (16383-SHL16(spx_cos(DIV32_16(MULT16_16(25736,i<<1),N)),1)); - st->window[N-i-1] = st->window[i]; - } -#else - for (i=0;i<N;i++) - st->window[i] = .5-.5*cos(2*M_PI*i/N); -#endif - for (i=0;i<=st->frame_size;i++) - st->power_1[i] = FLOAT_ONE; - for (i=0;i<N*M*K*C;i++) - st->W[i] = 0; - { - spx_word32_t sum = 0; - /* Ratio of ~10 between adaptation rate of first and last block */ - spx_word16_t decay = SHR32(spx_exp(NEG16(DIV32_16(QCONST16(2.4,11),M))),1); - st->prop[0] = QCONST16(.7, 15); - sum = EXTEND32(st->prop[0]); - for (i=1;i<M;i++) - { - st->prop[i] = MULT16_16_Q15(st->prop[i-1], decay); - sum = ADD32(sum, EXTEND32(st->prop[i])); - } - for (i=M-1;i>=0;i--) - { - st->prop[i] = DIV32(MULT16_16(QCONST16(.8f,15), st->prop[i]),sum); - } - } - - st->memX = (spx_word16_t*)speex_alloc(K*sizeof(spx_word16_t)); - st->memD = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t)); - st->memE = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t)); - st->preemph = QCONST16(.9,15); - if (st->sampling_rate<12000) - st->notch_radius = QCONST16(.9, 15); - else if (st->sampling_rate<24000) - st->notch_radius = QCONST16(.982, 15); - else - st->notch_radius = QCONST16(.992, 15); - - st->notch_mem = (spx_mem_t*)speex_alloc(2*C*sizeof(spx_mem_t)); - st->adapted = 0; - st->Pey = st->Pyy = FLOAT_ONE; - -#ifdef TWO_PATH - st->Davg1 = st->Davg2 = 0; - st->Dvar1 = st->Dvar2 = FLOAT_ZERO; -#endif - - st->play_buf = (spx_int16_t*)speex_alloc(K*(PLAYBACK_DELAY+1)*st->frame_size*sizeof(spx_int16_t)); - st->play_buf_pos = PLAYBACK_DELAY*st->frame_size; - st->play_buf_started = 0; - - return st; -} - -/** Resets echo canceller state */ -EXPORT void speex_echo_state_reset(SpeexEchoState *st) -{ - int i, M, N, C, K; - st->cancel_count=0; - st->screwed_up = 0; - N = st->window_size; - M = st->M; - C=st->C; - K=st->K; - for (i=0;i<N*M;i++) - st->W[i] = 0; -#ifdef TWO_PATH - for (i=0;i<N*M;i++) - st->foreground[i] = 0; -#endif - for (i=0;i<N*(M+1);i++) - st->X[i] = 0; - for (i=0;i<=st->frame_size;i++) - { - st->power[i] = 0; - st->power_1[i] = FLOAT_ONE; - st->Eh[i] = 0; - st->Yh[i] = 0; - } - for (i=0;i<st->frame_size;i++) - { - st->last_y[i] = 0; - } - for (i=0;i<N*C;i++) - { - st->E[i] = 0; - } - for (i=0;i<N*K;i++) - { - st->x[i] = 0; - } - for (i=0;i<2*C;i++) - st->notch_mem[i] = 0; - for (i=0;i<C;i++) - st->memD[i]=st->memE[i]=0; - for (i=0;i<K;i++) - st->memX[i]=0; - - st->saturated = 0; - st->adapted = 0; - st->sum_adapt = 0; - st->Pey = st->Pyy = FLOAT_ONE; -#ifdef TWO_PATH - st->Davg1 = st->Davg2 = 0; - st->Dvar1 = st->Dvar2 = FLOAT_ZERO; -#endif - for (i=0;i<3*st->frame_size;i++) - st->play_buf[i] = 0; - st->play_buf_pos = PLAYBACK_DELAY*st->frame_size; - st->play_buf_started = 0; - -} - -/** Destroys an echo canceller state */ -EXPORT void speex_echo_state_destroy(SpeexEchoState *st) -{ - spx_fft_destroy(st->fft_table); - - speex_free(st->e); - speex_free(st->x); - speex_free(st->input); - speex_free(st->y); - speex_free(st->last_y); - speex_free(st->Yf); - speex_free(st->Rf); - speex_free(st->Xf); - speex_free(st->Yh); - speex_free(st->Eh); - - speex_free(st->X); - speex_free(st->Y); - speex_free(st->E); - speex_free(st->W); -#ifdef TWO_PATH - speex_free(st->foreground); -#endif - speex_free(st->PHI); - speex_free(st->power); - speex_free(st->power_1); - speex_free(st->window); - speex_free(st->prop); - speex_free(st->wtmp); -#ifdef FIXED_POINT - speex_free(st->wtmp2); -#endif - speex_free(st->memX); - speex_free(st->memD); - speex_free(st->memE); - speex_free(st->notch_mem); - - speex_free(st->play_buf); - speex_free(st); - -#ifdef DUMP_ECHO_CANCEL_DATA - fclose(rFile); - fclose(pFile); - fclose(oFile); - rFile = pFile = oFile = NULL; -#endif -} - -EXPORT void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out) -{ - int i; - /*speex_warning_int("capture with fill level ", st->play_buf_pos/st->frame_size);*/ - st->play_buf_started = 1; - if (st->play_buf_pos>=st->frame_size) - { - speex_echo_cancellation(st, rec, st->play_buf, out); - st->play_buf_pos -= st->frame_size; - for (i=0;i<st->play_buf_pos;i++) - st->play_buf[i] = st->play_buf[i+st->frame_size]; - } else { - speex_warning("No playback frame available (your application is buggy and/or got xruns)"); - if (st->play_buf_pos!=0) - { - speex_warning("internal playback buffer corruption?"); - st->play_buf_pos = 0; - } - for (i=0;i<st->frame_size;i++) - out[i] = rec[i]; - } -} - -EXPORT void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play) -{ - /*speex_warning_int("playback with fill level ", st->play_buf_pos/st->frame_size);*/ - if (!st->play_buf_started) - { - speex_warning("discarded first playback frame"); - return; - } - if (st->play_buf_pos<=PLAYBACK_DELAY*st->frame_size) - { - int i; - for (i=0;i<st->frame_size;i++) - st->play_buf[st->play_buf_pos+i] = play[i]; - st->play_buf_pos += st->frame_size; - if (st->play_buf_pos <= (PLAYBACK_DELAY-1)*st->frame_size) - { - speex_warning("Auto-filling the buffer (your application is buggy and/or got xruns)"); - for (i=0;i<st->frame_size;i++) - st->play_buf[st->play_buf_pos+i] = play[i]; - st->play_buf_pos += st->frame_size; - } - } else { - speex_warning("Had to discard a playback frame (your application is buggy and/or got xruns)"); - } -} - -/** Performs echo cancellation on a frame (deprecated, last arg now ignored) */ -EXPORT void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out, spx_int32_t *Yout) -{ - speex_echo_cancellation(st, in, far_end, out); -} - -/** Performs echo cancellation on a frame */ -EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out) -{ - int i,j, chan, speak; - int N,M, C, K; - spx_word32_t Syy,See,Sxx,Sdd, Sff; -#ifdef TWO_PATH - spx_word32_t Dbf; - int update_foreground; -#endif - spx_word32_t Sey; - spx_word16_t ss, ss_1; - spx_float_t Pey = FLOAT_ONE, Pyy=FLOAT_ONE; - spx_float_t alpha, alpha_1; - spx_word16_t RER; - spx_word32_t tmp32; - - N = st->window_size; - M = st->M; - C = st->C; - K = st->K; - - st->cancel_count++; -#ifdef FIXED_POINT - ss=DIV32_16(11469,M); - ss_1 = SUB16(32767,ss); -#else - ss=.35/M; - ss_1 = 1-ss; -#endif - - for (chan = 0; chan < C; chan++) - { - /* Apply a notch filter to make sure DC doesn't end up causing problems */ - filter_dc_notch16(in+chan, st->notch_radius, st->input+chan*st->frame_size, st->frame_size, st->notch_mem+2*chan, C); - /* Copy input data to buffer and apply pre-emphasis */ - /* Copy input data to buffer */ - for (i=0;i<st->frame_size;i++) - { - spx_word32_t tmp32; - /* FIXME: This core has changed a bit, need to merge properly */ - tmp32 = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(MULT16_16_P15(st->preemph, st->memD[chan]))); -#ifdef FIXED_POINT - if (tmp32 > 32767) - { - tmp32 = 32767; - if (st->saturated == 0) - st->saturated = 1; - } - if (tmp32 < -32767) - { - tmp32 = -32767; - if (st->saturated == 0) - st->saturated = 1; - } -#endif - st->memD[chan] = st->input[chan*st->frame_size+i]; - st->input[chan*st->frame_size+i] = EXTRACT16(tmp32); - } - } - - for (speak = 0; speak < K; speak++) - { - for (i=0;i<st->frame_size;i++) - { - spx_word32_t tmp32; - st->x[speak*N+i] = st->x[speak*N+i+st->frame_size]; - tmp32 = SUB32(EXTEND32(far_end[i*K+speak]), EXTEND32(MULT16_16_P15(st->preemph, st->memX[speak]))); -#ifdef FIXED_POINT - /*FIXME: If saturation occurs here, we need to freeze adaptation for M frames (not just one) */ - if (tmp32 > 32767) - { - tmp32 = 32767; - st->saturated = M+1; - } - if (tmp32 < -32767) - { - tmp32 = -32767; - st->saturated = M+1; - } -#endif - st->x[speak*N+i+st->frame_size] = EXTRACT16(tmp32); - st->memX[speak] = far_end[i*K+speak]; - } - } - - for (speak = 0; speak < K; speak++) - { - /* Shift memory: this could be optimized eventually*/ - for (j=M-1;j>=0;j--) - { - for (i=0;i<N;i++) - st->X[(j+1)*N*K+speak*N+i] = st->X[j*N*K+speak*N+i]; - } - /* Convert x (echo input) to frequency domain */ - spx_fft(st->fft_table, st->x+speak*N, &st->X[speak*N]); - } - - Sxx = 0; - for (speak = 0; speak < K; speak++) - { - Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size); - power_spectrum_accum(st->X+speak*N, st->Xf, N); - } - - Sff = 0; - for (chan = 0; chan < C; chan++) - { -#ifdef TWO_PATH - /* Compute foreground filter */ - spectral_mul_accum16(st->X, st->foreground+chan*N*K*M, st->Y+chan*N, N, M*K); - spx_ifft(st->fft_table, st->Y+chan*N, st->e+chan*N); - for (i=0;i<st->frame_size;i++) - st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->e[chan*N+i+st->frame_size]); - Sff += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); -#endif - } - - /* Adjust proportional adaption rate */ - /* FIXME: Adjust that for C, K*/ - if (st->adapted) - mdf_adjust_prop (st->W, N, M, C*K, st->prop); - /* Compute weight gradient */ - if (st->saturated == 0) - { - for (chan = 0; chan < C; chan++) - { - for (speak = 0; speak < K; speak++) - { - for (j=M-1;j>=0;j--) - { - weighted_spectral_mul_conj(st->power_1, FLOAT_SHL(PSEUDOFLOAT(st->prop[j]),-15), &st->X[(j+1)*N*K+speak*N], st->E+chan*N, st->PHI, N); - for (i=0;i<N;i++) - st->W[chan*N*K*M + j*N*K + speak*N + i] += st->PHI[i]; - } - } - } - } else { - st->saturated--; - } - - /* FIXME: MC conversion required */ - /* Update weight to prevent circular convolution (MDF / AUMDF) */ - for (chan = 0; chan < C; chan++) - { - for (speak = 0; speak < K; speak++) - { - for (j=0;j<M;j++) - { - /* This is a variant of the Alternatively Updated MDF (AUMDF) */ - /* Remove the "if" to make this an MDF filter */ - if (j==0 || st->cancel_count%(M-1) == j-1) - { -#ifdef FIXED_POINT - for (i=0;i<N;i++) - st->wtmp2[i] = EXTRACT16(PSHR32(st->W[chan*N*K*M + j*N*K + speak*N + i],NORMALIZE_SCALEDOWN+16)); - spx_ifft(st->fft_table, st->wtmp2, st->wtmp); - for (i=0;i<st->frame_size;i++) - { - st->wtmp[i]=0; - } - for (i=st->frame_size;i<N;i++) - { - st->wtmp[i]=SHL16(st->wtmp[i],NORMALIZE_SCALEUP); - } - spx_fft(st->fft_table, st->wtmp, st->wtmp2); - /* The "-1" in the shift is a sort of kludge that trades less efficient update speed for decrease noise */ - for (i=0;i<N;i++) - st->W[chan*N*K*M + j*N*K + speak*N + i] -= SHL32(EXTEND32(st->wtmp2[i]),16+NORMALIZE_SCALEDOWN-NORMALIZE_SCALEUP-1); -#else - spx_ifft(st->fft_table, &st->W[chan*N*K*M + j*N*K + speak*N], st->wtmp); - for (i=st->frame_size;i<N;i++) - { - st->wtmp[i]=0; - } - spx_fft(st->fft_table, st->wtmp, &st->W[chan*N*K*M + j*N*K + speak*N]); -#endif - } - } - } - } - - /* So we can use power_spectrum_accum */ - for (i=0;i<=st->frame_size;i++) - st->Rf[i] = st->Yf[i] = st->Xf[i] = 0; - - Dbf = 0; - See = 0; -#ifdef TWO_PATH - /* Difference in response, this is used to estimate the variance of our residual power estimate */ - for (chan = 0; chan < C; chan++) - { - spectral_mul_accum(st->X, st->W+chan*N*K*M, st->Y+chan*N, N, M*K); - spx_ifft(st->fft_table, st->Y+chan*N, st->y+chan*N); - for (i=0;i<st->frame_size;i++) - st->e[chan*N+i] = SUB16(st->e[chan*N+i+st->frame_size], st->y[chan*N+i+st->frame_size]); - Dbf += 10+mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); - for (i=0;i<st->frame_size;i++) - st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]); - See += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); - } -#endif - -#ifndef TWO_PATH - Sff = See; -#endif - -#ifdef TWO_PATH - /* Logic for updating the foreground filter */ - - /* For two time windows, compute the mean of the energy difference, as well as the variance */ - st->Davg1 = ADD32(MULT16_32_Q15(QCONST16(.6f,15),st->Davg1), MULT16_32_Q15(QCONST16(.4f,15),SUB32(Sff,See))); - st->Davg2 = ADD32(MULT16_32_Q15(QCONST16(.85f,15),st->Davg2), MULT16_32_Q15(QCONST16(.15f,15),SUB32(Sff,See))); - st->Dvar1 = FLOAT_ADD(FLOAT_MULT(VAR1_SMOOTH, st->Dvar1), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.4f,15),Sff), MULT16_32_Q15(QCONST16(.4f,15),Dbf))); - st->Dvar2 = FLOAT_ADD(FLOAT_MULT(VAR2_SMOOTH, st->Dvar2), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.15f,15),Sff), MULT16_32_Q15(QCONST16(.15f,15),Dbf))); - - /* Equivalent float code: - st->Davg1 = .6*st->Davg1 + .4*(Sff-See); - st->Davg2 = .85*st->Davg2 + .15*(Sff-See); - st->Dvar1 = .36*st->Dvar1 + .16*Sff*Dbf; - st->Dvar2 = .7225*st->Dvar2 + .0225*Sff*Dbf; - */ - - update_foreground = 0; - /* Check if we have a statistically significant reduction in the residual echo */ - /* Note that this is *not* Gaussian, so we need to be careful about the longer tail */ - if (FLOAT_GT(FLOAT_MUL32U(SUB32(Sff,See),ABS32(SUB32(Sff,See))), FLOAT_MUL32U(Sff,Dbf))) - update_foreground = 1; - else if (FLOAT_GT(FLOAT_MUL32U(st->Davg1, ABS32(st->Davg1)), FLOAT_MULT(VAR1_UPDATE,(st->Dvar1)))) - update_foreground = 1; - else if (FLOAT_GT(FLOAT_MUL32U(st->Davg2, ABS32(st->Davg2)), FLOAT_MULT(VAR2_UPDATE,(st->Dvar2)))) - update_foreground = 1; - - /* Do we update? */ - if (update_foreground) - { - st->Davg1 = st->Davg2 = 0; - st->Dvar1 = st->Dvar2 = FLOAT_ZERO; - /* Copy background filter to foreground filter */ - for (i=0;i<N*M*C*K;i++) - st->foreground[i] = EXTRACT16(PSHR32(st->W[i],16)); - /* Apply a smooth transition so as to not introduce blocking artifacts */ - for (chan = 0; chan < C; chan++) - for (i=0;i<st->frame_size;i++) - st->e[chan*N+i+st->frame_size] = MULT16_16_Q15(st->window[i+st->frame_size],st->e[chan*N+i+st->frame_size]) + MULT16_16_Q15(st->window[i],st->y[chan*N+i+st->frame_size]); - } else { - int reset_background=0; - /* Otherwise, check if the background filter is significantly worse */ - if (FLOAT_GT(FLOAT_MUL32U(NEG32(SUB32(Sff,See)),ABS32(SUB32(Sff,See))), FLOAT_MULT(VAR_BACKTRACK,FLOAT_MUL32U(Sff,Dbf)))) - reset_background = 1; - if (FLOAT_GT(FLOAT_MUL32U(NEG32(st->Davg1), ABS32(st->Davg1)), FLOAT_MULT(VAR_BACKTRACK,st->Dvar1))) - reset_background = 1; - if (FLOAT_GT(FLOAT_MUL32U(NEG32(st->Davg2), ABS32(st->Davg2)), FLOAT_MULT(VAR_BACKTRACK,st->Dvar2))) - reset_background = 1; - if (reset_background) - { - /* Copy foreground filter to background filter */ - for (i=0;i<N*M*C*K;i++) - st->W[i] = SHL32(EXTEND32(st->foreground[i]),16); - /* We also need to copy the output so as to get correct adaptation */ - for (chan = 0; chan < C; chan++) - { - for (i=0;i<st->frame_size;i++) - st->y[chan*N+i+st->frame_size] = st->e[chan*N+i+st->frame_size]; - for (i=0;i<st->frame_size;i++) - st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]); - } - See = Sff; - st->Davg1 = st->Davg2 = 0; - st->Dvar1 = st->Dvar2 = FLOAT_ZERO; - } - } -#endif - - Sey = Syy = Sdd = 0; - for (chan = 0; chan < C; chan++) - { - /* Compute error signal (for the output with de-emphasis) */ - for (i=0;i<st->frame_size;i++) - { - spx_word32_t tmp_out; -#ifdef TWO_PATH - tmp_out = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(st->e[chan*N+i+st->frame_size])); -#else - tmp_out = SUB32(EXTEND32(st->input[chan*st->frame_size+i]), EXTEND32(st->y[chan*N+i+st->frame_size])); -#endif - tmp_out = ADD32(tmp_out, EXTEND32(MULT16_16_P15(st->preemph, st->memE[chan]))); - /* This is an arbitrary test for saturation in the microphone signal */ - if (in[i*C+chan] <= -32000 || in[i*C+chan] >= 32000) - { - if (st->saturated == 0) - st->saturated = 1; - } - out[i*C+chan] = WORD2INT(tmp_out); - st->memE[chan] = tmp_out; - } - -#ifdef DUMP_ECHO_CANCEL_DATA - dump_audio(in, far_end, out, st->frame_size); -#endif - - /* Compute error signal (filter update version) */ - for (i=0;i<st->frame_size;i++) - { - st->e[chan*N+i+st->frame_size] = st->e[chan*N+i]; - st->e[chan*N+i] = 0; - } - - /* Compute a bunch of correlations */ - /* FIXME: bad merge */ - Sey += mdf_inner_prod(st->e+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size); - Syy += mdf_inner_prod(st->y+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size); - Sdd += mdf_inner_prod(st->input+chan*st->frame_size, st->input+chan*st->frame_size, st->frame_size); - - /* Convert error to frequency domain */ - spx_fft(st->fft_table, st->e+chan*N, st->E+chan*N); - for (i=0;i<st->frame_size;i++) - st->y[i+chan*N] = 0; - spx_fft(st->fft_table, st->y+chan*N, st->Y+chan*N); - - /* Compute power spectrum of echo (X), error (E) and filter response (Y) */ - power_spectrum_accum(st->E+chan*N, st->Rf, N); - power_spectrum_accum(st->Y+chan*N, st->Yf, N); - - } - - /*printf ("%f %f %f %f\n", Sff, See, Syy, Sdd, st->update_cond);*/ - - /* Do some sanity check */ - if (!(Syy>=0 && Sxx>=0 && See >= 0) -#ifndef FIXED_POINT - || !(Sff < N*1e9 && Syy < N*1e9 && Sxx < N*1e9) -#endif - ) - { - /* Things have gone really bad */ - st->screwed_up += 50; - for (i=0;i<st->frame_size*C;i++) - out[i] = 0; - } else if (SHR32(Sff, 2) > ADD32(Sdd, SHR32(MULT16_16(N, 10000),6))) - { - /* AEC seems to add lots of echo instead of removing it, let's see if it will improve */ - st->screwed_up++; - } else { - /* Everything's fine */ - st->screwed_up=0; - } - if (st->screwed_up>=50) - { - speex_warning("The echo canceller started acting funny and got slapped (reset). It swears it will behave now."); - speex_echo_state_reset(st); - return; - } - - /* Add a small noise floor to make sure not to have problems when dividing */ - See = MAX32(See, SHR32(MULT16_16(N, 100),6)); - - for (speak = 0; speak < K; speak++) - { - Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size); - power_spectrum_accum(st->X+speak*N, st->Xf, N); - } - - - /* Smooth far end energy estimate over time */ - for (j=0;j<=st->frame_size;j++) - st->power[j] = MULT16_32_Q15(ss_1,st->power[j]) + 1 + MULT16_32_Q15(ss,st->Xf[j]); - - /* Compute filtered spectra and (cross-)correlations */ - for (j=st->frame_size;j>=0;j--) - { - spx_float_t Eh, Yh; - Eh = PSEUDOFLOAT(st->Rf[j] - st->Eh[j]); - Yh = PSEUDOFLOAT(st->Yf[j] - st->Yh[j]); - Pey = FLOAT_ADD(Pey,FLOAT_MULT(Eh,Yh)); - Pyy = FLOAT_ADD(Pyy,FLOAT_MULT(Yh,Yh)); -#ifdef FIXED_POINT - st->Eh[j] = MAC16_32_Q15(MULT16_32_Q15(SUB16(32767,st->spec_average),st->Eh[j]), st->spec_average, st->Rf[j]); - st->Yh[j] = MAC16_32_Q15(MULT16_32_Q15(SUB16(32767,st->spec_average),st->Yh[j]), st->spec_average, st->Yf[j]); -#else - st->Eh[j] = (1-st->spec_average)*st->Eh[j] + st->spec_average*st->Rf[j]; - st->Yh[j] = (1-st->spec_average)*st->Yh[j] + st->spec_average*st->Yf[j]; -#endif - } - - Pyy = FLOAT_SQRT(Pyy); - Pey = FLOAT_DIVU(Pey,Pyy); - - /* Compute correlation updatete rate */ - tmp32 = MULT16_32_Q15(st->beta0,Syy); - if (tmp32 > MULT16_32_Q15(st->beta_max,See)) - tmp32 = MULT16_32_Q15(st->beta_max,See); - alpha = FLOAT_DIV32(tmp32, See); - alpha_1 = FLOAT_SUB(FLOAT_ONE, alpha); - /* Update correlations (recursive average) */ - st->Pey = FLOAT_ADD(FLOAT_MULT(alpha_1,st->Pey) , FLOAT_MULT(alpha,Pey)); - st->Pyy = FLOAT_ADD(FLOAT_MULT(alpha_1,st->Pyy) , FLOAT_MULT(alpha,Pyy)); - if (FLOAT_LT(st->Pyy, FLOAT_ONE)) - st->Pyy = FLOAT_ONE; - /* We don't really hope to get better than 33 dB (MIN_LEAK-3dB) attenuation anyway */ - if (FLOAT_LT(st->Pey, FLOAT_MULT(MIN_LEAK,st->Pyy))) - st->Pey = FLOAT_MULT(MIN_LEAK,st->Pyy); - if (FLOAT_GT(st->Pey, st->Pyy)) - st->Pey = st->Pyy; - /* leak_estimate is the linear regression result */ - st->leak_estimate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIVU(st->Pey, st->Pyy),14)); - /* This looks like a stupid bug, but it's right (because we convert from Q14 to Q15) */ - if (st->leak_estimate > 16383) - st->leak_estimate = 32767; - else - st->leak_estimate = SHL16(st->leak_estimate,1); - /*printf ("%f\n", st->leak_estimate);*/ - - /* Compute Residual to Error Ratio */ -#ifdef FIXED_POINT - tmp32 = MULT16_32_Q15(st->leak_estimate,Syy); - tmp32 = ADD32(SHR32(Sxx,13), ADD32(tmp32, SHL32(tmp32,1))); - /* Check for y in e (lower bound on RER) */ - { - spx_float_t bound = PSEUDOFLOAT(Sey); - bound = FLOAT_DIVU(FLOAT_MULT(bound, bound), PSEUDOFLOAT(ADD32(1,Syy))); - if (FLOAT_GT(bound, PSEUDOFLOAT(See))) - tmp32 = See; - else if (tmp32 < FLOAT_EXTRACT32(bound)) - tmp32 = FLOAT_EXTRACT32(bound); - } - if (tmp32 > SHR32(See,1)) - tmp32 = SHR32(See,1); - RER = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32,See),15)); -#else - RER = (.0001*Sxx + 3.*MULT16_32_Q15(st->leak_estimate,Syy)) / See; - /* Check for y in e (lower bound on RER) */ - if (RER < Sey*Sey/(1+See*Syy)) - RER = Sey*Sey/(1+See*Syy); - if (RER > .5) - RER = .5; -#endif - - /* We consider that the filter has had minimal adaptation if the following is true*/ - if (!st->adapted && st->sum_adapt > SHL32(EXTEND32(M),15) && MULT16_32_Q15(st->leak_estimate,Syy) > MULT16_32_Q15(QCONST16(.03f,15),Syy)) - { - st->adapted = 1; - } - - if (st->adapted) - { - /* Normal learning rate calculation once we're past the minimal adaptation phase */ - for (i=0;i<=st->frame_size;i++) - { - spx_word32_t r, e; - /* Compute frequency-domain adaptation mask */ - r = MULT16_32_Q15(st->leak_estimate,SHL32(st->Yf[i],3)); - e = SHL32(st->Rf[i],3)+1; -#ifdef FIXED_POINT - if (r>SHR32(e,1)) - r = SHR32(e,1); -#else - if (r>.5*e) - r = .5*e; -#endif - r = MULT16_32_Q15(QCONST16(.7,15),r) + MULT16_32_Q15(QCONST16(.3,15),(spx_word32_t)(MULT16_32_Q15(RER,e))); - /*st->power_1[i] = adapt_rate*r/(e*(1+st->power[i]));*/ - st->power_1[i] = FLOAT_SHL(FLOAT_DIV32_FLOAT(r,FLOAT_MUL32U(e,st->power[i]+10)),WEIGHT_SHIFT+16); - } - } else { - /* Temporary adaption rate if filter is not yet adapted enough */ - spx_word16_t adapt_rate=0; - - if (Sxx > SHR32(MULT16_16(N, 1000),6)) - { - tmp32 = MULT16_32_Q15(QCONST16(.25f, 15), Sxx); -#ifdef FIXED_POINT - if (tmp32 > SHR32(See,2)) - tmp32 = SHR32(See,2); -#else - if (tmp32 > .25*See) - tmp32 = .25*See; -#endif - adapt_rate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32, See),15)); - } - for (i=0;i<=st->frame_size;i++) - st->power_1[i] = FLOAT_SHL(FLOAT_DIV32(EXTEND32(adapt_rate),ADD32(st->power[i],10)),WEIGHT_SHIFT+1); - - - /* How much have we adapted so far? */ - st->sum_adapt = ADD32(st->sum_adapt,adapt_rate); - } - - /* FIXME: MC conversion required */ - for (i=0;i<st->frame_size;i++) - st->last_y[i] = st->last_y[st->frame_size+i]; - if (st->adapted) - { - /* If the filter is adapted, take the filtered echo */ - for (i=0;i<st->frame_size;i++) - st->last_y[st->frame_size+i] = in[i]-out[i]; - } else { - /* If filter isn't adapted yet, all we can do is take the far end signal directly */ - /* moved earlier: for (i=0;i<N;i++) - st->last_y[i] = st->x[i];*/ - } - -} - -/* Compute spectrum of estimated echo for use in an echo post-filter */ -void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *residual_echo, int len) -{ - int i; - spx_word16_t leak2; - int N; - - N = st->window_size; - - /* Apply hanning window (should pre-compute it)*/ - for (i=0;i<N;i++) - st->y[i] = MULT16_16_Q15(st->window[i],st->last_y[i]); - - /* Compute power spectrum of the echo */ - spx_fft(st->fft_table, st->y, st->Y); - power_spectrum(st->Y, residual_echo, N); - -#ifdef FIXED_POINT - if (st->leak_estimate > 16383) - leak2 = 32767; - else - leak2 = SHL16(st->leak_estimate, 1); -#else - if (st->leak_estimate>.5) - leak2 = 1; - else - leak2 = 2*st->leak_estimate; -#endif - /* Estimate residual echo */ - for (i=0;i<=st->frame_size;i++) - residual_echo[i] = (spx_int32_t)MULT16_32_Q15(leak2,residual_echo[i]); - -} - -EXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr) -{ - switch(request) - { - - case SPEEX_ECHO_GET_FRAME_SIZE: - (*(int*)ptr) = st->frame_size; - break; - case SPEEX_ECHO_SET_SAMPLING_RATE: - st->sampling_rate = (*(int*)ptr); - st->spec_average = DIV32_16(SHL32(EXTEND32(st->frame_size), 15), st->sampling_rate); -#ifdef FIXED_POINT - st->beta0 = DIV32_16(SHL32(EXTEND32(st->frame_size), 16), st->sampling_rate); - st->beta_max = DIV32_16(SHL32(EXTEND32(st->frame_size), 14), st->sampling_rate); -#else - st->beta0 = (2.0f*st->frame_size)/st->sampling_rate; - st->beta_max = (.5f*st->frame_size)/st->sampling_rate; -#endif - if (st->sampling_rate<12000) - st->notch_radius = QCONST16(.9, 15); - else if (st->sampling_rate<24000) - st->notch_radius = QCONST16(.982, 15); - else - st->notch_radius = QCONST16(.992, 15); - break; - case SPEEX_ECHO_GET_SAMPLING_RATE: - (*(int*)ptr) = st->sampling_rate; - break; - case SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE: - /*FIXME: Implement this for multiple channels */ - *((spx_int32_t *)ptr) = st->M * st->frame_size; - break; - case SPEEX_ECHO_GET_IMPULSE_RESPONSE: - { - int M = st->M, N = st->window_size, n = st->frame_size, i, j; - spx_int32_t *filt = (spx_int32_t *) ptr; - for(j=0;j<M;j++) - { - /*FIXME: Implement this for multiple channels */ -#ifdef FIXED_POINT - for (i=0;i<N;i++) - st->wtmp2[i] = EXTRACT16(PSHR32(st->W[j*N+i],16+NORMALIZE_SCALEDOWN)); - spx_ifft(st->fft_table, st->wtmp2, st->wtmp); -#else - spx_ifft(st->fft_table, &st->W[j*N], st->wtmp); -#endif - for(i=0;i<n;i++) - filt[j*n+i] = PSHR32(MULT16_16(32767,st->wtmp[i]), WEIGHT_SHIFT-NORMALIZE_SCALEDOWN); - } - } - break; - default: - speex_warning_int("Unknown speex_echo_ctl request: ", request); - return -1; - } - return 0; -} diff --git a/src/lib/dl/ext/speex/misc_bfin.h b/src/lib/dl/ext/speex/misc_bfin.h deleted file mode 100755 index 77b082c0..00000000 --- a/src/lib/dl/ext/speex/misc_bfin.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2005 Analog Devices */ -/** - @file misc_bfin.h - @author Jean-Marc Valin - @brief Various compatibility routines for Speex (Blackfin version) -*/ -/* - 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. -*/ - -#define OVERRIDE_SPEEX_MOVE -void *speex_move (void *dest, void *src, int n) -{ - __asm__ __volatile__ - ( - "L0 = 0;\n\t" - "I0 = %0;\n\t" - "R0 = [I0++];\n\t" - "LOOP move%= LC0 = %2;\n\t" - "LOOP_BEGIN move%=;\n\t" - "[%1++] = R0 || R0 = [I0++];\n\t" - "LOOP_END move%=;\n\t" - "[%1++] = R0;\n\t" - : "=a" (src), "=a" (dest) - : "a" ((n>>2)-1), "0" (src), "1" (dest) - : "R0", "I0", "L0", "memory" - ); - return dest; -} diff --git a/src/lib/dl/ext/speex/modes.c b/src/lib/dl/ext/speex/modes.c deleted file mode 100755 index e10a32e8..00000000 --- a/src/lib/dl/ext/speex/modes.c +++ /dev/null @@ -1,366 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: modes.c - - Describes the different modes of the codec - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "modes.h" -#include "ltp.h" -#include "quant_lsp.h" -#include "cb_search.h" -#include "sb_celp.h" -#include "nb_celp.h" -#include "vbr.h" -#include "arch.h" -#include <math.h> - -#ifndef NULL -#define NULL 0 -#endif - - -/* Extern declarations for all codebooks we use here */ -extern const signed char gain_cdbk_nb[]; -extern const signed char gain_cdbk_lbr[]; -extern const signed char exc_5_256_table[]; -extern const signed char exc_5_64_table[]; -extern const signed char exc_8_128_table[]; -extern const signed char exc_10_32_table[]; -extern const signed char exc_10_16_table[]; -extern const signed char exc_20_32_table[]; - - -/* Parameters for Long-Term Prediction (LTP)*/ -static const ltp_params ltp_params_nb = { - gain_cdbk_nb, - 7, - 7 -}; - -/* Parameters for Long-Term Prediction (LTP)*/ -static const ltp_params ltp_params_vlbr = { - gain_cdbk_lbr, - 5, - 0 -}; - -/* Parameters for Long-Term Prediction (LTP)*/ -static const ltp_params ltp_params_lbr = { - gain_cdbk_lbr, - 5, - 7 -}; - -/* Parameters for Long-Term Prediction (LTP)*/ -static const ltp_params ltp_params_med = { - gain_cdbk_lbr, - 5, - 7 -}; - -/* Split-VQ innovation parameters for very low bit-rate narrowband */ -static const split_cb_params split_cb_nb_vlbr = { - 10, /*subvect_size*/ - 4, /*nb_subvect*/ - exc_10_16_table, /*shape_cb*/ - 4, /*shape_bits*/ - 0, -}; - -/* Split-VQ innovation parameters for very low bit-rate narrowband */ -static const split_cb_params split_cb_nb_ulbr = { - 20, /*subvect_size*/ - 2, /*nb_subvect*/ - exc_20_32_table, /*shape_cb*/ - 5, /*shape_bits*/ - 0, -}; - -/* Split-VQ innovation parameters for low bit-rate narrowband */ -static const split_cb_params split_cb_nb_lbr = { - 10, /*subvect_size*/ - 4, /*nb_subvect*/ - exc_10_32_table, /*shape_cb*/ - 5, /*shape_bits*/ - 0, -}; - - -/* Split-VQ innovation parameters narrowband */ -static const split_cb_params split_cb_nb = { - 5, /*subvect_size*/ - 8, /*nb_subvect*/ - exc_5_64_table, /*shape_cb*/ - 6, /*shape_bits*/ - 0, -}; - -/* Split-VQ innovation parameters narrowband */ -static const split_cb_params split_cb_nb_med = { - 8, /*subvect_size*/ - 5, /*nb_subvect*/ - exc_8_128_table, /*shape_cb*/ - 7, /*shape_bits*/ - 0, -}; - -/* Split-VQ innovation for low-band wideband */ -static const split_cb_params split_cb_sb = { - 5, /*subvect_size*/ - 8, /*nb_subvect*/ - exc_5_256_table, /*shape_cb*/ - 8, /*shape_bits*/ - 0, -}; - - - -/* 2150 bps "vocoder-like" mode for comfort noise */ -static const SpeexSubmode nb_submode1 = { - 0, - 1, - 0, - 0, - /* LSP quantization */ - lsp_quant_lbr, - lsp_unquant_lbr, - /* No pitch quantization */ - forced_pitch_quant, - forced_pitch_unquant, - NULL, - /* No innovation quantization (noise only) */ - noise_codebook_quant, - noise_codebook_unquant, - NULL, - -1, - 43 -}; - -/* 3.95 kbps very low bit-rate mode */ -static const SpeexSubmode nb_submode8 = { - 0, - 1, - 0, - 0, - /*LSP quantization*/ - lsp_quant_lbr, - lsp_unquant_lbr, - /*No pitch quantization*/ - forced_pitch_quant, - forced_pitch_unquant, - NULL, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, - &split_cb_nb_ulbr, - QCONST16(.5,15), - 79 -}; - -/* 5.95 kbps very low bit-rate mode */ -static const SpeexSubmode nb_submode2 = { - 0, - 0, - 0, - 0, - /*LSP quantization*/ - lsp_quant_lbr, - lsp_unquant_lbr, - /*No pitch quantization*/ - pitch_search_3tap, - pitch_unquant_3tap, - <p_params_vlbr, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, - &split_cb_nb_vlbr, - QCONST16(.6,15), - 119 -}; - -/* 8 kbps low bit-rate mode */ -static const SpeexSubmode nb_submode3 = { - -1, - 0, - 1, - 0, - /*LSP quantization*/ - lsp_quant_lbr, - lsp_unquant_lbr, - /*Pitch quantization*/ - pitch_search_3tap, - pitch_unquant_3tap, - <p_params_lbr, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, - &split_cb_nb_lbr, - QCONST16(.55,15), - 160 -}; - -/* 11 kbps medium bit-rate mode */ -static const SpeexSubmode nb_submode4 = { - -1, - 0, - 1, - 0, - /*LSP quantization*/ - lsp_quant_lbr, - lsp_unquant_lbr, - /*Pitch quantization*/ - pitch_search_3tap, - pitch_unquant_3tap, - <p_params_med, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, - &split_cb_nb_med, - QCONST16(.45,15), - 220 -}; - -/* 15 kbps high bit-rate mode */ -static const SpeexSubmode nb_submode5 = { - -1, - 0, - 3, - 0, - /*LSP quantization*/ - lsp_quant_nb, - lsp_unquant_nb, - /*Pitch quantization*/ - pitch_search_3tap, - pitch_unquant_3tap, - <p_params_nb, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, - &split_cb_nb, - QCONST16(.3,15), - 300 -}; - -/* 18.2 high bit-rate mode */ -static const SpeexSubmode nb_submode6 = { - -1, - 0, - 3, - 0, - /*LSP quantization*/ - lsp_quant_nb, - lsp_unquant_nb, - /*Pitch quantization*/ - pitch_search_3tap, - pitch_unquant_3tap, - <p_params_nb, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, - &split_cb_sb, - QCONST16(.2,15), - 364 -}; - -/* 24.6 kbps high bit-rate mode */ -static const SpeexSubmode nb_submode7 = { - -1, - 0, - 3, - 1, - /*LSP quantization*/ - lsp_quant_nb, - lsp_unquant_nb, - /*Pitch quantization*/ - pitch_search_3tap, - pitch_unquant_3tap, - <p_params_nb, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, - &split_cb_nb, - QCONST16(.1,15), - 492 -}; - - -/* Default mode for narrowband */ -static const SpeexNBMode nb_mode = { - 160, /*frameSize*/ - 40, /*subframeSize*/ - 10, /*lpcSize*/ - 17, /*pitchStart*/ - 144, /*pitchEnd*/ -#ifdef FIXED_POINT - 29491, 19661, /* gamma1, gamma2 */ -#else - 0.9, 0.6, /* gamma1, gamma2 */ -#endif - QCONST16(.0002,15), /*lpc_floor*/ - {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7, - &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, - 5, - {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7} -}; - - -/* Default mode for narrowband */ -EXPORT const SpeexMode speex_nb_mode = { - &nb_mode, - nb_mode_query, - "narrowband", - 0, - 4, - &nb_encoder_init, - &nb_encoder_destroy, - &nb_encode, - &nb_decoder_init, - &nb_decoder_destroy, - &nb_decode, - &nb_encoder_ctl, - &nb_decoder_ctl, -}; - - - -EXPORT int speex_mode_query(const SpeexMode *mode, int request, void *ptr) -{ - return mode->query(mode->mode, request, ptr); -} - -#ifdef FIXED_DEBUG -long long spx_mips=0; -#endif - diff --git a/src/lib/dl/ext/speex/modes.h b/src/lib/dl/ext/speex/modes.h deleted file mode 100755 index 26e2d861..00000000 --- a/src/lib/dl/ext/speex/modes.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin */ -/** - @file modes.h - @brief Describes the different modes of the codec -*/ -/* - 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 MODES_H -#define MODES_H - -#include <speex/speex.h> -#include <speex/speex_bits.h> -#include "arch.h" - -#define NB_SUBMODES 16 -#define NB_SUBMODE_BITS 4 - -#define SB_SUBMODES 8 -#define SB_SUBMODE_BITS 3 - -/* Used internally, NOT TO BE USED in applications */ -/** Used internally*/ -#define SPEEX_GET_PI_GAIN 100 -/** Used internally*/ -#define SPEEX_GET_EXC 101 -/** Used internally*/ -#define SPEEX_GET_INNOV 102 -/** Used internally*/ -#define SPEEX_GET_DTX_STATUS 103 -/** Used internally*/ -#define SPEEX_SET_INNOVATION_SAVE 104 -/** Used internally*/ -#define SPEEX_SET_WIDEBAND 105 - -/** Used internally*/ -#define SPEEX_GET_STACK 106 - - -/** Quantizes LSPs */ -typedef void (*lsp_quant_func)(spx_lsp_t *, spx_lsp_t *, int, SpeexBits *); - -/** Decodes quantized LSPs */ -typedef void (*lsp_unquant_func)(spx_lsp_t *, int, SpeexBits *); - - -/** Long-term predictor quantization */ -typedef int (*ltp_quant_func)(spx_word16_t *, spx_word16_t *, spx_coef_t *, spx_coef_t *, - spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t, - int, int, SpeexBits*, char *, spx_word16_t *, spx_word16_t *, int, int, int, spx_word32_t *); - -/** Long-term un-quantize */ -typedef void (*ltp_unquant_func)(spx_word16_t *, spx_word32_t *, int, int, spx_word16_t, const void *, int, int *, - spx_word16_t *, SpeexBits*, char*, int, int, spx_word16_t, int); - - -/** Innovation quantization function */ -typedef void (*innovation_quant_func)(spx_word16_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int, - spx_sig_t *, spx_word16_t *, SpeexBits *, char *, int, int); - -/** Innovation unquantization function */ -typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *, spx_int32_t *); - -/** Description of a Speex sub-mode (wither narrowband or wideband */ -typedef struct SpeexSubmode { - int lbr_pitch; /**< Set to -1 for "normal" modes, otherwise encode pitch using a global pitch and allowing a +- lbr_pitch variation (for low not-rates)*/ - int forced_pitch_gain; /**< Use the same (forced) pitch gain for all sub-frames */ - int have_subframe_gain; /**< Number of bits to use as sub-frame innovation gain */ - int double_codebook; /**< Apply innovation quantization twice for higher quality (and higher bit-rate)*/ - /*LSP functions*/ - lsp_quant_func lsp_quant; /**< LSP quantization function */ - lsp_unquant_func lsp_unquant; /**< LSP unquantization function */ - - /*Long-term predictor functions*/ - ltp_quant_func ltp_quant; /**< Long-term predictor (pitch) quantizer */ - ltp_unquant_func ltp_unquant; /**< Long-term predictor (pitch) un-quantizer */ - const void *ltp_params; /**< Pitch parameters (options) */ - - /*Quantization of innovation*/ - innovation_quant_func innovation_quant; /**< Innovation quantization */ - innovation_unquant_func innovation_unquant; /**< Innovation un-quantization */ - const void *innovation_params; /**< Innovation quantization parameters*/ - - spx_word16_t comb_gain; /**< Gain of enhancer comb filter */ - - int bits_per_frame; /**< Number of bits per frame after encoding*/ -} SpeexSubmode; - -/** Struct defining the encoding/decoding mode*/ -typedef struct SpeexNBMode { - int frameSize; /**< Size of frames used for encoding */ - int subframeSize; /**< Size of sub-frames used for encoding */ - int lpcSize; /**< Order of LPC filter */ - int pitchStart; /**< Smallest pitch value allowed */ - int pitchEnd; /**< Largest pitch value allowed */ - - spx_word16_t gamma1; /**< Perceptual filter parameter #1 */ - spx_word16_t gamma2; /**< Perceptual filter parameter #2 */ - spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */ - - const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */ - int defaultSubmode; /**< Default sub-mode to use when encoding */ - int quality_map[11]; /**< Mode corresponding to each quality setting */ -} SpeexNBMode; - - -/** Struct defining the encoding/decoding mode for SB-CELP (wideband) */ -typedef struct SpeexSBMode { - const SpeexMode *nb_mode; /**< Embedded narrowband mode */ - int frameSize; /**< Size of frames used for encoding */ - int subframeSize; /**< Size of sub-frames used for encoding */ - int lpcSize; /**< Order of LPC filter */ - spx_word16_t gamma1; /**< Perceptual filter parameter #1 */ - spx_word16_t gamma2; /**< Perceptual filter parameter #1 */ - spx_word16_t lpc_floor; /**< Noise floor for LPC analysis */ - spx_word16_t folding_gain; - - const SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */ - int defaultSubmode; /**< Default sub-mode to use when encoding */ - int low_quality_map[11]; /**< Mode corresponding to each quality setting */ - int quality_map[11]; /**< Mode corresponding to each quality setting */ -#ifndef DISABLE_VBR - const float (*vbr_thresh)[11]; -#endif - int nb_modes; -} SpeexSBMode; - -int speex_encode_native(void *state, spx_word16_t *in, SpeexBits *bits); -int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out); - -int nb_mode_query(const void *mode, int request, void *ptr); -int wb_mode_query(const void *mode, int request, void *ptr); - -#endif diff --git a/src/lib/dl/ext/speex/modes_wb.c b/src/lib/dl/ext/speex/modes_wb.c deleted file mode 100755 index e3b48422..00000000 --- a/src/lib/dl/ext/speex/modes_wb.c +++ /dev/null @@ -1,300 +0,0 @@ -/* Copyright (C) 2002-2007 Jean-Marc Valin - File: modes.c - - Describes the wideband modes of the codec - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "modes.h" -#include "ltp.h" -#include "quant_lsp.h" -#include "cb_search.h" -#include "sb_celp.h" -#include "nb_celp.h" -#include "vbr.h" -#include "arch.h" -#include <math.h> -#include "os_support.h" - - -#ifndef NULL -#define NULL 0 -#endif - -EXPORT const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode}; - -extern const signed char hexc_table[]; -extern const signed char hexc_10_32_table[]; - -#ifndef DISABLE_WIDEBAND - -/* Split-VQ innovation for high-band wideband */ -static const split_cb_params split_cb_high = { - 8, /*subvect_size*/ - 5, /*nb_subvect*/ - hexc_table, /*shape_cb*/ - 7, /*shape_bits*/ - 1, -}; - - -/* Split-VQ innovation for high-band wideband */ -static const split_cb_params split_cb_high_lbr = { - 10, /*subvect_size*/ - 4, /*nb_subvect*/ - hexc_10_32_table, /*shape_cb*/ - 5, /*shape_bits*/ - 0, -}; - -#endif - - -static const SpeexSubmode wb_submode1 = { - 0, - 0, - 1, - 0, - /*LSP quantization*/ - lsp_quant_high, - lsp_unquant_high, - /*Pitch quantization*/ - NULL, - NULL, - NULL, - /*No innovation quantization*/ - NULL, - NULL, - NULL, - -1, - 36 -}; - - -static const SpeexSubmode wb_submode2 = { - 0, - 0, - 1, - 0, - /*LSP quantization*/ - lsp_quant_high, - lsp_unquant_high, - /*Pitch quantization*/ - NULL, - NULL, - NULL, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, -#ifdef DISABLE_WIDEBAND - NULL, -#else - &split_cb_high_lbr, -#endif - -1, - 112 -}; - - -static const SpeexSubmode wb_submode3 = { - 0, - 0, - 1, - 0, - /*LSP quantization*/ - lsp_quant_high, - lsp_unquant_high, - /*Pitch quantization*/ - NULL, - NULL, - NULL, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, -#ifdef DISABLE_WIDEBAND - NULL, -#else - &split_cb_high, -#endif - -1, - 192 -}; - -static const SpeexSubmode wb_submode4 = { - 0, - 0, - 1, - 1, - /*LSP quantization*/ - lsp_quant_high, - lsp_unquant_high, - /*Pitch quantization*/ - NULL, - NULL, - NULL, - /*Innovation quantization*/ - split_cb_search_shape_sign, - split_cb_shape_sign_unquant, -#ifdef DISABLE_WIDEBAND - NULL, -#else - &split_cb_high, -#endif - -1, - 352 -}; - - -/* Split-band wideband CELP mode*/ -static const SpeexSBMode sb_wb_mode = { - &speex_nb_mode, - 160, /*frameSize*/ - 40, /*subframeSize*/ - 8, /*lpcSize*/ -#ifdef FIXED_POINT - 29491, 19661, /* gamma1, gamma2 */ -#else - 0.9, 0.6, /* gamma1, gamma2 */ -#endif - QCONST16(.0002,15), /*lpc_floor*/ - QCONST16(0.9f,15), - {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL}, - 3, - {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7}, - {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4}, -#ifndef DISABLE_VBR - vbr_hb_thresh, -#endif - 5 -}; - - -EXPORT const SpeexMode speex_wb_mode = { - &sb_wb_mode, - wb_mode_query, - "wideband (sub-band CELP)", - 1, - 4, - &sb_encoder_init, - &sb_encoder_destroy, - &sb_encode, - &sb_decoder_init, - &sb_decoder_destroy, - &sb_decode, - &sb_encoder_ctl, - &sb_decoder_ctl, -}; - - - -/* "Ultra-wideband" mode stuff */ - - - -/* Split-band "ultra-wideband" (32 kbps) CELP mode*/ -static const SpeexSBMode sb_uwb_mode = { - &speex_wb_mode, - 320, /*frameSize*/ - 80, /*subframeSize*/ - 8, /*lpcSize*/ -#ifdef FIXED_POINT - 29491, 19661, /* gamma1, gamma2 */ -#else - 0.9, 0.6, /* gamma1, gamma2 */ -#endif - QCONST16(.0002,15), /*lpc_floor*/ - QCONST16(0.7f,15), - {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL}, - 1, - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, - {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, -#ifndef DISABLE_VBR - vbr_uhb_thresh, -#endif - 2 -}; - -int wb_mode_query(const void *mode, int request, void *ptr) -{ - const SpeexSBMode *m = (const SpeexSBMode*)mode; - - switch (request) - { - case SPEEX_MODE_FRAME_SIZE: - *((int*)ptr)=2*m->frameSize; - break; - case SPEEX_SUBMODE_BITS_PER_FRAME: - if (*((int*)ptr)==0) - *((int*)ptr) = SB_SUBMODE_BITS+1; - else if (m->submodes[*((int*)ptr)]==NULL) - *((int*)ptr) = -1; - else - *((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame; - break; - default: - speex_warning_int("Unknown wb_mode_query request: ", request); - return -1; - } - return 0; -} - - -EXPORT const SpeexMode speex_uwb_mode = { - &sb_uwb_mode, - wb_mode_query, - "ultra-wideband (sub-band CELP)", - 2, - 4, - &sb_encoder_init, - &sb_encoder_destroy, - &sb_encode, - &sb_decoder_init, - &sb_decoder_destroy, - &sb_decode, - &sb_encoder_ctl, - &sb_decoder_ctl, -}; - -/* We have defined speex_lib_get_mode() as a macro in speex.h */ -#undef speex_lib_get_mode - -EXPORT const SpeexMode * speex_lib_get_mode (int mode) -{ - if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL; - - return speex_mode_list[mode]; -} - - - diff --git a/src/lib/dl/ext/speex/nb_celp.c b/src/lib/dl/ext/speex/nb_celp.c deleted file mode 100755 index 9dd726a0..00000000 --- a/src/lib/dl/ext/speex/nb_celp.c +++ /dev/null @@ -1,1903 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: nb_celp.c - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include "nb_celp.h" -#include "lpc.h" -#include "lsp.h" -#include "ltp.h" -#include "quant_lsp.h" -#include "cb_search.h" -#include "filters.h" -#include "stack_alloc.h" -#include "vq.h" -#include <speex/speex_bits.h> -#include "vbr.h" -#include "arch.h" -#include "math_approx.h" -#include "os_support.h" -#include <speex/speex_callbacks.h> - -#ifdef VORBIS_PSYCHO -#include "vorbis_psy.h" -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#define SUBMODE(x) st->submodes[st->submodeID]->x - -/* Default size for the encoder and decoder stack (can be changed at compile time). - This does not apply when using variable-size arrays or alloca. */ -#ifndef NB_ENC_STACK -#define NB_ENC_STACK (8000*sizeof(spx_sig_t)) -#endif - -#ifndef NB_DEC_STACK -#define NB_DEC_STACK (4000*sizeof(spx_sig_t)) -#endif - - -#ifdef FIXED_POINT -const spx_word32_t ol_gain_table[32]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822, 132760927}; -const spx_word16_t exc_gain_quant_scal3_bound[7]={1841, 3883, 6051, 8062, 10444, 13580, 18560}; -const spx_word16_t exc_gain_quant_scal3[8]={1002, 2680, 5086, 7016, 9108, 11781, 15380, 21740}; -const spx_word16_t exc_gain_quant_scal1_bound[1]={14385}; -const spx_word16_t exc_gain_quant_scal1[2]={11546, 17224}; - -#define LSP_MARGIN 16 -#define LSP_DELTA1 6553 -#define LSP_DELTA2 1638 - -#else - -const float exc_gain_quant_scal3_bound[7]={0.112338f, 0.236980f, 0.369316f, 0.492054f, 0.637471f, 0.828874f, 1.132784f}; -const float exc_gain_quant_scal3[8]={0.061130f, 0.163546f, 0.310413f, 0.428220f, 0.555887f, 0.719055f, 0.938694f, 1.326874f}; -const float exc_gain_quant_scal1_bound[1]={0.87798f}; -const float exc_gain_quant_scal1[2]={0.70469f, 1.05127f}; - -#define LSP_MARGIN .002f -#define LSP_DELTA1 .2f -#define LSP_DELTA2 .05f - -#endif - -#ifdef VORBIS_PSYCHO -#define EXTRA_BUFFER 100 -#else -#define EXTRA_BUFFER 0 -#endif - - -#define sqr(x) ((x)*(x)) - -extern const spx_word16_t lag_window[]; -extern const spx_word16_t lpc_window[]; - -void *nb_encoder_init(const SpeexMode *m) -{ - EncState *st; - const SpeexNBMode *mode; - int i; - - mode=(const SpeexNBMode *)m->mode; - st = (EncState*)speex_alloc(sizeof(EncState)); - if (!st) - return NULL; -#if defined(VAR_ARRAYS) || defined (USE_ALLOCA) - st->stack = NULL; -#else - st->stack = (char*)speex_alloc_scratch(NB_ENC_STACK); -#endif - - st->mode=m; - - st->frameSize = mode->frameSize; - st->nbSubframes=mode->frameSize/mode->subframeSize; - st->subframeSize=mode->subframeSize; - st->windowSize = st->frameSize+st->subframeSize; - st->lpcSize = mode->lpcSize; - st->gamma1=mode->gamma1; - st->gamma2=mode->gamma2; - st->min_pitch=mode->pitchStart; - st->max_pitch=mode->pitchEnd; - st->lpc_floor = mode->lpc_floor; - - st->submodes=mode->submodes; - st->submodeID=st->submodeSelect=mode->defaultSubmode; - st->bounded_pitch = 1; - - st->encode_submode = 1; - -#ifdef VORBIS_PSYCHO - st->psy = vorbis_psy_init(8000, 256); - st->curve = (float*)speex_alloc(128*sizeof(float)); - st->old_curve = (float*)speex_alloc(128*sizeof(float)); - st->psy_window = (float*)speex_alloc(256*sizeof(float)); -#endif - - st->cumul_gain = 1024; - - /* Allocating input buffer */ - st->winBuf = (spx_word16_t*)speex_alloc((st->windowSize-st->frameSize)*sizeof(spx_word16_t)); - /* Allocating excitation buffer */ - st->excBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t)); - st->exc = st->excBuf + mode->pitchEnd + 2; - st->swBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t)); - st->sw = st->swBuf + mode->pitchEnd + 2; - - st->window= lpc_window; - - /* Create the window for autocorrelation (lag-windowing) */ - st->lagWindow = lag_window; - - st->old_lsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); - st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); - st->first = 1; - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1); - - st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - st->mem_sw_whole = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - st->mem_exc = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - st->mem_exc2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - - st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); - st->innov_rms_save = NULL; - - st->pitch = (int*)speex_alloc((st->nbSubframes)*sizeof(int)); - -#ifndef DISABLE_VBR - st->vbr = (VBRState*)speex_alloc(sizeof(VBRState)); - vbr_init(st->vbr); - st->vbr_quality = 8; - st->vbr_enabled = 0; - st->vbr_max = 0; - st->vad_enabled = 0; - st->dtx_enabled = 0; - st->dtx_count=0; - st->abr_enabled = 0; - st->abr_drift = 0; - st->abr_drift2 = 0; -#endif /* #ifndef DISABLE_VBR */ - - st->plc_tuning = 2; - st->complexity=2; - st->sampling_rate=8000; - st->isWideband = 0; - st->highpass_enabled = 1; - -#ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, NB_ENC_STACK); -#endif - return st; -} - -void nb_encoder_destroy(void *state) -{ - EncState *st=(EncState *)state; - /* Free all allocated memory */ -#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA)) - speex_free_scratch(st->stack); -#endif - - speex_free (st->winBuf); - speex_free (st->excBuf); - speex_free (st->old_qlsp); - speex_free (st->swBuf); - - speex_free (st->old_lsp); - speex_free (st->mem_sp); - speex_free (st->mem_sw); - speex_free (st->mem_sw_whole); - speex_free (st->mem_exc); - speex_free (st->mem_exc2); - speex_free (st->pi_gain); - speex_free (st->pitch); - -#ifndef DISABLE_VBR - vbr_destroy(st->vbr); - speex_free (st->vbr); -#endif /* #ifndef DISABLE_VBR */ - -#ifdef VORBIS_PSYCHO - vorbis_psy_destroy(st->psy); - speex_free (st->curve); - speex_free (st->old_curve); - speex_free (st->psy_window); -#endif - - /*Free state memory... should be last*/ - speex_free(st); -} - -int nb_encode(void *state, void *vin, SpeexBits *bits) -{ - EncState *st; - int i, sub, roots; - int ol_pitch; - spx_word16_t ol_pitch_coef; - spx_word32_t ol_gain; - VARDECL(spx_word16_t *ringing); - VARDECL(spx_word16_t *target); - VARDECL(spx_sig_t *innov); - VARDECL(spx_word32_t *exc32); - VARDECL(spx_mem_t *mem); - VARDECL(spx_coef_t *bw_lpc1); - VARDECL(spx_coef_t *bw_lpc2); - VARDECL(spx_coef_t *lpc); - VARDECL(spx_lsp_t *lsp); - VARDECL(spx_lsp_t *qlsp); - VARDECL(spx_lsp_t *interp_lsp); - VARDECL(spx_lsp_t *interp_qlsp); - VARDECL(spx_coef_t *interp_lpc); - VARDECL(spx_coef_t *interp_qlpc); - char *stack; - VARDECL(spx_word16_t *syn_resp); - VARDECL(spx_word16_t *real_exc); - - spx_word32_t ener=0; - spx_word16_t fine_gain; - spx_word16_t *in = (spx_word16_t*)vin; - - st=(EncState *)state; - stack=st->stack; - - ALLOC(lpc, st->lpcSize, spx_coef_t); - ALLOC(bw_lpc1, st->lpcSize, spx_coef_t); - ALLOC(bw_lpc2, st->lpcSize, spx_coef_t); - ALLOC(lsp, st->lpcSize, spx_lsp_t); - ALLOC(qlsp, st->lpcSize, spx_lsp_t); - ALLOC(interp_lsp, st->lpcSize, spx_lsp_t); - ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t); - ALLOC(interp_lpc, st->lpcSize, spx_coef_t); - ALLOC(interp_qlpc, st->lpcSize, spx_coef_t); - - /* Move signals 1 frame towards the past */ - SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, st->max_pitch+2); - SPEEX_MOVE(st->swBuf, st->swBuf+st->frameSize, st->max_pitch+2); - - if (st->highpass_enabled) - highpass(in, in, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_INPUT, st->mem_hp); - - { - VARDECL(spx_word16_t *w_sig); - VARDECL(spx_word16_t *autocorr); - ALLOC(w_sig, st->windowSize, spx_word16_t); - ALLOC(autocorr, st->lpcSize+1, spx_word16_t); - /* Window for analysis */ - for (i=0;i<st->windowSize-st->frameSize;i++) - w_sig[i] = EXTRACT16(SHR32(MULT16_16(st->winBuf[i],st->window[i]),SIG_SHIFT)); - for (;i<st->windowSize;i++) - w_sig[i] = EXTRACT16(SHR32(MULT16_16(in[i-st->windowSize+st->frameSize],st->window[i]),SIG_SHIFT)); - /* Compute auto-correlation */ - _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize); - autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */ - - /* Lag windowing: equivalent to filtering in the power-spectrum domain */ - for (i=0;i<st->lpcSize+1;i++) - autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]); - - /* Levinson-Durbin */ - _spx_lpc(lpc, autocorr, st->lpcSize); - /* LPC to LSPs (x-domain) transform */ - roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack); - /* Check if we found all the roots */ - if (roots!=st->lpcSize) - { - /*If we can't find all LSP's, do some damage control and use previous filter*/ - for (i=0;i<st->lpcSize;i++) - { - lsp[i]=st->old_lsp[i]; - } - } - } - - - - - /* Whole frame analysis (open-loop estimation of pitch and excitation gain) */ - { - int diff = st->windowSize-st->frameSize; - if (st->first) - for (i=0;i<st->lpcSize;i++) - interp_lsp[i] = lsp[i]; - else - lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, st->nbSubframes, st->nbSubframes<<1); - - lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN); - - /* Compute interpolated LPCs (unquantized) for whole frame*/ - lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack); - - - /*Open-loop pitch*/ - if (!st->submodes[st->submodeID] || (st->complexity>2 && SUBMODE(have_subframe_gain)<3) || SUBMODE(forced_pitch_gain) || SUBMODE(lbr_pitch) != -1 -#ifndef DISABLE_VBR - || st->vbr_enabled || st->vad_enabled -#endif - ) - { - int nol_pitch[6]; - spx_word16_t nol_pitch_coef[6]; - - bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize); - bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize); - - SPEEX_COPY(st->sw, st->winBuf, diff); - SPEEX_COPY(st->sw+diff, in, st->frameSize-diff); - filter_mem16(st->sw, bw_lpc1, bw_lpc2, st->sw, st->frameSize, st->lpcSize, st->mem_sw_whole, stack); - - open_loop_nbest_pitch(st->sw, st->min_pitch, st->max_pitch, st->frameSize, - nol_pitch, nol_pitch_coef, 6, stack); - ol_pitch=nol_pitch[0]; - ol_pitch_coef = nol_pitch_coef[0]; - /*Try to remove pitch multiples*/ - for (i=1;i<6;i++) - { -#ifdef FIXED_POINT - if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],27853)) && -#else - if ((nol_pitch_coef[i]>.85*nol_pitch_coef[0]) && -#endif - (ABS(2*nol_pitch[i]-ol_pitch)<=2 || ABS(3*nol_pitch[i]-ol_pitch)<=3 || - ABS(4*nol_pitch[i]-ol_pitch)<=4 || ABS(5*nol_pitch[i]-ol_pitch)<=5)) - { - /*ol_pitch_coef=nol_pitch_coef[i];*/ - ol_pitch = nol_pitch[i]; - } - } - /*if (ol_pitch>50) - ol_pitch/=2;*/ - /*ol_pitch_coef = sqrt(ol_pitch_coef);*/ - - } else { - ol_pitch=0; - ol_pitch_coef=0; - } - - /*Compute "real" excitation*/ - SPEEX_COPY(st->exc, st->winBuf, diff); - SPEEX_COPY(st->exc+diff, in, st->frameSize-diff); - fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack); - - /* Compute open-loop excitation gain */ - { - spx_word16_t g = compute_rms16(st->exc, st->frameSize); - if (st->submodeID!=1 && ol_pitch>0) - ol_gain = MULT16_16(g, MULT16_16_Q14(QCONST16(1.1,14), - spx_sqrt(QCONST32(1.,28)-MULT16_32_Q15(QCONST16(.8,15),SHL32(MULT16_16(ol_pitch_coef,ol_pitch_coef),16))))); - else - ol_gain = SHL32(EXTEND32(g),SIG_SHIFT); - } - } - -#ifdef VORBIS_PSYCHO - SPEEX_MOVE(st->psy_window, st->psy_window+st->frameSize, 256-st->frameSize); - SPEEX_COPY(&st->psy_window[256-st->frameSize], in, st->frameSize); - compute_curve(st->psy, st->psy_window, st->curve); - /*print_vec(st->curve, 128, "curve");*/ - if (st->first) - SPEEX_COPY(st->old_curve, st->curve, 128); -#endif - - /*VBR stuff*/ -#ifndef DISABLE_VBR - if (st->vbr && (st->vbr_enabled||st->vad_enabled)) - { - float lsp_dist=0; - for (i=0;i<st->lpcSize;i++) - lsp_dist += (st->old_lsp[i] - lsp[i])*(st->old_lsp[i] - lsp[i]); - lsp_dist /= LSP_SCALING*LSP_SCALING; - - if (st->abr_enabled) - { - float qual_change=0; - if (st->abr_drift2 * st->abr_drift > 0) - { - /* Only adapt if long-term and short-term drift are the same sign */ - qual_change = -.00001*st->abr_drift/(1+st->abr_count); - if (qual_change>.05) - qual_change=.05; - if (qual_change<-.05) - qual_change=-.05; - } - st->vbr_quality += qual_change; - if (st->vbr_quality>10) - st->vbr_quality=10; - if (st->vbr_quality<0) - st->vbr_quality=0; - } - - st->relative_quality = vbr_analysis(st->vbr, in, st->frameSize, ol_pitch, GAIN_SCALING_1*ol_pitch_coef); - /*if (delta_qual<0)*/ - /* delta_qual*=.1*(3+st->vbr_quality);*/ - if (st->vbr_enabled) - { - spx_int32_t mode; - int choice=0; - float min_diff=100; - mode = 8; - while (mode) - { - int v1; - float thresh; - v1=(int)floor(st->vbr_quality); - if (v1==10) - thresh = vbr_nb_thresh[mode][v1]; - else - thresh = (st->vbr_quality-v1)*vbr_nb_thresh[mode][v1+1] + (1+v1-st->vbr_quality)*vbr_nb_thresh[mode][v1]; - if (st->relative_quality > thresh && - st->relative_quality-thresh<min_diff) - { - choice = mode; - min_diff = st->relative_quality-thresh; - } - mode--; - } - mode=choice; - if (mode==0) - { - if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20) - { - mode=1; - st->dtx_count=1; - } else { - mode=0; - st->dtx_count++; - } - } else { - st->dtx_count=0; - } - - speex_encoder_ctl(state, SPEEX_SET_MODE, &mode); - if (st->vbr_max>0) - { - spx_int32_t rate; - speex_encoder_ctl(state, SPEEX_GET_BITRATE, &rate); - if (rate > st->vbr_max) - { - rate = st->vbr_max; - speex_encoder_ctl(state, SPEEX_SET_BITRATE, &rate); - } - } - - if (st->abr_enabled) - { - spx_int32_t bitrate; - speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate); - st->abr_drift+=(bitrate-st->abr_enabled); - st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled); - st->abr_count += 1.0; - } - - } else { - /*VAD only case*/ - int mode; - if (st->relative_quality<2) - { - if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20) - { - st->dtx_count=1; - mode=1; - } else { - mode=0; - st->dtx_count++; - } - } else { - st->dtx_count = 0; - mode=st->submodeSelect; - } - /*speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);*/ - st->submodeID=mode; - } - } else { - st->relative_quality = -1; - } -#endif /* #ifndef DISABLE_VBR */ - - if (st->encode_submode) - { - /* First, transmit a zero for narrowband */ - speex_bits_pack(bits, 0, 1); - - /* Transmit the sub-mode we use for this frame */ - speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS); - - } - - /* If null mode (no transmission), just set a couple things to zero*/ - if (st->submodes[st->submodeID] == NULL) - { - for (i=0;i<st->frameSize;i++) - st->exc[i]=st->sw[i]=VERY_SMALL; - - for (i=0;i<st->lpcSize;i++) - st->mem_sw[i]=0; - st->first=1; - st->bounded_pitch = 1; - - SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize); - - /* Clear memory (no need to really compute it) */ - for (i=0;i<st->lpcSize;i++) - st->mem_sp[i] = 0; - return 0; - - } - - /* LSP Quantization */ - if (st->first) - { - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i] = lsp[i]; - } - - - /*Quantize LSPs*/ -#if 1 /*0 for unquantized*/ - SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits); -#else - for (i=0;i<st->lpcSize;i++) - qlsp[i]=lsp[i]; -#endif - - /*If we use low bit-rate pitch mode, transmit open-loop pitch*/ - if (SUBMODE(lbr_pitch)!=-1) - { - speex_bits_pack(bits, ol_pitch-st->min_pitch, 7); - } - - if (SUBMODE(forced_pitch_gain)) - { - int quant; - /* This just damps the pitch a bit, because it tends to be too aggressive when forced */ - ol_pitch_coef = MULT16_16_Q15(QCONST16(.9,15), ol_pitch_coef); -#ifdef FIXED_POINT - quant = PSHR16(MULT16_16_16(15, ol_pitch_coef),GAIN_SHIFT); -#else - quant = (int)floor(.5+15*ol_pitch_coef*GAIN_SCALING_1); -#endif - if (quant>15) - quant=15; - if (quant<0) - quant=0; - speex_bits_pack(bits, quant, 4); - ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT)); - } - - - /*Quantize and transmit open-loop excitation gain*/ -#ifdef FIXED_POINT - { - int qe = scal_quant32(ol_gain, ol_gain_table, 32); - /*ol_gain = exp(qe/3.5)*SIG_SCALING;*/ - ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]); - speex_bits_pack(bits, qe, 5); - } -#else - { - int qe = (int)(floor(.5+3.5*log(ol_gain*1.0/SIG_SCALING))); - if (qe<0) - qe=0; - if (qe>31) - qe=31; - ol_gain = exp(qe/3.5)*SIG_SCALING; - speex_bits_pack(bits, qe, 5); - } -#endif - - - - /* Special case for first frame */ - if (st->first) - { - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - } - - /* Target signal */ - ALLOC(target, st->subframeSize, spx_word16_t); - ALLOC(innov, st->subframeSize, spx_sig_t); - ALLOC(exc32, st->subframeSize, spx_word32_t); - ALLOC(ringing, st->subframeSize, spx_word16_t); - ALLOC(syn_resp, st->subframeSize, spx_word16_t); - ALLOC(real_exc, st->subframeSize, spx_word16_t); - ALLOC(mem, st->lpcSize, spx_mem_t); - - /* Loop on sub-frames */ - for (sub=0;sub<st->nbSubframes;sub++) - { - int offset; - spx_word16_t *sw; - spx_word16_t *exc; - int pitch; - int response_bound = st->subframeSize; - - /* Offset relative to start of frame */ - offset = st->subframeSize*sub; - /* Excitation */ - exc=st->exc+offset; - /* Weighted signal */ - sw=st->sw+offset; - - /* LSP interpolation (quantized and unquantized) */ - lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes); - lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes); - - /* Make sure the filters are stable */ - lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN); - lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN); - - /* Compute interpolated LPCs (quantized and unquantized) */ - lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack); - - lsp_to_lpc(interp_qlsp, interp_qlpc, st->lpcSize, stack); - - /* Compute analysis filter gain at w=pi (for use in SB-CELP) */ - { - spx_word32_t pi_g=LPC_SCALING; - for (i=0;i<st->lpcSize;i+=2) - { - /*pi_g += -st->interp_qlpc[i] + st->interp_qlpc[i+1];*/ - pi_g = ADD32(pi_g, SUB32(EXTEND32(interp_qlpc[i+1]),EXTEND32(interp_qlpc[i]))); - } - st->pi_gain[sub] = pi_g; - } - -#ifdef VORBIS_PSYCHO - { - float curr_curve[128]; - float fact = ((float)sub+1.0f)/st->nbSubframes; - for (i=0;i<128;i++) - curr_curve[i] = (1.0f-fact)*st->old_curve[i] + fact*st->curve[i]; - curve_to_lpc(st->psy, curr_curve, bw_lpc1, bw_lpc2, 10); - } -#else - /* Compute bandwidth-expanded (unquantized) LPCs for perceptual weighting */ - bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize); - if (st->gamma2>=0) - bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize); - else - { - for (i=0;i<st->lpcSize;i++) - bw_lpc2[i]=0; - } - /*print_vec(st->bw_lpc1, 10, "bw_lpc");*/ -#endif - - /*FIXME: This will break if we change the window size */ - speex_assert(st->windowSize-st->frameSize == st->subframeSize); - if (sub==0) - { - for (i=0;i<st->subframeSize;i++) - real_exc[i] = sw[i] = st->winBuf[i]; - } else { - for (i=0;i<st->subframeSize;i++) - real_exc[i] = sw[i] = in[i+((sub-1)*st->subframeSize)]; - } - fir_mem16(real_exc, interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2, stack); - - if (st->complexity==0) - response_bound >>= 1; - compute_impulse_response(interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, response_bound, st->lpcSize, stack); - for (i=response_bound;i<st->subframeSize;i++) - syn_resp[i]=VERY_SMALL; - - /* Compute zero response of A(z/g1) / ( A(z/g2) * A(z) ) */ - for (i=0;i<st->lpcSize;i++) - mem[i]=SHL32(st->mem_sp[i],1); - for (i=0;i<st->subframeSize;i++) - ringing[i] = VERY_SMALL; -#ifdef SHORTCUTS2 - iir_mem16(ringing, interp_qlpc, ringing, response_bound, st->lpcSize, mem, stack); - for (i=0;i<st->lpcSize;i++) - mem[i]=SHL32(st->mem_sw[i],1); - filter_mem16(ringing, st->bw_lpc1, st->bw_lpc2, ringing, response_bound, st->lpcSize, mem, stack); - SPEEX_MEMSET(&ringing[response_bound], 0, st->subframeSize-response_bound); -#else - iir_mem16(ringing, interp_qlpc, ringing, st->subframeSize, st->lpcSize, mem, stack); - for (i=0;i<st->lpcSize;i++) - mem[i]=SHL32(st->mem_sw[i],1); - filter_mem16(ringing, bw_lpc1, bw_lpc2, ringing, st->subframeSize, st->lpcSize, mem, stack); -#endif - - /* Compute weighted signal */ - for (i=0;i<st->lpcSize;i++) - mem[i]=st->mem_sw[i]; - filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack); - - if (st->complexity==0) - for (i=0;i<st->lpcSize;i++) - st->mem_sw[i]=mem[i]; - - /* Compute target signal (saturation prevents overflows on clipped input speech) */ - for (i=0;i<st->subframeSize;i++) - target[i]=EXTRACT16(SATURATE(SUB32(sw[i],PSHR32(ringing[i],1)),32767)); - - /* Reset excitation */ - SPEEX_MEMSET(exc, 0, st->subframeSize); - - /* If we have a long-term predictor (otherwise, something's wrong) */ - speex_assert (SUBMODE(ltp_quant)); - { - int pit_min, pit_max; - /* Long-term prediction */ - if (SUBMODE(lbr_pitch) != -1) - { - /* Low bit-rate pitch handling */ - int margin; - margin = SUBMODE(lbr_pitch); - if (margin) - { - if (ol_pitch < st->min_pitch+margin-1) - ol_pitch=st->min_pitch+margin-1; - if (ol_pitch > st->max_pitch-margin) - ol_pitch=st->max_pitch-margin; - pit_min = ol_pitch-margin+1; - pit_max = ol_pitch+margin; - } else { - pit_min=pit_max=ol_pitch; - } - } else { - pit_min = st->min_pitch; - pit_max = st->max_pitch; - } - - /* Force pitch to use only the current frame if needed */ - if (st->bounded_pitch && pit_max>offset) - pit_max=offset; - - /* Perform pitch search */ - pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2, - exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef, - st->lpcSize, st->subframeSize, bits, stack, - exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain); - - st->pitch[sub]=pitch; - } - /* Quantization of innovation */ - SPEEX_MEMSET(innov, 0, st->subframeSize); - - /* FIXME: Make sure this is save from overflows (so far so good) */ - for (i=0;i<st->subframeSize;i++) - real_exc[i] = EXTRACT16(SUB32(EXTEND32(real_exc[i]), PSHR32(exc32[i],SIG_SHIFT-1))); - - ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT); - - /*FIXME: Should use DIV32_16 and make sure result fits in 16 bits */ -#ifdef FIXED_POINT - { - spx_word32_t f = PDIV32(ener,PSHR32(ol_gain,SIG_SHIFT)); - if (f<=32767) - fine_gain = f; - else - fine_gain = 32767; - } -#else - fine_gain = PDIV32_16(ener,PSHR32(ol_gain,SIG_SHIFT)); -#endif - /* Calculate gain correction for the sub-frame (if any) */ - if (SUBMODE(have_subframe_gain)) - { - int qe; - if (SUBMODE(have_subframe_gain)==3) - { - qe = scal_quant(fine_gain, exc_gain_quant_scal3_bound, 8); - speex_bits_pack(bits, qe, 3); - ener=MULT16_32_Q14(exc_gain_quant_scal3[qe],ol_gain); - } else { - qe = scal_quant(fine_gain, exc_gain_quant_scal1_bound, 2); - speex_bits_pack(bits, qe, 1); - ener=MULT16_32_Q14(exc_gain_quant_scal1[qe],ol_gain); - } - } else { - ener=ol_gain; - } - - /*printf ("%f %f\n", ener, ol_gain);*/ - - /* Normalize innovation */ - signal_div(target, target, ener, st->subframeSize); - - /* Quantize innovation */ - speex_assert (SUBMODE(innovation_quant)); - { - /* Codebook search */ - SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2, - SUBMODE(innovation_params), st->lpcSize, st->subframeSize, - innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook)); - - /* De-normalize innovation and update excitation */ - signal_mul(innov, innov, ener, st->subframeSize); - - for (i=0;i<st->subframeSize;i++) - exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767)); - - /* In some (rare) modes, we do a second search (more bits) to reduce noise even more */ - if (SUBMODE(double_codebook)) { - char *tmp_stack=stack; - VARDECL(spx_sig_t *innov2); - ALLOC(innov2, st->subframeSize, spx_sig_t); - SPEEX_MEMSET(innov2, 0, st->subframeSize); - for (i=0;i<st->subframeSize;i++) - target[i]=MULT16_16_P13(QCONST16(2.2f,13), target[i]); - SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2, - SUBMODE(innovation_params), st->lpcSize, st->subframeSize, - innov2, syn_resp, bits, stack, st->complexity, 0); - signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize); - for (i=0;i<st->subframeSize;i++) - innov[i] = ADD32(innov[i],innov2[i]); - stack = tmp_stack; - } - for (i=0;i<st->subframeSize;i++) - exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767)); - if (st->innov_rms_save) - { - st->innov_rms_save[sub] = compute_rms(innov, st->subframeSize); - } - } - - /* Final signal synthesis from excitation */ - iir_mem16(exc, interp_qlpc, sw, st->subframeSize, st->lpcSize, st->mem_sp, stack); - - /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */ - if (st->complexity!=0) - filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack); - - } - - /* Store the LSPs for interpolation in the next frame */ - if (st->submodeID>=1) - { - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i] = lsp[i]; - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - } - -#ifdef VORBIS_PSYCHO - if (st->submodeID>=1) - SPEEX_COPY(st->old_curve, st->curve, 128); -#endif - - if (st->submodeID==1) - { -#ifndef DISABLE_VBR - if (st->dtx_count) - speex_bits_pack(bits, 15, 4); - else -#endif - speex_bits_pack(bits, 0, 4); - } - - /* The next frame will not be the first (Duh!) */ - st->first = 0; - SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize); - - if (SUBMODE(innovation_quant) == noise_codebook_quant || st->submodeID==0) - st->bounded_pitch = 1; - else - st->bounded_pitch = 0; - - return 1; -} - -void *nb_decoder_init(const SpeexMode *m) -{ - DecState *st; - const SpeexNBMode *mode; - int i; - - mode=(const SpeexNBMode*)m->mode; - st = (DecState *)speex_alloc(sizeof(DecState)); - if (!st) - return NULL; -#if defined(VAR_ARRAYS) || defined (USE_ALLOCA) - st->stack = NULL; -#else - st->stack = (char*)speex_alloc_scratch(NB_DEC_STACK); -#endif - - st->mode=m; - - - st->encode_submode = 1; - - st->first=1; - /* Codec parameters, should eventually have several "modes"*/ - st->frameSize = mode->frameSize; - st->nbSubframes=mode->frameSize/mode->subframeSize; - st->subframeSize=mode->subframeSize; - st->lpcSize = mode->lpcSize; - st->min_pitch=mode->pitchStart; - st->max_pitch=mode->pitchEnd; - - st->submodes=mode->submodes; - st->submodeID=mode->defaultSubmode; - - st->lpc_enh_enabled=1; - - st->excBuf = (spx_word16_t*)speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t)); - st->exc = st->excBuf + 2*st->max_pitch + st->subframeSize + 6; - SPEEX_MEMSET(st->excBuf, 0, st->frameSize + st->max_pitch); - - st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); - st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); - st->mem_sp = (spx_mem_t*)speex_alloc(st->lpcSize*sizeof(spx_mem_t)); - st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); - st->last_pitch = 40; - st->count_lost=0; - st->pitch_gain_buf[0] = st->pitch_gain_buf[1] = st->pitch_gain_buf[2] = 0; - st->pitch_gain_buf_idx = 0; - st->seed = 1000; - - st->sampling_rate=8000; - st->last_ol_gain = 0; - - st->user_callback.func = &speex_default_user_handler; - st->user_callback.data = NULL; - for (i=0;i<16;i++) - st->speex_callbacks[i].func = NULL; - - st->voc_m1=st->voc_m2=st->voc_mean=0; - st->voc_offset=0; - st->dtx_enabled=0; - st->isWideband = 0; - st->highpass_enabled = 1; - -#ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, NB_DEC_STACK); -#endif - return st; -} - -void nb_decoder_destroy(void *state) -{ - DecState *st; - st=(DecState*)state; - -#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA)) - speex_free_scratch(st->stack); -#endif - - speex_free (st->excBuf); - speex_free (st->interp_qlpc); - speex_free (st->old_qlsp); - speex_free (st->mem_sp); - speex_free (st->pi_gain); - - speex_free(state); -} - -#define median3(a, b, c) ((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a)))) - -#ifdef FIXED_POINT -const spx_word16_t attenuation[10] = {32767, 31483, 27923, 22861, 17278, 12055, 7764, 4616, 2533, 1283}; -#else -const spx_word16_t attenuation[10] = {1., 0.961, 0.852, 0.698, 0.527, 0.368, 0.237, 0.141, 0.077, 0.039}; - -#endif - -static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack) -{ - int i; - int pitch_val; - spx_word16_t pitch_gain; - spx_word16_t fact; - spx_word16_t gain_med; - spx_word16_t innov_gain; - spx_word16_t noise_gain; - - if (st->count_lost<10) - fact = attenuation[st->count_lost]; - else - fact = 0; - - gain_med = median3(st->pitch_gain_buf[0], st->pitch_gain_buf[1], st->pitch_gain_buf[2]); - if (gain_med < st->last_pitch_gain) - st->last_pitch_gain = gain_med; - -#ifdef FIXED_POINT - pitch_gain = st->last_pitch_gain; - if (pitch_gain>54) - pitch_gain = 54; - pitch_gain = SHL16(pitch_gain, 9); -#else - pitch_gain = GAIN_SCALING_1*st->last_pitch_gain; - if (pitch_gain>.85) - pitch_gain=.85; -#endif - pitch_gain = MULT16_16_Q15(fact,pitch_gain) + VERY_SMALL; - /* FIXME: This was rms of innovation (not exc) */ - innov_gain = compute_rms16(st->exc, st->frameSize); - noise_gain = MULT16_16_Q15(innov_gain, MULT16_16_Q15(fact, SUB16(Q15ONE,MULT16_16_Q15(pitch_gain,pitch_gain)))); - /* Shift all buffers by one frame */ - SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12); - - - pitch_val = st->last_pitch + SHR32((spx_int32_t)speex_rand(1+st->count_lost, &st->seed),SIG_SHIFT); - if (pitch_val > st->max_pitch) - pitch_val = st->max_pitch; - if (pitch_val < st->min_pitch) - pitch_val = st->min_pitch; - for (i=0;i<st->frameSize;i++) - { - st->exc[i]= MULT16_16_Q15(pitch_gain, (st->exc[i-pitch_val]+VERY_SMALL)) + - speex_rand(noise_gain, &st->seed); - } - - bw_lpc(QCONST16(.98,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize); - iir_mem16(&st->exc[-st->subframeSize], st->interp_qlpc, out, st->frameSize, - st->lpcSize, st->mem_sp, stack); - highpass(out, out, st->frameSize, HIGHPASS_NARROWBAND|HIGHPASS_OUTPUT, st->mem_hp); - - st->first = 0; - st->count_lost++; - st->pitch_gain_buf[st->pitch_gain_buf_idx++] = PSHR16(pitch_gain,9); - if (st->pitch_gain_buf_idx > 2) /* rollover */ - st->pitch_gain_buf_idx = 0; -} - -/* Just so we don't need to carry the complete wideband mode information */ -static const int wb_skip_table[8] = {0, 36, 112, 192, 352, 0, 0, 0}; - -int nb_decode(void *state, SpeexBits *bits, void *vout) -{ - DecState *st; - int i, sub; - int pitch; - spx_word16_t pitch_gain[3]; - spx_word32_t ol_gain=0; - int ol_pitch=0; - spx_word16_t ol_pitch_coef=0; - int best_pitch=40; - spx_word16_t best_pitch_gain=0; - int wideband; - int m; - char *stack; - VARDECL(spx_sig_t *innov); - VARDECL(spx_word32_t *exc32); - VARDECL(spx_coef_t *ak); - VARDECL(spx_lsp_t *qlsp); - spx_word16_t pitch_average=0; - - spx_word16_t *out = (spx_word16_t*)vout; - VARDECL(spx_lsp_t *interp_qlsp); - - st=(DecState*)state; - stack=st->stack; - - /* Check if we're in DTX mode*/ - if (!bits && st->dtx_enabled) - { - st->submodeID=0; - } else - { - /* If bits is NULL, consider the packet to be lost (what could we do anyway) */ - if (!bits) - { - nb_decode_lost(st, out, stack); - return 0; - } - - if (st->encode_submode) - { - - /* Search for next narrowband block (handle requests, skip wideband blocks) */ - do { - if (speex_bits_remaining(bits)<5) - return -1; - wideband = speex_bits_unpack_unsigned(bits, 1); - if (wideband) /* Skip wideband block (for compatibility) */ - { - int submode; - int advance; - advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS); - /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/ - advance = wb_skip_table[submode]; - if (advance < 0) - { - speex_notify("Invalid mode encountered. The stream is corrupted."); - return -2; - } - advance -= (SB_SUBMODE_BITS+1); - speex_bits_advance(bits, advance); - - if (speex_bits_remaining(bits)<5) - return -1; - wideband = speex_bits_unpack_unsigned(bits, 1); - if (wideband) - { - advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS); - /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/ - advance = wb_skip_table[submode]; - if (advance < 0) - { - speex_notify("Invalid mode encountered. The stream is corrupted."); - return -2; - } - advance -= (SB_SUBMODE_BITS+1); - speex_bits_advance(bits, advance); - wideband = speex_bits_unpack_unsigned(bits, 1); - if (wideband) - { - speex_notify("More than two wideband layers found. The stream is corrupted."); - return -2; - } - - } - } - if (speex_bits_remaining(bits)<4) - return -1; - /* FIXME: Check for overflow */ - m = speex_bits_unpack_unsigned(bits, 4); - if (m==15) /* We found a terminator */ - { - return -1; - } else if (m==14) /* Speex in-band request */ - { - int ret = speex_inband_handler(bits, st->speex_callbacks, state); - if (ret) - return ret; - } else if (m==13) /* User in-band request */ - { - int ret = st->user_callback.func(bits, state, st->user_callback.data); - if (ret) - return ret; - } else if (m>8) /* Invalid mode */ - { - speex_notify("Invalid mode encountered. The stream is corrupted."); - return -2; - } - - } while (m>8); - - /* Get the sub-mode that was used */ - st->submodeID = m; - } - - } - - /* Shift all buffers by one frame */ - SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12); - - /* If null mode (no transmission), just set a couple things to zero*/ - if (st->submodes[st->submodeID] == NULL) - { - VARDECL(spx_coef_t *lpc); - ALLOC(lpc, st->lpcSize, spx_coef_t); - bw_lpc(QCONST16(0.93f,15), st->interp_qlpc, lpc, st->lpcSize); - { - spx_word16_t innov_gain=0; - /* FIXME: This was innov, not exc */ - innov_gain = compute_rms16(st->exc, st->frameSize); - for (i=0;i<st->frameSize;i++) - st->exc[i]=speex_rand(innov_gain, &st->seed); - } - - - st->first=1; - - /* Final signal synthesis from excitation */ - iir_mem16(st->exc, lpc, out, st->frameSize, st->lpcSize, st->mem_sp, stack); - - st->count_lost=0; - return 0; - } - - ALLOC(qlsp, st->lpcSize, spx_lsp_t); - - /* Unquantize LSPs */ - SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits); - - /*Damp memory if a frame was lost and the LSP changed too much*/ - if (st->count_lost) - { - spx_word16_t fact; - spx_word32_t lsp_dist=0; - for (i=0;i<st->lpcSize;i++) - lsp_dist = ADD32(lsp_dist, EXTEND32(ABS(st->old_qlsp[i] - qlsp[i]))); -#ifdef FIXED_POINT - fact = SHR16(19661,SHR32(lsp_dist,LSP_SHIFT+2)); -#else - fact = .6*exp(-.2*lsp_dist); -#endif - for (i=0;i<st->lpcSize;i++) - st->mem_sp[i] = MULT16_32_Q15(fact,st->mem_sp[i]); - } - - - /* Handle first frame and lost-packet case */ - if (st->first || st->count_lost) - { - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - } - - /* Get open-loop pitch estimation for low bit-rate pitch coding */ - if (SUBMODE(lbr_pitch)!=-1) - { - ol_pitch = st->min_pitch+speex_bits_unpack_unsigned(bits, 7); - } - - if (SUBMODE(forced_pitch_gain)) - { - int quant; - quant = speex_bits_unpack_unsigned(bits, 4); - ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT)); - } - - /* Get global excitation gain */ - { - int qe; - qe = speex_bits_unpack_unsigned(bits, 5); -#ifdef FIXED_POINT - /* FIXME: Perhaps we could slightly lower the gain here when the output is going to saturate? */ - ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]); -#else - ol_gain = SIG_SCALING*exp(qe/3.5); -#endif - } - - ALLOC(ak, st->lpcSize, spx_coef_t); - ALLOC(innov, st->subframeSize, spx_sig_t); - ALLOC(exc32, st->subframeSize, spx_word32_t); - - if (st->submodeID==1) - { - int extra; - extra = speex_bits_unpack_unsigned(bits, 4); - - if (extra==15) - st->dtx_enabled=1; - else - st->dtx_enabled=0; - } - if (st->submodeID>1) - st->dtx_enabled=0; - - /*Loop on subframes */ - for (sub=0;sub<st->nbSubframes;sub++) - { - int offset; - spx_word16_t *exc; - spx_word16_t *sp; - spx_word16_t *innov_save = NULL; - spx_word16_t tmp; - - /* Offset relative to start of frame */ - offset = st->subframeSize*sub; - /* Excitation */ - exc=st->exc+offset; - /* Original signal */ - sp=out+offset; - if (st->innov_save) - innov_save = st->innov_save+offset; - - - /* Reset excitation */ - SPEEX_MEMSET(exc, 0, st->subframeSize); - - /*Adaptive codebook contribution*/ - speex_assert (SUBMODE(ltp_unquant)); - { - int pit_min, pit_max; - /* Handle pitch constraints if any */ - if (SUBMODE(lbr_pitch) != -1) - { - int margin; - margin = SUBMODE(lbr_pitch); - if (margin) - { -/* GT - need optimization? - if (ol_pitch < st->min_pitch+margin-1) - ol_pitch=st->min_pitch+margin-1; - if (ol_pitch > st->max_pitch-margin) - ol_pitch=st->max_pitch-margin; - pit_min = ol_pitch-margin+1; - pit_max = ol_pitch+margin; -*/ - pit_min = ol_pitch-margin+1; - if (pit_min < st->min_pitch) - pit_min = st->min_pitch; - pit_max = ol_pitch+margin; - if (pit_max > st->max_pitch) - pit_max = st->max_pitch; - } else { - pit_min = pit_max = ol_pitch; - } - } else { - pit_min = st->min_pitch; - pit_max = st->max_pitch; - } - - - - SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params), - st->subframeSize, &pitch, &pitch_gain[0], bits, stack, - st->count_lost, offset, st->last_pitch_gain, 0); - - /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is - crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat). - We can probably be even more aggressive and limit to 15000 or so. */ - sanitize_values32(exc32, NEG32(QCONST32(32000,SIG_SHIFT-1)), QCONST32(32000,SIG_SHIFT-1), st->subframeSize); - - tmp = gain_3tap_to_1tap(pitch_gain); - - pitch_average += tmp; - if ((tmp>best_pitch_gain&&ABS(2*best_pitch-pitch)>=3&&ABS(3*best_pitch-pitch)>=4&&ABS(4*best_pitch-pitch)>=5) - || (tmp>MULT16_16_Q15(QCONST16(.6,15),best_pitch_gain)&&(ABS(best_pitch-2*pitch)<3||ABS(best_pitch-3*pitch)<4||ABS(best_pitch-4*pitch)<5)) - || (MULT16_16_Q15(QCONST16(.67,15),tmp)>best_pitch_gain&&(ABS(2*best_pitch-pitch)<3||ABS(3*best_pitch-pitch)<4||ABS(4*best_pitch-pitch)<5)) ) - { - best_pitch = pitch; - if (tmp > best_pitch_gain) - best_pitch_gain = tmp; - } - } - - /* Unquantize the innovation */ - { - int q_energy; - spx_word32_t ener; - - SPEEX_MEMSET(innov, 0, st->subframeSize); - - /* Decode sub-frame gain correction */ - if (SUBMODE(have_subframe_gain)==3) - { - q_energy = speex_bits_unpack_unsigned(bits, 3); - ener = MULT16_32_Q14(exc_gain_quant_scal3[q_energy],ol_gain); - } else if (SUBMODE(have_subframe_gain)==1) - { - q_energy = speex_bits_unpack_unsigned(bits, 1); - ener = MULT16_32_Q14(exc_gain_quant_scal1[q_energy],ol_gain); - } else { - ener = ol_gain; - } - - speex_assert (SUBMODE(innovation_unquant)); - { - /*Fixed codebook contribution*/ - SUBMODE(innovation_unquant)(innov, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed); - /* De-normalize innovation and update excitation */ - - signal_mul(innov, innov, ener, st->subframeSize); - - /* Decode second codebook (only for some modes) */ - if (SUBMODE(double_codebook)) - { - char *tmp_stack=stack; - VARDECL(spx_sig_t *innov2); - ALLOC(innov2, st->subframeSize, spx_sig_t); - SPEEX_MEMSET(innov2, 0, st->subframeSize); - SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed); - signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize); - for (i=0;i<st->subframeSize;i++) - innov[i] = ADD32(innov[i], innov2[i]); - stack = tmp_stack; - } - for (i=0;i<st->subframeSize;i++) - exc[i]=EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767)); - /*print_vec(exc, 40, "innov");*/ - if (innov_save) - { - for (i=0;i<st->subframeSize;i++) - innov_save[i] = EXTRACT16(PSHR32(innov[i], SIG_SHIFT)); - } - } - - /*Vocoder mode*/ - if (st->submodeID==1) - { - spx_word16_t g=ol_pitch_coef; - g=MULT16_16_P14(QCONST16(1.5f,14),(g-QCONST16(.2f,6))); - if (g<0) - g=0; - if (g>GAIN_SCALING) - g=GAIN_SCALING; - - SPEEX_MEMSET(exc, 0, st->subframeSize); - while (st->voc_offset<st->subframeSize) - { - /* exc[st->voc_offset]= g*sqrt(2*ol_pitch)*ol_gain; - Not quite sure why we need the factor of two in the sqrt */ - if (st->voc_offset>=0) - exc[st->voc_offset]=MULT16_16(spx_sqrt(MULT16_16_16(2,ol_pitch)),EXTRACT16(PSHR32(MULT16_16(g,PSHR32(ol_gain,SIG_SHIFT)),6))); - st->voc_offset+=ol_pitch; - } - st->voc_offset -= st->subframeSize; - - for (i=0;i<st->subframeSize;i++) - { - spx_word16_t exci=exc[i]; - exc[i]= ADD16(ADD16(MULT16_16_Q15(QCONST16(.7f,15),exc[i]) , MULT16_16_Q15(QCONST16(.3f,15),st->voc_m1)), - SUB16(MULT16_16_Q15(Q15_ONE-MULT16_16_16(QCONST16(.85f,9),g),EXTRACT16(PSHR32(innov[i],SIG_SHIFT))), - MULT16_16_Q15(MULT16_16_16(QCONST16(.15f,9),g),EXTRACT16(PSHR32(st->voc_m2,SIG_SHIFT))) - )); - st->voc_m1 = exci; - st->voc_m2=innov[i]; - st->voc_mean = EXTRACT16(PSHR32(ADD32(MULT16_16(QCONST16(.8f,15),st->voc_mean), MULT16_16(QCONST16(.2f,15),exc[i])), 15)); - exc[i]-=st->voc_mean; - } - } - - } - } - - ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t); - - if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost) - { - multicomb(st->exc-st->subframeSize, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack); - multicomb(st->exc+st->subframeSize, out+2*st->subframeSize, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack); - } else { - SPEEX_COPY(out, &st->exc[-st->subframeSize], st->frameSize); - } - - /* If the last packet was lost, re-scale the excitation to obtain the same energy as encoded in ol_gain */ - if (st->count_lost) - { - spx_word16_t exc_ener; - spx_word32_t gain32; - spx_word16_t gain; - exc_ener = compute_rms16 (st->exc, st->frameSize); - gain32 = PDIV32(ol_gain, ADD16(exc_ener,1)); -#ifdef FIXED_POINT - if (gain32 > 32767) - gain32 = 32767; - gain = EXTRACT16(gain32); -#else - if (gain32 > 2) - gain32=2; - gain = gain32; -#endif - for (i=0;i<st->frameSize;i++) - { - st->exc[i] = MULT16_16_Q14(gain, st->exc[i]); - out[i]=st->exc[i-st->subframeSize]; - } - } - - /*Loop on subframes */ - for (sub=0;sub<st->nbSubframes;sub++) - { - int offset; - spx_word16_t *sp; - spx_word16_t *exc; - /* Offset relative to start of frame */ - offset = st->subframeSize*sub; - /* Original signal */ - sp=out+offset; - /* Excitation */ - exc=st->exc+offset; - - /* LSP interpolation (quantized and unquantized) */ - lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes); - - /* Make sure the LSP's are stable */ - lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN); - - /* Compute interpolated LPCs (unquantized) */ - lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack); - - /* Compute analysis filter at w=pi */ - { - spx_word32_t pi_g=LPC_SCALING; - for (i=0;i<st->lpcSize;i+=2) - { - /*pi_g += -st->interp_qlpc[i] + st->interp_qlpc[i+1];*/ - pi_g = ADD32(pi_g, SUB32(EXTEND32(ak[i+1]),EXTEND32(ak[i]))); - } - st->pi_gain[sub] = pi_g; - } - - iir_mem16(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, - st->mem_sp, stack); - - for (i=0;i<st->lpcSize;i++) - st->interp_qlpc[i] = ak[i]; - - } - - if (st->highpass_enabled) - highpass(out, out, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_OUTPUT, st->mem_hp); - /*for (i=0;i<st->frameSize;i++) - printf ("%d\n", (int)st->frame[i]);*/ - - /* Tracking output level */ - st->level = 1+PSHR32(ol_gain,SIG_SHIFT); - st->max_level = MAX16(MULT16_16_Q15(QCONST16(.99f,15), st->max_level), st->level); - st->min_level = MIN16(ADD16(1,MULT16_16_Q14(QCONST16(1.01f,14), st->min_level)), st->level); - if (st->max_level < st->min_level+1) - st->max_level = st->min_level+1; - /*printf ("%f %f %f %d\n", og, st->min_level, st->max_level, update);*/ - - /* Store the LSPs for interpolation in the next frame */ - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - - /* The next frame will not be the first (Duh!) */ - st->first = 0; - st->count_lost=0; - st->last_pitch = best_pitch; -#ifdef FIXED_POINT - st->last_pitch_gain = PSHR16(pitch_average,2); -#else - st->last_pitch_gain = .25*pitch_average; -#endif - st->pitch_gain_buf[st->pitch_gain_buf_idx++] = st->last_pitch_gain; - if (st->pitch_gain_buf_idx > 2) /* rollover */ - st->pitch_gain_buf_idx = 0; - - st->last_ol_gain = ol_gain; - - return 0; -} - -int nb_encoder_ctl(void *state, int request, void *ptr) -{ - EncState *st; - st=(EncState*)state; - switch(request) - { - case SPEEX_GET_FRAME_SIZE: - (*(spx_int32_t*)ptr) = st->frameSize; - break; - case SPEEX_SET_LOW_MODE: - case SPEEX_SET_MODE: - st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_LOW_MODE: - case SPEEX_GET_MODE: - (*(spx_int32_t*)ptr) = st->submodeID; - break; -#ifndef DISABLE_VBR - case SPEEX_SET_VBR: - st->vbr_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_VBR: - (*(spx_int32_t*)ptr) = st->vbr_enabled; - break; - case SPEEX_SET_VAD: - st->vad_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_VAD: - (*(spx_int32_t*)ptr) = st->vad_enabled; - break; - case SPEEX_SET_DTX: - st->dtx_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_DTX: - (*(spx_int32_t*)ptr) = st->dtx_enabled; - break; - case SPEEX_SET_ABR: - st->abr_enabled = (*(spx_int32_t*)ptr); - st->vbr_enabled = st->abr_enabled!=0; - if (st->vbr_enabled) - { - spx_int32_t i=10; - spx_int32_t rate, target; - float vbr_qual; - target = (*(spx_int32_t*)ptr); - while (i>=0) - { - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i); - speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate); - if (rate <= target) - break; - i--; - } - vbr_qual=i; - if (vbr_qual<0) - vbr_qual=0; - speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual); - st->abr_count=0; - st->abr_drift=0; - st->abr_drift2=0; - } - - break; - case SPEEX_GET_ABR: - (*(spx_int32_t*)ptr) = st->abr_enabled; - break; -#endif /* #ifndef DISABLE_VBR */ -#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) - case SPEEX_SET_VBR_QUALITY: - st->vbr_quality = (*(float*)ptr); - break; - case SPEEX_GET_VBR_QUALITY: - (*(float*)ptr) = st->vbr_quality; - break; -#endif /* !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */ - case SPEEX_SET_QUALITY: - { - int quality = (*(spx_int32_t*)ptr); - if (quality < 0) - quality = 0; - if (quality > 10) - quality = 10; - st->submodeSelect = st->submodeID = ((const SpeexNBMode*)(st->mode->mode))->quality_map[quality]; - } - break; - case SPEEX_SET_COMPLEXITY: - st->complexity = (*(spx_int32_t*)ptr); - if (st->complexity<0) - st->complexity=0; - break; - case SPEEX_GET_COMPLEXITY: - (*(spx_int32_t*)ptr) = st->complexity; - break; - case SPEEX_SET_BITRATE: - { - spx_int32_t i=10; - spx_int32_t rate, target; - target = (*(spx_int32_t*)ptr); - while (i>=0) - { - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i); - speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate); - if (rate <= target) - break; - i--; - } - } - break; - case SPEEX_GET_BITRATE: - if (st->submodes[st->submodeID]) - (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize; - else - (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize; - break; - case SPEEX_SET_SAMPLING_RATE: - st->sampling_rate = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_SAMPLING_RATE: - (*(spx_int32_t*)ptr)=st->sampling_rate; - break; - case SPEEX_RESET_STATE: - { - int i; - st->bounded_pitch = 1; - st->first = 1; - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1); - for (i=0;i<st->lpcSize;i++) - st->mem_sw[i]=st->mem_sw_whole[i]=st->mem_sp[i]=st->mem_exc[i]=0; - for (i=0;i<st->frameSize+st->max_pitch+1;i++) - st->excBuf[i]=st->swBuf[i]=0; - for (i=0;i<st->windowSize-st->frameSize;i++) - st->winBuf[i]=0; - } - break; - case SPEEX_SET_SUBMODE_ENCODING: - st->encode_submode = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_SUBMODE_ENCODING: - (*(spx_int32_t*)ptr) = st->encode_submode; - break; - case SPEEX_GET_LOOKAHEAD: - (*(spx_int32_t*)ptr)=(st->windowSize-st->frameSize); - break; - case SPEEX_SET_PLC_TUNING: - st->plc_tuning = (*(spx_int32_t*)ptr); - if (st->plc_tuning>100) - st->plc_tuning=100; - break; - case SPEEX_GET_PLC_TUNING: - (*(spx_int32_t*)ptr)=(st->plc_tuning); - break; -#ifndef DISABLE_VBR - case SPEEX_SET_VBR_MAX_BITRATE: - st->vbr_max = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_VBR_MAX_BITRATE: - (*(spx_int32_t*)ptr) = st->vbr_max; - break; -#endif /* #ifndef DISABLE_VBR */ - case SPEEX_SET_HIGHPASS: - st->highpass_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_HIGHPASS: - (*(spx_int32_t*)ptr) = st->highpass_enabled; - break; - - /* This is all internal stuff past this point */ - case SPEEX_GET_PI_GAIN: - { - int i; - spx_word32_t *g = (spx_word32_t*)ptr; - for (i=0;i<st->nbSubframes;i++) - g[i]=st->pi_gain[i]; - } - break; - case SPEEX_GET_EXC: - { - int i; - for (i=0;i<st->nbSubframes;i++) - ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize); - } - break; -#ifndef DISABLE_VBR - case SPEEX_GET_RELATIVE_QUALITY: - (*(float*)ptr)=st->relative_quality; - break; -#endif /* #ifndef DISABLE_VBR */ - case SPEEX_SET_INNOVATION_SAVE: - st->innov_rms_save = (spx_word16_t*)ptr; - break; - case SPEEX_SET_WIDEBAND: - st->isWideband = *((spx_int32_t*)ptr); - break; - case SPEEX_GET_STACK: - *((char**)ptr) = st->stack; - break; - default: - speex_warning_int("Unknown nb_ctl request: ", request); - return -1; - } - return 0; -} - -int nb_decoder_ctl(void *state, int request, void *ptr) -{ - DecState *st; - st=(DecState*)state; - switch(request) - { - case SPEEX_SET_LOW_MODE: - case SPEEX_SET_MODE: - st->submodeID = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_LOW_MODE: - case SPEEX_GET_MODE: - (*(spx_int32_t*)ptr) = st->submodeID; - break; - case SPEEX_SET_ENH: - st->lpc_enh_enabled = *((spx_int32_t*)ptr); - break; - case SPEEX_GET_ENH: - *((spx_int32_t*)ptr) = st->lpc_enh_enabled; - break; - case SPEEX_GET_FRAME_SIZE: - (*(spx_int32_t*)ptr) = st->frameSize; - break; - case SPEEX_GET_BITRATE: - if (st->submodes[st->submodeID]) - (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize; - else - (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize; - break; - case SPEEX_SET_SAMPLING_RATE: - st->sampling_rate = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_SAMPLING_RATE: - (*(spx_int32_t*)ptr)=st->sampling_rate; - break; - case SPEEX_SET_HANDLER: - { - SpeexCallback *c = (SpeexCallback*)ptr; - st->speex_callbacks[c->callback_id].func=c->func; - st->speex_callbacks[c->callback_id].data=c->data; - st->speex_callbacks[c->callback_id].callback_id=c->callback_id; - } - break; - case SPEEX_SET_USER_HANDLER: - { - SpeexCallback *c = (SpeexCallback*)ptr; - st->user_callback.func=c->func; - st->user_callback.data=c->data; - st->user_callback.callback_id=c->callback_id; - } - break; - case SPEEX_RESET_STATE: - { - int i; - for (i=0;i<st->lpcSize;i++) - st->mem_sp[i]=0; - for (i=0;i<st->frameSize + st->max_pitch + 1;i++) - st->excBuf[i]=0; - } - break; - case SPEEX_SET_SUBMODE_ENCODING: - st->encode_submode = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_SUBMODE_ENCODING: - (*(spx_int32_t*)ptr) = st->encode_submode; - break; - case SPEEX_GET_LOOKAHEAD: - (*(spx_int32_t*)ptr)=st->subframeSize; - break; - case SPEEX_SET_HIGHPASS: - st->highpass_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_GET_HIGHPASS: - (*(spx_int32_t*)ptr) = st->highpass_enabled; - break; - /* FIXME: Convert to fixed-point and re-enable even when float API is disabled */ -#ifndef DISABLE_FLOAT_API - case SPEEX_GET_ACTIVITY: - { - float ret; - ret = log(st->level/st->min_level)/log(st->max_level/st->min_level); - if (ret>1) - ret = 1; - /* Done in a strange way to catch NaNs as well */ - if (!(ret > 0)) - ret = 0; - /*printf ("%f %f %f %f\n", st->level, st->min_level, st->max_level, ret);*/ - (*(spx_int32_t*)ptr) = (int)(100*ret); - } - break; -#endif - case SPEEX_GET_PI_GAIN: - { - int i; - spx_word32_t *g = (spx_word32_t*)ptr; - for (i=0;i<st->nbSubframes;i++) - g[i]=st->pi_gain[i]; - } - break; - case SPEEX_GET_EXC: - { - int i; - for (i=0;i<st->nbSubframes;i++) - ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize); - } - break; - case SPEEX_GET_DTX_STATUS: - *((spx_int32_t*)ptr) = st->dtx_enabled; - break; - case SPEEX_SET_INNOVATION_SAVE: - st->innov_save = (spx_word16_t*)ptr; - break; - case SPEEX_SET_WIDEBAND: - st->isWideband = *((spx_int32_t*)ptr); - break; - case SPEEX_GET_STACK: - *((char**)ptr) = st->stack; - break; - default: - speex_warning_int("Unknown nb_ctl request: ", request); - return -1; - } - return 0; -} diff --git a/src/lib/dl/ext/speex/nb_celp.h b/src/lib/dl/ext/speex/nb_celp.h deleted file mode 100755 index 14c776ff..00000000 --- a/src/lib/dl/ext/speex/nb_celp.h +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin */ -/** - @file nb_celp.h - @brief Narrowband CELP encoder/decoder -*/ -/* - 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 NB_CELP_H -#define NB_CELP_H - -#include "modes.h" -#include <speex/speex_bits.h> -#include <speex/speex_callbacks.h> -#include "vbr.h" -#include "filters.h" - -#ifdef VORBIS_PSYCHO -#include "vorbis_psy.h" -#endif - -/**Structure representing the full state of the narrowband encoder*/ -typedef struct EncState { - const SpeexMode *mode; /**< Mode corresponding to the state */ - int first; /**< Is this the first frame? */ - int frameSize; /**< Size of frames */ - int subframeSize; /**< Size of sub-frames */ - int nbSubframes; /**< Number of sub-frames */ - int windowSize; /**< Analysis (LPC) window length */ - int lpcSize; /**< LPC order */ - int min_pitch; /**< Minimum pitch value allowed */ - int max_pitch; /**< Maximum pitch value allowed */ - - spx_word32_t cumul_gain; /**< Product of previously used pitch gains (Q10) */ - int bounded_pitch; /**< Next frame should not rely on previous frames for pitch */ - int ol_pitch; /**< Open-loop pitch */ - int ol_voiced; /**< Open-loop voiced/non-voiced decision */ - int *pitch; - -#ifdef VORBIS_PSYCHO - VorbisPsy *psy; - float *psy_window; - float *curve; - float *old_curve; -#endif - - spx_word16_t gamma1; /**< Perceptual filter: A(z/gamma1) */ - spx_word16_t gamma2; /**< Perceptual filter: A(z/gamma2) */ - spx_word16_t lpc_floor; /**< Noise floor multiplier for A[0] in LPC analysis*/ - char *stack; /**< Pseudo-stack allocation for temporary memory */ - spx_word16_t *winBuf; /**< Input buffer (original signal) */ - spx_word16_t *excBuf; /**< Excitation buffer */ - spx_word16_t *exc; /**< Start of excitation frame */ - spx_word16_t *swBuf; /**< Weighted signal buffer */ - spx_word16_t *sw; /**< Start of weighted signal frame */ - const spx_word16_t *window; /**< Temporary (Hanning) window */ - const spx_word16_t *lagWindow; /**< Window applied to auto-correlation */ - spx_lsp_t *old_lsp; /**< LSPs for previous frame */ - spx_lsp_t *old_qlsp; /**< Quantized LSPs for previous frame */ - spx_mem_t *mem_sp; /**< Filter memory for signal synthesis */ - spx_mem_t *mem_sw; /**< Filter memory for perceptually-weighted signal */ - spx_mem_t *mem_sw_whole; /**< Filter memory for perceptually-weighted signal (whole frame)*/ - spx_mem_t *mem_exc; /**< Filter memory for excitation (whole frame) */ - spx_mem_t *mem_exc2; /**< Filter memory for excitation (whole frame) */ - spx_mem_t mem_hp[2]; /**< High-pass filter memory */ - spx_word32_t *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */ - spx_word16_t *innov_rms_save; /**< If non-NULL, innovation RMS is copied here */ - -#ifndef DISABLE_VBR - VBRState *vbr; /**< State of the VBR data */ - float vbr_quality; /**< Quality setting for VBR encoding */ - float relative_quality; /**< Relative quality that will be needed by VBR */ - spx_int32_t vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */ - spx_int32_t vbr_max; /**< Max bit-rate allowed in VBR mode */ - int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */ - int dtx_enabled; /**< 1 for enabling DTX, 0 otherwise */ - int dtx_count; /**< Number of consecutive DTX frames */ - spx_int32_t abr_enabled; /**< ABR setting (in bps), 0 if off */ - float abr_drift; - float abr_drift2; - float abr_count; -#endif /* #ifndef DISABLE_VBR */ - - int complexity; /**< Complexity setting (0-10 from least complex to most complex) */ - spx_int32_t sampling_rate; - int plc_tuning; - int encode_submode; - const SpeexSubmode * const *submodes; /**< Sub-mode data */ - int submodeID; /**< Activated sub-mode */ - int submodeSelect; /**< Mode chosen by the user (may differ from submodeID if VAD is on) */ - int isWideband; /**< Is this used as part of the embedded wideband codec */ - int highpass_enabled; /**< Is the input filter enabled */ -} EncState; - -/**Structure representing the full state of the narrowband decoder*/ -typedef struct DecState { - const SpeexMode *mode; /**< Mode corresponding to the state */ - int first; /**< Is this the first frame? */ - int count_lost; /**< Was the last frame lost? */ - int frameSize; /**< Size of frames */ - int subframeSize; /**< Size of sub-frames */ - int nbSubframes; /**< Number of sub-frames */ - int lpcSize; /**< LPC order */ - int min_pitch; /**< Minimum pitch value allowed */ - int max_pitch; /**< Maximum pitch value allowed */ - spx_int32_t sampling_rate; - - spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */ - - char *stack; /**< Pseudo-stack allocation for temporary memory */ - spx_word16_t *excBuf; /**< Excitation buffer */ - spx_word16_t *exc; /**< Start of excitation frame */ - spx_lsp_t *old_qlsp; /**< Quantized LSPs for previous frame */ - spx_coef_t *interp_qlpc; /**< Interpolated quantized LPCs */ - spx_mem_t *mem_sp; /**< Filter memory for synthesis signal */ - spx_mem_t mem_hp[2]; /**< High-pass filter memory */ - spx_word32_t *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */ - spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */ - - spx_word16_t level; - spx_word16_t max_level; - spx_word16_t min_level; - - /* This is used in packet loss concealment */ - int last_pitch; /**< Pitch of last correctly decoded frame */ - spx_word16_t last_pitch_gain; /**< Pitch gain of last correctly decoded frame */ - spx_word16_t pitch_gain_buf[3]; /**< Pitch gain of last decoded frames */ - int pitch_gain_buf_idx; /**< Tail of the buffer */ - spx_int32_t seed; /** Seed used for random number generation */ - - int encode_submode; - const SpeexSubmode * const *submodes; /**< Sub-mode data */ - int submodeID; /**< Activated sub-mode */ - int lpc_enh_enabled; /**< 1 when LPC enhancer is on, 0 otherwise */ - SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS]; - - SpeexCallback user_callback; - - /*Vocoder data*/ - spx_word16_t voc_m1; - spx_word32_t voc_m2; - spx_word16_t voc_mean; - int voc_offset; - - int dtx_enabled; - int isWideband; /**< Is this used as part of the embedded wideband codec */ - int highpass_enabled; /**< Is the input filter enabled */ -} DecState; - -/** Initializes encoder state*/ -void *nb_encoder_init(const SpeexMode *m); - -/** De-allocates encoder state resources*/ -void nb_encoder_destroy(void *state); - -/** Encodes one frame*/ -int nb_encode(void *state, void *in, SpeexBits *bits); - - -/** Initializes decoder state*/ -void *nb_decoder_init(const SpeexMode *m); - -/** De-allocates decoder state resources*/ -void nb_decoder_destroy(void *state); - -/** Decodes one frame*/ -int nb_decode(void *state, SpeexBits *bits, void *out); - -/** ioctl-like function for controlling a narrowband encoder */ -int nb_encoder_ctl(void *state, int request, void *ptr); - -/** ioctl-like function for controlling a narrowband decoder */ -int nb_decoder_ctl(void *state, int request, void *ptr); - - -#endif diff --git a/src/lib/dl/ext/speex/os_support.h b/src/lib/dl/ext/speex/os_support.h deleted file mode 100755 index d943d9aa..00000000 --- a/src/lib/dl/ext/speex/os_support.h +++ /dev/null @@ -1,169 +0,0 @@ -/* Copyright (C) 2007 Jean-Marc Valin - - File: os_support.h - This is the (tiny) OS abstraction layer. Aside from math.h, this is the - only place where system headers are allowed. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 OS_SUPPORT_H -#define OS_SUPPORT_H - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#ifdef OS_SUPPORT_CUSTOM -#include "os_support_custom.h" -#endif - -/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free - NOTE: speex_alloc needs to CLEAR THE MEMORY */ -#ifndef OVERRIDE_SPEEX_ALLOC -static inline void *speex_alloc (int size) -{ - /* WARNING: this is not equivalent to malloc(). If you want to use malloc() - or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise - you will experience strange bugs */ - return calloc(size,1); -} -#endif - -/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */ -#ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH -static inline void *speex_alloc_scratch (int size) -{ - /* Scratch space doesn't need to be cleared */ - return calloc(size,1); -} -#endif - -/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */ -#ifndef OVERRIDE_SPEEX_REALLOC -static inline void *speex_realloc (void *ptr, int size) -{ - return realloc(ptr, size); -} -#endif - -/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */ -#ifndef OVERRIDE_SPEEX_FREE -static inline void speex_free (void *ptr) -{ - free(ptr); -} -#endif - -/** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */ -#ifndef OVERRIDE_SPEEX_FREE_SCRATCH -static inline void speex_free_scratch (void *ptr) -{ - free(ptr); -} -#endif - -/** Copy n bytes of memory from src to dst. The 0* term provides compile-time type checking */ -#ifndef OVERRIDE_SPEEX_COPY -#define SPEEX_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) )) -#endif - -/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term - provides compile-time type checking */ -#ifndef OVERRIDE_SPEEX_MOVE -#define SPEEX_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) )) -#endif - -/** Set n bytes of memory to value of c, starting at address s */ -#ifndef OVERRIDE_SPEEX_MEMSET -#define SPEEX_MEMSET(dst, c, n) (memset((dst), (c), (n)*sizeof(*(dst)))) -#endif - - -#ifndef OVERRIDE_SPEEX_FATAL -static inline void _speex_fatal(const char *str, const char *file, int line) -{ - fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str); - exit(1); -} -#endif - -#ifndef OVERRIDE_SPEEX_WARNING -static inline void speex_warning(const char *str) -{ -#ifndef DISABLE_WARNINGS - fprintf (stderr, "warning: %s\n", str); -#endif -} -#endif - -#ifndef OVERRIDE_SPEEX_WARNING_INT -static inline void speex_warning_int(const char *str, int val) -{ -#ifndef DISABLE_WARNINGS - fprintf (stderr, "warning: %s %d\n", str, val); -#endif -} -#endif - -#ifndef OVERRIDE_SPEEX_NOTIFY -static inline void speex_notify(const char *str) -{ -#ifndef DISABLE_NOTIFICATIONS -// fprintf (stderr, "notification: %s\n", str); -#endif -} -#endif - -#ifndef OVERRIDE_SPEEX_PUTC -/** Speex wrapper for putc */ -static inline void _speex_putc(int ch, void *file) -{ - FILE *f = (FILE *)file; - fprintf(f, "%c", ch); -} -#endif - -#define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__); -#define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}} - -#ifndef RELEASE -static inline void print_vec(float *vec, int len, char *name) -{ - int i; - printf ("%s ", name); - for (i=0;i<len;i++) - printf (" %f", vec[i]); - printf ("\n"); -} -#endif - -#endif - diff --git a/src/lib/dl/ext/speex/preprocess.c b/src/lib/dl/ext/speex/preprocess.c deleted file mode 100755 index 1309adfb..00000000 --- a/src/lib/dl/ext/speex/preprocess.c +++ /dev/null @@ -1,1219 +0,0 @@ -/* Copyright (C) 2003 Epic Games (written by Jean-Marc Valin) - Copyright (C) 2004-2006 Epic Games - - File: preprocess.c - Preprocessor with denoising based on the algorithm by Ephraim and Malah - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - - -/* - Recommended papers: - - Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error - short-time spectral amplitude estimator". IEEE Transactions on Acoustics, - Speech and Signal Processing, vol. ASSP-32, no. 6, pp. 1109-1121, 1984. - - Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error - log-spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and - Signal Processing, vol. ASSP-33, no. 2, pp. 443-445, 1985. - - I. Cohen and B. Berdugo, "Speech enhancement for non-stationary noise environments". - Signal Processing, vol. 81, no. 2, pp. 2403-2418, 2001. - - Stefan Gustafsson, Rainer Martin, Peter Jax, and Peter Vary. "A psychoacoustic - approach to combined acoustic echo cancellation and noise reduction". IEEE - Transactions on Speech and Audio Processing, 2002. - - J.-M. Valin, J. Rouat, and F. Michaud, "Microphone array post-filter for separation - of simultaneous non-stationary sources". In Proceedings IEEE International - Conference on Acoustics, Speech, and Signal Processing, 2004. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include "speex/speex_preprocess.h" -#include "speex/speex_echo.h" -#include "arch.h" -#include "fftwrap.h" -#include "filterbank.h" -#include "math_approx.h" -#include "os_support.h" - -#ifndef M_PI -#define M_PI 3.14159263 -#endif - -#define LOUDNESS_EXP 5.f -#define AMP_SCALE .001f -#define AMP_SCALE_1 1000.f - -#define NB_BANDS 24 - -#define SPEECH_PROB_START_DEFAULT QCONST16(0.35f,15) -#define SPEECH_PROB_CONTINUE_DEFAULT QCONST16(0.20f,15) -#define NOISE_SUPPRESS_DEFAULT -15 -#define ECHO_SUPPRESS_DEFAULT -40 -#define ECHO_SUPPRESS_ACTIVE_DEFAULT -15 - -#ifndef NULL -#define NULL 0 -#endif - -#define SQR(x) ((x)*(x)) -#define SQR16(x) (MULT16_16((x),(x))) -#define SQR16_Q15(x) (MULT16_16_Q15((x),(x))) - -#ifdef FIXED_POINT -static inline spx_word16_t DIV32_16_Q8(spx_word32_t a, spx_word32_t b) -{ - if (SHR32(a,7) >= b) - { - return 32767; - } else { - if (b>=QCONST32(1,23)) - { - a = SHR32(a,8); - b = SHR32(b,8); - } - if (b>=QCONST32(1,19)) - { - a = SHR32(a,4); - b = SHR32(b,4); - } - if (b>=QCONST32(1,15)) - { - a = SHR32(a,4); - b = SHR32(b,4); - } - a = SHL32(a,8); - return PDIV32_16(a,b); - } - -} -static inline spx_word16_t DIV32_16_Q15(spx_word32_t a, spx_word32_t b) -{ - if (SHR32(a,15) >= b) - { - return 32767; - } else { - if (b>=QCONST32(1,23)) - { - a = SHR32(a,8); - b = SHR32(b,8); - } - if (b>=QCONST32(1,19)) - { - a = SHR32(a,4); - b = SHR32(b,4); - } - if (b>=QCONST32(1,15)) - { - a = SHR32(a,4); - b = SHR32(b,4); - } - a = SHL32(a,15)-a; - return DIV32_16(a,b); - } -} -#define SNR_SCALING 256.f -#define SNR_SCALING_1 0.0039062f -#define SNR_SHIFT 8 - -#define FRAC_SCALING 32767.f -#define FRAC_SCALING_1 3.0518e-05 -#define FRAC_SHIFT 1 - -#define EXPIN_SCALING 2048.f -#define EXPIN_SCALING_1 0.00048828f -#define EXPIN_SHIFT 11 -#define EXPOUT_SCALING_1 1.5259e-05 - -#define NOISE_SHIFT 7 - -#else - -#define DIV32_16_Q8(a,b) ((a)/(b)) -#define DIV32_16_Q15(a,b) ((a)/(b)) -#define SNR_SCALING 1.f -#define SNR_SCALING_1 1.f -#define SNR_SHIFT 0 -#define FRAC_SCALING 1.f -#define FRAC_SCALING_1 1.f -#define FRAC_SHIFT 0 -#define NOISE_SHIFT 0 - -#define EXPIN_SCALING 1.f -#define EXPIN_SCALING_1 1.f -#define EXPOUT_SCALING_1 1.f - -#endif - -/** Speex pre-processor state. */ -struct SpeexPreprocessState_ { - /* Basic info */ - int frame_size; /**< Number of samples processed each time */ - int ps_size; /**< Number of points in the power spectrum */ - int sampling_rate; /**< Sampling rate of the input/output */ - int nbands; - FilterBank *bank; - - /* Parameters */ - int denoise_enabled; - int vad_enabled; - int dereverb_enabled; - spx_word16_t reverb_decay; - spx_word16_t reverb_level; - spx_word16_t speech_prob_start; - spx_word16_t speech_prob_continue; - int noise_suppress; - int echo_suppress; - int echo_suppress_active; - SpeexEchoState *echo_state; - - spx_word16_t speech_prob; /**< Probability last frame was speech */ - - /* DSP-related arrays */ - spx_word16_t *frame; /**< Processing frame (2*ps_size) */ - spx_word16_t *ft; /**< Processing frame in freq domain (2*ps_size) */ - spx_word32_t *ps; /**< Current power spectrum */ - spx_word16_t *gain2; /**< Adjusted gains */ - spx_word16_t *gain_floor; /**< Minimum gain allowed */ - spx_word16_t *window; /**< Analysis/Synthesis window */ - spx_word32_t *noise; /**< Noise estimate */ - spx_word32_t *reverb_estimate; /**< Estimate of reverb energy */ - spx_word32_t *old_ps; /**< Power spectrum for last frame */ - spx_word16_t *gain; /**< Ephraim Malah gain */ - spx_word16_t *prior; /**< A-priori SNR */ - spx_word16_t *post; /**< A-posteriori SNR */ - - spx_word32_t *S; /**< Smoothed power spectrum */ - spx_word32_t *Smin; /**< See Cohen paper */ - spx_word32_t *Stmp; /**< See Cohen paper */ - int *update_prob; /**< Probability of speech presence for noise update */ - - spx_word16_t *zeta; /**< Smoothed a priori SNR */ - spx_word32_t *echo_noise; - spx_word32_t *residual_echo; - - /* Misc */ - spx_word16_t *inbuf; /**< Input buffer (overlapped analysis) */ - spx_word16_t *outbuf; /**< Output buffer (for overlap and add) */ - - /* AGC stuff, only for floating point for now */ -#ifndef FIXED_POINT - int agc_enabled; - float agc_level; - float loudness_accum; - float *loudness_weight; /**< Perceptual loudness curve */ - float loudness; /**< Loudness estimate */ - float agc_gain; /**< Current AGC gain */ - float max_gain; /**< Maximum gain allowed */ - float max_increase_step; /**< Maximum increase in gain from one frame to another */ - float max_decrease_step; /**< Maximum decrease in gain from one frame to another */ - float prev_loudness; /**< Loudness of previous frame */ - float init_max; /**< Current gain limit during initialisation */ -#endif - int nb_adapt; /**< Number of frames used for adaptation so far */ - int was_speech; - int min_count; /**< Number of frames processed so far */ - void *fft_lookup; /**< Lookup table for the FFT */ -#ifdef FIXED_POINT - int frame_shift; -#endif -}; - - -static void conj_window(spx_word16_t *w, int len) -{ - int i; - for (i=0;i<len;i++) - { - spx_word16_t tmp; -#ifdef FIXED_POINT - spx_word16_t x = DIV32_16(MULT16_16(32767,i),len); -#else - spx_word16_t x = DIV32_16(MULT16_16(QCONST16(4.f,13),i),len); -#endif - int inv=0; - if (x<QCONST16(1.f,13)) - { - } else if (x<QCONST16(2.f,13)) - { - x=QCONST16(2.f,13)-x; - inv=1; - } else if (x<QCONST16(3.f,13)) - { - x=x-QCONST16(2.f,13); - inv=1; - } else { - x=QCONST16(2.f,13)-x+QCONST16(2.f,13); /* 4 - x */ - } - x = MULT16_16_Q14(QCONST16(1.271903f,14), x); - tmp = SQR16_Q15(QCONST16(.5f,15)-MULT16_16_P15(QCONST16(.5f,15),spx_cos_norm(SHL32(EXTEND32(x),2)))); - if (inv) - tmp=SUB16(Q15_ONE,tmp); - w[i]=spx_sqrt(SHL32(EXTEND32(tmp),15)); - } -} - - -#ifdef FIXED_POINT -/* This function approximates the gain function - y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x) - which multiplied by xi/(1+xi) is the optimal gain - in the loudness domain ( sqrt[amplitude] ) - Input in Q11 format, output in Q15 -*/ -static inline spx_word32_t hypergeom_gain(spx_word32_t xx) -{ - int ind; - spx_word16_t frac; - /* Q13 table */ - static const spx_word16_t table[21] = { - 6730, 8357, 9868, 11267, 12563, 13770, 14898, - 15959, 16961, 17911, 18816, 19682, 20512, 21311, - 22082, 22827, 23549, 24250, 24931, 25594, 26241}; - ind = SHR32(xx,10); - if (ind<0) - return Q15_ONE; - if (ind>19) - return ADD32(EXTEND32(Q15_ONE),EXTEND32(DIV32_16(QCONST32(.1296,23), SHR32(xx,EXPIN_SHIFT-SNR_SHIFT)))); - frac = SHL32(xx-SHL32(ind,10),5); - return SHL32(DIV32_16(PSHR32(MULT16_16(Q15_ONE-frac,table[ind]) + MULT16_16(frac,table[ind+1]),7),(spx_sqrt(SHL32(xx,15)+6711))),7); -} - -static inline spx_word16_t qcurve(spx_word16_t x) -{ - x = MAX16(x, 1); - return DIV32_16(SHL32(EXTEND32(32767),9),ADD16(512,MULT16_16_Q15(QCONST16(.60f,15),DIV32_16(32767,x)))); -} - -/* Compute the gain floor based on different floors for the background noise and residual echo */ -static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len) -{ - int i; - - if (noise_suppress > effective_echo_suppress) - { - spx_word16_t noise_gain, gain_ratio; - noise_gain = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(0.11513,11),noise_suppress)),1))); - gain_ratio = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(.2302585f,11),effective_echo_suppress-noise_suppress)),1))); - - /* gain_floor = sqrt [ (noise*noise_floor + echo*echo_floor) / (noise+echo) ] */ - for (i=0;i<len;i++) - gain_floor[i] = MULT16_16_Q15(noise_gain, - spx_sqrt(SHL32(EXTEND32(DIV32_16_Q15(PSHR32(noise[i],NOISE_SHIFT) + MULT16_32_Q15(gain_ratio,echo[i]), - (1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]) )),15))); - } else { - spx_word16_t echo_gain, gain_ratio; - echo_gain = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(0.11513,11),effective_echo_suppress)),1))); - gain_ratio = EXTRACT16(MIN32(Q15_ONE,SHR32(spx_exp(MULT16_16(QCONST16(.2302585f,11),noise_suppress-effective_echo_suppress)),1))); - - /* gain_floor = sqrt [ (noise*noise_floor + echo*echo_floor) / (noise+echo) ] */ - for (i=0;i<len;i++) - gain_floor[i] = MULT16_16_Q15(echo_gain, - spx_sqrt(SHL32(EXTEND32(DIV32_16_Q15(MULT16_32_Q15(gain_ratio,PSHR32(noise[i],NOISE_SHIFT)) + echo[i], - (1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]) )),15))); - } -} - -#else -/* This function approximates the gain function - y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x) - which multiplied by xi/(1+xi) is the optimal gain - in the loudness domain ( sqrt[amplitude] ) -*/ -static inline spx_word32_t hypergeom_gain(spx_word32_t xx) -{ - int ind; - float integer, frac; - float x; - static const float table[21] = { - 0.82157f, 1.02017f, 1.20461f, 1.37534f, 1.53363f, 1.68092f, 1.81865f, - 1.94811f, 2.07038f, 2.18638f, 2.29688f, 2.40255f, 2.50391f, 2.60144f, - 2.69551f, 2.78647f, 2.87458f, 2.96015f, 3.04333f, 3.12431f, 3.20326f}; - x = EXPIN_SCALING_1*xx; - integer = floor(2*x); - ind = (int)integer; - if (ind<0) - return FRAC_SCALING; - if (ind>19) - return FRAC_SCALING*(1+.1296/x); - frac = 2*x-integer; - return FRAC_SCALING*((1-frac)*table[ind] + frac*table[ind+1])/sqrt(x+.0001f); -} - -static inline spx_word16_t qcurve(spx_word16_t x) -{ - return 1.f/(1.f+.15f/(SNR_SCALING_1*x)); -} - -static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len) -{ - int i; - float echo_floor; - float noise_floor; - - noise_floor = exp(.2302585f*noise_suppress); - echo_floor = exp(.2302585f*effective_echo_suppress); - - /* Compute the gain floor based on different floors for the background noise and residual echo */ - for (i=0;i<len;i++) - gain_floor[i] = FRAC_SCALING*sqrt(noise_floor*PSHR32(noise[i],NOISE_SHIFT) + echo_floor*echo[i])/sqrt(1+PSHR32(noise[i],NOISE_SHIFT) + echo[i]); -} - -#endif -EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate) -{ - int i; - int N, N3, N4, M; - - SpeexPreprocessState *st = (SpeexPreprocessState *)speex_alloc(sizeof(SpeexPreprocessState)); - st->frame_size = frame_size; - - /* Round ps_size down to the nearest power of two */ -#if 0 - i=1; - st->ps_size = st->frame_size; - while(1) - { - if (st->ps_size & ~i) - { - st->ps_size &= ~i; - i<<=1; - } else { - break; - } - } - - - if (st->ps_size < 3*st->frame_size/4) - st->ps_size = st->ps_size * 3 / 2; -#else - st->ps_size = st->frame_size; -#endif - - N = st->ps_size; - N3 = 2*N - st->frame_size; - N4 = st->frame_size - N3; - - st->sampling_rate = sampling_rate; - st->denoise_enabled = 1; - st->vad_enabled = 0; - st->dereverb_enabled = 0; - st->reverb_decay = 0; - st->reverb_level = 0; - st->noise_suppress = NOISE_SUPPRESS_DEFAULT; - st->echo_suppress = ECHO_SUPPRESS_DEFAULT; - st->echo_suppress_active = ECHO_SUPPRESS_ACTIVE_DEFAULT; - - st->speech_prob_start = SPEECH_PROB_START_DEFAULT; - st->speech_prob_continue = SPEECH_PROB_CONTINUE_DEFAULT; - - st->echo_state = NULL; - - st->nbands = NB_BANDS; - M = st->nbands; - st->bank = filterbank_new(M, sampling_rate, N, 1); - - st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t)); - st->window = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t)); - st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t)); - - st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); - st->noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); - st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); - st->residual_echo = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); - st->reverb_estimate = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); - st->old_ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); - st->prior = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); - st->post = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); - st->gain = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); - st->gain2 = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); - st->gain_floor = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); - st->zeta = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); - - st->S = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t)); - st->Smin = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t)); - st->Stmp = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t)); - st->update_prob = (int*)speex_alloc(N*sizeof(int)); - - st->inbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t)); - st->outbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t)); - - conj_window(st->window, 2*N3); - for (i=2*N3;i<2*st->ps_size;i++) - st->window[i]=Q15_ONE; - - if (N4>0) - { - for (i=N3-1;i>=0;i--) - { - st->window[i+N3+N4]=st->window[i+N3]; - st->window[i+N3]=1; - } - } - for (i=0;i<N+M;i++) - { - st->noise[i]=QCONST32(1.f,NOISE_SHIFT); - st->reverb_estimate[i]=0; - st->old_ps[i]=1; - st->gain[i]=Q15_ONE; - st->post[i]=SHL16(1, SNR_SHIFT); - st->prior[i]=SHL16(1, SNR_SHIFT); - } - - for (i=0;i<N;i++) - st->update_prob[i] = 1; - for (i=0;i<N3;i++) - { - st->inbuf[i]=0; - st->outbuf[i]=0; - } -#ifndef FIXED_POINT - st->agc_enabled = 0; - st->agc_level = 8000; - st->loudness_weight = (float*)speex_alloc(N*sizeof(float)); - for (i=0;i<N;i++) - { - float ff=((float)i)*.5*sampling_rate/((float)N); - /*st->loudness_weight[i] = .5f*(1.f/(1.f+ff/8000.f))+1.f*exp(-.5f*(ff-3800.f)*(ff-3800.f)/9e5f);*/ - st->loudness_weight[i] = .35f-.35f*ff/16000.f+.73f*exp(-.5f*(ff-3800)*(ff-3800)/9e5f); - if (st->loudness_weight[i]<.01f) - st->loudness_weight[i]=.01f; - st->loudness_weight[i] *= st->loudness_weight[i]; - } - /*st->loudness = pow(AMP_SCALE*st->agc_level,LOUDNESS_EXP);*/ - st->loudness = 1e-15; - st->agc_gain = 1; - st->max_gain = 30; - st->max_increase_step = exp(0.11513f * 12.*st->frame_size / st->sampling_rate); - st->max_decrease_step = exp(-0.11513f * 40.*st->frame_size / st->sampling_rate); - st->prev_loudness = 1; - st->init_max = 1; -#endif - st->was_speech = 0; - - st->fft_lookup = spx_fft_init(2*N); - - st->nb_adapt=0; - st->min_count=0; - return st; -} - -EXPORT void speex_preprocess_state_destroy(SpeexPreprocessState *st) -{ - speex_free(st->frame); - speex_free(st->ft); - speex_free(st->ps); - speex_free(st->gain2); - speex_free(st->gain_floor); - speex_free(st->window); - speex_free(st->noise); - speex_free(st->reverb_estimate); - speex_free(st->old_ps); - speex_free(st->gain); - speex_free(st->prior); - speex_free(st->post); -#ifndef FIXED_POINT - speex_free(st->loudness_weight); -#endif - speex_free(st->echo_noise); - speex_free(st->residual_echo); - - speex_free(st->S); - speex_free(st->Smin); - speex_free(st->Stmp); - speex_free(st->update_prob); - speex_free(st->zeta); - - speex_free(st->inbuf); - speex_free(st->outbuf); - - spx_fft_destroy(st->fft_lookup); - filterbank_destroy(st->bank); - speex_free(st); -} - -/* FIXME: The AGC doesn't work yet with fixed-point*/ -#ifndef FIXED_POINT -static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx_word16_t *ft) -{ - int i; - int N = st->ps_size; - float target_gain; - float loudness=1.f; - float rate; - - for (i=2;i<N;i++) - { - loudness += 2.f*N*st->ps[i]* st->loudness_weight[i]; - } - loudness=sqrt(loudness); - /*if (loudness < 2*pow(st->loudness, 1.0/LOUDNESS_EXP) && - loudness*2 > pow(st->loudness, 1.0/LOUDNESS_EXP))*/ - if (Pframe>.3f) - { - /*rate=2.0f*Pframe*Pframe/(1+st->nb_loudness_adapt);*/ - rate = .03*Pframe*Pframe; - st->loudness = (1-rate)*st->loudness + (rate)*pow(AMP_SCALE*loudness, LOUDNESS_EXP); - st->loudness_accum = (1-rate)*st->loudness_accum + rate; - if (st->init_max < st->max_gain && st->nb_adapt > 20) - st->init_max *= 1.f + .1f*Pframe*Pframe; - } - /*printf ("%f %f %f %f\n", Pframe, loudness, pow(st->loudness, 1.0f/LOUDNESS_EXP), st->loudness2);*/ - - target_gain = AMP_SCALE*st->agc_level*pow(st->loudness/(1e-4+st->loudness_accum), -1.0f/LOUDNESS_EXP); - - if ((Pframe>.5 && st->nb_adapt > 20) || target_gain < st->agc_gain) - { - if (target_gain > st->max_increase_step*st->agc_gain) - target_gain = st->max_increase_step*st->agc_gain; - if (target_gain < st->max_decrease_step*st->agc_gain && loudness < 10*st->prev_loudness) - target_gain = st->max_decrease_step*st->agc_gain; - if (target_gain > st->max_gain) - target_gain = st->max_gain; - if (target_gain > st->init_max) - target_gain = st->init_max; - - st->agc_gain = target_gain; - } - /*fprintf (stderr, "%f %f %f\n", loudness, (float)AMP_SCALE_1*pow(st->loudness, 1.0f/LOUDNESS_EXP), st->agc_gain);*/ - - for (i=0;i<2*N;i++) - ft[i] *= st->agc_gain; - st->prev_loudness = loudness; -} -#endif - -static void preprocess_analysis(SpeexPreprocessState *st, spx_int16_t *x) -{ - int i; - int N = st->ps_size; - int N3 = 2*N - st->frame_size; - int N4 = st->frame_size - N3; - spx_word32_t *ps=st->ps; - - /* 'Build' input frame */ - for (i=0;i<N3;i++) - st->frame[i]=st->inbuf[i]; - for (i=0;i<st->frame_size;i++) - st->frame[N3+i]=x[i]; - - /* Update inbuf */ - for (i=0;i<N3;i++) - st->inbuf[i]=x[N4+i]; - - /* Windowing */ - for (i=0;i<2*N;i++) - st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]); - -#ifdef FIXED_POINT - { - spx_word16_t max_val=0; - for (i=0;i<2*N;i++) - max_val = MAX16(max_val, ABS16(st->frame[i])); - st->frame_shift = 14-spx_ilog2(EXTEND32(max_val)); - for (i=0;i<2*N;i++) - st->frame[i] = SHL16(st->frame[i], st->frame_shift); - } -#endif - - /* Perform FFT */ - spx_fft(st->fft_lookup, st->frame, st->ft); - - /* Power spectrum */ - ps[0]=MULT16_16(st->ft[0],st->ft[0]); - for (i=1;i<N;i++) - ps[i]=MULT16_16(st->ft[2*i-1],st->ft[2*i-1]) + MULT16_16(st->ft[2*i],st->ft[2*i]); - for (i=0;i<N;i++) - st->ps[i] = PSHR32(st->ps[i], 2*st->frame_shift); - - filterbank_compute_bank32(st->bank, ps, ps+N); -} - -static void update_noise_prob(SpeexPreprocessState *st) -{ - int i; - int min_range; - int N = st->ps_size; - - for (i=1;i<N-1;i++) - st->S[i] = MULT16_32_Q15(QCONST16(.8f,15),st->S[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i-1]) - + MULT16_32_Q15(QCONST16(.1f,15),st->ps[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i+1]); - st->S[0] = MULT16_32_Q15(QCONST16(.8f,15),st->S[0]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[0]); - st->S[N-1] = MULT16_32_Q15(QCONST16(.8f,15),st->S[N-1]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[N-1]); - - if (st->nb_adapt==1) - { - for (i=0;i<N;i++) - st->Smin[i] = st->Stmp[i] = 0; - } - - if (st->nb_adapt < 100) - min_range = 15; - else if (st->nb_adapt < 1000) - min_range = 50; - else if (st->nb_adapt < 10000) - min_range = 150; - else - min_range = 300; - if (st->min_count > min_range) - { - st->min_count = 0; - for (i=0;i<N;i++) - { - st->Smin[i] = MIN32(st->Stmp[i], st->S[i]); - st->Stmp[i] = st->S[i]; - } - } else { - for (i=0;i<N;i++) - { - st->Smin[i] = MIN32(st->Smin[i], st->S[i]); - st->Stmp[i] = MIN32(st->Stmp[i], st->S[i]); - } - } - for (i=0;i<N;i++) - { - if (MULT16_32_Q15(QCONST16(.4f,15),st->S[i]) > st->Smin[i]) - st->update_prob[i] = 1; - else - st->update_prob[i] = 0; - /*fprintf (stderr, "%f ", st->S[i]/st->Smin[i]);*/ - /*fprintf (stderr, "%f ", st->update_prob[i]);*/ - } - -} - -#define NOISE_OVERCOMPENS 1. - -void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *Yout, int len); - -EXPORT int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo) -{ - return speex_preprocess_run(st, x); -} - -EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x) -{ - int i; - int M; - int N = st->ps_size; - int N3 = 2*N - st->frame_size; - int N4 = st->frame_size - N3; - spx_word32_t *ps=st->ps; - spx_word32_t Zframe; - spx_word16_t Pframe; - spx_word16_t beta, beta_1; - spx_word16_t effective_echo_suppress; - - st->nb_adapt++; - if (st->nb_adapt>20000) - st->nb_adapt = 20000; - st->min_count++; - - beta = MAX16(QCONST16(.03,15),DIV32_16(Q15_ONE,st->nb_adapt)); - beta_1 = Q15_ONE-beta; - M = st->nbands; - /* Deal with residual echo if provided */ - if (st->echo_state) - { - speex_echo_get_residual(st->echo_state, st->residual_echo, N); -#ifndef FIXED_POINT - /* If there are NaNs or ridiculous values, it'll show up in the DC and we just reset everything to zero */ - if (!(st->residual_echo[0] >=0 && st->residual_echo[0]<N*1e9f)) - { - for (i=0;i<N;i++) - st->residual_echo[i] = 0; - } -#endif - for (i=0;i<N;i++) - st->echo_noise[i] = MAX32(MULT16_32_Q15(QCONST16(.6f,15),st->echo_noise[i]), st->residual_echo[i]); - filterbank_compute_bank32(st->bank, st->echo_noise, st->echo_noise+N); - } else { - for (i=0;i<N+M;i++) - st->echo_noise[i] = 0; - } - preprocess_analysis(st, x); - - update_noise_prob(st); - - /* Noise estimation always updated for the 10 first frames */ - /*if (st->nb_adapt<10) - { - for (i=1;i<N-1;i++) - st->update_prob[i] = 0; - } - */ - - /* Update the noise estimate for the frequencies where it can be */ - for (i=0;i<N;i++) - { - if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i], NOISE_SHIFT)) - st->noise[i] = MAX32(EXTEND32(0),MULT16_32_Q15(beta_1,st->noise[i]) + MULT16_32_Q15(beta,SHL32(st->ps[i],NOISE_SHIFT))); - } - filterbank_compute_bank32(st->bank, st->noise, st->noise+N); - - /* Special case for first frame */ - if (st->nb_adapt==1) - for (i=0;i<N+M;i++) - st->old_ps[i] = ps[i]; - - /* Compute a posteriori SNR */ - for (i=0;i<N+M;i++) - { - spx_word16_t gamma; - - /* Total noise estimate including residual echo and reverberation */ - spx_word32_t tot_noise = ADD32(ADD32(ADD32(EXTEND32(1), PSHR32(st->noise[i],NOISE_SHIFT)) , st->echo_noise[i]) , st->reverb_estimate[i]); - - /* A posteriori SNR = ps/noise - 1*/ - st->post[i] = SUB16(DIV32_16_Q8(ps[i],tot_noise), QCONST16(1.f,SNR_SHIFT)); - st->post[i]=MIN16(st->post[i], QCONST16(100.f,SNR_SHIFT)); - - /* Computing update gamma = .1 + .9*(old/(old+noise))^2 */ - gamma = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.89f,15),SQR16_Q15(DIV32_16_Q15(st->old_ps[i],ADD32(st->old_ps[i],tot_noise)))); - - /* A priori SNR update = gamma*max(0,post) + (1-gamma)*old/noise */ - st->prior[i] = EXTRACT16(PSHR32(ADD32(MULT16_16(gamma,MAX16(0,st->post[i])), MULT16_16(Q15_ONE-gamma,DIV32_16_Q8(st->old_ps[i],tot_noise))), 15)); - st->prior[i]=MIN16(st->prior[i], QCONST16(100.f,SNR_SHIFT)); - } - - /*print_vec(st->post, N+M, "");*/ - - /* Recursive average of the a priori SNR. A bit smoothed for the psd components */ - st->zeta[0] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[0]), MULT16_16(QCONST16(.3f,15),st->prior[0])),15); - for (i=1;i<N-1;i++) - st->zeta[i] = PSHR32(ADD32(ADD32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[i]), MULT16_16(QCONST16(.15f,15),st->prior[i])), - MULT16_16(QCONST16(.075f,15),st->prior[i-1])), MULT16_16(QCONST16(.075f,15),st->prior[i+1])),15); - for (i=N-1;i<N+M;i++) - st->zeta[i] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),st->zeta[i]), MULT16_16(QCONST16(.3f,15),st->prior[i])),15); - - /* Speech probability of presence for the entire frame is based on the average filterbank a priori SNR */ - Zframe = 0; - for (i=N;i<N+M;i++) - Zframe = ADD32(Zframe, EXTEND32(st->zeta[i])); - Pframe = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.899f,15),qcurve(DIV32_16(Zframe,st->nbands))); - - effective_echo_suppress = EXTRACT16(PSHR32(ADD32(MULT16_16(SUB16(Q15_ONE,Pframe), st->echo_suppress), MULT16_16(Pframe, st->echo_suppress_active)),15)); - - compute_gain_floor(st->noise_suppress, effective_echo_suppress, st->noise+N, st->echo_noise+N, st->gain_floor+N, M); - - /* Compute Ephraim & Malah gain speech probability of presence for each critical band (Bark scale) - Technically this is actually wrong because the EM gaim assumes a slightly different probability - distribution */ - for (i=N;i<N+M;i++) - { - /* See EM and Cohen papers*/ - spx_word32_t theta; - /* Gain from hypergeometric function */ - spx_word32_t MM; - /* Weiner filter gain */ - spx_word16_t prior_ratio; - /* a priority probability of speech presence based on Bark sub-band alone */ - spx_word16_t P1; - /* Speech absence a priori probability (considering sub-band and frame) */ - spx_word16_t q; -#ifdef FIXED_POINT - spx_word16_t tmp; -#endif - - prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT))); - theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT)); - - MM = hypergeom_gain(theta); - /* Gain with bound */ - st->gain[i] = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM))); - /* Save old Bark power spectrum */ - st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]); - - P1 = QCONST16(.199f,15)+MULT16_16_Q15(QCONST16(.8f,15),qcurve (st->zeta[i])); - q = Q15_ONE-MULT16_16_Q15(Pframe,P1); -#ifdef FIXED_POINT - theta = MIN32(theta, EXTEND32(32767)); -/*Q8*/tmp = MULT16_16_Q15((SHL32(1,SNR_SHIFT)+st->prior[i]),EXTRACT16(MIN32(Q15ONE,SHR32(spx_exp(-EXTRACT16(theta)),1)))); - tmp = MIN16(QCONST16(3.,SNR_SHIFT), tmp); /* Prevent overflows in the next line*/ -/*Q8*/tmp = EXTRACT16(PSHR32(MULT16_16(PDIV32_16(SHL32(EXTEND32(q),8),(Q15_ONE-q)),tmp),8)); - st->gain2[i]=DIV32_16(SHL32(EXTEND32(32767),SNR_SHIFT), ADD16(256,tmp)); -#else - st->gain2[i]=1/(1.f + (q/(1.f-q))*(1+st->prior[i])*exp(-theta)); -#endif - } - /* Convert the EM gains and speech prob to linear frequency */ - filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2); - filterbank_compute_psd16(st->bank,st->gain+N, st->gain); - - /* Use 1 for linear gain resolution (best) or 0 for Bark gain resolution (faster) */ - if (1) - { - filterbank_compute_psd16(st->bank,st->gain_floor+N, st->gain_floor); - - /* Compute gain according to the Ephraim-Malah algorithm -- linear frequency */ - for (i=0;i<N;i++) - { - spx_word32_t MM; - spx_word32_t theta; - spx_word16_t prior_ratio; - spx_word16_t tmp; - spx_word16_t p; - spx_word16_t g; - - /* Wiener filter gain */ - prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT))); - theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT)); - - /* Optimal estimator for loudness domain */ - MM = hypergeom_gain(theta); - /* EM gain with bound */ - g = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM))); - /* Interpolated speech probability of presence */ - p = st->gain2[i]; - - /* Constrain the gain to be close to the Bark scale gain */ - if (MULT16_16_Q15(QCONST16(.333f,15),g) > st->gain[i]) - g = MULT16_16(3,st->gain[i]); - st->gain[i] = g; - - /* Save old power spectrum */ - st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]); - - /* Apply gain floor */ - if (st->gain[i] < st->gain_floor[i]) - st->gain[i] = st->gain_floor[i]; - - /* Exponential decay model for reverberation (unused) */ - /*st->reverb_estimate[i] = st->reverb_decay*st->reverb_estimate[i] + st->reverb_decay*st->reverb_level*st->gain[i]*st->gain[i]*st->ps[i];*/ - - /* Take into account speech probability of presence (loudness domain MMSE estimator) */ - /* gain2 = [p*sqrt(gain)+(1-p)*sqrt(gain _floor) ]^2 */ - tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15))); - st->gain2[i]=SQR16_Q15(tmp); - - /* Use this if you want a log-domain MMSE estimator instead */ - /*st->gain2[i] = pow(st->gain[i], p) * pow(st->gain_floor[i],1.f-p);*/ - } - } else { - for (i=N;i<N+M;i++) - { - spx_word16_t tmp; - spx_word16_t p = st->gain2[i]; - st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]); - tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15))); - st->gain2[i]=SQR16_Q15(tmp); - } - filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2); - } - - /* If noise suppression is off, don't apply the gain (but then why call this in the first place!) */ - if (!st->denoise_enabled) - { - for (i=0;i<N+M;i++) - st->gain2[i]=Q15_ONE; - } - - /* Apply computed gain */ - for (i=1;i<N;i++) - { - st->ft[2*i-1] = MULT16_16_P15(st->gain2[i],st->ft[2*i-1]); - st->ft[2*i] = MULT16_16_P15(st->gain2[i],st->ft[2*i]); - } - st->ft[0] = MULT16_16_P15(st->gain2[0],st->ft[0]); - st->ft[2*N-1] = MULT16_16_P15(st->gain2[N-1],st->ft[2*N-1]); - - /*FIXME: This *will* not work for fixed-point */ -#ifndef FIXED_POINT - if (st->agc_enabled) - speex_compute_agc(st, Pframe, st->ft); -#endif - - /* Inverse FFT with 1/N scaling */ - spx_ifft(st->fft_lookup, st->ft, st->frame); - /* Scale back to original (lower) amplitude */ - for (i=0;i<2*N;i++) - st->frame[i] = PSHR16(st->frame[i], st->frame_shift); - - /*FIXME: This *will* not work for fixed-point */ -#ifndef FIXED_POINT - if (st->agc_enabled) - { - float max_sample=0; - for (i=0;i<2*N;i++) - if (fabs(st->frame[i])>max_sample) - max_sample = fabs(st->frame[i]); - if (max_sample>28000.f) - { - float damp = 28000.f/max_sample; - for (i=0;i<2*N;i++) - st->frame[i] *= damp; - } - } -#endif - - /* Synthesis window (for WOLA) */ - for (i=0;i<2*N;i++) - st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]); - - /* Perform overlap and add */ - for (i=0;i<N3;i++) - x[i] = st->outbuf[i] + st->frame[i]; - for (i=0;i<N4;i++) - x[N3+i] = st->frame[N3+i]; - - /* Update outbuf */ - for (i=0;i<N3;i++) - st->outbuf[i] = st->frame[st->frame_size+i]; - - /* FIXME: This VAD is a kludge */ - st->speech_prob = Pframe; - if (st->vad_enabled) - { - if (st->speech_prob > st->speech_prob_start || (st->was_speech && st->speech_prob > st->speech_prob_continue)) - { - st->was_speech=1; - return 1; - } else - { - st->was_speech=0; - return 0; - } - } else { - return 1; - } -} - -EXPORT void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x) -{ - int i; - int N = st->ps_size; - int N3 = 2*N - st->frame_size; - int M; - spx_word32_t *ps=st->ps; - - M = st->nbands; - st->min_count++; - - preprocess_analysis(st, x); - - update_noise_prob(st); - - for (i=1;i<N-1;i++) - { - if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i],NOISE_SHIFT)) - { - st->noise[i] = MULT16_32_Q15(QCONST16(.95f,15),st->noise[i]) + MULT16_32_Q15(QCONST16(.05f,15),SHL32(st->ps[i],NOISE_SHIFT)); - } - } - - for (i=0;i<N3;i++) - st->outbuf[i] = MULT16_16_Q15(x[st->frame_size-N3+i],st->window[st->frame_size+i]); - - /* Save old power spectrum */ - for (i=0;i<N+M;i++) - st->old_ps[i] = ps[i]; - - for (i=0;i<N;i++) - st->reverb_estimate[i] = MULT16_32_Q15(st->reverb_decay, st->reverb_estimate[i]); -} - - -EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr) -{ - int i; - SpeexPreprocessState *st; - st=(SpeexPreprocessState*)state; - switch(request) - { - case SPEEX_PREPROCESS_SET_DENOISE: - st->denoise_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_PREPROCESS_GET_DENOISE: - (*(spx_int32_t*)ptr) = st->denoise_enabled; - break; -#ifndef FIXED_POINT - case SPEEX_PREPROCESS_SET_AGC: - st->agc_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_PREPROCESS_GET_AGC: - (*(spx_int32_t*)ptr) = st->agc_enabled; - break; -#ifndef DISABLE_FLOAT_API - case SPEEX_PREPROCESS_SET_AGC_LEVEL: - st->agc_level = (*(float*)ptr); - if (st->agc_level<1) - st->agc_level=1; - if (st->agc_level>32768) - st->agc_level=32768; - break; - case SPEEX_PREPROCESS_GET_AGC_LEVEL: - (*(float*)ptr) = st->agc_level; - break; -#endif /* #ifndef DISABLE_FLOAT_API */ - case SPEEX_PREPROCESS_SET_AGC_INCREMENT: - st->max_increase_step = exp(0.11513f * (*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate); - break; - case SPEEX_PREPROCESS_GET_AGC_INCREMENT: - (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_increase_step)*st->sampling_rate/st->frame_size); - break; - case SPEEX_PREPROCESS_SET_AGC_DECREMENT: - st->max_decrease_step = exp(0.11513f * (*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate); - break; - case SPEEX_PREPROCESS_GET_AGC_DECREMENT: - (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_decrease_step)*st->sampling_rate/st->frame_size); - break; - case SPEEX_PREPROCESS_SET_AGC_MAX_GAIN: - st->max_gain = exp(0.11513f * (*(spx_int32_t*)ptr)); - break; - case SPEEX_PREPROCESS_GET_AGC_MAX_GAIN: - (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->max_gain)); - break; -#endif - case SPEEX_PREPROCESS_SET_VAD: - speex_warning("The VAD has been replaced by a hack pending a complete rewrite"); - st->vad_enabled = (*(spx_int32_t*)ptr); - break; - case SPEEX_PREPROCESS_GET_VAD: - (*(spx_int32_t*)ptr) = st->vad_enabled; - break; - - case SPEEX_PREPROCESS_SET_DEREVERB: - st->dereverb_enabled = (*(spx_int32_t*)ptr); - for (i=0;i<st->ps_size;i++) - st->reverb_estimate[i]=0; - break; - case SPEEX_PREPROCESS_GET_DEREVERB: - (*(spx_int32_t*)ptr) = st->dereverb_enabled; - break; - - case SPEEX_PREPROCESS_SET_DEREVERB_LEVEL: - /* FIXME: Re-enable when de-reverberation is actually enabled again */ - /*st->reverb_level = (*(float*)ptr);*/ - break; - case SPEEX_PREPROCESS_GET_DEREVERB_LEVEL: - /* FIXME: Re-enable when de-reverberation is actually enabled again */ - /*(*(float*)ptr) = st->reverb_level;*/ - break; - - case SPEEX_PREPROCESS_SET_DEREVERB_DECAY: - /* FIXME: Re-enable when de-reverberation is actually enabled again */ - /*st->reverb_decay = (*(float*)ptr);*/ - break; - case SPEEX_PREPROCESS_GET_DEREVERB_DECAY: - /* FIXME: Re-enable when de-reverberation is actually enabled again */ - /*(*(float*)ptr) = st->reverb_decay;*/ - break; - - case SPEEX_PREPROCESS_SET_PROB_START: - *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr)); - st->speech_prob_start = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100); - break; - case SPEEX_PREPROCESS_GET_PROB_START: - (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_start, 100); - break; - - case SPEEX_PREPROCESS_SET_PROB_CONTINUE: - *(spx_int32_t*)ptr = MIN32(100,MAX32(0, *(spx_int32_t*)ptr)); - st->speech_prob_continue = DIV32_16(MULT16_16(Q15ONE,*(spx_int32_t*)ptr), 100); - break; - case SPEEX_PREPROCESS_GET_PROB_CONTINUE: - (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob_continue, 100); - break; - - case SPEEX_PREPROCESS_SET_NOISE_SUPPRESS: - st->noise_suppress = -ABS(*(spx_int32_t*)ptr); - break; - case SPEEX_PREPROCESS_GET_NOISE_SUPPRESS: - (*(spx_int32_t*)ptr) = st->noise_suppress; - break; - case SPEEX_PREPROCESS_SET_ECHO_SUPPRESS: - st->echo_suppress = -ABS(*(spx_int32_t*)ptr); - break; - case SPEEX_PREPROCESS_GET_ECHO_SUPPRESS: - (*(spx_int32_t*)ptr) = st->echo_suppress; - break; - case SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE: - st->echo_suppress_active = -ABS(*(spx_int32_t*)ptr); - break; - case SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE: - (*(spx_int32_t*)ptr) = st->echo_suppress_active; - break; - case SPEEX_PREPROCESS_SET_ECHO_STATE: - st->echo_state = (SpeexEchoState*)ptr; - break; - case SPEEX_PREPROCESS_GET_ECHO_STATE: - (*(SpeexEchoState**)ptr) = (SpeexEchoState*)st->echo_state; - break; -#ifndef FIXED_POINT - case SPEEX_PREPROCESS_GET_AGC_LOUDNESS: - (*(spx_int32_t*)ptr) = pow(st->loudness, 1.0/LOUDNESS_EXP); - break; - case SPEEX_PREPROCESS_GET_AGC_GAIN: - (*(spx_int32_t*)ptr) = floor(.5+8.6858*log(st->agc_gain)); - break; -#endif - case SPEEX_PREPROCESS_GET_PSD_SIZE: - case SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE: - (*(spx_int32_t*)ptr) = st->ps_size; - break; - case SPEEX_PREPROCESS_GET_PSD: - for(i=0;i<st->ps_size;i++) - ((spx_int32_t *)ptr)[i] = (spx_int32_t) st->ps[i]; - break; - case SPEEX_PREPROCESS_GET_NOISE_PSD: - for(i=0;i<st->ps_size;i++) - ((spx_int32_t *)ptr)[i] = (spx_int32_t) PSHR32(st->noise[i], NOISE_SHIFT); - break; - case SPEEX_PREPROCESS_GET_PROB: - (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob, 100); - break; -#ifndef FIXED_POINT - case SPEEX_PREPROCESS_SET_AGC_TARGET: - st->agc_level = (*(spx_int32_t*)ptr); - if (st->agc_level<1) - st->agc_level=1; - if (st->agc_level>32768) - st->agc_level=32768; - break; - case SPEEX_PREPROCESS_GET_AGC_TARGET: - (*(spx_int32_t*)ptr) = st->agc_level; - break; -#endif - default: - speex_warning_int("Unknown speex_preprocess_ctl request: ", request); - return -1; - } - return 0; -} - -#ifdef FIXED_DEBUG -long long spx_mips=0; -#endif - diff --git a/src/lib/dl/ext/speex/pseudofloat.h b/src/lib/dl/ext/speex/pseudofloat.h deleted file mode 100755 index fa841a01..00000000 --- a/src/lib/dl/ext/speex/pseudofloat.h +++ /dev/null @@ -1,379 +0,0 @@ -/* Copyright (C) 2005 Jean-Marc Valin */ -/** - @file pseudofloat.h - @brief Pseudo-floating point - * This header file provides a lightweight floating point type for - * use on fixed-point platforms when a large dynamic range is - * required. The new type is not compatible with the 32-bit IEEE format, - * it is not even remotely as accurate as 32-bit floats, and is not - * even guaranteed to produce even remotely correct results for code - * other than Speex. It makes all kinds of shortcuts that are acceptable - * for Speex, but may not be acceptable for your application. You're - * quite welcome to reuse this code and improve it, but don't assume - * it works out of the box. Most likely, it doesn't. - */ -/* - 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 PSEUDOFLOAT_H -#define PSEUDOFLOAT_H - -#include "arch.h" -#include "os_support.h" -#include "math_approx.h" -#include <math.h> - -#ifdef FIXED_POINT - -typedef struct { - spx_int16_t m; - spx_int16_t e; -} spx_float_t; - -static const spx_float_t FLOAT_ZERO = {0,0}; -static const spx_float_t FLOAT_ONE = {16384,-14}; -static const spx_float_t FLOAT_HALF = {16384,-15}; - -#define MIN(a,b) ((a)<(b)?(a):(b)) -static inline spx_float_t PSEUDOFLOAT(spx_int32_t x) -{ - int e=0; - int sign=0; - if (x<0) - { - sign = 1; - x = -x; - } - if (x==0) - { - spx_float_t r = {0,0}; - return r; - } - e = spx_ilog2(ABS32(x))-14; - x = VSHR32(x, e); - if (sign) - { - spx_float_t r; - r.m = -x; - r.e = e; - return r; - } - else - { - spx_float_t r; - r.m = x; - r.e = e; - return r; - } -} - - -static inline spx_float_t FLOAT_ADD(spx_float_t a, spx_float_t b) -{ - spx_float_t r; - if (a.m==0) - return b; - else if (b.m==0) - return a; - if ((a).e > (b).e) - { - r.m = ((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1)); - r.e = (a).e+1; - } - else - { - r.m = ((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1)); - r.e = (b).e+1; - } - if (r.m>0) - { - if (r.m<16384) - { - r.m<<=1; - r.e-=1; - } - } else { - if (r.m>-16384) - { - r.m<<=1; - r.e-=1; - } - } - /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/ - return r; -} - -static inline spx_float_t FLOAT_SUB(spx_float_t a, spx_float_t b) -{ - spx_float_t r; - if (a.m==0) - return b; - else if (b.m==0) - return a; - if ((a).e > (b).e) - { - r.m = ((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1)); - r.e = (a).e+1; - } - else - { - r.m = ((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1); - r.e = (b).e+1; - } - if (r.m>0) - { - if (r.m<16384) - { - r.m<<=1; - r.e-=1; - } - } else { - if (r.m>-16384) - { - r.m<<=1; - r.e-=1; - } - } - /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/ - return r; -} - -static inline int FLOAT_LT(spx_float_t a, spx_float_t b) -{ - if (a.m==0) - return b.m>0; - else if (b.m==0) - return a.m<0; - if ((a).e > (b).e) - return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1)); - else - return ((b).m>>1) > ((a).m>>MIN(15,(b).e-(a).e+1)); - -} - -static inline int FLOAT_GT(spx_float_t a, spx_float_t b) -{ - return FLOAT_LT(b,a); -} - -static inline spx_float_t FLOAT_MULT(spx_float_t a, spx_float_t b) -{ - spx_float_t r; - r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15); - r.e = (a).e+(b).e+15; - if (r.m>0) - { - if (r.m<16384) - { - r.m<<=1; - r.e-=1; - } - } else { - if (r.m>-16384) - { - r.m<<=1; - r.e-=1; - } - } - /*printf ("%f * %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/ - return r; -} - -static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b) -{ - spx_float_t r; - r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15); - r.e = (a).e+(b).e+15; - return r; -} - - -static inline spx_float_t FLOAT_SHL(spx_float_t a, int b) -{ - spx_float_t r; - r.m = a.m; - r.e = a.e+b; - return r; -} - -static inline spx_int16_t FLOAT_EXTRACT16(spx_float_t a) -{ - if (a.e<0) - return EXTRACT16((EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e); - else - return a.m<<a.e; -} - -static inline spx_int32_t FLOAT_EXTRACT32(spx_float_t a) -{ - if (a.e<0) - return (EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e; - else - return EXTEND32(a.m)<<a.e; -} - -static inline spx_int32_t FLOAT_MUL32(spx_float_t a, spx_word32_t b) -{ - return VSHR32(MULT16_32_Q15(a.m, b),-a.e-15); -} - -static inline spx_float_t FLOAT_MUL32U(spx_word32_t a, spx_word32_t b) -{ - int e1, e2; - spx_float_t r; - if (a==0 || b==0) - { - return FLOAT_ZERO; - } - e1 = spx_ilog2(ABS32(a)); - a = VSHR32(a, e1-14); - e2 = spx_ilog2(ABS32(b)); - b = VSHR32(b, e2-14); - r.m = MULT16_16_Q15(a,b); - r.e = e1+e2-13; - return r; -} - -/* Do NOT attempt to divide by a negative number */ -static inline spx_float_t FLOAT_DIV32_FLOAT(spx_word32_t a, spx_float_t b) -{ - int e=0; - spx_float_t r; - if (a==0) - { - return FLOAT_ZERO; - } - e = spx_ilog2(ABS32(a))-spx_ilog2(b.m-1)-15; - a = VSHR32(a, e); - if (ABS32(a)>=SHL32(EXTEND32(b.m-1),15)) - { - a >>= 1; - e++; - } - r.m = DIV32_16(a,b.m); - r.e = e-b.e; - return r; -} - - -/* Do NOT attempt to divide by a negative number */ -static inline spx_float_t FLOAT_DIV32(spx_word32_t a, spx_word32_t b) -{ - int e0=0,e=0; - spx_float_t r; - if (a==0) - { - return FLOAT_ZERO; - } - if (b>32767) - { - e0 = spx_ilog2(b)-14; - b = VSHR32(b, e0); - e0 = -e0; - } - e = spx_ilog2(ABS32(a))-spx_ilog2(b-1)-15; - a = VSHR32(a, e); - if (ABS32(a)>=SHL32(EXTEND32(b-1),15)) - { - a >>= 1; - e++; - } - e += e0; - r.m = DIV32_16(a,b); - r.e = e; - return r; -} - -/* Do NOT attempt to divide by a negative number */ -static inline spx_float_t FLOAT_DIVU(spx_float_t a, spx_float_t b) -{ - int e=0; - spx_int32_t num; - spx_float_t r; - if (b.m<=0) - { - speex_warning_int("Attempted to divide by", b.m); - return FLOAT_ONE; - } - num = a.m; - a.m = ABS16(a.m); - while (a.m >= b.m) - { - e++; - a.m >>= 1; - } - num = num << (15-e); - r.m = DIV32_16(num,b.m); - r.e = a.e-b.e-15+e; - return r; -} - -static inline spx_float_t FLOAT_SQRT(spx_float_t a) -{ - spx_float_t r; - spx_int32_t m; - m = SHL32(EXTEND32(a.m), 14); - r.e = a.e - 14; - if (r.e & 1) - { - r.e -= 1; - m <<= 1; - } - r.e >>= 1; - r.m = spx_sqrt(m); - return r; -} - -#else - -#define spx_float_t float -#define FLOAT_ZERO 0.f -#define FLOAT_ONE 1.f -#define FLOAT_HALF 0.5f -#define PSEUDOFLOAT(x) (x) -#define FLOAT_MULT(a,b) ((a)*(b)) -#define FLOAT_AMULT(a,b) ((a)*(b)) -#define FLOAT_MUL32(a,b) ((a)*(b)) -#define FLOAT_DIV32(a,b) ((a)/(b)) -#define FLOAT_EXTRACT16(a) (a) -#define FLOAT_EXTRACT32(a) (a) -#define FLOAT_ADD(a,b) ((a)+(b)) -#define FLOAT_SUB(a,b) ((a)-(b)) -#define REALFLOAT(x) (x) -#define FLOAT_DIV32_FLOAT(a,b) ((a)/(b)) -#define FLOAT_MUL32U(a,b) ((a)*(b)) -#define FLOAT_SHL(a,b) (a) -#define FLOAT_LT(a,b) ((a)<(b)) -#define FLOAT_GT(a,b) ((a)>(b)) -#define FLOAT_DIVU(a,b) ((a)/(b)) -#define FLOAT_SQRT(a) (spx_sqrt(a)) - -#endif - -#endif diff --git a/src/lib/dl/ext/speex/quant_lsp.c b/src/lib/dl/ext/speex/quant_lsp.c deleted file mode 100755 index e624d1a2..00000000 --- a/src/lib/dl/ext/speex/quant_lsp.c +++ /dev/null @@ -1,385 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: quant_lsp.c - LSP vector quantization - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "quant_lsp.h" -#include "os_support.h" -#include <math.h> -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#include "arch.h" - -#ifdef BFIN_ASM -#include "quant_lsp_bfin.h" -#endif - -#ifdef FIXED_POINT - -#define LSP_LINEAR(i) (SHL16(i+1,11)) -#define LSP_LINEAR_HIGH(i) (ADD16(MULT16_16_16(i,2560),6144)) -#define LSP_DIV_256(x) (SHL16((spx_word16_t)x, 5)) -#define LSP_DIV_512(x) (SHL16((spx_word16_t)x, 4)) -#define LSP_DIV_1024(x) (SHL16((spx_word16_t)x, 3)) -#define LSP_PI 25736 - -#else - -#define LSP_LINEAR(i) (.25*(i)+.25) -#define LSP_LINEAR_HIGH(i) (.3125*(i)+.75) -#define LSP_SCALE 256. -#define LSP_DIV_256(x) (0.0039062*(x)) -#define LSP_DIV_512(x) (0.0019531*(x)) -#define LSP_DIV_1024(x) (0.00097656*(x)) -#define LSP_PI M_PI - -#endif - -static void compute_quant_weights(spx_lsp_t *qlsp, spx_word16_t *quant_weight, int order) -{ - int i; - spx_word16_t tmp1, tmp2; - for (i=0;i<order;i++) - { - if (i==0) - tmp1 = qlsp[i]; - else - tmp1 = qlsp[i]-qlsp[i-1]; - if (i==order-1) - tmp2 = LSP_PI-qlsp[i]; - else - tmp2 = qlsp[i+1]-qlsp[i]; - if (tmp2<tmp1) - tmp1 = tmp2; -#ifdef FIXED_POINT - quant_weight[i] = DIV32_16(81920,ADD16(300,tmp1)); -#else - quant_weight[i] = 10/(.04+tmp1); -#endif - } - -} - -/* Note: x is modified*/ -#ifndef OVERRIDE_LSP_QUANT -static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nbDim) -{ - int i,j; - spx_word32_t dist; - spx_word16_t tmp; - spx_word32_t best_dist=VERY_LARGE32; - int best_id=0; - const signed char *ptr=cdbk; - for (i=0;i<nbVec;i++) - { - dist=0; - for (j=0;j<nbDim;j++) - { - tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5)); - dist=MAC16_16(dist,tmp,tmp); - } - if (dist<best_dist) - { - best_dist=dist; - best_id=i; - } - } - - for (j=0;j<nbDim;j++) - x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5)); - - return best_id; -} -#endif - -/* Note: x is modified*/ -#ifndef OVERRIDE_LSP_WEIGHT_QUANT -static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed char *cdbk, int nbVec, int nbDim) -{ - int i,j; - spx_word32_t dist; - spx_word16_t tmp; - spx_word32_t best_dist=VERY_LARGE32; - int best_id=0; - const signed char *ptr=cdbk; - for (i=0;i<nbVec;i++) - { - dist=0; - for (j=0;j<nbDim;j++) - { - tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5)); - dist=MAC16_32_Q15(dist,weight[j],MULT16_16(tmp,tmp)); - } - if (dist<best_dist) - { - best_dist=dist; - best_id=i; - } - } - - for (j=0;j<nbDim;j++) - x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5)); - return best_id; -} -#endif - -void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) -{ - int i; - int id; - spx_word16_t quant_weight[10]; - - for (i=0;i<order;i++) - qlsp[i]=lsp[i]; - - compute_quant_weights(qlsp, quant_weight, order); - - for (i=0;i<order;i++) - qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i)); - -#ifndef FIXED_POINT - for (i=0;i<order;i++) - qlsp[i] = LSP_SCALE*qlsp[i]; -#endif - id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order); - speex_bits_pack(bits, id, 6); - - for (i=0;i<order;i++) - qlsp[i]*=2; - - id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5); - speex_bits_pack(bits, id, 6); - - for (i=0;i<5;i++) - qlsp[i]*=2; - - id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low2, NB_CDBK_SIZE_LOW2, 5); - speex_bits_pack(bits, id, 6); - - id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5); - speex_bits_pack(bits, id, 6); - - for (i=5;i<10;i++) - qlsp[i]*=2; - - id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high2, NB_CDBK_SIZE_HIGH2, 5); - speex_bits_pack(bits, id, 6); - -#ifdef FIXED_POINT - for (i=0;i<order;i++) - qlsp[i]=PSHR16(qlsp[i],2); -#else - for (i=0;i<order;i++) - qlsp[i]=qlsp[i] * .00097656; -#endif - - for (i=0;i<order;i++) - qlsp[i]=lsp[i]-qlsp[i]; -} - -void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits) -{ - int i, id; - for (i=0;i<order;i++) - lsp[i]=LSP_LINEAR(i); - - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<10;i++) - lsp[i] = ADD32(lsp[i], LSP_DIV_256(cdbk_nb[id*10+i])); - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<5;i++) - lsp[i] = ADD16(lsp[i], LSP_DIV_512(cdbk_nb_low1[id*5+i])); - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<5;i++) - lsp[i] = ADD32(lsp[i], LSP_DIV_1024(cdbk_nb_low2[id*5+i])); - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<5;i++) - lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_512(cdbk_nb_high1[id*5+i])); - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<5;i++) - lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_1024(cdbk_nb_high2[id*5+i])); -} - - -void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) -{ - int i; - int id; - spx_word16_t quant_weight[10]; - - for (i=0;i<order;i++) - qlsp[i]=lsp[i]; - - compute_quant_weights(qlsp, quant_weight, order); - - for (i=0;i<order;i++) - qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i)); -#ifndef FIXED_POINT - for (i=0;i<order;i++) - qlsp[i]=qlsp[i]*LSP_SCALE; -#endif - id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order); - speex_bits_pack(bits, id, 6); - - for (i=0;i<order;i++) - qlsp[i]*=2; - - id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5); - speex_bits_pack(bits, id, 6); - - id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5); - speex_bits_pack(bits, id, 6); - -#ifdef FIXED_POINT - for (i=0;i<order;i++) - qlsp[i] = PSHR16(qlsp[i],1); -#else - for (i=0;i<order;i++) - qlsp[i] = qlsp[i]*0.0019531; -#endif - - for (i=0;i<order;i++) - qlsp[i]=lsp[i]-qlsp[i]; -} - -void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits) -{ - int i, id; - for (i=0;i<order;i++) - lsp[i]=LSP_LINEAR(i); - - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<10;i++) - lsp[i] += LSP_DIV_256(cdbk_nb[id*10+i]); - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<5;i++) - lsp[i] += LSP_DIV_512(cdbk_nb_low1[id*5+i]); - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<5;i++) - lsp[i+5] += LSP_DIV_512(cdbk_nb_high1[id*5+i]); - -} - - -#ifdef DISABLE_WIDEBAND -void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); -} -void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); -} -#else -extern const signed char high_lsp_cdbk[]; -extern const signed char high_lsp_cdbk2[]; - - -void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits) -{ - int i; - int id; - spx_word16_t quant_weight[10]; - - for (i=0;i<order;i++) - qlsp[i]=lsp[i]; - - compute_quant_weights(qlsp, quant_weight, order); - - /* quant_weight[0] = 10/(qlsp[1]-qlsp[0]); - quant_weight[order-1] = 10/(qlsp[order-1]-qlsp[order-2]); - for (i=1;i<order-1;i++) - { - tmp1 = 10/(qlsp[i]-qlsp[i-1]); - tmp2 = 10/(qlsp[i+1]-qlsp[i]); - quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2; - }*/ - - for (i=0;i<order;i++) - qlsp[i]=SUB16(qlsp[i],LSP_LINEAR_HIGH(i)); -#ifndef FIXED_POINT - for (i=0;i<order;i++) - qlsp[i] = qlsp[i]*LSP_SCALE; -#endif - id = lsp_quant(qlsp, high_lsp_cdbk, 64, order); - speex_bits_pack(bits, id, 6); - - for (i=0;i<order;i++) - qlsp[i]*=2; - - id = lsp_weight_quant(qlsp, quant_weight, high_lsp_cdbk2, 64, order); - speex_bits_pack(bits, id, 6); - -#ifdef FIXED_POINT - for (i=0;i<order;i++) - qlsp[i] = PSHR16(qlsp[i],1); -#else - for (i=0;i<order;i++) - qlsp[i] = qlsp[i]*0.0019531; -#endif - - for (i=0;i<order;i++) - qlsp[i]=lsp[i]-qlsp[i]; -} - -void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits) -{ - - int i, id; - for (i=0;i<order;i++) - lsp[i]=LSP_LINEAR_HIGH(i); - - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<order;i++) - lsp[i] += LSP_DIV_256(high_lsp_cdbk[id*order+i]); - - - id=speex_bits_unpack_unsigned(bits, 6); - for (i=0;i<order;i++) - lsp[i] += LSP_DIV_512(high_lsp_cdbk2[id*order+i]); -} - -#endif - diff --git a/src/lib/dl/ext/speex/quant_lsp.h b/src/lib/dl/ext/speex/quant_lsp.h deleted file mode 100755 index 3bf4d402..00000000 --- a/src/lib/dl/ext/speex/quant_lsp.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file quant_lsp.h - @brief LSP vector quantization -*/ -/* - 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 QUANT_LSP_H -#define QUANT_LSP_H - -#include <speex/speex_bits.h> -#include "arch.h" - -#define MAX_LSP_SIZE 20 - -#define NB_CDBK_SIZE 64 -#define NB_CDBK_SIZE_LOW1 64 -#define NB_CDBK_SIZE_LOW2 64 -#define NB_CDBK_SIZE_HIGH1 64 -#define NB_CDBK_SIZE_HIGH2 64 - -/*Narrowband codebooks*/ -extern const signed char cdbk_nb[]; -extern const signed char cdbk_nb_low1[]; -extern const signed char cdbk_nb_low2[]; -extern const signed char cdbk_nb_high1[]; -extern const signed char cdbk_nb_high2[]; - -/* Quantizes narrowband LSPs with 30 bits */ -void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits); - -/* Decodes quantized narrowband LSPs */ -void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits); - -/* Quantizes low bit-rate narrowband LSPs with 18 bits */ -void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits); - -/* Decodes quantized low bit-rate narrowband LSPs */ -void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits); - -/* Quantizes high-band LSPs with 12 bits */ -void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits); - -/* Decodes high-band LSPs */ -void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits); - -#endif diff --git a/src/lib/dl/ext/speex/quant_lsp_bfin.h b/src/lib/dl/ext/speex/quant_lsp_bfin.h deleted file mode 100755 index 087b466b..00000000 --- a/src/lib/dl/ext/speex/quant_lsp_bfin.h +++ /dev/null @@ -1,165 +0,0 @@ -/* Copyright (C) 2006 David Rowe */ -/** - @file quant_lsp_bfin.h - @author David Rowe - @brief Various compatibility routines for Speex (Blackfin version) -*/ -/* - 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. -*/ - -#define OVERRIDE_LSP_QUANT -#ifdef OVERRIDE_LSP_QUANT - -/* - Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html - well tell you all the magic resgister constraints used below - for gcc in-line asm. -*/ - -static int lsp_quant( - spx_word16_t *x, - const signed char *cdbk, - int nbVec, - int nbDim -) -{ - int j; - spx_word32_t best_dist=1<<30; - int best_id=0; - - __asm__ __volatile__ - ( -" %0 = 1 (X);\n\t" /* %0: best_dist */ -" %0 <<= 30;\n\t" -" %1 = 0 (X);\n\t" /* %1: best_i */ -" P2 = %3\n\t" /* P2: ptr to cdbk */ -" R5 = 0;\n\t" /* R5: best cb entry */ - -" R0 = %5;\n\t" /* set up circ addr */ -" R0 <<= 1;\n\t" -" L0 = R0;\n\t" -" I0 = %2;\n\t" /* %2: &x[0] */ -" B0 = %2;\n\t" - -" R2.L = W [I0++];\n\t" -" LSETUP (1f, 2f) LC0 = %4;\n\t" -"1: R3 = 0;\n\t" /* R3: dist */ -" LSETUP (3f, 4f) LC1 = %5;\n\t" -"3: R1 = B [P2++] (X);\n\t" -" R1 <<= 5;\n\t" -" R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t" -" R0 = R0.L*R0.L;\n\t" -"4: R3 = R3 + R0;\n\t" - -" cc =R3<%0;\n\t" -" if cc %0=R3;\n\t" -" if cc %1=R5;\n\t" -"2: R5 += 1;\n\t" -" L0 = 0;\n\t" - : "=&d" (best_dist), "=&d" (best_id) - : "a" (x), "b" (cdbk), "a" (nbVec), "a" (nbDim) - : "I0", "P2", "R0", "R1", "R2", "R3", "R5", "L0", "B0", "A0" - ); - - for (j=0;j<nbDim;j++) { - x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5)); - } - return best_id; -} -#endif - -#define OVERRIDE_LSP_WEIGHT_QUANT -#ifdef OVERRIDE_LSP_WEIGHT_QUANT - -/* - Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html - well tell you all the magic resgister constraints used below - for gcc in-line asm. -*/ - -static int lsp_weight_quant( - spx_word16_t *x, - spx_word16_t *weight, - const signed char *cdbk, - int nbVec, - int nbDim -) -{ - int j; - spx_word32_t best_dist=1<<30; - int best_id=0; - - __asm__ __volatile__ - ( -" %0 = 1 (X);\n\t" /* %0: best_dist */ -" %0 <<= 30;\n\t" -" %1 = 0 (X);\n\t" /* %1: best_i */ -" P2 = %4\n\t" /* P2: ptr to cdbk */ -" R5 = 0;\n\t" /* R5: best cb entry */ - -" R0 = %6;\n\t" /* set up circ addr */ -" R0 <<= 1;\n\t" -" L0 = R0;\n\t" -" L1 = R0;\n\t" -" I0 = %2;\n\t" /* %2: &x[0] */ -" I1 = %3;\n\t" /* %3: &weight[0] */ -" B0 = %2;\n\t" -" B1 = %3;\n\t" - -" LSETUP (1f, 2f) LC0 = %5;\n\t" -"1: R3 = 0 (X);\n\t" /* R3: dist */ -" LSETUP (3f, 4f) LC1 = %6;\n\t" -"3: R0.L = W [I0++] || R2.L = W [I1++];\n\t" -" R1 = B [P2++] (X);\n\t" -" R1 <<= 5;\n\t" -" R0.L = R0.L - R1.L;\n\t" -" R0 = R0.L*R0.L;\n\t" -" A1 = R2.L*R0.L (M,IS);\n\t" -" A1 = A1 >>> 16;\n\t" -" R1 = (A1 += R2.L*R0.H) (IS);\n\t" -"4: R3 = R3 + R1;\n\t" - -" cc =R3<%0;\n\t" -" if cc %0=R3;\n\t" -" if cc %1=R5;\n\t" -"2: R5 += 1;\n\t" -" L0 = 0;\n\t" -" L1 = 0;\n\t" - : "=&d" (best_dist), "=&d" (best_id) - : "a" (x), "a" (weight), "b" (cdbk), "a" (nbVec), "a" (nbDim) - : "I0", "I1", "P2", "R0", "R1", "R2", "R3", "R5", "A1", - "L0", "L1", "B0", "B1" - ); - - for (j=0;j<nbDim;j++) { - x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5)); - } - return best_id; -} -#endif diff --git a/src/lib/dl/ext/speex/resample.c b/src/lib/dl/ext/speex/resample.c deleted file mode 100755 index bebd1a86..00000000 --- a/src/lib/dl/ext/speex/resample.c +++ /dev/null @@ -1,1131 +0,0 @@ -/* Copyright (C) 2007-2008 Jean-Marc Valin - Copyright (C) 2008 Thorvald Natvig - - File: resample.c - Arbitrary resampling code - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -/* - The design goals of this code are: - - Very fast algorithm - - SIMD-friendly algorithm - - Low memory requirement - - Good *perceptual* quality (and not best SNR) - - Warning: This resampler is relatively new. Although I think I got rid of - all the major bugs and I don't expect the API to change anymore, there - may be something I've missed. So use with caution. - - This algorithm is based on this original resampling algorithm: - Smith, Julius O. Digital Audio Resampling Home Page - Center for Computer Research in Music and Acoustics (CCRMA), - Stanford University, 2007. - Web published at http://www-ccrma.stanford.edu/~jos/resample/. - - There is one main difference, though. This resampler uses cubic - interpolation instead of linear interpolation in the above paper. This - makes the table much smaller and makes it possible to compute that table - on a per-stream basis. In turn, being able to tweak the table for each - stream makes it possible to both reduce complexity on simple ratios - (e.g. 2/3), and get rid of the rounding operations in the inner loop. - The latter both reduces CPU time and makes the algorithm more SIMD-friendly. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef OUTSIDE_SPEEX -#include <stdlib.h> -static void *speex_alloc (int size) {return calloc(size,1);} -static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);} -static void speex_free (void *ptr) {free(ptr);} -#include "speex_resampler.h" -#include "arch.h" -#else /* OUTSIDE_SPEEX */ - -#include "speex/speex_resampler.h" -#include "arch.h" -#include "os_support.h" -#endif /* OUTSIDE_SPEEX */ - -#include "stack_alloc.h" -#include <math.h> - -#ifndef M_PI -#define M_PI 3.14159263 -#endif - -#ifdef FIXED_POINT -#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x))) -#else -#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x)))) -#endif - -#define IMAX(a,b) ((a) > (b) ? (a) : (b)) -#define IMIN(a,b) ((a) < (b) ? (a) : (b)) - -#ifndef NULL -#define NULL 0 -#endif - -#ifdef _USE_SSE -#include "resample_sse.h" -#endif - -/* Numer of elements to allocate on the stack */ -#ifdef VAR_ARRAYS -#define FIXED_STACK_ALLOC 8192 -#else -#define FIXED_STACK_ALLOC 1024 -#endif - -typedef int (*resampler_basic_func)(SpeexResamplerState *, spx_uint32_t , const spx_word16_t *, spx_uint32_t *, spx_word16_t *, spx_uint32_t *); - -struct SpeexResamplerState_ { - spx_uint32_t in_rate; - spx_uint32_t out_rate; - spx_uint32_t num_rate; - spx_uint32_t den_rate; - - int quality; - spx_uint32_t nb_channels; - spx_uint32_t filt_len; - spx_uint32_t mem_alloc_size; - spx_uint32_t buffer_size; - int int_advance; - int frac_advance; - float cutoff; - spx_uint32_t oversample; - int initialised; - int started; - - /* These are per-channel */ - spx_int32_t *last_sample; - spx_uint32_t *samp_frac_num; - spx_uint32_t *magic_samples; - - spx_word16_t *mem; - spx_word16_t *sinc_table; - spx_uint32_t sinc_table_length; - resampler_basic_func resampler_ptr; - - int in_stride; - int out_stride; -} ; - -static double kaiser12_table[68] = { - 0.99859849, 1.00000000, 0.99859849, 0.99440475, 0.98745105, 0.97779076, - 0.96549770, 0.95066529, 0.93340547, 0.91384741, 0.89213598, 0.86843014, - 0.84290116, 0.81573067, 0.78710866, 0.75723148, 0.72629970, 0.69451601, - 0.66208321, 0.62920216, 0.59606986, 0.56287762, 0.52980938, 0.49704014, - 0.46473455, 0.43304576, 0.40211431, 0.37206735, 0.34301800, 0.31506490, - 0.28829195, 0.26276832, 0.23854851, 0.21567274, 0.19416736, 0.17404546, - 0.15530766, 0.13794294, 0.12192957, 0.10723616, 0.09382272, 0.08164178, - 0.07063950, 0.06075685, 0.05193064, 0.04409466, 0.03718069, 0.03111947, - 0.02584161, 0.02127838, 0.01736250, 0.01402878, 0.01121463, 0.00886058, - 0.00691064, 0.00531256, 0.00401805, 0.00298291, 0.00216702, 0.00153438, - 0.00105297, 0.00069463, 0.00043489, 0.00025272, 0.00013031, 0.0000527734, - 0.00001000, 0.00000000}; -/* -static double kaiser12_table[36] = { - 0.99440475, 1.00000000, 0.99440475, 0.97779076, 0.95066529, 0.91384741, - 0.86843014, 0.81573067, 0.75723148, 0.69451601, 0.62920216, 0.56287762, - 0.49704014, 0.43304576, 0.37206735, 0.31506490, 0.26276832, 0.21567274, - 0.17404546, 0.13794294, 0.10723616, 0.08164178, 0.06075685, 0.04409466, - 0.03111947, 0.02127838, 0.01402878, 0.00886058, 0.00531256, 0.00298291, - 0.00153438, 0.00069463, 0.00025272, 0.0000527734, 0.00000500, 0.00000000}; -*/ -static double kaiser10_table[36] = { - 0.99537781, 1.00000000, 0.99537781, 0.98162644, 0.95908712, 0.92831446, - 0.89005583, 0.84522401, 0.79486424, 0.74011713, 0.68217934, 0.62226347, - 0.56155915, 0.50119680, 0.44221549, 0.38553619, 0.33194107, 0.28205962, - 0.23636152, 0.19515633, 0.15859932, 0.12670280, 0.09935205, 0.07632451, - 0.05731132, 0.04193980, 0.02979584, 0.02044510, 0.01345224, 0.00839739, - 0.00488951, 0.00257636, 0.00115101, 0.00035515, 0.00000000, 0.00000000}; - -static double kaiser8_table[36] = { - 0.99635258, 1.00000000, 0.99635258, 0.98548012, 0.96759014, 0.94302200, - 0.91223751, 0.87580811, 0.83439927, 0.78875245, 0.73966538, 0.68797126, - 0.63451750, 0.58014482, 0.52566725, 0.47185369, 0.41941150, 0.36897272, - 0.32108304, 0.27619388, 0.23465776, 0.19672670, 0.16255380, 0.13219758, - 0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490, - 0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000}; - -static double kaiser6_table[36] = { - 0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003, - 0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565, - 0.71712752, 0.67172623, 0.62508937, 0.57774224, 0.53019925, 0.48295561, - 0.43647969, 0.39120616, 0.34752997, 0.30580127, 0.26632152, 0.22934058, - 0.19505503, 0.16360756, 0.13508755, 0.10953262, 0.08693120, 0.06722600, - 0.05031820, 0.03607231, 0.02432151, 0.01487334, 0.00752000, 0.00000000}; - -struct FuncDef { - double *table; - int oversample; -}; - -static struct FuncDef _KAISER12 = {kaiser12_table, 64}; -#define KAISER12 (&_KAISER12) -/*static struct FuncDef _KAISER12 = {kaiser12_table, 32}; -#define KAISER12 (&_KAISER12)*/ -static struct FuncDef _KAISER10 = {kaiser10_table, 32}; -#define KAISER10 (&_KAISER10) -static struct FuncDef _KAISER8 = {kaiser8_table, 32}; -#define KAISER8 (&_KAISER8) -static struct FuncDef _KAISER6 = {kaiser6_table, 32}; -#define KAISER6 (&_KAISER6) - -struct QualityMapping { - int base_length; - int oversample; - float downsample_bandwidth; - float upsample_bandwidth; - struct FuncDef *window_func; -}; - - -/* This table maps conversion quality to internal parameters. There are two - reasons that explain why the up-sampling bandwidth is larger than the - down-sampling bandwidth: - 1) When up-sampling, we can assume that the spectrum is already attenuated - close to the Nyquist rate (from an A/D or a previous resampling filter) - 2) Any aliasing that occurs very close to the Nyquist rate will be masked - by the sinusoids/noise just below the Nyquist rate (guaranteed only for - up-sampling). -*/ -static const struct QualityMapping quality_map[11] = { - { 8, 4, 0.830f, 0.860f, KAISER6 }, /* Q0 */ - { 16, 4, 0.850f, 0.880f, KAISER6 }, /* Q1 */ - { 32, 4, 0.882f, 0.910f, KAISER6 }, /* Q2 */ /* 82.3% cutoff ( ~60 dB stop) 6 */ - { 48, 8, 0.895f, 0.917f, KAISER8 }, /* Q3 */ /* 84.9% cutoff ( ~80 dB stop) 8 */ - { 64, 8, 0.921f, 0.940f, KAISER8 }, /* Q4 */ /* 88.7% cutoff ( ~80 dB stop) 8 */ - { 80, 16, 0.922f, 0.940f, KAISER10}, /* Q5 */ /* 89.1% cutoff (~100 dB stop) 10 */ - { 96, 16, 0.940f, 0.945f, KAISER10}, /* Q6 */ /* 91.5% cutoff (~100 dB stop) 10 */ - {128, 16, 0.950f, 0.950f, KAISER10}, /* Q7 */ /* 93.1% cutoff (~100 dB stop) 10 */ - {160, 16, 0.960f, 0.960f, KAISER10}, /* Q8 */ /* 94.5% cutoff (~100 dB stop) 10 */ - {192, 32, 0.968f, 0.968f, KAISER12}, /* Q9 */ /* 95.5% cutoff (~100 dB stop) 10 */ - {256, 32, 0.975f, 0.975f, KAISER12}, /* Q10 */ /* 96.6% cutoff (~100 dB stop) 10 */ -}; -/*8,24,40,56,80,104,128,160,200,256,320*/ -static double compute_func(float x, struct FuncDef *func) -{ - float y, frac; - double interp[4]; - int ind; - y = x*func->oversample; - ind = (int)floor(y); - frac = (y-ind); - /* CSE with handle the repeated powers */ - interp[3] = -0.1666666667*frac + 0.1666666667*(frac*frac*frac); - interp[2] = frac + 0.5*(frac*frac) - 0.5*(frac*frac*frac); - /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/ - interp[0] = -0.3333333333*frac + 0.5*(frac*frac) - 0.1666666667*(frac*frac*frac); - /* Just to make sure we don't have rounding problems */ - interp[1] = 1.f-interp[3]-interp[2]-interp[0]; - - /*sum = frac*accum[1] + (1-frac)*accum[2];*/ - return interp[0]*func->table[ind] + interp[1]*func->table[ind+1] + interp[2]*func->table[ind+2] + interp[3]*func->table[ind+3]; -} - -#if 0 -#include <stdio.h> -int main(int argc, char **argv) -{ - int i; - for (i=0;i<256;i++) - { - printf ("%f\n", compute_func(i/256., KAISER12)); - } - return 0; -} -#endif - -#ifdef FIXED_POINT -/* The slow way of computing a sinc for the table. Should improve that some day */ -static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func) -{ - /*fprintf (stderr, "%f ", x);*/ - float xx = x * cutoff; - if (fabs(x)<1e-6f) - return WORD2INT(32768.*cutoff); - else if (fabs(x) > .5f*N) - return 0; - /*FIXME: Can it really be any slower than this? */ - return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func)); -} -#else -/* The slow way of computing a sinc for the table. Should improve that some day */ -static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func) -{ - /*fprintf (stderr, "%f ", x);*/ - float xx = x * cutoff; - if (fabs(x)<1e-6) - return cutoff; - else if (fabs(x) > .5*N) - return 0; - /*FIXME: Can it really be any slower than this? */ - return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func); -} -#endif - -#ifdef FIXED_POINT -static void cubic_coef(spx_word16_t x, spx_word16_t interp[4]) -{ - /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation - but I know it's MMSE-optimal on a sinc */ - spx_word16_t x2, x3; - x2 = MULT16_16_P15(x, x); - x3 = MULT16_16_P15(x, x2); - interp[0] = PSHR32(MULT16_16(QCONST16(-0.16667f, 15),x) + MULT16_16(QCONST16(0.16667f, 15),x3),15); - interp[1] = EXTRACT16(EXTEND32(x) + SHR32(SUB32(EXTEND32(x2),EXTEND32(x3)),1)); - interp[3] = PSHR32(MULT16_16(QCONST16(-0.33333f, 15),x) + MULT16_16(QCONST16(.5f,15),x2) - MULT16_16(QCONST16(0.16667f, 15),x3),15); - /* Just to make sure we don't have rounding problems */ - interp[2] = Q15_ONE-interp[0]-interp[1]-interp[3]; - if (interp[2]<32767) - interp[2]+=1; -} -#else -static void cubic_coef(spx_word16_t frac, spx_word16_t interp[4]) -{ - /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation - but I know it's MMSE-optimal on a sinc */ - interp[0] = -0.16667f*frac + 0.16667f*frac*frac*frac; - interp[1] = frac + 0.5f*frac*frac - 0.5f*frac*frac*frac; - /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/ - interp[3] = -0.33333f*frac + 0.5f*frac*frac - 0.16667f*frac*frac*frac; - /* Just to make sure we don't have rounding problems */ - interp[2] = 1.-interp[0]-interp[1]-interp[3]; -} -#endif - -static int resampler_basic_direct_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len) -{ - const int N = st->filt_len; - int out_sample = 0; - int last_sample = st->last_sample[channel_index]; - spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index]; - const spx_word16_t *sinc_table = st->sinc_table; - const int out_stride = st->out_stride; - const int int_advance = st->int_advance; - const int frac_advance = st->frac_advance; - const spx_uint32_t den_rate = st->den_rate; - spx_word32_t sum; - int j; - - while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len)) - { - const spx_word16_t *sinc = & sinc_table[samp_frac_num*N]; - const spx_word16_t *iptr = & in[last_sample]; - -#ifndef OVERRIDE_INNER_PRODUCT_SINGLE - float accum[4] = {0,0,0,0}; - - for(j=0;j<N;j+=4) { - accum[0] += sinc[j]*iptr[j]; - accum[1] += sinc[j+1]*iptr[j+1]; - accum[2] += sinc[j+2]*iptr[j+2]; - accum[3] += sinc[j+3]*iptr[j+3]; - } - sum = accum[0] + accum[1] + accum[2] + accum[3]; -#else - sum = inner_product_single(sinc, iptr, N); -#endif - - out[out_stride * out_sample++] = PSHR32(sum, 15); - last_sample += int_advance; - samp_frac_num += frac_advance; - if (samp_frac_num >= den_rate) - { - samp_frac_num -= den_rate; - last_sample++; - } - } - - st->last_sample[channel_index] = last_sample; - st->samp_frac_num[channel_index] = samp_frac_num; - return out_sample; -} - -#ifdef FIXED_POINT -#else -/* This is the same as the previous function, except with a double-precision accumulator */ -static int resampler_basic_direct_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len) -{ - const int N = st->filt_len; - int out_sample = 0; - int last_sample = st->last_sample[channel_index]; - spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index]; - const spx_word16_t *sinc_table = st->sinc_table; - const int out_stride = st->out_stride; - const int int_advance = st->int_advance; - const int frac_advance = st->frac_advance; - const spx_uint32_t den_rate = st->den_rate; - double sum; - int j; - - while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len)) - { - const spx_word16_t *sinc = & sinc_table[samp_frac_num*N]; - const spx_word16_t *iptr = & in[last_sample]; - -#ifndef OVERRIDE_INNER_PRODUCT_DOUBLE - double accum[4] = {0,0,0,0}; - - for(j=0;j<N;j+=4) { - accum[0] += sinc[j]*iptr[j]; - accum[1] += sinc[j+1]*iptr[j+1]; - accum[2] += sinc[j+2]*iptr[j+2]; - accum[3] += sinc[j+3]*iptr[j+3]; - } - sum = accum[0] + accum[1] + accum[2] + accum[3]; -#else - sum = inner_product_double(sinc, iptr, N); -#endif - - out[out_stride * out_sample++] = PSHR32(sum, 15); - last_sample += int_advance; - samp_frac_num += frac_advance; - if (samp_frac_num >= den_rate) - { - samp_frac_num -= den_rate; - last_sample++; - } - } - - st->last_sample[channel_index] = last_sample; - st->samp_frac_num[channel_index] = samp_frac_num; - return out_sample; -} -#endif - -static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len) -{ - const int N = st->filt_len; - int out_sample = 0; - int last_sample = st->last_sample[channel_index]; - spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index]; - const int out_stride = st->out_stride; - const int int_advance = st->int_advance; - const int frac_advance = st->frac_advance; - const spx_uint32_t den_rate = st->den_rate; - int j; - spx_word32_t sum; - - while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len)) - { - const spx_word16_t *iptr = & in[last_sample]; - - const int offset = samp_frac_num*st->oversample/st->den_rate; -#ifdef FIXED_POINT - const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate); -#else - const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate; -#endif - spx_word16_t interp[4]; - - -#ifndef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE - spx_word32_t accum[4] = {0,0,0,0}; - - for(j=0;j<N;j++) { - const spx_word16_t curr_in=iptr[j]; - accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]); - accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]); - accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]); - accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]); - } - - cubic_coef(frac, interp); - sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]); -#else - cubic_coef(frac, interp); - sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); -#endif - - out[out_stride * out_sample++] = PSHR32(sum,15); - last_sample += int_advance; - samp_frac_num += frac_advance; - if (samp_frac_num >= den_rate) - { - samp_frac_num -= den_rate; - last_sample++; - } - } - - st->last_sample[channel_index] = last_sample; - st->samp_frac_num[channel_index] = samp_frac_num; - return out_sample; -} - -#ifdef FIXED_POINT -#else -/* This is the same as the previous function, except with a double-precision accumulator */ -static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len) -{ - const int N = st->filt_len; - int out_sample = 0; - int last_sample = st->last_sample[channel_index]; - spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index]; - const int out_stride = st->out_stride; - const int int_advance = st->int_advance; - const int frac_advance = st->frac_advance; - const spx_uint32_t den_rate = st->den_rate; - int j; - spx_word32_t sum; - - while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len)) - { - const spx_word16_t *iptr = & in[last_sample]; - - const int offset = samp_frac_num*st->oversample/st->den_rate; -#ifdef FIXED_POINT - const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate); -#else - const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate; -#endif - spx_word16_t interp[4]; - - -#ifndef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE - double accum[4] = {0,0,0,0}; - - for(j=0;j<N;j++) { - const double curr_in=iptr[j]; - accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]); - accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]); - accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]); - accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]); - } - - cubic_coef(frac, interp); - sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]); -#else - cubic_coef(frac, interp); - sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); -#endif - - out[out_stride * out_sample++] = PSHR32(sum,15); - last_sample += int_advance; - samp_frac_num += frac_advance; - if (samp_frac_num >= den_rate) - { - samp_frac_num -= den_rate; - last_sample++; - } - } - - st->last_sample[channel_index] = last_sample; - st->samp_frac_num[channel_index] = samp_frac_num; - return out_sample; -} -#endif - -static void update_filter(SpeexResamplerState *st) -{ - spx_uint32_t old_length; - - old_length = st->filt_len; - st->oversample = quality_map[st->quality].oversample; - st->filt_len = quality_map[st->quality].base_length; - - if (st->num_rate > st->den_rate) - { - /* down-sampling */ - st->cutoff = quality_map[st->quality].downsample_bandwidth * st->den_rate / st->num_rate; - /* FIXME: divide the numerator and denominator by a certain amount if they're too large */ - st->filt_len = st->filt_len*st->num_rate / st->den_rate; - /* Round down to make sure we have a multiple of 4 */ - st->filt_len &= (~0x3); - if (2*st->den_rate < st->num_rate) - st->oversample >>= 1; - if (4*st->den_rate < st->num_rate) - st->oversample >>= 1; - if (8*st->den_rate < st->num_rate) - st->oversample >>= 1; - if (16*st->den_rate < st->num_rate) - st->oversample >>= 1; - if (st->oversample < 1) - st->oversample = 1; - } else { - /* up-sampling */ - st->cutoff = quality_map[st->quality].upsample_bandwidth; - } - - /* Choose the resampling type that requires the least amount of memory */ - if (st->den_rate <= st->oversample) - { - spx_uint32_t i; - if (!st->sinc_table) - st->sinc_table = (spx_word16_t *)speex_alloc(st->filt_len*st->den_rate*sizeof(spx_word16_t)); - else if (st->sinc_table_length < st->filt_len*st->den_rate) - { - st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,st->filt_len*st->den_rate*sizeof(spx_word16_t)); - st->sinc_table_length = st->filt_len*st->den_rate; - } - for (i=0;i<st->den_rate;i++) - { - spx_int32_t j; - for (j=0;j<st->filt_len;j++) - { - st->sinc_table[i*st->filt_len+j] = sinc(st->cutoff,((j-(spx_int32_t)st->filt_len/2+1)-((float)i)/st->den_rate), st->filt_len, quality_map[st->quality].window_func); - } - } -#ifdef FIXED_POINT - st->resampler_ptr = resampler_basic_direct_single; -#else - if (st->quality>8) - st->resampler_ptr = resampler_basic_direct_double; - else - st->resampler_ptr = resampler_basic_direct_single; -#endif - /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff);*/ - } else { - spx_int32_t i; - if (!st->sinc_table) - st->sinc_table = (spx_word16_t *)speex_alloc((st->filt_len*st->oversample+8)*sizeof(spx_word16_t)); - else if (st->sinc_table_length < st->filt_len*st->oversample+8) - { - st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,(st->filt_len*st->oversample+8)*sizeof(spx_word16_t)); - st->sinc_table_length = st->filt_len*st->oversample+8; - } - for (i=-4;i<(spx_int32_t)(st->oversample*st->filt_len+4);i++) - st->sinc_table[i+4] = sinc(st->cutoff,(i/(float)st->oversample - st->filt_len/2), st->filt_len, quality_map[st->quality].window_func); -#ifdef FIXED_POINT - st->resampler_ptr = resampler_basic_interpolate_single; -#else - if (st->quality>8) - st->resampler_ptr = resampler_basic_interpolate_double; - else - st->resampler_ptr = resampler_basic_interpolate_single; -#endif - /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff);*/ - } - st->int_advance = st->num_rate/st->den_rate; - st->frac_advance = st->num_rate%st->den_rate; - - - /* Here's the place where we update the filter memory to take into account - the change in filter length. It's probably the messiest part of the code - due to handling of lots of corner cases. */ - if (!st->mem) - { - spx_uint32_t i; - st->mem_alloc_size = st->filt_len-1 + st->buffer_size; - st->mem = (spx_word16_t*)speex_alloc(st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t)); - for (i=0;i<st->nb_channels*st->mem_alloc_size;i++) - st->mem[i] = 0; - /*speex_warning("init filter");*/ - } else if (!st->started) - { - spx_uint32_t i; - st->mem_alloc_size = st->filt_len-1 + st->buffer_size; - st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t)); - for (i=0;i<st->nb_channels*st->mem_alloc_size;i++) - st->mem[i] = 0; - /*speex_warning("reinit filter");*/ - } else if (st->filt_len > old_length) - { - spx_int32_t i; - /* Increase the filter length */ - /*speex_warning("increase filter size");*/ - int old_alloc_size = st->mem_alloc_size; - if ((st->filt_len-1 + st->buffer_size) > st->mem_alloc_size) - { - st->mem_alloc_size = st->filt_len-1 + st->buffer_size; - st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t)); - } - for (i=st->nb_channels-1;i>=0;i--) - { - spx_int32_t j; - spx_uint32_t olen = old_length; - /*if (st->magic_samples[i])*/ - { - /* Try and remove the magic samples as if nothing had happened */ - - /* FIXME: This is wrong but for now we need it to avoid going over the array bounds */ - olen = old_length + 2*st->magic_samples[i]; - for (j=old_length-2+st->magic_samples[i];j>=0;j--) - st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]] = st->mem[i*old_alloc_size+j]; - for (j=0;j<st->magic_samples[i];j++) - st->mem[i*st->mem_alloc_size+j] = 0; - st->magic_samples[i] = 0; - } - if (st->filt_len > olen) - { - /* If the new filter length is still bigger than the "augmented" length */ - /* Copy data going backward */ - for (j=0;j<olen-1;j++) - st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = st->mem[i*st->mem_alloc_size+(olen-2-j)]; - /* Then put zeros for lack of anything better */ - for (;j<st->filt_len-1;j++) - st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = 0; - /* Adjust last_sample */ - st->last_sample[i] += (st->filt_len - olen)/2; - } else { - /* Put back some of the magic! */ - st->magic_samples[i] = (olen - st->filt_len)/2; - for (j=0;j<st->filt_len-1+st->magic_samples[i];j++) - st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]]; - } - } - } else if (st->filt_len < old_length) - { - spx_uint32_t i; - /* Reduce filter length, this a bit tricky. We need to store some of the memory as "magic" - samples so they can be used directly as input the next time(s) */ - for (i=0;i<st->nb_channels;i++) - { - spx_uint32_t j; - spx_uint32_t old_magic = st->magic_samples[i]; - st->magic_samples[i] = (old_length - st->filt_len)/2; - /* We must copy some of the memory that's no longer used */ - /* Copy data going backward */ - for (j=0;j<st->filt_len-1+st->magic_samples[i]+old_magic;j++) - st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]]; - st->magic_samples[i] += old_magic; - } - } - -} - -EXPORT SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err) -{ - return speex_resampler_init_frac(nb_channels, in_rate, out_rate, in_rate, out_rate, quality, err); -} - -EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err) -{ - spx_uint32_t i; - SpeexResamplerState *st; - if (quality > 10 || quality < 0) - { - if (err) - *err = RESAMPLER_ERR_INVALID_ARG; - return NULL; - } - st = (SpeexResamplerState *)speex_alloc(sizeof(SpeexResamplerState)); - st->initialised = 0; - st->started = 0; - st->in_rate = 0; - st->out_rate = 0; - st->num_rate = 0; - st->den_rate = 0; - st->quality = -1; - st->sinc_table_length = 0; - st->mem_alloc_size = 0; - st->filt_len = 0; - st->mem = 0; - st->resampler_ptr = 0; - - st->cutoff = 1.f; - st->nb_channels = nb_channels; - st->in_stride = 1; - st->out_stride = 1; - -#ifdef FIXED_POINT - st->buffer_size = 160; -#else - st->buffer_size = 160; -#endif - - /* Per channel data */ - st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(int)); - st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int)); - st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int)); - for (i=0;i<nb_channels;i++) - { - st->last_sample[i] = 0; - st->magic_samples[i] = 0; - st->samp_frac_num[i] = 0; - } - - speex_resampler_set_quality(st, quality); - speex_resampler_set_rate_frac(st, ratio_num, ratio_den, in_rate, out_rate); - - - update_filter(st); - - st->initialised = 1; - if (err) - *err = RESAMPLER_ERR_SUCCESS; - - return st; -} - -EXPORT void speex_resampler_destroy(SpeexResamplerState *st) -{ - speex_free(st->mem); - speex_free(st->sinc_table); - speex_free(st->last_sample); - speex_free(st->magic_samples); - speex_free(st->samp_frac_num); - speex_free(st); -} - -static int speex_resampler_process_native(SpeexResamplerState *st, spx_uint32_t channel_index, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len) -{ - int j=0; - const int N = st->filt_len; - int out_sample = 0; - spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size; - spx_uint32_t ilen; - - st->started = 1; - - /* Call the right resampler through the function ptr */ - out_sample = st->resampler_ptr(st, channel_index, mem, in_len, out, out_len); - - if (st->last_sample[channel_index] < (spx_int32_t)*in_len) - *in_len = st->last_sample[channel_index]; - *out_len = out_sample; - st->last_sample[channel_index] -= *in_len; - - ilen = *in_len; - - for(j=0;j<N-1;++j) - mem[j] = mem[j+ilen]; - - return RESAMPLER_ERR_SUCCESS; -} - -static int speex_resampler_magic(SpeexResamplerState *st, spx_uint32_t channel_index, spx_word16_t **out, spx_uint32_t out_len) { - spx_uint32_t tmp_in_len = st->magic_samples[channel_index]; - spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size; - const int N = st->filt_len; - - speex_resampler_process_native(st, channel_index, &tmp_in_len, *out, &out_len); - - st->magic_samples[channel_index] -= tmp_in_len; - - /* If we couldn't process all "magic" input samples, save the rest for next time */ - if (st->magic_samples[channel_index]) - { - spx_uint32_t i; - for (i=0;i<st->magic_samples[channel_index];i++) - mem[N-1+i]=mem[N-1+i+tmp_in_len]; - } - *out += out_len*st->out_stride; - return out_len; -} - -#ifdef FIXED_POINT -EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len) -#else -EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len) -#endif -{ - int j; - spx_uint32_t ilen = *in_len; - spx_uint32_t olen = *out_len; - spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size; - const int filt_offs = st->filt_len - 1; - const spx_uint32_t xlen = st->mem_alloc_size - filt_offs; - const int istride = st->in_stride; - - if (st->magic_samples[channel_index]) - olen -= speex_resampler_magic(st, channel_index, &out, olen); - if (! st->magic_samples[channel_index]) { - while (ilen && olen) { - spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen; - spx_uint32_t ochunk = olen; - - if (in) { - for(j=0;j<ichunk;++j) - x[j+filt_offs]=in[j*istride]; - } else { - for(j=0;j<ichunk;++j) - x[j+filt_offs]=0; - } - speex_resampler_process_native(st, channel_index, &ichunk, out, &ochunk); - ilen -= ichunk; - olen -= ochunk; - out += ochunk * st->out_stride; - if (in) - in += ichunk * istride; - } - } - *in_len -= ilen; - *out_len -= olen; - return RESAMPLER_ERR_SUCCESS; -} - -#ifdef FIXED_POINT -EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len) -#else -EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len) -#endif -{ - int j; - const int istride_save = st->in_stride; - const int ostride_save = st->out_stride; - spx_uint32_t ilen = *in_len; - spx_uint32_t olen = *out_len; - spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size; - const spx_uint32_t xlen = st->mem_alloc_size - (st->filt_len - 1); -#ifdef VAR_ARRAYS - const unsigned int ylen = (olen < FIXED_STACK_ALLOC) ? olen : FIXED_STACK_ALLOC; - VARDECL(spx_word16_t *ystack); - ALLOC(ystack, ylen, spx_word16_t); -#else - const unsigned int ylen = FIXED_STACK_ALLOC; - spx_word16_t ystack[FIXED_STACK_ALLOC]; -#endif - - st->out_stride = 1; - - while (ilen && olen) { - spx_word16_t *y = ystack; - spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen; - spx_uint32_t ochunk = (olen > ylen) ? ylen : olen; - spx_uint32_t omagic = 0; - - if (st->magic_samples[channel_index]) { - omagic = speex_resampler_magic(st, channel_index, &y, ochunk); - ochunk -= omagic; - olen -= omagic; - } - if (! st->magic_samples[channel_index]) { - if (in) { - for(j=0;j<ichunk;++j) -#ifdef FIXED_POINT - x[j+st->filt_len-1]=WORD2INT(in[j*istride_save]); -#else - x[j+st->filt_len-1]=in[j*istride_save]; -#endif - } else { - for(j=0;j<ichunk;++j) - x[j+st->filt_len-1]=0; - } - - speex_resampler_process_native(st, channel_index, &ichunk, y, &ochunk); - } else { - ichunk = 0; - ochunk = 0; - } - - for (j=0;j<ochunk+omagic;++j) -#ifdef FIXED_POINT - out[j*ostride_save] = ystack[j]; -#else - out[j*ostride_save] = WORD2INT(ystack[j]); -#endif - - ilen -= ichunk; - olen -= ochunk; - out += (ochunk+omagic) * ostride_save; - if (in) - in += ichunk * istride_save; - } - st->out_stride = ostride_save; - *in_len -= ilen; - *out_len -= olen; - - return RESAMPLER_ERR_SUCCESS; -} - -EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len) -{ - spx_uint32_t i; - int istride_save, ostride_save; - spx_uint32_t bak_len = *out_len; - istride_save = st->in_stride; - ostride_save = st->out_stride; - st->in_stride = st->out_stride = st->nb_channels; - for (i=0;i<st->nb_channels;i++) - { - *out_len = bak_len; - if (in != NULL) - speex_resampler_process_float(st, i, in+i, in_len, out+i, out_len); - else - speex_resampler_process_float(st, i, NULL, in_len, out+i, out_len); - } - st->in_stride = istride_save; - st->out_stride = ostride_save; - return RESAMPLER_ERR_SUCCESS; -} - -EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len) -{ - spx_uint32_t i; - int istride_save, ostride_save; - spx_uint32_t bak_len = *out_len; - istride_save = st->in_stride; - ostride_save = st->out_stride; - st->in_stride = st->out_stride = st->nb_channels; - for (i=0;i<st->nb_channels;i++) - { - *out_len = bak_len; - if (in != NULL) - speex_resampler_process_int(st, i, in+i, in_len, out+i, out_len); - else - speex_resampler_process_int(st, i, NULL, in_len, out+i, out_len); - } - st->in_stride = istride_save; - st->out_stride = ostride_save; - return RESAMPLER_ERR_SUCCESS; -} - -EXPORT int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate) -{ - return speex_resampler_set_rate_frac(st, in_rate, out_rate, in_rate, out_rate); -} - -EXPORT void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate) -{ - *in_rate = st->in_rate; - *out_rate = st->out_rate; -} - -EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate) -{ - spx_uint32_t fact; - spx_uint32_t old_den; - spx_uint32_t i; - if (st->in_rate == in_rate && st->out_rate == out_rate && st->num_rate == ratio_num && st->den_rate == ratio_den) - return RESAMPLER_ERR_SUCCESS; - - old_den = st->den_rate; - st->in_rate = in_rate; - st->out_rate = out_rate; - st->num_rate = ratio_num; - st->den_rate = ratio_den; - /* FIXME: This is terribly inefficient, but who cares (at least for now)? */ - for (fact=2;fact<=IMIN(st->num_rate, st->den_rate);fact++) - { - while ((st->num_rate % fact == 0) && (st->den_rate % fact == 0)) - { - st->num_rate /= fact; - st->den_rate /= fact; - } - } - - if (old_den > 0) - { - for (i=0;i<st->nb_channels;i++) - { - st->samp_frac_num[i]=st->samp_frac_num[i]*st->den_rate/old_den; - /* Safety net */ - if (st->samp_frac_num[i] >= st->den_rate) - st->samp_frac_num[i] = st->den_rate-1; - } - } - - if (st->initialised) - update_filter(st); - return RESAMPLER_ERR_SUCCESS; -} - -EXPORT void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den) -{ - *ratio_num = st->num_rate; - *ratio_den = st->den_rate; -} - -EXPORT int speex_resampler_set_quality(SpeexResamplerState *st, int quality) -{ - if (quality > 10 || quality < 0) - return RESAMPLER_ERR_INVALID_ARG; - if (st->quality == quality) - return RESAMPLER_ERR_SUCCESS; - st->quality = quality; - if (st->initialised) - update_filter(st); - return RESAMPLER_ERR_SUCCESS; -} - -EXPORT void speex_resampler_get_quality(SpeexResamplerState *st, int *quality) -{ - *quality = st->quality; -} - -EXPORT void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride) -{ - st->in_stride = stride; -} - -EXPORT void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride) -{ - *stride = st->in_stride; -} - -EXPORT void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride) -{ - st->out_stride = stride; -} - -EXPORT void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride) -{ - *stride = st->out_stride; -} - -EXPORT int speex_resampler_get_input_latency(SpeexResamplerState *st) -{ - return st->filt_len / 2; -} - -EXPORT int speex_resampler_get_output_latency(SpeexResamplerState *st) -{ - return ((st->filt_len / 2) * st->den_rate + (st->num_rate >> 1)) / st->num_rate; -} - -EXPORT int speex_resampler_skip_zeros(SpeexResamplerState *st) -{ - spx_uint32_t i; - for (i=0;i<st->nb_channels;i++) - st->last_sample[i] = st->filt_len/2; - return RESAMPLER_ERR_SUCCESS; -} - -EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st) -{ - spx_uint32_t i; - for (i=0;i<st->nb_channels*(st->filt_len-1);i++) - st->mem[i] = 0; - return RESAMPLER_ERR_SUCCESS; -} - -EXPORT const char *speex_resampler_strerror(int err) -{ - switch (err) - { - case RESAMPLER_ERR_SUCCESS: - return "Success."; - case RESAMPLER_ERR_ALLOC_FAILED: - return "Memory allocation failed."; - case RESAMPLER_ERR_BAD_STATE: - return "Bad resampler state."; - case RESAMPLER_ERR_INVALID_ARG: - return "Invalid argument."; - case RESAMPLER_ERR_PTR_OVERLAP: - return "Input and output buffers overlap."; - default: - return "Unknown error. Bad error code or strange version mismatch."; - } -} diff --git a/src/lib/dl/ext/speex/resample_sse.h b/src/lib/dl/ext/speex/resample_sse.h deleted file mode 100755 index 4bd35a2d..00000000 --- a/src/lib/dl/ext/speex/resample_sse.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright (C) 2007-2008 Jean-Marc Valin - * Copyright (C) 2008 Thorvald Natvig - */ -/** - @file resample_sse.h - @brief Resampler functions (SSE version) -*/ -/* - 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 <xmmintrin.h> - -#define OVERRIDE_INNER_PRODUCT_SINGLE -static inline float inner_product_single(const float *a, const float *b, unsigned int len) -{ - int i; - float ret; - __m128 sum = _mm_setzero_ps(); - for (i=0;i<len;i+=8) - { - sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i))); - sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4))); - } - sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum)); - sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55)); - _mm_store_ss(&ret, sum); - return ret; -} - -#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE -static inline float interpolate_product_single(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) { - int i; - float ret; - __m128 sum = _mm_setzero_ps(); - __m128 f = _mm_loadu_ps(frac); - for(i=0;i<len;i+=2) - { - sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample))); - sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample))); - } - sum = _mm_mul_ps(f, sum); - sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum)); - sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55)); - _mm_store_ss(&ret, sum); - return ret; -} - -#ifdef _USE_SSE2 -#include <emmintrin.h> -#define OVERRIDE_INNER_PRODUCT_DOUBLE - -static inline double inner_product_double(const float *a, const float *b, unsigned int len) -{ - int i; - double ret; - __m128d sum = _mm_setzero_pd(); - __m128 t; - for (i=0;i<len;i+=8) - { - t = _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i)); - sum = _mm_add_pd(sum, _mm_cvtps_pd(t)); - sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t))); - - t = _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4)); - sum = _mm_add_pd(sum, _mm_cvtps_pd(t)); - sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t))); - } - sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum)); - _mm_store_sd(&ret, sum); - return ret; -} - -#define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE -static inline double interpolate_product_double(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) { - int i; - double ret; - __m128d sum; - __m128d sum1 = _mm_setzero_pd(); - __m128d sum2 = _mm_setzero_pd(); - __m128 f = _mm_loadu_ps(frac); - __m128d f1 = _mm_cvtps_pd(f); - __m128d f2 = _mm_cvtps_pd(_mm_movehl_ps(f,f)); - __m128 t; - for(i=0;i<len;i+=2) - { - t = _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample)); - sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t)); - sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t))); - - t = _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample)); - sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t)); - sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t))); - } - sum1 = _mm_mul_pd(f1, sum1); - sum2 = _mm_mul_pd(f2, sum2); - sum = _mm_add_pd(sum1, sum2); - sum = _mm_add_sd(sum, (__m128d) _mm_movehl_ps((__m128) sum, (__m128) sum)); - _mm_store_sd(&ret, sum); - return ret; -} - -#endif diff --git a/src/lib/dl/ext/speex/sb_celp.c b/src/lib/dl/ext/speex/sb_celp.c deleted file mode 100755 index 6c19ff8b..00000000 --- a/src/lib/dl/ext/speex/sb_celp.c +++ /dev/null @@ -1,1488 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: sb_celp.c - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include "sb_celp.h" -#include "filters.h" -#include "lpc.h" -#include "lsp.h" -#include "stack_alloc.h" -#include "cb_search.h" -#include "quant_lsp.h" -#include "vq.h" -#include "ltp.h" -#include "arch.h" -#include "math_approx.h" -#include "os_support.h" - -#ifndef NULL -#define NULL 0 -#endif - -/* Default size for the encoder and decoder stack (can be changed at compile time). - This does not apply when using variable-size arrays or alloca. */ -#ifndef SB_ENC_STACK -#define SB_ENC_STACK (10000*sizeof(spx_sig_t)) -#endif - -#ifndef SB_DEC_STACK -#define SB_DEC_STACK (6000*sizeof(spx_sig_t)) -#endif - - -#ifdef DISABLE_WIDEBAND -void *sb_encoder_init(const SpeexMode *m) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); - return NULL; -} -void sb_encoder_destroy(void *state) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); -} -int sb_encode(void *state, void *vin, SpeexBits *bits) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); - return -2; -} -void *sb_decoder_init(const SpeexMode *m) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); - return NULL; -} -void sb_decoder_destroy(void *state) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); -} -int sb_decode(void *state, SpeexBits *bits, void *vout) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); - return -2; -} -int sb_encoder_ctl(void *state, int request, void *ptr) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); - return -2; -} -int sb_decoder_ctl(void *state, int request, void *ptr) -{ - speex_fatal("Wideband and Ultra-wideband are disabled"); - return -2; -} -#else - - -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif - -#define sqr(x) ((x)*(x)) - -#define SUBMODE(x) st->submodes[st->submodeID]->x - -#ifdef FIXED_POINT -static const spx_word16_t gc_quant_bound[16] = {125, 164, 215, 282, 370, 484, 635, 832, 1090, 1428, 1871, 2452, 3213, 4210, 5516, 7228}; -static const spx_word16_t fold_quant_bound[32] = { - 39, 44, 50, 57, 64, 73, 83, 94, - 106, 120, 136, 154, 175, 198, 225, 255, - 288, 327, 370, 420, 476, 539, 611, 692, - 784, 889, 1007, 1141, 1293, 1465, 1660, 1881}; -#define LSP_MARGIN 410 -#define LSP_DELTA1 6553 -#define LSP_DELTA2 1638 - -#else - -static const spx_word16_t gc_quant_bound[16] = { - 0.97979, 1.28384, 1.68223, 2.20426, 2.88829, 3.78458, 4.95900, 6.49787, - 8.51428, 11.15642, 14.61846, 19.15484, 25.09895, 32.88761, 43.09325, 56.46588}; -static const spx_word16_t fold_quant_bound[32] = { - 0.30498, 0.34559, 0.39161, 0.44375, 0.50283, 0.56979, 0.64565, 0.73162, - 0.82903, 0.93942, 1.06450, 1.20624, 1.36685, 1.54884, 1.75506, 1.98875, - 2.25355, 2.55360, 2.89361, 3.27889, 3.71547, 4.21018, 4.77076, 5.40598, - 6.12577, 6.94141, 7.86565, 8.91295, 10.09969, 11.44445, 12.96826, 14.69497}; - -#define LSP_MARGIN .05 -#define LSP_DELTA1 .2 -#define LSP_DELTA2 .05 - -#endif - -#define QMF_ORDER 64 - -#ifdef FIXED_POINT -static const spx_word16_t h0[64] = {2, -7, -7, 18, 15, -39, -25, 75, 35, -130, -41, 212, 38, -327, -17, 483, -32, -689, 124, 956, -283, -1307, 543, 1780, -973, -2467, 1733, 3633, -3339, -6409, 9059, 30153, 30153, 9059, -6409, -3339, 3633, 1733, -2467, -973, 1780, 543, -1307, -283, 956, 124, -689, -32, 483, -17, -327, 38, 212, -41, -130, 35, 75, -25, -39, 15, 18, -7, -7, 2}; - -#else -static const float h0[64] = { - 3.596189e-05f, -0.0001123515f, - -0.0001104587f, 0.0002790277f, - 0.0002298438f, -0.0005953563f, - -0.0003823631f, 0.00113826f, - 0.0005308539f, -0.001986177f, - -0.0006243724f, 0.003235877f, - 0.0005743159f, -0.004989147f, - -0.0002584767f, 0.007367171f, - -0.0004857935f, -0.01050689f, - 0.001894714f, 0.01459396f, - -0.004313674f, -0.01994365f, - 0.00828756f, 0.02716055f, - -0.01485397f, -0.03764973f, - 0.026447f, 0.05543245f, - -0.05095487f, -0.09779096f, - 0.1382363f, 0.4600981f, - 0.4600981f, 0.1382363f, - -0.09779096f, -0.05095487f, - 0.05543245f, 0.026447f, - -0.03764973f, -0.01485397f, - 0.02716055f, 0.00828756f, - -0.01994365f, -0.004313674f, - 0.01459396f, 0.001894714f, - -0.01050689f, -0.0004857935f, - 0.007367171f, -0.0002584767f, - -0.004989147f, 0.0005743159f, - 0.003235877f, -0.0006243724f, - -0.001986177f, 0.0005308539f, - 0.00113826f, -0.0003823631f, - -0.0005953563f, 0.0002298438f, - 0.0002790277f, -0.0001104587f, - -0.0001123515f, 3.596189e-05f -}; - -#endif - -extern const spx_word16_t lag_window[]; -extern const spx_word16_t lpc_window[]; - - -void *sb_encoder_init(const SpeexMode *m) -{ - int i; - spx_int32_t tmp; - SBEncState *st; - const SpeexSBMode *mode; - - st = (SBEncState*)speex_alloc(sizeof(SBEncState)); - if (!st) - return NULL; - st->mode = m; - mode = (const SpeexSBMode*)m->mode; - - - st->st_low = speex_encoder_init(mode->nb_mode); -#if defined(VAR_ARRAYS) || defined (USE_ALLOCA) - st->stack = NULL; -#else - /*st->stack = (char*)speex_alloc_scratch(SB_ENC_STACK);*/ - speex_encoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack); -#endif - - st->full_frame_size = 2*mode->frameSize; - st->frame_size = mode->frameSize; - st->subframeSize = mode->subframeSize; - st->nbSubframes = mode->frameSize/mode->subframeSize; - st->windowSize = st->frame_size+st->subframeSize; - st->lpcSize=mode->lpcSize; - - st->encode_submode = 1; - st->submodes=mode->submodes; - st->submodeSelect = st->submodeID=mode->defaultSubmode; - - tmp=9; - speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &tmp); - tmp=1; - speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp); - - st->lpc_floor = mode->lpc_floor; - st->gamma1=mode->gamma1; - st->gamma2=mode->gamma2; - st->first=1; - - st->high=(spx_word16_t*)speex_alloc((st->windowSize-st->frame_size)*sizeof(spx_word16_t)); - - st->h0_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); - st->h1_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); - - st->window= lpc_window; - - st->lagWindow = lag_window; - - st->old_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); - st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); - st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); - st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); - st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t)); - st->innov_rms_save = NULL; - - st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - st->mem_sp2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t)); - - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1); - -#ifndef DISABLE_VBR - st->vbr_quality = 8; - st->vbr_enabled = 0; - st->vbr_max = 0; - st->vbr_max_high = 20000; /* We just need a big value here */ - st->vad_enabled = 0; - st->abr_enabled = 0; - st->relative_quality=0; -#endif /* #ifndef DISABLE_VBR */ - - st->complexity=2; - speex_encoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate); - st->sampling_rate*=2; -#ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st)); -#endif - return st; -} - -void sb_encoder_destroy(void *state) -{ - SBEncState *st=(SBEncState*)state; - - speex_encoder_destroy(st->st_low); -#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA)) - /*speex_free_scratch(st->stack);*/ -#endif - - speex_free(st->high); - - speex_free(st->h0_mem); - speex_free(st->h1_mem); - - speex_free(st->old_lsp); - speex_free(st->old_qlsp); - speex_free(st->interp_qlpc); - speex_free(st->pi_gain); - speex_free(st->exc_rms); - - speex_free(st->mem_sp); - speex_free(st->mem_sp2); - speex_free(st->mem_sw); - - - speex_free(st); -} - - -int sb_encode(void *state, void *vin, SpeexBits *bits) -{ - SBEncState *st; - int i, roots, sub; - char *stack; - VARDECL(spx_mem_t *mem); - VARDECL(spx_sig_t *innov); - VARDECL(spx_word16_t *target); - VARDECL(spx_word16_t *syn_resp); - VARDECL(spx_word32_t *low_pi_gain); - spx_word16_t *low; - spx_word16_t *high; - VARDECL(spx_word16_t *low_exc_rms); - VARDECL(spx_word16_t *low_innov_rms); - const SpeexSBMode *mode; - spx_int32_t dtx; - spx_word16_t *in = (spx_word16_t*)vin; - spx_word16_t e_low=0, e_high=0; - VARDECL(spx_coef_t *lpc); - VARDECL(spx_coef_t *interp_lpc); - VARDECL(spx_coef_t *bw_lpc1); - VARDECL(spx_coef_t *bw_lpc2); - VARDECL(spx_lsp_t *lsp); - VARDECL(spx_lsp_t *qlsp); - VARDECL(spx_lsp_t *interp_lsp); - VARDECL(spx_lsp_t *interp_qlsp); - - st = (SBEncState*)state; - stack=st->stack; - mode = (const SpeexSBMode*)(st->mode->mode); - low = in; - high = in+st->frame_size; - - /* High-band buffering / sync with low band */ - /* Compute the two sub-bands by filtering with QMF h0*/ - qmf_decomp(in, h0, low, high, st->full_frame_size, QMF_ORDER, st->h0_mem, stack); - -#ifndef DISABLE_VBR - if (st->vbr_enabled || st->vad_enabled) - { - /* Need to compute things here before the signal is trashed by the encoder */ - /*FIXME: Are the two signals (low, high) in sync? */ - e_low = compute_rms16(low, st->frame_size); - e_high = compute_rms16(high, st->frame_size); - } -#endif /* #ifndef DISABLE_VBR */ - - ALLOC(low_innov_rms, st->nbSubframes, spx_word16_t); - speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_rms); - /* Encode the narrowband part*/ - speex_encode_native(st->st_low, low, bits); - - high = high - (st->windowSize-st->frame_size); - SPEEX_COPY(high, st->high, st->windowSize-st->frame_size); - SPEEX_COPY(st->high, &high[st->frame_size], st->windowSize-st->frame_size); - - - ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t); - ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t); - speex_encoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain); - speex_encoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms); - - speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, &dtx); - - if (dtx==0) - dtx=1; - else - dtx=0; - - ALLOC(lpc, st->lpcSize, spx_coef_t); - ALLOC(interp_lpc, st->lpcSize, spx_coef_t); - ALLOC(bw_lpc1, st->lpcSize, spx_coef_t); - ALLOC(bw_lpc2, st->lpcSize, spx_coef_t); - - ALLOC(lsp, st->lpcSize, spx_lsp_t); - ALLOC(qlsp, st->lpcSize, spx_lsp_t); - ALLOC(interp_lsp, st->lpcSize, spx_lsp_t); - ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t); - - { - VARDECL(spx_word16_t *autocorr); - VARDECL(spx_word16_t *w_sig); - ALLOC(autocorr, st->lpcSize+1, spx_word16_t); - ALLOC(w_sig, st->windowSize, spx_word16_t); - /* Window for analysis */ - /* FIXME: This is a kludge */ - if (st->subframeSize==80) - { - for (i=0;i<st->windowSize;i++) - w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i>>1]),SIG_SHIFT)); - } else { - for (i=0;i<st->windowSize;i++) - w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i]),SIG_SHIFT)); - } - /* Compute auto-correlation */ - _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize); - autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */ - - /* Lag windowing: equivalent to filtering in the power-spectrum domain */ - for (i=0;i<st->lpcSize+1;i++) - autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]); - - /* Levinson-Durbin */ - _spx_lpc(lpc, autocorr, st->lpcSize); - } - - /* LPC to LSPs (x-domain) transform */ - roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack); - if (roots!=st->lpcSize) - { - roots = lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA2, stack); - if (roots!=st->lpcSize) { - /*If we can't find all LSP's, do some damage control and use a flat filter*/ - for (i=0;i<st->lpcSize;i++) - { - lsp[i]=st->old_lsp[i]; - } - } - } - -#ifndef DISABLE_VBR - /* VBR code */ - if ((st->vbr_enabled || st->vad_enabled) && !dtx) - { - float ratio; - if (st->abr_enabled) - { - float qual_change=0; - if (st->abr_drift2 * st->abr_drift > 0) - { - /* Only adapt if long-term and short-term drift are the same sign */ - qual_change = -.00001*st->abr_drift/(1+st->abr_count); - if (qual_change>.1) - qual_change=.1; - if (qual_change<-.1) - qual_change=-.1; - } - st->vbr_quality += qual_change; - if (st->vbr_quality>10) - st->vbr_quality=10; - if (st->vbr_quality<0) - st->vbr_quality=0; - } - - - ratio = 2*log((1.f+e_high)/(1.f+e_low)); - - speex_encoder_ctl(st->st_low, SPEEX_GET_RELATIVE_QUALITY, &st->relative_quality); - if (ratio<-4) - ratio=-4; - if (ratio>2) - ratio=2; - /*if (ratio>-2)*/ - if (st->vbr_enabled) - { - spx_int32_t modeid; - modeid = mode->nb_modes-1; - st->relative_quality+=1.0*(ratio+2); - if (st->relative_quality<-1) - st->relative_quality=-1; - while (modeid) - { - int v1; - float thresh; - v1=(int)floor(st->vbr_quality); - if (v1==10) - thresh = mode->vbr_thresh[modeid][v1]; - else - thresh = (st->vbr_quality-v1) * mode->vbr_thresh[modeid][v1+1] + - (1+v1-st->vbr_quality) * mode->vbr_thresh[modeid][v1]; - if (st->relative_quality >= thresh && st->sampling_rate*st->submodes[modeid]->bits_per_frame/st->full_frame_size <= st->vbr_max_high) - break; - modeid--; - } - speex_encoder_ctl(state, SPEEX_SET_HIGH_MODE, &modeid); - if (st->abr_enabled) - { - spx_int32_t bitrate; - speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate); - st->abr_drift+=(bitrate-st->abr_enabled); - st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled); - st->abr_count += 1.0; - } - - } else { - /* VAD only */ - int modeid; - if (st->relative_quality<2.0) - modeid=1; - else - modeid=st->submodeSelect; - /*speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);*/ - st->submodeID=modeid; - - } - /*fprintf (stderr, "%f %f\n", ratio, low_qual);*/ - } -#endif /* #ifndef DISABLE_VBR */ - - if (st->encode_submode) - { - speex_bits_pack(bits, 1, 1); - if (dtx) - speex_bits_pack(bits, 0, SB_SUBMODE_BITS); - else - speex_bits_pack(bits, st->submodeID, SB_SUBMODE_BITS); - } - - /* If null mode (no transmission), just set a couple things to zero*/ - if (dtx || st->submodes[st->submodeID] == NULL) - { - for (i=0;i<st->frame_size;i++) - high[i]=VERY_SMALL; - - for (i=0;i<st->lpcSize;i++) - st->mem_sw[i]=0; - st->first=1; - - /* Final signal synthesis from excitation */ - iir_mem16(high, st->interp_qlpc, high, st->frame_size, st->lpcSize, st->mem_sp, stack); - - if (dtx) - return 0; - else - return 1; - } - - - /* LSP quantization */ - SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits); - - if (st->first) - { - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i] = lsp[i]; - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - } - - ALLOC(mem, st->lpcSize, spx_mem_t); - ALLOC(syn_resp, st->subframeSize, spx_word16_t); - ALLOC(innov, st->subframeSize, spx_sig_t); - ALLOC(target, st->subframeSize, spx_word16_t); - - for (sub=0;sub<st->nbSubframes;sub++) - { - VARDECL(spx_word16_t *exc); - VARDECL(spx_word16_t *res); - VARDECL(spx_word16_t *sw); - spx_word16_t *sp; - spx_word16_t filter_ratio; /*Q7*/ - int offset; - spx_word32_t rl, rh; /*Q13*/ - spx_word16_t eh=0; - - offset = st->subframeSize*sub; - sp=high+offset; - ALLOC(exc, st->subframeSize, spx_word16_t); - ALLOC(res, st->subframeSize, spx_word16_t); - ALLOC(sw, st->subframeSize, spx_word16_t); - - /* LSP interpolation (quantized and unquantized) */ - lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes); - lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes); - - lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN); - lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN); - - lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack); - lsp_to_lpc(interp_qlsp, st->interp_qlpc, st->lpcSize, stack); - - bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize); - bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize); - - /* Compute mid-band (4000 Hz for wideband) response of low-band and high-band - filters */ - st->pi_gain[sub]=LPC_SCALING; - rh = LPC_SCALING; - for (i=0;i<st->lpcSize;i+=2) - { - rh += st->interp_qlpc[i+1] - st->interp_qlpc[i]; - st->pi_gain[sub] += st->interp_qlpc[i] + st->interp_qlpc[i+1]; - } - - rl = low_pi_gain[sub]; -#ifdef FIXED_POINT - filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767)); -#else - filter_ratio=(rl+.01)/(rh+.01); -#endif - - /* Compute "real excitation" */ - fir_mem16(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2, stack); - /* Compute energy of low-band and high-band excitation */ - - eh = compute_rms16(exc, st->subframeSize); - - if (!SUBMODE(innovation_quant)) {/* 1 for spectral folding excitation, 0 for stochastic */ - spx_word32_t g; /*Q7*/ - spx_word16_t el; /*Q0*/ - el = low_innov_rms[sub]; - - /* Gain to use if we want to use the low-band excitation for high-band */ - g=PDIV32(MULT16_16(filter_ratio,eh),EXTEND32(ADD16(1,el))); - -#if 0 - { - char *tmp_stack=stack; - float *tmp_sig; - float g2; - ALLOC(tmp_sig, st->subframeSize, spx_sig_t); - for (i=0;i<st->lpcSize;i++) - mem[i]=st->mem_sp[i]; - iir_mem2(st->low_innov+offset, st->interp_qlpc, tmp_sig, st->subframeSize, st->lpcSize, mem); - g2 = compute_rms(sp, st->subframeSize)/(.01+compute_rms(tmp_sig, st->subframeSize)); - /*fprintf (stderr, "gains: %f %f\n", g, g2);*/ - g = g2; - stack = tmp_stack; - } -#endif - - /*print_vec(&g, 1, "gain factor");*/ - /* Gain quantization */ - { - int quant = scal_quant(g, fold_quant_bound, 32); - /*speex_warning_int("tata", quant);*/ - if (quant<0) - quant=0; - if (quant>31) - quant=31; - speex_bits_pack(bits, quant, 5); - } - if (st->innov_rms_save) - { - st->innov_rms_save[sub] = eh; - } - st->exc_rms[sub] = eh; - } else { - spx_word16_t gc; /*Q7*/ - spx_word32_t scale; /*Q14*/ - spx_word16_t el; /*Q0*/ - el = low_exc_rms[sub]; /*Q0*/ - - gc = PDIV32_16(MULT16_16(filter_ratio,1+eh),1+el); - - /* This is a kludge that cleans up a historical bug */ - if (st->subframeSize==80) - gc = MULT16_16_P15(QCONST16(0.70711f,15),gc); - /*printf ("%f %f %f %f\n", el, eh, filter_ratio, gc);*/ - { - int qgc = scal_quant(gc, gc_quant_bound, 16); - speex_bits_pack(bits, qgc, 4); - gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]); - } - if (st->subframeSize==80) - gc = MULT16_16_P14(QCONST16(1.4142f,14), gc); - - scale = SHL32(MULT16_16(PDIV32_16(SHL32(EXTEND32(gc),SIG_SHIFT-6),filter_ratio),(1+el)),6); - - compute_impulse_response(st->interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack); - - - /* Reset excitation */ - for (i=0;i<st->subframeSize;i++) - res[i]=VERY_SMALL; - - /* Compute zero response (ringing) of A(z/g1) / ( A(z/g2) * Aq(z) ) */ - for (i=0;i<st->lpcSize;i++) - mem[i]=st->mem_sp[i]; - iir_mem16(res, st->interp_qlpc, res, st->subframeSize, st->lpcSize, mem, stack); - - for (i=0;i<st->lpcSize;i++) - mem[i]=st->mem_sw[i]; - filter_mem16(res, bw_lpc1, bw_lpc2, res, st->subframeSize, st->lpcSize, mem, stack); - - /* Compute weighted signal */ - for (i=0;i<st->lpcSize;i++) - mem[i]=st->mem_sw[i]; - filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack); - - /* Compute target signal */ - for (i=0;i<st->subframeSize;i++) - target[i]=SUB16(sw[i],res[i]); - - signal_div(target, target, scale, st->subframeSize); - - /* Reset excitation */ - SPEEX_MEMSET(innov, 0, st->subframeSize); - - /*print_vec(target, st->subframeSize, "\ntarget");*/ - SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2, - SUBMODE(innovation_params), st->lpcSize, st->subframeSize, - innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook)); - /*print_vec(target, st->subframeSize, "after");*/ - - signal_mul(innov, innov, scale, st->subframeSize); - - if (SUBMODE(double_codebook)) { - char *tmp_stack=stack; - VARDECL(spx_sig_t *innov2); - ALLOC(innov2, st->subframeSize, spx_sig_t); - SPEEX_MEMSET(innov2, 0, st->subframeSize); - for (i=0;i<st->subframeSize;i++) - target[i]=MULT16_16_P13(QCONST16(2.5f,13), target[i]); - - SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2, - SUBMODE(innovation_params), st->lpcSize, st->subframeSize, - innov2, syn_resp, bits, stack, st->complexity, 0); - signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize); - - for (i=0;i<st->subframeSize;i++) - innov[i] = ADD32(innov[i],innov2[i]); - stack = tmp_stack; - } - for (i=0;i<st->subframeSize;i++) - exc[i] = PSHR32(innov[i],SIG_SHIFT); - - if (st->innov_rms_save) - { - st->innov_rms_save[sub] = MULT16_16_Q15(QCONST16(.70711f, 15), compute_rms(innov, st->subframeSize)); - } - st->exc_rms[sub] = compute_rms16(exc, st->subframeSize); - - - } - - - /*Keep the previous memory*/ - for (i=0;i<st->lpcSize;i++) - mem[i]=st->mem_sp[i]; - /* Final signal synthesis from excitation */ - iir_mem16(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp, stack); - - /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */ - filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack); - } - - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i] = lsp[i]; - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - - st->first=0; - - return 1; -} - - - - - -void *sb_decoder_init(const SpeexMode *m) -{ - spx_int32_t tmp; - SBDecState *st; - const SpeexSBMode *mode; - st = (SBDecState*)speex_alloc(sizeof(SBDecState)); - if (!st) - return NULL; - st->mode = m; - mode=(const SpeexSBMode*)m->mode; - st->encode_submode = 1; - - st->st_low = speex_decoder_init(mode->nb_mode); -#if defined(VAR_ARRAYS) || defined (USE_ALLOCA) - st->stack = NULL; -#else - /*st->stack = (char*)speex_alloc_scratch(SB_DEC_STACK);*/ - speex_decoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack); -#endif - - st->full_frame_size = 2*mode->frameSize; - st->frame_size = mode->frameSize; - st->subframeSize = mode->subframeSize; - st->nbSubframes = mode->frameSize/mode->subframeSize; - st->lpcSize=mode->lpcSize; - speex_decoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate); - st->sampling_rate*=2; - tmp=1; - speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp); - - st->submodes=mode->submodes; - st->submodeID=mode->defaultSubmode; - - st->first=1; - - st->g0_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); - st->g1_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t)); - - st->excBuf = (spx_word16_t*)speex_alloc((st->subframeSize)*sizeof(spx_word16_t)); - - st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t)); - st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); - - st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); - st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t)); - st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t)); - - st->innov_save = NULL; - - - st->lpc_enh_enabled=0; - st->seed = 1000; - -#ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st)); -#endif - return st; -} - -void sb_decoder_destroy(void *state) -{ - SBDecState *st; - st = (SBDecState*)state; - speex_decoder_destroy(st->st_low); -#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA)) - /*speex_free_scratch(st->stack);*/ -#endif - - speex_free(st->g0_mem); - speex_free(st->g1_mem); - speex_free(st->excBuf); - speex_free(st->old_qlsp); - speex_free(st->interp_qlpc); - speex_free(st->pi_gain); - speex_free(st->exc_rms); - speex_free(st->mem_sp); - - speex_free(state); -} - -static void sb_decode_lost(SBDecState *st, spx_word16_t *out, int dtx, char *stack) -{ - int i; - int saved_modeid=0; - - if (dtx) - { - saved_modeid=st->submodeID; - st->submodeID=1; - } else { - bw_lpc(QCONST16(0.99f,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize); - } - - st->first=1; - - - /* Final signal synthesis from excitation */ - if (!dtx) - { - st->last_ener = MULT16_16_Q15(QCONST16(.9f,15),st->last_ener); - } - for (i=0;i<st->frame_size;i++) - out[i+st->frame_size] = speex_rand(st->last_ener, &st->seed); - - iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize, - st->mem_sp, stack); - - - /* Reconstruct the original */ - qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack); - if (dtx) - { - st->submodeID=saved_modeid; - } - - return; -} - -int sb_decode(void *state, SpeexBits *bits, void *vout) -{ - int i, sub; - SBDecState *st; - int wideband; - int ret; - char *stack; - VARDECL(spx_word32_t *low_pi_gain); - VARDECL(spx_word16_t *low_exc_rms); - VARDECL(spx_coef_t *ak); - VARDECL(spx_lsp_t *qlsp); - VARDECL(spx_lsp_t *interp_qlsp); - spx_int32_t dtx; - const SpeexSBMode *mode; - spx_word16_t *out = (spx_word16_t*)vout; - spx_word16_t *low_innov_alias; - spx_word32_t exc_ener_sum = 0; - - st = (SBDecState*)state; - stack=st->stack; - mode = (const SpeexSBMode*)(st->mode->mode); - - low_innov_alias = out+st->frame_size; - speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_alias); - /* Decode the low-band */ - ret = speex_decode_native(st->st_low, bits, out); - - speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, &dtx); - - /* If error decoding the narrowband part, propagate error */ - if (ret!=0) - { - return ret; - } - - if (!bits) - { - sb_decode_lost(st, out, dtx, stack); - return 0; - } - - if (st->encode_submode) - { - - /*Check "wideband bit"*/ - if (speex_bits_remaining(bits)>0) - wideband = speex_bits_peek(bits); - else - wideband = 0; - if (wideband) - { - /*Regular wideband frame, read the submode*/ - wideband = speex_bits_unpack_unsigned(bits, 1); - st->submodeID = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS); - } else - { - /*Was a narrowband frame, set "null submode"*/ - st->submodeID = 0; - } - if (st->submodeID != 0 && st->submodes[st->submodeID] == NULL) - { - speex_notify("Invalid mode encountered. The stream is corrupted."); - return -2; - } - } - - /* If null mode (no transmission), just set a couple things to zero*/ - if (st->submodes[st->submodeID] == NULL) - { - if (dtx) - { - sb_decode_lost(st, out, 1, stack); - return 0; - } - - for (i=0;i<st->frame_size;i++) - out[st->frame_size+i]=VERY_SMALL; - - st->first=1; - - /* Final signal synthesis from excitation */ - iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize, st->mem_sp, stack); - - qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack); - - return 0; - - } - - ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t); - ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t); - speex_decoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain); - speex_decoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms); - - ALLOC(qlsp, st->lpcSize, spx_lsp_t); - ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t); - SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits); - - if (st->first) - { - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - } - - ALLOC(ak, st->lpcSize, spx_coef_t); - - for (sub=0;sub<st->nbSubframes;sub++) - { - VARDECL(spx_word32_t *exc); - spx_word16_t *innov_save=NULL; - spx_word16_t *sp; - spx_word16_t filter_ratio; - spx_word16_t el=0; - int offset; - spx_word32_t rl=0,rh=0; - - offset = st->subframeSize*sub; - sp=out+st->frame_size+offset; - ALLOC(exc, st->subframeSize, spx_word32_t); - /* Pointer for saving innovation */ - if (st->innov_save) - { - innov_save = st->innov_save+2*offset; - SPEEX_MEMSET(innov_save, 0, 2*st->subframeSize); - } - - /* LSP interpolation */ - lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes); - - lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN); - - /* LSP to LPC */ - lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack); - - /* Calculate reponse ratio between the low and high filter in the middle - of the band (4000 Hz) */ - - st->pi_gain[sub]=LPC_SCALING; - rh = LPC_SCALING; - for (i=0;i<st->lpcSize;i+=2) - { - rh += ak[i+1] - ak[i]; - st->pi_gain[sub] += ak[i] + ak[i+1]; - } - - rl = low_pi_gain[sub]; -#ifdef FIXED_POINT - filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767)); -#else - filter_ratio=(rl+.01)/(rh+.01); -#endif - - SPEEX_MEMSET(exc, 0, st->subframeSize); - if (!SUBMODE(innovation_unquant)) - { - spx_word32_t g; - int quant; - - quant = speex_bits_unpack_unsigned(bits, 5); - g= spx_exp(MULT16_16(QCONST16(.125f,11),(quant-10))); - - g = PDIV32(g, filter_ratio); - - for (i=0;i<st->subframeSize;i+=2) - { - exc[i]=SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i]),SHL32(g,6)),SIG_SHIFT); - exc[i+1]=NEG32(SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i+1]),SHL32(g,6)),SIG_SHIFT)); - } - - } else { - spx_word16_t gc; - spx_word32_t scale; - int qgc = speex_bits_unpack_unsigned(bits, 4); - - el = low_exc_rms[sub]; - gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]); - - if (st->subframeSize==80) - gc = MULT16_16_P14(QCONST16(1.4142f,14),gc); - - scale = SHL32(PDIV32(SHL32(MULT16_16(gc, el),3), filter_ratio),SIG_SHIFT-3); - SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize, - bits, stack, &st->seed); - - signal_mul(exc,exc,scale,st->subframeSize); - - if (SUBMODE(double_codebook)) { - char *tmp_stack=stack; - VARDECL(spx_sig_t *innov2); - ALLOC(innov2, st->subframeSize, spx_sig_t); - SPEEX_MEMSET(innov2, 0, st->subframeSize); - SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, - bits, stack, &st->seed); - signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize); - for (i=0;i<st->subframeSize;i++) - exc[i] = ADD32(exc[i],innov2[i]); - stack = tmp_stack; - } - - } - - if (st->innov_save) - { - for (i=0;i<st->subframeSize;i++) - innov_save[2*i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT)); - } - - iir_mem16(st->excBuf, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, - st->mem_sp, stack); - for (i=0;i<st->subframeSize;i++) - st->excBuf[i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT)); - for (i=0;i<st->lpcSize;i++) - st->interp_qlpc[i] = ak[i]; - st->exc_rms[sub] = compute_rms16(st->excBuf, st->subframeSize); - exc_ener_sum = ADD32(exc_ener_sum, DIV32(MULT16_16(st->exc_rms[sub],st->exc_rms[sub]), st->nbSubframes)); - } - st->last_ener = spx_sqrt(exc_ener_sum); - - qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack); - for (i=0;i<st->lpcSize;i++) - st->old_qlsp[i] = qlsp[i]; - - st->first=0; - - return 0; -} - - -int sb_encoder_ctl(void *state, int request, void *ptr) -{ - SBEncState *st; - st=(SBEncState*)state; - switch(request) - { - case SPEEX_GET_FRAME_SIZE: - (*(spx_int32_t*)ptr) = st->full_frame_size; - break; - case SPEEX_SET_HIGH_MODE: - st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr); - break; - case SPEEX_SET_LOW_MODE: - speex_encoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr); - break; - case SPEEX_SET_DTX: - speex_encoder_ctl(st->st_low, SPEEX_SET_DTX, ptr); - break; - case SPEEX_GET_DTX: - speex_encoder_ctl(st->st_low, SPEEX_GET_DTX, ptr); - break; - case SPEEX_GET_LOW_MODE: - speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr); - break; - case SPEEX_SET_MODE: - speex_encoder_ctl(st, SPEEX_SET_QUALITY, ptr); - break; -#ifndef DISABLE_VBR - case SPEEX_SET_VBR: - st->vbr_enabled = (*(spx_int32_t*)ptr); - speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr); - break; - case SPEEX_GET_VBR: - (*(spx_int32_t*)ptr) = st->vbr_enabled; - break; - case SPEEX_SET_VAD: - st->vad_enabled = (*(spx_int32_t*)ptr); - speex_encoder_ctl(st->st_low, SPEEX_SET_VAD, ptr); - break; - case SPEEX_GET_VAD: - (*(spx_int32_t*)ptr) = st->vad_enabled; - break; -#endif /* #ifndef DISABLE_VBR */ -#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) - case SPEEX_SET_VBR_QUALITY: - { - spx_int32_t q; - float qual = (*(float*)ptr)+.6; - st->vbr_quality = (*(float*)ptr); - if (qual>10) - qual=10; - q=(int)floor(.5+*(float*)ptr); - if (q>10) - q=10; - speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_QUALITY, &qual); - speex_encoder_ctl(state, SPEEX_SET_QUALITY, &q); - break; - } - case SPEEX_GET_VBR_QUALITY: - (*(float*)ptr) = st->vbr_quality; - break; -#endif /* #if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */ -#ifndef DISABLE_VBR - case SPEEX_SET_ABR: - st->abr_enabled = (*(spx_int32_t*)ptr); - st->vbr_enabled = st->abr_enabled!=0; - speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, &st->vbr_enabled); - if (st->vbr_enabled) - { - spx_int32_t i=10, rate, target; - float vbr_qual; - target = (*(spx_int32_t*)ptr); - while (i>=0) - { - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i); - speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate); - if (rate <= target) - break; - i--; - } - vbr_qual=i; - if (vbr_qual<0) - vbr_qual=0; - speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual); - st->abr_count=0; - st->abr_drift=0; - st->abr_drift2=0; - } - - break; - case SPEEX_GET_ABR: - (*(spx_int32_t*)ptr) = st->abr_enabled; - break; -#endif /* #ifndef DISABLE_VBR */ - - case SPEEX_SET_QUALITY: - { - spx_int32_t nb_qual; - int quality = (*(spx_int32_t*)ptr); - if (quality < 0) - quality = 0; - if (quality > 10) - quality = 10; - st->submodeSelect = st->submodeID = ((const SpeexSBMode*)(st->mode->mode))->quality_map[quality]; - nb_qual = ((const SpeexSBMode*)(st->mode->mode))->low_quality_map[quality]; - speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual); - } - break; - case SPEEX_SET_COMPLEXITY: - speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr); - st->complexity = (*(spx_int32_t*)ptr); - if (st->complexity<1) - st->complexity=1; - break; - case SPEEX_GET_COMPLEXITY: - (*(spx_int32_t*)ptr) = st->complexity; - break; - case SPEEX_SET_BITRATE: - { - spx_int32_t i=10; - spx_int32_t rate, target; - target = (*(spx_int32_t*)ptr); - while (i>=0) - { - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i); - speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate); - if (rate <= target) - break; - i--; - } - } - break; - case SPEEX_GET_BITRATE: - speex_encoder_ctl(st->st_low, request, ptr); - /*fprintf (stderr, "before: %d\n", (*(int*)ptr));*/ - if (st->submodes[st->submodeID]) - (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size; - else - (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size; - /*fprintf (stderr, "after: %d\n", (*(int*)ptr));*/ - break; - case SPEEX_SET_SAMPLING_RATE: - { - spx_int32_t tmp=(*(spx_int32_t*)ptr); - st->sampling_rate = tmp; - tmp>>=1; - speex_encoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp); - } - break; - case SPEEX_GET_SAMPLING_RATE: - (*(spx_int32_t*)ptr)=st->sampling_rate; - break; - case SPEEX_RESET_STATE: - { - int i; - st->first = 1; - for (i=0;i<st->lpcSize;i++) - st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1); - for (i=0;i<st->lpcSize;i++) - st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0; - for (i=0;i<QMF_ORDER;i++) - st->h0_mem[i]=st->h1_mem[i]=0; - } - break; - case SPEEX_SET_SUBMODE_ENCODING: - st->encode_submode = (*(spx_int32_t*)ptr); - speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr); - break; - case SPEEX_GET_SUBMODE_ENCODING: - (*(spx_int32_t*)ptr) = st->encode_submode; - break; - case SPEEX_GET_LOOKAHEAD: - speex_encoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr); - (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr) + QMF_ORDER - 1; - break; - case SPEEX_SET_PLC_TUNING: - speex_encoder_ctl(st->st_low, SPEEX_SET_PLC_TUNING, ptr); - break; - case SPEEX_GET_PLC_TUNING: - speex_encoder_ctl(st->st_low, SPEEX_GET_PLC_TUNING, ptr); - break; -#ifndef DISABLE_VBR - case SPEEX_SET_VBR_MAX_BITRATE: - { - st->vbr_max = (*(spx_int32_t*)ptr); - if (SPEEX_SET_VBR_MAX_BITRATE<1) - { - speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &st->vbr_max); - st->vbr_max_high = 17600; - } else { - spx_int32_t low_rate; - if (st->vbr_max >= 42200) - { - st->vbr_max_high = 17600; - } else if (st->vbr_max >= 27800) - { - st->vbr_max_high = 9600; - } else if (st->vbr_max > 20600) - { - st->vbr_max_high = 5600; - } else { - st->vbr_max_high = 1800; - } - if (st->subframeSize==80) - st->vbr_max_high = 1800; - low_rate = st->vbr_max - st->vbr_max_high; - speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &low_rate); - } - } - break; - case SPEEX_GET_VBR_MAX_BITRATE: - (*(spx_int32_t*)ptr) = st->vbr_max; - break; -#endif /* #ifndef DISABLE_VBR */ - case SPEEX_SET_HIGHPASS: - speex_encoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr); - break; - case SPEEX_GET_HIGHPASS: - speex_encoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr); - break; - - - /* This is all internal stuff past this point */ - case SPEEX_GET_PI_GAIN: - { - int i; - spx_word32_t *g = (spx_word32_t*)ptr; - for (i=0;i<st->nbSubframes;i++) - g[i]=st->pi_gain[i]; - } - break; - case SPEEX_GET_EXC: - { - int i; - for (i=0;i<st->nbSubframes;i++) - ((spx_word16_t*)ptr)[i] = st->exc_rms[i]; - } - break; -#ifndef DISABLE_VBR - case SPEEX_GET_RELATIVE_QUALITY: - (*(float*)ptr)=st->relative_quality; - break; -#endif /* #ifndef DISABLE_VBR */ - case SPEEX_SET_INNOVATION_SAVE: - st->innov_rms_save = (spx_word16_t*)ptr; - break; - case SPEEX_SET_WIDEBAND: - speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr); - break; - case SPEEX_GET_STACK: - *((char**)ptr) = st->stack; - break; - default: - speex_warning_int("Unknown nb_ctl request: ", request); - return -1; - } - return 0; -} - -int sb_decoder_ctl(void *state, int request, void *ptr) -{ - SBDecState *st; - st=(SBDecState*)state; - switch(request) - { - case SPEEX_SET_HIGH_MODE: - st->submodeID = (*(spx_int32_t*)ptr); - break; - case SPEEX_SET_LOW_MODE: - speex_decoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr); - break; - case SPEEX_GET_LOW_MODE: - speex_decoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr); - break; - case SPEEX_GET_FRAME_SIZE: - (*(spx_int32_t*)ptr) = st->full_frame_size; - break; - case SPEEX_SET_ENH: - speex_decoder_ctl(st->st_low, request, ptr); - st->lpc_enh_enabled = *((spx_int32_t*)ptr); - break; - case SPEEX_GET_ENH: - *((spx_int32_t*)ptr) = st->lpc_enh_enabled; - break; - case SPEEX_SET_MODE: - case SPEEX_SET_QUALITY: - { - spx_int32_t nb_qual; - int quality = (*(spx_int32_t*)ptr); - if (quality < 0) - quality = 0; - if (quality > 10) - quality = 10; - st->submodeID = ((const SpeexSBMode*)(st->mode->mode))->quality_map[quality]; - nb_qual = ((const SpeexSBMode*)(st->mode->mode))->low_quality_map[quality]; - speex_decoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual); - } - break; - case SPEEX_GET_BITRATE: - speex_decoder_ctl(st->st_low, request, ptr); - if (st->submodes[st->submodeID]) - (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size; - else - (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size; - break; - case SPEEX_SET_SAMPLING_RATE: - { - spx_int32_t tmp=(*(spx_int32_t*)ptr); - st->sampling_rate = tmp; - tmp>>=1; - speex_decoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp); - } - break; - case SPEEX_GET_SAMPLING_RATE: - (*(spx_int32_t*)ptr)=st->sampling_rate; - break; - case SPEEX_SET_HANDLER: - speex_decoder_ctl(st->st_low, SPEEX_SET_HANDLER, ptr); - break; - case SPEEX_SET_USER_HANDLER: - speex_decoder_ctl(st->st_low, SPEEX_SET_USER_HANDLER, ptr); - break; - case SPEEX_RESET_STATE: - { - int i; - for (i=0;i<2*st->lpcSize;i++) - st->mem_sp[i]=0; - for (i=0;i<QMF_ORDER;i++) - st->g0_mem[i]=st->g1_mem[i]=0; - st->last_ener=0; - } - break; - case SPEEX_SET_SUBMODE_ENCODING: - st->encode_submode = (*(spx_int32_t*)ptr); - speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr); - break; - case SPEEX_GET_SUBMODE_ENCODING: - (*(spx_int32_t*)ptr) = st->encode_submode; - break; - case SPEEX_GET_LOOKAHEAD: - speex_decoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr); - (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr); - break; - case SPEEX_SET_HIGHPASS: - speex_decoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr); - break; - case SPEEX_GET_HIGHPASS: - speex_decoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr); - break; - case SPEEX_GET_ACTIVITY: - speex_decoder_ctl(st->st_low, SPEEX_GET_ACTIVITY, ptr); - break; - case SPEEX_GET_PI_GAIN: - { - int i; - spx_word32_t *g = (spx_word32_t*)ptr; - for (i=0;i<st->nbSubframes;i++) - g[i]=st->pi_gain[i]; - } - break; - case SPEEX_GET_EXC: - { - int i; - for (i=0;i<st->nbSubframes;i++) - ((spx_word16_t*)ptr)[i] = st->exc_rms[i]; - } - break; - case SPEEX_GET_DTX_STATUS: - speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, ptr); - break; - case SPEEX_SET_INNOVATION_SAVE: - st->innov_save = (spx_word16_t*)ptr; - break; - case SPEEX_SET_WIDEBAND: - speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr); - break; - case SPEEX_GET_STACK: - *((char**)ptr) = st->stack; - break; - default: - speex_warning_int("Unknown nb_ctl request: ", request); - return -1; - } - return 0; -} - -#endif - diff --git a/src/lib/dl/ext/speex/sb_celp.h b/src/lib/dl/ext/speex/sb_celp.h deleted file mode 100755 index e8c37612..00000000 --- a/src/lib/dl/ext/speex/sb_celp.h +++ /dev/null @@ -1,155 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin */ -/** - @file sb_celp.h - @brief Sub-band CELP mode used for wideband encoding -*/ -/* - 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 SB_CELP_H -#define SB_CELP_H - -#include "modes.h" -#include <speex/speex_bits.h> -#include "nb_celp.h" - -/**Structure representing the full state of the sub-band encoder*/ -typedef struct SBEncState { - const SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */ - void *st_low; /**< State of the low-band (narrowband) encoder */ - int full_frame_size; /**< Length of full-band frames*/ - int frame_size; /**< Length of high-band frames*/ - int subframeSize; /**< Length of high-band sub-frames*/ - int nbSubframes; /**< Number of high-band sub-frames*/ - int windowSize; /**< Length of high-band LPC window*/ - int lpcSize; /**< Order of high-band LPC analysis */ - int first; /**< First frame? */ - spx_word16_t lpc_floor; /**< Controls LPC analysis noise floor */ - spx_word16_t gamma1; /**< Perceptual weighting coef 1 */ - spx_word16_t gamma2; /**< Perceptual weighting coef 2 */ - - char *stack; /**< Temporary allocation stack */ - spx_word16_t *high; /**< High-band signal (buffer) */ - spx_word16_t *h0_mem, *h1_mem; - - const spx_word16_t *window; /**< LPC analysis window */ - const spx_word16_t *lagWindow; /**< Auto-correlation window */ - spx_lsp_t *old_lsp; /**< LSPs of previous frame */ - spx_lsp_t *old_qlsp; /**< Quantized LSPs of previous frame */ - spx_coef_t *interp_qlpc; /**< Interpolated quantized LPCs for current sub-frame */ - - spx_mem_t *mem_sp; /**< Synthesis signal memory */ - spx_mem_t *mem_sp2; - spx_mem_t *mem_sw; /**< Perceptual signal memory */ - spx_word32_t *pi_gain; - spx_word16_t *exc_rms; - spx_word16_t *innov_rms_save; /**< If non-NULL, innovation is copied here */ - -#ifndef DISABLE_VBR - float vbr_quality; /**< Quality setting for VBR encoding */ - int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */ - spx_int32_t vbr_max; /**< Max bit-rate allowed in VBR mode (total) */ - spx_int32_t vbr_max_high; /**< Max bit-rate allowed in VBR mode for the high-band */ - spx_int32_t abr_enabled; /**< ABR setting (in bps), 0 if off */ - float abr_drift; - float abr_drift2; - float abr_count; - int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */ - float relative_quality; -#endif /* #ifndef DISABLE_VBR */ - - int encode_submode; - const SpeexSubmode * const *submodes; - int submodeID; - int submodeSelect; - int complexity; - spx_int32_t sampling_rate; - -} SBEncState; - - -/**Structure representing the full state of the sub-band decoder*/ -typedef struct SBDecState { - const SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */ - void *st_low; /**< State of the low-band (narrowband) encoder */ - int full_frame_size; - int frame_size; - int subframeSize; - int nbSubframes; - int lpcSize; - int first; - spx_int32_t sampling_rate; - int lpc_enh_enabled; - - char *stack; - spx_word16_t *g0_mem, *g1_mem; - - spx_word16_t *excBuf; - spx_lsp_t *old_qlsp; - spx_coef_t *interp_qlpc; - - spx_mem_t *mem_sp; - spx_word32_t *pi_gain; - spx_word16_t *exc_rms; - spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */ - - spx_word16_t last_ener; - spx_int32_t seed; - - int encode_submode; - const SpeexSubmode * const *submodes; - int submodeID; -} SBDecState; - - -/**Initializes encoder state*/ -void *sb_encoder_init(const SpeexMode *m); - -/**De-allocates encoder state resources*/ -void sb_encoder_destroy(void *state); - -/**Encodes one frame*/ -int sb_encode(void *state, void *in, SpeexBits *bits); - - -/**Initializes decoder state*/ -void *sb_decoder_init(const SpeexMode *m); - -/**De-allocates decoder state resources*/ -void sb_decoder_destroy(void *state); - -/**Decodes one frame*/ -int sb_decode(void *state, SpeexBits *bits, void *out); - -int sb_encoder_ctl(void *state, int request, void *ptr); - -int sb_decoder_ctl(void *state, int request, void *ptr); - -#endif diff --git a/src/lib/dl/ext/speex/scal.c b/src/lib/dl/ext/speex/scal.c deleted file mode 100755 index d11c5f80..00000000 --- a/src/lib/dl/ext/speex/scal.c +++ /dev/null @@ -1,293 +0,0 @@ -/* Copyright (C) 2006-2008 CSIRO, Jean-Marc Valin, Xiph.Org Foundation - - File: scal.c - Shaped comb-allpass filter for channel decorrelation - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -*/ - -/* -The algorithm implemented here is described in: - -* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For - Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on - Hands­free Speech Communication and Microphone Arrays (HSCMA), 2008. - http://people.xiph.org/~jm/papers/valin_hscma2008.pdf - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "speex/speex_echo.h" -#include "vorbis_psy.h" -#include "arch.h" -#include "os_support.h" -#include "smallft.h" -#include <math.h> -#include <stdlib.h> - -#ifndef M_PI -#define M_PI 3.14159261 -#endif - -#define ALLPASS_ORDER 20 - -struct SpeexDecorrState_ { - int rate; - int channels; - int frame_size; -#ifdef VORBIS_PSYCHO - VorbisPsy *psy; - struct drft_lookup lookup; - float *wola_mem; - float *curve; -#endif - float *vorbis_win; - int seed; - float *y; - - /* Per-channel stuff */ - float *buff; - float (*ring)[ALLPASS_ORDER]; - int *ringID; - int *order; - float *alpha; -}; - - - -EXPORT SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size) -{ - int i, ch; - SpeexDecorrState *st = speex_alloc(sizeof(SpeexDecorrState)); - st->rate = rate; - st->channels = channels; - st->frame_size = frame_size; -#ifdef VORBIS_PSYCHO - st->psy = vorbis_psy_init(rate, 2*frame_size); - spx_drft_init(&st->lookup, 2*frame_size); - st->wola_mem = speex_alloc(frame_size*sizeof(float)); - st->curve = speex_alloc(frame_size*sizeof(float)); -#endif - st->y = speex_alloc(frame_size*sizeof(float)); - - st->buff = speex_alloc(channels*2*frame_size*sizeof(float)); - st->ringID = speex_alloc(channels*sizeof(int)); - st->order = speex_alloc(channels*sizeof(int)); - st->alpha = speex_alloc(channels*sizeof(float)); - st->ring = speex_alloc(channels*ALLPASS_ORDER*sizeof(float)); - - /*FIXME: The +20 is there only as a kludge for ALL_PASS_OLA*/ - st->vorbis_win = speex_alloc((2*frame_size+20)*sizeof(float)); - for (i=0;i<2*frame_size;i++) - st->vorbis_win[i] = sin(.5*M_PI* sin(M_PI*i/(2*frame_size))*sin(M_PI*i/(2*frame_size)) ); - st->seed = rand(); - - for (ch=0;ch<channels;ch++) - { - for (i=0;i<ALLPASS_ORDER;i++) - st->ring[ch][i] = 0; - st->ringID[ch] = 0; - st->alpha[ch] = 0; - st->order[ch] = 10; - } - return st; -} - -static float uni_rand(int *seed) -{ - const unsigned int jflone = 0x3f800000; - const unsigned int jflmsk = 0x007fffff; - union {int i; float f;} ran; - *seed = 1664525 * *seed + 1013904223; - ran.i = jflone | (jflmsk & *seed); - ran.f -= 1.5; - return 2*ran.f; -} - -static unsigned int irand(int *seed) -{ - *seed = 1664525 * *seed + 1013904223; - return ((unsigned int)*seed)>>16; -} - - -EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength) -{ - int ch; - float amount; - - if (strength<0) - strength = 0; - if (strength>100) - strength = 100; - - amount = .01*strength; - for (ch=0;ch<st->channels;ch++) - { - int i; - int N=2*st->frame_size; - float beta, beta2; - float *x; - float max_alpha = 0; - - float *buff; - float *ring; - int ringID; - int order; - float alpha; - - buff = st->buff+ch*2*st->frame_size; - ring = st->ring[ch]; - ringID = st->ringID[ch]; - order = st->order[ch]; - alpha = st->alpha[ch]; - - for (i=0;i<st->frame_size;i++) - buff[i] = buff[i+st->frame_size]; - for (i=0;i<st->frame_size;i++) - buff[i+st->frame_size] = in[i*st->channels+ch]; - - x = buff+st->frame_size; - beta = 1.-.3*amount*amount; - if (amount>1) - beta = 1-sqrt(.4*amount); - else - beta = 1-0.63246*amount; - if (beta<0) - beta = 0; - - beta2 = beta; - for (i=0;i<st->frame_size;i++) - { - st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order] - + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i] - - alpha*(ring[ringID] - - beta*ring[ringID+1>=order?0:ringID+1]); - ring[ringID++]=st->y[i]; - st->y[i] *= st->vorbis_win[st->frame_size+i]; - if (ringID>=order) - ringID=0; - } - order = order+(irand(&st->seed)%3)-1; - if (order < 5) - order = 5; - if (order > 10) - order = 10; - /*order = 5+(irand(&st->seed)%6);*/ - max_alpha = pow(.96+.04*(amount-1),order); - if (max_alpha > .98/(1.+beta2)) - max_alpha = .98/(1.+beta2); - - alpha = alpha + .4*uni_rand(&st->seed); - if (alpha > max_alpha) - alpha = max_alpha; - if (alpha < -max_alpha) - alpha = -max_alpha; - for (i=0;i<ALLPASS_ORDER;i++) - ring[i] = 0; - ringID = 0; - for (i=0;i<st->frame_size;i++) - { - float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order] - + x[i-ALLPASS_ORDER]*st->vorbis_win[i] - - alpha*(ring[ringID] - - beta*ring[ringID+1>=order?0:ringID+1]); - ring[ringID++]=tmp; - tmp *= st->vorbis_win[i]; - if (ringID>=order) - ringID=0; - st->y[i] += tmp; - } - -#ifdef VORBIS_PSYCHO - float frame[N]; - float scale = 1./N; - for (i=0;i<2*st->frame_size;i++) - frame[i] = buff[i]; - //float coef = .5*0.78130; - float coef = M_PI*0.075063 * 0.93763 * amount * .8 * 0.707; - compute_curve(st->psy, buff, st->curve); - for (i=1;i<st->frame_size;i++) - { - float x1,x2; - float gain; - do { - x1 = uni_rand(&st->seed); - x2 = uni_rand(&st->seed); - } while (x1*x1+x2*x2 > 1.); - gain = coef*sqrt(.1+st->curve[i]); - frame[2*i-1] = gain*x1; - frame[2*i] = gain*x2; - } - frame[0] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[0]); - frame[2*st->frame_size-1] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[st->frame_size-1]); - spx_drft_backward(&st->lookup,frame); - for (i=0;i<2*st->frame_size;i++) - frame[i] *= st->vorbis_win[i]; -#endif - - for (i=0;i<st->frame_size;i++) - { -#ifdef VORBIS_PSYCHO - float tmp = st->y[i] + frame[i] + st->wola_mem[i]; - st->wola_mem[i] = frame[i+st->frame_size]; -#else - float tmp = st->y[i]; -#endif - if (tmp>32767) - tmp = 32767; - if (tmp < -32767) - tmp = -32767; - out[i*st->channels+ch] = tmp; - } - - st->ringID[ch] = ringID; - st->order[ch] = order; - st->alpha[ch] = alpha; - - } -} - -EXPORT void speex_decorrelate_destroy(SpeexDecorrState *st) -{ -#ifdef VORBIS_PSYCHO - vorbis_psy_destroy(st->psy); - speex_free(st->wola_mem); - speex_free(st->curve); -#endif - speex_free(st->buff); - speex_free(st->ring); - speex_free(st->ringID); - speex_free(st->alpha); - speex_free(st->vorbis_win); - speex_free(st->order); - speex_free(st->y); - speex_free(st); -} diff --git a/src/lib/dl/ext/speex/skeleton.c b/src/lib/dl/ext/speex/skeleton.c deleted file mode 100755 index 157becef..00000000 --- a/src/lib/dl/ext/speex/skeleton.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * skeleton.c - * author: Tahseen Mohammad - */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -#include <ext/libogg/ogg.h> - -#include "skeleton.h" - -/* write an ogg_page to a file pointer */ -int write_ogg_page_to_file(ogg_page *og, FILE *out) { - int written; - - written = fwrite(og->header,1, og->header_len, out); - written += fwrite(og->body,1, og->body_len, out); - - return written; -} - -int add_message_header_field(fisbone_packet *fp, - char *header_key, - char *header_value) { - - /* size of both key and value + ': ' + CRLF */ - int this_message_size = strlen(header_key) + strlen(header_value) + 4; - if (fp->message_header_fields == NULL) { - fp->message_header_fields = _ogg_calloc(this_message_size, sizeof(char)); - } else { - int new_size = (fp->current_header_size + this_message_size) * sizeof(char); - fp->message_header_fields = _ogg_realloc(fp->message_header_fields, new_size); - } - snprintf(fp->message_header_fields + fp->current_header_size, - this_message_size+1, - "%s: %s\r\n", - header_key, - header_value); - fp->current_header_size += this_message_size; - - return 0; -} - -/* create a ogg_packet from a fishead_packet structure */ -ogg_packet ogg_from_fishead(fishead_packet *fp) { - - ogg_packet op; - - memset(&op, 0, sizeof(op)); - op.packet = _ogg_calloc(FISHEAD_SIZE, sizeof(unsigned char)); - memset(op.packet, 0, FISHEAD_SIZE); - - memcpy (op.packet, FISHEAD_IDENTIFIER, 8); /* identifier */ - *((ogg_uint16_t*)(op.packet+8)) = SKELETON_VERSION_MAJOR; /* version major */ - *((ogg_uint16_t*)(op.packet+10)) = SKELETON_VERSION_MINOR; /* version minor */ - *((ogg_int64_t*)(op.packet+12)) = (ogg_int64_t)fp->ptime_n; /* presentationtime numerator */ - *((ogg_int64_t*)(op.packet+20)) = (ogg_int64_t)fp->ptime_d; /* presentationtime denominator */ - *((ogg_int64_t*)(op.packet+28)) = (ogg_int64_t)fp->btime_n; /* basetime numerator */ - *((ogg_int64_t*)(op.packet+36)) = (ogg_int64_t)fp->btime_d; /* basetime denominator */ - /* TODO: UTC time, set to zero for now */ - - op.b_o_s = 1; /* its the first packet of the stream */ - op.e_o_s = 0; /* its not the last packet of the stream */ - op.bytes = FISHEAD_SIZE; /* length of the packet in bytes */ - - return op; -} - -/* create a ogg_packet from a fisbone_packet structure. - * call this method after the fisbone_packet is filled and all message header fields are added - * by calling add_message_header_field method. - */ -ogg_packet ogg_from_fisbone(fisbone_packet *fp) { - - ogg_packet op; - int packet_size = FISBONE_SIZE + fp->current_header_size; - - memset (&op, 0, sizeof (op)); - op.packet = _ogg_calloc (packet_size, sizeof(unsigned char)); - memset (op.packet, 0, packet_size); - memcpy (op.packet, FISBONE_IDENTIFIER, 8); /* identifier */ - *((ogg_uint32_t*)(op.packet+8)) = FISBONE_MESSAGE_HEADER_OFFSET; /* offset of the message header fields */ - *((ogg_uint32_t*)(op.packet+12)) = fp->serial_no; /* serialno of the respective stream */ - *((ogg_uint32_t*)(op.packet+16)) = fp->nr_header_packet; /* number of header packets */ - *((ogg_int64_t*)(op.packet+20)) = fp->granule_rate_n; /* granulrate numerator */ - *((ogg_int64_t*)(op.packet+28)) = fp->granule_rate_d; /* granulrate denominator */ - *((ogg_int64_t*)(op.packet+36)) = fp->start_granule; /* start granule */ - *((ogg_uint32_t*)(op.packet+44)) = fp->preroll; /* preroll, for theora its 0 */ - *(op.packet+48) = fp->granule_shift; /* granule shift */ - memcpy((op.packet+FISBONE_SIZE), fp->message_header_fields, fp->current_header_size); - - op.b_o_s = 0; - op.e_o_s = 0; - op.bytes = packet_size; /* size of the packet in bytes */ - - return op; -} - -/* fills up a fishead_packet from a fishead ogg_packet of a skeleton bistream */ -fishead_packet fishead_from_ogg(ogg_packet *op) { - - fishead_packet fp; - - if (memcmp(op->packet, FISHEAD_IDENTIFIER, 8)) - ; /* invalid packet what do we do? */ - - fp.version_major = *((ogg_uint16_t*)(op->packet+8)); /* version major */ - fp.version_minor = *((ogg_uint16_t*)(op->packet+10)); /* version minor */ - fp.ptime_n = *((ogg_int64_t*)(op->packet+12)); /* presentationtime numerator */ - fp.ptime_d = *((ogg_int64_t*)(op->packet+20)); /* presentationtime denominator */ - fp.btime_n = *((ogg_int64_t*)(op->packet+28)); /* basetime numerator */ - fp.btime_d = *((ogg_int64_t*)(op->packet+36)); /* basetime denominator */ - memcpy(fp.UTC, op->packet+44, 20); - - return fp; -} - -/* fills up a fisbone_packet from a fisbone ogg_packet of a skeleton bitstream */ -fisbone_packet fisbone_from_ogg(ogg_packet *op) { - - fisbone_packet fp; - - if (memcmp(op->packet, FISBONE_IDENTIFIER, 8)) - ; /* invalid value, what do we do? */ - fp.serial_no = *((ogg_uint32_t*)(op->packet+12)); /* serialno of the stream represented by this fisbone packet */ - fp.nr_header_packet = *((ogg_uint32_t*)(op->packet+16)); /* number of header packets */ - fp.granule_rate_n = *((ogg_int64_t*)(op->packet+20)); /* granulrate numerator */ - fp.granule_rate_d = *((ogg_int64_t*)(op->packet+28)); /* granulrate denominator */ - fp.start_granule = *((ogg_int64_t*)(op->packet+36)); /* start granule */ - fp.preroll = *((ogg_uint32_t*)(op->packet+44)); /* preroll, for theora its 0 */ - fp.granule_shift = *(op->packet+48); /* granule shift */ - fp.current_header_size = op->bytes - FISBONE_SIZE; - fp.message_header_fields = _ogg_calloc(fp.current_header_size+1, sizeof(char)); - memcpy(fp.message_header_fields, op->packet+FISBONE_SIZE, fp.current_header_size); - - return fp; -} - -int add_fishead_to_stream(ogg_stream_state *os, fishead_packet *fp) { - - ogg_packet op; - - op = ogg_from_fishead(fp); - ogg_stream_packetin(os, &op); - _ogg_free(op.packet); - - return 0; -} - -int add_fisbone_to_stream(ogg_stream_state *os, fisbone_packet *fp) { - - ogg_packet op; - - op = ogg_from_fisbone(fp); - ogg_stream_packetin(os, &op); - _ogg_free(op.packet); - - return 0; -} - -int add_eos_packet_to_stream(ogg_stream_state *os) { - - ogg_packet op; - - memset (&op, 0, sizeof(op)); - op.e_o_s = 1; - ogg_stream_packetin(os, &op); - - return 0; -} - -int flush_ogg_stream_to_file(ogg_stream_state *os, FILE *out) { - - ogg_page og; - int result; - - while((result = ogg_stream_flush(os, &og))) - { - if(!result) break; - result = write_ogg_page_to_file(&og, out); - if(result != og.header_len + og.body_len) - return 1; - } - - return 0; -} diff --git a/src/lib/dl/ext/speex/skeleton.h b/src/lib/dl/ext/speex/skeleton.h deleted file mode 100755 index 50eadcde..00000000 --- a/src/lib/dl/ext/speex/skeleton.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * skeleton.h - * author: Tahseen Mohammad - */ - -#ifndef _SKELETON_H -#define _SKELETON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef WIN32 -#define snprintf _snprintf -#endif - -#include <ext/libogg/ogg.h> - -#define SKELETON_VERSION_MAJOR 3 -#define SKELETON_VERSION_MINOR 0 -#define FISHEAD_IDENTIFIER "fishead\0" -#define FISBONE_IDENTIFIER "fisbone\0" -#define FISHEAD_SIZE 64 -#define FISBONE_SIZE 52 -#define FISBONE_MESSAGE_HEADER_OFFSET 44 - -/* fishead_packet holds a fishead header packet. */ -typedef struct { - ogg_uint16_t version_major; /* skeleton version major */ - ogg_uint16_t version_minor; /* skeleton version minor */ - /* Start time of the presentation - * For a new stream presentationtime & basetime is same. */ - ogg_int64_t ptime_n; /* presentation time numerator */ - ogg_int64_t ptime_d; /* presentation time denominator */ - ogg_int64_t btime_n; /* basetime numerator */ - ogg_int64_t btime_d; /* basetime denominator */ - /* will holds the time of origin of the stream, a 20 bit field. */ - unsigned char UTC[20]; -} fishead_packet; - -/* fisbone_packet holds a fisbone header packet. */ -typedef struct { - ogg_uint32_t serial_no; /* serial no of the corresponding stream */ - ogg_uint32_t nr_header_packet; /* number of header packets */ - /* granule rate is the temporal resolution of the logical bitstream */ - ogg_int64_t granule_rate_n; /* granule rate numerator */ - ogg_int64_t granule_rate_d; /* granule rate denominator */ - ogg_int64_t start_granule; /* start granule value */ - ogg_uint32_t preroll; /* preroll */ - unsigned char granule_shift; /* 1 byte value holding the granule shift */ - char *message_header_fields; /* holds all the message header fields */ - /* current total size of the message header fields, for realloc purpose, initially zero */ - ogg_uint32_t current_header_size; -} fisbone_packet; - -extern int write_ogg_page_to_file(ogg_page *og, FILE *out); -extern int add_message_header_field(fisbone_packet *fp, char *header_key, char *header_value); -/* remember to deallocate the returned ogg_packet properly */ -extern ogg_packet ogg_from_fishead(fishead_packet *fp); -extern ogg_packet ogg_from_fisbone(fisbone_packet *fp); -extern fishead_packet fishead_from_ogg(ogg_packet *op); -extern fisbone_packet fisbone_from_ogg(ogg_packet *op); -extern int add_fishead_to_stream(ogg_stream_state *os, fishead_packet *fp); -extern int add_fisbone_to_stream(ogg_stream_state *os, fisbone_packet *fp); -extern int add_eos_packet_to_stream(ogg_stream_state *os); -extern int flush_ogg_stream_to_file(ogg_stream_state *os, FILE *out); - -#ifdef __cplusplus -} -#endif - -#endif /* _SKELETON_H */ - - - - - - diff --git a/src/lib/dl/ext/speex/smallft.c b/src/lib/dl/ext/speex/smallft.c deleted file mode 100755 index 5c26d016..00000000 --- a/src/lib/dl/ext/speex/smallft.c +++ /dev/null @@ -1,1261 +0,0 @@ -/******************************************************************** - * * - * 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: *unnormalized* fft transform - last mod: $Id: smallft.c,v 1.19 2003/10/08 05:12:37 jm Exp $ - - ********************************************************************/ - -/* 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 - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include "smallft.h" -#include "arch.h" -#include "os_support.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<nf;i++){ - ib=nf-i+1; - ifac[ib+1]=ifac[ib]; - } - ifac[2] = 2; - - L107: - if(nl!=1)goto L104; - ifac[0]=n; - ifac[1]=nf; - argh=tpi/n; - is=0; - nfm1=nf-1; - l1=1; - - if(nfm1==0)return; - - for (k1=0;k1<nfm1;k1++){ - ip=ifac[k1+2]; - ld=0; - l2=l1*ip; - ido=n/l2; - ipm=ip-1; - - for (j=0;j<ipm;j++){ - ld+=l1; - i=is; - argld=(float)ld*argh; - fi=0.f; - for (ii=2;ii<ido;ii+=2){ - fi+=1.f; - arg=fi*argld; - wa[i++]=cos(arg); - wa[i++]=sin(arg); - } - is+=ido; - } - l1=l2; - } -} - -static void fdrffti(int n, float *wsave, int *ifac){ - - if (n == 1) return; - drfti1(n, wsave+n, ifac); -} - -static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){ - int i,k; - float ti2,tr2; - int t0,t1,t2,t3,t4,t5,t6; - - t1=0; - t0=(t2=l1*ido); - t3=ido<<1; - for(k=0;k<l1;k++){ - ch[t1<<1]=cc[t1]+cc[t2]; - ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; - t1+=ido; - t2+=ido; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - t2=t0; - for(k=0;k<l1;k++){ - t3=t2; - t4=(t1<<1)+(ido<<1); - t5=t1; - t6=t1+t1; - for(i=2;i<ido;i+=2){ - t3+=2; - t4-=2; - t5+=2; - t6+=2; - tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; - ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; - ch[t6]=cc[t5]+ti2; - ch[t4]=ti2-cc[t5]; - ch[t6-1]=cc[t5-1]+tr2; - ch[t4-1]=cc[t5-1]-tr2; - } - t1+=ido; - t2+=ido; - } - - if(ido%2==1)return; - - L105: - t3=(t2=(t1=ido)-1); - t2+=t0; - for(k=0;k<l1;k++){ - ch[t1]=-cc[t2]; - ch[t1-1]=cc[t3]; - t1+=ido<<1; - t2+=ido; - t3+=ido; - } -} - -static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2,float *wa3){ - static float hsqt2 = .70710678118654752f; - int i,k,t0,t1,t2,t3,t4,t5,t6; - float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; - t0=l1*ido; - - t1=t0; - t4=t1<<1; - t2=t1+(t1<<1); - t3=0; - - for(k=0;k<l1;k++){ - tr1=cc[t1]+cc[t2]; - tr2=cc[t3]+cc[t4]; - - ch[t5=t3<<2]=tr1+tr2; - ch[(ido<<2)+t5-1]=tr2-tr1; - ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4]; - ch[t5]=cc[t2]-cc[t1]; - - t1+=ido; - t2+=ido; - t3+=ido; - t4+=ido; - } - - if(ido<2)return; - if(ido==2)goto L105; - - - t1=0; - for(k=0;k<l1;k++){ - t2=t1; - t4=t1<<2; - t5=(t6=ido<<1)+t4; - for(i=2;i<ido;i+=2){ - t3=(t2+=2); - t4+=2; - t5-=2; - - t3+=t0; - cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; - ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; - t3+=t0; - cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3]; - ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1]; - t3+=t0; - cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3]; - ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1]; - - tr1=cr2+cr4; - tr4=cr4-cr2; - ti1=ci2+ci4; - ti4=ci2-ci4; - - ti2=cc[t2]+ci3; - ti3=cc[t2]-ci3; - tr2=cc[t2-1]+cr3; - tr3=cc[t2-1]-cr3; - - ch[t4-1]=tr1+tr2; - ch[t4]=ti1+ti2; - - ch[t5-1]=tr3-ti4; - ch[t5]=tr4-ti3; - - ch[t4+t6-1]=ti4+tr3; - ch[t4+t6]=tr4+ti3; - - ch[t5+t6-1]=tr2-tr1; - ch[t5+t6]=ti1-ti2; - } - t1+=ido; - } - if(ido&1)return; - - L105: - - t2=(t1=t0+ido-1)+(t0<<1); - t3=ido<<2; - t4=ido; - t5=ido<<1; - t6=ido; - - for(k=0;k<l1;k++){ - ti1=-hsqt2*(cc[t1]+cc[t2]); - tr1=hsqt2*(cc[t1]-cc[t2]); - - ch[t4-1]=tr1+cc[t6-1]; - ch[t4+t5-1]=cc[t6-1]-tr1; - - ch[t4]=ti1-cc[t1+t0]; - ch[t4+t5]=ti1+cc[t1+t0]; - - t1+=ido; - t2+=ido; - t4+=t3; - t6+=ido; - } -} - -static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1, - float *c2,float *ch,float *ch2,float *wa){ - - static float tpi=6.283185307179586f; - int idij,ipph,i,j,k,l,ic,ik,is; - int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; - float dc2,ai1,ai2,ar1,ar2,ds2; - int nbd; - float dcp,arg,dsp,ar1h,ar2h; - int idp2,ipp2; - - arg=tpi/(float)ip; - dcp=cos(arg); - dsp=sin(arg); - ipph=(ip+1)>>1; - ipp2=ip; - idp2=ido; - nbd=(ido-1)>>1; - t0=l1*ido; - t10=ip*ido; - - if(ido==1)goto L119; - for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik]; - - t1=0; - for(j=1;j<ip;j++){ - t1+=t0; - t2=t1; - for(k=0;k<l1;k++){ - ch[t2]=c1[t2]; - t2+=ido; - } - } - - is=-ido; - t1=0; - if(nbd>l1){ - for(j=1;j<ip;j++){ - t1+=t0; - is+=ido; - t2= -ido+t1; - for(k=0;k<l1;k++){ - idij=is-1; - t2+=ido; - t3=t2; - for(i=2;i<ido;i+=2){ - idij+=2; - t3+=2; - ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; - ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; - } - } - } - }else{ - - for(j=1;j<ip;j++){ - is+=ido; - idij=is-1; - t1+=t0; - t2=t1; - for(i=2;i<ido;i+=2){ - idij+=2; - t2+=2; - t3=t2; - for(k=0;k<l1;k++){ - ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; - ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; - t3+=ido; - } - } - } - } - - t1=0; - t2=ipp2*t0; - if(nbd<l1){ - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5=t3-ido; - t6=t4-ido; - for(k=0;k<l1;k++){ - t5+=ido; - t6+=ido; - c1[t5-1]=ch[t5-1]+ch[t6-1]; - c1[t6-1]=ch[t5]-ch[t6]; - c1[t5]=ch[t5]+ch[t6]; - c1[t6]=ch[t6-1]-ch[t5-1]; - } - } - } - }else{ - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - c1[t5-1]=ch[t5-1]+ch[t6-1]; - c1[t6-1]=ch[t5]-ch[t6]; - c1[t5]=ch[t5]+ch[t6]; - c1[t6]=ch[t6-1]-ch[t5-1]; - } - t3+=ido; - t4+=ido; - } - } - } - -L119: - for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; - - t1=0; - t2=ipp2*idl1; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1-ido; - t4=t2-ido; - for(k=0;k<l1;k++){ - t3+=ido; - t4+=ido; - c1[t3]=ch[t3]+ch[t4]; - c1[t4]=ch[t4]-ch[t3]; - } - } - - ar1=1.f; - ai1=0.f; - t1=0; - t2=ipp2*idl1; - t3=(ip-1)*idl1; - for(l=1;l<ipph;l++){ - t1+=idl1; - t2-=idl1; - ar1h=dcp*ar1-dsp*ai1; - ai1=dcp*ai1+dsp*ar1; - ar1=ar1h; - t4=t1; - t5=t2; - t6=t3; - t7=idl1; - - for(ik=0;ik<idl1;ik++){ - ch2[t4++]=c2[ik]+ar1*c2[t7++]; - ch2[t5++]=ai1*c2[t6++]; - } - - dc2=ar1; - ds2=ai1; - ar2=ar1; - ai2=ai1; - - t4=idl1; - t5=(ipp2-1)*idl1; - for(j=2;j<ipph;j++){ - t4+=idl1; - t5-=idl1; - - ar2h=dc2*ar2-ds2*ai2; - ai2=dc2*ai2+ds2*ar2; - ar2=ar2h; - - t6=t1; - t7=t2; - t8=t4; - t9=t5; - for(ik=0;ik<idl1;ik++){ - ch2[t6++]+=ar2*c2[t8++]; - ch2[t7++]+=ai2*c2[t9++]; - } - } - } - - t1=0; - for(j=1;j<ipph;j++){ - t1+=idl1; - t2=t1; - for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++]; - } - - if(ido<l1)goto L132; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t4=t2; - for(i=0;i<ido;i++)cc[t4++]=ch[t3++]; - t1+=ido; - t2+=t10; - } - - goto L135; - - L132: - for(i=0;i<ido;i++){ - t1=i; - t2=i; - for(k=0;k<l1;k++){ - cc[t2]=ch[t1]; - t1+=ido; - t2+=t10; - } - } - - L135: - t1=0; - t2=ido<<1; - t3=0; - t4=ipp2*t0; - for(j=1;j<ipph;j++){ - - t1+=t2; - t3+=t0; - t4-=t0; - - t5=t1; - t6=t3; - t7=t4; - - for(k=0;k<l1;k++){ - cc[t5-1]=ch[t6]; - cc[t5]=ch[t7]; - t5+=t10; - t6+=ido; - t7+=ido; - } - } - - if(ido==1)return; - if(nbd<l1)goto L141; - - t1=-ido; - t3=0; - t4=0; - t5=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t2; - t3+=t2; - t4+=t0; - t5-=t0; - t6=t1; - t7=t3; - t8=t4; - t9=t5; - for(k=0;k<l1;k++){ - for(i=2;i<ido;i+=2){ - ic=idp2-i; - cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1]; - cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1]; - cc[i+t7]=ch[i+t8]+ch[i+t9]; - cc[ic+t6]=ch[i+t9]-ch[i+t8]; - } - t6+=t10; - t7+=t10; - t8+=ido; - t9+=ido; - } - } - return; - - L141: - - t1=-ido; - t3=0; - t4=0; - t5=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t2; - t3+=t2; - t4+=t0; - t5-=t0; - for(i=2;i<ido;i+=2){ - t6=idp2+t1-i; - t7=i+t3; - t8=i+t4; - t9=i+t5; - for(k=0;k<l1;k++){ - cc[t7-1]=ch[t8-1]+ch[t9-1]; - cc[t6-1]=ch[t8-1]-ch[t9-1]; - cc[t7]=ch[t8]+ch[t9]; - cc[t6]=ch[t9]-ch[t8]; - t6+=t10; - t7+=t10; - t8+=ido; - t9+=ido; - } - } - } -} - -static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){ - int i,k1,l1,l2; - int na,kh,nf; - int ip,iw,ido,idl1,ix2,ix3; - - nf=ifac[1]; - na=1; - l2=n; - iw=n; - - for(k1=0;k1<nf;k1++){ - kh=nf-k1; - ip=ifac[kh+1]; - l1=l2/ip; - ido=n/l2; - idl1=ido*l1; - iw-=(ip-1)*ido; - na=1-na; - - if(ip!=4)goto L102; - - ix2=iw+ido; - ix3=ix2+ido; - if(na!=0) - dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); - else - dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); - goto L110; - - L102: - if(ip!=2)goto L104; - if(na!=0)goto L103; - - dradf2(ido,l1,c,ch,wa+iw-1); - goto L110; - - L103: - dradf2(ido,l1,ch,c,wa+iw-1); - goto L110; - - L104: - if(ido==1)na=1-na; - if(na!=0)goto L109; - - dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); - na=1; - goto L110; - - L109: - dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); - na=0; - - L110: - l2=l1; - } - - if(na==1)return; - - for(i=0;i<n;i++)c[i]=ch[i]; -} - -static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){ - int i,k,t0,t1,t2,t3,t4,t5,t6; - float ti2,tr2; - - t0=l1*ido; - - t1=0; - t2=0; - t3=(ido<<1)-1; - for(k=0;k<l1;k++){ - ch[t1]=cc[t2]+cc[t3+t2]; - ch[t1+t0]=cc[t2]-cc[t3+t2]; - t2=(t1+=ido)<<1; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t5=(t4=t2)+(ido<<1); - t6=t0+t1; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5-=2; - t6+=2; - ch[t3-1]=cc[t4-1]+cc[t5-1]; - tr2=cc[t4-1]-cc[t5-1]; - ch[t3]=cc[t4]-cc[t5]; - ti2=cc[t4]+cc[t5]; - ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2; - ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2; - } - t2=(t1+=ido)<<1; - } - - if(ido%2==1)return; - -L105: - t1=ido-1; - t2=ido-1; - for(k=0;k<l1;k++){ - ch[t1]=cc[t2]+cc[t2]; - ch[t1+t0]=-(cc[t2+1]+cc[t2+1]); - t1+=ido; - t2+=ido<<1; - } -} - -static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2){ - static float taur = -.5f; - static float taui = .8660254037844386f; - int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; - float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2; - t0=l1*ido; - - t1=0; - t2=t0<<1; - t3=ido<<1; - t4=ido+(ido<<1); - t5=0; - for(k=0;k<l1;k++){ - tr2=cc[t3-1]+cc[t3-1]; - cr2=cc[t5]+(taur*tr2); - ch[t1]=cc[t5]+tr2; - ci3=taui*(cc[t3]+cc[t3]); - ch[t1+t0]=cr2-ci3; - ch[t1+t2]=cr2+ci3; - t1+=ido; - t3+=t4; - t5+=t4; - } - - if(ido==1)return; - - t1=0; - t3=ido<<1; - for(k=0;k<l1;k++){ - t7=t1+(t1<<1); - t6=(t5=t7+t3); - t8=t1; - t10=(t9=t1+t0)+t0; - - for(i=2;i<ido;i+=2){ - t5+=2; - t6-=2; - t7+=2; - t8+=2; - t9+=2; - t10+=2; - tr2=cc[t5-1]+cc[t6-1]; - cr2=cc[t7-1]+(taur*tr2); - ch[t8-1]=cc[t7-1]+tr2; - ti2=cc[t5]-cc[t6]; - ci2=cc[t7]+(taur*ti2); - ch[t8]=cc[t7]+ti2; - cr3=taui*(cc[t5-1]-cc[t6-1]); - ci3=taui*(cc[t5]+cc[t6]); - dr2=cr2-ci3; - dr3=cr2+ci3; - di2=ci2+cr3; - di3=ci2-cr3; - ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2; - ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2; - ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3; - ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3; - } - t1+=ido; - } -} - -static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2,float *wa3){ - static float sqrt2=1.414213562373095f; - int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; - float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; - t0=l1*ido; - - t1=0; - t2=ido<<2; - t3=0; - t6=ido<<1; - for(k=0;k<l1;k++){ - t4=t3+t6; - t5=t1; - tr3=cc[t4-1]+cc[t4-1]; - tr4=cc[t4]+cc[t4]; - tr1=cc[t3]-cc[(t4+=t6)-1]; - tr2=cc[t3]+cc[t4-1]; - ch[t5]=tr2+tr3; - ch[t5+=t0]=tr1-tr4; - ch[t5+=t0]=tr2-tr3; - ch[t5+=t0]=tr1+tr4; - t1+=ido; - t3+=t2; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - for(k=0;k<l1;k++){ - t5=(t4=(t3=(t2=t1<<2)+t6))+t6; - t7=t1; - for(i=2;i<ido;i+=2){ - t2+=2; - t3+=2; - t4-=2; - t5-=2; - t7+=2; - ti1=cc[t2]+cc[t5]; - ti2=cc[t2]-cc[t5]; - ti3=cc[t3]-cc[t4]; - tr4=cc[t3]+cc[t4]; - tr1=cc[t2-1]-cc[t5-1]; - tr2=cc[t2-1]+cc[t5-1]; - ti4=cc[t3-1]-cc[t4-1]; - tr3=cc[t3-1]+cc[t4-1]; - ch[t7-1]=tr2+tr3; - cr3=tr2-tr3; - ch[t7]=ti2+ti3; - ci3=ti2-ti3; - cr2=tr1-tr4; - cr4=tr1+tr4; - ci2=ti1+ti4; - ci4=ti1-ti4; - - ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2; - ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2; - ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3; - ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3; - ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4; - ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4; - } - t1+=ido; - } - - if(ido%2 == 1)return; - - L105: - - t1=ido; - t2=ido<<2; - t3=ido-1; - t4=ido+(ido<<1); - for(k=0;k<l1;k++){ - t5=t3; - ti1=cc[t1]+cc[t4]; - ti2=cc[t4]-cc[t1]; - tr1=cc[t1-1]-cc[t4-1]; - tr2=cc[t1-1]+cc[t4-1]; - ch[t5]=tr2+tr2; - ch[t5+=t0]=sqrt2*(tr1-ti1); - ch[t5+=t0]=ti2+ti2; - ch[t5+=t0]=-sqrt2*(tr1+ti1); - - t3+=ido; - t1+=t2; - t4+=t2; - } -} - -static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1, - float *c2,float *ch,float *ch2,float *wa){ - static float tpi=6.283185307179586f; - int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10, - t11,t12; - float dc2,ai1,ai2,ar1,ar2,ds2; - int nbd; - float dcp,arg,dsp,ar1h,ar2h; - int ipp2; - - t10=ip*ido; - t0=l1*ido; - arg=tpi/(float)ip; - dcp=cos(arg); - dsp=sin(arg); - nbd=(ido-1)>>1; - ipp2=ip; - ipph=(ip+1)>>1; - if(ido<l1)goto L103; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t4=t2; - for(i=0;i<ido;i++){ - ch[t3]=cc[t4]; - t3++; - t4++; - } - t1+=ido; - t2+=t10; - } - goto L106; - - L103: - t1=0; - for(i=0;i<ido;i++){ - t2=t1; - t3=t1; - for(k=0;k<l1;k++){ - ch[t2]=cc[t3]; - t2+=ido; - t3+=t10; - } - t1++; - } - - L106: - t1=0; - t2=ipp2*t0; - t7=(t5=ido<<1); - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - t6=t5; - for(k=0;k<l1;k++){ - ch[t3]=cc[t6-1]+cc[t6-1]; - ch[t4]=cc[t6]+cc[t6]; - t3+=ido; - t4+=ido; - t6+=t10; - } - t5+=t7; - } - - if (ido == 1)goto L116; - if(nbd<l1)goto L112; - - t1=0; - t2=ipp2*t0; - t7=0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - - t7+=(ido<<1); - t8=t7; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - t9=t8; - t11=t8; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - t9+=2; - t11-=2; - ch[t5-1]=cc[t9-1]+cc[t11-1]; - ch[t6-1]=cc[t9-1]-cc[t11-1]; - ch[t5]=cc[t9]-cc[t11]; - ch[t6]=cc[t9]+cc[t11]; - } - t3+=ido; - t4+=ido; - t8+=t10; - } - } - goto L116; - - L112: - t1=0; - t2=ipp2*t0; - t7=0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - t7+=(ido<<1); - t8=t7; - t9=t7; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t8+=2; - t9-=2; - t5=t3; - t6=t4; - t11=t8; - t12=t9; - for(k=0;k<l1;k++){ - ch[t5-1]=cc[t11-1]+cc[t12-1]; - ch[t6-1]=cc[t11-1]-cc[t12-1]; - ch[t5]=cc[t11]-cc[t12]; - ch[t6]=cc[t11]+cc[t12]; - t5+=ido; - t6+=ido; - t11+=t10; - t12+=t10; - } - } - } - -L116: - ar1=1.f; - ai1=0.f; - t1=0; - t9=(t2=ipp2*idl1); - t3=(ip-1)*idl1; - for(l=1;l<ipph;l++){ - t1+=idl1; - t2-=idl1; - - ar1h=dcp*ar1-dsp*ai1; - ai1=dcp*ai1+dsp*ar1; - ar1=ar1h; - t4=t1; - t5=t2; - t6=0; - t7=idl1; - t8=t3; - for(ik=0;ik<idl1;ik++){ - c2[t4++]=ch2[t6++]+ar1*ch2[t7++]; - c2[t5++]=ai1*ch2[t8++]; - } - dc2=ar1; - ds2=ai1; - ar2=ar1; - ai2=ai1; - - t6=idl1; - t7=t9-idl1; - for(j=2;j<ipph;j++){ - t6+=idl1; - t7-=idl1; - ar2h=dc2*ar2-ds2*ai2; - ai2=dc2*ai2+ds2*ar2; - ar2=ar2h; - t4=t1; - t5=t2; - t11=t6; - t12=t7; - for(ik=0;ik<idl1;ik++){ - c2[t4++]+=ar2*ch2[t11++]; - c2[t5++]+=ai2*ch2[t12++]; - } - } - } - - t1=0; - for(j=1;j<ipph;j++){ - t1+=idl1; - t2=t1; - for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++]; - } - - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - ch[t3]=c1[t3]-c1[t4]; - ch[t4]=c1[t3]+c1[t4]; - t3+=ido; - t4+=ido; - } - } - - if(ido==1)goto L132; - if(nbd<l1)goto L128; - - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - ch[t5-1]=c1[t5-1]-c1[t6]; - ch[t6-1]=c1[t5-1]+c1[t6]; - ch[t5]=c1[t5]+c1[t6-1]; - ch[t6]=c1[t5]-c1[t6-1]; - } - t3+=ido; - t4+=ido; - } - } - goto L132; - - L128: - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5=t3; - t6=t4; - for(k=0;k<l1;k++){ - ch[t5-1]=c1[t5-1]-c1[t6]; - ch[t6-1]=c1[t5-1]+c1[t6]; - ch[t5]=c1[t5]+c1[t6-1]; - ch[t6]=c1[t5]-c1[t6-1]; - t5+=ido; - t6+=ido; - } - } - } - -L132: - if(ido==1)return; - - for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; - - t1=0; - for(j=1;j<ip;j++){ - t2=(t1+=t0); - for(k=0;k<l1;k++){ - c1[t2]=ch[t2]; - t2+=ido; - } - } - - if(nbd>l1)goto L139; - - is= -ido-1; - t1=0; - for(j=1;j<ip;j++){ - is+=ido; - t1+=t0; - idij=is; - t2=t1; - for(i=2;i<ido;i+=2){ - t2+=2; - idij+=2; - t3=t2; - for(k=0;k<l1;k++){ - c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; - c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; - t3+=ido; - } - } - } - return; - - L139: - is= -ido-1; - t1=0; - for(j=1;j<ip;j++){ - is+=ido; - t1+=t0; - t2=t1; - for(k=0;k<l1;k++){ - idij=is; - t3=t2; - for(i=2;i<ido;i+=2){ - idij+=2; - t3+=2; - c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; - c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; - } - t2+=ido; - } - } -} - -static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){ - int i,k1,l1,l2; - int na; - int nf,ip,iw,ix2,ix3,ido,idl1; - - nf=ifac[1]; - na=0; - l1=1; - iw=1; - - for(k1=0;k1<nf;k1++){ - ip=ifac[k1 + 2]; - l2=ip*l1; - ido=n/l2; - idl1=ido*l1; - if(ip!=4)goto L103; - ix2=iw+ido; - ix3=ix2+ido; - - if(na!=0) - dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); - else - dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); - na=1-na; - goto L115; - - L103: - if(ip!=2)goto L106; - - if(na!=0) - dradb2(ido,l1,ch,c,wa+iw-1); - else - dradb2(ido,l1,c,ch,wa+iw-1); - na=1-na; - goto L115; - - L106: - if(ip!=3)goto L109; - - ix2=iw+ido; - if(na!=0) - dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1); - else - dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1); - na=1-na; - goto L115; - - L109: -/* The radix five case can be translated later..... */ -/* if(ip!=5)goto L112; - - ix2=iw+ido; - ix3=ix2+ido; - ix4=ix3+ido; - if(na!=0) - dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); - else - dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); - na=1-na; - goto L115; - - L112:*/ - if(na!=0) - dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); - else - dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); - if(ido==1)na=1-na; - - L115: - l1=l2; - iw+=(ip-1)*ido; - } - - if(na==0)return; - - for(i=0;i<n;i++)c[i]=ch[i]; -} - -void spx_drft_forward(struct drft_lookup *l,float *data){ - if(l->n==1)return; - drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); -} - -void spx_drft_backward(struct drft_lookup *l,float *data){ - if (l->n==1)return; - drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); -} - -void spx_drft_init(struct drft_lookup *l,int n) -{ - l->n=n; - l->trigcache=(float*)speex_alloc(3*n*sizeof(*l->trigcache)); - l->splitcache=(int*)speex_alloc(32*sizeof(*l->splitcache)); - fdrffti(n, l->trigcache, l->splitcache); -} - -void spx_drft_clear(struct drft_lookup *l) -{ - if(l) - { - if(l->trigcache) - speex_free(l->trigcache); - if(l->splitcache) - speex_free(l->splitcache); - } -} diff --git a/src/lib/dl/ext/speex/smallft.h b/src/lib/dl/ext/speex/smallft.h deleted file mode 100755 index 446e2f65..00000000 --- a/src/lib/dl/ext/speex/smallft.h +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************** - * * - * 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: fft transform - last mod: $Id: smallft.h,v 1.3 2003/09/16 18:35:45 jm Exp $ - - ********************************************************************/ -/** - @file smallft.h - @brief Discrete Rotational Fourier Transform (DRFT) -*/ - -#ifndef _V_SMFT_H_ -#define _V_SMFT_H_ - - -#ifdef __cplusplus -extern "C" { -#endif - -/** Discrete Rotational Fourier Transform lookup */ -struct drft_lookup{ - int n; - float *trigcache; - int *splitcache; -}; - -extern void spx_drft_forward(struct drft_lookup *l,float *data); -extern void spx_drft_backward(struct drft_lookup *l,float *data); -extern void spx_drft_init(struct drft_lookup *l,int n); -extern void spx_drft_clear(struct drft_lookup *l); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/speex/speex.c b/src/lib/dl/ext/speex/speex.c deleted file mode 100755 index b425155c..00000000 --- a/src/lib/dl/ext/speex/speex.c +++ /dev/null @@ -1,250 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: speex.c - - Basic Speex functions - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "modes.h" -#include <math.h> -#include "os_support.h" - -#ifndef NULL -#define NULL 0 -#endif - -#define MAX_IN_SAMPLES 640 - - - -EXPORT void *speex_encoder_init(const SpeexMode *mode) -{ - return mode->enc_init(mode); -} - -EXPORT void *speex_decoder_init(const SpeexMode *mode) -{ - return mode->dec_init(mode); -} - -EXPORT void speex_encoder_destroy(void *state) -{ - (*((SpeexMode**)state))->enc_destroy(state); -} - -EXPORT void speex_decoder_destroy(void *state) -{ - (*((SpeexMode**)state))->dec_destroy(state); -} - - - -int speex_encode_native(void *state, spx_word16_t *in, SpeexBits *bits) -{ - return (*((SpeexMode**)state))->enc(state, in, bits); -} - -int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out) -{ - return (*((SpeexMode**)state))->dec(state, bits, out); -} - - - -#ifdef FIXED_POINT - -#ifndef DISABLE_FLOAT_API -EXPORT int speex_encode(void *state, float *in, SpeexBits *bits) -{ - int i; - spx_int32_t N; - spx_int16_t short_in[MAX_IN_SAMPLES]; - speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N); - for (i=0;i<N;i++) - { - if (in[i]>32767.f) - short_in[i] = 32767; - else if (in[i]<-32768.f) - short_in[i] = -32768; - else - short_in[i] = (spx_int16_t)floor(.5+in[i]); - } - return (*((SpeexMode**)state))->enc(state, short_in, bits); -} -#endif /* #ifndef DISABLE_FLOAT_API */ - -EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits) -{ - SpeexMode *mode; - mode = *(SpeexMode**)state; - return (mode)->enc(state, in, bits); -} - -#ifndef DISABLE_FLOAT_API -EXPORT int speex_decode(void *state, SpeexBits *bits, float *out) -{ - int i, ret; - spx_int32_t N; - spx_int16_t short_out[MAX_IN_SAMPLES]; - speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N); - ret = (*((SpeexMode**)state))->dec(state, bits, short_out); - for (i=0;i<N;i++) - out[i] = short_out[i]; - return ret; -} -#endif /* #ifndef DISABLE_FLOAT_API */ - -EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out) -{ - SpeexMode *mode = *(SpeexMode**)state; - return (mode)->dec(state, bits, out); -} - -#else - -EXPORT int speex_encode(void *state, float *in, SpeexBits *bits) -{ - return (*((SpeexMode**)state))->enc(state, in, bits); -} - -EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits) -{ - int i; - spx_int32_t N; - float float_in[MAX_IN_SAMPLES]; - speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N); - for (i=0;i<N;i++) - float_in[i] = in[i]; - return (*((SpeexMode**)state))->enc(state, float_in, bits); -} - -EXPORT int speex_decode(void *state, SpeexBits *bits, float *out) -{ - return (*((SpeexMode**)state))->dec(state, bits, out); -} - -EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out) -{ - int i; - spx_int32_t N; - float float_out[MAX_IN_SAMPLES]; - int ret; - speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N); - ret = (*((SpeexMode**)state))->dec(state, bits, float_out); - for (i=0;i<N;i++) - { - if (float_out[i]>32767.f) - out[i] = 32767; - else if (float_out[i]<-32768.f) - out[i] = -32768; - else - out[i] = (spx_int16_t)floor(.5+float_out[i]); - } - return ret; -} -#endif - - - -EXPORT int speex_encoder_ctl(void *state, int request, void *ptr) -{ - return (*((SpeexMode**)state))->enc_ctl(state, request, ptr); -} - -EXPORT int speex_decoder_ctl(void *state, int request, void *ptr) -{ - return (*((SpeexMode**)state))->dec_ctl(state, request, ptr); -} - - - -int nb_mode_query(const void *mode, int request, void *ptr) -{ - const SpeexNBMode *m = (const SpeexNBMode*)mode; - - switch (request) - { - case SPEEX_MODE_FRAME_SIZE: - *((int*)ptr)=m->frameSize; - break; - case SPEEX_SUBMODE_BITS_PER_FRAME: - if (*((int*)ptr)==0) - *((int*)ptr) = NB_SUBMODE_BITS+1; - else if (m->submodes[*((int*)ptr)]==NULL) - *((int*)ptr) = -1; - else - *((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame; - break; - default: - speex_warning_int("Unknown nb_mode_query request: ", request); - return -1; - } - return 0; -} - - - -EXPORT int speex_lib_ctl(int request, void *ptr) -{ - switch (request) - { - case SPEEX_LIB_GET_MAJOR_VERSION: - *((int*)ptr) = SPEEX_MAJOR_VERSION; - break; - case SPEEX_LIB_GET_MINOR_VERSION: - *((int*)ptr) = SPEEX_MINOR_VERSION; - break; - case SPEEX_LIB_GET_MICRO_VERSION: - *((int*)ptr) = SPEEX_MICRO_VERSION; - break; - case SPEEX_LIB_GET_EXTRA_VERSION: - *((const char**)ptr) = SPEEX_EXTRA_VERSION; - break; - case SPEEX_LIB_GET_VERSION_STRING: - *((const char**)ptr) = SPEEX_VERSION; - break; - /*case SPEEX_LIB_SET_ALLOC_FUNC: - break; - case SPEEX_LIB_GET_ALLOC_FUNC: - break; - case SPEEX_LIB_SET_FREE_FUNC: - break; - case SPEEX_LIB_GET_FREE_FUNC: - break;*/ - default: - speex_warning_int("Unknown wb_mode_query request: ", request); - return -1; - } - return 0; -} diff --git a/src/lib/dl/ext/speex/speex.h b/src/lib/dl/ext/speex/speex.h deleted file mode 100755 index ca62ba04..00000000 --- a/src/lib/dl/ext/speex/speex.h +++ /dev/null @@ -1,424 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin*/ -/** - @file speex.h - @brief Describes the different modes of the codec -*/ -/* - 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 SPEEX_H -#define SPEEX_H -/** @defgroup Codec Speex encoder and decoder - * This is the Speex codec itself. - * @{ - */ - -#include "ext/speex/speex_bits.h" -#include "ext/speex/speex_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Values allowed for *ctl() requests */ - -/** Set enhancement on/off (decoder only) */ -#define SPEEX_SET_ENH 0 -/** Get enhancement state (decoder only) */ -#define SPEEX_GET_ENH 1 - -/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/ -/** Obtain frame size used by encoder/decoder */ -#define SPEEX_GET_FRAME_SIZE 3 - -/** Set quality value */ -#define SPEEX_SET_QUALITY 4 -/** Get current quality setting */ -/* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */ - -/** Set sub-mode to use */ -#define SPEEX_SET_MODE 6 -/** Get current sub-mode in use */ -#define SPEEX_GET_MODE 7 - -/** Set low-band sub-mode to use (wideband only)*/ -#define SPEEX_SET_LOW_MODE 8 -/** Get current low-band mode in use (wideband only)*/ -#define SPEEX_GET_LOW_MODE 9 - -/** Set high-band sub-mode to use (wideband only)*/ -#define SPEEX_SET_HIGH_MODE 10 -/** Get current high-band mode in use (wideband only)*/ -#define SPEEX_GET_HIGH_MODE 11 - -/** Set VBR on (1) or off (0) */ -#define SPEEX_SET_VBR 12 -/** Get VBR status (1 for on, 0 for off) */ -#define SPEEX_GET_VBR 13 - -/** Set quality value for VBR encoding (0-10) */ -#define SPEEX_SET_VBR_QUALITY 14 -/** Get current quality value for VBR encoding (0-10) */ -#define SPEEX_GET_VBR_QUALITY 15 - -/** Set complexity of the encoder (0-10) */ -#define SPEEX_SET_COMPLEXITY 16 -/** Get current complexity of the encoder (0-10) */ -#define SPEEX_GET_COMPLEXITY 17 - -/** Set bit-rate used by the encoder (or lower) */ -#define SPEEX_SET_BITRATE 18 -/** Get current bit-rate used by the encoder or decoder */ -#define SPEEX_GET_BITRATE 19 - -/** Define a handler function for in-band Speex request*/ -#define SPEEX_SET_HANDLER 20 - -/** Define a handler function for in-band user-defined request*/ -#define SPEEX_SET_USER_HANDLER 22 - -/** Set sampling rate used in bit-rate computation */ -#define SPEEX_SET_SAMPLING_RATE 24 -/** Get sampling rate used in bit-rate computation */ -#define SPEEX_GET_SAMPLING_RATE 25 - -/** Reset the encoder/decoder memories to zero*/ -#define SPEEX_RESET_STATE 26 - -/** Get VBR info (mostly used internally) */ -#define SPEEX_GET_RELATIVE_QUALITY 29 - -/** Set VAD status (1 for on, 0 for off) */ -#define SPEEX_SET_VAD 30 - -/** Get VAD status (1 for on, 0 for off) */ -#define SPEEX_GET_VAD 31 - -/** Set Average Bit-Rate (ABR) to n bits per seconds */ -#define SPEEX_SET_ABR 32 -/** Get Average Bit-Rate (ABR) setting (in bps) */ -#define SPEEX_GET_ABR 33 - -/** Set DTX status (1 for on, 0 for off) */ -#define SPEEX_SET_DTX 34 -/** Get DTX status (1 for on, 0 for off) */ -#define SPEEX_GET_DTX 35 - -/** Set submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) */ -#define SPEEX_SET_SUBMODE_ENCODING 36 -/** Get submode encoding in each frame */ -#define SPEEX_GET_SUBMODE_ENCODING 37 - -/*#define SPEEX_SET_LOOKAHEAD 38*/ -/** Returns the lookahead used by Speex */ -#define SPEEX_GET_LOOKAHEAD 39 - -/** Sets tuning for packet-loss concealment (expected loss rate) */ -#define SPEEX_SET_PLC_TUNING 40 -/** Gets tuning for PLC */ -#define SPEEX_GET_PLC_TUNING 41 - -/** Sets the max bit-rate allowed in VBR mode */ -#define SPEEX_SET_VBR_MAX_BITRATE 42 -/** Gets the max bit-rate allowed in VBR mode */ -#define SPEEX_GET_VBR_MAX_BITRATE 43 - -/** Turn on/off input/output high-pass filtering */ -#define SPEEX_SET_HIGHPASS 44 -/** Get status of input/output high-pass filtering */ -#define SPEEX_GET_HIGHPASS 45 - -/** Get "activity level" of the last decoded frame, i.e. - how much damage we cause if we remove the frame */ -#define SPEEX_GET_ACTIVITY 47 - - -/* Preserving compatibility:*/ -/** Equivalent to SPEEX_SET_ENH */ -#define SPEEX_SET_PF 0 -/** Equivalent to SPEEX_GET_ENH */ -#define SPEEX_GET_PF 1 - - - - -/* Values allowed for mode queries */ -/** Query the frame size of a mode */ -#define SPEEX_MODE_FRAME_SIZE 0 - -/** Query the size of an encoded frame for a particular sub-mode */ -#define SPEEX_SUBMODE_BITS_PER_FRAME 1 - - - -/** Get major Speex version */ -#define SPEEX_LIB_GET_MAJOR_VERSION 1 -/** Get minor Speex version */ -#define SPEEX_LIB_GET_MINOR_VERSION 3 -/** Get micro Speex version */ -#define SPEEX_LIB_GET_MICRO_VERSION 5 -/** Get extra Speex version */ -#define SPEEX_LIB_GET_EXTRA_VERSION 7 -/** Get Speex version string */ -#define SPEEX_LIB_GET_VERSION_STRING 9 - -/*#define SPEEX_LIB_SET_ALLOC_FUNC 10 -#define SPEEX_LIB_GET_ALLOC_FUNC 11 -#define SPEEX_LIB_SET_FREE_FUNC 12 -#define SPEEX_LIB_GET_FREE_FUNC 13 - -#define SPEEX_LIB_SET_WARNING_FUNC 14 -#define SPEEX_LIB_GET_WARNING_FUNC 15 -#define SPEEX_LIB_SET_ERROR_FUNC 16 -#define SPEEX_LIB_GET_ERROR_FUNC 17 -*/ - -/** Number of defined modes in Speex */ -#define SPEEX_NB_MODES 3 - -/** modeID for the defined narrowband mode */ -#define SPEEX_MODEID_NB 0 - -/** modeID for the defined wideband mode */ -#define SPEEX_MODEID_WB 1 - -/** modeID for the defined ultra-wideband mode */ -#define SPEEX_MODEID_UWB 2 - -struct SpeexMode; - - -/* Prototypes for mode function pointers */ - -/** Encoder state initialization function */ -typedef void *(*encoder_init_func)(const struct SpeexMode *mode); - -/** Encoder state destruction function */ -typedef void (*encoder_destroy_func)(void *st); - -/** Main encoding function */ -typedef int (*encode_func)(void *state, void *in, SpeexBits *bits); - -/** Function for controlling the encoder options */ -typedef int (*encoder_ctl_func)(void *state, int request, void *ptr); - -/** Decoder state initialization function */ -typedef void *(*decoder_init_func)(const struct SpeexMode *mode); - -/** Decoder state destruction function */ -typedef void (*decoder_destroy_func)(void *st); - -/** Main decoding function */ -typedef int (*decode_func)(void *state, SpeexBits *bits, void *out); - -/** Function for controlling the decoder options */ -typedef int (*decoder_ctl_func)(void *state, int request, void *ptr); - - -/** Query function for a mode */ -typedef int (*mode_query_func)(const void *mode, int request, void *ptr); - -/** Struct defining a Speex mode */ -typedef struct SpeexMode { - /** Pointer to the low-level mode data */ - const void *mode; - - /** Pointer to the mode query function */ - mode_query_func query; - - /** The name of the mode (you should not rely on this to identify the mode)*/ - const char *modeName; - - /**ID of the mode*/ - int modeID; - - /**Version number of the bitstream (incremented every time we break - bitstream compatibility*/ - int bitstream_version; - - /** Pointer to encoder initialization function */ - encoder_init_func enc_init; - - /** Pointer to encoder destruction function */ - encoder_destroy_func enc_destroy; - - /** Pointer to frame encoding function */ - encode_func enc; - - /** Pointer to decoder initialization function */ - decoder_init_func dec_init; - - /** Pointer to decoder destruction function */ - decoder_destroy_func dec_destroy; - - /** Pointer to frame decoding function */ - decode_func dec; - - /** ioctl-like requests for encoder */ - encoder_ctl_func enc_ctl; - - /** ioctl-like requests for decoder */ - decoder_ctl_func dec_ctl; - -} SpeexMode; - -/** - * Returns a handle to a newly created Speex encoder state structure. For now, - * the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes - * may be added. Note that for now if you have more than one channels to - * encode, you need one state per channel. - * - * @param mode The mode to use (either speex_nb_mode or speex_wb.mode) - * @return A newly created encoder state or NULL if state allocation fails - */ -void *speex_encoder_init(const SpeexMode *mode); - -/** Frees all resources associated to an existing Speex encoder state. - * @param state Encoder state to be destroyed */ -void speex_encoder_destroy(void *state); - -/** Uses an existing encoder state to encode one frame of speech pointed to by - "in". The encoded bit-stream is saved in "bits". - @param state Encoder state - @param in Frame that will be encoded with a +-2^15 range. This data MAY be - overwritten by the encoder and should be considered uninitialised - after the call. - @param bits Bit-stream where the data will be written - @return 0 if frame needs not be transmitted (DTX only), 1 otherwise - */ -int speex_encode(void *state, float *in, SpeexBits *bits); - -/** Uses an existing encoder state to encode one frame of speech pointed to by - "in". The encoded bit-stream is saved in "bits". - @param state Encoder state - @param in Frame that will be encoded with a +-2^15 range - @param bits Bit-stream where the data will be written - @return 0 if frame needs not be transmitted (DTX only), 1 otherwise - */ -int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits); - -/** Used like the ioctl function to control the encoder parameters - * - * @param state Encoder state - * @param request ioctl-type request (one of the SPEEX_* macros) - * @param ptr Data exchanged to-from function - * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter - */ -int speex_encoder_ctl(void *state, int request, void *ptr); - - -/** Returns a handle to a newly created decoder state structure. For now, - * the mode argument can be &nb_mode or &wb_mode . In the future, more modes - * may be added. Note that for now if you have more than one channels to - * decode, you need one state per channel. - * - * @param mode Speex mode (one of speex_nb_mode or speex_wb_mode) - * @return A newly created decoder state or NULL if state allocation fails - */ -void *speex_decoder_init(const SpeexMode *mode); - -/** Frees all resources associated to an existing decoder state. - * - * @param state State to be destroyed - */ -void speex_decoder_destroy(void *state); - -/** Uses an existing decoder state to decode one frame of speech from - * bit-stream bits. The output speech is saved written to out. - * - * @param state Decoder state - * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost) - * @param out Where to write the decoded frame - * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream) - */ -int speex_decode(void *state, SpeexBits *bits, float *out); - -/** Uses an existing decoder state to decode one frame of speech from - * bit-stream bits. The output speech is saved written to out. - * - * @param state Decoder state - * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost) - * @param out Where to write the decoded frame - * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream) - */ -int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out); - -/** Used like the ioctl function to control the encoder parameters - * - * @param state Decoder state - * @param request ioctl-type request (one of the SPEEX_* macros) - * @param ptr Data exchanged to-from function - * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter - */ -int speex_decoder_ctl(void *state, int request, void *ptr); - - -/** Query function for mode information - * - * @param mode Speex mode - * @param request ioctl-type request (one of the SPEEX_* macros) - * @param ptr Data exchanged to-from function - * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter - */ -int speex_mode_query(const SpeexMode *mode, int request, void *ptr); - -/** Functions for controlling the behavior of libspeex - * @param request ioctl-type request (one of the SPEEX_LIB_* macros) - * @param ptr Data exchanged to-from function - * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter - */ -int speex_lib_ctl(int request, void *ptr); - -/** Default narrowband mode */ -extern const SpeexMode speex_nb_mode; - -/** Default wideband mode */ -extern const SpeexMode speex_wb_mode; - -/** Default "ultra-wideband" mode */ -extern const SpeexMode speex_uwb_mode; - -/** List of all modes available */ -extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES]; - -/** Obtain one of the modes available */ -const SpeexMode * speex_lib_get_mode (int mode); - -#ifndef WIN32 -/* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */ -#define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode)) -#endif - -#ifdef __cplusplus -} -#endif - -/** @}*/ -#endif diff --git a/src/lib/dl/ext/speex/speex_bits.h b/src/lib/dl/ext/speex/speex_bits.h deleted file mode 100755 index a26fb4ce..00000000 --- a/src/lib/dl/ext/speex/speex_bits.h +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file speex_bits.h - @brief Handles bit packing/unpacking -*/ -/* - 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 BITS_H -#define BITS_H -/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations - * This is the structure that holds the bit-stream when encoding or decoding - * with Speex. It allows some manipulations as well. - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** Bit-packing data structure representing (part of) a bit-stream. */ -typedef struct SpeexBits { - char *chars; /**< "raw" data */ - int nbBits; /**< Total number of bits stored in the stream*/ - int charPtr; /**< Position of the byte "cursor" */ - int bitPtr; /**< Position of the bit "cursor" within the current char */ - int owner; /**< Does the struct "own" the "raw" buffer (member "chars") */ - int overflow;/**< Set to one if we try to read past the valid data */ - int buf_size;/**< Allocated size for buffer */ - int reserved1; /**< Reserved for future use */ - void *reserved2; /**< Reserved for future use */ -} SpeexBits; - -/** Initializes and allocates resources for a SpeexBits struct */ -void speex_bits_init(SpeexBits *bits); - -/** Initializes SpeexBits struct using a pre-allocated buffer*/ -void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size); - -/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */ -void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size); - -/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/ -void speex_bits_destroy(SpeexBits *bits); - -/** Resets bits to initial value (just after initialization, erasing content)*/ -void speex_bits_reset(SpeexBits *bits); - -/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */ -void speex_bits_rewind(SpeexBits *bits); - -/** Initializes the bit-stream from the data in an area of memory */ -void speex_bits_read_from(SpeexBits *bits, char *bytes, int len); - -/** Append bytes to the bit-stream - * - * @param bits Bit-stream to operate on - * @param bytes pointer to the bytes what will be appended - * @param len Number of bytes of append - */ -void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len); - -/** Write the content of a bit-stream to an area of memory - * - * @param bits Bit-stream to operate on - * @param bytes Memory location where to write the bits - * @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer) - * @return Number of bytes written to the "bytes" buffer -*/ -int speex_bits_write(SpeexBits *bits, char *bytes, int max_len); - -/** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */ -int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len); - -/** Append bits to the bit-stream - * @param bits Bit-stream to operate on - * @param data Value to append as integer - * @param nbBits number of bits to consider in "data" - */ -void speex_bits_pack(SpeexBits *bits, int data, int nbBits); - -/** Interpret the next bits in the bit-stream as a signed integer - * - * @param bits Bit-stream to operate on - * @param nbBits Number of bits to interpret - * @return A signed integer represented by the bits read - */ -int speex_bits_unpack_signed(SpeexBits *bits, int nbBits); - -/** Interpret the next bits in the bit-stream as an unsigned integer - * - * @param bits Bit-stream to operate on - * @param nbBits Number of bits to interpret - * @return An unsigned integer represented by the bits read - */ -unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits); - -/** Returns the number of bytes in the bit-stream, including the last one even if it is not "full" - * - * @param bits Bit-stream to operate on - * @return Number of bytes in the stream - */ -int speex_bits_nbytes(SpeexBits *bits); - -/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position - * - * @param bits Bit-stream to operate on - * @param nbBits Number of bits to look for - * @return Value of the bits peeked, interpreted as unsigned - */ -unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits); - -/** Get the value of the next bit in the stream, without modifying the - * "cursor" position - * - * @param bits Bit-stream to operate on - * @return Value of the bit peeked (one bit only) - */ -int speex_bits_peek(SpeexBits *bits); - -/** Advances the position of the "bit cursor" in the stream - * - * @param bits Bit-stream to operate on - * @param n Number of bits to advance - */ -void speex_bits_advance(SpeexBits *bits, int n); - -/** Returns the number of bits remaining to be read in a stream - * - * @param bits Bit-stream to operate on - * @return Number of bits that can still be read from the stream - */ -int speex_bits_remaining(SpeexBits *bits); - -/** Insert a terminator so that the data can be sent as a packet while auto-detecting - * the number of frames in each packet - * - * @param bits Bit-stream to operate on - */ -void speex_bits_insert_terminator(SpeexBits *bits); - -#ifdef __cplusplus -} -#endif - -/* @} */ -#endif diff --git a/src/lib/dl/ext/speex/speex_buffer.h b/src/lib/dl/ext/speex/speex_buffer.h deleted file mode 100755 index df56f5f1..00000000 --- a/src/lib/dl/ext/speex/speex_buffer.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 2007 Jean-Marc Valin - - File: speex_buffer.h - This is a very simple ring buffer implementation. It is not thread-safe - so you need to do your own locking. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 SPEEX_BUFFER_H -#define SPEEX_BUFFER_H - -#include "speex/speex_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct SpeexBuffer_; -typedef struct SpeexBuffer_ SpeexBuffer; - -SpeexBuffer *speex_buffer_init(int size); - -void speex_buffer_destroy(SpeexBuffer *st); - -int speex_buffer_write(SpeexBuffer *st, void *data, int len); - -int speex_buffer_writezeros(SpeexBuffer *st, int len); - -int speex_buffer_read(SpeexBuffer *st, void *data, int len); - -int speex_buffer_get_available(SpeexBuffer *st); - -int speex_buffer_resize(SpeexBuffer *st, int len); - -#ifdef __cplusplus -} -#endif - -#endif - - - - diff --git a/src/lib/dl/ext/speex/speex_callbacks.c b/src/lib/dl/ext/speex/speex_callbacks.c deleted file mode 100755 index 0e077c38..00000000 --- a/src/lib/dl/ext/speex/speex_callbacks.c +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File speex_callbacks.c - Callback handling and in-band signalling - - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex_callbacks.h> -#include "arch.h" -#include "os_support.h" - -EXPORT int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state) -{ - int id; - SpeexCallback *callback; - /*speex_bits_advance(bits, 5);*/ - id=speex_bits_unpack_unsigned(bits, 4); - callback = callback_list+id; - - if (callback->func) - { - return callback->func(bits, state, callback->data); - } else - /*If callback is not registered, skip the right number of bits*/ - { - int adv; - if (id<2) - adv = 1; - else if (id<8) - adv = 4; - else if (id<10) - adv = 8; - else if (id<12) - adv = 16; - else if (id<14) - adv = 32; - else - adv = 64; - speex_bits_advance(bits, adv); - } - return 0; -} - -EXPORT int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data) -{ - spx_int32_t m; - m = speex_bits_unpack_unsigned(bits, 4); - speex_encoder_ctl(data, SPEEX_SET_MODE, &m); - return 0; -} - -EXPORT int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data) -{ - spx_int32_t m; - m = speex_bits_unpack_unsigned(bits, 4); - speex_encoder_ctl(data, SPEEX_SET_LOW_MODE, &m); - return 0; -} - -EXPORT int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data) -{ - spx_int32_t m; - m = speex_bits_unpack_unsigned(bits, 4); - speex_encoder_ctl(data, SPEEX_SET_HIGH_MODE, &m); - return 0; -} - -#ifndef DISABLE_VBR -EXPORT int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data) -{ - spx_int32_t vbr; - vbr = speex_bits_unpack_unsigned(bits, 1); - speex_encoder_ctl(data, SPEEX_SET_VBR, &vbr); - return 0; -} -#endif /* #ifndef DISABLE_VBR */ - -EXPORT int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data) -{ - spx_int32_t enh; - enh = speex_bits_unpack_unsigned(bits, 1); - speex_decoder_ctl(data, SPEEX_SET_ENH, &enh); - return 0; -} - -#ifndef DISABLE_VBR -EXPORT int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data) -{ - float qual; - qual = speex_bits_unpack_unsigned(bits, 4); - speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual); - return 0; -} -#endif /* #ifndef DISABLE_VBR */ - -EXPORT int speex_std_char_handler(SpeexBits *bits, void *state, void *data) -{ - unsigned char ch; - ch = speex_bits_unpack_unsigned(bits, 8); - _speex_putc(ch, data); - /*printf("speex_std_char_handler ch=%x\n", ch);*/ - return 0; -} - - - -/* Default handler for user callbacks: skip it */ -EXPORT int speex_default_user_handler(SpeexBits *bits, void *state, void *data) -{ - int req_size = speex_bits_unpack_unsigned(bits, 4); - speex_bits_advance(bits, 5+8*req_size); - return 0; -} diff --git a/src/lib/dl/ext/speex/speex_callbacks.h b/src/lib/dl/ext/speex/speex_callbacks.h deleted file mode 100755 index 6f450b3a..00000000 --- a/src/lib/dl/ext/speex/speex_callbacks.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin*/ -/** - @file speex_callbacks.h - @brief Describes callback handling and in-band signalling -*/ -/* - 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 SPEEX_CALLBACKS_H -#define SPEEX_CALLBACKS_H -/** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder. - * @{ - */ - -#include "speex.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** Total number of callbacks */ -#define SPEEX_MAX_CALLBACKS 16 - -/* Describes all the in-band requests */ - -/*These are 1-bit requests*/ -/** Request for perceptual enhancement (1 for on, 0 for off) */ -#define SPEEX_INBAND_ENH_REQUEST 0 -/** Reserved */ -#define SPEEX_INBAND_RESERVED1 1 - -/*These are 4-bit requests*/ -/** Request for a mode change */ -#define SPEEX_INBAND_MODE_REQUEST 2 -/** Request for a low mode change */ -#define SPEEX_INBAND_LOW_MODE_REQUEST 3 -/** Request for a high mode change */ -#define SPEEX_INBAND_HIGH_MODE_REQUEST 4 -/** Request for VBR (1 on, 0 off) */ -#define SPEEX_INBAND_VBR_QUALITY_REQUEST 5 -/** Request to be sent acknowledge */ -#define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6 -/** Request for VBR (1 for on, 0 for off) */ -#define SPEEX_INBAND_VBR_REQUEST 7 - -/*These are 8-bit requests*/ -/** Send a character in-band */ -#define SPEEX_INBAND_CHAR 8 -/** Intensity stereo information */ -#define SPEEX_INBAND_STEREO 9 - -/*These are 16-bit requests*/ -/** Transmit max bit-rate allowed */ -#define SPEEX_INBAND_MAX_BITRATE 10 - -/*These are 32-bit requests*/ -/** Acknowledge packet reception */ -#define SPEEX_INBAND_ACKNOWLEDGE 12 - -/** Callback function type */ -typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data); - -/** Callback information */ -typedef struct SpeexCallback { - int callback_id; /**< ID associated to the callback */ - speex_callback_func func; /**< Callback handler function */ - void *data; /**< Data that will be sent to the handler */ - void *reserved1; /**< Reserved for future use */ - int reserved2; /**< Reserved for future use */ -} SpeexCallback; - -/** Handle in-band request */ -int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state); - -/** Standard handler for mode request (change mode, no questions asked) */ -int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data); - -/** Standard handler for high mode request (change high mode, no questions asked) */ -int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data); - -/** Standard handler for in-band characters (write to stderr) */ -int speex_std_char_handler(SpeexBits *bits, void *state, void *data); - -/** Default handler for user-defined requests: in this case, just ignore */ -int speex_default_user_handler(SpeexBits *bits, void *state, void *data); - - - -/** Standard handler for low mode request (change low mode, no questions asked) */ -int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data); - -/** Standard handler for VBR request (Set VBR, no questions asked) */ -int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data); - -/** Standard handler for enhancer request (Turn enhancer on/off, no questions asked) */ -int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data); - -/** Standard handler for VBR quality request (Set VBR quality, no questions asked) */ -int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data); - - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif diff --git a/src/lib/dl/ext/speex/speex_config_types.h b/src/lib/dl/ext/speex/speex_config_types.h deleted file mode 100755 index bd548546..00000000 --- a/src/lib/dl/ext/speex/speex_config_types.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __SPEEX_TYPES_H__ -#define __SPEEX_TYPES_H__ - -/* these are filled in by configure */ -typedef short spx_int16_t; -typedef unsigned short spx_uint16_t; -typedef int spx_int32_t; -typedef unsigned int spx_uint32_t; - -#endif - diff --git a/src/lib/dl/ext/speex/speex_echo.h b/src/lib/dl/ext/speex/speex_echo.h deleted file mode 100755 index 53bcd28a..00000000 --- a/src/lib/dl/ext/speex/speex_echo.h +++ /dev/null @@ -1,170 +0,0 @@ -/* Copyright (C) Jean-Marc Valin */ -/** - @file speex_echo.h - @brief Echo cancellation -*/ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 SPEEX_ECHO_H -#define SPEEX_ECHO_H -/** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller - * This is the acoustic echo canceller module. - * @{ - */ -#include "speex/speex_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** Obtain frame size used by the AEC */ -#define SPEEX_ECHO_GET_FRAME_SIZE 3 - -/** Set sampling rate */ -#define SPEEX_ECHO_SET_SAMPLING_RATE 24 -/** Get sampling rate */ -#define SPEEX_ECHO_GET_SAMPLING_RATE 25 - -/* Can't set window sizes */ -/** Get size of impulse response (int32) */ -#define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27 - -/* Can't set window content */ -/** Get impulse response (int32[]) */ -#define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29 - -/** Internal echo canceller state. Should never be accessed directly. */ -struct SpeexEchoState_; - -/** @class SpeexEchoState - * This holds the state of the echo canceller. You need one per channel. -*/ - -/** Internal echo canceller state. Should never be accessed directly. */ -typedef struct SpeexEchoState_ SpeexEchoState; - -/** Creates a new echo canceller state - * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms) - * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms) - * @return Newly-created echo canceller state - */ -SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length); - -/** Creates a new multi-channel echo canceller state - * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms) - * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms) - * @param nb_mic Number of microphone channels - * @param nb_speakers Number of speaker channels - * @return Newly-created echo canceller state - */ -SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers); - -/** Destroys an echo canceller state - * @param st Echo canceller state -*/ -void speex_echo_state_destroy(SpeexEchoState *st); - -/** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added - * to playback in this form) - * - * @param st Echo canceller state - * @param rec Signal from the microphone (near end + far end echo) - * @param play Signal played to the speaker (received from far end) - * @param out Returns near-end signal with echo removed - */ -void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out); - -/** Performs echo cancellation a frame (deprecated) */ -void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout); - -/** Perform echo cancellation using internal playback buffer, which is delayed by two frames - * to account for the delay introduced by most soundcards (but it could be off!) - * @param st Echo canceller state - * @param rec Signal from the microphone (near end + far end echo) - * @param out Returns near-end signal with echo removed -*/ -void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out); - -/** Let the echo canceller know that a frame was just queued to the soundcard - * @param st Echo canceller state - * @param play Signal played to the speaker (received from far end) -*/ -void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play); - -/** Reset the echo canceller to its original state - * @param st Echo canceller state - */ -void speex_echo_state_reset(SpeexEchoState *st); - -/** Used like the ioctl function to control the echo canceller parameters - * - * @param st Echo canceller state - * @param request ioctl-type request (one of the SPEEX_ECHO_* macros) - * @param ptr Data exchanged to-from function - * @return 0 if no error, -1 if request in unknown - */ -int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr); - - - -struct SpeexDecorrState_; - -typedef struct SpeexDecorrState_ SpeexDecorrState; - - -/** Create a state for the channel decorrelation algorithm - This is useful for multi-channel echo cancellation only - * @param rate Sampling rate - * @param channels Number of channels (it's a bit pointless if you don't have at least 2) - * @param frame_size Size of the frame to process at ones (counting samples *per* channel) -*/ -SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size); - -/** Remove correlation between the channels by modifying the phase and possibly - adding noise in a way that is not (or little) perceptible. - * @param st Decorrelator state - * @param in Input audio in interleaved format - * @param out Result of the decorrelation (out *may* alias in) - * @param strength How much alteration of the audio to apply from 0 to 100. -*/ -void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength); - -/** Destroy a Decorrelation state - * @param st State to destroy -*/ -void speex_decorrelate_destroy(SpeexDecorrState *st); - - -#ifdef __cplusplus -} -#endif - - -/** @}*/ -#endif diff --git a/src/lib/dl/ext/speex/speex_header.c b/src/lib/dl/ext/speex/speex_header.c deleted file mode 100755 index b7430595..00000000 --- a/src/lib/dl/ext/speex/speex_header.c +++ /dev/null @@ -1,200 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: speex_header.c - Describes the Speex header - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "arch.h" -#include <speex/speex_header.h> -#include <speex/speex.h> -#include "os_support.h" - -#ifndef NULL -#define NULL 0 -#endif - -/** Convert little endian */ -static inline spx_int32_t le_int(spx_int32_t i) -{ -#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) ) - spx_uint32_t ui, ret; - ui = i; - ret = ui>>24; - ret |= (ui>>8)&0x0000ff00; - ret |= (ui<<8)&0x00ff0000; - ret |= (ui<<24); - return ret; -#else - return i; -#endif -} - -#define ENDIAN_SWITCH(x) {x=le_int(x);} - - -/* -typedef struct SpeexHeader { - char speex_string[8]; - char speex_version[SPEEX_HEADER_VERSION_LENGTH]; - int speex_version_id; - int header_size; - int rate; - int mode; - int mode_bitstream_version; - int nb_channels; - int bitrate; - int frame_size; - int vbr; - int frames_per_packet; - int extra_headers; - int reserved1; - int reserved2; -} SpeexHeader; -*/ - -EXPORT void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m) -{ - int i; - const char *h="Speex "; - /* - strncpy(header->speex_string, "Speex ", 8); - strncpy(header->speex_version, SPEEX_VERSION, SPEEX_HEADER_VERSION_LENGTH-1); - header->speex_version[SPEEX_HEADER_VERSION_LENGTH-1]=0; - */ - for (i=0;i<8;i++) - header->speex_string[i]=h[i]; - for (i=0;i<SPEEX_HEADER_VERSION_LENGTH-1 && SPEEX_VERSION[i];i++) - header->speex_version[i]=SPEEX_VERSION[i]; - for (;i<SPEEX_HEADER_VERSION_LENGTH;i++) - header->speex_version[i]=0; - - header->speex_version_id = 1; - header->header_size = sizeof(SpeexHeader); - - header->rate = rate; - header->mode = m->modeID; - header->mode_bitstream_version = m->bitstream_version; - if (m->modeID<0) - speex_warning("This mode is meant to be used alone"); - header->nb_channels = nb_channels; - header->bitrate = -1; - speex_mode_query(m, SPEEX_MODE_FRAME_SIZE, &header->frame_size); - header->vbr = 0; - - header->frames_per_packet = 0; - header->extra_headers = 0; - header->reserved1 = 0; - header->reserved2 = 0; -} - -EXPORT char *speex_header_to_packet(SpeexHeader *header, int *size) -{ - SpeexHeader *le_header; - le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader)); - - SPEEX_COPY(le_header, header, 1); - - /*Make sure everything is now little-endian*/ - ENDIAN_SWITCH(le_header->speex_version_id); - ENDIAN_SWITCH(le_header->header_size); - ENDIAN_SWITCH(le_header->rate); - ENDIAN_SWITCH(le_header->mode); - ENDIAN_SWITCH(le_header->mode_bitstream_version); - ENDIAN_SWITCH(le_header->nb_channels); - ENDIAN_SWITCH(le_header->bitrate); - ENDIAN_SWITCH(le_header->frame_size); - ENDIAN_SWITCH(le_header->vbr); - ENDIAN_SWITCH(le_header->frames_per_packet); - ENDIAN_SWITCH(le_header->extra_headers); - - *size = sizeof(SpeexHeader); - return (char *)le_header; -} - -EXPORT SpeexHeader *speex_packet_to_header(char *packet, int size) -{ - int i; - SpeexHeader *le_header; - const char *h = "Speex "; - for (i=0;i<8;i++) - if (packet[i]!=h[i]) - { - speex_notify("This doesn't look like a Speex file"); - return NULL; - } - - /*FIXME: Do we allow larger headers?*/ - if (size < (int)sizeof(SpeexHeader)) - { - speex_notify("Speex header too small"); - return NULL; - } - - le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader)); - - SPEEX_COPY(le_header, (SpeexHeader*)packet, 1); - - /*Make sure everything is converted correctly from little-endian*/ - ENDIAN_SWITCH(le_header->speex_version_id); - ENDIAN_SWITCH(le_header->header_size); - ENDIAN_SWITCH(le_header->rate); - ENDIAN_SWITCH(le_header->mode); - ENDIAN_SWITCH(le_header->mode_bitstream_version); - ENDIAN_SWITCH(le_header->nb_channels); - ENDIAN_SWITCH(le_header->bitrate); - ENDIAN_SWITCH(le_header->frame_size); - ENDIAN_SWITCH(le_header->vbr); - ENDIAN_SWITCH(le_header->frames_per_packet); - ENDIAN_SWITCH(le_header->extra_headers); - - if (le_header->mode >= SPEEX_NB_MODES || le_header->mode < 0) - { - speex_notify("Invalid mode specified in Speex header"); - speex_free (le_header); - return NULL; - } - - if (le_header->nb_channels>2) - le_header->nb_channels = 2; - if (le_header->nb_channels<1) - le_header->nb_channels = 1; - - return le_header; - -} - -EXPORT void speex_header_free(void *ptr) -{ - speex_free(ptr); -} diff --git a/src/lib/dl/ext/speex/speex_header.h b/src/lib/dl/ext/speex/speex_header.h deleted file mode 100755 index f85b2496..00000000 --- a/src/lib/dl/ext/speex/speex_header.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file speex_header.h - @brief Describes the Speex header -*/ -/* - 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 SPEEX_HEADER_H -#define SPEEX_HEADER_H -/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header - * This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP. - * @{ - */ - -#include "speex/speex_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct SpeexMode; - -/** Length of the Speex header identifier */ -#define SPEEX_HEADER_STRING_LENGTH 8 - -/** Maximum number of characters for encoding the Speex version number in the header */ -#define SPEEX_HEADER_VERSION_LENGTH 20 - -/** Speex header info for file-based formats */ -typedef struct SpeexHeader { - char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */ - char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */ - spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */ - spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */ - spx_int32_t rate; /**< Sampling rate used */ - spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */ - spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */ - spx_int32_t nb_channels; /**< Number of channels encoded */ - spx_int32_t bitrate; /**< Bit-rate used */ - spx_int32_t frame_size; /**< Size of frames */ - spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */ - spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */ - spx_int32_t extra_headers; /**< Number of additional headers after the comments */ - spx_int32_t reserved1; /**< Reserved for future use, must be zero */ - spx_int32_t reserved2; /**< Reserved for future use, must be zero */ -} SpeexHeader; - -/** Initializes a SpeexHeader using basic information */ -void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m); - -/** Creates the header packet from the header itself (mostly involves endianness conversion) */ -char *speex_header_to_packet(SpeexHeader *header, int *size); - -/** Creates a SpeexHeader from a packet */ -SpeexHeader *speex_packet_to_header(char *packet, int size); - -/** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */ -void speex_header_free(void *ptr); - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif diff --git a/src/lib/dl/ext/speex/speex_jitter.h b/src/lib/dl/ext/speex/speex_jitter.h deleted file mode 100755 index d68674b1..00000000 --- a/src/lib/dl/ext/speex/speex_jitter.h +++ /dev/null @@ -1,197 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file speex_jitter.h - @brief Adaptive jitter buffer for Speex -*/ -/* - 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 SPEEX_JITTER_H -#define SPEEX_JITTER_H -/** @defgroup JitterBuffer JitterBuffer: Adaptive jitter buffer - * This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size - * to maintain good quality and low latency. - * @{ - */ - -#include "speex/speex_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** Generic adaptive jitter buffer state */ -struct JitterBuffer_; - -/** Generic adaptive jitter buffer state */ -typedef struct JitterBuffer_ JitterBuffer; - -/** Definition of an incoming packet */ -typedef struct _JitterBufferPacket JitterBufferPacket; - -/** Definition of an incoming packet */ -struct _JitterBufferPacket { - char *data; /**< Data bytes contained in the packet */ - spx_uint32_t len; /**< Length of the packet in bytes */ - spx_uint32_t timestamp; /**< Timestamp for the packet */ - spx_uint32_t span; /**< Time covered by the packet (same units as timestamp) */ - spx_uint16_t sequence; /**< RTP Sequence number if available (0 otherwise) */ - spx_uint32_t user_data; /**< Put whatever data you like here (it's ignored by the jitter buffer) */ -}; - -/** Packet has been retrieved */ -#define JITTER_BUFFER_OK 0 -/** Packet is lost or is late */ -#define JITTER_BUFFER_MISSING 1 -/** A "fake" packet is meant to be inserted here to increase buffering */ -#define JITTER_BUFFER_INSERTION 2 -/** There was an error in the jitter buffer */ -#define JITTER_BUFFER_INTERNAL_ERROR -1 -/** Invalid argument */ -#define JITTER_BUFFER_BAD_ARGUMENT -2 - - -/** Set minimum amount of extra buffering required (margin) */ -#define JITTER_BUFFER_SET_MARGIN 0 -/** Get minimum amount of extra buffering required (margin) */ -#define JITTER_BUFFER_GET_MARGIN 1 -/* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */ - -/** Get the amount of available packets currently buffered */ -#define JITTER_BUFFER_GET_AVAILABLE_COUNT 3 -/** Included because of an early misspelling (will remove in next release) */ -#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3 - -/** Assign a function to destroy unused packet. When setting that, the jitter - buffer no longer copies packet data. */ -#define JITTER_BUFFER_SET_DESTROY_CALLBACK 4 -/** */ -#define JITTER_BUFFER_GET_DESTROY_CALLBACK 5 - -/** Tell the jitter buffer to only adjust the delay in multiples of the step parameter provided */ -#define JITTER_BUFFER_SET_DELAY_STEP 6 -/** */ -#define JITTER_BUFFER_GET_DELAY_STEP 7 - -/** Tell the jitter buffer to only do concealment in multiples of the size parameter provided */ -#define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8 -#define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9 - -/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss - should be half of that or less. */ -#define JITTER_BUFFER_SET_MAX_LATE_RATE 10 -#define JITTER_BUFFER_GET_MAX_LATE_RATE 11 - -/** Equivalent cost of one percent late packet in timestamp units */ -#define JITTER_BUFFER_SET_LATE_COST 12 -#define JITTER_BUFFER_GET_LATE_COST 13 - - -/** Initialises jitter buffer - * - * @param step_size Starting value for the size of concleanment packets and delay - adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP - and JITTER_BUFFER_GET_CONCEALMENT_SIZE. - * @return Newly created jitter buffer state - */ -JitterBuffer *jitter_buffer_init(int step_size); - -/** Restores jitter buffer to its original state - * - * @param jitter Jitter buffer state - */ -void jitter_buffer_reset(JitterBuffer *jitter); - -/** Destroys jitter buffer - * - * @param jitter Jitter buffer state - */ -void jitter_buffer_destroy(JitterBuffer *jitter); - -/** Put one packet into the jitter buffer - * - * @param jitter Jitter buffer state - * @param packet Incoming packet -*/ -void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet); - -/** Get one packet from the jitter buffer - * - * @param jitter Jitter buffer state - * @param packet Returned packet - * @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee) - * @param current_timestamp Timestamp for the returned packet -*/ -int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset); - -/** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp. - * This is mainly useful for media where a single "frame" can be split into several packets. - * - * @param jitter Jitter buffer state - * @param packet Returned packet - */ -int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet); - -/** Get pointer timestamp of jitter buffer - * - * @param jitter Jitter buffer state -*/ -int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter); - -/** Advance by one tick - * - * @param jitter Jitter buffer state -*/ -void jitter_buffer_tick(JitterBuffer *jitter); - -/** Telling the jitter buffer about the remaining data in the application buffer - * @param jitter Jitter buffer state - * @param rem Amount of data buffered by the application (timestamp units) - */ -void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem); - -/** Used like the ioctl function to control the jitter buffer parameters - * - * @param jitter Jitter buffer state - * @param request ioctl-type request (one of the JITTER_BUFFER_* macros) - * @param ptr Data exchanged to-from function - * @return 0 if no error, -1 if request in unknown -*/ -int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr); - -int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset); - -/* @} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/speex/speex_preprocess.h b/src/lib/dl/ext/speex/speex_preprocess.h deleted file mode 100755 index f8eef2cd..00000000 --- a/src/lib/dl/ext/speex/speex_preprocess.h +++ /dev/null @@ -1,219 +0,0 @@ -/* Copyright (C) 2003 Epic Games - Written by Jean-Marc Valin */ -/** - * @file speex_preprocess.h - * @brief Speex preprocessor. The preprocess can do noise suppression, - * residual echo suppression (after using the echo canceller), automatic - * gain control (AGC) and voice activity detection (VAD). -*/ -/* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 SPEEX_PREPROCESS_H -#define SPEEX_PREPROCESS_H -/** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor - * This is the Speex preprocessor. The preprocess can do noise suppression, - * residual echo suppression (after using the echo canceller), automatic - * gain control (AGC) and voice activity detection (VAD). - * @{ - */ - -#include "speex/speex_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** State of the preprocessor (one per channel). Should never be accessed directly. */ -struct SpeexPreprocessState_; - -/** State of the preprocessor (one per channel). Should never be accessed directly. */ -typedef struct SpeexPreprocessState_ SpeexPreprocessState; - - -/** Creates a new preprocessing state. You MUST create one state per channel processed. - * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms). Must be - * the same value as that used for the echo canceller for residual echo cancellation to work. - * @param sampling_rate Sampling rate used for the input. - * @return Newly created preprocessor state -*/ -SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate); - -/** Destroys a preprocessor state - * @param st Preprocessor state to destroy -*/ -void speex_preprocess_state_destroy(SpeexPreprocessState *st); - -/** Preprocess a frame - * @param st Preprocessor state - * @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init(). - * @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on. -*/ -int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x); - -/** Preprocess a frame (deprecated, use speex_preprocess_run() instead)*/ -int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo); - -/** Update preprocessor state, but do not compute the output - * @param st Preprocessor state - * @param x Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init(). -*/ -void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x); - -/** Used like the ioctl function to control the preprocessor parameters - * @param st Preprocessor state - * @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros) - * @param ptr Data exchanged to-from function - * @return 0 if no error, -1 if request in unknown -*/ -int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr); - - - -/** Set preprocessor denoiser state */ -#define SPEEX_PREPROCESS_SET_DENOISE 0 -/** Get preprocessor denoiser state */ -#define SPEEX_PREPROCESS_GET_DENOISE 1 - -/** Set preprocessor Automatic Gain Control state */ -#define SPEEX_PREPROCESS_SET_AGC 2 -/** Get preprocessor Automatic Gain Control state */ -#define SPEEX_PREPROCESS_GET_AGC 3 - -/** Set preprocessor Voice Activity Detection state */ -#define SPEEX_PREPROCESS_SET_VAD 4 -/** Get preprocessor Voice Activity Detection state */ -#define SPEEX_PREPROCESS_GET_VAD 5 - -/** Set preprocessor Automatic Gain Control level (float) */ -#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6 -/** Get preprocessor Automatic Gain Control level (float) */ -#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7 - -/** Set preprocessor dereverb state */ -#define SPEEX_PREPROCESS_SET_DEREVERB 8 -/** Get preprocessor dereverb state */ -#define SPEEX_PREPROCESS_GET_DEREVERB 9 - -/** Set preprocessor dereverb level */ -#define SPEEX_PREPROCESS_SET_DEREVERB_LEVEL 10 -/** Get preprocessor dereverb level */ -#define SPEEX_PREPROCESS_GET_DEREVERB_LEVEL 11 - -/** Set preprocessor dereverb decay */ -#define SPEEX_PREPROCESS_SET_DEREVERB_DECAY 12 -/** Get preprocessor dereverb decay */ -#define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13 - -/** Set probability required for the VAD to go from silence to voice */ -#define SPEEX_PREPROCESS_SET_PROB_START 14 -/** Get probability required for the VAD to go from silence to voice */ -#define SPEEX_PREPROCESS_GET_PROB_START 15 - -/** Set probability required for the VAD to stay in the voice state (integer percent) */ -#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16 -/** Get probability required for the VAD to stay in the voice state (integer percent) */ -#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17 - -/** Set maximum attenuation of the noise in dB (negative number) */ -#define SPEEX_PREPROCESS_SET_NOISE_SUPPRESS 18 -/** Get maximum attenuation of the noise in dB (negative number) */ -#define SPEEX_PREPROCESS_GET_NOISE_SUPPRESS 19 - -/** Set maximum attenuation of the residual echo in dB (negative number) */ -#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS 20 -/** Get maximum attenuation of the residual echo in dB (negative number) */ -#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS 21 - -/** Set maximum attenuation of the residual echo in dB when near end is active (negative number) */ -#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE 22 -/** Get maximum attenuation of the residual echo in dB when near end is active (negative number) */ -#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE 23 - -/** Set the corresponding echo canceller state so that residual echo suppression can be performed (NULL for no residual echo suppression) */ -#define SPEEX_PREPROCESS_SET_ECHO_STATE 24 -/** Get the corresponding echo canceller state */ -#define SPEEX_PREPROCESS_GET_ECHO_STATE 25 - -/** Set maximal gain increase in dB/second (int32) */ -#define SPEEX_PREPROCESS_SET_AGC_INCREMENT 26 - -/** Get maximal gain increase in dB/second (int32) */ -#define SPEEX_PREPROCESS_GET_AGC_INCREMENT 27 - -/** Set maximal gain decrease in dB/second (int32) */ -#define SPEEX_PREPROCESS_SET_AGC_DECREMENT 28 - -/** Get maximal gain decrease in dB/second (int32) */ -#define SPEEX_PREPROCESS_GET_AGC_DECREMENT 29 - -/** Set maximal gain in dB (int32) */ -#define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30 - -/** Get maximal gain in dB (int32) */ -#define SPEEX_PREPROCESS_GET_AGC_MAX_GAIN 31 - -/* Can't set loudness */ -/** Get loudness */ -#define SPEEX_PREPROCESS_GET_AGC_LOUDNESS 33 - -/* Can't set gain */ -/** Get current gain (int32 percent) */ -#define SPEEX_PREPROCESS_GET_AGC_GAIN 35 - -/* Can't set spectrum size */ -/** Get spectrum size for power spectrum (int32) */ -#define SPEEX_PREPROCESS_GET_PSD_SIZE 37 - -/* Can't set power spectrum */ -/** Get power spectrum (int32[] of squared values) */ -#define SPEEX_PREPROCESS_GET_PSD 39 - -/* Can't set noise size */ -/** Get spectrum size for noise estimate (int32) */ -#define SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE 41 - -/* Can't set noise estimate */ -/** Get noise estimate (int32[] of squared values) */ -#define SPEEX_PREPROCESS_GET_NOISE_PSD 43 - -/* Can't set speech probability */ -/** Get speech probability in last frame (int32). */ -#define SPEEX_PREPROCESS_GET_PROB 45 - -/** Set preprocessor Automatic Gain Control level (int32) */ -#define SPEEX_PREPROCESS_SET_AGC_TARGET 46 -/** Get preprocessor Automatic Gain Control level (int32) */ -#define SPEEX_PREPROCESS_GET_AGC_TARGET 47 - -#ifdef __cplusplus -} -#endif - -/** @}*/ -#endif diff --git a/src/lib/dl/ext/speex/speex_resampler.h b/src/lib/dl/ext/speex/speex_resampler.h deleted file mode 100755 index 54eef8d7..00000000 --- a/src/lib/dl/ext/speex/speex_resampler.h +++ /dev/null @@ -1,340 +0,0 @@ -/* Copyright (C) 2007 Jean-Marc Valin - - File: speex_resampler.h - Resampling code - - The design goals of this code are: - - Very fast algorithm - - Low memory requirement - - Good *perceptual* quality (and not best SNR) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. 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. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 SPEEX_RESAMPLER_H -#define SPEEX_RESAMPLER_H - -#ifdef OUTSIDE_SPEEX - -/********* WARNING: MENTAL SANITY ENDS HERE *************/ - -/* If the resampler is defined outside of Speex, we change the symbol names so that - there won't be any clash if linking with Speex later on. */ - -/* #define RANDOM_PREFIX your software name here */ -#ifndef RANDOM_PREFIX -#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes" -#endif - -#define CAT_PREFIX2(a,b) a ## b -#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b) - -#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init) -#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac) -#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy) -#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float) -#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int) -#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float) -#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int) -#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate) -#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate) -#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac) -#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio) -#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality) -#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality) -#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride) -#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride) -#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride) -#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride) -#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency) -#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency) -#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros) -#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem) -#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror) - -#define spx_int16_t short -#define spx_int32_t int -#define spx_uint16_t unsigned short -#define spx_uint32_t unsigned int - -#else /* OUTSIDE_SPEEX */ - -#include "speex/speex_types.h" - -#endif /* OUTSIDE_SPEEX */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define SPEEX_RESAMPLER_QUALITY_MAX 10 -#define SPEEX_RESAMPLER_QUALITY_MIN 0 -#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4 -#define SPEEX_RESAMPLER_QUALITY_VOIP 3 -#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5 - -enum { - RESAMPLER_ERR_SUCCESS = 0, - RESAMPLER_ERR_ALLOC_FAILED = 1, - RESAMPLER_ERR_BAD_STATE = 2, - RESAMPLER_ERR_INVALID_ARG = 3, - RESAMPLER_ERR_PTR_OVERLAP = 4, - - RESAMPLER_ERR_MAX_ERROR -}; - -struct SpeexResamplerState_; -typedef struct SpeexResamplerState_ SpeexResamplerState; - -/** Create a new resampler with integer input and output rates. - * @param nb_channels Number of channels to be processed - * @param in_rate Input sampling rate (integer number of Hz). - * @param out_rate Output sampling rate (integer number of Hz). - * @param quality Resampling quality between 0 and 10, where 0 has poor quality - * and 10 has very high quality. - * @return Newly created resampler state - * @retval NULL Error: not enough memory - */ -SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, - spx_uint32_t in_rate, - spx_uint32_t out_rate, - int quality, - int *err); - -/** Create a new resampler with fractional input/output rates. The sampling - * rate ratio is an arbitrary rational number with both the numerator and - * denominator being 32-bit integers. - * @param nb_channels Number of channels to be processed - * @param ratio_num Numerator of the sampling rate ratio - * @param ratio_den Denominator of the sampling rate ratio - * @param in_rate Input sampling rate rounded to the nearest integer (in Hz). - * @param out_rate Output sampling rate rounded to the nearest integer (in Hz). - * @param quality Resampling quality between 0 and 10, where 0 has poor quality - * and 10 has very high quality. - * @return Newly created resampler state - * @retval NULL Error: not enough memory - */ -SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, - spx_uint32_t ratio_num, - spx_uint32_t ratio_den, - spx_uint32_t in_rate, - spx_uint32_t out_rate, - int quality, - int *err); - -/** Destroy a resampler state. - * @param st Resampler state - */ -void speex_resampler_destroy(SpeexResamplerState *st); - -/** Resample a float array. The input and output buffers must *not* overlap. - * @param st Resampler state - * @param channel_index Index of the channel to process for the multi-channel - * base (0 otherwise) - * @param in Input buffer - * @param in_len Number of input samples in the input buffer. Returns the - * number of samples processed - * @param out Output buffer - * @param out_len Size of the output buffer. Returns the number of samples written - */ -int speex_resampler_process_float(SpeexResamplerState *st, - spx_uint32_t channel_index, - const float *in, - spx_uint32_t *in_len, - float *out, - spx_uint32_t *out_len); - -/** Resample an int array. The input and output buffers must *not* overlap. - * @param st Resampler state - * @param channel_index Index of the channel to process for the multi-channel - * base (0 otherwise) - * @param in Input buffer - * @param in_len Number of input samples in the input buffer. Returns the number - * of samples processed - * @param out Output buffer - * @param out_len Size of the output buffer. Returns the number of samples written - */ -int speex_resampler_process_int(SpeexResamplerState *st, - spx_uint32_t channel_index, - const spx_int16_t *in, - spx_uint32_t *in_len, - spx_int16_t *out, - spx_uint32_t *out_len); - -/** Resample an interleaved float array. The input and output buffers must *not* overlap. - * @param st Resampler state - * @param in Input buffer - * @param in_len Number of input samples in the input buffer. Returns the number - * of samples processed. This is all per-channel. - * @param out Output buffer - * @param out_len Size of the output buffer. Returns the number of samples written. - * This is all per-channel. - */ -int speex_resampler_process_interleaved_float(SpeexResamplerState *st, - const float *in, - spx_uint32_t *in_len, - float *out, - spx_uint32_t *out_len); - -/** Resample an interleaved int array. The input and output buffers must *not* overlap. - * @param st Resampler state - * @param in Input buffer - * @param in_len Number of input samples in the input buffer. Returns the number - * of samples processed. This is all per-channel. - * @param out Output buffer - * @param out_len Size of the output buffer. Returns the number of samples written. - * This is all per-channel. - */ -int speex_resampler_process_interleaved_int(SpeexResamplerState *st, - const spx_int16_t *in, - spx_uint32_t *in_len, - spx_int16_t *out, - spx_uint32_t *out_len); - -/** Set (change) the input/output sampling rates (integer value). - * @param st Resampler state - * @param in_rate Input sampling rate (integer number of Hz). - * @param out_rate Output sampling rate (integer number of Hz). - */ -int speex_resampler_set_rate(SpeexResamplerState *st, - spx_uint32_t in_rate, - spx_uint32_t out_rate); - -/** Get the current input/output sampling rates (integer value). - * @param st Resampler state - * @param in_rate Input sampling rate (integer number of Hz) copied. - * @param out_rate Output sampling rate (integer number of Hz) copied. - */ -void speex_resampler_get_rate(SpeexResamplerState *st, - spx_uint32_t *in_rate, - spx_uint32_t *out_rate); - -/** Set (change) the input/output sampling rates and resampling ratio - * (fractional values in Hz supported). - * @param st Resampler state - * @param ratio_num Numerator of the sampling rate ratio - * @param ratio_den Denominator of the sampling rate ratio - * @param in_rate Input sampling rate rounded to the nearest integer (in Hz). - * @param out_rate Output sampling rate rounded to the nearest integer (in Hz). - */ -int speex_resampler_set_rate_frac(SpeexResamplerState *st, - spx_uint32_t ratio_num, - spx_uint32_t ratio_den, - spx_uint32_t in_rate, - spx_uint32_t out_rate); - -/** Get the current resampling ratio. This will be reduced to the least - * common denominator. - * @param st Resampler state - * @param ratio_num Numerator of the sampling rate ratio copied - * @param ratio_den Denominator of the sampling rate ratio copied - */ -void speex_resampler_get_ratio(SpeexResamplerState *st, - spx_uint32_t *ratio_num, - spx_uint32_t *ratio_den); - -/** Set (change) the conversion quality. - * @param st Resampler state - * @param quality Resampling quality between 0 and 10, where 0 has poor - * quality and 10 has very high quality. - */ -int speex_resampler_set_quality(SpeexResamplerState *st, - int quality); - -/** Get the conversion quality. - * @param st Resampler state - * @param quality Resampling quality between 0 and 10, where 0 has poor - * quality and 10 has very high quality. - */ -void speex_resampler_get_quality(SpeexResamplerState *st, - int *quality); - -/** Set (change) the input stride. - * @param st Resampler state - * @param stride Input stride - */ -void speex_resampler_set_input_stride(SpeexResamplerState *st, - spx_uint32_t stride); - -/** Get the input stride. - * @param st Resampler state - * @param stride Input stride copied - */ -void speex_resampler_get_input_stride(SpeexResamplerState *st, - spx_uint32_t *stride); - -/** Set (change) the output stride. - * @param st Resampler state - * @param stride Output stride - */ -void speex_resampler_set_output_stride(SpeexResamplerState *st, - spx_uint32_t stride); - -/** Get the output stride. - * @param st Resampler state copied - * @param stride Output stride - */ -void speex_resampler_get_output_stride(SpeexResamplerState *st, - spx_uint32_t *stride); - -/** Get the latency in input samples introduced by the resampler. - * @param st Resampler state - */ -int speex_resampler_get_input_latency(SpeexResamplerState *st); - -/** Get the latency in output samples introduced by the resampler. - * @param st Resampler state - */ -int speex_resampler_get_output_latency(SpeexResamplerState *st); - -/** Make sure that the first samples to go out of the resamplers don't have - * leading zeros. This is only useful before starting to use a newly created - * resampler. It is recommended to use that when resampling an audio file, as - * it will generate a file with the same length. For real-time processing, - * it is probably easier not to use this call (so that the output duration - * is the same for the first frame). - * @param st Resampler state - */ -int speex_resampler_skip_zeros(SpeexResamplerState *st); - -/** Reset a resampler so a new (unrelated) stream can be processed. - * @param st Resampler state - */ -int speex_resampler_reset_mem(SpeexResamplerState *st); - -/** Returns the English meaning for an error code - * @param err Error code - * @return English string - */ -const char *speex_resampler_strerror(int err); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/speex/speex_stereo.h b/src/lib/dl/ext/speex/speex_stereo.h deleted file mode 100755 index a259713b..00000000 --- a/src/lib/dl/ext/speex/speex_stereo.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin*/ -/** - @file speex_stereo.h - @brief Describes the handling for intensity stereo -*/ -/* - 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 STEREO_H -#define STEREO_H -/** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files - * This describes the Speex intensity stereo encoding/decoding - * @{ - */ - -#include "speex/speex_types.h" -#include "speex/speex_bits.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** If you access any of these fields directly, I'll personally come and bite you */ -typedef struct SpeexStereoState { - float balance; /**< Left/right balance info */ - float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */ - float smooth_left; /**< Smoothed left channel gain */ - float smooth_right; /**< Smoothed right channel gain */ - float reserved1; /**< Reserved for future use */ - float reserved2; /**< Reserved for future use */ -} SpeexStereoState; - -/** Deprecated. Use speex_stereo_state_init() instead. */ -#define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0} - -/** Initialise/create a stereo stereo state */ -SpeexStereoState *speex_stereo_state_init(); - -/** Reset/re-initialise an already allocated stereo state */ -void speex_stereo_state_reset(SpeexStereoState *stereo); - -/** Destroy a stereo stereo state */ -void speex_stereo_state_destroy(SpeexStereoState *stereo); - -/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */ -void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits); - -/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */ -void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits); - -/** Transforms a mono frame into a stereo frame using intensity stereo info */ -void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo); - -/** Transforms a mono frame into a stereo frame using intensity stereo info */ -void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo); - -/** Callback handler for intensity stereo info */ -int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data); - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif diff --git a/src/lib/dl/ext/speex/speex_types.h b/src/lib/dl/ext/speex/speex_types.h deleted file mode 100755 index 326e639f..00000000 --- a/src/lib/dl/ext/speex/speex_types.h +++ /dev/null @@ -1,126 +0,0 @@ -/* speex_types.h taken from libogg */ -/******************************************************************** - * * - * 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: os_types.h 7524 2004-08-11 04:20:36Z conrad $ - - ********************************************************************/ -/** - @file speex_types.h - @brief Speex types -*/ -#ifndef _SPEEX_TYPES_H -#define _SPEEX_TYPES_H - -#if defined(_WIN32) - -# if defined(__CYGWIN__) -# include <_G_config.h> - typedef _G_int32_t spx_int32_t; - typedef _G_uint32_t spx_uint32_t; - typedef _G_int16_t spx_int16_t; - typedef _G_uint16_t spx_uint16_t; -# elif defined(__MINGW32__) - typedef short spx_int16_t; - typedef unsigned short spx_uint16_t; - typedef int spx_int32_t; - typedef unsigned int spx_uint32_t; -# elif defined(__MWERKS__) - typedef int spx_int32_t; - typedef unsigned int spx_uint32_t; - typedef short spx_int16_t; - typedef unsigned short spx_uint16_t; -# else - /* MSVC/Borland */ - typedef __int32 spx_int32_t; - typedef unsigned __int32 spx_uint32_t; - typedef __int16 spx_int16_t; - typedef unsigned __int16 spx_uint16_t; -# endif - -#elif defined(__MACOS__) - -# include <sys/types.h> - typedef SInt16 spx_int16_t; - typedef UInt16 spx_uint16_t; - typedef SInt32 spx_int32_t; - typedef UInt32 spx_uint32_t; - -#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ - -# include <sys/types.h> - typedef int16_t spx_int16_t; - typedef u_int16_t spx_uint16_t; - typedef int32_t spx_int32_t; - typedef u_int32_t spx_uint32_t; - -#elif defined(__BEOS__) - - /* Be */ -# include <inttypes.h> - typedef int16_t spx_int16_t; - typedef u_int16_t spx_uint16_t; - typedef int32_t spx_int32_t; - typedef u_int32_t spx_uint32_t; - -#elif defined (__EMX__) - - /* OS/2 GCC */ - typedef short spx_int16_t; - typedef unsigned short spx_uint16_t; - typedef int spx_int32_t; - typedef unsigned int spx_uint32_t; - -#elif defined (DJGPP) - - /* DJGPP */ - typedef short spx_int16_t; - typedef int spx_int32_t; - typedef unsigned int spx_uint32_t; - -#elif defined(R5900) - - /* PS2 EE */ - typedef int spx_int32_t; - typedef unsigned spx_uint32_t; - typedef short spx_int16_t; - -#elif defined(__SYMBIAN32__) - - /* Symbian GCC */ - typedef signed short spx_int16_t; - typedef unsigned short spx_uint16_t; - typedef signed int spx_int32_t; - typedef unsigned int spx_uint32_t; - -#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) - - typedef short spx_int16_t; - typedef unsigned short spx_uint16_t; - typedef long spx_int32_t; - typedef unsigned long spx_uint32_t; - -#elif defined(CONFIG_TI_C6X) - - typedef short spx_int16_t; - typedef unsigned short spx_uint16_t; - typedef int spx_int32_t; - typedef unsigned int spx_uint32_t; - -#else - -# include <ext/speex/speex_config_types.h> - -#endif - -#endif /* _SPEEX_TYPES_H */ diff --git a/src/lib/dl/ext/speex/speexdec.c b/src/lib/dl/ext/speex/speexdec.c deleted file mode 100755 index b8bddc71..00000000 --- a/src/lib/dl/ext/speex/speexdec.c +++ /dev/null @@ -1,808 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: speexdec.c - - 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. -*/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <stdio.h> -#if !defined WIN32 && !defined _WIN32 -#include <unistd.h> -#endif -#ifdef HAVE_GETOPT_H -#include "getopt.h" -#endif -#ifndef HAVE_GETOPT_LONG -#include "getopt_win.h" -#endif -#include <stdlib.h> -#include <string.h> - -#include <ext/speex/speex.h> -#include <ext/libogg/ogg.h> - -#if defined WIN32 || defined _WIN32 -#include "wave_out.h" -/* We need the following two to set stdout to binary */ -#include <io.h> -#include <fcntl.h> -#endif -#include <math.h> - -#ifdef __MINGW32__ -#include "wave_out.c" -#endif - -#ifdef HAVE_SYS_SOUNDCARD_H -#include <sys/soundcard.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/ioctl.h> - -#elif defined HAVE_SYS_AUDIOIO_H -#include <sys/types.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/audioio.h> -#ifndef AUDIO_ENCODING_SLINEAR -#define AUDIO_ENCODING_SLINEAR AUDIO_ENCODING_LINEAR /* Solaris */ -#endif - -#endif - -#include <string.h> -#include "wav_io.h" -#include <speex/speex_header.h> -#include <speex/speex_stereo.h> -#include <speex/speex_callbacks.h> - -#define MAX_FRAME_SIZE 2000 - -#define readint(buf, base) (((buf[base+3]<<24)&0xff000000)| \ - ((buf[base+2]<<16)&0xff0000)| \ - ((buf[base+1]<<8)&0xff00)| \ - (buf[base]&0xff)) - -static void print_comments(char *comments, int length) -{ - char *c=comments; - int len, i, nb_fields; - char *end; - - if (length<8) - { - fprintf (stderr, "Invalid/corrupted comments\n"); - return; - } - end = c+length; - len=readint(c, 0); - c+=4; - if (len < 0 || c+len>end) - { - fprintf (stderr, "Invalid/corrupted comments\n"); - return; - } - fwrite(c, 1, len, stderr); - c+=len; - fprintf (stderr, "\n"); - if (c+4>end) - { - fprintf (stderr, "Invalid/corrupted comments\n"); - return; - } - nb_fields=readint(c, 0); - c+=4; - for (i=0;i<nb_fields;i++) - { - if (c+4>end) - { - fprintf (stderr, "Invalid/corrupted comments\n"); - return; - } - len=readint(c, 0); - c+=4; - if (len < 0 || c+len>end) - { - fprintf (stderr, "Invalid/corrupted comments\n"); - return; - } - fwrite(c, 1, len, stderr); - c+=len; - fprintf (stderr, "\n"); - } -} - -FILE *out_file_open(char *outFile, int rate, int *channels) -{ - FILE *fout=NULL; - /*Open output file*/ - if (strlen(outFile)==0) - { -#if defined HAVE_SYS_SOUNDCARD_H - int audio_fd, format, stereo; - audio_fd=open("/dev/dsp", O_WRONLY); - if (audio_fd<0) - { - perror("Cannot open /dev/dsp"); - exit(1); - } - - format=AFMT_S16_NE; - if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format)==-1) - { - perror("SNDCTL_DSP_SETFMT"); - close(audio_fd); - exit(1); - } - - stereo=0; - if (*channels==2) - stereo=1; - if (ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo)==-1) - { - perror("SNDCTL_DSP_STEREO"); - close(audio_fd); - exit(1); - } - if (stereo!=0) - { - if (*channels==1) - fprintf (stderr, "Cannot set mono mode, will decode in stereo\n"); - *channels=2; - } - - if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate)==-1) - { - perror("SNDCTL_DSP_SPEED"); - close(audio_fd); - exit(1); - } - fout = fdopen(audio_fd, "w"); -#elif defined HAVE_SYS_AUDIOIO_H - audio_info_t info; - int audio_fd; - - audio_fd = open("/dev/audio", O_WRONLY); - if (audio_fd<0) - { - perror("Cannot open /dev/audio"); - exit(1); - } - - AUDIO_INITINFO(&info); -#ifdef AUMODE_PLAY /* NetBSD/OpenBSD */ - info.mode = AUMODE_PLAY; -#endif - info.play.encoding = AUDIO_ENCODING_SLINEAR; - info.play.precision = 16; - info.play.sample_rate = rate; - info.play.channels = *channels; - - if (ioctl(audio_fd, AUDIO_SETINFO, &info) < 0) - { - perror ("AUDIO_SETINFO"); - exit(1); - } - fout = fdopen(audio_fd, "w"); -#elif defined WIN32 || defined _WIN32 - { - unsigned int speex_channels = *channels; - if (Set_WIN_Params (INVALID_FILEDESC, rate, SAMPLE_SIZE, speex_channels)) - { - fprintf (stderr, "Can't access %s\n", "WAVE OUT"); - exit(1); - } - } -#else - fprintf (stderr, "No soundcard support\n"); - exit(1); -#endif - } else { - if (strcmp(outFile,"-")==0) - { -#if defined WIN32 || defined _WIN32 - _setmode(_fileno(stdout), _O_BINARY); -#elif defined OS2 - _fsetmode(stdout,"b"); -#endif - fout=stdout; - } - else - { - fout = fopen(outFile, "wb"); - if (!fout) - { - perror(outFile); - exit(1); - } - if (strcmp(outFile+strlen(outFile)-4,".wav")==0 || strcmp(outFile+strlen(outFile)-4,".WAV")==0) - write_wav_header(fout, rate, *channels, 0, 0); - } - } - return fout; -} - -void usage() -{ - printf ("Usage: speexdec [options] input_file.spx [output_file]\n"); - printf ("\n"); - printf ("Decodes a Speex file and produce a WAV file or raw file\n"); - printf ("\n"); - printf ("input_file can be:\n"); - printf (" filename.spx regular Speex file\n"); - printf (" - stdin\n"); - printf ("\n"); - printf ("output_file can be:\n"); - printf (" filename.wav Wav file\n"); - printf (" filename.* Raw PCM file (any extension other that .wav)\n"); - printf (" - stdout\n"); - printf (" (nothing) Will be played to soundcard\n"); - printf ("\n"); - printf ("Options:\n"); - printf (" --enh Enable perceptual enhancement (default)\n"); - printf (" --no-enh Disable perceptual enhancement\n"); - printf (" --force-nb Force decoding in narrowband\n"); - printf (" --force-wb Force decoding in wideband\n"); - printf (" --force-uwb Force decoding in ultra-wideband\n"); - printf (" --mono Force decoding in mono\n"); - printf (" --stereo Force decoding in stereo\n"); - printf (" --rate n Force decoding at sampling rate n Hz\n"); - printf (" --packet-loss n Simulate n %% random packet loss\n"); - printf (" -V Verbose mode (show bit-rate)\n"); - printf (" -h, --help This help\n"); - printf (" -v, --version Version information\n"); - printf (" --pf Deprecated, use --enh instead\n"); - printf (" --no-pf Deprecated, use --no-enh instead\n"); - printf ("\n"); - printf ("More information is available from the Speex site: http://www.speex.org\n"); - printf ("\n"); - printf ("Please report bugs to the mailing list `speex-dev@xiph.org'.\n"); -} - -void version() -{ - const char* speex_version; - speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version); - printf ("speexdec (Speex decoder) version %s (compiled " __DATE__ ")\n", speex_version); - printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n"); -} - -void version_short() -{ - const char* speex_version; - speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version); - printf ("speexdec version %s\n", speex_version); - printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n"); -} - -static void *process_header(ogg_packet *op, spx_int32_t enh_enabled, spx_int32_t *frame_size, int *granule_frame_size, spx_int32_t *rate, int *nframes, int forceMode, int *channels, SpeexStereoState *stereo, int *extra_headers, int quiet) -{ - void *st; - const SpeexMode *mode; - SpeexHeader *header; - int modeID; - SpeexCallback callback; - - header = speex_packet_to_header((char*)op->packet, op->bytes); - if (!header) - { - fprintf (stderr, "Cannot read header\n"); - return NULL; - } - if (header->mode >= SPEEX_NB_MODES || header->mode<0) - { - fprintf (stderr, "Mode number %d does not (yet/any longer) exist in this version\n", - header->mode); - free(header); - return NULL; - } - - modeID = header->mode; - if (forceMode!=-1) - modeID = forceMode; - - mode = speex_lib_get_mode (modeID); - - if (header->speex_version_id > 1) - { - fprintf (stderr, "This file was encoded with Speex bit-stream version %d, which I don't know how to decode\n", header->speex_version_id); - free(header); - return NULL; - } - - if (mode->bitstream_version < header->mode_bitstream_version) - { - fprintf (stderr, "The file was encoded with a newer version of Speex. You need to upgrade in order to play it.\n"); - free(header); - return NULL; - } - if (mode->bitstream_version > header->mode_bitstream_version) - { - fprintf (stderr, "The file was encoded with an older version of Speex. You would need to downgrade the version in order to play it.\n"); - free(header); - return NULL; - } - - st = speex_decoder_init(mode); - if (!st) - { - fprintf (stderr, "Decoder initialization failed.\n"); - free(header); - return NULL; - } - speex_decoder_ctl(st, SPEEX_SET_ENH, &enh_enabled); - speex_decoder_ctl(st, SPEEX_GET_FRAME_SIZE, frame_size); - *granule_frame_size = *frame_size; - - if (!*rate) - *rate = header->rate; - /* Adjust rate if --force-* options are used */ - if (forceMode!=-1) - { - if (header->mode < forceMode) - { - *rate <<= (forceMode - header->mode); - *granule_frame_size >>= (forceMode - header->mode); - } - if (header->mode > forceMode) - { - *rate >>= (header->mode - forceMode); - *granule_frame_size <<= (header->mode - forceMode); - } - } - - - speex_decoder_ctl(st, SPEEX_SET_SAMPLING_RATE, rate); - - *nframes = header->frames_per_packet; - - if (*channels==-1) - *channels = header->nb_channels; - - if (!(*channels==1)) - { - *channels = 2; - callback.callback_id = SPEEX_INBAND_STEREO; - callback.func = speex_std_stereo_request_handler; - callback.data = stereo; - speex_decoder_ctl(st, SPEEX_SET_HANDLER, &callback); - } - - if (!quiet) - { - fprintf (stderr, "Decoding %d Hz audio using %s mode", - *rate, mode->modeName); - - if (*channels==1) - fprintf (stderr, " (mono"); - else - fprintf (stderr, " (stereo"); - - if (header->vbr) - fprintf (stderr, ", VBR)\n"); - else - fprintf(stderr, ")\n"); - /*fprintf (stderr, "Decoding %d Hz audio at %d bps using %s mode\n", - *rate, mode->bitrate, mode->modeName);*/ - } - - *extra_headers = header->extra_headers; - - free(header); - return st; -} - -int main(int argc, char **argv) -{ - int c; - int option_index = 0; - char *inFile, *outFile; - FILE *fin, *fout=NULL; - short out[MAX_FRAME_SIZE]; - short output[MAX_FRAME_SIZE]; - int frame_size=0, granule_frame_size=0; - void *st=NULL; - SpeexBits bits; - int packet_count=0; - int stream_init = 0; - int quiet = 0; - ogg_int64_t page_granule=0, last_granule=0; - int skip_samples=0, page_nb_packets; - struct option long_options[] = - { - {"help", no_argument, NULL, 0}, - {"quiet", no_argument, NULL, 0}, - {"version", no_argument, NULL, 0}, - {"version-short", no_argument, NULL, 0}, - {"enh", no_argument, NULL, 0}, - {"no-enh", no_argument, NULL, 0}, - {"pf", no_argument, NULL, 0}, - {"no-pf", no_argument, NULL, 0}, - {"force-nb", no_argument, NULL, 0}, - {"force-wb", no_argument, NULL, 0}, - {"force-uwb", no_argument, NULL, 0}, - {"rate", required_argument, NULL, 0}, - {"mono", no_argument, NULL, 0}, - {"stereo", no_argument, NULL, 0}, - {"packet-loss", required_argument, NULL, 0}, - {0, 0, 0, 0} - }; - ogg_sync_state oy; - ogg_page og; - ogg_packet op; - ogg_stream_state os; - int enh_enabled; - int nframes=2; - int print_bitrate=0; - int close_in=0; - int eos=0; - int forceMode=-1; - int audio_size=0; - float loss_percent=-1; - SpeexStereoState stereo = SPEEX_STEREO_STATE_INIT; - int channels=-1; - int rate=0; - int extra_headers=0; - int wav_format=0; - int lookahead; - int speex_serialno = -1; - - enh_enabled = 1; - - /*Process options*/ - while(1) - { - c = getopt_long (argc, argv, "hvV", - long_options, &option_index); - if (c==-1) - break; - - switch(c) - { - case 0: - if (strcmp(long_options[option_index].name,"help")==0) - { - usage(); - exit(0); - } else if (strcmp(long_options[option_index].name,"quiet")==0) - { - quiet = 1; - } else if (strcmp(long_options[option_index].name,"version")==0) - { - version(); - exit(0); - } else if (strcmp(long_options[option_index].name,"version-short")==0) - { - version_short(); - exit(0); - } else if (strcmp(long_options[option_index].name,"enh")==0) - { - enh_enabled=1; - } else if (strcmp(long_options[option_index].name,"no-enh")==0) - { - enh_enabled=0; - } else if (strcmp(long_options[option_index].name,"pf")==0) - { - fprintf (stderr, "--pf is deprecated, use --enh instead\n"); - enh_enabled=1; - } else if (strcmp(long_options[option_index].name,"no-pf")==0) - { - fprintf (stderr, "--no-pf is deprecated, use --no-enh instead\n"); - enh_enabled=0; - } else if (strcmp(long_options[option_index].name,"force-nb")==0) - { - forceMode=0; - } else if (strcmp(long_options[option_index].name,"force-wb")==0) - { - forceMode=1; - } else if (strcmp(long_options[option_index].name,"force-uwb")==0) - { - forceMode=2; - } else if (strcmp(long_options[option_index].name,"mono")==0) - { - channels=1; - } else if (strcmp(long_options[option_index].name,"stereo")==0) - { - channels=2; - } else if (strcmp(long_options[option_index].name,"rate")==0) - { - rate=atoi (optarg); - } else if (strcmp(long_options[option_index].name,"packet-loss")==0) - { - loss_percent = atof(optarg); - } - break; - case 'h': - usage(); - exit(0); - break; - case 'v': - version(); - exit(0); - break; - case 'V': - print_bitrate=1; - break; - case '?': - usage(); - exit(1); - break; - } - } - if (argc-optind!=2 && argc-optind!=1) - { - usage(); - exit(1); - } - inFile=argv[optind]; - - if (argc-optind==2) - outFile=argv[optind+1]; - else - outFile = ""; - wav_format = strlen(outFile)>=4 && ( - strcmp(outFile+strlen(outFile)-4,".wav")==0 - || strcmp(outFile+strlen(outFile)-4,".WAV")==0); - /*Open input file*/ - if (strcmp(inFile, "-")==0) - { -#if defined WIN32 || defined _WIN32 - _setmode(_fileno(stdin), _O_BINARY); -#endif - fin=stdin; - } - else - { - fin = fopen(inFile, "rb"); - if (!fin) - { - perror(inFile); - exit(1); - } - close_in=1; - } - - - /*Init Ogg data struct*/ - ogg_sync_init(&oy); - - speex_bits_init(&bits); - /*Main decoding loop*/ - - while (1) - { - char *data; - int i, j, nb_read; - /*Get the ogg buffer for writing*/ - data = ogg_sync_buffer(&oy, 200); - /*Read bitstream from input file*/ - nb_read = fread(data, sizeof(char), 200, fin); - ogg_sync_wrote(&oy, nb_read); - - /*Loop for all complete pages we got (most likely only one)*/ - while (ogg_sync_pageout(&oy, &og)==1) - { - int packet_no; - if (stream_init == 0) { - ogg_stream_init(&os, ogg_page_serialno(&og)); - stream_init = 1; - } - if (ogg_page_serialno(&og) != os.serialno) { - /* so all streams are read. */ - ogg_stream_reset_serialno(&os, ogg_page_serialno(&og)); - } - /*Add page to the bitstream*/ - ogg_stream_pagein(&os, &og); - page_granule = ogg_page_granulepos(&og); - page_nb_packets = ogg_page_packets(&og); - if (page_granule>0 && frame_size) - { - /* FIXME: shift the granule values if --force-* is specified */ - skip_samples = frame_size*(page_nb_packets*granule_frame_size*nframes - (page_granule-last_granule))/granule_frame_size; - if (ogg_page_eos(&og)) - skip_samples = -skip_samples; - /*else if (!ogg_page_bos(&og)) - skip_samples = 0;*/ - } else - { - skip_samples = 0; - } - /*printf ("page granulepos: %d %d %d\n", skip_samples, page_nb_packets, (int)page_granule);*/ - last_granule = page_granule; - /*Extract all available packets*/ - packet_no=0; - while (!eos && ogg_stream_packetout(&os, &op) == 1) - { - if (op.bytes>=5 && !memcmp(op.packet, "Speex", 5)) { - speex_serialno = os.serialno; - } - if (speex_serialno == -1 || os.serialno != speex_serialno) - break; - /*If first packet, process as Speex header*/ - if (packet_count==0) - { - st = process_header(&op, enh_enabled, &frame_size, &granule_frame_size, &rate, &nframes, forceMode, &channels, &stereo, &extra_headers, quiet); - if (!st) - exit(1); - speex_decoder_ctl(st, SPEEX_GET_LOOKAHEAD, &lookahead); - if (!nframes) - nframes=1; - fout = out_file_open(outFile, rate, &channels); - - } else if (packet_count==1) - { - if (!quiet) - print_comments((char*)op.packet, op.bytes); - } else if (packet_count<=1+extra_headers) - { - /* Ignore extra headers */ - } else { - int lost=0; - packet_no++; - if (loss_percent>0 && 100*((float)rand())/RAND_MAX<loss_percent) - lost=1; - - /*End of stream condition*/ - if (op.e_o_s && os.serialno == speex_serialno) /* don't care for anything except speex eos */ - eos=1; - - /*Copy Ogg packet to Speex bitstream*/ - speex_bits_read_from(&bits, (char*)op.packet, op.bytes); - for (j=0;j!=nframes;j++) - { - int ret; - /*Decode frame*/ - if (!lost) - ret = speex_decode_int(st, &bits, output); - else - ret = speex_decode_int(st, NULL, output); - - /*for (i=0;i<frame_size*channels;i++) - printf ("%d\n", (int)output[i]);*/ - - if (ret==-1) - break; - if (ret==-2) - { - fprintf (stderr, "Decoding error: corrupted stream?\n"); - break; - } - if (speex_bits_remaining(&bits)<0) - { - fprintf (stderr, "Decoding overflow: corrupted stream?\n"); - break; - } - if (channels==2) - speex_decode_stereo_int(output, frame_size, &stereo); - - if (print_bitrate) { - spx_int32_t tmp; - char ch=13; - speex_decoder_ctl(st, SPEEX_GET_BITRATE, &tmp); - fputc (ch, stderr); - fprintf (stderr, "Bitrate is use: %d bps ", tmp); - } - /*Convert to short and save to output file*/ - if (strlen(outFile)!=0) - { - for (i=0;i<frame_size*channels;i++) - out[i]=le_short(output[i]); - } else { - for (i=0;i<frame_size*channels;i++) - out[i]=output[i]; - } - { - int frame_offset = 0; - int new_frame_size = frame_size; - /*printf ("packet %d %d\n", packet_no, skip_samples);*/ - /*fprintf (stderr, "packet %d %d %d\n", packet_no, skip_samples, lookahead);*/ - if (packet_no == 1 && j==0 && skip_samples > 0) - { - /*printf ("chopping first packet\n");*/ - new_frame_size -= skip_samples+lookahead; - frame_offset = skip_samples+lookahead; - } - if (packet_no == page_nb_packets && skip_samples < 0) - { - int packet_length = nframes*frame_size+skip_samples+lookahead; - new_frame_size = packet_length - j*frame_size; - if (new_frame_size<0) - new_frame_size = 0; - if (new_frame_size>frame_size) - new_frame_size = frame_size; - /*printf ("chopping end: %d %d %d\n", new_frame_size, packet_length, packet_no);*/ - } - if (new_frame_size>0) - { -#if defined WIN32 || defined _WIN32 - if (strlen(outFile)==0) - WIN_Play_Samples (out+frame_offset*channels, sizeof(short) * new_frame_size*channels); - else -#endif - fwrite(out+frame_offset*channels, sizeof(short), new_frame_size*channels, fout); - - audio_size+=sizeof(short)*new_frame_size*channels; - } - } - } - } - packet_count++; - } - } - if (feof(fin)) - break; - - } - - if (fout && wav_format) - { - if (fseek(fout,4,SEEK_SET)==0) - { - int tmp; - tmp = le_int(audio_size+36); - fwrite(&tmp,4,1,fout); - if (fseek(fout,32,SEEK_CUR)==0) - { - tmp = le_int(audio_size); - fwrite(&tmp,4,1,fout); - } else - { - fprintf (stderr, "First seek worked, second didn't\n"); - } - } else { - fprintf (stderr, "Cannot seek on wave file, size will be incorrect\n"); - } - } - - if (st) - speex_decoder_destroy(st); - else - { - fprintf (stderr, "This doesn't look like a Speex file\n"); - } - speex_bits_destroy(&bits); - if (stream_init) - ogg_stream_clear(&os); - ogg_sync_clear(&oy); - -#if defined WIN32 || defined _WIN32 - if (strlen(outFile)==0) - WIN_Audio_close (); -#endif - - if (close_in) - fclose(fin); - if (fout != NULL) - fclose(fout); - - return 0; -} diff --git a/src/lib/dl/ext/speex/speexenc.c b/src/lib/dl/ext/speex/speexenc.c deleted file mode 100755 index 649fc8e6..00000000 --- a/src/lib/dl/ext/speex/speexenc.c +++ /dev/null @@ -1,996 +0,0 @@ -/* Copyright (C) 2002-2006 Jean-Marc Valin - File: speexenc.c - - 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. -*/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <stdio.h> -#if !defined WIN32 && !defined _WIN32 -#include <unistd.h> -#endif -#ifdef HAVE_GETOPT_H -#include "getopt.h" -#endif -#ifndef HAVE_GETOPT_LONG -#include "getopt_win.h" -#endif -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include <speex/speex.h> -#include <ext/libogg/ogg.h> -#include "wav_io.h" -#include <speex/speex_header.h> -#include <speex/speex_stereo.h> -#include <speex/speex_preprocess.h> - -#if defined WIN32 || defined _WIN32 -/* We need the following two to set stdout to binary */ -#include <io.h> -#include <fcntl.h> -#endif - -#include "skeleton.h" - - -void comment_init(char **comments, int* length, char *vendor_string); -void comment_add(char **comments, int* length, char *tag, char *val); - - -/*Write an Ogg page to a file pointer*/ -int oe_write_page(ogg_page *page, FILE *fp) -{ - int written; - written = fwrite(page->header,1,page->header_len, fp); - written += fwrite(page->body,1,page->body_len, fp); - - return written; -} - -#define MAX_FRAME_SIZE 2000 -#define MAX_FRAME_BYTES 2000 - -/* Convert input audio bits, endians and channels */ -static int read_samples(FILE *fin,int frame_size, int bits, int channels, int lsb, short * input, char *buff, spx_int32_t *size) -{ - unsigned char in[MAX_FRAME_BYTES*2]; - int i; - short *s; - int nb_read; - - if (size && *size<=0) - { - return 0; - } - /*Read input audio*/ - if (size) - *size -= bits/8*channels*frame_size; - if (buff) - { - for (i=0;i<12;i++) - in[i]=buff[i]; - nb_read = fread(in+12,1,bits/8*channels*frame_size-12, fin) + 12; - if (size) - *size += 12; - } else { - nb_read = fread(in,1,bits/8*channels* frame_size, fin); - } - nb_read /= bits/8*channels; - - /*fprintf (stderr, "%d\n", nb_read);*/ - if (nb_read==0) - return 0; - - s=(short*)in; - if(bits==8) - { - /* Convert 8->16 bits */ - for(i=frame_size*channels-1;i>=0;i--) - { - s[i]=(in[i]<<8)^0x8000; - } - } else - { - /* convert to our endian format */ - for(i=0;i<frame_size*channels;i++) - { - if(lsb) - s[i]=le_short(s[i]); - else - s[i]=be_short(s[i]); - } - } - - /* FIXME: This is probably redundent now */ - /* copy to float input buffer */ - for (i=0;i<frame_size*channels;i++) - { - input[i]=(short)s[i]; - } - - for (i=nb_read*channels;i<frame_size*channels;i++) - { - input[i]=0; - } - - - return nb_read; -} - -void add_fishead_packet (ogg_stream_state *os) { - - fishead_packet fp; - - memset(&fp, 0, sizeof(fp)); - fp.ptime_n = 0; - fp.ptime_d = 1000; - fp.btime_n = 0; - fp.btime_d = 1000; - - add_fishead_to_stream(os, &fp); -} - -/* - * Adds the fishead packets in the skeleton output stream along with the e_o_s packet - */ -void add_fisbone_packet (ogg_stream_state *os, spx_int32_t serialno, SpeexHeader *header) { - - fisbone_packet fp; - - memset(&fp, 0, sizeof(fp)); - fp.serial_no = serialno; - fp.nr_header_packet = 2 + header->extra_headers; - fp.granule_rate_n = header->rate; - fp.granule_rate_d = 1; - fp.start_granule = 0; - fp.preroll = 3; - fp.granule_shift = 0; - - add_message_header_field(&fp, "Content-Type", "audio/x-speex"); - - add_fisbone_to_stream(os, &fp); -} - -void version() -{ - const char* speex_version; - speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version); - printf ("speexenc (Speex encoder) version %s (compiled " __DATE__ ")\n", speex_version); - printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n"); -} - -void version_short() -{ - const char* speex_version; - speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version); - printf ("speexenc version %s\n", speex_version); - printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n"); -} - -void usage() -{ - printf ("Usage: speexenc [options] input_file output_file\n"); - printf ("\n"); - printf ("Encodes input_file using Speex. It can read the WAV or raw files.\n"); - printf ("\n"); - printf ("input_file can be:\n"); - printf (" filename.wav wav file\n"); - printf (" filename.* Raw PCM file (any extension other than .wav)\n"); - printf (" - stdin\n"); - printf ("\n"); - printf ("output_file can be:\n"); - printf (" filename.spx Speex file\n"); - printf (" - stdout\n"); - printf ("\n"); - printf ("Options:\n"); - printf (" -n, --narrowband Narrowband (8 kHz) input file\n"); - printf (" -w, --wideband Wideband (16 kHz) input file\n"); - printf (" -u, --ultra-wideband \"Ultra-wideband\" (32 kHz) input file\n"); - printf (" --quality n Encoding quality (0-10), default 8\n"); - printf (" --bitrate n Encoding bit-rate (use bit-rate n or lower)\n"); - printf (" --vbr Enable variable bit-rate (VBR)\n"); - printf (" --vbr-max-bitrate Set max VBR bit-rate allowed\n"); - printf (" --abr rate Enable average bit-rate (ABR) at rate bps\n"); - printf (" --vad Enable voice activity detection (VAD)\n"); - printf (" --dtx Enable file-based discontinuous transmission (DTX)\n"); - printf (" --comp n Set encoding complexity (0-10), default 3\n"); - printf (" --nframes n Number of frames per Ogg packet (1-10), default 1\n"); - printf (" --denoise Denoise the input before encoding\n"); - printf (" --agc Apply adaptive gain control (AGC) before encoding\n"); - printf (" --skeleton Outputs ogg skeleton metadata (may cause incompatibilities)\n"); - printf (" --comment Add the given string as an extra comment. This may be\n"); - printf (" used multiple times\n"); - printf (" --author Author of this track\n"); - printf (" --title Title for this track\n"); - printf (" -h, --help This help\n"); - printf (" -v, --version Version information\n"); - printf (" -V Verbose mode (show bit-rate)\n"); - printf ("Raw input options:\n"); - printf (" --rate n Sampling rate for raw input\n"); - printf (" --stereo Consider raw input as stereo\n"); - printf (" --le Raw input is little-endian\n"); - printf (" --be Raw input is big-endian\n"); - printf (" --8bit Raw input is 8-bit unsigned\n"); - printf (" --16bit Raw input is 16-bit signed\n"); - printf ("Default raw PCM input is 16-bit, little-endian, mono\n"); - printf ("\n"); - printf ("More information is available from the Speex site: http://www.speex.org\n"); - printf ("\n"); - printf ("Please report bugs to the mailing list `speex-dev@xiph.org'.\n"); -} - - -int main(int argc, char **argv) -{ - int nb_samples, total_samples=0, nb_encoded; - int c; - int option_index = 0; - char *inFile, *outFile; - FILE *fin, *fout; - short input[MAX_FRAME_SIZE]; - spx_int32_t frame_size; - int quiet=0; - spx_int32_t vbr_enabled=0; - spx_int32_t vbr_max=0; - int abr_enabled=0; - spx_int32_t vad_enabled=0; - spx_int32_t dtx_enabled=0; - int nbBytes; - const SpeexMode *mode=NULL; - int modeID = -1; - void *st; - SpeexBits bits; - char cbits[MAX_FRAME_BYTES]; - int with_skeleton = 0; - struct option long_options[] = - { - {"wideband", no_argument, NULL, 0}, - {"ultra-wideband", no_argument, NULL, 0}, - {"narrowband", no_argument, NULL, 0}, - {"vbr", no_argument, NULL, 0}, - {"vbr-max-bitrate", required_argument, NULL, 0}, - {"abr", required_argument, NULL, 0}, - {"vad", no_argument, NULL, 0}, - {"dtx", no_argument, NULL, 0}, - {"quality", required_argument, NULL, 0}, - {"bitrate", required_argument, NULL, 0}, - {"nframes", required_argument, NULL, 0}, - {"comp", required_argument, NULL, 0}, - {"denoise", no_argument, NULL, 0}, - {"agc", no_argument, NULL, 0}, - {"skeleton",no_argument,NULL, 0}, - {"help", no_argument, NULL, 0}, - {"quiet", no_argument, NULL, 0}, - {"le", no_argument, NULL, 0}, - {"be", no_argument, NULL, 0}, - {"8bit", no_argument, NULL, 0}, - {"16bit", no_argument, NULL, 0}, - {"stereo", no_argument, NULL, 0}, - {"rate", required_argument, NULL, 0}, - {"version", no_argument, NULL, 0}, - {"version-short", no_argument, NULL, 0}, - {"comment", required_argument, NULL, 0}, - {"author", required_argument, NULL, 0}, - {"title", required_argument, NULL, 0}, - {0, 0, 0, 0} - }; - int print_bitrate=0; - spx_int32_t rate=0; - spx_int32_t size; - int chan=1; - int fmt=16; - spx_int32_t quality=-1; - float vbr_quality=-1; - int lsb=1; - ogg_stream_state os; - ogg_stream_state so; /* ogg stream for skeleton bitstream */ - ogg_page og; - ogg_packet op; - int bytes_written=0, ret, result; - int id=-1; - SpeexHeader header; - int nframes=1; - spx_int32_t complexity=3; - const char* speex_version; - char vendor_string[64]; - char *comments; - int comments_length; - int close_in=0, close_out=0; - int eos=0; - spx_int32_t bitrate=0; - double cumul_bits=0, enc_frames=0; - char first_bytes[12]; - int wave_input=0; - spx_int32_t tmp; - SpeexPreprocessState *preprocess = NULL; - int denoise_enabled=0, agc_enabled=0; - spx_int32_t lookahead = 0; - - speex_lib_ctl(SPEEX_LIB_GET_VERSION_STRING, (void*)&speex_version); - snprintf(vendor_string, sizeof(vendor_string), "Encoded with Speex %s", speex_version); - - comment_init(&comments, &comments_length, vendor_string); - - /*Process command-line options*/ - while(1) - { - c = getopt_long (argc, argv, "nwuhvV", - long_options, &option_index); - if (c==-1) - break; - - switch(c) - { - case 0: - if (strcmp(long_options[option_index].name,"narrowband")==0) - { - modeID = SPEEX_MODEID_NB; - } else if (strcmp(long_options[option_index].name,"wideband")==0) - { - modeID = SPEEX_MODEID_WB; - } else if (strcmp(long_options[option_index].name,"ultra-wideband")==0) - { - modeID = SPEEX_MODEID_UWB; - } else if (strcmp(long_options[option_index].name,"vbr")==0) - { - vbr_enabled=1; - } else if (strcmp(long_options[option_index].name,"vbr-max-bitrate")==0) - { - vbr_max=atoi(optarg); - if (vbr_max<1) - { - fprintf (stderr, "Invalid VBR max bit-rate value: %d\n", vbr_max); - exit(1); - } - } else if (strcmp(long_options[option_index].name,"abr")==0) - { - abr_enabled=atoi(optarg); - if (!abr_enabled) - { - fprintf (stderr, "Invalid ABR value: %d\n", abr_enabled); - exit(1); - } - } else if (strcmp(long_options[option_index].name,"vad")==0) - { - vad_enabled=1; - } else if (strcmp(long_options[option_index].name,"dtx")==0) - { - dtx_enabled=1; - } else if (strcmp(long_options[option_index].name,"quality")==0) - { - quality = atoi (optarg); - vbr_quality=atof(optarg); - } else if (strcmp(long_options[option_index].name,"bitrate")==0) - { - bitrate = atoi (optarg); - } else if (strcmp(long_options[option_index].name,"nframes")==0) - { - nframes = atoi (optarg); - if (nframes<1) - nframes=1; - if (nframes>10) - nframes=10; - } else if (strcmp(long_options[option_index].name,"comp")==0) - { - complexity = atoi (optarg); - } else if (strcmp(long_options[option_index].name,"denoise")==0) - { - denoise_enabled=1; - } else if (strcmp(long_options[option_index].name,"agc")==0) - { - agc_enabled=1; - } else if (strcmp(long_options[option_index].name,"skeleton")==0) - { - with_skeleton=1; - } else if (strcmp(long_options[option_index].name,"help")==0) - { - usage(); - exit(0); - } else if (strcmp(long_options[option_index].name,"quiet")==0) - { - quiet = 1; - } else if (strcmp(long_options[option_index].name,"version")==0) - { - version(); - exit(0); - } else if (strcmp(long_options[option_index].name,"version-short")==0) - { - version_short(); - exit(0); - } else if (strcmp(long_options[option_index].name,"le")==0) - { - lsb=1; - } else if (strcmp(long_options[option_index].name,"be")==0) - { - lsb=0; - } else if (strcmp(long_options[option_index].name,"8bit")==0) - { - fmt=8; - } else if (strcmp(long_options[option_index].name,"16bit")==0) - { - fmt=16; - } else if (strcmp(long_options[option_index].name,"stereo")==0) - { - chan=2; - } else if (strcmp(long_options[option_index].name,"rate")==0) - { - rate=atoi (optarg); - } else if (strcmp(long_options[option_index].name,"comment")==0) - { - if (!strchr(optarg, '=')) - { - fprintf (stderr, "Invalid comment: %s\n", optarg); - fprintf (stderr, "Comments must be of the form name=value\n"); - exit(1); - } - comment_add(&comments, &comments_length, NULL, optarg); - } else if (strcmp(long_options[option_index].name,"author")==0) - { - comment_add(&comments, &comments_length, "author=", optarg); - } else if (strcmp(long_options[option_index].name,"title")==0) - { - comment_add(&comments, &comments_length, "title=", optarg); - } - - break; - case 'n': - modeID = SPEEX_MODEID_NB; - break; - case 'h': - usage(); - exit(0); - break; - case 'v': - version(); - exit(0); - break; - case 'V': - print_bitrate=1; - break; - case 'w': - modeID = SPEEX_MODEID_WB; - break; - case 'u': - modeID = SPEEX_MODEID_UWB; - break; - case '?': - usage(); - exit(1); - break; - } - } - if (argc-optind!=2) - { - usage(); - exit(1); - } - inFile=argv[optind]; - outFile=argv[optind+1]; - - /*Initialize Ogg stream struct*/ - srand(time(NULL)); - if (ogg_stream_init(&os, rand())==-1) - { - fprintf(stderr,"Error: stream init failed\n"); - exit(1); - } - if (with_skeleton && ogg_stream_init(&so, rand())==-1) - { - fprintf(stderr,"Error: stream init failed\n"); - exit(1); - } - - if (strcmp(inFile, "-")==0) - { -#if defined WIN32 || defined _WIN32 - _setmode(_fileno(stdin), _O_BINARY); -#elif defined OS2 - _fsetmode(stdin,"b"); -#endif - fin=stdin; - } - else - { - fin = fopen(inFile, "rb"); - if (!fin) - { - perror(inFile); - exit(1); - } - close_in=1; - } - - { - fread(first_bytes, 1, 12, fin); - if (strncmp(first_bytes,"RIFF",4)==0 && strncmp(first_bytes,"RIFF",4)==0) - { - if (read_wav_header(fin, &rate, &chan, &fmt, &size)==-1) - exit(1); - wave_input=1; - lsb=1; /* CHECK: exists big-endian .wav ?? */ - } - } - - if (modeID==-1 && !rate) - { - /* By default, use narrowband/8 kHz */ - modeID = SPEEX_MODEID_NB; - rate=8000; - } else if (modeID!=-1 && rate) - { - mode = speex_lib_get_mode (modeID); - if (rate>48000) - { - fprintf (stderr, "Error: sampling rate too high: %d Hz, try down-sampling\n", rate); - exit(1); - } else if (rate>25000) - { - if (modeID != SPEEX_MODEID_UWB) - { - fprintf (stderr, "Warning: Trying to encode in %s at %d Hz. I'll do it but I suggest you try ultra-wideband instead\n", mode->modeName , rate); - } - } else if (rate>12500) - { - if (modeID != SPEEX_MODEID_WB) - { - fprintf (stderr, "Warning: Trying to encode in %s at %d Hz. I'll do it but I suggest you try wideband instead\n", mode->modeName , rate); - } - } else if (rate>=6000) - { - if (modeID != SPEEX_MODEID_NB) - { - fprintf (stderr, "Warning: Trying to encode in %s at %d Hz. I'll do it but I suggest you try narrowband instead\n", mode->modeName , rate); - } - } else { - fprintf (stderr, "Error: sampling rate too low: %d Hz\n", rate); - exit(1); - } - } else if (modeID==-1) - { - if (rate>48000) - { - fprintf (stderr, "Error: sampling rate too high: %d Hz, try down-sampling\n", rate); - exit(1); - } else if (rate>25000) - { - modeID = SPEEX_MODEID_UWB; - } else if (rate>12500) - { - modeID = SPEEX_MODEID_WB; - } else if (rate>=6000) - { - modeID = SPEEX_MODEID_NB; - } else { - fprintf (stderr, "Error: Sampling rate too low: %d Hz\n", rate); - exit(1); - } - } else if (!rate) - { - if (modeID == SPEEX_MODEID_NB) - rate=8000; - else if (modeID == SPEEX_MODEID_WB) - rate=16000; - else if (modeID == SPEEX_MODEID_UWB) - rate=32000; - } - - if (!quiet) - if (rate!=8000 && rate!=16000 && rate!=32000) - fprintf (stderr, "Warning: Speex is only optimized for 8, 16 and 32 kHz. It will still work at %d Hz but your mileage may vary\n", rate); - - if (!mode) - mode = speex_lib_get_mode (modeID); - - speex_init_header(&header, rate, 1, mode); - header.frames_per_packet=nframes; - header.vbr=vbr_enabled; - header.nb_channels = chan; - - { - char *st_string="mono"; - if (chan==2) - st_string="stereo"; - if (!quiet) - fprintf (stderr, "Encoding %d Hz audio using %s mode (%s)\n", - header.rate, mode->modeName, st_string); - } - /*fprintf (stderr, "Encoding %d Hz audio at %d bps using %s mode\n", - header.rate, mode->bitrate, mode->modeName);*/ - - /*Initialize Speex encoder*/ - st = speex_encoder_init(mode); - - if (strcmp(outFile,"-")==0) - { -#if defined WIN32 || defined _WIN32 - _setmode(_fileno(stdout), _O_BINARY); -#endif - fout=stdout; - } - else - { - fout = fopen(outFile, "wb"); - if (!fout) - { - perror(outFile); - exit(1); - } - close_out=1; - } - - speex_encoder_ctl(st, SPEEX_GET_FRAME_SIZE, &frame_size); - speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &complexity); - speex_encoder_ctl(st, SPEEX_SET_SAMPLING_RATE, &rate); - - if (quality >= 0) - { - if (vbr_enabled) - { - if (vbr_max>0) - speex_encoder_ctl(st, SPEEX_SET_VBR_MAX_BITRATE, &vbr_max); - speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_quality); - } - else - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &quality); - } - if (bitrate) - { - if (quality >= 0 && vbr_enabled) - fprintf (stderr, "Warning: --bitrate option is overriding --quality\n"); - speex_encoder_ctl(st, SPEEX_SET_BITRATE, &bitrate); - } - if (vbr_enabled) - { - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); - } else if (vad_enabled) - { - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_VAD, &tmp); - } - if (dtx_enabled) - speex_encoder_ctl(st, SPEEX_SET_DTX, &tmp); - if (dtx_enabled && !(vbr_enabled || abr_enabled || vad_enabled)) - { - fprintf (stderr, "Warning: --dtx is useless without --vad, --vbr or --abr\n"); - } else if ((vbr_enabled || abr_enabled) && (vad_enabled)) - { - fprintf (stderr, "Warning: --vad is already implied by --vbr or --abr\n"); - } - if (with_skeleton) { - fprintf (stderr, "Warning: Enabling skeleton output may cause some decoders to fail.\n"); - } - - if (abr_enabled) - { - speex_encoder_ctl(st, SPEEX_SET_ABR, &abr_enabled); - } - - speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &lookahead); - - if (denoise_enabled || agc_enabled) - { - preprocess = speex_preprocess_state_init(frame_size, rate); - speex_preprocess_ctl(preprocess, SPEEX_PREPROCESS_SET_DENOISE, &denoise_enabled); - speex_preprocess_ctl(preprocess, SPEEX_PREPROCESS_SET_AGC, &agc_enabled); - lookahead += frame_size; - } - - /* first packet should be the skeleton header. */ - - if (with_skeleton) { - add_fishead_packet(&so); - if ((ret = flush_ogg_stream_to_file(&so, fout))) { - fprintf (stderr,"Error: failed skeleton (fishead) header to output stream\n"); - exit(1); - } else - bytes_written += ret; - } - - /*Write header*/ - { - int packet_size; - op.packet = (unsigned char *)speex_header_to_packet(&header, &packet_size); - op.bytes = packet_size; - op.b_o_s = 1; - op.e_o_s = 0; - op.granulepos = 0; - op.packetno = 0; - ogg_stream_packetin(&os, &op); - free(op.packet); - - while((result = ogg_stream_flush(&os, &og))) - { - if(!result) break; - ret = oe_write_page(&og, fout); - if(ret != og.header_len + og.body_len) - { - fprintf (stderr,"Error: failed writing header to output stream\n"); - exit(1); - } - else - bytes_written += ret; - } - - op.packet = (unsigned char *)comments; - op.bytes = comments_length; - op.b_o_s = 0; - op.e_o_s = 0; - op.granulepos = 0; - op.packetno = 1; - ogg_stream_packetin(&os, &op); - } - - /* fisbone packet should be write after all bos pages */ - if (with_skeleton) { - add_fisbone_packet(&so, os.serialno, &header); - if ((ret = flush_ogg_stream_to_file(&so, fout))) { - fprintf (stderr,"Error: failed writing skeleton (fisbone )header to output stream\n"); - exit(1); - } else - bytes_written += ret; - } - - /* writing the rest of the speex header packets */ - while((result = ogg_stream_flush(&os, &og))) - { - if(!result) break; - ret = oe_write_page(&og, fout); - if(ret != og.header_len + og.body_len) - { - fprintf (stderr,"Error: failed writing header to output stream\n"); - exit(1); - } - else - bytes_written += ret; - } - - free(comments); - - /* write the skeleton eos packet */ - if (with_skeleton) { - add_eos_packet_to_stream(&so); - if ((ret = flush_ogg_stream_to_file(&so, fout))) { - fprintf (stderr,"Error: failed writing skeleton header to output stream\n"); - exit(1); - } else - bytes_written += ret; - } - - - speex_bits_init(&bits); - - if (!wave_input) - { - nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, first_bytes, NULL); - } else { - nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, &size); - } - if (nb_samples==0) - eos=1; - total_samples += nb_samples; - nb_encoded = -lookahead; - /*Main encoding loop (one frame per iteration)*/ - while (!eos || total_samples>nb_encoded) - { - id++; - /*Encode current frame*/ - if (chan==2) - speex_encode_stereo_int(input, frame_size, &bits); - - if (preprocess) - speex_preprocess(preprocess, input, NULL); - - speex_encode_int(st, input, &bits); - - nb_encoded += frame_size; - if (print_bitrate) { - int tmp; - char ch=13; - speex_encoder_ctl(st, SPEEX_GET_BITRATE, &tmp); - fputc (ch, stderr); - cumul_bits += tmp; - enc_frames += 1; - if (!quiet) - { - if (vad_enabled || vbr_enabled || abr_enabled) - fprintf (stderr, "Bitrate is use: %d bps (average %d bps) ", tmp, (int)(cumul_bits/enc_frames)); - else - fprintf (stderr, "Bitrate is use: %d bps ", tmp); - } - - } - - if (wave_input) - { - nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, &size); - } else { - nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, NULL); - } - if (nb_samples==0) - { - eos=1; - } - if (eos && total_samples<=nb_encoded) - op.e_o_s = 1; - else - op.e_o_s = 0; - total_samples += nb_samples; - - if ((id+1)%nframes!=0) - continue; - speex_bits_insert_terminator(&bits); - nbBytes = speex_bits_write(&bits, cbits, MAX_FRAME_BYTES); - speex_bits_reset(&bits); - op.packet = (unsigned char *)cbits; - op.bytes = nbBytes; - op.b_o_s = 0; - /*Is this redundent?*/ - if (eos && total_samples<=nb_encoded) - op.e_o_s = 1; - else - op.e_o_s = 0; - op.granulepos = (id+1)*frame_size-lookahead; - if (op.granulepos>total_samples) - op.granulepos = total_samples; - /*printf ("granulepos: %d %d %d %d %d %d\n", (int)op.granulepos, id, nframes, lookahead, 5, 6);*/ - op.packetno = 2+id/nframes; - ogg_stream_packetin(&os, &op); - - /*Write all new pages (most likely 0 or 1)*/ - while (ogg_stream_pageout(&os,&og)) - { - ret = oe_write_page(&og, fout); - if(ret != og.header_len + og.body_len) - { - fprintf (stderr,"Error: failed writing header to output stream\n"); - exit(1); - } - else - bytes_written += ret; - } - } - if ((id+1)%nframes!=0) - { - while ((id+1)%nframes!=0) - { - id++; - speex_bits_pack(&bits, 15, 5); - } - nbBytes = speex_bits_write(&bits, cbits, MAX_FRAME_BYTES); - op.packet = (unsigned char *)cbits; - op.bytes = nbBytes; - op.b_o_s = 0; - op.e_o_s = 1; - op.granulepos = (id+1)*frame_size-lookahead; - if (op.granulepos>total_samples) - op.granulepos = total_samples; - - op.packetno = 2+id/nframes; - ogg_stream_packetin(&os, &op); - } - /*Flush all pages left to be written*/ - while (ogg_stream_flush(&os, &og)) - { - ret = oe_write_page(&og, fout); - if(ret != og.header_len + og.body_len) - { - fprintf (stderr,"Error: failed writing header to output stream\n"); - exit(1); - } - else - bytes_written += ret; - } - - speex_encoder_destroy(st); - speex_bits_destroy(&bits); - ogg_stream_clear(&os); - - if (close_in) - fclose(fin); - if (close_out) - fclose(fout); - return 0; -} - -/* - Comments will be stored in the Vorbis style. - It is describled in the "Structure" section of - http://www.xiph.org/ogg/vorbis/doc/v-comment.html - -The comment header is decoded as follows: - 1) [vendor_length] = read an unsigned integer of 32 bits - 2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets - 3) [user_comment_list_length] = read an unsigned integer of 32 bits - 4) iterate [user_comment_list_length] times { - 5) [length] = read an unsigned integer of 32 bits - 6) this iteration's user comment = read a UTF-8 vector as [length] octets - } - 7) [framing_bit] = read a single bit as boolean - 8) if ( [framing_bit] unset or end of packet ) then ERROR - 9) done. - - If you have troubles, please write to ymnk@jcraft.com. - */ - -#define readint(buf, base) (((buf[base+3]<<24)&0xff000000)| \ - ((buf[base+2]<<16)&0xff0000)| \ - ((buf[base+1]<<8)&0xff00)| \ - (buf[base]&0xff)) -#define writeint(buf, base, val) do{ buf[base+3]=((val)>>24)&0xff; \ - buf[base+2]=((val)>>16)&0xff; \ - buf[base+1]=((val)>>8)&0xff; \ - buf[base]=(val)&0xff; \ - }while(0) - -void comment_init(char **comments, int* length, char *vendor_string) -{ - int vendor_length=strlen(vendor_string); - int user_comment_list_length=0; - int len=4+vendor_length+4; - char *p=(char*)malloc(len); - if(p==NULL){ - fprintf (stderr, "malloc failed in comment_init()\n"); - exit(1); - } - writeint(p, 0, vendor_length); - memcpy(p+4, vendor_string, vendor_length); - writeint(p, 4+vendor_length, user_comment_list_length); - *length=len; - *comments=p; -} -void comment_add(char **comments, int* length, char *tag, char *val) -{ - char* p=*comments; - int vendor_length=readint(p, 0); - int user_comment_list_length=readint(p, 4+vendor_length); - int tag_len=(tag?strlen(tag):0); - int val_len=strlen(val); - int len=(*length)+4+tag_len+val_len; - - p=(char*)realloc(p, len); - if(p==NULL){ - fprintf (stderr, "realloc failed in comment_add()\n"); - exit(1); - } - - writeint(p, *length, tag_len+val_len); /* length of comment */ - if(tag) memcpy(p+*length+4, tag, tag_len); /* comment */ - memcpy(p+*length+4+tag_len, val, val_len); /* comment */ - writeint(p, 4+vendor_length, user_comment_list_length+1); - - *comments=p; - *length=len; -} -#undef readint -#undef writeint diff --git a/src/lib/dl/ext/speex/stack_alloc.h b/src/lib/dl/ext/speex/stack_alloc.h deleted file mode 100755 index 5264e666..00000000 --- a/src/lib/dl/ext/speex/stack_alloc.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file stack_alloc.h - @brief Temporary memory allocation on stack -*/ -/* - 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 STACK_ALLOC_H -#define STACK_ALLOC_H - -#ifdef USE_ALLOCA -# ifdef WIN32 -# include <malloc.h> -# else -# ifdef HAVE_ALLOCA_H -# include <alloca.h> -# else -# include <stdlib.h> -# endif -# endif -#endif - -/** - * @def ALIGN(stack, size) - * - * Aligns the stack to a 'size' boundary - * - * @param stack Stack - * @param size New size boundary - */ - -/** - * @def PUSH(stack, size, type) - * - * Allocates 'size' elements of type 'type' on the stack - * - * @param stack Stack - * @param size Number of elements - * @param type Type of element - */ - -/** - * @def VARDECL(var) - * - * Declare variable on stack - * - * @param var Variable to declare - */ - -/** - * @def ALLOC(var, size, type) - * - * Allocate 'size' elements of 'type' on stack - * - * @param var Name of variable to allocate - * @param size Number of elements - * @param type Type of element - */ - -#ifdef ENABLE_VALGRIND - -#include <valgrind/memcheck.h> - -#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) - -#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type)))) - -#else - -#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) - -#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type)))) - -#endif - -#if defined(VAR_ARRAYS) -#define VARDECL(var) -#define ALLOC(var, size, type) type var[size] -#elif defined(USE_ALLOCA) -#define VARDECL(var) var -#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size)) -#else -#define VARDECL(var) var -#define ALLOC(var, size, type) var = PUSH(stack, size, type) -#endif - - -#endif diff --git a/src/lib/dl/ext/speex/stereo.c b/src/lib/dl/ext/speex/stereo.c deleted file mode 100755 index db5ea4a8..00000000 --- a/src/lib/dl/ext/speex/stereo.c +++ /dev/null @@ -1,296 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: stereo.c - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex_stereo.h> -#include <speex/speex_callbacks.h> -#include "math_approx.h" -#include "vq.h" -#include <math.h> -#include "os_support.h" - -typedef struct RealSpeexStereoState { - spx_word32_t balance; /**< Left/right balance info */ - spx_word32_t e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */ - spx_word32_t smooth_left; /**< Smoothed left channel gain */ - spx_word32_t smooth_right; /**< Smoothed right channel gain */ - spx_uint32_t reserved1; /**< Reserved for future use */ - spx_int32_t reserved2; /**< Reserved for future use */ -} RealSpeexStereoState; - - -/*float e_ratio_quant[4] = {1, 1.26, 1.587, 2};*/ -#ifndef FIXED_POINT -static const float e_ratio_quant[4] = {.25f, .315f, .397f, .5f}; -static const float e_ratio_quant_bounds[3] = {0.2825f, 0.356f, 0.4485f}; -#else -static const spx_word16_t e_ratio_quant[4] = {8192, 10332, 13009, 16384}; -static const spx_word16_t e_ratio_quant_bounds[3] = {9257, 11665, 14696}; -static const spx_word16_t balance_bounds[31] = {18, 23, 30, 38, 49, 63, 81, 104, - 134, 172, 221, 284, 364, 468, 600, 771, - 990, 1271, 1632, 2096, 2691, 3455, 4436, 5696, - 7314, 9392, 12059, 15484, 19882, 25529, 32766}; -#endif - -/* This is an ugly compatibility hack that properly resets the stereo state - In case it it compiled in fixed-point, but initialised with the deprecated - floating point static initialiser */ -#ifdef FIXED_POINT -#define COMPATIBILITY_HACK(s) do {if ((s)->reserved1 != 0xdeadbeef) speex_stereo_state_reset((SpeexStereoState*)s); } while (0); -#else -#define COMPATIBILITY_HACK(s) -#endif - -EXPORT SpeexStereoState *speex_stereo_state_init() -{ - SpeexStereoState *stereo = speex_alloc(sizeof(SpeexStereoState)); - speex_stereo_state_reset(stereo); - return stereo; -} - -EXPORT void speex_stereo_state_reset(SpeexStereoState *_stereo) -{ - RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo; -#ifdef FIXED_POINT - stereo->balance = 65536; - stereo->e_ratio = 16384; - stereo->smooth_left = 16384; - stereo->smooth_right = 16384; - stereo->reserved1 = 0xdeadbeef; - stereo->reserved2 = 0; -#else - stereo->balance = 1.0f; - stereo->e_ratio = .5f; - stereo->smooth_left = 1.f; - stereo->smooth_right = 1.f; - stereo->reserved1 = 0; - stereo->reserved2 = 0; -#endif -} - -EXPORT void speex_stereo_state_destroy(SpeexStereoState *stereo) -{ - speex_free(stereo); -} - -#ifndef DISABLE_FLOAT_API -EXPORT void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits) -{ - int i, tmp; - float e_left=0, e_right=0, e_tot=0; - float balance, e_ratio; - for (i=0;i<frame_size;i++) - { - e_left += ((float)data[2*i])*data[2*i]; - e_right += ((float)data[2*i+1])*data[2*i+1]; - data[i] = .5*(((float)data[2*i])+data[2*i+1]); - e_tot += ((float)data[i])*data[i]; - } - balance=(e_left+1)/(e_right+1); - e_ratio = e_tot/(1+e_left+e_right); - - /*Quantization*/ - speex_bits_pack(bits, 14, 5); - speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4); - - balance=4*log(balance); - - /*Pack sign*/ - if (balance>0) - speex_bits_pack(bits, 0, 1); - else - speex_bits_pack(bits, 1, 1); - balance=floor(.5+fabs(balance)); - if (balance>30) - balance=31; - - speex_bits_pack(bits, (int)balance, 5); - - /* FIXME: this is a hack */ - tmp=scal_quant(e_ratio*Q15_ONE, e_ratio_quant_bounds, 4); - speex_bits_pack(bits, tmp, 2); -} -#endif /* #ifndef DISABLE_FLOAT_API */ - -EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits) -{ - int i, tmp; - spx_word32_t e_left=0, e_right=0, e_tot=0; - spx_word32_t balance, e_ratio; - spx_word32_t largest, smallest; - int balance_id; -#ifdef FIXED_POINT - int shift; -#endif - - /* In band marker */ - speex_bits_pack(bits, 14, 5); - /* Stereo marker */ - speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4); - - for (i=0;i<frame_size;i++) - { - e_left += SHR32(MULT16_16(data[2*i],data[2*i]),8); - e_right += SHR32(MULT16_16(data[2*i+1],data[2*i+1]),8); -#ifdef FIXED_POINT - /* I think this is actually unbiased */ - data[i] = SHR16(data[2*i],1)+PSHR16(data[2*i+1],1); -#else - data[i] = .5*(((float)data[2*i])+data[2*i+1]); -#endif - e_tot += SHR32(MULT16_16(data[i],data[i]),8); - } - if (e_left > e_right) - { - speex_bits_pack(bits, 0, 1); - largest = e_left; - smallest = e_right; - } else { - speex_bits_pack(bits, 1, 1); - largest = e_right; - smallest = e_left; - } - - /* Balance quantization */ -#ifdef FIXED_POINT - shift = spx_ilog2(largest)-15; - largest = VSHR32(largest, shift-4); - smallest = VSHR32(smallest, shift); - balance = DIV32(largest, ADD32(smallest, 1)); - if (balance > 32767) - balance = 32767; - balance_id = scal_quant(EXTRACT16(balance), balance_bounds, 32); -#else - balance=(largest+1.)/(smallest+1.); - balance=4*log(balance); - balance_id=floor(.5+fabs(balance)); - if (balance_id>30) - balance_id=31; -#endif - - speex_bits_pack(bits, balance_id, 5); - - /* "coherence" quantisation */ -#ifdef FIXED_POINT - shift = spx_ilog2(e_tot); - e_tot = VSHR32(e_tot, shift-25); - e_left = VSHR32(e_left, shift-10); - e_right = VSHR32(e_right, shift-10); - e_ratio = DIV32(e_tot, e_left+e_right+1); -#else - e_ratio = e_tot/(1.+e_left+e_right); -#endif - - tmp=scal_quant(EXTRACT16(e_ratio), e_ratio_quant_bounds, 4); - /*fprintf (stderr, "%d %d %d %d\n", largest, smallest, balance_id, e_ratio);*/ - speex_bits_pack(bits, tmp, 2); -} - -#ifndef DISABLE_FLOAT_API -EXPORT void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *_stereo) -{ - int i; - spx_word32_t balance; - spx_word16_t e_left, e_right, e_ratio; - RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo; - - COMPATIBILITY_HACK(stereo); - - balance=stereo->balance; - e_ratio=stereo->e_ratio; - - /* These two are Q14, with max value just below 2. */ - e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance)))); - e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8); - - for (i=frame_size-1;i>=0;i--) - { - spx_word16_t tmp=data[i]; - stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15)); - stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15)); - data[2*i] = (float)MULT16_16_P14(stereo->smooth_left, tmp); - data[2*i+1] = (float)MULT16_16_P14(stereo->smooth_right, tmp); - } -} -#endif /* #ifndef DISABLE_FLOAT_API */ - -EXPORT void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *_stereo) -{ - int i; - spx_word32_t balance; - spx_word16_t e_left, e_right, e_ratio; - RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo; - - COMPATIBILITY_HACK(stereo); - - balance=stereo->balance; - e_ratio=stereo->e_ratio; - - /* These two are Q14, with max value just below 2. */ - e_right = DIV32(QCONST32(1., 22), spx_sqrt(MULT16_32_Q15(e_ratio, ADD32(QCONST32(1., 16), balance)))); - e_left = SHR32(MULT16_16(spx_sqrt(balance), e_right), 8); - - for (i=frame_size-1;i>=0;i--) - { - spx_int16_t tmp=data[i]; - stereo->smooth_left = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_left, QCONST16(0.98, 15)), e_left, QCONST16(0.02, 15)), 15)); - stereo->smooth_right = EXTRACT16(PSHR32(MAC16_16(MULT16_16(stereo->smooth_right, QCONST16(0.98, 15)), e_right, QCONST16(0.02, 15)), 15)); - data[2*i] = (spx_int16_t)MULT16_16_P14(stereo->smooth_left, tmp); - data[2*i+1] = (spx_int16_t)MULT16_16_P14(stereo->smooth_right, tmp); - } -} - -EXPORT int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data) -{ - RealSpeexStereoState *stereo; - spx_word16_t sign=1, dexp; - int tmp; - - stereo = (RealSpeexStereoState*)data; - - COMPATIBILITY_HACK(stereo); - - if (speex_bits_unpack_unsigned(bits, 1)) - sign=-1; - dexp = speex_bits_unpack_unsigned(bits, 5); -#ifndef FIXED_POINT - stereo->balance = exp(sign*.25*dexp); -#else - stereo->balance = spx_exp(MULT16_16(sign, SHL16(dexp, 9))); -#endif - tmp = speex_bits_unpack_unsigned(bits, 2); - stereo->e_ratio = e_ratio_quant[tmp]; - - return 0; -} diff --git a/src/lib/dl/ext/speex/testdenoise.c b/src/lib/dl/ext/speex/testdenoise.c deleted file mode 100755 index 49f51202..00000000 --- a/src/lib/dl/ext/speex/testdenoise.c +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex_preprocess.h> -#include <stdio.h> - -#define NN 160 - -int main() -{ - short in[NN]; - int i; - SpeexPreprocessState *st; - int count=0; - float f; - - st = speex_preprocess_state_init(NN, 8000); - i=1; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i); - i=0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i); - i=8000; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &i); - i=0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i); - f=.0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f); - f=.0; - speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f); - while (1) - { - int vad; - fread(in, sizeof(short), NN, stdin); - if (feof(stdin)) - break; - vad = speex_preprocess_run(st, in); - /*fprintf (stderr, "%d\n", vad);*/ - fwrite(in, sizeof(short), NN, stdout); - count++; - } - speex_preprocess_state_destroy(st); - return 0; -} diff --git a/src/lib/dl/ext/speex/testecho.c b/src/lib/dl/ext/speex/testecho.c deleted file mode 100755 index 5ae855f0..00000000 --- a/src/lib/dl/ext/speex/testecho.c +++ /dev/null @@ -1,53 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include "speex/speex_echo.h" -#include "speex/speex_preprocess.h" - - -#define NN 128 -#define TAIL 1024 - -int main(int argc, char **argv) -{ - FILE *echo_fd, *ref_fd, *e_fd; - short echo_buf[NN], ref_buf[NN], e_buf[NN]; - SpeexEchoState *st; - SpeexPreprocessState *den; - int sampleRate = 8000; - - if (argc != 4) - { - fprintf(stderr, "testecho mic_signal.sw speaker_signal.sw output.sw\n"); - exit(1); - } - echo_fd = fopen(argv[2], "rb"); - ref_fd = fopen(argv[1], "rb"); - e_fd = fopen(argv[3], "wb"); - - st = speex_echo_state_init(NN, TAIL); - den = speex_preprocess_state_init(NN, sampleRate); - speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &sampleRate); - speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st); - - while (!feof(ref_fd) && !feof(echo_fd)) - { - fread(ref_buf, sizeof(short), NN, ref_fd); - fread(echo_buf, sizeof(short), NN, echo_fd); - speex_echo_cancellation(st, ref_buf, echo_buf, e_buf); - speex_preprocess_run(den, e_buf); - fwrite(e_buf, sizeof(short), NN, e_fd); - } - speex_echo_state_destroy(st); - speex_preprocess_state_destroy(den); - fclose(e_fd); - fclose(echo_fd); - fclose(ref_fd); - return 0; -} diff --git a/src/lib/dl/ext/speex/testenc.c b/src/lib/dl/ext/speex/testenc.c deleted file mode 100755 index 44c132f1..00000000 --- a/src/lib/dl/ext/speex/testenc.c +++ /dev/null @@ -1,146 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex.h> -#include <stdio.h> -#include <stdlib.h> -#include <speex/speex_callbacks.h> - -#ifdef FIXED_DEBUG -extern long long spx_mips; -#endif - -#define FRAME_SIZE 160 -#include <math.h> -int main(int argc, char **argv) -{ - char *inFile, *outFile, *bitsFile; - FILE *fin, *fout, *fbits=NULL; - short in_short[FRAME_SIZE]; - short out_short[FRAME_SIZE]; - int snr_frames = 0; - char cbits[200]; - int nbBits; - int i; - void *st; - void *dec; - SpeexBits bits; - spx_int32_t tmp; - int bitCount=0; - spx_int32_t skip_group_delay; - SpeexCallback callback; - - st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB)); - dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_NB)); - - /* BEGIN: You probably don't need the following in a real application */ - callback.callback_id = SPEEX_INBAND_CHAR; - callback.func = speex_std_char_handler; - callback.data = stderr; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - callback.callback_id = SPEEX_INBAND_MODE_REQUEST; - callback.func = speex_std_mode_request_handler; - callback.data = st; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - /* END of unnecessary stuff */ - - tmp=1; - speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); - tmp=0; - speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); - tmp=8; - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); - - /* Turn this off if you want to measure SNR (on by default) */ - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp); - speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp); - - speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); - speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); - skip_group_delay += tmp; - - if (argc != 4 && argc != 3) - { - fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); - exit(1); - } - inFile = argv[1]; - fin = fopen(inFile, "rb"); - outFile = argv[2]; - fout = fopen(outFile, "wb+"); - if (argc==4) - { - bitsFile = argv[3]; - fbits = fopen(bitsFile, "wb"); - } - speex_bits_init(&bits); - while (!feof(fin)) - { - fread(in_short, sizeof(short), FRAME_SIZE, fin); - if (feof(fin)) - break; - speex_bits_reset(&bits); - - speex_encode_int(st, in_short, &bits); - nbBits = speex_bits_write(&bits, cbits, 200); - bitCount+=bits.nbBits; - - if (argc==4) - fwrite(cbits, 1, nbBits, fbits); - speex_bits_rewind(&bits); - - speex_decode_int(dec, &bits, out_short); - speex_bits_reset(&bits); - - fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); - skip_group_delay = 0; - } - fprintf (stderr, "Total encoded size: %d bits\n", bitCount); - speex_encoder_destroy(st); - speex_decoder_destroy(dec); - speex_bits_destroy(&bits); - -#ifndef DISABLE_FLOAT_API - { - float sigpow,errpow,snr, seg_snr=0; - sigpow = 0; - errpow = 0; - - /* This code just computes SNR, so you don't need it either */ - rewind(fin); - rewind(fout); - - while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) - && - FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) - { - float s=0, e=0; - for (i=0;i<FRAME_SIZE;++i) { - s += (float)in_short[i] * in_short[i]; - e += ((float)in_short[i]-out_short[i]) * ((float)in_short[i]-out_short[i]); - } - seg_snr += 10*log10((s+160)/(e+160)); - sigpow += s; - errpow += e; - snr_frames++; - } - snr = 10 * log10( sigpow / errpow ); - seg_snr /= snr_frames; - fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr); - -#ifdef FIXED_DEBUG - printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); -#endif - } -#endif - - fclose(fin); - fclose(fout); - - return 0; -} diff --git a/src/lib/dl/ext/speex/testenc_uwb.c b/src/lib/dl/ext/speex/testenc_uwb.c deleted file mode 100755 index 503b64dc..00000000 --- a/src/lib/dl/ext/speex/testenc_uwb.c +++ /dev/null @@ -1,137 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex.h> -#include <stdio.h> -#include <stdlib.h> -#include <speex/speex_callbacks.h> - -#ifdef FIXED_DEBUG -extern long long spx_mips; -#endif - -#define FRAME_SIZE 640 -#include <math.h> -int main(int argc, char **argv) -{ - char *inFile, *outFile, *bitsFile; - FILE *fin, *fout, *fbits=NULL; - short in_short[FRAME_SIZE]; - short out_short[FRAME_SIZE]; - float in_float[FRAME_SIZE]; - float sigpow,errpow,snr, seg_snr=0; - int snr_frames = 0; - char cbits[200]; - int nbBits; - int i; - void *st; - void *dec; - SpeexBits bits; - spx_int32_t tmp; - int bitCount=0; - spx_int32_t skip_group_delay; - SpeexCallback callback; - - sigpow = 0; - errpow = 0; - - st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB)); - dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB)); - - callback.callback_id = SPEEX_INBAND_CHAR; - callback.func = speex_std_char_handler; - callback.data = stderr; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - callback.callback_id = SPEEX_INBAND_MODE_REQUEST; - callback.func = speex_std_mode_request_handler; - callback.data = st; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - tmp=0; - speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); - tmp=0; - speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); - tmp=7; - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); - tmp=1; - speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); - - speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); - speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); - skip_group_delay += tmp; - - - if (argc != 4 && argc != 3) - { - fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); - exit(1); - } - inFile = argv[1]; - fin = fopen(inFile, "rb"); - outFile = argv[2]; - fout = fopen(outFile, "wb+"); - if (argc==4) - { - bitsFile = argv[3]; - fbits = fopen(bitsFile, "wb"); - } - speex_bits_init(&bits); - while (!feof(fin)) - { - fread(in_short, sizeof(short), FRAME_SIZE, fin); - if (feof(fin)) - break; - for (i=0;i<FRAME_SIZE;i++) - in_float[i]=in_short[i]; - speex_bits_reset(&bits); - - speex_encode_int(st, in_short, &bits); - nbBits = speex_bits_write(&bits, cbits, 200); - bitCount+=bits.nbBits; - - if (argc==4) - fwrite(cbits, 1, nbBits, fbits); - speex_bits_rewind(&bits); - - speex_decode_int(dec, &bits, out_short); - speex_bits_reset(&bits); - - fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); - skip_group_delay = 0; - } - fprintf (stderr, "Total encoded size: %d bits\n", bitCount); - speex_encoder_destroy(st); - speex_decoder_destroy(dec); - - rewind(fin); - rewind(fout); - - while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) - && - FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) - { - float s=0, e=0; - for (i=0;i<FRAME_SIZE;++i) { - s += (float)in_short[i] * in_short[i]; - e += ((float)in_short[i]-out_short[i]) * ((float)in_short[i]-out_short[i]); - } - seg_snr += 10*log10((s+1)/(e+1)); - sigpow += s; - errpow += e; - snr_frames++; - } - fclose(fin); - fclose(fout); - - snr = 10 * log10( sigpow / errpow ); - seg_snr /= snr_frames; - fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr); - -#ifdef FIXED_DEBUG - printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); -#endif - - return 1; -} diff --git a/src/lib/dl/ext/speex/testenc_wb.c b/src/lib/dl/ext/speex/testenc_wb.c deleted file mode 100755 index 3f13184a..00000000 --- a/src/lib/dl/ext/speex/testenc_wb.c +++ /dev/null @@ -1,140 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex.h> -#include <stdio.h> -#include <stdlib.h> -#include <speex/speex_callbacks.h> - -#ifdef FIXED_DEBUG -extern long long spx_mips; -#endif - -#define FRAME_SIZE 320 -#include <math.h> -int main(int argc, char **argv) -{ - char *inFile, *outFile, *bitsFile; - FILE *fin, *fout, *fbits=NULL; - short in_short[FRAME_SIZE]; - short out_short[FRAME_SIZE]; - float sigpow,errpow,snr, seg_snr=0; - int snr_frames = 0; - char cbits[200]; - int nbBits; - int i; - void *st; - void *dec; - SpeexBits bits; - spx_int32_t tmp; - int bitCount=0; - spx_int32_t skip_group_delay; - SpeexCallback callback; - - sigpow = 0; - errpow = 0; - - st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); - dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); - - callback.callback_id = SPEEX_INBAND_CHAR; - callback.func = speex_std_char_handler; - callback.data = stderr; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - callback.callback_id = SPEEX_INBAND_MODE_REQUEST; - callback.func = speex_std_mode_request_handler; - callback.data = st; - speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); - - tmp=1; - speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); - tmp=0; - speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); - tmp=8; - speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); - tmp=3; - speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); - /*tmp=3; - speex_encoder_ctl(st, SPEEX_SET_HIGH_MODE, &tmp); - tmp=6; - speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp); -*/ - - speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); - speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); - skip_group_delay += tmp; - - - if (argc != 4 && argc != 3) - { - fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); - exit(1); - } - inFile = argv[1]; - fin = fopen(inFile, "rb"); - outFile = argv[2]; - fout = fopen(outFile, "wb+"); - if (argc==4) - { - bitsFile = argv[3]; - fbits = fopen(bitsFile, "wb"); - } - speex_bits_init(&bits); - while (!feof(fin)) - { - fread(in_short, sizeof(short), FRAME_SIZE, fin); - if (feof(fin)) - break; - speex_bits_reset(&bits); - - speex_encode_int(st, in_short, &bits); - nbBits = speex_bits_write(&bits, cbits, 200); - bitCount+=bits.nbBits; - - if (argc==4) - fwrite(cbits, 1, nbBits, fbits); - speex_bits_rewind(&bits); - - speex_decode_int(dec, &bits, out_short); - speex_bits_reset(&bits); - - fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); - skip_group_delay = 0; - } - fprintf (stderr, "Total encoded size: %d bits\n", bitCount); - speex_encoder_destroy(st); - speex_decoder_destroy(dec); - speex_bits_destroy(&bits); - - rewind(fin); - rewind(fout); - - while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) - && - FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) - { - float s=0, e=0; - for (i=0;i<FRAME_SIZE;++i) { - s += (float)in_short[i] * in_short[i]; - e += ((float)in_short[i]-out_short[i]) * ((float)in_short[i]-out_short[i]); - } - seg_snr += 10*log10((s+160)/(e+160)); - sigpow += s; - errpow += e; - snr_frames++; - } - fclose(fin); - fclose(fout); - - snr = 10 * log10( sigpow / errpow ); - seg_snr /= snr_frames; - fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr); - -#ifdef FIXED_DEBUG - printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames)); -#endif - - return 1; -} diff --git a/src/lib/dl/ext/speex/testjitter.c b/src/lib/dl/ext/speex/testjitter.c deleted file mode 100755 index 3bcbe2fe..00000000 --- a/src/lib/dl/ext/speex/testjitter.c +++ /dev/null @@ -1,75 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <speex/speex_jitter.h> -#include <stdio.h> - -union jbpdata { - unsigned int idx; - unsigned char data[4]; -}; - -void synthIn(JitterBufferPacket *in, int idx, int span) { - union jbpdata d; - d.idx = idx; - - in->data = d.data; - in->len = sizeof(d); - in->timestamp = idx * 10; - in->span = span * 10; - in->sequence = idx; - in->user_data = 0; -} - -void jitterFill(JitterBuffer *jb) { - char buffer[65536]; - JitterBufferPacket in, out; - int i; - - out.data = buffer; - - jitter_buffer_reset(jb); - - for(i=0;i<100;++i) { - synthIn(&in, i, 1); - jitter_buffer_put(jb, &in); - - out.len = 65536; - if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) { - printf("Fill test failed iteration %d\n", i); - } - if (out.timestamp != i * 10) { - printf("Fill test expected %d got %d\n", i*10, out.timestamp); - } - jitter_buffer_tick(jb); - } -} - -int main() -{ - char buffer[65536]; - JitterBufferPacket in, out; - int i; - - JitterBuffer *jb = jitter_buffer_init(10); - - out.data = buffer; - - /* Frozen sender case */ - jitterFill(jb); - for(i=0;i<100;++i) { - out.len = 65536; - jitter_buffer_get(jb, &out, 10, NULL); - jitter_buffer_tick(jb); - } - synthIn(&in, 100, 1); - jitter_buffer_put(jb, &in); - out.len = 65536; - if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) { - printf("Failed frozen sender resynchronize\n"); - } else { - printf("Frozen sender: Jitter %d\n", out.timestamp - 100*10); - } - return 0; -} diff --git a/src/lib/dl/ext/speex/vbr.c b/src/lib/dl/ext/speex/vbr.c deleted file mode 100755 index 5b7dd9bf..00000000 --- a/src/lib/dl/ext/speex/vbr.c +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: vbr.c - - VBR-related routines - - 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. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "vbr.h" -#include <math.h> - - -#define sqr(x) ((x)*(x)) - -#define MIN_ENERGY 6000 -#define NOISE_POW .3 - -#ifndef DISABLE_VBR - -const float vbr_nb_thresh[9][11]={ - {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* CNG */ - { 4.0f, 2.5f, 2.0f, 1.2f, 0.5f, 0.0f, -0.5f, -0.7f, -0.8f, -0.9f, -1.0f}, /* 2 kbps */ - {10.0f, 6.5f, 5.2f, 4.5f, 3.9f, 3.5f, 3.0f, 2.5f, 2.3f, 1.8f, 1.0f}, /* 6 kbps */ - {11.0f, 8.8f, 7.5f, 6.5f, 5.0f, 3.9f, 3.9f, 3.9f, 3.5f, 3.0f, 1.0f}, /* 8 kbps */ - {11.0f, 11.0f, 9.9f, 8.5f, 7.0f, 6.0f, 4.5f, 4.0f, 4.0f, 4.0f, 2.0f}, /* 11 kbps */ - {11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.5f, 8.0f, 7.0f, 6.0f, 5.0f, 3.0f}, /* 15 kbps */ - {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.5f, 7.0f, 6.0f, 5.0f}, /* 18 kbps */ - {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.8f, 9.5f, 7.5f}, /* 24 kbps */ - { 7.0f, 4.5f, 3.7f, 3.0f, 2.5f, 2.0f, 1.8f, 1.5f, 1.0f, 0.0f, 0.0f} /* 4 kbps */ -}; - - -const float vbr_hb_thresh[5][11]={ - {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* silence */ - {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* 2 kbps */ - {11.0f, 11.0f, 9.5f, 8.5f, 7.5f, 6.0f, 5.0f, 3.9f, 3.0f, 2.0f, 1.0f}, /* 6 kbps */ - {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.5f, 8.7f, 7.8f, 7.0f, 6.5f, 4.0f}, /* 10 kbps */ - {11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 11.0f, 9.8f, 7.5f, 5.5f} /* 18 kbps */ -}; - -const float vbr_uhb_thresh[2][11]={ - {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f}, /* silence */ - { 3.9f, 2.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f} /* 2 kbps */ -}; - -void vbr_init(VBRState *vbr) -{ - int i; - - vbr->average_energy=0; - vbr->last_energy=1; - vbr->accum_sum=0; - vbr->energy_alpha=.1; - vbr->soft_pitch=0; - vbr->last_pitch_coef=0; - vbr->last_quality=0; - - vbr->noise_accum = .05*pow(MIN_ENERGY, NOISE_POW); - vbr->noise_accum_count=.05; - vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count; - vbr->consec_noise=0; - - - for (i=0;i<VBR_MEMORY_SIZE;i++) - vbr->last_log_energy[i] = log(MIN_ENERGY); -} - - -/* - This function should analyse the signal and decide how critical the - coding error will be perceptually. The following factors should be - taken into account: - - -Attacks (positive energy derivative) should be coded with more bits - - -Stationary voiced segments should receive more bits - - -Segments with (very) low absolute energy should receive less bits (maybe - only shaped noise?) - - -DTX for near-zero energy? - - -Stationary fricative segments should have less bits - - -Temporal masking: when energy slope is decreasing, decrease the bit-rate - - -Decrease bit-rate for males (low pitch)? - - -(wideband only) less bits in the high-band when signal is very - non-stationary (harder to notice high-frequency noise)??? - -*/ - -float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float pitch_coef) -{ - int i; - float ener=0, ener1=0, ener2=0; - float qual=7; - int va; - float log_energy; - float non_st=0; - float voicing; - float pow_ener; - - for (i=0;i<len>>1;i++) - ener1 += ((float)sig[i])*sig[i]; - - for (i=len>>1;i<len;i++) - ener2 += ((float)sig[i])*sig[i]; - ener=ener1+ener2; - - log_energy = log(ener+MIN_ENERGY); - for (i=0;i<VBR_MEMORY_SIZE;i++) - non_st += sqr(log_energy-vbr->last_log_energy[i]); - non_st = non_st/(30*VBR_MEMORY_SIZE); - if (non_st>1) - non_st=1; - - voicing = 3*(pitch_coef-.4)*fabs(pitch_coef-.4); - vbr->average_energy = (1-vbr->energy_alpha)*vbr->average_energy + vbr->energy_alpha*ener; - vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count; - pow_ener = pow(ener,NOISE_POW); - if (vbr->noise_accum_count<.06 && ener>MIN_ENERGY) - vbr->noise_accum = .05*pow_ener; - - if ((voicing<.3 && non_st < .2 && pow_ener < 1.2*vbr->noise_level) - || (voicing<.3 && non_st < .05 && pow_ener < 1.5*vbr->noise_level) - || (voicing<.4 && non_st < .05 && pow_ener < 1.2*vbr->noise_level) - || (voicing<0 && non_st < .05)) - { - float tmp; - va = 0; - vbr->consec_noise++; - if (pow_ener > 3*vbr->noise_level) - tmp = 3*vbr->noise_level; - else - tmp = pow_ener; - if (vbr->consec_noise>=4) - { - vbr->noise_accum = .95*vbr->noise_accum + .05*tmp; - vbr->noise_accum_count = .95*vbr->noise_accum_count + .05; - } - } else { - va = 1; - vbr->consec_noise=0; - } - - if (pow_ener < vbr->noise_level && ener>MIN_ENERGY) - { - vbr->noise_accum = .95*vbr->noise_accum + .05*pow_ener; - vbr->noise_accum_count = .95*vbr->noise_accum_count + .05; - } - - /* Checking for very low absolute energy */ - if (ener < 30000) - { - qual -= .7; - if (ener < 10000) - qual-=.7; - if (ener < 3000) - qual-=.7; - } else { - float short_diff, long_diff; - short_diff = log((ener+1)/(1+vbr->last_energy)); - long_diff = log((ener+1)/(1+vbr->average_energy)); - /*fprintf (stderr, "%f %f\n", short_diff, long_diff);*/ - - if (long_diff<-5) - long_diff=-5; - if (long_diff>2) - long_diff=2; - - if (long_diff>0) - qual += .6*long_diff; - if (long_diff<0) - qual += .5*long_diff; - if (short_diff>0) - { - if (short_diff>5) - short_diff=5; - qual += .5*short_diff; - } - /* Checking for energy increases */ - if (ener2 > 1.6*ener1) - qual += .5; - } - vbr->last_energy = ener; - vbr->soft_pitch = .6*vbr->soft_pitch + .4*pitch_coef; - qual += 2.2*((pitch_coef-.4) + (vbr->soft_pitch-.4)); - - if (qual < vbr->last_quality) - qual = .5*qual + .5*vbr->last_quality; - if (qual<4) - qual=4; - if (qual>10) - qual=10; - - /* - if (vbr->consec_noise>=2) - qual-=1.3; - if (vbr->consec_noise>=5) - qual-=1.3; - if (vbr->consec_noise>=12) - qual-=1.3; - */ - if (vbr->consec_noise>=3) - qual=4; - - if (vbr->consec_noise) - qual -= 1.0 * (log(3.0 + vbr->consec_noise)-log(3)); - if (qual<0) - qual=0; - - if (ener<60000) - { - if (vbr->consec_noise>2) - qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3)); - if (ener<10000&&vbr->consec_noise>2) - qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3)); - if (qual<0) - qual=0; - qual += .3*log(.0001+ener/60000.0); - } - if (qual<-1) - qual=-1; - - /*printf ("%f %f %f %f %d\n", qual, voicing, non_st, pow_ener/(.01+vbr->noise_level), va);*/ - - vbr->last_pitch_coef = pitch_coef; - vbr->last_quality = qual; - - for (i=VBR_MEMORY_SIZE-1;i>0;i--) - vbr->last_log_energy[i] = vbr->last_log_energy[i-1]; - vbr->last_log_energy[0] = log_energy; - - /*printf ("VBR: %f %f %f %d %f\n", (float)(log_energy-log(vbr->average_energy+MIN_ENERGY)), non_st, voicing, va, vbr->noise_level);*/ - - return qual; -} - -void vbr_destroy(VBRState *vbr) -{ -} - -#endif /* #ifndef DISABLE_VBR */ diff --git a/src/lib/dl/ext/speex/vbr.h b/src/lib/dl/ext/speex/vbr.h deleted file mode 100755 index ff1e3e46..00000000 --- a/src/lib/dl/ext/speex/vbr.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file vbr.h - @brief Variable Bit-Rate (VBR) related routines -*/ -/* - 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 VBR_H -#define VBR_H - -#include "arch.h" - -#define VBR_MEMORY_SIZE 5 - -extern const float vbr_nb_thresh[9][11]; -extern const float vbr_hb_thresh[5][11]; -extern const float vbr_uhb_thresh[2][11]; - -/** VBR state. */ -typedef struct VBRState { - float energy_alpha; - float average_energy; - float last_energy; - float last_log_energy[VBR_MEMORY_SIZE]; - float accum_sum; - float last_pitch_coef; - float soft_pitch; - float last_quality; - float noise_level; - float noise_accum; - float noise_accum_count; - int consec_noise; -} VBRState; - -void vbr_init(VBRState *vbr); - -float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float pitch_coef); - -void vbr_destroy(VBRState *vbr); - -#endif diff --git a/src/lib/dl/ext/speex/vorbis_psy.h b/src/lib/dl/ext/speex/vorbis_psy.h deleted file mode 100755 index 68710577..00000000 --- a/src/lib/dl/ext/speex/vorbis_psy.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright (C) 2005 Jean-Marc Valin, CSIRO, Christopher Montgomery - File: vorbis_psy.h - - 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 VORBIS_PSY_H -#define VORBIS_PSY_H - -#ifdef VORBIS_PSYCHO - -#include "smallft.h" -#define P_BANDS 17 /* 62Hz to 16kHz */ -#define NOISE_COMPAND_LEVELS 40 - - -#define todB(x) ((x)>1e-13?log((x)*(x))*4.34294480f:-30) -#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) - -/* 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)) - - -typedef struct { - - float noisewindowlo; - float noisewindowhi; - int noisewindowlomin; - int noisewindowhimin; - int noisewindowfixed; - float noiseoff[P_BANDS]; - float noisecompand[NOISE_COMPAND_LEVELS]; - -} VorbisPsyInfo; - - - -typedef struct { - int n; - int rate; - struct drft_lookup lookup; - VorbisPsyInfo *vi; - - float *window; - float *noiseoffset; - long *bark; - -} VorbisPsy; - - -VorbisPsy *vorbis_psy_init(int rate, int size); -void vorbis_psy_destroy(VorbisPsy *psy); -void compute_curve(VorbisPsy *psy, float *audio, float *curve); -void curve_to_lpc(VorbisPsy *psy, float *curve, float *awk1, float *awk2, int ord); - -#endif -#endif diff --git a/src/lib/dl/ext/speex/vq.c b/src/lib/dl/ext/speex/vq.c deleted file mode 100755 index 609f124e..00000000 --- a/src/lib/dl/ext/speex/vq.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: vq.c - Vector quantization - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "vq.h" -#include "stack_alloc.h" -#include "arch.h" - -#ifdef _USE_SSE -#include <xmmintrin.h> -#include "vq_sse.h" -#elif defined(SHORTCUTS) && (defined(ARM4_ASM) || defined(ARM5E_ASM)) -#include "vq_arm4.h" -#elif defined(BFIN_ASM) -#include "vq_bfin.h" -#endif - - -int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries) -{ - int i=0; - while (i<entries-1 && in>boundary[0]) - { - boundary++; - i++; - } - return i; -} - -int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries) -{ - int i=0; - while (i<entries-1 && in>boundary[0]) - { - boundary++; - i++; - } - return i; -} - - -#ifndef OVERRIDE_VQ_NBEST -/*Finds the indices of the n-best entries in a codebook*/ -void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) -{ - int i,j,k,used; - used = 0; - for (i=0;i<entries;i++) - { - spx_word32_t dist=0; - for (j=0;j<len;j++) - dist = MAC16_16(dist,in[j],*codebook++); -#ifdef FIXED_POINT - dist=SUB32(SHR32(E[i],1),dist); -#else - dist=.5f*E[i]-dist; -#endif - if (i<N || dist<best_dist[N-1]) - { - for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--) - { - best_dist[k]=best_dist[k-1]; - nbest[k] = nbest[k-1]; - } - best_dist[k]=dist; - nbest[k]=i; - used++; - } - } -} -#endif - - - - -#ifndef OVERRIDE_VQ_NBEST_SIGN -/*Finds the indices of the n-best entries in a codebook with sign*/ -void vq_nbest_sign(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) -{ - int i,j,k, sign, used; - used=0; - for (i=0;i<entries;i++) - { - spx_word32_t dist=0; - for (j=0;j<len;j++) - dist = MAC16_16(dist,in[j],*codebook++); - if (dist>0) - { - sign=0; - dist=-dist; - } else - { - sign=1; - } -#ifdef FIXED_POINT - dist = ADD32(dist,SHR32(E[i],1)); -#else - dist = ADD32(dist,.5f*E[i]); -#endif - if (i<N || dist<best_dist[N-1]) - { - for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--) - { - best_dist[k]=best_dist[k-1]; - nbest[k] = nbest[k-1]; - } - best_dist[k]=dist; - nbest[k]=i; - used++; - if (sign) - nbest[k]+=entries; - } - } -} -#endif diff --git a/src/lib/dl/ext/speex/vq.h b/src/lib/dl/ext/speex/vq.h deleted file mode 100755 index 5a4ced24..00000000 --- a/src/lib/dl/ext/speex/vq.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file vq.h - @brief Vector quantization -*/ -/* - 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 VQ_H -#define VQ_H - -#include "arch.h" - -int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries); -int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries); - -#ifdef _USE_SSE -#include <xmmintrin.h> -void vq_nbest(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); - -void vq_nbest_sign(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); -#else -void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); - -void vq_nbest_sign(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack); -#endif - -#endif diff --git a/src/lib/dl/ext/speex/vq_arm4.h b/src/lib/dl/ext/speex/vq_arm4.h deleted file mode 100755 index 585b8613..00000000 --- a/src/lib/dl/ext/speex/vq_arm4.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2004 Jean-Marc Valin */ -/** - @file vq_arm4.h - @brief ARM4-optimized vq routine -*/ -/* - 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. -*/ - -#define OVERRIDE_VQ_NBEST -void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) -{ - int i,j; - for (i=0;i<entries;i+=4) - { -#if 1 - spx_word32_t dist1, dist2, dist3, dist4; - int dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8; - __asm__ __volatile__ ( - "mov %0, #0 \n\t" - "mov %1, #0 \n\t" - "mov %2, #0 \n\t" - "mov %3, #0 \n\t" - "mov %10, %4 \n\t" - "add %4, %4, %4\n\t" - ".vqloop%=:\n\t" - "ldrsh %7, [%5], #2 \n\t" - "ldrsh %8, [%6] \n\t" - "mov %9, %6 \n\t" - "mla %0, %7, %8, %0 \n\t" - "ldrsh %8, [%9, %4]! \n\t" - "mla %1, %7, %8, %1 \n\t" - "ldrsh %8, [%9, %4]!\n\t" - "mla %2, %7, %8, %2 \n\t" - "ldrsh %8, [%9, %4]! \n\t" - "mla %3, %7, %8, %3 \n\t" - "subs %10, %10, #1 \n\t" - "add %6, %6, #2 \n\t" - "bne .vqloop%=" - : "=r" (dist1), "=r" (dist2), "=r" (dist3), "=r" (dist4), - "=r" (dead1), "=r" (dead2), "=r" (codebook), "=r" (dead4), - "=r" (dead5), "=r" (dead6), "=r" (dead7) - : "4" (len), "5" (in), "6" (codebook) - : "cc"); -#else -dist1=dist2=dist3=dist4=0; - /* spx_word32_t dist1=0; - spx_word32_t dist2=0; - spx_word32_t dist3=0; - spx_word32_t dist4=0;*/ - for (j=0;j<2;j++) - { - const spx_word16_t *code = codebook; - dist1 = MAC16_16(dist1,in[j],*code); - code += len; - dist2 = MAC16_16(dist2,in[j],*code); - code += len; - dist3 = MAC16_16(dist3,in[j],*code); - code += len; - dist4 = MAC16_16(dist4,in[j],*code); - codebook++; - } -#endif - dist1=SUB32(SHR(*E++,1),dist1); - if (dist1<*best_dist || i==0) - { - *best_dist=dist1; - *nbest=i; - } - dist2=SUB32(SHR(*E++,1),dist2); - if (dist2<*best_dist) - { - *best_dist=dist2; - *nbest=i+1; - } - dist3=SUB32(SHR(*E++,1),dist3); - if (dist3<*best_dist) - { - *best_dist=dist3; - *nbest=i+2; - } - dist4=SUB32(SHR(*E++,1),dist4); - if (dist4<*best_dist) - { - *best_dist=dist4; - *nbest=i+3; - } - codebook += 3*len; - } -} diff --git a/src/lib/dl/ext/speex/vq_bfin.h b/src/lib/dl/ext/speex/vq_bfin.h deleted file mode 100755 index 2cc9ea5f..00000000 --- a/src/lib/dl/ext/speex/vq_bfin.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2005 Analog Devices */ -/** - @file vq_bfin.h - @author Jean-Marc Valin - @brief Blackfin-optimized vq routine -*/ -/* - 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. -*/ - -#define OVERRIDE_VQ_NBEST -void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) -{ - if (N==1) - { - best_dist[0] = 2147483647; - { - spx_word32_t dist; - __asm__ __volatile__ - ( - "LC0 = %8;\n\t" - "R2 = 0;\n\t" - "I0 = %6;\n\t" - "B0 = %6;\n\t" - "L0 = %9;\n\t" - "LOOP entries_loop%= LC0;\n\t" - "LOOP_BEGIN entries_loop%=;\n\t" - "%0 = [%4++];\n\t" - "%0 >>= 1;\n\t" - "A0 = %0;\n\t" - "R0.L = W[%1++%7] || R1.L = W[I0++];\n\t" - "LOOP vq_loop%= LC1 = %5;\n\t" - "LOOP_BEGIN vq_loop%=;\n\t" - "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%7] || R1.L = W[I0++];\n\t" - "LOOP_END vq_loop%=;\n\t" - "%0 = (A0 -= R0.L*R1.L) (IS);\n\t" - "cc = %0 < %2;\n\t" - "if cc %2 = %0;\n\t" - "if cc %3 = R2;\n\t" - "R2 += 1;\n\t" - "LOOP_END entries_loop%=;\n\t" - : "=&D" (dist), "=&a" (codebook), "=&d" (best_dist[0]), "=&d" (nbest[0]), "=&a" (E) - : "a" (len-1), "a" (in), "a" (2), "d" (entries), "d" (len<<1), "1" (codebook), "4" (E), "2" (best_dist[0]), "3" (nbest[0]) - : "R0", "R1", "R2", "I0", "L0", "B0", "A0", "cc", "memory" - ); - } - } else { - int i,k,used; - used = 0; - for (i=0;i<entries;i++) - { - spx_word32_t dist; - __asm__ - ( - "%0 >>= 1;\n\t" - "A0 = %0;\n\t" - "I0 = %3;\n\t" - "L0 = 0;\n\t" - "R0.L = W[%1++%4] || R1.L = W[I0++];\n\t" - "LOOP vq_loop%= LC0 = %2;\n\t" - "LOOP_BEGIN vq_loop%=;\n\t" - "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%4] || R1.L = W[I0++];\n\t" - "LOOP_END vq_loop%=;\n\t" - "%0 = (A0 -= R0.L*R1.L) (IS);\n\t" - : "=D" (dist), "=a" (codebook) - : "a" (len-1), "a" (in), "a" (2), "1" (codebook), "0" (E[i]) - : "R0", "R1", "I0", "L0", "A0" - ); - if (i<N || dist<best_dist[N-1]) - { - for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--) - { - best_dist[k]=best_dist[k-1]; - nbest[k] = nbest[k-1]; - } - best_dist[k]=dist; - nbest[k]=i; - used++; - } - } - } -} diff --git a/src/lib/dl/ext/speex/vq_sse.h b/src/lib/dl/ext/speex/vq_sse.h deleted file mode 100755 index 00a42ce3..00000000 --- a/src/lib/dl/ext/speex/vq_sse.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright (C) 2004 Jean-Marc Valin */ -/** - @file vq_sse.h - @brief SSE-optimized vq routine -*/ -/* - 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. -*/ - -#define OVERRIDE_VQ_NBEST -void vq_nbest(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) -{ - int i,j,k,used; - VARDECL(float *dist); - VARDECL(__m128 *in); - __m128 half; - used = 0; - ALLOC(dist, entries, float); - half = _mm_set_ps1(.5f); - ALLOC(in, len, __m128); - for (i=0;i<len;i++) - in[i] = _mm_set_ps1(_in[i]); - for (i=0;i<entries>>2;i++) - { - __m128 d = _mm_mul_ps(E[i], half); - for (j=0;j<len;j++) - d = _mm_sub_ps(d, _mm_mul_ps(in[j], *codebook++)); - _mm_storeu_ps(dist+4*i, d); - } - for (i=0;i<entries;i++) - { - if (i<N || dist[i]<best_dist[N-1]) - { - for (k=N-1; (k >= 1) && (k > used || dist[i] < best_dist[k-1]); k--) - { - best_dist[k]=best_dist[k-1]; - nbest[k] = nbest[k-1]; - } - best_dist[k]=dist[i]; - nbest[k]=i; - used++; - } - } -} - - - - -#define OVERRIDE_VQ_NBEST_SIGN -void vq_nbest_sign(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack) -{ - int i,j,k,used; - VARDECL(float *dist); - VARDECL(__m128 *in); - __m128 half; - used = 0; - ALLOC(dist, entries, float); - half = _mm_set_ps1(.5f); - ALLOC(in, len, __m128); - for (i=0;i<len;i++) - in[i] = _mm_set_ps1(_in[i]); - for (i=0;i<entries>>2;i++) - { - __m128 d = _mm_setzero_ps(); - for (j=0;j<len;j++) - d = _mm_add_ps(d, _mm_mul_ps(in[j], *codebook++)); - _mm_storeu_ps(dist+4*i, d); - } - for (i=0;i<entries;i++) - { - int sign; - if (dist[i]>0) - { - sign=0; - dist[i]=-dist[i]; - } else - { - sign=1; - } - dist[i] += .5f*((float*)E)[i]; - if (i<N || dist[i]<best_dist[N-1]) - { - for (k=N-1; (k >= 1) && (k > used || dist[i] < best_dist[k-1]); k--) - { - best_dist[k]=best_dist[k-1]; - nbest[k] = nbest[k-1]; - } - best_dist[k]=dist[i]; - nbest[k]=i; - used++; - if (sign) - nbest[k]+=entries; - } - } -} diff --git a/src/lib/dl/ext/speex/wav_io.c b/src/lib/dl/ext/speex/wav_io.c deleted file mode 100755 index 02931b1a..00000000 --- a/src/lib/dl/ext/speex/wav_io.c +++ /dev/null @@ -1,232 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: wav_io.c - Routines to handle wav (RIFF) headers - - 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. -*/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <stdio.h> -#include <string.h> -#include "speex/speex_types.h" -#include "wav_io.h" - - -int read_wav_header(FILE *file, int *rate, int *channels, int *format, spx_int32_t *size) -{ - char ch[5]; - spx_int32_t itmp; - spx_int16_t stmp; - spx_int32_t bpersec; - spx_int16_t balign; - int skip_bytes; - int i; - - ch[4]=0; -#if 0 - fread(ch, 1, 4, file); - if (strcmp(ch, "RIFF")!=0) - { - fseek(file, 0, SEEK_SET); - return 0; - } - - fread(&itmp, 4, 1, file); - *size = le_int(itmp-36); - - fread(ch, 1, 4, file); - if (strcmp(ch, "WAVE")!=0) - { - fprintf (stderr, "RIFF file is not a WAVE file\n"); - return -1; - } -#endif - fread(ch, 1, 4, file); - while (strcmp(ch, "fmt ")!=0) - { - fread(&itmp, 4, 1, file); - itmp = le_int(itmp); - /*fprintf (stderr, "skip=%d\n", itmp);*/ - /*strange way of seeking, but it works even for pipes*/ - for (i=0;i<itmp;i++) - fgetc(file); - /*fseek(file, itmp, SEEK_CUR);*/ - fread(ch, 1, 4, file); - if (feof(file)) - { - fprintf (stderr, "Corrupted WAVE file: no \"fmt \"\n"); - return -1; - } - } - /*if (strcmp(ch, "fmt ")!=0) - { - fprintf (stderr, "Corrupted WAVE file: no \"fmt \"\n"); - return -1; - }*/ - - fread(&itmp, 4, 1, file); - itmp = le_int(itmp); - skip_bytes=itmp-16; - /*fprintf (stderr, "skip=%d\n", skip_bytes);*/ - - fread(&stmp, 2, 1, file); - stmp = le_short(stmp); - if (stmp!=1) - { - fprintf (stderr, "Only PCM encoding is supported\n"); - return -1; - } - - fread(&stmp, 2, 1, file); - stmp = le_short(stmp); - *channels = stmp; - - if (stmp>2) - { - fprintf (stderr, "Only mono and (intensity) stereo supported\n"); - return -1; - } - - fread(&itmp, 4, 1, file); - itmp = le_int(itmp); - *rate = itmp; - if (*rate != 8000 && *rate != 16000 && *rate != 11025 && *rate != 22050 && *rate != 32000 && *rate != 44100 && *rate != 48000) - { - fprintf (stderr, "Only 8 kHz (narrowband) and 16 kHz (wideband) supported (plus 11.025 kHz and 22.05 kHz, but your mileage may vary)\n"); - return -1; - } - - fread(&itmp, 4, 1, file); - bpersec = le_int(itmp); - - fread(&stmp, 2, 1, file); - balign = le_short(stmp); - - fread(&stmp, 2, 1, file); - stmp = le_short(stmp); - if (stmp!=16 && stmp!=8) - { - fprintf (stderr, "Only 8/16-bit linear supported\n"); - return -1; - } - *format=stmp; - - if (bpersec!=*rate**channels*stmp/8) - { - fprintf (stderr, "Corrupted header: ByteRate mismatch\n"); - return -1; - } - - if (balign!=*channels*stmp/8) - { - fprintf (stderr, "Corrupted header: BlockAlign mismatch\n"); - return -1; - } - - - /*strange way of seeking, but it works even for pipes*/ - if (skip_bytes>0) - for (i=0;i<skip_bytes;i++) - fgetc(file); - - /*fseek(file, skip_bytes, SEEK_CUR);*/ - - fread(ch, 1, 4, file); - while (strcmp(ch, "data")!=0) - { - fread(&itmp, 4, 1, file); - itmp = le_int(itmp); - /*strange way of seeking, but it works even for pipes*/ - for (i=0;i<itmp;i++) - fgetc(file); - /*fseek(file, itmp, SEEK_CUR);*/ - fread(ch, 1, 4, file); - if (feof(file)) - { - fprintf (stderr, "Corrupted WAVE file: no \"data\"\n"); - return -1; - } - } - - /*Ignore this for now*/ - fread(&itmp, 4, 1, file); - itmp = le_int(itmp); - - *size=itmp; - - return 1; -} - - - -void write_wav_header(FILE *file, int rate, int channels, int format, int size) -{ - char ch[5]; - spx_int32_t itmp; - spx_int16_t stmp; - - ch[4]=0; - - fprintf (file, "RIFF"); - - itmp = 0x7fffffff; - fwrite(&itmp, 4, 1, file); - - fprintf (file, "WAVEfmt "); - - itmp = le_int(16); - fwrite(&itmp, 4, 1, file); - - stmp = le_short(1); - fwrite(&stmp, 2, 1, file); - - stmp = le_short(channels); - fwrite(&stmp, 2, 1, file); - - itmp = le_int(rate); - fwrite(&itmp, 4, 1, file); - - itmp = le_int(rate*channels*2); - fwrite(&itmp, 4, 1, file); - - stmp = le_short(2*channels); - fwrite(&stmp, 2, 1, file); - - stmp = le_short(16); - fwrite(&stmp, 2, 1, file); - - fprintf (file, "data"); - - itmp = le_int(0x7fffffff); - fwrite(&itmp, 4, 1, file); - - -} diff --git a/src/lib/dl/ext/speex/wav_io.h b/src/lib/dl/ext/speex/wav_io.h deleted file mode 100755 index 07557639..00000000 --- a/src/lib/dl/ext/speex/wav_io.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin - File: wav_io.h - - 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 WAV_IO_H -#define WAV_IO_H - -#include <stdio.h> -#include "speex/speex_types.h" - -#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) ) -#define le_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8)) -#define be_short(s) ((short) (s)) -#else -#define le_short(s) ((short) (s)) -#define be_short(s) ((short) ((unsigned short) (s) << 8) | ((unsigned short) (s) >> 8)) -#endif - -/** Convert little endian */ -static inline spx_int32_t le_int(spx_int32_t i) -{ -#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) ) - spx_uint32_t ui, ret; - ui = i; - ret = ui>>24; - ret |= (ui>>8)&0x0000ff00; - ret |= (ui<<8)&0x00ff0000; - ret |= (ui<<24); - return ret; -#else - return i; -#endif -} - -int read_wav_header(FILE *file, int *rate, int *channels, int *format, spx_int32_t *size); - -void write_wav_header(FILE *file, int rate, int channels, int format, int size); - -#endif diff --git a/src/lib/dl/ext/speex/wave_out.c b/src/lib/dl/ext/speex/wave_out.c deleted file mode 100755 index 64eeb6e9..00000000 --- a/src/lib/dl/ext/speex/wave_out.c +++ /dev/null @@ -1,220 +0,0 @@ -/* Copyright (c) 2002, John Edwards - - 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. -*/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -/* Set TABS = 4 */ -/******************************************************************** - - function: To provide playback of 16 bit PCM wave data in Win32 - environments from decoded compressed files. - - ********************************************************************/ - -#if defined WIN32 || defined _WIN32 - -#include <string.h> -#include <errno.h> -#include "wave_out.h" - -#define MAXWAVESIZE 4294967040LU -#define MAX_WAVEBLOCKS 32 - -// This is modified for USE_WIN_AUDIO - ONLY 2002-02-27 - - -static CRITICAL_SECTION cs; -static HWAVEOUT dev = NULL; -static int ScheduledBlocks = 0; -static int PlayedWaveHeadersCount = 0; // free index -static WAVEHDR* PlayedWaveHeaders [MAX_WAVEBLOCKS]; - -static int -Box ( const char* msg ) -{ - MessageBox ( NULL, msg, " "VERSION_STRING": Error Message . . .", MB_OK | MB_ICONEXCLAMATION ); - return -1; -} - - -/* - * This function registers already played WAVE chunks. Freeing is done by free_memory(), - */ - -static void CALLBACK -wave_callback ( HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) -{ - if ( uMsg == WOM_DONE ) { - EnterCriticalSection ( &cs ); - PlayedWaveHeaders [PlayedWaveHeadersCount++] = (WAVEHDR*) dwParam1; - LeaveCriticalSection ( &cs ); - } -} - - -static void -free_memory ( void ) -{ - WAVEHDR* wh; - HGLOBAL hg; - - EnterCriticalSection ( &cs ); - wh = PlayedWaveHeaders [--PlayedWaveHeadersCount]; - ScheduledBlocks--; // decrease the number of USED blocks - LeaveCriticalSection ( &cs ); - - waveOutUnprepareHeader ( dev, wh, sizeof (WAVEHDR) ); - - hg = GlobalHandle ( wh -> lpData ); // Deallocate the buffer memory - GlobalUnlock (hg); - GlobalFree (hg); - - hg = GlobalHandle ( wh ); // Deallocate the header memory - GlobalUnlock (hg); - GlobalFree (hg); -} - - -Int -Set_WIN_Params ( FILE_T dummyFile , - Ldouble SampleFreq, - Uint BitsPerSample, - Uint Channels ) -{ - WAVEFORMATEX outFormat; - UINT deviceID = WAVE_MAPPER; - - (void) dummyFile; - - if ( waveOutGetNumDevs () == 0 ) - return Box ( "No audio device present." ); - - outFormat.wFormatTag = WAVE_FORMAT_PCM; - outFormat.wBitsPerSample = BitsPerSample; - outFormat.nChannels = Channels; - outFormat.nSamplesPerSec = (unsigned long)(SampleFreq + 0.5); - outFormat.nBlockAlign = (outFormat.wBitsPerSample + 7) / 8 * outFormat.nChannels; - outFormat.nAvgBytesPerSec = outFormat.nSamplesPerSec * outFormat.nBlockAlign; - - switch ( waveOutOpen ( &dev, deviceID, &outFormat, (DWORD)wave_callback, 0, CALLBACK_FUNCTION ) ) - { - case MMSYSERR_ALLOCATED: return Box ( "Device is already open." ); - case MMSYSERR_BADDEVICEID: return Box ( "The specified device is out of range." ); - case MMSYSERR_NODRIVER: return Box ( "There is no audio driver in this system." ); - case MMSYSERR_NOMEM: return Box ( "Unable to allocate sound memory." ); - case WAVERR_BADFORMAT: return Box ( "This audio format is not supported." ); - case WAVERR_SYNC: return Box ( "The device is synchronous." ); - default: return Box ( "Unknown media error." ); - case MMSYSERR_NOERROR: break; - } - - waveOutReset ( dev ); - InitializeCriticalSection ( &cs ); - SetPriorityClass ( GetCurrentProcess (), HIGH_PRIORITY_CLASS ); - return 0; -} - - -int -WIN_Play_Samples ( const void* data, size_t len ) -{ - HGLOBAL hg; - HGLOBAL hg2; - LPWAVEHDR wh; - void* allocptr; - - do { - while ( PlayedWaveHeadersCount > 0 ) // free used blocks ... - free_memory (); - - if ( ScheduledBlocks < sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders) ) // wait for a free block ... - break; - Sleep (26); - } while (1); - - if ( (hg2 = GlobalAlloc ( GMEM_MOVEABLE, len )) == NULL ) // allocate some memory for a copy of the buffer - return Box ( "GlobalAlloc failed." ); - - allocptr = GlobalLock (hg2); - CopyMemory ( allocptr, data, len ); // Here we can call any modification output functions we want.... - - if ( (hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR))) == NULL ) // now make a header and WRITE IT! - return -1; - - wh = GlobalLock (hg); - wh -> dwBufferLength = len; - wh -> lpData = allocptr; - - if ( waveOutPrepareHeader ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) { - GlobalUnlock (hg); - GlobalFree (hg); - return -1; - } - - if ( waveOutWrite ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) { - GlobalUnlock (hg); - GlobalFree (hg); - return -1; - } - - EnterCriticalSection ( &cs ); - ScheduledBlocks++; - LeaveCriticalSection ( &cs ); - - return len; -} - - -int -WIN_Audio_close ( void ) -{ - if ( dev != NULL ) { - - while ( ScheduledBlocks > 0 ) { - Sleep (ScheduledBlocks); - while ( PlayedWaveHeadersCount > 0 ) // free used blocks ... - free_memory (); - } - - waveOutReset (dev); // reset the device - waveOutClose (dev); // close the device - dev = NULL; - } - - DeleteCriticalSection ( &cs ); - ScheduledBlocks = 0; - return 0; -} - -#endif - -/* end of wave_out.c */ diff --git a/src/lib/dl/ext/speex/wave_out.h b/src/lib/dl/ext/speex/wave_out.h deleted file mode 100755 index 0c467b19..00000000 --- a/src/lib/dl/ext/speex/wave_out.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (c) 2002, John Edwards - - 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. -*/ - -// WAVE_OUT.H - Necessary stuff for WIN_AUDIO - -#ifndef WAVE_OUT_H -#define WAVE_OUT_H - -#include <stdio.h> -#include <windows.h> -#ifdef __MINGW32__ -#include <mmsystem.h> -#endif - -#define VERSION_STRING "\n 0.7.0\n" - -#define Cdecl __cdecl -#define __attribute__(x) -#define sleep(__sec) Sleep ((__sec) * 1000) -#define inline __inline -#define restrict - -//// constants ///////////////////////////////////////////////////// - -#define CD_SAMPLE_FREQ 44.1e3 -#define SAMPLE_SIZE 16 -#define SAMPLE_SIZE_STRING "" -#define WINAUDIO_FD ((FILE_T)-128) -#define FILE_T FILE* -#define INVALID_FILEDESC NULL - -//// Simple types ////////////////////////////////////////////////// - -typedef signed int Int; // at least -32767...+32767, fast type -typedef unsigned int Uint; // at least 0...65535, fast type -typedef long double Ldouble; // most exact floating point format - -//// procedures/functions ////////////////////////////////////////// -// wave_out.c -Int Set_WIN_Params ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels); -int WIN_Play_Samples ( const void* buff, size_t len ); -int WIN_Audio_close ( void ); - -#endif /* WAVE_OUT_H */ diff --git a/src/lib/dl/ext/speex/window.c b/src/lib/dl/ext/speex/window.c deleted file mode 100755 index ac042d45..00000000 --- a/src/lib/dl/ext/speex/window.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright (C) 2006 Jean-Marc Valin - File: window.c - - 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. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "arch.h" - -#ifdef FIXED_POINT -const spx_word16_t lag_window[11] = { - 16384, 16337, 16199, 15970, 15656, 15260, 14790, 14254, 13659, 13015, 12330 -}; - -const spx_word16_t lpc_window[200] = { -1310, 1313, 1321, 1333, 1352, 1375, 1403, 1436, -1475, 1518, 1567, 1621, 1679, 1743, 1811, 1884, -1962, 2044, 2132, 2224, 2320, 2421, 2526, 2636, -2750, 2868, 2990, 3116, 3246, 3380, 3518, 3659, -3804, 3952, 4104, 4259, 4417, 4578, 4742, 4909, -5079, 5251, 5425, 5602, 5781, 5963, 6146, 6331, -6518, 6706, 6896, 7087, 7280, 7473, 7668, 7863, -8059, 8256, 8452, 8650, 8847, 9044, 9241, 9438, -9635, 9831, 10026, 10220, 10414, 10606, 10797, 10987, -11176, 11363, 11548, 11731, 11912, 12091, 12268, 12443, -12615, 12785, 12952, 13116, 13277, 13435, 13590, 13742, -13890, 14035, 14176, 14314, 14448, 14578, 14704, 14826, -14944, 15058, 15168, 15273, 15374, 15470, 15562, 15649, -15732, 15810, 15883, 15951, 16015, 16073, 16127, 16175, -16219, 16257, 16291, 16319, 16342, 16360, 16373, 16381, -16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, -16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, -16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, -16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, -16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, -16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, -16384, 16384, 16384, 16361, 16294, 16183, 16028, 15830, -15588, 15304, 14979, 14613, 14207, 13763, 13282, 12766, -12215, 11631, 11016, 10373, 9702, 9007, 8289, 7551, -6797, 6028, 5251, 4470, 3695, 2943, 2248, 1696 -}; -#else -const spx_word16_t lag_window[11] = { - 1.00000, 0.99716, 0.98869, 0.97474, 0.95554, 0.93140, 0.90273, 0.86998, 0.83367, 0.79434, 0.75258 -}; - -const spx_word16_t lpc_window[200] = { - 0.080000f, 0.080158f, 0.080630f, 0.081418f, 0.082520f, 0.083935f, 0.085663f, 0.087703f, - 0.090052f, 0.092710f, 0.095674f, 0.098943f, 0.102514f, 0.106385f, 0.110553f, 0.115015f, - 0.119769f, 0.124811f, 0.130137f, 0.135744f, 0.141628f, 0.147786f, 0.154212f, 0.160902f, - 0.167852f, 0.175057f, 0.182513f, 0.190213f, 0.198153f, 0.206328f, 0.214731f, 0.223357f, - 0.232200f, 0.241254f, 0.250513f, 0.259970f, 0.269619f, 0.279453f, 0.289466f, 0.299651f, - 0.310000f, 0.320507f, 0.331164f, 0.341965f, 0.352901f, 0.363966f, 0.375151f, 0.386449f, - 0.397852f, 0.409353f, 0.420943f, 0.432615f, 0.444361f, 0.456172f, 0.468040f, 0.479958f, - 0.491917f, 0.503909f, 0.515925f, 0.527959f, 0.540000f, 0.552041f, 0.564075f, 0.576091f, - 0.588083f, 0.600042f, 0.611960f, 0.623828f, 0.635639f, 0.647385f, 0.659057f, 0.670647f, - 0.682148f, 0.693551f, 0.704849f, 0.716034f, 0.727099f, 0.738035f, 0.748836f, 0.759493f, - 0.770000f, 0.780349f, 0.790534f, 0.800547f, 0.810381f, 0.820030f, 0.829487f, 0.838746f, - 0.847800f, 0.856643f, 0.865269f, 0.873672f, 0.881847f, 0.889787f, 0.897487f, 0.904943f, - 0.912148f, 0.919098f, 0.925788f, 0.932214f, 0.938372f, 0.944256f, 0.949863f, 0.955189f, - 0.960231f, 0.964985f, 0.969447f, 0.973615f, 0.977486f, 0.981057f, 0.984326f, 0.987290f, - 0.989948f, 0.992297f, 0.994337f, 0.996065f, 0.997480f, 0.998582f, 0.999370f, 0.999842f, - 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, - 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, - 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, - 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, - 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, - 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, 1.000000f, - 1.000000f, 1.000000f, 1.000000f, 0.998640f, 0.994566f, 0.987787f, 0.978324f, 0.966203f, - 0.951458f, 0.934131f, 0.914270f, 0.891931f, 0.867179f, 0.840084f, 0.810723f, 0.779182f, - 0.745551f, 0.709930f, 0.672424f, 0.633148f, 0.592223f, 0.549781f, 0.505964f, 0.460932f, - 0.414863f, 0.367968f, 0.320511f, 0.272858f, 0.225569f, 0.179655f, 0.137254f, 0.103524f -}; -#endif diff --git a/src/lib/dl/ext/vorbis/CLEAN.BAT b/src/lib/dl/ext/vorbis/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/vorbis/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/vorbis/MAKE.BAT b/src/lib/dl/ext/vorbis/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/vorbis/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/vorbis/analysis.c b/src/lib/dl/ext/vorbis/analysis.c deleted file mode 100755 index f62e6301..00000000 --- a/src/lib/dl/ext/vorbis/analysis.c +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: single-block PCM analysis mode dispatch - last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $ - - ********************************************************************/ - -#include <stdio.h> -#include <string.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "codec.h" -#include "codec_internal.h" -#include "registry.h" -#include "scales.h" -#include "os.h" -#include "misc.h" - -/* 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;i<PACKETBLOBS;i++) - oggpack_reset(vbi->packetblob[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); -} - -#ifdef ANALYSIS -int analysis_noisy=1; - -/* 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]; - - sprintf(buffer,"%s_%d.m",base,i); - of=fopen(buffer,"w"); - - if(!of)perror("failed to open data dump file"); - - for(j=0;j<n;j++){ - if(bark){ - float b=toBARK((4000.f*j/n)+.25); - fprintf(of,"%f ",b); - }else - if(off!=0) - fprintf(of,"%f ",(double)(j+off)/8000.); - else - fprintf(of,"%f ",(double)j); - - if(dB){ - float val; - if(v[j]==0.) - val=-140.; - else - val=todB(v+j); - fprintf(of,"%f\n",val); - }else{ - fprintf(of,"%f\n",v[j]); - } - } - fclose(of); -} - -void _analysis_output(char *base,int i,float *v,int n,int bark,int dB, - ogg_int64_t off){ - if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off); -} - -#endif - - - - - - - - - - - diff --git a/src/lib/dl/ext/vorbis/backends.h b/src/lib/dl/ext/vorbis/backends.h deleted file mode 100755 index ff5bcc95..00000000 --- a/src/lib/dl/ext/vorbis/backends.h +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: libvorbis backend and mapping structures; needed for - static mode headers - last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - -/* this is exposed up here because we need it for static modes. - Lookups for each backend aren't exposed because there's no reason - to do so */ - -#ifndef _vorbis_backend_h_ -#define _vorbis_backend_h_ - -#include "codec_internal.h" - -/* this would all be simpler/shorter with templates, but.... */ -/* Floor backend generic *****************************************/ -typedef struct{ - void (*pack) (vorbis_info_floor *,oggpack_buffer *); - vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *); - vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_floor *); - void (*free_info) (vorbis_info_floor *); - void (*free_look) (vorbis_look_floor *); - void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *); - int (*inverse2) (struct vorbis_block *,vorbis_look_floor *, - void *buffer,float *); -} vorbis_func_floor; - -typedef struct{ - int order; - long rate; - long barkmap; - - int ampbits; - int ampdB; - - int numbooks; /* <= 16 */ - int books[16]; - - float lessthan; /* encode-only config setting hacks for libvorbis */ - float greaterthan; /* encode-only config setting hacks for libvorbis */ - -} vorbis_info_floor0; - - -#define VIF_POSIT 63 -#define VIF_CLASS 16 -#define VIF_PARTS 31 -typedef struct{ - int partitions; /* 0 to 31 */ - int partitionclass[VIF_PARTS]; /* 0 to 15 */ - - int class_dim[VIF_CLASS]; /* 1 to 8 */ - int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */ - int class_book[VIF_CLASS]; /* subs ^ dim entries */ - int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */ - - - int mult; /* 1 2 3 or 4 */ - int postlist[VIF_POSIT+2]; /* first two implicit */ - - - /* encode side analysis parameters */ - float maxover; - float maxunder; - float maxerr; - - float twofitweight; - float twofitatten; - - int n; - -} vorbis_info_floor1; - -/* Residue backend generic *****************************************/ -typedef struct{ - void (*pack) (vorbis_info_residue *,oggpack_buffer *); - vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *); - vorbis_look_residue *(*look) (vorbis_dsp_state *, - vorbis_info_residue *); - void (*free_info) (vorbis_info_residue *); - void (*free_look) (vorbis_look_residue *); - long **(*class) (struct vorbis_block *,vorbis_look_residue *, - int **,int *,int); - int (*forward) (oggpack_buffer *,struct vorbis_block *, - vorbis_look_residue *, - int **,int *,int,long **,int); - int (*inverse) (struct vorbis_block *,vorbis_look_residue *, - float **,int *,int); -} vorbis_func_residue; - -typedef struct vorbis_info_residue0{ -/* block-partitioned VQ coded straight residue */ - long begin; - long end; - - /* first stage (lossless partitioning) */ - int grouping; /* group n vectors per partition */ - int partitions; /* possible codebooks for a partition */ - int partvals; /* partitions ^ groupbook dim */ - int groupbook; /* huffbook for partitioning */ - int secondstages[64]; /* expanded out to pointers in lookup */ - int booklist[512]; /* list of second stage books */ - - const int classmetric1[64]; - const int classmetric2[64]; -} vorbis_info_residue0; - -/* Mapping backend generic *****************************************/ -typedef struct{ - void (*pack) (vorbis_info *,vorbis_info_mapping *, - oggpack_buffer *); - vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *); - void (*free_info) (vorbis_info_mapping *); - int (*forward) (struct vorbis_block *vb); - int (*inverse) (struct vorbis_block *vb,vorbis_info_mapping *); -} vorbis_func_mapping; - -typedef struct vorbis_info_mapping0{ - int submaps; /* <= 16 */ - int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */ - - int floorsubmap[16]; /* [mux] submap to floors */ - int residuesubmap[16]; /* [mux] submap to residue */ - - int coupling_steps; - int coupling_mag[256]; - int coupling_ang[256]; - -} vorbis_info_mapping0; - -#endif diff --git a/src/lib/dl/ext/vorbis/barkmel.c b/src/lib/dl/ext/vorbis/barkmel.c deleted file mode 100755 index 6adb7154..00000000 --- a/src/lib/dl/ext/vorbis/barkmel.c +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: bark scale utility - last mod: $Id: barkmel.c 16037 2009-05-26 21:10:58Z xiphmont $ - - ********************************************************************/ - -#include <stdio.h> -#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/src/lib/dl/ext/vorbis/bitrate.c b/src/lib/dl/ext/vorbis/bitrate.c deleted file mode 100755 index 73001597..00000000 --- a/src/lib/dl/ext/vorbis/bitrate.c +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: bitrate tracking and management - last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "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)<desired_fill){ - while(choice+1<PACKETBLOBS && this_bits<avg_target_bits && - bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){ - choice++; - this_bits=oggpack_bytes(vbi->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_bits<min_target_bits){ - while(bm->minmax_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_bits<min_target_bits){ - bm->minmax_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_reservoir<desired_fill)bm->minmax_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/src/lib/dl/ext/vorbis/bitrate.h b/src/lib/dl/ext/vorbis/bitrate.h deleted file mode 100755 index db48fcb6..00000000 --- a/src/lib/dl/ext/vorbis/bitrate.h +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: bitrate tracking and management - last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $ - - ********************************************************************/ - -#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/src/lib/dl/ext/vorbis/block.c b/src/lib/dl/ext/vorbis/block.c deleted file mode 100755 index 1e3faea4..00000000 --- a/src/lib/dl/ext/vorbis/block.c +++ /dev/null @@ -1,1046 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: PCM data vector blocking, windowing and dis/reassembly - last mod: $Id: block.c 17561 2010-10-23 10:34:24Z xiphmont $ - - Handle windowing, overlap-add, etc of the PCM vectors. This is made - more amusing by Vorbis' current two allowed block sizes. - - ********************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ext/libogg/ogg.h> -#include "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;i<PACKETBLOBS;i++){ - if(i==PACKETBLOBS/2){ - vbi->packetblob[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;i<PACKETBLOBS;i++){ - oggpack_writeclear(vbi->packetblob[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;i<ci->books;i++) - vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]); - } - - b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy)); - for(i=0;i<ci->psys;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;i<ci->books;i++){ - if(ci->book_param[i]==NULL) - goto abort_books; - if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i])) - goto abort_books; - /* 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;i<vi->channels;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;i<ci->floors;i++) - b->flr[i]=_floor_P[ci->floor_type[i]]-> - look(v,ci->floor_param[i]); - - for(i=0;i<ci->residues;i++) - b->residue[i]=_residue_P[ci->residue_type[i]]-> - look(v,ci->residue_param[i]); - - return 0; - abort_books: - for(i=0;i<ci->books;i++){ - if(ci->book_param[i]!=NULL){ - vorbis_staticbook_destroy(ci->book_param[i]); - ci->book_param[i]=NULL; - } - } - vorbis_dsp_clear(v); - return -1; -} - -/* 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); - - /* compressed audio packets start after the headers - with sequence number 3 */ - v->sequence=3; - - 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){ - if(ci) - for(i=0;i<ci->floors;i++) - _floor_P[ci->floor_type[i]]-> - free_look(b->flr[i]); - _ogg_free(b->flr); - } - if(b->residue){ - if(ci) - for(i=0;i<ci->residues;i++) - _residue_P[ci->residue_type[i]]-> - free_look(b->residue[i]); - _ogg_free(b->residue); - } - if(b->psy){ - if(ci) - for(i=0;i<ci->psys;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){ - if(vi) - for(i=0;i<vi->channels;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;i<vi->channels;i++){ - v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); - } - } - - for(i=0;i<vi->channels;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=16; - 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;i<v->vi->channels;i++){ - /* need to run the extrapolation in reverse! */ - for(j=0;j<v->pcm_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); - -#if 0 - if(v->vi->channels==2){ - if(i==0) - _analysis_output("predataL",0,work,v->pcm_current-v->centerW,0,0,0); - else - _analysis_output("predataR",0,work,v->pcm_current-v->centerW,0,0,0); - }else{ - _analysis_output("predata",0,work,v->pcm_current-v->centerW,0,0,0); - } -#endif - - /* 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;j<v->pcm_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;i<vi->channels;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_current<blockbound)return(0); /* not enough data yet; - although this check is - less strict that the - _ve_envelope_search, - the search is not run - if we only use one - block size */ - - - } - - /* fill in the block. Note that for a short window, lW and nW are *short* - regardless of actual settings in the stream */ - - _vorbis_block_ripcord(vb); - vb->lW=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;i<vi->channels;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;i<vi->channels;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)){ - vorbis_dsp_clear(v); - 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;j<vi->channels;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;i<n1;i++) - pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i]; - }else{ - /* large/small */ - float *w=_vorbis_window_get(b->window[0]-hs); - float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2; - float *p=vb->pcm[j]; - for(i=0;i<n0;i++) - pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i]; - } - }else{ - if(v->W){ - /* 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;i<n0;i++) - pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i]; - for(;i<n1/2+n0/2;i++) - pcm[i]=p[i]; - }else{ - /* small/small */ - float *w=_vorbis_window_get(b->window[0]-hs); - float *pcm=v->pcm[j]+prevCenter; - float *p=vb->pcm[j]; - for(i=0;i<n0;i++) - pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i]; - } - } - - /* the copy section */ - { - float *pcm=v->pcm[j]+thisCenter; - float *p=vb->pcm[j]+n; - for(i=0;i<n;i++) - pcm[i]=p[i]; - } - } - - if(v->centerW) - 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 */ - long extra=b->sample_count-vb->granulepos; - - /* we use ogg_int64_t for granule positions because a - uint64 isn't universally available. Unfortunately, - that means granposes can be 'negative' and result in - extra being negative */ - if(extra<0) - extra=0; - - if(vb->eofflag){ - /* trim the end */ - /* no preceding 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 */ - - /* Guard against corrupt/malicious frames that set EOP and - a backdated granpos; don't rewind more samples than we - actually have */ - if(extra > (v->pcm_current - v->pcm_returned)<<hs) - extra = (v->pcm_current - v->pcm_returned)<<hs; - - v->pcm_current-=extra>>hs; - }else{ - /* trim the beginning */ - v->pcm_returned+=extra>>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 */ - - /* Guard against corrupt/malicious frames that set EOP and - a backdated granpos; don't rewind more samples than we - actually have */ - if(extra > (v->pcm_current - v->pcm_returned)<<hs) - extra = (v->pcm_current - v->pcm_returned)<<hs; - - /* we use ogg_int64_t for granule positions because a - uint64 isn't universally available. Unfortunately, - that means granposes can be 'negative' and result in - extra being negative */ - if(extra<0) - extra=0; - - 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_returned<v->pcm_current){ - if(pcm){ - int i; - for(i=0;i<vi->channels;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;j<vi->channels;j++){ - float *p=v->pcm[j]; - for(i=0;i<n1;i++){ - float temp=p[i]; - p[i]=p[i+n1]; - p[i+n1]=temp; - } - } - - v->pcm_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;j<vi->channels;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;j<vi->channels;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;i<vi->channels;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/src/lib/dl/ext/vorbis/books/coupled/res_books_51.h b/src/lib/dl/ext/vorbis/books/coupled/res_books_51.h deleted file mode 100755 index 917a9558..00000000 --- a/src/lib/dl/ext/vorbis/books/coupled/res_books_51.h +++ /dev/null @@ -1,12257 +0,0 @@ -static const long _vq_quantlist__44p0_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p0_l0_0[] = { - 1, 3, 4, 7, 7, 8, 8, 9, 9, 9,10,10,10, 5, 6, 5, - 8, 7, 9, 8, 9, 9,10, 9,11,10, 5, 5, 7, 7, 8, 8, - 9, 9, 9, 9,10,10,11, 8, 9, 8,10, 9,10, 9,10, 9, - 11,10,11,10, 8, 8, 9, 9,10, 9,10, 9,11,10,11,10, - 11,10,11,11,11,11,11,11,11,11,11,11,11,11,10,11, - 11,11,12,11,11,11,11,11,11,10,12,12,12,12,12,12, - 12,11,12,12,12,11,11,11,12,12,12,12,12,12,12,11, - 12,11,12,11,11,13,12,12,12,13,12,12,12,12,11,12, - 11,11,13,13,13,12,12,12,12,12,12,11,11,11,10,13, - 13,13,12,13,12,13,11,13,10,12,11,11,13,13,12,13, - 12,12,12,12,11,12,11,11,11, -}; - -static const static_codebook _44p0_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p0_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p0_l0_0, - 0 -}; - -static const long _vq_quantlist__44p0_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p0_l0_1[] = { - 1, 4, 4, 6, 6, 5, 5, 5, 7, 5, 5, 5, 5, 6, 7, 7, - 6, 7, 7, 7, 6, 7, 7, 7, 7, -}; - -static const static_codebook _44p0_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p0_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p0_l0_1, - 0 -}; - -static const long _vq_quantlist__44p0_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_l1_0[] = { - 1, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const static_codebook _44p0_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44p0_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p0_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p0_lfe[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book__44p0_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p0_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p0_long[] = { - 2, 3, 6, 7,10,14,16, 3, 2, 5, 7,11,14,17, 6, 5, - 5, 7,10,12,14, 7, 7, 6, 6, 7, 9,13,10,11, 9, 6, - 6, 9,11,15,15,13,10, 9,10,12,18,18,16,14,12,13, - 16, -}; - -static const static_codebook _huff_book__44p0_long = { - 2, 49, - (long *)_huff_lengthlist__44p0_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p0_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_p1_0[] = { - 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p0_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p0_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p0_p1_0, - 0 -}; - -static const long _vq_quantlist__44p0_p2_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_p2_0[] = { - 1, 5, 5, 0, 7, 7, 0, 8, 8, 0, 9, 9, 0,12,12, 0, - 8, 8, 0, 9, 9, 0,12,12, 0, 8, 8, 0, 6, 6, 0,11, - 11, 0,12,12, 0,12,12, 0,15,15, 0,11,11, 0,12,12, - 0,15,15, 0,12,12, 0, 5, 5, 0, 5, 5, 0, 6, 6, 0, - 7, 7, 0,11,11, 0, 6, 6, 0, 7, 7, 0,10,11, 0, 6, - 6, 0, 7, 7, 0,11,11, 0,12,12, 0,11,11, 0,15,15, - 0,10,10, 0,12,12, 0,15,15, 0,12,12, 0, 6, 6, 0, - 12,12, 0,12,12, 0,12,12, 0,15,15, 0,11,11, 0,12, - 12, 0,15,15, 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, - 0, 0, 0, 8, 8, 0,12,12, 0,12,12, 0,12,12, 0,15, - 15, 0,12,12, 0,11,12, 0,15,16, 0,11,11, 0, 6, 6, - 0,11,12, 0,12,12, 0,12,12, 0,16,15, 0,12,12, 0, - 13,12, 0,15,14, 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, 0, 0, -}; - -static const static_codebook _44p0_p2_0 = { - 5, 243, - (long *)_vq_lengthlist__44p0_p2_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p0_p2_0, - 0 -}; - -static const long _vq_quantlist__44p0_p2_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_p2_1[] = { - 1, 3, 3, 0, 9, 9, 0, 9, 9, 0,10,10, 0, 9, 9, 0, - 10,10, 0,10,10, 0, 9, 9, 0,10,10, 0, 7, 7, 0, 7, - 7, 0, 6, 6, 0, 8, 8, 0, 7, 7, 0, 8, 8, 0, 8, 9, - 0, 8, 8, 0, 8, 8, 0, 7, 7, 0, 9, 9, 0, 8, 8, 0, - 10,10, 0, 9, 9, 0,10,10, 0,10,10, 0, 9, 9, 0,10, - 10, 0, 9, 9, 0,11,11, 0,11,11, 0,12,12, 0,11,11, - 0,12,12, 0,13,13, 0,12,12, 0,13,12, 0, 8, 8, 0, - 12,12, 0,12,12, 0,13,13, 0,12,12, 0,13,13, 0,13, - 13, 0,13,13, 0,13,13, 0, 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, 9, 9, 0,11,11, 0,12,12, 0,13,13, 0,12, - 12, 0,13,13, 0,13,13, 0,12,12, 0,12,12, 0, 8, 8, - 0,12,12, 0,12,12, 0,13,13, 0,13,13, 0,13,14, 0, - 14,13, 0,13,13, 0,13,13, 0, 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, -}; - -static const static_codebook _44p0_p2_1 = { - 5, 243, - (long *)_vq_lengthlist__44p0_p2_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p0_p2_1, - 0 -}; - -static const long _vq_quantlist__44p0_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_p3_0[] = { - 1, 6, 6, 7, 8, 8, 7, 8, 8, 7, 9, 9,10,12,11, 9, - 8, 8, 7, 9, 9,11,12,12, 9, 9, 9, 6, 7, 7,10,11, - 11,10,11,11,10,11,11,13,13,14,12,12,12,11,11,11, - 14,14,14,12,12,12, 6, 5, 5, 9, 6, 5, 9, 6, 6, 9, - 7, 7,12,10,10,11, 6, 6,10, 7, 7,13,10,10,12, 7, - 7, 7, 8, 8,12,10,10,12,10,10,11,10,10,15,13,13, - 13, 9, 9,12,11,11,16,13,13,15,11,11, 8, 7, 7,12, - 12,12,12,11,11,12,11,11,14,14,14,14,12,12,12,12, - 12,16,15,15,14,12,12, 0,10,10, 0,12,12, 0,12,12, - 0,11,11, 0,14,14, 0,11,11, 0,12,12, 0,15,15, 0, - 11,11, 8, 8, 8,13,11,11,13,10,10,13,11,11,15,13, - 13,14,11,11,12,10,10,16,14,14,14,10,10, 9, 7, 7, - 13,11,11,13,11,11,12,11,11,16,14,14,14,12,12,13, - 12,12,15,14,14,15,13,12, 0,11,11, 0,12,12, 0,12, - 12, 0,12,12, 0,15,15, 0,12,12, 0,13,12, 0,14,15, - 0,12,12, -}; - -static const static_codebook _44p0_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p0_p3_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p0_p3_0, - 0 -}; - -static const long _vq_quantlist__44p0_p3_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p0_p3_1[] = { - 2, 4, 4, 8, 8,10,12,12,11,11, 9,11,11,12,13,11, - 12,12,11,11,11,12,12,12,12,10,13,12,13,13,11,12, - 12,13,13,11,12,12,13,13,11,12,13,13,13,11,13,13, - 13,13,10,13,13,12,13,11,12,12,14,14,11,13,12,12, - 12,11,12,12,13,13,11,13,13,12,12,11,13,13,13,13, - 11,12,12,13,13,11,13,13,12,12,11,12,12,13,13,11, - 13,13,12,12,11,13,13,13,13,11,12,12,14,14,11,13, - 13,12,12,11,12,12,13,13,11,13,13,12,12,11,10,10, - 10,10,12,10,10,11,11,11, 8, 8,11,11,13,10,10,10, - 10,12,10,10,10,10,13,11,11,11,11,13,10,10,11,11, - 13,11,11,12,12,13,11,11,11,11,13,11,11,12,12,13, - 11,11,12,12,13,10,10,11,11,13,11,11,11,11,13,11, - 10,11,11,13,11,11,11,11,13,11,11,11,11,13,10,10, - 11,11,13,11,11,11,11,12,10,11,11,11,13,11,11,11, - 11,13,11,11,11,11,13,10,10,11,11,13,11,11,11,11, - 13,11,11,11,11,13,11,11,11,11,11,10,10,10,10,12, - 10,10, 9, 9,12,12,12,11,11,13,12,12, 9, 9,13,12, - 12,10,10,12,12,12,12,12,13,13,13,14,14,13,12,12, - 11,11,13,13,13,12,12,13,12,12,11,11,13,12,13,11, - 11,13,13,13,14,14,13,12,12,10,10,13,13,13,11,11, - 13,12,12,10,10,13,13,13,11,11,13,13,13,14,14,13, - 12,12,10,10,13,13,13,11,11,13,12,13,10,10,13,13, - 13,11,11,13,13,13,14,14,13,12,12,10,10,13,13,13, - 11,11,13,13,12,10,10,14,12,12, 8, 8,14,12,12, 9, - 9,14,11,11, 9, 9,14,12,12, 8, 8,14,11,11, 7, 7, - 14,13,13,10,10,15,12,12,10,10,15,13,13,10,10,15, - 12,12, 9, 9,15,13,13,10,10,15,13,13,10,10,15,12, - 12,10,10,15,13,13,10,10,14,12,12, 9, 9,14,13,13, - 9, 9,14,13,13, 9, 9,15,12,12, 9, 9,15,13,13, 9, - 9,14,12,12, 9, 9,14,13,13, 9, 9,14,13,13, 9, 9, - 15,12,12, 9, 9,14,13,13, 9, 9,14,12,12, 9, 9,14, - 13,13, 9, 9,13,12,12, 8, 8,13,13,13, 8, 8,14,13, - 13, 9, 9,13,13,13, 7, 7,14,13,13, 8, 8,14,14,14, - 10,10,14,14,14,11,11,14,14,14, 9, 9,14,14,14,10, - 10,14,14,14, 9, 9,14,14,14,10, 9,15,14,14,11,11, - 14,14,14, 9, 9,14,14,14,10,10,14,14,14, 9, 9,14, - 14,14, 9, 9,15,14,14,11,11,14,14,14, 8, 8,14,14, - 14, 9, 9,14,14,14, 8, 8,14,14,14, 9, 9,15,14,14, - 11,11,14,14,14, 8, 8,14,14,14, 9, 9,14,14,14, 8, - 8,12,12,12,13,13,16,15,15,11,11,16,15,16,12,12, - 17,16,16,11,11,17,15,15,12,11,16,16,16,12,13,16, - 15,15,13,13,16,16,16,12,12,16,16,15,13,13,16,16, - 16,12,12,16,16,16,13,13,17,16,16,14,14,17,17,16, - 12,12,17,16,16,13,13,17,17,16,12,13,16,16,17,13, - 12,17,16,16,14,13,17,16,16,12,12,17,16,16,12,12, - 17,16,17,12,12,17,17,17,13,13,16,16,16,13,14,17, - 17,16,12,12,16,16,16,13,13,17,17,17,12,12,13,14, - 14,10,10,16,14,14,12,12,16,15,15,14,14,16,14,14, - 12,12,15,14,14,13,13,17,15,15,14,13,16,16,15,15, - 15,16,15,15,14,14,16,15,15,14,14,17,15,15,14,14, - 16,15,15,14,14,16,16,15,15,15,17,15,15,13,13,16, - 15,15,14,14,17,15,15,13,13,17,15,15,14,14,16,15, - 15,15,15,16,14,14,13,13,16,15,15,14,14,16,14,14, - 13,13,17,15,15,14,14,16,16,15,15,15,17,14,14,13, - 13,16,15,15,14,14,17,14,14,13,13,13,11,11,10,10, - 16,14,14,13,13,15,14,14,13,13,16,14,14,12,12,16, - 14,14,12,12,15,15,15,14,14,16,14,14,14,14,16,15, - 14,14,14,16,14,14,14,14,16,15,15,14,13,16,15,15, - 14,14,16,14,14,14,14,17,15,15,14,14,16,14,14,14, - 14,16,15,15,13,14,16,15,15,14,14,16,14,14,14,14, - 16,15,15,13,13,16,14,14,13,13,16,15,15,13,13,16, - 15,15,14,14,16,14,14,14,14,17,15,15,13,13,16,15, - 14,13,13,17,15,15,13,13,14,14,14, 9, 9,14,14,14, - 17,17,14,15,15,18,18,14,14,14,18,19,14,14,14,18, - 18,15,15,15,19,18,15,16,15,18,20,15,15,15,18,19, - 15,15,15,19,19,15,15,15,18,20,15,15,15,18,19,15, - 15,16,20,18,15,15,15,18,18,15,15,15,19,19,15,15, - 15,18,19,15,15,15,18,19,15,15,15,19,19,14,15,14, - 19,19,15,15,15,20,19,15,14,14,19,18,14,15,15,18, - 19,15,15,16,20,20,14,14,14,18,19,15,15,15,19,18, - 14,14,14,18,18,14,12,12, 9, 9,13,14,14,18,18,14, - 13,13,18,19,14,14,14,18,18,14,14,14,18,18,15,15, - 15,19,19,15,14,14,19,18,14,15,15,19,18,15,14,14, - 18,18,15,15,15,19,18,14,15,15,19,19,15,14,14,19, - 18,14,15,15,19,18,15,14,14,19,18,14,15,15,19,18, - 15,15,15,21,18,15,14,14,19,18,14,15,15,18,19,14, - 15,14,20,19,14,15,15,18,19,14,15,15,19,19,15,14, - 14,19,20,14,15,15,18,18,14,14,14,19,19,14,15,15, - 19,18,12,12,12,13,13,16,15,15,11,11,16,15,15,12, - 12,16,16,16,11,11,16,15,15,11,11,16,16,16,13,13, - 17,16,16,13,13,17,17,17,12,12,16,16,16,13,13,17, - 16,17,13,12,15,16,16,12,12,16,15,15,13,13,17,16, - 16,12,12,16,16,15,12,12,16,16,16,12,12,17,17,16, - 13,12,16,16,16,13,13,17,16,16,12,12,17,16,16,12, - 12,17,17,16,12,12,16,17,16,12,12,17,15,15,13,13, - 17,16,16,12,12,16,16,16,12,12,16,16,16,12,12,13, - 13,13, 9, 9,15,14,14,13,13,16,15,14,14,14,16,14, - 14,13,13,15,14,14,13,13,17,15,15,14,14,16,15,15, - 15,15,16,15,15,14,14,16,15,15,15,15,17,15,15,14, - 14,16,15,15,14,14,16,15,15,15,15,17,14,15,14,14, - 16,15,15,14,14,17,15,15,13,14,17,15,15,14,14,16, - 15,15,15,15,17,14,14,13,13,16,15,15,14,14,17,14, - 14,13,13,17,15,15,14,14,16,15,16,15,15,17,14,14, - 13,13,16,15,15,14,14,18,14,14,13,13,13,11,11,11, - 11,15,14,14,12,12,15,14,14,13,13,16,14,14,12,12, - 16,13,14,12,12,16,15,15,13,13,16,14,14,14,14,16, - 15,15,13,13,16,14,14,13,13,16,14,15,13,13,15,15, - 15,13,13,16,14,14,14,13,16,14,14,13,13,16,14,14, - 13,13,16,15,15,13,13,16,15,15,13,13,16,14,14,14, - 14,16,15,15,12,12,16,14,14,13,13,16,15,15,12,12, - 16,15,15,13,13,16,14,14,14,14,17,15,14,12,12,16, - 14,14,13,13,16,15,15,12,12,14,14,14, 8, 8,14,14, - 14,17,18,14,15,15,17,18,14,14,14,17,18,14,14,14, - 18,18,14,15,15,18,18,14,16,15,19,19,15,15,15,18, - 19,15,16,15,20,19,15,15,15,18,18,14,15,15,18,19, - 15,16,16,20,19,15,15,15,19,17,14,15,15,20,18,14, - 15,15,18,18,14,15,15,18,19,14,15,15,19,20,14,14, - 14,18,18,14,15,15,18,19,14,14,14,18,19,14,15,15, - 19,18,15,16,16,20,21,14,14,15,19,19,14,15,15,19, - 19,14,14,14,19,18,13,12,12, 9, 9,13,14,14,18,19, - 14,14,14,18,19,14,14,14,18,18,14,14,14,18,18,14, - 15,15,19,19,15,14,14,19,18,15,15,15,19,19,15,14, - 14,19,20,14,15,15,18,19,14,15,15,20,18,15,14,14, - 18,18,14,15,15,18,18,14,14,14,19,19,14,15,15,18, - 18,14,15,15,19,18,15,14,14,19,19,14,15,15,19,18, - 15,14,14,19,18,14,14,15,18,19,14,15,15,19,18,15, - 14,14,18,19,14,15,14,19,20,14,14,14,19,19,14,15, - 15,19,19,12,12,12,13,13,16,16,16,11,11,16,16,16, - 12,12,17,16,16,11,11,17,15,15,11,11,16,16,16,13, - 13,17,15,16,13,13,16,16,16,12,12,17,16,16,13,13, - 17,17,16,12,12,17,17,16,13,13,17,16,16,13,13,17, - 17,17,12,12,17,16,16,13,13,17,17,17,12,12,16,16, - 16,12,12,17,15,15,13,13,17,16,16,11,11,17,16,16, - 12,12,16,16,16,11,11,16,17,16,12,12,17,16,16,13, - 13,17,17,16,12,12,17,17,16,12,12,17,16,16,11,11, - 13,14,14, 9, 9,16,14,14,13,13,16,14,15,14,14,16, - 14,14,12,12,16,14,14,13,13,17,15,15,14,14,16,15, - 15,15,15,17,15,15,14,14,16,15,15,14,14,17,15,15, - 14,14,16,15,15,14,14,16,15,15,15,16,17,14,15,14, - 14,16,15,15,14,14,17,15,15,14,14,16,15,15,14,14, - 16,15,15,15,15,17,14,14,13,13,16,15,15,14,14,16, - 14,14,13,13,17,15,15,14,14,16,16,15,15,15,17,14, - 14,13,13,16,15,15,14,14,17,14,14,13,13,13,11,11, - 10,10,16,14,14,12,12,15,13,13,13,12,16,14,14,11, - 11,16,14,14,11,11,16,14,15,13,14,16,14,14,13,13, - 16,15,15,13,13,16,14,14,13,13,16,15,15,13,13,16, - 15,15,13,13,17,14,14,14,14,17,15,15,13,13,16,14, - 15,13,13,16,15,15,13,13,16,15,15,13,13,16,14,14, - 13,13,17,15,15,12,12,16,14,14,12,12,16,15,15,12, - 12,16,15,15,13,13,16,14,14,13,13,17,15,15,12,12, - 17,14,14,12,12,16,15,15,12,12,13,14,14, 8, 8,13, - 14,14,18,18,13,15,15,17,18,14,14,14,18,19,14,14, - 14,19,18,14,15,15,19,18,15,15,16,21,18,15,15,15, - 19,19,14,16,16,19,19,14,15,15,18,19,14,15,15,19, - 20,14,16,16,19,18,15,15,15,18,19,14,15,15,19,18, - 15,15,15,18,18,15,15,15,20,18,15,16,16,20,19,14, - 15,14,18,19,14,15,16,19,20,14,15,15,19,18,15,15, - 15,19,18,15,16,16,20,19,15,14,14,18,18,14,15,15, - 19,19,14,15,15,18,18,13,12,12, 8, 8,13,14,14,19, - 18,14,13,13,20,18,14,14,14,19,18,14,13,13,18,19, - 14,15,15,20,19,15,14,14,19,19,14,15,15,19,18,15, - 14,14,20,20,15,15,15,19,18,14,15,15,19,18,15,14, - 14,19,18,14,15,15,20,19,14,14,14,20,19,14,15,15, - 19,18,15,15,15,18,18,15,14,14,18,18,14,15,15,19, - 19,14,14,14,19,19,14,15,15,19,19,15,15,15,19,18, - 15,14,14,20,19,15,15,15,19,19,14,14,14,20,19,14, - 15,15,20,20,12,12,12,13,13,17,16,16,11,11,16,16, - 15,12,12,17,16,16,11,11,17,15,15,11,11,17,17,17, - 13,13,17,16,16,13,13,17,17,17,12,12,17,16,16,13, - 13,17,17,16,12,13,16,17,16,13,13,17,16,15,13,13, - 17,16,16,12,12,17,16,16,12,13,17,16,17,12,12,17, - 17,17,12,12,17,16,15,13,13,17,16,16,12,12,17,16, - 16,12,12,17,16,16,11,11,16,16,16,12,12,17,15,15, - 13,13,17,16,15,11,11,16,16,16,12,12,17,16,16,11, - 11,13,14,14, 9, 9,16,14,14,13,13,16,14,15,14,14, - 16,14,14,12,12,16,14,14,13,13,17,15,15,14,15,16, - 15,15,15,15,17,15,15,14,14,16,15,15,15,14,16,15, - 15,14,14,16,15,15,14,14,16,15,16,15,15,17,15,14, - 14,14,16,15,15,14,14,17,15,15,13,13,16,15,15,14, - 14,16,16,16,15,15,17,14,14,13,13,16,15,15,14,14, - 18,14,15,13,13,16,15,15,14,14,16,16,15,15,15,16, - 14,14,13,13,16,15,15,14,14,17,14,15,13,13,13,11, - 11,10,10,15,14,14,12,12,15,14,14,13,13,16,14,14, - 12,12,16,13,14,12,12,16,14,15,14,13,16,14,14,14, - 14,16,15,15,13,13,16,14,14,13,13,16,15,15,13,13, - 15,15,15,13,13,16,14,14,14,14,17,15,15,13,13,16, - 14,14,13,13,16,15,15,13,13,16,15,15,13,13,16,14, - 14,13,13,17,15,15,12,12,16,14,14,12,12,16,14,15, - 12,12,16,15,15,13,13,16,14,14,13,13,17,15,15,12, - 12,16,14,14,12,12,16,15,15,12,12,14,14,14, 8, 8, - 14,14,14,17,17,14,15,15,18,18,14,14,14,18,17,14, - 14,14,18,18,14,15,15,18,20,15,16,15,19,18,15,15, - 15,19,18,15,15,16,19,18,15,15,15,18,18,14,15,15, - 18,18,15,16,16,18,19,15,15,15,18,18,15,15,15,19, - 20,15,15,15,18,18,15,15,15,18,18,15,16,16,19,19, - 15,14,15,19,19,15,15,15,19,20,14,14,15,18,18,15, - 15,15,19,19,15,16,16,19,19,15,15,14,18,19,15,15, - 15,20,20,15,15,14,18,18,13,12,12, 8, 8,13,14,14, - 18,18,14,14,14,18,18,14,14,14,18,20,14,14,14,18, - 18,14,15,15,19,18,15,14,14,18,19,15,15,15,18,19, - 15,14,14,18,19,15,15,15,18,18,14,15,14,18,19,15, - 14,14,21,19,15,15,15,19,18,14,14,14,19,18,14,15, - 15,19,18,15,15,15,20,19,15,14,14,20,18,14,15,15, - 18,19,14,14,14,19,18,14,15,15,18,19,15,15,15,18, - 19,15,14,14,19,19,15,15,15,19,19,14,14,14,19,20, - 14,15,15,18,19, -}; - -static const static_codebook _44p0_p3_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p0_p3_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p0_p3_1, - 0 -}; - -static const long _vq_quantlist__44p0_p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p0_p4_0[] = { - 2, 6, 6,14,14, 6, 8, 8,14,14, 7, 7, 7,14,14, 0, - 13,13,15,16, 0,13,13,15,15, 7, 8, 8,15,15, 9,10, - 10,16,16, 9, 8, 8,14,15, 0,13,13,17,17, 0,13,13, - 16,16, 8, 8, 8,15,15,12,11,11,16,16, 9, 8, 8,14, - 14, 0,13,13,17,17, 0,13,13,15,15, 0,14,14,16,16, - 0, 0, 0,18,19, 0,12,12,16,15, 0,16,16, 0,20, 0, - 14,14,16,16, 0,14,14,17,17, 0, 0, 0,19,19, 0,12, - 12,15,15, 0,18,17,21,21, 0,14,14,16,16, 5, 7, 7, - 12,13, 9,10, 9,14,14,11,10,10,14,14, 0, 0, 0,18, - 17, 0,20,21,18,18, 9,10,10,14,14,12,12,12,17,16, - 12,10,10,14,14, 0,20,20,18,17, 0,21,21,17,17,11, - 10,10,14,14,15,13,13,18,18,13,11,11,14,14, 0,20, - 0,18,18, 0,20,21,18,17, 0,21, 0,18,19, 0, 0, 0, - 0,21, 0,21,20,16,17, 0, 0, 0,21,21, 0, 0, 0,20, - 18, 0,20, 0,17,18, 0, 0, 0, 0, 0, 0, 0,20,16,17, - 0, 0, 0,20, 0, 0, 0, 0,18,18, 6, 6, 6,13,13, 8, - 5, 5,11,11, 9, 6, 6,13,13, 0, 9, 9,12,12, 0,10, - 10,14,14, 9, 7, 7,13,13,12, 9, 9,13,13,10, 6, 6, - 13,13, 0,10,10,14,14, 0,10,10,13,13, 9, 7, 7,13, - 13,13,10,10,13,13,11, 6, 6,13,13, 0,10,10,15,15, - 0,10,10,13,13, 0,12,11,15,15, 0,20,19,17,16, 0, - 9, 9,13,13, 0,13,13,20,19, 0,11,11,13,13, 0,11, - 11,15,15, 0,20,19,17,17, 0,10,10,13,13, 0,14,15, - 0,21, 0,12,12,13,13, 0,10,10,12,12, 0,11,11,15, - 15, 0,11,11,15,15, 0,15,15,20,20, 0,16,16, 0, 0, - 0,11,11,15,15, 0,14,14,17,17, 0,11,11,15,15, 0, - 15,15,20,21, 0,16,16,21,21, 0,12,12,15,15, 0,15, - 15,18,20, 0,11,11,16,15, 0,15,15,21,21, 0,16,16, - 0,21, 0,16,16, 0, 0, 0, 0, 0, 0, 0, 0,14,14,21, - 21, 0,17,18, 0, 0, 0,16,17,20, 0, 0,16,16, 0, 0, - 0, 0, 0, 0, 0, 0,15,15,20,20, 0,19,18, 0,21, 0, - 18,17, 0, 0, 0,10,10,11,11, 0,10,10,10,10, 0,11, - 11,12,12, 0,11,11, 9, 9, 0,13,13,12,12, 0,11,11, - 12,12, 0,13,13,12,12, 0,10,10,12,12, 0,12,12,13, - 13, 0,12,12,12,12, 0,11,11,12,12, 0,13,13,12,12, - 0,10,10,12,12, 0,13,13,13,13, 0,12,12,12,12, 0, - 14,13,13,13, 0,19,21,15,15, 0,12,11,12,12, 0,16, - 15,19,19, 0,13,13,11,11, 0,13,13,13,13, 0, 0,21, - 15,16, 0,12,12,12,12, 0,16,16,19,21, 0,13,13,12, - 12, 7, 7, 7,16,16,11, 9, 9,16,16,12, 9, 9,16,16, - 0,13,13,16,16, 0,14,14,17,16,11, 9, 9,16,16,14, - 12,11,17,17,13, 8, 9,15,15, 0,13,13,19,19, 0,13, - 13,16,15,12,10,10,17,17,15,12,12,19,18,14, 9, 9, - 17,16, 0,14,14,18, 0, 0,14,13,16,16, 0,14,15,18, - 17, 0,21, 0,19,21, 0,12,12,16,16, 0,16,16, 0, 0, - 0,14,14,16,16, 0,14,14,18,18, 0, 0,21,20, 0, 0, - 13,13,16,17, 0,18,18, 0, 0, 0,15,14,17,16, 8, 7, - 7,14,14,11,10,10,15,15,13,10,10,15,15, 0,21,20, - 19,19, 0,21, 0,17,18,11,10,10,15,16,14,12,12,18, - 18,14,11,11,15,14, 0,21,20,18,19, 0, 0,21,18,18, - 12,11,11,16,16,16,14,14,18,20,14,11,11,16,15, 0, - 20,20,19,19, 0, 0,20,18,18, 0,21, 0,18,19, 0, 0, - 0, 0, 0, 0,20,20,17,18, 0, 0, 0,20,20, 0, 0, 0, - 19,19, 0, 0, 0,20,18, 0, 0, 0, 0, 0, 0, 0,21,18, - 18, 0,21,21, 0,21, 0, 0, 0,19,20,11, 9, 9,14,14, - 13,10,10,14,14,13,11,11,15,15, 0,13,13,13,13, 0, - 14,14,16,16,13,11,11,15,15,16,12,12,15,15,14,10, - 10,14,14, 0,14,14,16,16, 0,14,14,15,15,13,10,10, - 15,15,17,13,14,15,16,15,10,10,15,15, 0,14,14,17, - 16, 0,14,14,15,15, 0,15,15,17,17, 0, 0,21,18,18, - 0,13,13,15,15, 0,16,16,21,20, 0,14,14,15,14, 0, - 15,14,16,17, 0, 0,20,20,19, 0,13,13,15,15, 0,19, - 18, 0, 0, 0,15,15,15,15, 0,11,11,14,14, 0,12,12, - 16,16, 0,12,12,16,16, 0,15,16,21,21, 0,16,17,21, - 0, 0,12,12,17,16, 0,14,14,18,19, 0,11,11,16,16, - 0,15,15,20,21, 0,16,16,21, 0, 0,12,12,17,16, 0, - 15,15,19,19, 0,12,12,16,17, 0,16,15, 0, 0, 0,16, - 16, 0, 0, 0,17,17, 0,21, 0, 0, 0, 0, 0, 0,14,15, - 20, 0, 0,17,17, 0, 0, 0,17,17, 0, 0, 0,17,16, 0, - 0, 0, 0, 0, 0, 0, 0,15,15, 0, 0, 0,18,18, 0, 0, - 0,18,17, 0, 0, 0,11,11,14,14, 0,12,12,15,15, 0, - 12,12,15,15, 0,13,13,14,14, 0,14,14,17,17, 0,12, - 12,16,16, 0,14,14,16,16, 0,11,11,15,15, 0,13,13, - 16,17, 0,13,13,16,16, 0,12,12,15,15, 0,14,14,17, - 16, 0,11,11,15,15, 0,14,14,17,17, 0,13,13,16,16, - 0,15,15,17,18, 0,21,20,20,21, 0,12,12,15,15, 0, - 16,16,20,21, 0,14,14,15,15, 0,14,14,17,17, 0, 0, - 0,18,19, 0,12,13,15,15, 0,18,17,21, 0, 0,14,15, - 15,15, 8, 8, 8,16,16,12,10,10,16,16,13, 9, 9,16, - 16, 0,14,14,18,17, 0,14,14,16,17,12,10,10,18,17, - 14,12,11,18,18,14, 9, 9,16,16, 0,13,13,18,18, 0, - 13,13,17,16,12, 9, 9,16,17,17,13,13,17,17,14, 9, - 9,15,15, 0,14,14,20,19, 0,13,13,16,16, 0,15,15, - 19,18, 0, 0, 0,20,19, 0,12,13,17,17, 0,16,16,20, - 0, 0,14,14,16,17, 0,14,14,19,18, 0, 0, 0,20,20, - 0,13,13,16,16, 0,18,17, 0, 0, 0,15,15,16,16, 9, - 7, 7,14,14,12,10,10,15,15,13,10,10,15,15, 0,21, - 0,18,19, 0,20,21,19,18,12,10,10,16,15,15,13,13, - 18,18,14,11,11,15,15, 0, 0, 0,19,18, 0, 0,21,18, - 18,13,11,11,15,15,16,14,14,17,19,15,11,11,15,15, - 0,21,21,20,18, 0, 0,21,18,18, 0, 0,21,21,19, 0, - 0, 0, 0, 0, 0,19,20,18,17, 0, 0, 0,21,21, 0,21, - 0,20,18, 0, 0,21,19,19, 0, 0, 0, 0, 0, 0,20,21, - 17,17, 0, 0, 0, 0, 0, 0,21, 0,18,20, 0,10,10,14, - 14, 0,11,11,15,15, 0,11,11,15,15, 0,14,14,15,15, - 0,15,15,16,16, 0,11,12,16,16, 0,13,13,16,16, 0, - 11,11,15,15, 0,14,14,17,17, 0,14,14,15,15, 0,11, - 11,16,15, 0,14,14,15,15, 0,11,11,15,15, 0,15,15, - 17,17, 0,14,14,15,15, 0,16,16,18,18, 0, 0, 0,20, - 19, 0,14,13,16,15, 0,17,17,21, 0, 0,15,15,15,15, - 0,16,15,17,16, 0,20, 0,20,18, 0,13,14,15,15, 0, - 19,18, 0,21, 0,15,15,15,15, 0,11,11,14,14, 0,12, - 12,16,16, 0,12,12,16,16, 0,16,15,20,21, 0,17,16, - 0, 0, 0,12,12,16,16, 0,14,14,18,18, 0,11,11,16, - 16, 0,15,15,21,20, 0,16,16, 0, 0, 0,12,12,16,17, - 0,15,14,19,19, 0,11,12,16,16, 0,15,15,21, 0, 0, - 16,16, 0, 0, 0,16,17, 0, 0, 0, 0, 0, 0, 0, 0,15, - 15,21, 0, 0,17,17, 0, 0, 0,17,17, 0, 0, 0,17,16, - 0, 0, 0, 0, 0, 0, 0, 0,15,15, 0,20, 0,19,20, 0, - 0, 0,17,17, 0, 0, 0,12,12,15,15, 0,12,12,15,15, - 0,12,12,16,16, 0,13,13,15,15, 0,15,15,17,17, 0, - 13,13,17,16, 0,14,14,17,17, 0,11,11,16,16, 0,14, - 14,17,17, 0,13,13,16,16, 0,12,12,16,16, 0,15,15, - 16,17, 0,11,11,15,16, 0,14,14,17,17, 0,13,14,16, - 16, 0,15,15,18,18, 0,21,20,20,19, 0,13,13,16,17, - 0,16,16, 0, 0, 0,14,14,16,16, 0,15,15,18,18, 0, - 0, 0,20,19, 0,13,13,16,16, 0,17,17, 0, 0, 0,14, - 14,16,16, 0,11,11,16,16, 0,13,13,18,17, 0,13,13, - 17,17, 0,16,16,17,17, 0,16,16,17,18, 0,12,12,17, - 17, 0,15,15,18,18, 0,12,12,16,16, 0,16,16,19,19, - 0,15,15,16,17, 0,12,12,17,17, 0,17,17,18,18, 0, - 12,12,17,17, 0,16,16,19,19, 0,15,16,17,17, 0,16, - 16,18,17, 0, 0, 0,21,21, 0,13,13,16,16, 0,17,17, - 0,20, 0,15,15,16,17, 0,16,16,19,18, 0, 0,21,20, - 21, 0,14,14,17,16, 0,20, 0, 0, 0, 0,15,16,16,17, - 0, 9, 9,14,14, 0,13,13,16,16, 0,14,14,15,15, 0, - 0,20,19,19, 0, 0, 0,19,19, 0,12,12,15,15, 0,15, - 16,19,18, 0,14,14,15,15, 0,21, 0,18,18, 0,20, 0, - 17,18, 0,13,13,16,16, 0,17,17,17,19, 0,14,14,16, - 15, 0,21,20,20,19, 0, 0, 0,19,19, 0, 0, 0,19,18, - 0, 0, 0, 0, 0, 0,20,20,17,18, 0, 0, 0,21,21, 0, - 0, 0,18,18, 0,21, 0,18,19, 0, 0, 0, 0, 0, 0,20, - 21,18,18, 0, 0, 0,20,21, 0, 0, 0,19,19, 0,18,18, - 15,15, 0,20,21,17,17, 0,19,21,17,17, 0, 0, 0,17, - 18, 0, 0, 0,20,19, 0,19,19,17,17, 0, 0, 0,18,18, - 0,19,20,16,17, 0, 0,21,20,20, 0,19,20,19,18, 0, - 19,20,16,16, 0, 0, 0,18,19, 0,19,20,17,17, 0, 0, - 21, 0,20, 0,21,21,17,19, 0,20, 0,19,20, 0, 0, 0, - 20, 0, 0,19,18,17,16, 0, 0, 0, 0, 0, 0, 0,20,17, - 17, 0,20,21,18,20, 0, 0, 0, 0,21, 0,19,20,17,17, - 0, 0, 0, 0, 0, 0,20,21,17,17, 0,11,11,14,14, 0, - 13,13,16,17, 0,13,13,16,16, 0,17,17, 0,21, 0,18, - 17,21, 0, 0,13,13,16,16, 0,15,15,18,18, 0,12,12, - 16,16, 0,17,16,21, 0, 0,17,17, 0, 0, 0,12,12,17, - 17, 0,17,17,19,21, 0,13,12,16,16, 0,17,17, 0, 0, - 0,17,17, 0, 0, 0,18,17, 0,21, 0, 0, 0, 0, 0, 0, - 15,15,20, 0, 0,20,18, 0, 0, 0,17,18, 0, 0, 0,16, - 17, 0, 0, 0, 0, 0, 0, 0, 0,15,15, 0, 0, 0,19,19, - 0, 0, 0,18,18, 0, 0, 0,14,14,18,18, 0,16,16, 0, - 21, 0,16,16,21,21, 0,17,17, 0,20, 0,17,17,20, 0, - 0,16,15, 0, 0, 0,20,20, 0, 0, 0,15,15,20,20, 0, - 17,17,21, 0, 0,17,18,20,20, 0,15,15,20,20, 0,18, - 18, 0, 0, 0,15,15,19,20, 0,17,18, 0, 0, 0,17,17, - 20,20, 0,18,17,21, 0, 0, 0, 0, 0,21, 0,15,15,20, - 20, 0,19,19, 0, 0, 0,17,17,21, 0, 0,17,17, 0, 0, - 0, 0, 0,21, 0, 0,15,15,19,19, 0,20,21, 0, 0, 0, - 18,17,21,21, 0,12,12,16,16, 0,14,14,17,17, 0,13, - 13,17,18, 0,16,16,18,17, 0,16,16,18,18, 0,13,13, - 18,18, 0,15,16,19,18, 0,13,13,16,16, 0,16,16,20, - 18, 0,16,16,17,17, 0,12,13,17,17, 0,17,16,18,18, - 0,12,12,16,16, 0,17,16,20,19, 0,16,16,16,16, 0, - 16,17,18,20, 0, 0, 0,21,20, 0,14,14,17,16, 0,19, - 18, 0,20, 0,16,16,17,16, 0,16,16,17,18, 0, 0,21, - 21,21, 0,14,14,16,16, 0,20,20,21, 0, 0,16,16,16, - 16, 0,10,10,14,14, 0,14,14,15,16, 0,14,14,15,15, - 0, 0,21,18,18, 0, 0,21,18,19, 0,13,13,16,16, 0, - 16,16,18,18, 0,14,14,15,15, 0,21, 0,18,18, 0,21, - 0,18,18, 0,13,13,16,16, 0,17,17,19,20, 0,14,14, - 15,15, 0, 0, 0,18,20, 0, 0,21,18,18, 0, 0,21,19, - 18, 0, 0, 0, 0, 0, 0,20,21,18,17, 0, 0, 0,21,21, - 0, 0, 0,19,19, 0,21, 0,18,19, 0, 0, 0, 0, 0, 0, - 21,20,17,17, 0, 0,21,20, 0, 0, 0, 0,19,19, 0,19, - 20,15,16, 0, 0,20,18,17, 0,20,21,17,18, 0,21, 0, - 18,18, 0, 0, 0,19,19, 0,20,20,17,18, 0, 0, 0,18, - 19, 0,20,20,18,17, 0, 0, 0, 0,20, 0, 0,21,17,18, - 0,20,21,17,17, 0, 0, 0,18,18, 0,19,19,17,17, 0, - 0, 0,21,21, 0,20,20,17,17, 0, 0, 0,21,19, 0, 0, - 0,20,19, 0,21,20,17,18, 0, 0, 0, 0, 0, 0, 0,20, - 18,17, 0,21,20,18,18, 0, 0, 0,20,21, 0,20,20,17, - 17, 0, 0, 0, 0, 0, 0,20, 0,17,17, 0,11,11,13,14, - 0,13,13,16,16, 0,13,13,16,16, 0,17,17, 0, 0, 0, - 17,18, 0, 0, 0,13,13,16,16, 0,15,16,18,18, 0,13, - 13,16,17, 0,16,17,20, 0, 0,17,18,20, 0, 0,13,13, - 17,17, 0,16,16,20,21, 0,13,13,16,16, 0,17,17,21, - 0, 0,17,18, 0, 0, 0,17,18, 0,21, 0, 0, 0, 0, 0, - 0,15,15,20, 0, 0,19,19, 0, 0, 0,17,17, 0, 0, 0, - 18,17,21,20, 0, 0, 0, 0, 0, 0,16,16,20,21, 0,21, - 20, 0,21, 0,19,21, 0, 0, 0,15,15, 0, 0, 0,16,17, - 0,19, 0,16,16, 0, 0, 0,17,17, 0, 0, 0,19,18, 0, - 0, 0,16,16,20,20, 0,20,18,21, 0, 0,15,15,21,21, - 0,18,18, 0, 0, 0,18,19, 0, 0, 0,16,15, 0,21, 0, - 20,19, 0, 0, 0,16,16, 0, 0, 0,20,18, 0,21, 0,17, - 18,21, 0, 0,18,19, 0, 0, 0, 0, 0, 0, 0, 0,16,16, - 20,20, 0,19,20, 0, 0, 0,17,17, 0, 0, 0,18,17,20, - 21, 0, 0, 0, 0, 0, 0,16,16, 0,20, 0,20,22, 0, 0, - 0,18,18, 0,22, -}; - -static const static_codebook _44p0_p4_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p0_p4_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p0_p4_0, - 0 -}; - -static const long _vq_quantlist__44p0_p4_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p0_p4_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p0_p4_1 = { - 1, 7, - (long *)_vq_lengthlist__44p0_p4_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p0_p4_1, - 0 -}; - -static const long _vq_quantlist__44p0_p5_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_p5_0[] = { - 1, 6, 6, 6, 8, 8, 7, 8, 8, 7, 9, 8,10,11,11, 9, - 8, 8, 7, 8, 8,11,11,11, 9, 8, 8, 6, 7, 7,10,10, - 10,10,10,10,10,10,10,14,13,13,12,11,11,10,10,10, - 14,14,13,13,11,11, 6, 6, 6, 8, 5, 5, 8, 7, 7, 8, - 7, 7,11, 9, 9, 9, 7, 7, 8, 7, 7,12,10,10,10, 7, - 7, 7, 8, 8,12,11,11,12,10,10,11,10,10,14,13,13, - 13,10,10,11,10,11,16,14,14,13,10,10, 7, 8, 7,12, - 12,12,12,11,11,12,11,11,16,14,15,13,12,12,11,11, - 11,17,15,14,14,13,13,10, 9, 9,13,11,11,13,11,11, - 12,11,11,16,14,13,14,11,11,12,11,11,16,15,14,14, - 11,11, 7, 8, 8,12,11,11,12,10,10,12,10,10,16,14, - 13,13,11,11,12,10,10,16,14,14,13,10,10, 8, 8, 8, - 12,12,12,12,11,11,12,11,11,16,14,15,14,12,12,12, - 11,11,16,15,15,14,12,12,10,10,10,13,11,11,13,11, - 11,12,12,12,16,14,14,14,11,11,12,11,11,17,14,15, - 14,11,11, -}; - -static const static_codebook _44p0_p5_0 = { - 5, 243, - (long *)_vq_lengthlist__44p0_p5_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p0_p5_0, - 0 -}; - -static const long _vq_quantlist__44p0_p5_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_p5_1[] = { - 2, 7, 7, 7, 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, 9, 8, - 7, 7, 8, 8, 8, 9, 9, 9, 9, 7, 7, 6, 6, 6, 9, 7, - 7, 9, 7, 7, 9, 8, 8,10, 8, 8,10, 8, 8,10, 8, 8, - 10, 8, 8,10, 8, 8, 7, 6, 6, 9, 6, 6, 9, 6, 6, 9, - 7, 7,10, 8, 8, 9, 6, 6, 9, 7, 7,10, 8, 8, 9, 7, - 7, 7, 8, 8,11, 9, 9,11, 9, 9,11, 9, 9,12, 9, 9, - 12, 8, 8,12, 9, 9,12,10, 9,12, 8, 8, 8, 7, 7,10, - 9, 9,11, 9, 9,11, 9, 9,11,11,10,11, 9, 9,11,10, - 9,11,10,11,11, 9, 9,10, 8, 8,11, 9, 9,11, 9, 9, - 11, 9, 9,11,10,10,11, 9, 9,11, 9, 9,11,10,10,11, - 9, 9, 9, 8, 8,12, 9, 9,12, 9, 9,11, 9, 9,12, 9, - 9,12, 8, 8,12, 9, 9,12, 9, 9,12, 8, 8, 9, 7, 7, - 11, 9,10,11,10, 9,11, 9, 9,11,11,11,11, 9, 9,11, - 10,10,11,11,11,11, 9, 9,10, 9, 9,11, 9, 9,11,10, - 10,11,10, 9,11,10,10,11, 9, 9,11,10,10,11,10,11, - 11, 9, 9, -}; - -static const static_codebook _44p0_p5_1 = { - 5, 243, - (long *)_vq_lengthlist__44p0_p5_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p0_p5_1, - 0 -}; - -static const long _vq_quantlist__44p0_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p0_p6_0[] = { - 1, 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, 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, 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, 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, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p0_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p0_p6_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p0_p6_0, - 0 -}; - -static const long _vq_quantlist__44p0_p6_1[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p0_p6_1[] = { - 1, 3, 2, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, - 11,12,12,12,14,14,14,15,15, -}; - -static const static_codebook _44p0_p6_1 = { - 1, 25, - (long *)_vq_lengthlist__44p0_p6_1, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p0_p6_1, - 0 -}; - -static const long _vq_quantlist__44p0_p6_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p0_p6_2[] = { - 3, 4, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p0_p6_2 = { - 1, 25, - (long *)_vq_lengthlist__44p0_p6_2, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p0_p6_2, - 0 -}; - -static const long _huff_lengthlist__44p0_short[] = { - 3, 3, 7, 8,10,13,16, 3, 2, 5, 7, 9,13,16, 6, 4, - 4, 6,10,14,15, 7, 5, 5, 7,10,13,14, 9, 8, 9, 9, - 9,11,13,12,11,12, 9, 7, 8,11,14,12,10, 6, 5, 7, - 10, -}; - -static const static_codebook _huff_book__44p0_short = { - 2, 49, - (long *)_huff_lengthlist__44p0_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p1_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p1_l0_0[] = { - 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 4, 6, 5, - 8, 6, 9, 8,10, 9,10,10,11,10, 5, 5, 6, 6, 8, 8, - 9, 9,10,10,10,10,11, 7, 8, 8, 9, 8,10, 9,10, 9, - 11,10,11,10, 7, 8, 8, 8,10, 9,10,10,10,10,11,10, - 11, 9,10,10,11,11,11,11,12,11,12,11,12,11, 9,10, - 10,11,11,11,11,11,11,11,12,11,12,11,11,11,12,12, - 12,12,12,12,12,12,12,11,11,12,11,12,12,12,12,12, - 12,12,12,11,12,12,12,12,12,13,12,13,12,12,12,12, - 12,12,12,12,12,13,13,13,13,12,13,12,12,12,12,12, - 13,13,12,13,12,13,12,13,12,12,12,12,13,13,13,13, - 13,13,12,12,12,12,12,11,12, -}; - -static const static_codebook _44p1_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p1_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p1_l0_0, - 0 -}; - -static const long _vq_quantlist__44p1_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p1_l0_1[] = { - 1, 4, 4, 6, 6, 5, 5, 5, 6, 6, 5, 6, 5, 6, 6, 6, - 6, 7, 7, 7, 6, 7, 6, 7, 7, -}; - -static const static_codebook _44p1_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p1_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p1_l0_1, - 0 -}; - -static const long _vq_quantlist__44p1_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_l1_0[] = { - 1, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const static_codebook _44p1_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44p1_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p1_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p1_lfe[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book__44p1_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p1_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p1_long[] = { - 3, 3, 7, 7, 9,13,16, 3, 2, 4, 6,10,13,17, 7, 4, - 4, 6, 9,12,14, 7, 6, 6, 5, 7, 9,12,10,10, 9, 6, - 6, 9,12,14,14,13, 9, 8,10,11,18,18,15,13,11,10, - 11, -}; - -static const static_codebook _huff_book__44p1_long = { - 2, 49, - (long *)_huff_lengthlist__44p1_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p1_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_p1_0[] = { - 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p1_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p1_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p1_p1_0, - 0 -}; - -static const long _vq_quantlist__44p1_p2_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_p2_0[] = { - 1, 4, 4, 0, 7, 7, 0, 8, 8, 0, 9, 9, 0,12,12, 0, - 8, 8, 0, 9, 9, 0,12,12, 0, 8, 8, 0, 6, 6, 0,11, - 11, 0,11,11, 0,12,12, 0,14,14, 0,11,11, 0,12,12, - 0,14,14, 0,11,11, 0, 6, 6, 0, 6, 5, 0, 7, 6, 0, - 7, 7, 0,10,10, 0, 6, 6, 0, 7, 7, 0,10,10, 0, 7, - 7, 0, 7, 7, 0,10,10, 0,11,11, 0,11,11, 0,14,14, - 0,10,10, 0,12,12, 0,14,14, 0,12,12, 0, 6, 6, 0, - 11,11, 0,11,11, 0,12,12, 0,14,14, 0,11,11, 0,12, - 12, 0,15,15, 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, 8, 8, 0,11,11, 0,11,11, 0,12,12, 0,15, - 15, 0,12,12, 0,11,11, 0,15,15, 0,11,11, 0, 6, 6, - 0,11,11, 0,12,12, 0,12,12, 0,15,15, 0,11,11, 0, - 12,12, 0,14,14, 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, 0, 0, -}; - -static const static_codebook _44p1_p2_0 = { - 5, 243, - (long *)_vq_lengthlist__44p1_p2_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p1_p2_0, - 0 -}; - -static const long _vq_quantlist__44p1_p2_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_p2_1[] = { - 1, 3, 3, 0, 8, 8, 0, 8, 8, 0,10,10, 0, 9, 9, 0, - 10,10, 0,10,10, 0, 9, 9, 0,10,10, 0, 7, 7, 0, 7, - 7, 0, 7, 7, 0, 8, 8, 0, 8, 8, 0, 8, 8, 0, 9, 9, - 0, 8, 8, 0, 8, 8, 0, 7, 7, 0, 8, 8, 0, 8, 8, 0, - 10,10, 0, 9, 9, 0, 9, 9, 0,10,10, 0, 9, 9, 0,10, - 10, 0, 8, 8, 0,11,11, 0,11,11, 0,12,12, 0,11,11, - 0,12,12, 0,12,12, 0,12,12, 0,12,12, 0, 8, 8, 0, - 11,11, 0,11,11, 0,13,12, 0,12,12, 0,13,12, 0,13, - 13, 0,12,12, 0,13,13, 0, 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, 8, 8, 0,11,11, 0,11,11, 0,13,12, 0,12, - 12, 0,12,12, 0,12,12, 0,11,11, 0,12,12, 0, 8, 8, - 0,12,12, 0,12,12, 0,13,13, 0,12,12, 0,13,13, 0, - 13,13, 0,12,13, 0,13,13, 0, 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, -}; - -static const static_codebook _44p1_p2_1 = { - 5, 243, - (long *)_vq_lengthlist__44p1_p2_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p1_p2_1, - 0 -}; - -static const long _vq_quantlist__44p1_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_p3_0[] = { - 1, 6, 6, 6, 7, 7, 7, 8, 8, 7, 8, 8,10,11,11, 9, - 8, 8, 7, 9, 9,11,12,12, 9, 8, 8, 6, 7, 7, 9,11, - 11,10,11,11,10,11,11,13,13,13,11,12,12,10,11,11, - 13,14,14,12,12,12, 6, 6, 6, 8, 6, 6, 8, 6, 6, 9, - 7, 7,12,10,10,10, 6, 6, 9, 7, 7,12,10,10,11, 7, - 6, 7, 8, 8,12,10,10,12,10,10,11,10,10,15,13,13, - 13,10,10,12,11,11,15,13,13,14,11,11, 8, 7, 7,12, - 11,11,12,11,11,11,11,11,14,14,14,13,12,12,12,11, - 11,16,15,15,14,12,12, 0,10,10, 0,11,11, 0,12,12, - 0,11,11, 0,14,14, 0,11,11, 0,11,11, 0,15,15, 0, - 11,11, 7, 8, 8,13,10,10,12,10,10,12,11,11,15,13, - 13,14,11,11,12,10,10,16,14,14,14,10,10, 8, 7, 7, - 12,11,11,13,11,11,12,11,11,15,14,14,14,12,12,13, - 12,12,15,14,14,15,12,12, 0,11,11, 0,12,12, 0,12, - 12, 0,12,12, 0,15,15, 0,12,12, 0,12,12, 0,15,14, - 0,12,12, -}; - -static const static_codebook _44p1_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p1_p3_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p1_p3_0, - 0 -}; - -static const long _vq_quantlist__44p1_p3_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p1_p3_1[] = { - 2, 3, 4, 7, 7,10,12,12,12,12,10,11,11,13,13,11, - 12,12,11,11,12,12,12,12,12,11,13,13,13,13,12,12, - 12,13,14,12,13,13,13,13,12,13,13,13,13,12,13,13, - 13,13,11,13,13,13,13,12,12,12,14,14,12,13,13,12, - 12,12,12,13,13,13,12,13,13,13,13,12,13,13,13,13, - 12,12,12,14,14,12,13,13,12,12,12,13,13,13,13,12, - 13,13,12,12,12,13,13,13,13,12,12,12,14,14,12,13, - 13,12,12,12,13,13,13,13,12,13,13,12,12,10,10,11, - 10,10,11,11,11,11,11,11, 9, 9,10,10,12,11,11,10, - 10,12,10,10,10,10,13,12,12,12,12,13,11,11,11,11, - 13,12,12,12,12,13,11,11,11,11,13,12,12,12,12,13, - 12,12,12,12,13,11,11,11,11,13,12,12,12,12,13,11, - 11,11,11,13,12,12,11,11,13,12,12,11,11,13,11,11, - 11,11,13,12,12,11,11,13,11,11,11,11,13,12,12,11, - 11,13,12,12,11,11,13,11,11,11,11,13,12,12,11,11, - 13,11,11,11,11,13,12,12,11,11,11,11,11,10,10,11, - 11,11, 9, 9,11,12,12,11,11,12,12,12, 9, 9,13,13, - 13,10,10,13,13,13,11,11,13,13,13,14,14,13,13,13, - 11,10,13,13,14,12,12,13,13,13,11,11,13,13,13,11, - 11,13,13,13,14,14,13,13,13,10,10,13,13,13,11,11, - 13,13,13,10,10,13,14,13,11,11,13,14,14,14,14,13, - 13,13,10,10,13,14,14,11,11,13,13,13,10,10,13,14, - 14,11,11,13,13,13,14,14,14,13,13,10,10,13,14,14, - 11,11,13,13,13,10,10,14,12,12, 9, 9,14,12,12, 9, - 9,14,11,11, 9, 9,14,12,12, 8, 8,14,11,11, 7, 7, - 15,13,13,10,10,15,12,12,10,10,15,13,13,10,10,15, - 12,12,10,10,15,13,13,10,10,15,13,13,10,10,15,12, - 12,10,10,15,13,13,10,10,15,12,12,10,10,15,13,13, - 10,10,15,13,13,10,10,15,12,12,10,10,15,13,13, 9, - 9,15,12,12, 9, 9,14,13,13, 9, 9,15,13,13,10,10, - 15,12,12,10,10,15,13,13, 9, 9,15,12,12, 9, 9,15, - 13,13, 9, 9,13,12,12, 9, 9,13,13,13, 8, 8,13,13, - 13, 9, 9,13,13,13, 7, 7,14,13,13, 8, 8,14,14,14, - 10,10,15,14,14,11,11,14,14,14, 9, 9,15,14,14,10, - 10,15,14,14, 9, 9,14,14,14,10,10,15,14,14,11,11, - 15,14,14, 9, 9,14,14,14,10,10,14,14,14, 9, 9,15, - 14,15,10,10,15,14,14,11,11,14,14,14, 9, 9,14,14, - 14, 9, 9,14,14,14, 8, 8,15,14,14,10,10,15,14,14, - 11,11,14,14,14, 9, 9,15,14,14, 9, 9,14,14,14, 8, - 8,12,12,12,13,13,16,16,16,11,11,17,16,16,12,12, - 17,16,16,11,11,17,16,16,11,11,17,17,16,13,13,17, - 16,16,13,13,18,17,16,12,12,17,16,16,13,13,17,16, - 17,12,12,18,17,17,13,13,17,16,16,14,14,18,17,17, - 12,12,18,16,16,13,13,17,17,17,13,12,17,17,17,13, - 13,17,16,16,13,13,18,17,17,12,12,17,16,16,13,12, - 17,17,17,12,12,18,17,17,13,13,18,16,16,14,14,18, - 17,17,12,12,17,17,17,13,13,18,17,18,12,12,13,14, - 14,10,10,16,14,14,13,13,17,15,15,14,14,17,14,14, - 12,13,16,14,14,13,13,17,15,15,14,14,16,16,16,15, - 15,17,15,15,14,14,17,16,16,14,15,17,15,15,14,14, - 17,15,16,14,14,17,16,16,15,15,17,15,15,13,13,17, - 15,15,14,14,18,15,15,13,14,17,15,15,14,14,16,16, - 16,15,15,17,15,15,13,13,17,15,15,14,14,17,15,15, - 13,13,17,15,15,14,14,16,16,16,15,15,17,15,15,13, - 13,17,15,15,14,14,18,15,15,13,13,13,11,11,10,10, - 16,14,14,13,12,16,14,14,13,13,16,15,14,12,12,16, - 14,14,12,12,16,15,15,14,14,16,14,14,14,14,17,15, - 15,13,13,16,15,15,14,14,17,15,15,13,14,17,15,15, - 14,14,17,15,14,14,14,17,15,15,13,13,17,15,15,14, - 14,17,15,15,13,13,17,15,15,14,14,17,14,14,14,14, - 17,15,15,13,13,17,15,15,13,13,17,15,15,13,13,17, - 15,15,14,14,17,15,15,14,14,17,15,15,13,13,17,15, - 15,13,13,17,15,15,13,13,14,14,15, 8, 8,14,14,14, - 19,19,14,15,15,18,19,14,14,14,19,18,14,14,14,19, - 19,15,15,15,19,18,15,16,16,19,19,15,15,15,19,19, - 15,16,16,20,19,15,15,15,19,19,15,15,15,19,19,16, - 16,16,20,19,15,15,15,19,18,15,16,16,20,19,15,15, - 15,18,18,15,15,15,19,20,15,16,16,19,19,15,15,15, - 20,19,15,15,15,20,19,15,15,15,19,18,15,15,15,19, - 19,15,16,16,19,20,15,15,15,19,19,15,15,15,19,20, - 15,15,15,19,19,14,12,12, 9, 9,14,14,14,19,19,14, - 14,14,19,19,14,14,15,20,19,15,14,14,18,19,15,15, - 15,19,19,15,15,14,20,19,15,15,15,20,19,15,15,14, - 20,19,15,15,15,20,19,15,15,15,19,20,15,14,14,19, - 20,15,15,15,20,20,15,14,14,20,19,15,15,15,19,19, - 15,15,15,19,19,15,14,14,19,19,15,15,15,19,20,15, - 15,15,20,20,15,15,15,19,19,15,15,15,20,19,16,14, - 14,19,19,15,15,15,20,19,15,14,15,20,19,14,15,15, - 20,19,12,12,12,13,13,16,16,16,11,11,16,16,16,12, - 12,17,16,16,11,11,17,15,16,11,11,17,17,17,13,13, - 18,16,17,13,13,18,17,17,13,12,17,16,17,13,13,17, - 17,17,13,13,16,16,16,12,12,17,16,16,13,13,17,16, - 16,12,12,17,16,16,12,13,17,17,17,12,12,17,17,17, - 13,13,18,16,16,13,13,18,17,17,12,12,18,17,17,12, - 12,17,17,17,12,12,17,17,17,12,12,17,16,16,13,13, - 17,17,17,12,12,17,16,16,12,12,17,17,17,12,12,13, - 14,14, 9, 9,16,14,14,13,13,16,15,15,14,14,17,14, - 14,13,13,16,14,14,13,13,17,15,15,15,15,16,16,16, - 15,15,17,15,15,14,14,17,15,15,15,15,17,15,15,14, - 14,17,15,15,14,14,16,16,16,15,15,17,15,15,14,14, - 17,15,15,14,14,17,15,15,14,14,17,15,15,14,14,16, - 16,16,15,15,18,15,15,14,13,17,15,15,14,14,17,15, - 15,13,13,17,15,15,14,14,16,16,16,15,15,17,15,15, - 14,13,17,15,15,14,14,17,15,15,13,13,13,11,11,11, - 11,16,14,14,12,12,16,14,14,13,13,16,15,14,12,12, - 17,14,14,12,12,17,15,15,13,13,17,14,14,14,14,17, - 15,15,13,13,17,14,15,14,13,17,15,15,13,13,16,15, - 15,13,13,16,14,14,14,14,17,15,15,13,13,16,14,14, - 13,13,16,15,15,13,13,17,15,15,13,13,17,14,14,14, - 14,17,15,15,12,12,17,15,15,13,13,17,15,15,12,12, - 16,15,15,13,13,17,14,14,13,14,17,15,15,12,12,17, - 14,14,13,13,17,15,15,12,12,14,14,14, 8, 8,14,14, - 14,18,18,14,15,15,19,19,14,14,14,19,19,14,15,14, - 18,19,15,15,15,18,19,15,16,16,20,20,15,15,15,19, - 20,15,16,16,19,20,15,15,15,19,20,15,15,16,19,19, - 15,16,16,20,20,15,15,15,20,19,15,16,16,20,19,15, - 15,15,19,20,15,15,15,19,19,15,16,16,20,19,15,15, - 15,19,19,15,16,15,20,19,15,15,15,19,19,15,15,15, - 19,20,15,16,16,20,20,15,15,15,19,19,15,15,15,20, - 20,15,15,15,19,19,14,12,12, 9, 9,14,14,14,18,18, - 14,14,14,19,20,14,14,14,18,18,14,14,14,18,19,15, - 15,15,19,20,15,14,14,19,19,15,15,15,19,19,15,14, - 15,19,19,15,15,15,18,20,15,15,15,19,19,15,14,14, - 19,19,15,15,15,20,19,15,15,14,20,20,15,15,15,19, - 19,15,15,15,19,19,15,14,14,19,19,15,15,15,19,19, - 15,14,14,19,20,14,15,15,19,19,15,15,15,19,19,15, - 14,14,20,19,15,15,15,19,19,15,14,14,20,19,15,15, - 15,19,19,13,12,12,13,13,17,17,16,11,11,16,16,16, - 12,12,17,17,16,11,11,17,16,16,11,11,17,17,17,13, - 13,17,16,16,13,13,18,17,17,12,12,17,16,16,13,13, - 18,17,17,12,12,18,17,17,13,13,18,16,17,13,13,17, - 17,17,12,12,18,17,17,13,13,18,17,17,12,12,17,16, - 17,12,12,17,16,16,13,13,17,16,16,11,11,17,16,16, - 12,12,17,17,17,11,11,17,17,17,12,12,18,16,16,13, - 13,18,17,17,12,11,17,16,16,12,12,18,17,17,11,11, - 13,14,14, 9, 9,16,14,14,13,13,16,15,15,14,14,17, - 14,14,12,12,16,14,14,13,13,17,15,15,14,14,17,16, - 16,15,16,18,15,15,14,14,17,15,15,14,14,17,15,15, - 14,14,18,15,15,14,14,16,16,16,15,16,18,15,15,14, - 14,17,16,15,14,14,18,15,15,14,14,17,15,15,14,14, - 17,16,16,15,15,18,14,15,13,13,17,15,15,14,14,18, - 15,15,13,13,17,15,15,14,14,17,16,15,15,15,17,15, - 15,13,13,17,15,15,14,14,18,15,15,13,13,13,11,11, - 10,10,16,14,14,12,12,16,14,14,12,12,17,14,15,11, - 11,17,14,14,11,11,17,15,15,13,13,17,14,14,14,13, - 17,15,15,13,13,16,15,15,13,13,17,15,15,13,13,17, - 15,15,13,13,17,14,14,14,14,17,15,15,13,13,17,14, - 15,13,13,16,15,15,13,13,17,15,15,13,13,17,14,14, - 13,13,17,15,15,12,12,16,14,14,12,12,17,15,15,12, - 12,17,15,15,13,13,17,14,14,13,13,17,15,15,12,12, - 17,14,14,12,12,17,15,15,12,12,13,15,14, 8, 8,14, - 14,14,19,19,14,15,15,18,19,14,14,14,18,19,14,15, - 14,19,19,15,16,15,19,19,15,16,16,19,20,15,15,15, - 19,19,15,16,16,19,19,15,16,16,19,19,15,15,15,19, - 19,15,16,16,20,20,15,15,15,19,19,15,15,15,19,19, - 15,15,15,19,19,15,15,15,19,19,15,16,16,20,19,15, - 15,15,19,19,15,15,15,19,19,15,15,15,19,19,15,16, - 15,19,19,15,16,16,21,19,15,15,15,20,20,15,15,15, - 20,21,15,15,15,19,20,14,12,12, 8, 8,14,14,14,19, - 19,14,13,13,19,19,14,14,14,19,19,14,13,14,19,19, - 15,15,15,20,20,15,14,14,20,19,15,15,15,19,20,15, - 14,14,19,20,15,15,15,20,19,15,15,15,19,20,15,14, - 14,20,20,15,15,15,20,19,15,14,14,19,19,15,15,15, - 19,19,15,15,15,20,19,15,14,14,21,19,15,15,15,20, - 21,15,14,14,21,19,15,15,15,19,19,15,15,15,20,20, - 15,14,14,19,21,15,15,15,19,19,15,14,14,19,20,15, - 15,15,19,19,13,12,12,13,13,17,16,16,11,11,17,16, - 15,12,12,18,16,16,11,11,17,16,16,11,11,18,17,17, - 13,13,18,16,16,13,13,17,17,17,12,13,18,17,16,13, - 13,18,17,17,13,13,17,17,17,13,13,17,16,16,13,13, - 18,16,17,12,12,17,16,16,13,12,17,17,17,12,12,18, - 17,17,13,12,18,16,16,13,13,18,17,17,12,12,17,16, - 16,12,12,17,17,17,11,11,17,16,16,12,12,17,16,16, - 13,13,17,16,16,11,11,17,16,16,12,12,17,17,17,11, - 11,13,14,14, 9, 9,16,14,14,13,13,16,15,15,14,14, - 17,14,14,12,12,16,14,14,13,13,17,15,15,14,14,17, - 15,16,15,15,17,15,15,14,14,17,15,16,14,15,18,15, - 15,14,14,17,15,15,14,14,16,16,16,15,15,18,15,15, - 13,14,17,15,15,14,14,18,15,15,14,14,17,15,15,14, - 14,17,16,16,15,15,17,15,15,13,13,17,15,15,14,14, - 18,15,15,13,13,17,15,15,14,14,17,16,16,15,15,17, - 15,15,13,13,17,15,15,14,14,18,15,15,13,13,13,11, - 11,10,10,16,14,14,12,12,16,14,14,13,13,17,14,14, - 11,11,17,14,14,12,12,17,15,15,14,14,17,14,14,14, - 14,17,15,15,13,13,17,15,14,13,13,16,15,15,13,13, - 16,15,15,13,13,17,14,14,14,14,17,15,15,13,13,17, - 14,14,13,13,16,15,15,13,13,16,15,15,13,13,17,14, - 14,13,13,17,15,15,12,12,17,14,14,12,12,16,15,15, - 12,12,17,15,15,13,13,17,14,14,13,13,17,15,15,12, - 12,17,14,14,12,12,16,15,15,12,12,14,14,14, 8, 8, - 14,14,14,18,18,14,15,15,19,18,14,14,14,18,18,14, - 14,14,18,19,15,16,15,19,19,15,17,16,20,20,15,15, - 15,19,19,15,16,16,19,19,15,15,15,19,19,15,16,15, - 18,19,15,16,16,20,20,15,15,15,19,19,15,16,16,19, - 20,15,15,15,19,19,15,15,16,19,19,15,16,16,20,20, - 15,15,15,19,19,15,15,15,19,20,15,15,15,19,19,15, - 15,15,19,19,15,16,16,20,20,15,15,15,19,20,15,16, - 16,20,20,15,15,15,19,19,13,12,12, 8, 8,14,14,14, - 19,20,14,14,14,19,19,14,14,14,18,19,14,14,14,19, - 20,15,15,15,19,20,15,14,14,21,20,15,15,15,20,20, - 15,15,14,19,19,15,15,15,19,19,15,15,15,19,19,15, - 14,14,19,20,15,15,15,19,20,15,14,14,19,19,15,15, - 15,19,19,15,15,15,19,19,16,14,14,19,19,15,15,15, - 20,20,15,14,14,21,19,15,15,15,19,19,15,15,15,19, - 20,16,14,14,19,20,15,15,15,19,19,15,14,14,19,19, - 15,15,15,20,19, -}; - -static const static_codebook _44p1_p3_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p1_p3_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p1_p3_1, - 0 -}; - -static const long _vq_quantlist__44p1_p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p1_p4_0[] = { - 2, 6, 6,14,14, 6, 7, 7,14,14, 7, 7, 7,14,14, 0, - 13,13,16,16, 0,13,13,15,14, 7, 8, 8,15,15, 9,10, - 10,16,16, 9, 8, 8,15,15, 0,13,13,17,16, 0,13,13, - 15,16, 8, 8, 8,15,15,12,11,11,16,16, 9, 8, 8,14, - 14, 0,13,13,17,18, 0,13,13,15,15, 0,14,14,16,16, - 0, 0, 0,19,18, 0,12,12,16,15, 0,15,16, 0,20, 0, - 14,14,16,16, 0,14,14,17,17, 0, 0, 0,19,18, 0,12, - 12,15,15, 0,17,17, 0,20, 0,14,14,16,16, 5, 6, 7, - 12,12, 9, 9, 9,14,14,10,10,10,14,14, 0,21,21,18, - 17, 0,20,20,18,17, 9,10,10,14,14,12,12,12,16,16, - 12,10,10,14,14, 0,20,19,18,17, 0, 0,20,17,18,11, - 10,10,14,14,14,13,13,18,18,13,11,11,14,14, 0,20, - 20,17,18, 0,21,21,17,17, 0,21, 0,18,18, 0, 0, 0, - 0, 0, 0,20,19,16,17, 0, 0, 0,19,19, 0, 0, 0,18, - 18, 0,21,21,18,18, 0, 0, 0, 0, 0, 0,20,20,16,17, - 0, 0, 0,21,21, 0, 0, 0,18,19, 6, 6, 6,13,12, 8, - 6, 6,11,11, 8, 6, 6,13,13, 0, 9, 9,11,11, 0,11, - 10,14,14, 9, 7, 7,13,13,11, 9, 9,13,13,10, 6, 6, - 13,13, 0,10,10,14,15, 0,10,10,13,13, 9, 7, 7,13, - 13,13,10, 9,13,13,10, 6, 6,13,13, 0,10,10,15,14, - 0,10,10,13,13, 0,11,11,15,15, 0,19,20,17,17, 0, - 9, 9,13,13, 0,13,13,20,20, 0,11,11,13,13, 0,11, - 11,15,15, 0,19,19,17,17, 0,10,10,13,13, 0,15,15, - 20,20, 0,12,12,13,13, 0,10,10,12,12, 0,11,11,15, - 15, 0,11,11,15,15, 0,15,15,20, 0, 0,16,16, 0,21, - 0,11,11,15,15, 0,14,14,18,17, 0,11,11,15,15, 0, - 15,16,19,20, 0,16,16,21,21, 0,12,12,15,15, 0,15, - 14,18,18, 0,11,11,16,16, 0,15,15,21,21, 0,16,15, - 0, 0, 0,16,16,21, 0, 0, 0, 0, 0, 0, 0,14,14,20, - 20, 0,18,18, 0, 0, 0,16,17,21, 0, 0,16,16,21,21, - 0, 0, 0, 0, 0, 0,15,15,21,21, 0,20,19, 0,21, 0, - 17,17, 0, 0, 0,10,10,12,11, 0,10,10,10,11, 0,11, - 11,12,12, 0,11,11, 9, 9, 0,13,13,11,12, 0,11,11, - 12,12, 0,13,13,12,12, 0,10,10,12,12, 0,12,12,13, - 13, 0,12,12,12,12, 0,11,11,12,12, 0,13,13,12,12, - 0,10,10,12,12, 0,13,13,14,14, 0,12,12,12,12, 0, - 14,14,14,13, 0,19,20,15,15, 0,12,11,12,12, 0,15, - 15,21,20, 0,13,13,11,11, 0,13,13,13,13, 0,19, 0, - 15,15, 0,12,12,12,12, 0,17,16,19, 0, 0,13,13,12, - 12, 7, 7, 7,16,16,11, 9, 9,15,15,12, 9, 9,16,16, - 0,13,13,15,14, 0,14,14,17,16,10, 9, 9,16,16,14, - 11,11,17,16,12, 9, 8,15,15, 0,13,13,18,18, 0,13, - 13,15,15,12,10,10,18,17,15,12,12,17,17,14, 9, 9, - 16,16, 0,13,13,18,19, 0,14,13,17,16, 0,14,14,18, - 18, 0, 0, 0,20,21, 0,12,12,16,16, 0,16,16,20,21, - 0,14,14,17,16, 0,14,14,18,19, 0, 0, 0,19,21, 0, - 13,13,17,17, 0,17,17, 0,21, 0,15,15,16,16, 8, 7, - 7,14,14,11,10,10,15,15,12,10,10,15,15, 0,20,20, - 18,18, 0, 0, 0,17,17,11,10,10,16,16,14,12,12,18, - 17,14,11,11,15,15, 0,20,21,18,18, 0, 0,19,18,17, - 12,10,10,16,16,17,14,14,19,19,14,11,11,15,15, 0, - 21,21,19,19, 0,21,20,19,18, 0,21, 0,18,19, 0, 0, - 0, 0, 0, 0,20,20,18,17, 0,21, 0, 0, 0, 0, 0, 0, - 19,18, 0, 0, 0,18,19, 0, 0, 0, 0, 0, 0, 0,21,17, - 18, 0, 0, 0, 0,21, 0, 0,21,18,19,11, 9, 9,14,14, - 13,10,10,13,13,13,11,11,15,15, 0,13,13,12,12, 0, - 15,15,16,16,13,10,10,15,15,16,12,12,15,15,15,10, - 10,15,15, 0,14,13,16,15, 0,14,13,15,15,13,10,10, - 15,15,18,14,14,15,15,15,10,10,14,15, 0,14,14,16, - 16, 0,14,14,16,15, 0,15,15,17,16, 0,21, 0,18,18, - 0,12,13,15,15, 0,16,16, 0, 0, 0,14,14,15,15, 0, - 15,15,16,16, 0,21,20,18,18, 0,13,13,15,15, 0,19, - 18, 0, 0, 0,15,15,15,15, 0,11,11,13,13, 0,12,12, - 16,16, 0,12,12,16,16, 0,15,16,20, 0, 0,16,17, 0, - 0, 0,12,12,16,16, 0,14,14,18,18, 0,11,11,16,17, - 0,15,15,20, 0, 0,16,16, 0, 0, 0,12,12,16,16, 0, - 15,15,19,19, 0,11,11,17,17, 0,16,16,21, 0, 0,16, - 16, 0, 0, 0,17,17,20,20, 0, 0, 0, 0, 0, 0,15,15, - 20, 0, 0,17,18, 0, 0, 0,17,17, 0, 0, 0,16,16, 0, - 21, 0, 0, 0, 0, 0, 0,15,15,21, 0, 0,19,18, 0, 0, - 0,18,17, 0, 0, 0,11,11,14,14, 0,11,11,15,15, 0, - 12,12,16,16, 0,13,13,14,14, 0,14,14,17,17, 0,12, - 12,16,16, 0,14,14,16,16, 0,11,11,16,15, 0,13,13, - 16,17, 0,13,13,16,16, 0,12,12,15,16, 0,15,14,16, - 16, 0,11,11,15,15, 0,14,14,17,17, 0,13,13,16,16, - 0,15,14,18,18, 0,21, 0,19,19, 0,13,13,15,15, 0, - 16,16,20,20, 0,14,14,16,15, 0,14,14,17,17, 0,21, - 0,20,18, 0,13,13,15,15, 0,17,17, 0, 0, 0,14,14, - 16,15, 8, 8, 8,16,16,12, 9, 9,16,16,13, 9, 9,16, - 16, 0,14,14,18,17, 0,14,14,16,17,12,10,10,18,17, - 14,11,11,18,18,14, 9, 9,16,16, 0,13,13,18,18, 0, - 13,13,17,16,12, 9, 9,16,17,17,13,13,16,16,14, 9, - 9,15,15, 0,14,14,20,20, 0,13,13,15,15, 0,15,14, - 18,18, 0, 0, 0,20,21, 0,12,13,16,17, 0,16,16,20, - 21, 0,14,14,16,17, 0,14,14,18,17, 0, 0, 0,20,21, - 0,13,13,16,16, 0,19,17, 0,21, 0,14,15,16,16, 8, - 7, 7,14,13,12,10,10,15,15,13,10,10,15,15, 0,21, - 21,18,19, 0,20,21,18,18,12,10,10,16,15,15,12,12, - 17,17,14,11,11,15,15, 0,21,21,19,18, 0, 0,21,17, - 18,13,11,11,15,15,16,13,13,18,19,15,11,11,15,14, - 0,21, 0,19,19, 0, 0,21,18,18, 0, 0,21,19,19, 0, - 0, 0, 0, 0, 0,20,19,17,17, 0, 0, 0,21, 0, 0,21, - 0,18,19, 0, 0,20,20,19, 0, 0, 0, 0, 0, 0,21,20, - 18,17, 0, 0, 0, 0,20, 0, 0, 0,18,19, 0,10,10,15, - 14, 0,11,11,14,14, 0,11,11,15,16, 0,14,14,15,15, - 0,15,15,16,16, 0,11,11,16,16, 0,14,13,16,16, 0, - 11,11,15,15, 0,14,14,16,16, 0,14,14,15,15, 0,11, - 11,15,15, 0,13,13,15,15, 0,11,11,15,15, 0,15,15, - 18,17, 0,14,14,15,15, 0,15,16,18,18, 0, 0, 0,20, - 20, 0,14,13,16,15, 0,17,17,21, 0, 0,15,15,15,15, - 0,16,15,17,17, 0, 0, 0,19,19, 0,13,13,15,15, 0, - 20,19, 0, 0, 0,15,15,15,15, 0,11,11,13,13, 0,12, - 12,16,16, 0,12,12,16,16, 0,15,15,21,21, 0,17,16, - 0, 0, 0,12,12,16,16, 0,14,14,17,17, 0,11,11,16, - 16, 0,15,15, 0, 0, 0,16,16,21, 0, 0,12,12,17,16, - 0,14,15,20,20, 0,11,11,16,16, 0,15,15, 0,20, 0, - 16,16, 0,21, 0,16,17,21, 0, 0, 0, 0, 0, 0, 0,15, - 15, 0,21, 0,18,18, 0, 0, 0,17,16, 0, 0, 0,17,17, - 21, 0, 0, 0, 0, 0, 0, 0,15,15, 0,20, 0,19,20,21, - 0, 0,17,18, 0, 0, 0,12,12,15,15, 0,12,12,15,15, - 0,12,12,16,16, 0,13,13,15,15, 0,15,15,17,17, 0, - 13,12,17,16, 0,14,14,17,16, 0,11,11,16,16, 0,14, - 14,17,17, 0,14,14,17,17, 0,12,12,16,16, 0,15,15, - 17,17, 0,11,11,16,16, 0,14,14,17,17, 0,14,14,16, - 16, 0,15,15,18,17, 0, 0, 0,19, 0, 0,13,13,16,16, - 0,16,16, 0,21, 0,14,14,16,16, 0,15,15,18,17, 0, - 0, 0,19,19, 0,13,13,16,16, 0,18,17, 0,21, 0,14, - 15,16,16, 0,11,11,16,16, 0,13,13,17,17, 0,13,13, - 17,17, 0,16,16,16,17, 0,16,16,18,18, 0,12,12,17, - 17, 0,16,15,18,17, 0,12,12,16,16, 0,16,15,19,19, - 0,16,15,17,17, 0,12,12,17,18, 0,16,16,18,18, 0, - 12,12,16,16, 0,16,16,19,19, 0,15,16,17,17, 0,15, - 16,18,18, 0, 0, 0,20,20, 0,13,13,16,16, 0,18,18, - 21,20, 0,15,15,16,16, 0,16,16,19,18, 0, 0, 0,19, - 20, 0,14,14,17,17, 0,19,19, 0,21, 0,15,16,16,16, - 0, 9, 9,14,14, 0,13,13,15,15, 0,14,14,15,15, 0, - 0,21,19,19, 0, 0,21,18,18, 0,12,12,15,15, 0,15, - 15,18,18, 0,14,13,15,15, 0,21,21,18,19, 0,21,20, - 18,18, 0,13,13,16,16, 0,17,17,18,19, 0,14,14,15, - 15, 0, 0,21,19,19, 0,21,20,18,19, 0,20,20,19,19, - 0, 0, 0, 0, 0, 0,19,20,17,17, 0, 0, 0,21,21, 0, - 21, 0,18,20, 0,21, 0,18,21, 0, 0, 0, 0, 0, 0,21, - 21,19,18, 0, 0, 0, 0, 0, 0, 0, 0,19,19, 0,18,18, - 15,15, 0,18,20,17,16, 0,20, 0,17,17, 0,21, 0,17, - 17, 0,21,20,19,20, 0,19,19,16,16, 0,21,21,17,18, - 0,19,19,17,17, 0,20,21,21,21, 0,20,20,18,18, 0, - 19,19,16,16, 0, 0,21,18,19, 0,18,19,16,17, 0,21, - 21,19,20, 0,21,19,18,18, 0,21,20,19,21, 0, 0, 0, - 20,21, 0,19,19,17,16, 0, 0, 0, 0, 0, 0,21,20,17, - 17, 0,20,21,19,18, 0, 0, 0, 0,21, 0,19,18,16,17, - 0, 0, 0, 0, 0, 0,20,20,17,17, 0,11,11,14,14, 0, - 13,13,16,16, 0,13,13,16,16, 0,17,17,21, 0, 0,17, - 18, 0, 0, 0,12,12,16,16, 0,15,15,17,18, 0,12,12, - 16,16, 0,16,16, 0,20, 0,17,17, 0,21, 0,12,12,17, - 17, 0,16,16,19,20, 0,12,12,17,17, 0,17,17, 0,20, - 0,17,17, 0, 0, 0,17,17,21, 0, 0, 0, 0, 0, 0, 0, - 15,15, 0,20, 0,19,19, 0, 0, 0,18,18, 0, 0, 0,17, - 17, 0, 0, 0, 0, 0, 0, 0, 0,15,15, 0, 0, 0,20,19, - 0, 0, 0,19,18, 0, 0, 0,14,14,21,19, 0,16,16,20, - 21, 0,16,16,20,20, 0,17,17,20, 0, 0,17,17,20,20, - 0,15,15,20,20, 0,19,18,20, 0, 0,15,15,20,20, 0, - 17,18,21,20, 0,17,17,20,21, 0,15,15,19,19, 0,19, - 18,21,21, 0,15,15,19,20, 0,17,18, 0, 0, 0,17,17, - 20,20, 0,17,18,20,21, 0, 0, 0, 0, 0, 0,15,15,20, - 20, 0,19,19, 0, 0, 0,17,17,19,21, 0,17,17, 0,21, - 0, 0, 0, 0,21, 0,15,15,20,19, 0, 0,20, 0, 0, 0, - 17,17,21,20, 0,12,12,16,16, 0,14,14,17,17, 0,13, - 13,17,17, 0,16,16,17,18, 0,17,16,18,18, 0,13,13, - 18,17, 0,15,16,19,18, 0,13,13,16,16, 0,16,16,19, - 19, 0,16,16,17,17, 0,13,12,17,17, 0,16,16,18,17, - 0,12,12,16,16, 0,17,17,19,18, 0,16,15,16,16, 0, - 16,17,18,19, 0, 0, 0,20,20, 0,14,14,17,16, 0,18, - 18,21, 0, 0,16,16,16,16, 0,16,16,18,17, 0, 0,21, - 21,21, 0,14,14,16,16, 0,21,20,21, 0, 0,16,16,16, - 16, 0,10,10,14,14, 0,14,14,15,16, 0,14,14,15,15, - 0, 0,21,18,18, 0, 0,21,18,19, 0,13,13,16,16, 0, - 16,16,18,17, 0,14,14,15,15, 0,20, 0,18,18, 0,21, - 0,18,17, 0,13,13,16,15, 0,17,17,19,19, 0,14,14, - 15,15, 0,20,20,18,19, 0, 0, 0,18,17, 0, 0,21,18, - 18, 0, 0, 0, 0, 0, 0,20,21,18,17, 0, 0, 0, 0, 0, - 0, 0, 0,19,19, 0, 0,21,18,18, 0, 0, 0, 0, 0, 0, - 21, 0,18,17, 0, 0, 0, 0,21, 0, 0, 0,19,20, 0,19, - 19,16,16, 0, 0,21,18,17, 0,21, 0,18,18, 0,20, 0, - 19,18, 0,21,20,19,19, 0,21,19,17,18, 0, 0,21,19, - 19, 0,21,19,18,18, 0,21, 0,20,18, 0, 0,21,18,18, - 0,20,21,17,17, 0,21, 0,18,18, 0,21,19,17,17, 0, - 21, 0, 0,20, 0, 0,20,17,18, 0, 0, 0,19,20, 0, 0, - 0,20,19, 0,19,21,17,18, 0,21, 0, 0, 0, 0,21,21, - 18,17, 0, 0,21,18,18, 0, 0, 0, 0,21, 0,20,19,16, - 17, 0, 0, 0, 0, 0, 0,21,20,17,17, 0,11,11,13,13, - 0,13,13,16,16, 0,13,13,16,16, 0,17,17, 0,21, 0, - 18,19,21, 0, 0,12,12,16,16, 0,15,15,19,18, 0,13, - 13,16,16, 0,16,17,21,19, 0,17,17,21,21, 0,13,13, - 16,16, 0,16,16,20,18, 0,13,13,16,16, 0,17,17, 0, - 0, 0,18,18, 0, 0, 0,18,17, 0,20, 0, 0, 0, 0, 0, - 0,15,15,21,21, 0,19,18, 0, 0, 0,17,17,21,21, 0, - 17,17, 0, 0, 0, 0, 0, 0, 0, 0,15,15,20,21, 0,20, - 20, 0, 0, 0,19,19, 0, 0, 0,14,15,21,19, 0,16,16, - 0,21, 0,17,16,21,21, 0,17,18,21,20, 0,18,18, 0, - 21, 0,16,16, 0,20, 0,19,19, 0, 0, 0,16,15, 0,20, - 0,18,18, 0, 0, 0,17,17, 0,21, 0,16,16,20,20, 0, - 20,19, 0, 0, 0,15,16,21,22, 0,18,18, 0, 0, 0,18, - 17, 0, 0, 0,18,18, 0, 0, 0, 0, 0, 0, 0, 0,16,16, - 21,20, 0,19,20, 0, 0, 0,18,17,21, 0, 0,17,18, 0, - 0, 0, 0, 0, 0, 0, 0,16,16, 0,20, 0, 0,20, 0, 0, - 0,18,18,22, 0, -}; - -static const static_codebook _44p1_p4_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p1_p4_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p1_p4_0, - 0 -}; - -static const long _vq_quantlist__44p1_p4_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p1_p4_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p1_p4_1 = { - 1, 7, - (long *)_vq_lengthlist__44p1_p4_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p1_p4_1, - 0 -}; - -static const long _vq_quantlist__44p1_p5_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_p5_0[] = { - 1, 6, 6, 7, 8, 8, 7, 8, 8, 7, 9, 8,10,11,11, 9, - 8, 8, 7, 8, 8,11,11,11, 9, 8, 8, 6, 7, 7,10,10, - 10,10,10,10,10,10,10,14,13,13,12,11,11,10,10,10, - 14,14,13,12,11,11, 6, 6, 6, 8, 5, 5, 8, 7, 7, 9, - 7, 7,11,10,10, 9, 7, 7, 9, 7, 7,12,10,10,10, 7, - 7, 7, 8, 8,12,11,10,12,10,10,11,10,10,15,13,13, - 13,10,10,11,10,10,17,14,13,13,10,10, 7, 7, 7,12, - 11,12,12,11,11,12,11,11,16,14,14,13,12,12,12,11, - 11,17,15,14,14,12,12,10, 9, 9,13,11,11,13,11,11, - 13,11,11,17,14,13,14,11,11,12,11,11,16,15,14,14, - 11,11, 7, 8, 8,12,11,11,12,10,10,12,10,10,15,13, - 13,14,11,10,12,10,10,16,14,14,14,10,10, 8, 7, 7, - 12,11,11,12,11,11,12,11,11,17,14,14,14,12,12,12, - 11,11,16,15,15,14,12,12,10,10,10,13,11,11,13,11, - 11,13,11,12,16,14,14,14,11,11,13,12,11,16,15,15, - 14,11,11, -}; - -static const static_codebook _44p1_p5_0 = { - 5, 243, - (long *)_vq_lengthlist__44p1_p5_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p1_p5_0, - 0 -}; - -static const long _vq_quantlist__44p1_p5_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_p5_1[] = { - 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 8, 8, 8, - 7, 7, 8, 8, 8, 9, 8, 8, 9, 7, 7, 6, 6, 6, 9, 8, - 7, 9, 7, 7, 9, 8, 8,10, 8, 8,10, 8, 8,10, 8, 8, - 10, 8, 8,10, 8, 8, 7, 6, 6, 9, 6, 6, 9, 7, 7, 9, - 7, 7,10, 8, 8, 9, 6, 6, 9, 7, 7,10, 8, 8, 9, 7, - 7, 7, 8, 8,11, 9, 9,11, 9, 9,11, 8, 9,12, 9, 9, - 12, 8, 8,11, 9, 9,12, 9, 9,12, 8, 8, 8, 7, 7,10, - 9, 9,10,10, 9,10, 9, 9,11,10,10,11, 9, 9,11, 9, - 9,11,10,11,11, 9, 9,10, 8, 8,11, 9, 9,10, 9, 9, - 11, 9, 9,11,10,10,11, 9, 9,11, 9, 9,11,10,10,11, - 9, 9, 9, 8, 8,11, 9, 9,12, 9, 9,11, 9, 9,12, 9, - 9,12, 8, 8,12, 9, 9,12, 9, 9,12, 8, 8, 9, 7, 7, - 11, 9, 9,11,10,10,11, 9, 9,11,11,11,11, 9, 9,11, - 10,10,11,11,11,11, 9, 9,10, 9, 9,11, 9, 9,11,10, - 10,11, 9, 9,11,10,10,11, 9, 9,11, 9,10,11,10,10, - 11, 9, 9, -}; - -static const static_codebook _44p1_p5_1 = { - 5, 243, - (long *)_vq_lengthlist__44p1_p5_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p1_p5_1, - 0 -}; - -static const long _vq_quantlist__44p1_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p1_p6_0[] = { - 1, 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, 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, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p1_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p1_p6_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p1_p6_0, - 0 -}; - -static const long _vq_quantlist__44p1_p6_1[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p1_p6_1[] = { - 1, 3, 2, 5, 4, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,13,14,16,16,16,16, -}; - -static const static_codebook _44p1_p6_1 = { - 1, 25, - (long *)_vq_lengthlist__44p1_p6_1, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p1_p6_1, - 0 -}; - -static const long _vq_quantlist__44p1_p6_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p1_p6_2[] = { - 3, 4, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p1_p6_2 = { - 1, 25, - (long *)_vq_lengthlist__44p1_p6_2, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p1_p6_2, - 0 -}; - -static const long _huff_lengthlist__44p1_short[] = { - 4, 5, 7, 8,10,13,14, 4, 2, 4, 6, 8,11,12, 7, 4, - 3, 5, 8,12,14, 8, 5, 4, 4, 8,12,12, 9, 7, 7, 7, - 9,10,11,13,11,11, 9, 7, 8,10,13,11,10, 6, 5, 7, - 9, -}; - -static const static_codebook _huff_book__44p1_short = { - 2, 49, - (long *)_huff_lengthlist__44p1_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p2_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p2_l0_0[] = { - 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 4, 6, 5, - 8, 7, 9, 8,10, 9,11,10,11,11, 4, 5, 6, 7, 8, 8, - 9, 9,10,10,10,10,11, 8, 9, 8,10, 8,10, 9,11,10, - 11,11,11,11, 8, 8, 9, 8,10, 9,10,10,11,11,11,11, - 11, 9,10,10,11,11,11,11,11,11,12,11,12,11, 9,10, - 10,10,11,11,11,11,11,11,12,11,12,10,11,11,12,11, - 12,12,12,12,12,12,12,12,10,11,11,11,11,12,12,12, - 13,12,12,12,12,11,12,12,12,12,13,13,12,12,12,12, - 12,12,11,12,12,12,12,13,13,12,13,12,12,12,12,12, - 13,13,13,13,13,13,12,13,12,13,12,12,12,13,13,13, - 13,13,13,13,12,13,12,12,12, -}; - -static const static_codebook _44p2_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p2_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p2_l0_0, - 0 -}; - -static const long _vq_quantlist__44p2_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p2_l0_1[] = { - 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 6, 5, - 5, 6, 6, 6, 5, 6, 5, 6, 6, -}; - -static const static_codebook _44p2_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p2_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p2_l0_1, - 0 -}; - -static const long _vq_quantlist__44p2_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_l1_0[] = { - 1, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const static_codebook _44p2_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44p2_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p2_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p2_lfe[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book__44p2_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p2_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p2_long[] = { - 3, 4, 9, 8, 8,10,13,16, 4, 2, 9, 5, 7,10,14,18, - 9, 7, 6, 5, 7, 9,12,16, 7, 5, 5, 3, 5, 8,11,13, - 8, 7, 7, 5, 5, 7, 9,11,10,10, 9, 8, 6, 6, 8,10, - 13,14,13,11, 9, 8, 9,10,17,18,16,14,11,10,10,10, -}; - -static const static_codebook _huff_book__44p2_long = { - 2, 64, - (long *)_huff_lengthlist__44p2_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p2_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p1_0[] = { - 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p2_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p2_p1_0, - 0 -}; - -static const long _vq_quantlist__44p2_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p2_p2_0[] = { - 1, 4, 4, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, - 10,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0,11,11, 0, 0, 0, 0, 0, - 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, - 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0,11,11, 0, 0, - 0, 0, 0, 0, 0, 0,10,10, 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, 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, 7, 7, 0, 0, 0, - 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 8, 8, 0, 0, 0, 0, - 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, - 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, - 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 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, 8, 8, 0, 0, 0, 8, 8, 0, - 0, 0,10,10, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, - 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, - 11,11, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0,11,10, 0, 0, 0, 0, 0, - 0, 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0,10,10, 0, 0, 0,11,11, 0, 0, - 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0,11,11, 0, 0, 0, - 0, 0, 0, 0, 0,10,10, 0, 0, 0,13,13, 0, 0, 0, 0, - 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,12,12, - 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,13,13, 0, - 0, 0, 0, 0, 0, 0, 0,12,12, 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, 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, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 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, 9, 0, 0, 0,11,11, - 0, 0, 0,12,12, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, - 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,12,11, 0, 0, - 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0,13,13, 0, 0, 0, - 0, 0, 0, 0, 0,12,12, 0, 0, 0,13,13, 0, 0, 0, 0, - 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,12,12, - 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, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0,10,10, 0, 0, 0,11,11, 0, - 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0,13,13, 0, 0, - 0, 0, 0, 0, 0, 0,12,12, 0, 0, 0,13,13, 0, 0, 0, - 0, 0, 0, 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0,10, - 10, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,14,13, - 0, 0, 0, 0, 0, 0, 0, 0,13,12, 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, - 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, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 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, 9, 0, 0, 0,11, - 11, 0, 0, 0,12,12, 0, 0, 0,12,12, 0, 0, 0, 0, 0, - 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0,12,12, 0, - 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,13,13, 0, 0, - 0, 0, 0, 0, 0, 0,12,12, 0, 0, 0,12,12, 0, 0, 0, - 0, 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,12, - 12, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 9, 0, 0, 0,11,11, 0, 0, 0,12,12, - 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0,12,12, 0, - 0, 0, 0, 0, 0, 0, 0,11,11, 0, 0, 0,14,14, 0, 0, - 0, 0, 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, - 12,12, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0,12, - 12, 0, 0, 0, 0, 0, 0, 0, 0,11,11, 0, 0, 0,14,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, 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, 9, 9, 0, 0, 0, - 11,11, 0, 0, 0,12,12, 0, 0, 0,13,13, 0, 0, 0, 0, - 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,12,12, - 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,12,12, 0, - 0, 0, 0, 0, 0, 0, 0,12,12, 0, 0, 0,14,14, 0, 0, - 0, 0, 0, 0, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0, 0, - 12,12, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p2_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p2_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p2_p2_0, - 0 -}; - -static const long _vq_quantlist__44p2_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p3_0[] = { - 1, 5, 5, 6, 7, 7, 0, 8, 8, 6, 9, 9, 8,11,11, 0, - 8, 8, 0, 9, 9, 0,12,12, 0, 8, 8, 5, 7, 7, 7,10, - 10, 0,12,12, 8,11,11, 9,12,12, 0,11,12, 0,12,12, - 0,15,15, 0,12,12, 0, 6, 6, 0, 6, 6, 0, 7, 7, 0, - 7, 7, 0,10,10, 0, 7, 7, 0, 8, 8, 0,11,11, 0, 7, - 7, 6, 7, 7,10, 9, 9, 0,11,10,10, 9, 9,12,12,12, - 0,10,10, 0,11,11, 0,13,13, 0,11,11, 7, 6, 6,10, - 10,10, 0,11,11,11,11,11,12,12,12, 0,11,11, 0,12, - 12, 0,15,15, 0,11,11, 0,11,11, 0,11,11, 0,12,12, - 0,12,12, 0,14,14, 0,12,12, 0,12,12, 0,15,15, 0, - 11,11, 0, 8, 8, 0,10,10, 0,11,11, 0,11,11, 0,12, - 12, 0,12,12, 0,11,11, 0,15,15, 0,11,11, 0, 6, 6, - 0,10,10, 0,12,12, 0,10,10, 0,13,13, 0,12,12, 0, - 13,13, 0,14,14, 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, 0, 0, -}; - -static const static_codebook _44p2_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p2_p3_0, - 0 -}; - -static const long _vq_quantlist__44p2_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p3_1[] = { - 2, 3, 3, 0, 8, 8, 0, 8, 8, 0, 9, 9, 0, 9, 9, 0, - 9, 9, 0, 9, 9, 0, 9, 9, 0, 8, 8, 0, 6, 6, 0, 7, - 7, 0, 7, 7, 0, 8, 8, 0, 8, 8, 0, 8, 8, 0, 8, 8, - 0, 8, 8, 0, 8, 8, 0, 6, 6, 0, 6, 6, 0, 6, 6, 0, - 8, 8, 0, 9, 9, 0, 7, 7, 0, 8, 8, 0, 9, 9, 0, 6, - 6, 0, 8, 8, 0, 9, 9, 0, 9, 9, 0,10,10, 0,10,10, - 0,10,10, 0,10,10, 0,11,11, 0, 9, 9, 0, 7, 7, 0, - 10,10, 0,10,10, 0,12,11, 0,12,12, 0,11,11, 0,11, - 11, 0,12,12, 0,10,10, 0, 7, 7, 0,10,10, 0,10,10, - 0,12,12, 0,11,12, 0,11,11, 0,11,11, 0,11,11, 0, - 10,10, 0, 8, 8, 0, 9, 9, 0, 9, 9, 0,10,10, 0,10, - 10, 0,10, 9, 0,10,10, 0,10,10, 0, 9, 9, 0, 6, 6, - 0,10,10, 0,10,10, 0,11,11, 0,12,12, 0,11,11, 0, - 11,11, 0,12,12, 0,11,11, 0, 7, 7, 0, 9, 9, 0, 9, - 9, 0,11,11, 0,11,11, 0,10,10, 0,10,10, 0,11,11, - 0, 9, 9, -}; - -static const static_codebook _44p2_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p2_p3_1, - 0 -}; - -static const long _vq_quantlist__44p2_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p4_0[] = { - 1, 6, 6, 6, 7, 7, 7, 8, 8, 7, 8, 8,10,11,11, 9, - 8, 8, 7, 8, 8,11,11,11, 9, 8, 8, 6, 7, 7, 9,11, - 11, 9,11,11,10,11,11,12,13,13,11,12,12,10,11,11, - 13,14,14,12,12,12, 6, 6, 6, 8, 6, 6, 8, 7, 7, 9, - 7, 7,11,10,10,10, 6, 6, 9, 7, 7,12,10,10,11, 6, - 7, 7, 7, 7,11,10,10,12,10,10,11,10,10,14,13,13, - 13,10,10,12,11,11,15,13,13,14,10,10, 8, 7, 7,12, - 11,11,12,11,11,11,11,11,14,14,14,13,12,12,12,11, - 11,15,15,15,13,12,12, 0,10,10, 0,11,11, 0,11,11, - 0,11,11, 0,14,14, 0,11,11, 0,11,11, 0,15,15, 0, - 11,11, 7, 8, 8,12,10,10,12,10,10,12,11,11,15,13, - 13,14,11,11,12,10,10,16,14,14,14,10,10, 8, 7, 7, - 12,11,11,12,11,11,12,11,11,16,14,14,14,12,12,13, - 12,12,15,14,14,15,12,12, 0,11,11, 0,12,12, 0,12, - 12, 0,12,12, 0,15,15, 0,12,12, 0,12,12, 0,14,14, - 0,12,12, -}; - -static const static_codebook _44p2_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p2_p4_0, - 0 -}; - -static const long _vq_quantlist__44p2_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p2_p4_1[] = { - 3, 4, 4, 8, 8,11, 9, 9,12,12,11,10,10,12,12,12, - 10,10,11,11,12,12,12,12,12,12,11,11,13,13,12,12, - 12,13,13,12,10,10,12,12,12,11,11,13,13,12,13,13, - 13,13,12,11,11,13,13,12,12,12,13,13,12,10,10,12, - 12,12,11,11,13,13,12,13,13,12,12,12,11,11,13,13, - 12,13,13,13,13,12,11,11,12,12,12,11,11,12,12,12, - 13,13,12,12,12,13,13,13,13,12,13,13,13,13,13,13, - 13,12,12,12,13,13,13,13,12,13,13,12,12,11, 8, 8, - 10,10,12,11,11,11,11,12,10,10,10,10,13,11,11,10, - 10,13,11,11,10,10,13,12,12,12,12,13,11,11,11,11, - 13,12,12,11,11,13,12,12,11,11,13,12,12,12,11,13, - 12,12,12,12,13,11,11,11,11,13,12,12,11,11,13,11, - 12,11,11,13,12,12,11,11,14,12,12,11,11,13,11,11, - 11,11,14,12,12,11,11,13,11,12,10,10,14,12,12,11, - 11,14,12,12,11,11,14,11,11,11,11,14,12,12,11,11, - 13,12,12,11,11,14,12,12,11,11,11, 8, 8,10,10,12, - 7, 7,10,10,12, 9, 9,11,11,13, 9, 9, 9, 9,13,13, - 13,10,10,13, 9, 9,12,12,13,13,13,12,12,13, 9, 8, - 11,11,13,10,10,12,12,14,13,13,11,11,13, 9, 9,11, - 11,13,13,13,12,12,13, 9, 9,10,10,13,10,10,11,11, - 13,13,13,10,10,14,10,10,11,11,14,14,14,12,12,13, - 9, 9,10,10,13,10,10,11,11,14,13,14,10,10,14,14, - 14,11,12,14,14,14,14,14,14,13,13,10,10,13,14,14, - 11,11,14,14,14,10,10,14, 9, 9, 9, 9,14, 9, 9, 9, - 9,14,10,10, 9, 9,14,10,10, 8, 8,14,11,11, 8, 8, - 15,11,11,10,10,15,12,12,10,10,15,10,10,10,10,15, - 11,11,10,10,15,13,13,10,10,15,11,11,10,10,15,12, - 12,10,10,15,10,10,10,10,15,11,11,10,10,15,13,13, - 10,10,15,11,11,10,10,15,12,12,10,10,15,11,11, 9, - 9,15,11,11, 9, 9,15,13,13, 9, 9,15,13,13,10,10, - 15,12,12,10,10,15,13,13,10,10,15,13,12, 9, 9,15, - 13,13, 9, 9,14,12,12, 9, 9,14,13,13, 9, 9,14,13, - 13, 9, 9,14,13,13, 7, 7,14,13,13, 8, 8,15,14,14, - 10,10,15,14,14,10,10,15,14,14,10,10,15,14,14,10, - 10,15,14,14, 9, 9,15,14,14,10,10,15,14,14,10,10, - 14,14,14, 9, 9,15,14,14,10,10,14,14,14, 9, 9,15, - 14,14,10,10,15,14,14,10,10,14,14,14, 9, 9,14,14, - 14, 9, 9,14,14,14, 8, 8,15,14,14,10,10,15,14,14, - 11,11,15,14,14, 9, 9,15,14,14, 9, 9,14,14,14, 8, - 8,13, 9, 9,12,12,17,11,11,12,12,17,12,12,12,12, - 17,12,12,11,11,18,15,15,12,12,17,12,12,12,12,17, - 14,15,13,13,17,12,12,12,12,17,13,13,12,13,17,15, - 15,12,12,18,13,13,13,13,18,15,15,13,13,18,12,12, - 12,12,18,13,13,13,13,18,15,15,12,12,18,13,13,12, - 12,18,15,15,13,13,18,13,13,12,12,17,13,13,12,12, - 17,15,15,12,12,18,15,15,13,13,18,15,15,13,14,18, - 15,16,12,12,18,15,15,12,12,18,16,16,12,12,13, 8, - 8,10,10,14,15,14,11,11,14,15,15,12,12,15,14,14, - 12,11,15,15,15,12,12,15,15,15,12,12,15,15,15,13, - 13,15,15,15,12,12,15,15,15,13,13,15,15,15,13,13, - 15,15,15,13,13,15,15,16,13,13,15,15,15,12,12,15, - 15,15,13,13,15,15,15,13,13,15,15,15,13,13,15,15, - 15,13,13,15,15,14,12,12,15,15,15,12,12,16,15,14, - 12,12,16,15,15,13,13,16,16,16,13,13,16,15,15,12, - 12,15,15,15,13,13,15,15,15,12,12,13,12,12,10,10, - 14,14,14,11,11,15,14,14,12,12,15,14,14,11,11,15, - 14,14,11,11,15,15,15,13,13,15,14,14,13,13,15,15, - 15,12,12,15,14,15,13,13,16,15,15,12,12,15,15,15, - 13,13,16,14,14,13,13,15,15,15,12,12,15,15,15,13, - 13,16,15,15,12,12,16,15,15,12,12,16,14,14,13,13, - 15,15,15,11,11,15,15,15,12,12,16,15,15,11,11,16, - 15,15,13,13,16,14,15,14,14,16,15,15,12,12,16,15, - 14,12,12,16,15,15,12,12,14,10,10, 9, 9,14,11,11, - 12,12,14,12,12,13,13,14,12,12,12,12,15,14,14,13, - 13,15,13,13,14,14,15,14,14,15,15,15,12,12,13,13, - 15,13,13,14,14,15,14,14,13,13,15,13,13,13,14,15, - 14,14,15,15,15,12,12,13,13,15,13,13,14,14,15,14, - 14,13,13,15,13,13,14,14,15,14,14,15,15,15,13,13, - 12,12,15,13,13,13,13,15,14,14,13,12,15,15,15,14, - 15,15,15,14,20,20,15,14,14,13,13,15,14,14,13,13, - 15,14,14,13,13,14,12,12, 9, 9,14,14,14,12,12,14, - 13,13,12,13,14,14,14,12,12,15,14,14,12,12,15,14, - 14,14,13,15,14,14,14,14,15,14,14,13,13,15,14,14, - 13,13,15,15,15,14,14,15,14,14,13,13,15,14,14,14, - 14,15,14,14,13,13,15,14,14,13,13,15,15,15,15,14, - 15,15,15,13,13,15,14,14,14,14,15,14,14,13,13,15, - 14,14,13,13,14,15,15,14,14,15,15,15,14,14,15,14, - 14,14,14,15,15,15,14,14,15,14,14,13,14,15,15,15, - 14,14,13,10,10,12,12,17,11,11,12,12,17,12,12,12, - 12,17,12,12,11,11,17,15,15,12,11,18,13,13,13,13, - 18,15,15,13,13,17,12,12,12,12,18,13,13,13,13,17, - 15,15,12,12,17,12,12,12,12,17,15,15,13,13,17,12, - 12,12,12,17,13,13,12,12,17,15,15,12,12,18,14,13, - 12,12,18,15,15,13,13,18,13,13,12,12,18,13,13,12, - 12,18,16,16,12,12,18,16,16,12,12,18,15,15,13,13, - 18,16,16,12,12,17,15,15,12,12,17,16,16,12,12,13, - 8, 8,10,10,14,14,15,12,12,14,15,15,12,12,15,14, - 14,12,12,15,15,14,12,12,15,15,15,13,13,15,15,15, - 13,13,15,15,15,12,12,16,15,15,13,13,16,15,15,13, - 13,15,15,15,12,12,15,15,15,14,14,15,15,15,12,12, - 15,15,15,13,13,16,15,15,13,13,15,15,15,13,13,16, - 15,15,13,13,15,15,14,12,12,15,15,15,12,12,16,14, - 15,13,13,16,15,15,13,13,15,16,15,13,13,16,15,14, - 13,13,16,15,15,13,13,16,15,15,13,13,13,12,12,11, - 11,14,14,14,11,11,14,14,14,12,12,15,14,14,11,11, - 16,14,14,11,11,15,15,15,12,13,16,14,14,13,13,15, - 15,15,12,12,15,14,14,13,13,16,15,15,12,12,15,15, - 15,12,12,15,14,14,13,13,15,15,15,12,12,15,14,14, - 12,12,16,15,15,12,12,16,15,15,12,12,16,14,14,13, - 13,15,15,15,11,11,15,15,14,12,12,16,15,15,11,11, - 16,15,15,12,12,16,14,14,13,13,16,15,15,11,11,16, - 14,14,12,12,16,15,15,11,11,14,10,10, 9, 9,14,11, - 11,12,12,14,12,12,13,14,14,12,12,12,12,14,14,14, - 13,13,15,13,13,14,14,15,14,14,15,15,15,12,12,13, - 13,15,13,13,14,14,15,15,15,14,14,15,13,13,14,14, - 15,15,15,15,15,15,12,12,13,13,15,13,13,14,14,15, - 14,14,13,13,15,13,13,14,14,15,14,14,15,15,15,12, - 12,13,13,15,13,13,13,13,14,14,14,13,13,15,15,15, - 14,15,15,15,15,21,19,15,14,14,13,13,15,14,14,14, - 14,14,14,14,13,13,14,12,12, 9, 9,14,14,14,12,12, - 14,14,13,13,13,14,14,14,12,12,14,14,14,12,12,15, - 14,14,13,13,15,14,14,14,14,15,14,14,13,13,15,14, - 14,13,13,15,15,15,15,15,15,14,14,13,13,15,14,14, - 14,14,15,14,14,13,13,15,14,14,13,13,14,15,15,15, - 15,15,14,15,13,13,15,14,14,14,14,15,14,14,13,13, - 15,14,14,13,13,14,15,15,14,14,15,15,15,14,14,15, - 14,14,14,14,15,15,15,15,15,15,14,14,14,13,14,15, - 15,14,14,13,10,10,12,12,18,12,12,12,12,17,12,12, - 12,12,18,13,13,11,11,18,15,14,11,11,17,13,13,13, - 13,18,15,15,12,12,18,12,12,12,12,17,13,13,12,12, - 18,15,15,12,12,18,13,13,13,12,18,15,15,13,13,18, - 13,13,12,12,18,13,13,12,12,18,15,15,12,12,17,13, - 13,12,12,17,15,15,12,12,17,12,12,11,11,17,13,13, - 11,11,17,15,15,11,11,18,16,16,12,12,18,15,15,13, - 13,18,15,15,11,11,17,15,15,12,12,18,15,15,11,11, - 13, 8, 8,10,10,14,14,14,11,11,15,15,15,12,12,15, - 14,14,11,11,16,14,14,12,12,15,15,15,12,12,15,15, - 15,13,13,15,15,15,12,12,15,15,15,12,12,16,15,15, - 13,13,15,15,15,12,12,15,15,15,13,13,16,15,15,12, - 12,15,15,15,12,12,16,15,15,13,13,16,15,15,12,12, - 15,15,15,13,13,15,14,14,12,12,15,15,15,12,12,16, - 15,14,12,12,16,15,15,13,13,16,16,16,13,13,16,14, - 15,13,13,15,15,15,13,13,16,15,15,12,12,13,12,12, - 10,10,14,14,14,11,11,15,14,14,12,12,15,14,14,11, - 11,16,14,14,11,11,15,14,15,12,12,15,14,14,13,13, - 15,15,15,12,12,15,14,14,12,12,15,14,15,12,12,15, - 15,15,12,12,16,14,14,13,13,15,15,15,11,12,16,14, - 14,12,12,16,15,15,12,12,15,15,15,12,12,16,14,14, - 12,12,15,15,15,11,11,15,14,14,11,12,15,15,14,11, - 11,16,15,15,12,12,16,14,14,13,13,16,15,15,11,11, - 16,14,14,12,12,16,15,15,11,11,13,10,10, 8, 8,14, - 12,12,12,12,14,12,12,13,13,14,12,12,12,12,14,14, - 14,13,13,15,13,13,14,14,15,15,14,15,15,15,13,13, - 13,13,15,13,13,14,14,15,14,15,14,14,15,13,13,13, - 13,15,15,15,15,15,15,12,12,13,12,15,13,13,14,14, - 15,14,14,13,13,15,13,13,14,13,15,15,15,16,16,15, - 13,13,12,12,15,13,13,13,13,14,14,14,12,12,15,15, - 15,14,14,15,15,15,20,20,15,14,14,13,13,15,15,14, - 14,14,15,14,14,13,13,13,12,12, 9, 9,14,13,13,12, - 12,14,13,13,12,12,14,14,14,12,12,14,14,14,13,13, - 15,14,14,13,13,15,14,14,14,14,15,15,14,12,12,15, - 14,14,13,13,15,14,15,14,15,15,14,14,13,13,15,14, - 14,14,14,15,14,14,12,12,15,14,14,13,13,14,15,14, - 15,14,15,14,14,13,13,15,14,14,14,14,15,14,14,12, - 12,15,14,14,13,13,15,15,15,14,14,15,15,15,14,14, - 16,14,14,14,14,15,15,15,14,14,15,14,14,14,14,14, - 15,15,14,14,13,13,13,12,13,17,15,15,12,12,17,15, - 15,12,12,18,15,15,11,11,17,16,16,11,11,18,16,16, - 13,13,18,17,16,13,13,18,16,16,12,12,18,16,16,12, - 12,18,17,17,12,12,17,16,16,12,13,17,16,16,12,13, - 17,16,16,12,12,17,16,16,12,12,18,17,16,12,12,18, - 16,16,12,12,17,16,17,12,12,18,15,15,11,11,18,15, - 15,12,12,17,17,17,11,11,17,17,17,12,12,17,16,16, - 13,13,18,16,16,11,11,18,16,16,12,12,18,17,16,11, - 11,14,14,14,10,10,16,15,14,11,11,16,15,15,12,12, - 16,14,14,12,12,17,14,14,13,13,17,15,15,13,13,17, - 15,15,14,14,16,15,15,12,12,16,15,15,13,13,18,15, - 15,14,14,16,15,15,12,12,16,15,15,14,14,16,15,15, - 12,12,16,15,15,13,13,17,15,15,13,13,17,15,15,13, - 13,17,15,15,14,14,16,14,14,12,12,17,15,15,12,12, - 18,15,15,13,13,17,15,15,14,14,17,16,16,15,15,17, - 15,14,13,13,17,15,15,14,14,17,15,15,13,13,14,12, - 12,11,11,15,14,14,12,12,16,14,14,12,12,16,14,14, - 11,11,17,14,14,12,12,16,15,14,13,13,16,14,14,13, - 13,16,15,15,12,12,16,14,14,13,13,17,15,15,13,13, - 16,15,15,13,13,17,14,14,13,13,16,15,15,12,12,16, - 14,14,12,12,16,15,15,12,12,17,15,15,12,12,17,14, - 14,13,13,16,15,15,12,12,16,14,14,12,12,16,15,15, - 12,12,17,15,15,13,13,17,14,14,13,13,17,15,15,12, - 12,17,14,14,12,12,17,15,15,12,12,14,14,14, 8, 8, - 14,14,14,13,13,14,15,15,14,14,14,14,14,14,14,15, - 15,15,19,19,15,15,15,14,14,15,15,16,20,19,15,15, - 15,14,14,15,16,16,15,15,15,15,15,19,19,15,15,15, - 14,14,15,16,16,19,20,15,15,15,14,14,15,15,15,15, - 15,15,15,15,19,19,15,15,15,15,15,15,15,16,19,20, - 15,14,15,14,14,15,15,15,15,15,15,15,15,20,19,15, - 15,15,21,19,15,16,16,20,20,15,15,14,19,19,15,15, - 16,20,21,15,15,15,20,19,13,12,12, 9, 9,14,14,14, - 12,12,14,13,13,13,13,14,14,14,13,13,15,14,14,20, - 19,15,14,14,14,13,15,14,14,19,19,15,15,14,13,13, - 15,14,14,14,14,15,15,15,19,20,15,14,14,13,13,15, - 14,14,20,19,14,15,14,13,13,15,14,14,14,13,15,15, - 15,19,20,15,15,14,14,14,15,14,14,21,19,15,15,15, - 13,13,15,14,14,14,14,14,15,15,20,20,15,15,15,21, - 20,15,14,14,19,20,15,15,15,20,20,15,14,14,19,20, - 15,15,15,21,19, -}; - -static const static_codebook _44p2_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p2_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p2_p4_1, - 0 -}; - -static const long _vq_quantlist__44p2_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p2_p5_0[] = { - 2, 6, 6,14,14, 6, 7, 7,14,14, 7, 7, 7,15,15, 0, - 13,13,16,16, 0,13,13,15,15, 7, 8, 8,15,15, 9,10, - 10,17,16, 9, 8, 8,15,15, 0,13,13,18,17, 0,13,13, - 16,16, 8, 8, 8,15,15,12,11,11,16,17, 9, 8, 8,14, - 14, 0,13,13,18,17, 0,13,13,16,15, 0,14,14,18,17, - 0,20,22,18,20, 0,12,12,16,16, 0,16,16,22,20, 0, - 14,14,16,16, 0,14,14,17,17, 0,22,22,22,19, 0,12, - 13,16,16, 0,17,17, 0, 0, 0,15,15,16,16, 5, 7, 7, - 13,13, 9, 9, 9,15,14,10,10,10,14,14, 0,21,21,18, - 17, 0,21,22,18,17, 9,10,10,14,14,12,12,12,17,17, - 12,10,10,14,14, 0,19,21,18,17, 0,20,22,18,18,11, - 10,10,14,14,14,13,13,18,17,12,11,11,14,14, 0,22, - 19,17,18, 0,20, 0,18,17, 0,22,21,17,17, 0, 0, 0, - 0, 0, 0,20,22,17,17, 0,22, 0,21,19, 0,22, 0,18, - 18, 0, 0,22,18,19, 0, 0, 0, 0, 0, 0,19,21,17,17, - 0, 0, 0,20,20, 0, 0, 0,18,18, 6, 6, 6,13,12, 8, - 6, 6,11,11, 8, 6, 6,13,13, 0, 9, 9,11,11, 0,11, - 11,14,14, 9, 7, 7,13,13,11, 9, 9,13,13,10, 6, 6, - 13,13, 0,10,10,14,14, 0,10,10,13,13, 9, 7, 7,13, - 14,13, 9, 9,13,13,10, 6, 6,13,12, 0,11,11,15,15, - 0,10,10,13,13, 0,12,12,15,15, 0,19, 0,17,17, 0, - 9, 9,13,13, 0,13,14,19,20, 0,11,11,13,13, 0,11, - 11,14,14, 0,19,20,17,18, 0,10,10,13,13, 0,15,15, - 21,19, 0,12,12,13,13, 0,10,10,12,13, 0,11,11,15, - 15, 0,11,11,15,15, 0,15,15,22, 0, 0,16,17,22, 0, - 0,11,11,15,15, 0,14,14,18,17, 0,11,11,15,16, 0, - 15,15,22,21, 0,16,16, 0,20, 0,12,12,16,15, 0,15, - 14,19,19, 0,11,11,16,16, 0,15,15,21, 0, 0,16,15, - 0, 0, 0,16,16,22,21, 0, 0, 0, 0, 0, 0,15,15,20, - 20, 0,18,18, 0, 0, 0,16,17, 0, 0, 0,17,17, 0,22, - 0, 0, 0, 0, 0, 0,15,15,21,22, 0,20,18, 0, 0, 0, - 18,17,22, 0, 0,10,10,12,11, 0,10,10,10,10, 0,11, - 11,12,12, 0,11,11, 9, 9, 0,13,13,12,12, 0,11,11, - 12,12, 0,13,13,12,12, 0,10,10,12,12, 0,13,12,13, - 13, 0,12,12,12,12, 0,11,11,12,12, 0,13,13,12,12, - 0,10,10,12,12, 0,13,13,13,14, 0,12,12,12,12, 0, - 13,14,14,14, 0,20,21,15,15, 0,12,11,12,12, 0,15, - 16,20,22, 0,13,12,11,11, 0,13,13,14,13, 0,20, 0, - 16,15, 0,12,12,12,12, 0,16,16,22,21, 0,13,13,12, - 12, 6, 7, 7,16,16,11, 9, 9,15,15,12, 9, 9,16,16, - 0,13,13,14,14, 0,14,14,16,17,10, 9, 9,16,16,14, - 12,12,16,16,12, 9, 9,15,15, 0,13,13,18,18, 0,13, - 13,15,16,12,10,10,17,18,15,12,12,17,17,13, 9, 9, - 16,16, 0,13,13,17,18, 0,14,14,16,16, 0,15,15,18, - 18, 0,22, 0,20,20, 0,12,12,16,16, 0,16,16,20,22, - 0,14,14,16,16, 0,15,14,18,18, 0, 0,22,19,21, 0, - 13,13,16,17, 0,17,17,22,22, 0,15,15,16,16, 7, 7, - 7,14,14,11,10,10,15,15,12,10,10,15,14, 0,22, 0, - 18,18, 0, 0,21,17,18,11,10,10,15,15,14,12,12,17, - 17,14,11,11,15,15, 0,22,20,18,18, 0, 0,20,18,17, - 12,10,10,16,16,17,14,14,19,18,14,11,11,15,15, 0, - 21,22,19,19, 0,21,22,18,18, 0,22, 0,19,21, 0, 0, - 0, 0, 0, 0,22,22,18,17, 0, 0, 0,21,20, 0,22,22, - 20,19, 0, 0,22,20,20, 0, 0, 0, 0, 0, 0,20,21,17, - 17, 0, 0,22,21,21, 0, 0, 0,18,18,10, 9, 9,14,14, - 13,10,10,13,13,13,10,11,14,14, 0,13,13,12,12, 0, - 15,15,16,16,13,10,10,15,15,15,12,12,14,14,15,10, - 10,14,15, 0,14,14,16,15, 0,14,14,15,15,13,10,10, - 15,15,18,13,13,15,15,15,10,10,14,15, 0,14,14,16, - 16, 0,14,14,15,15, 0,15,15,16,16, 0,22, 0,18,18, - 0,12,13,14,14, 0,17,17,22, 0, 0,14,14,14,14, 0, - 15,15,16,16, 0,22, 0,18,17, 0,13,13,14,14, 0,19, - 18,21,22, 0,15,15,14,14, 0,11,11,13,13, 0,12,12, - 16,16, 0,12,12,16,16, 0,15,16,21, 0, 0,16,17, 0, - 22, 0,12,12,16,16, 0,14,14,17,18, 0,11,11,16,16, - 0,15,15,21,22, 0,16,16, 0, 0, 0,12,12,16,16, 0, - 15,15, 0,19, 0,12,12,16,17, 0,16,16,22, 0, 0,16, - 16, 0,22, 0,17,17, 0,22, 0, 0, 0, 0, 0, 0,15,15, - 20,19, 0,18,18, 0, 0, 0,17,18, 0, 0, 0,17,17, 0, - 0, 0, 0, 0, 0, 0, 0,15,15, 0,22, 0,20,18, 0, 0, - 0,18,18,22,22, 0,11,11,14,14, 0,12,12,14,14, 0, - 12,12,15,15, 0,13,13,14,14, 0,14,14,17,16, 0,12, - 12,16,16, 0,14,14,16,16, 0,11,11,15,15, 0,13,13, - 16,16, 0,13,13,15,15, 0,12,12,15,15, 0,15,14,16, - 16, 0,11,11,15,15, 0,14,14,17,17, 0,13,13,15,15, - 0,15,15,17,17, 0, 0, 0,19,18, 0,13,12,15,15, 0, - 16,16, 0, 0, 0,14,14,15,15, 0,14,14,16,17, 0,22, - 0,18,18, 0,13,13,15,15, 0,17,17, 0, 0, 0,14,14, - 15,15, 8, 8, 8,16,16,12,10,10,16,16,13, 9, 9,16, - 16, 0,14,14,17,17, 0,14,14,17,16,12,10,10,18,17, - 14,11,11,18,18,14, 9,10,16,16, 0,13,13,18,19, 0, - 14,13,16,16,12, 9, 9,16,16,17,13,13,17,17,14, 9, - 9,15,15, 0,14,14,19,20, 0,13,13,15,15, 0,15,15, - 18,19, 0, 0,22,22,22, 0,13,13,17,17, 0,16,16,19, - 21, 0,14,14,16,16, 0,14,14,18,18, 0, 0, 0, 0, 0, - 0,13,13,16,16, 0,18,18, 0, 0, 0,15,15,16,16, 8, - 7, 7,14,14,12,10,10,15,15,13,10,10,15,14, 0,22, - 0,18,18, 0,22, 0,18,18,12,10,10,16,15,15,12,12, - 17,17,14,11,11,15,15, 0,20,21,19,18, 0, 0, 0,17, - 18,13,11,11,15,15,16,13,13,18,18,15,11,11,14,14, - 0,22,21,19,19, 0,21,22,18,18, 0,22,22,20,18, 0, - 0, 0, 0, 0, 0,22,19,17,17, 0, 0, 0,22,21, 0, 0, - 22,19,17, 0, 0,22,19,19, 0, 0, 0, 0, 0, 0,22,21, - 18,17, 0, 0, 0,22, 0, 0, 0, 0,19,19, 0,10,10,14, - 14, 0,11,11,15,14, 0,11,11,15,15, 0,14,14,15,14, - 0,15,15,16,16, 0,11,11,16,16, 0,13,13,16,16, 0, - 11,11,15,15, 0,14,14,17,16, 0,14,14,15,15, 0,11, - 11,16,16, 0,14,13,15,15, 0,11,11,15,15, 0,15,15, - 17,17, 0,14,14,15,14, 0,16,16,17,17, 0, 0,22,18, - 18, 0,13,13,15,15, 0,17,17,22, 0, 0,15,15,15,14, - 0,15,16,16,17, 0, 0,22,18,19, 0,13,13,15,15, 0, - 20,18,21, 0, 0,15,15,14,14, 0,11,11,13,13, 0,12, - 12,16,16, 0,12,12,16,15, 0,15,16,22,22, 0,17,17, - 0, 0, 0,12,12,16,16, 0,14,14,18,18, 0,11,11,16, - 16, 0,15,16,22,20, 0,16,16, 0,22, 0,12,12,16,16, - 0,15,15,18,20, 0,11,11,16,16, 0,15,15, 0, 0, 0, - 16,16, 0, 0, 0,17,17,22, 0, 0, 0, 0, 0, 0, 0,15, - 15, 0,21, 0,18,18, 0, 0, 0,17,16, 0, 0, 0,17,17, - 22,22, 0, 0, 0, 0, 0, 0,15,15,21, 0, 0,20,22, 0, - 0, 0,18,18, 0, 0, 0,12,12,15,15, 0,12,12,15,15, - 0,12,12,16,16, 0,13,13,15,15, 0,15,15,17,17, 0, - 13,12,16,16, 0,14,14,16,16, 0,12,11,16,16, 0,14, - 14,17,17, 0,14,14,16,16, 0,12,12,16,16, 0,15,15, - 17,16, 0,11,11,15,16, 0,14,14,17,17, 0,14,14,16, - 16, 0,15,15,18,18, 0, 0, 0,22,19, 0,13,13,15,16, - 0,16,17, 0, 0, 0,14,14,16,16, 0,15,15,18,17, 0, - 0, 0,20,20, 0,13,13,16,15, 0,17,17,22,22, 0,14, - 14,15,15, 0,11,11,16,16, 0,13,13,16,17, 0,13,13, - 17,18, 0,16,16,17,17, 0,17,17,18,18, 0,12,12,17, - 17, 0,16,15,18,18, 0,12,12,16,16, 0,16,16,18,18, - 0,15,15,17,17, 0,12,12,17,17, 0,16,16,19,18, 0, - 12,12,16,17, 0,16,16,19,19, 0,15,16,16,17, 0,16, - 16,19,17, 0, 0, 0,20,22, 0,13,13,16,16, 0,19,18, - 21, 0, 0,15,15,16,16, 0,16,16,18,18, 0, 0, 0,22, - 21, 0,14,14,16,16, 0,21,19,21,22, 0,16,16,16,16, - 0, 9, 9,14,14, 0,13,13,15,15, 0,14,14,15,15, 0, - 0,20,18,19, 0, 0,22,18,18, 0,12,12,15,15, 0,15, - 15,17,18, 0,14,13,14,14, 0,20, 0,18,18, 0,21, 0, - 18,17, 0,13,13,15,16, 0,17,17,18,18, 0,14,14,15, - 15, 0,22,22,20,19, 0,20,21,18,18, 0,20,22,19,19, - 0, 0, 0, 0, 0, 0,20,20,17,17, 0, 0,22,22,21, 0, - 22, 0,18,18, 0,20,22,19,19, 0, 0, 0, 0, 0, 0,21, - 21,17,18, 0, 0, 0,21,20, 0, 0,22,19,18, 0,18,18, - 15,15, 0,22,21,17,16, 0, 0,22,17,17, 0,20,22,18, - 18, 0, 0,22,20,20, 0,21,19,16,16, 0,21,21,18,18, - 0,19,19,17,17, 0, 0,22,19,19, 0,22,20,17,17, 0, - 21,19,16,16, 0,22,22,19,18, 0,19,20,16,16, 0,22, - 21,19,21, 0,21,22,17,18, 0,21,20,18,18, 0, 0, 0, - 19,20, 0,20,19,16,16, 0,22,22, 0, 0, 0,21,21,17, - 16, 0,22,20,19,18, 0, 0, 0,20,20, 0,20,19,16,16, - 0, 0, 0, 0, 0, 0,21,22,17,17, 0,11,11,13,13, 0, - 13,13,15,16, 0,13,13,16,16, 0,17,18,21, 0, 0,17, - 18, 0, 0, 0,12,12,15,16, 0,15,15,19,18, 0,12,12, - 16,16, 0,17,17,22, 0, 0,17,17, 0,22, 0,12,12,17, - 16, 0,16,16,19,20, 0,12,12,16,16, 0,17,17, 0, 0, - 0,17,17, 0,21, 0,17,16,22, 0, 0, 0, 0, 0, 0, 0, - 15,15,20,22, 0,20,18, 0, 0, 0,18,18, 0, 0, 0,17, - 17,21, 0, 0, 0, 0, 0, 0, 0,15,15,21,22, 0,19,20, - 22, 0, 0,19,18, 0, 0, 0,14,14,18,18, 0,16,16,22, - 20, 0,16,16,22,19, 0,17,17,20,22, 0,19,19, 0, 0, - 0,15,15,20, 0, 0,18,21, 0,20, 0,15,15,21,20, 0, - 18,17, 0, 0, 0,17,17, 0,22, 0,15,15,19,19, 0,19, - 18, 0, 0, 0,15,15,20, 0, 0,18,18,22,22, 0,17,17, - 0,20, 0,18,18, 0, 0, 0, 0,22, 0, 0, 0,15,15,19, - 20, 0,20,19, 0, 0, 0,17,17,20,21, 0,17,18,20,22, - 0, 0, 0, 0,22, 0,15,15,20,20, 0,22,20, 0, 0, 0, - 17,18,20, 0, 0,12,12,17,16, 0,14,14,17,17, 0,13, - 13,17,17, 0,16,16,18,18, 0,17,16,17,17, 0,13,13, - 17,17, 0,15,16,18,18, 0,13,13,16,16, 0,16,16,18, - 18, 0,16,16,17,16, 0,13,13,16,16, 0,17,17,18,17, - 0,12,12,15,16, 0,17,17,19,19, 0,16,16,16,16, 0, - 16,17,19,18, 0, 0, 0,21,22, 0,14,14,16,16, 0,18, - 18, 0,22, 0,16,16,16,16, 0,16,16,18,17, 0, 0, 0, - 21,20, 0,14,14,16,16, 0,21,22,22, 0, 0,16,16,16, - 16, 0, 9, 9,14,13, 0,13,14,15,16, 0,14,13,15,14, - 0,22, 0,18,18, 0,21, 0,17,18, 0,13,13,15,15, 0, - 15,16,18,17, 0,14,14,15,14, 0,20,22,18,18, 0,22, - 21,17,17, 0,13,13,15,15, 0,17,17,19,19, 0,14,14, - 14,14, 0, 0,22,18,18, 0, 0,22,17,17, 0, 0,22,19, - 20, 0, 0, 0, 0, 0, 0,21,20,17,16, 0, 0, 0,21,22, - 0, 0, 0,18,19, 0, 0, 0,18,18, 0, 0, 0, 0, 0, 0, - 22, 0,17,17, 0, 0, 0,20,22, 0, 0, 0,18,19, 0,18, - 19,16,16, 0,22,20,17,17, 0,22,22,17,18, 0,22,22, - 18,17, 0, 0,22,18,19, 0,20,20,17,18, 0, 0,22,19, - 18, 0,22,22,17,17, 0,22, 0,19,19, 0, 0,22,18,18, - 0,20,22,17,17, 0, 0,22,18,18, 0,19,20,17,17, 0, - 22, 0,20,19, 0,22,21,17,17, 0, 0, 0,18,18, 0, 0, - 0,22,19, 0,20, 0,17,17, 0,22, 0, 0,22, 0, 0,20, - 17,18, 0,22, 0,19,19, 0, 0, 0, 0,19, 0,19,21,17, - 17, 0, 0, 0, 0, 0, 0,20,21,17,16, 0,11,11,13,13, - 0,13,13,16,16, 0,13,13,15,16, 0,17,17,21,22, 0, - 17,18, 0, 0, 0,12,12,16,16, 0,15,15,18,18, 0,13, - 13,16,16, 0,17,16,21,21, 0,17,17, 0, 0, 0,13,13, - 16,16, 0,16,16,19,18, 0,13,13,16,16, 0,17,17, 0, - 22, 0,17,18,20,22, 0,17,18, 0, 0, 0, 0, 0, 0, 0, - 0,15,15,20, 0, 0,18,19, 0, 0, 0,17,17, 0, 0, 0, - 18,17,22, 0, 0, 0, 0, 0, 0, 0,15,16,21,20, 0,20, - 20, 0, 0, 0,18,19, 0, 0, 0,15,15,22,22, 0,17,16, - 20,22, 0,17,17,20,22, 0,18,18, 0,21, 0,19,18, 0, - 0, 0,16,16,20,20, 0,19,19,22, 0, 0,15,16,21,22, - 0,18,19,22, 0, 0,17,18, 0, 0, 0,16,16,22, 0, 0, - 19,19, 0,21, 0,15,16,20, 0, 0,18,18, 0,22, 0,18, - 17, 0, 0, 0,18,18, 0, 0, 0, 0, 0, 0, 0, 0,16,16, - 22,21, 0,20,21, 0, 0, 0,17,18,22, 0, 0,18,18, 0, - 0, 0, 0, 0, 0, 0, 0,16,16,20,19, 0,22,21, 0, 0, - 0,18,18,22,22, -}; - -static const static_codebook _44p2_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p2_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p2_p5_0, - 0 -}; - -static const long _vq_quantlist__44p2_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p2_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p2_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p2_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p2_p5_1, - 0 -}; - -static const long _vq_quantlist__44p2_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p6_0[] = { - 1, 7, 7, 7, 8, 8, 7, 8, 8, 7, 9, 9,10,11,11, 9, - 8, 8, 7, 8, 9,11,11,11, 9, 8, 8, 6, 7, 7,10,10, - 10,10,10,10,10,10,10,14,14,14,12,11,11,10,11,11, - 15,14,14,13,11,11, 6, 6, 6, 8, 5, 5, 8, 7, 7, 8, - 7, 7,11,10,10, 9, 7, 7, 9, 7, 7,12,10,10,10, 7, - 7, 6, 8, 7,12,10,10,12,10,10,11,10,10,15,14,13, - 13,10,10,11,10,10,16,14,14,14,10,10, 7, 7, 7,12, - 11,11,12,11,11,11,11,11,16,14,14,13,12,12,11,11, - 11,17,15,15,14,12,12,10, 9, 9,13,11,11,13,11,11, - 12,11,11,16,14,13,14,11,11,12,11,11,17,15,14,14, - 11,11, 7, 8, 8,12,11,11,12,10,10,12,10,10,16,13, - 14,13,10,10,11,10,10,17,14,14,14,10,10, 7, 7, 7, - 12,11,11,12,11,11,12,11,11,15,14,15,14,12,12,12, - 11,11,17,15,15,14,12,12,10,10, 9,13,11,11,13,11, - 11,13,11,11,16,14,14,14,11,11,13,11,11,16,15,15, - 15,11,11, -}; - -static const static_codebook _44p2_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p2_p6_0, - 0 -}; - -static const long _vq_quantlist__44p2_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p6_1[] = { - 2, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 8, - 7, 7, 8, 8, 8, 9, 9, 9, 9, 8, 8, 6, 7, 7, 9, 8, - 8, 9, 7, 7, 9, 8, 8,10, 8, 8,10, 8, 8,10, 8, 8, - 10, 8, 9,10, 8, 8, 7, 6, 6, 8, 6, 6, 9, 6, 6, 9, - 7, 7,10, 8, 8, 9, 6, 6, 9, 7, 7,10, 9, 8, 9, 7, - 7, 7, 7, 7,11, 8, 8,11, 9, 9,10, 9, 9,12, 9, 9, - 12, 8, 8,11, 9, 9,12, 9, 9,12, 8, 8, 8, 7, 7,10, - 9, 9,10, 9, 9,10, 9, 9,11,10,11,11, 9, 9,11, 9, - 9,11,11,11,11, 9, 9,10, 8, 8,11, 9, 9,10, 9, 9, - 11, 9, 9,11,10,10,11, 9, 9,11, 9, 9,12,10,10,11, - 9, 9, 8, 8, 8,11, 9, 9,12, 9, 9,11, 9, 9,12, 9, - 9,12, 8, 8,12, 9, 9,12, 9,10,12, 8, 8, 9, 7, 7, - 11, 9, 9,11,10,10,11, 9, 9,11,11,11,11, 9, 9,11, - 10,10,12,11,11,11, 9,10,10, 9, 9,11, 9, 9,11,10, - 10,11,10,10,11,11,11,11, 9, 9,11, 9,10,11,11,11, - 11, 9, 9, -}; - -static const static_codebook _44p2_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p2_p6_1, - 0 -}; - -static const long _vq_quantlist__44p2_p7_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p7_0[] = { - 1, 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p2_p7_0 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p7_0, - 1, -513979392, 1633504256, 2, 0, - (long *)_vq_quantlist__44p2_p7_0, - 0 -}; - -static const long _vq_quantlist__44p2_p7_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p2_p7_1[] = { - 1, 9, 9, 6, 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, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10, -}; - -static const static_codebook _44p2_p7_1 = { - 5, 243, - (long *)_vq_lengthlist__44p2_p7_1, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p2_p7_1, - 0 -}; - -static const long _vq_quantlist__44p2_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p2_p7_2[] = { - 1, 3, 2, 5, 4, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,14,14,15,15,15,15, -}; - -static const static_codebook _44p2_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p2_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p2_p7_2, - 0 -}; - -static const long _vq_quantlist__44p2_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p2_p7_3[] = { - 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p2_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p2_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p2_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p2_short[] = { - 4, 4,12, 9, 8,12,15,17, 4, 2,11, 6, 5, 9,13,15, - 11, 7, 8, 7, 7,10,14,13, 8, 5, 7, 5, 5, 8,12,12, - 8, 4, 7, 4, 3, 6,11,12,11, 8, 9, 7, 6, 8,11,12, - 15,13,14,12, 9, 7,10,13,16,12,17,12, 7, 5, 8,11, -}; - -static const static_codebook _huff_book__44p2_short = { - 2, 64, - (long *)_huff_lengthlist__44p2_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p3_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p3_l0_0[] = { - 1, 4, 4, 8, 8, 8, 8, 9, 9,10,10,10,10, 4, 6, 5, - 8, 7, 9, 9, 9, 9,10, 9,11, 9, 4, 5, 6, 7, 8, 9, - 9, 9, 9, 9,10, 9,10, 8, 9, 8, 9, 8,10, 9,11, 9, - 12,10,12,10, 8, 8, 9, 8, 9, 9,10, 9,11,10,12,10, - 12, 9,10,10,11,10,12,11,12,11,12,12,12,12, 9,10, - 10,11,11,11,11,11,12,12,12,12,12,10,11,11,12,12, - 12,12,12,12,12,12,12,12,10,11,11,12,12,12,12,12, - 12,12,12,12,12,11,12,12,12,12,12,13,12,13,12,13, - 12,12,11,12,12,12,12,12,12,13,12,12,12,12,12,12, - 12,12,13,13,12,13,12,13,12,13,12,12,12,13,12,13, - 12,13,12,13,12,13,12,12,12, -}; - -static const static_codebook _44p3_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p3_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p3_l0_0, - 0 -}; - -static const long _vq_quantlist__44p3_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p3_l0_1[] = { - 3, 4, 4, 5, 5, 4, 4, 5, 5, 5, 4, 5, 4, 5, 5, 5, - 5, 6, 5, 6, 5, 6, 5, 6, 5, -}; - -static const static_codebook _44p3_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p3_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p3_l0_1, - 0 -}; - -static const long _vq_quantlist__44p3_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_l1_0[] = { - 1, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const static_codebook _44p3_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44p3_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p3_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p3_lfe[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book__44p3_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p3_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p3_long[] = { - 3, 4,13, 9, 9,12,15,17, 4, 2,18, 5, 7,10,14,18, - 11, 8, 6, 5, 6, 8,11,14, 8, 5, 5, 3, 5, 8,11,13, - 9, 6, 7, 5, 5, 7, 9,10,11,10, 9, 8, 6, 6, 8,10, - 14,14,11,11, 9, 8, 9,10,17,17,14,13,10, 9,10,10, -}; - -static const static_codebook _huff_book__44p3_long = { - 2, 64, - (long *)_huff_lengthlist__44p3_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p3_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p1_0[] = { - 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p3_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p3_p1_0, - 0 -}; - -static const long _vq_quantlist__44p3_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p3_p2_0[] = { - 3, 7, 7, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, - 11,11, 0, 0, 0, 0, 0, 0, 0, 0,10, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0,10,11, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, - 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0,12,12, 0, 0, - 0, 0, 0, 0, 0, 0,11,11, 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, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7, 7, 0, 0, 0, - 5, 5, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, - 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 6, 0, 0, 0, 7, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 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,11,11, 0, 0, 0, 9, 9, 0, - 0, 0,10,10, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, - 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, - 10,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, - 0, 0, 0,11,12, 0, 0, 0, 0, 0, 0, 0, 0,11,11, 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, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 9, 0, 0, 0, 7, 7, 0, 0, 0, 8, 8, 0, 0, - 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, - 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, - 0, 0, 0, 0, 0, 0, 0, 9, 9, 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, 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, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 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, 9, 0, 0, 0, 7, 7, - 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, - 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, - 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, - 0, 0, 0, 0,11,11, 0, 0, 0, 0, 0, 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, 9, 9, 0, 0, 0, 7, 7, 0, 0, 0, 8, 8, 0, - 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 8, 7, 0, 0, 0, 9, 9, 0, 0, 0, - 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0,11,11, - 0, 0, 0, 0, 0, 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, - 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, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 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, 9, 0, 0, 0, 7, - 7, 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, - 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, - 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 9, 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, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,10,10, 0, 0, 0, 9, 9, 0, 0, 0,10,10, - 0, 0, 0,11,12, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, - 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0,11,11, 0, 0, - 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, - 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0,11, - 11, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 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, 0, 0, 0, 0, 0, 0, 0, - 0, 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,10,10, 0, 0, 0, - 9, 9, 0, 0, 0,10,10, 0, 0, 0,12,12, 0, 0, 0, 0, - 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, - 0, 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, - 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0,11,11, 0, 0, - 0, 0, 0, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0, - 10,10, 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, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p3_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p3_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p3_p2_0, - 0 -}; - -static const long _vq_quantlist__44p3_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p3_0[] = { - 1, 5, 5, 5, 8, 8, 0, 8, 8, 6, 9, 9, 8,10,10, 0, - 8, 8, 0, 9, 9, 0,12,12, 0, 8, 8, 4, 7, 7, 6,10, - 10, 0,12,12, 7,11,11, 9,12,12, 0,12,12, 0,13,13, - 0,15,15, 0,12,12, 0, 7, 7, 0, 7, 7, 0, 8, 8, 0, - 8, 8, 0,10,10, 0, 7, 7, 0, 8, 8, 0,11,11, 0, 7, - 7, 5, 7, 7, 9, 9, 9, 0,11,10, 9, 9, 9,11,12,12, - 0,10,10, 0,11,11, 0,13,13, 0,11,11, 6, 7, 7, 9, - 10,10, 0,12,12,10,11,11,11,12,12, 0,12,12, 0,13, - 13, 0,15,15, 0,12,12, 0,10,10, 0,11,11, 0,11,11, - 0,12,12, 0,13,13, 0,11,11, 0,12,12, 0,15,15, 0, - 11,11, 0, 8, 8, 0,10,10, 0,12,12, 0,11,11, 0,12, - 12, 0,12,12, 0,12,12, 0,15,15, 0,11,11, 0, 7, 7, - 0,10,10, 0,12,12, 0,10,10, 0,12,13, 0,12,12, 0, - 13,13, 0,14,14, 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, 0, 0, -}; - -static const static_codebook _44p3_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p3_p3_0, - 0 -}; - -static const long _vq_quantlist__44p3_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p3_1[] = { - 3, 4, 4, 0, 8, 8, 0, 8, 8, 0, 9, 9, 0,10,10, 0, - 8, 8, 0, 9, 9, 0,10,10, 0, 8, 8, 0, 7, 7, 0, 8, - 8, 0, 8, 8, 0, 8, 8, 0, 8, 8, 0, 8, 8, 0, 8, 8, - 0, 8, 8, 0, 8, 8, 0, 7, 7, 0, 6, 6, 0, 7, 7, 0, - 7, 7, 0,10,10, 0, 6, 6, 0, 7, 7, 0,10,10, 0, 6, - 5, 0, 8, 8, 0, 7, 7, 0, 8, 8, 0, 8, 8, 0, 9, 9, - 0, 7, 7, 0, 8, 8, 0, 9, 9, 0, 7, 7, 0, 6, 6, 0, - 9,10, 0,10,10, 0,10,10, 0,11,11, 0, 9, 9, 0,10, - 10, 0,11,11, 0, 9, 9, 0, 8, 8, 0, 8, 8, 0, 8, 8, - 0, 9, 9, 0, 9, 9, 0, 8, 8, 0, 8, 8, 0, 9, 9, 0, - 7, 7, 0, 8, 8, 0, 7, 7, 0, 7, 7, 0, 8, 8, 0, 9, - 9, 0, 7, 7, 0, 7, 7, 0, 9, 9, 0, 6, 6, 0, 6, 6, - 0,10,10, 0,10,10, 0,10,10, 0,12,12, 0, 9, 9, 0, - 10,10, 0,12,12, 0, 9, 9, 0, 8, 8, 0, 7, 7, 0, 8, - 8, 0, 8, 8, 0, 9, 9, 0, 7, 7, 0, 8, 8, 0, 9, 9, - 0, 7, 7, -}; - -static const static_codebook _44p3_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p3_p3_1, - 0 -}; - -static const long _vq_quantlist__44p3_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p4_0[] = { - 1, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8,10,11,11, 9, - 8, 8, 8, 8, 8,11,11,11,10, 8, 8, 5, 7, 7, 9,11, - 11,10,11,11,10,11,11,12,13,14,11,12,12,10,11,11, - 13,14,14,12,12,12, 5, 6, 6, 8, 6, 6, 8, 7, 7, 8, - 7, 7,11,10,10,10, 7, 7, 9, 7, 7,12,11,11,11, 7, - 7, 7, 7, 7,11,10,10,12,10,10,11,10,10,15,13,13, - 13,10,10,12,11,11,15,13,13,14,11,11, 7, 7, 7,11, - 11,11,12,11,11,12,11,11,14,14,14,14,12,12,12,12, - 12,16,15,15,14,12,12, 0,10,10, 0,11,11, 0,11,12, - 0,11,11, 0,14,14, 0,11,11, 0,12,12, 0,15,15, 0, - 11,11, 8, 8, 8,12,10,10,12,10,10,13,11,11,15,13, - 13,14,11,11,12,10,10,16,14,14,14,10,10, 8, 7, 7, - 12,11,11,13,11,11,12,11,11,15,14,14,14,12,12,13, - 12,12,15,14,14,15,12,12, 0,11,11, 0,12,12, 0,12, - 12, 0,12,12, 0,15,15, 0,12,12, 0,13,13, 0,14,15, - 0,12,12, -}; - -static const static_codebook _44p3_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p3_p4_0, - 0 -}; - -static const long _vq_quantlist__44p3_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p3_p4_1[] = { - 3, 4, 5, 8, 8,12,10,10,12,12,12,10,10,12,12,13, - 11,11,12,12,13,12,12,12,12,13,10,10,13,13,13,13, - 13,13,13,13,10,10,13,13,13,11,11,13,13,14,13,13, - 12,12,13,10,10,13,13,13,13,13,13,13,13,10,10,12, - 12,13,11,11,13,13,13,13,13,12,12,13,12,12,13,13, - 13,13,13,13,13,14,11,11,12,12,14,12,12,13,12,14, - 14,14,12,12,13,14,14,13,13,14,13,13,13,13,14,14, - 14,12,12,14,13,13,13,13,14,14,14,12,12,12, 8, 8, - 11,11,12,12,12,11,11,12,11,11,10,10,13,12,12,10, - 10,13,12,12,10,10,13,12,12,12,12,14,12,12,12,12, - 13,13,13,11,11,14,12,12,11,11,14,12,12,12,12,14, - 12,12,12,12,13,12,12,12,12,13,13,13,11,11,14,12, - 12,11,11,14,12,12,12,12,14,13,13,12,12,14,12,12, - 12,11,14,13,13,11,11,14,13,12,11,11,14,13,13,11, - 11,14,13,13,12,12,14,12,12,12,12,15,13,13,12,12, - 14,12,12,11,11,14,13,13,11,11,12, 9, 9,10,10,12, - 7, 7,11,11,12, 9, 9,12,12,13,10,10,10,10,14,14, - 14,11,11,13, 9, 9,12,12,14,14,14,12,12,13, 8, 8, - 11,11,14, 9, 9,12,12,14,14,14,11,11,13, 9, 9,12, - 12,14,14,14,12,12,14, 8, 8,11,11,14, 9, 9,12,12, - 14,14,14,11,11,14,10,10,12,12,14,14,14,13,13,14, - 9, 9,11,11,14,10,10,12,12,14,14,14,11,11,14,14, - 15,12,12,15,14,14,14,14,15,14,14,11,11,14,14,14, - 12,12,14,14,14,11,11,14,11,11,10,10,14,10,10,10, - 10,14,10,10,10,10,15,11,11, 9, 9,14,12,12, 9, 9, - 15,11,11,11,11,15,13,13,11,11,15,10,10,10,10,15, - 11,11,10,10,15,13,13,11,11,15,11,11,11,11,15,13, - 13,11,11,15,10,10,10,10,15,11,11,10,10,15,13,13, - 11,11,15,12,12,11,11,15,13,13,11,11,15,11,11,10, - 10,15,12,12,10,10,15,13,13,10,10,15,14,14,11,11, - 15,13,13,11,11,15,14,14,10,11,15,13,13,10,10,15, - 13,14,10,10,14,13,13,10,10,14,13,13,10,10,14,13, - 13,10,10,14,13,13, 9, 9,14,14,14, 9, 9,15,14,14, - 11,11,15,14,14,10,10,15,14,14,10,10,15,14,14,11, - 11,15,14,14,10,10,15,14,14,11,11,15,14,14,10,10, - 14,14,14,10,10,15,14,14,10,10,14,14,14,10,10,15, - 14,14,11,11,15,14,14,11,11,14,14,14,10,10,15,14, - 14,10,10,14,14,14, 9, 9,15,15,15,11,11,15,14,14, - 12,12,15,15,14,10,10,15,14,14,10,10,14,15,15, 9, - 9,14,10,10,12,12,17, 9, 9,12,12,17,10,10,13,13, - 17,11,11,12,12,18,14,14,12,12,17,10,10,13,13,17, - 14,14,12,12,17, 9, 9,12,12,17,11,11,12,12,17,14, - 14,12,12,18,10,10,13,13,18,14,14,13,13,18, 9, 9, - 12,12,18,10,10,13,13,18,14,14,12,12,18,11,11,13, - 13,18,14,14,13,13,18,10,10,12,12,17,11,11,12,12, - 17,14,14,12,12,18,15,15,13,13,18,14,14,14,14,18, - 15,15,12,12,18,14,14,12,12,18,15,15,12,12,13, 7, - 7,11,11,14,15,15,11,11,14,15,15,12,12,14,15,15, - 11,11,15,15,15,11,11,14,15,15,12,12,14,15,15,12, - 12,14,15,15,11,11,14,15,15,11,11,15,15,15,12,12, - 14,15,15,12,12,14,15,15,12,12,14,15,15,11,11,14, - 15,15,11,11,15,15,15,12,12,15,15,15,12,12,14,15, - 15,12,12,14,15,14,12,12,14,15,15,11,11,15,14,14, - 12,12,15,15,15,12,12,15,16,16,12,12,15,15,15,12, - 12,15,15,15,12,12,15,15,15,12,12,13,13,13,11,10, - 14,14,15,11,11,14,14,14,12,12,15,14,14,10,10,15, - 15,15,11,11,14,15,15,12,12,14,14,14,11,11,14,15, - 15,11,11,14,15,15,12,12,15,15,15,11,11,14,15,15, - 12,12,14,14,14,12,12,14,15,15,11,11,14,15,15,12, - 12,15,15,15,11,11,15,15,15,12,12,15,14,14,12,12, - 14,15,15,11,11,14,15,15,11,11,15,15,15,10,10,15, - 15,16,12,12,15,15,15,14,14,15,15,15,11,11,15,15, - 15,12,12,15,15,15,11,11,14,11,11,10,10,15, 9, 9, - 12,12,15,10,10,12,12,15,11,11,11,11,15,14,14,12, - 12,15,10,10,13,13,15,14,14,12,12,15, 9, 9,12,12, - 15,10,10,13,13,15,13,13,12,11,15,10,10,12,12,15, - 14,14,12,12,15, 9, 9,11,11,15,11,11,12,12,15,13, - 13,11,11,15,11,11,13,13,15,13,14,13,14,15,11,11, - 11,11,15,11,11,12,12,15,14,14,11,11,15,14,14,13, - 13,15,14,14,20,20,15,14,14,12,12,15,14,14,12,12, - 15,14,14,11,11,14,13,13,10,10,14,13,13,12,12,14, - 14,13,12,12,15,14,14,12,12,15,14,14,11,11,15,14, - 14,12,12,15,14,14,13,13,15,14,14,12,11,15,14,14, - 11,11,15,14,14,13,13,15,14,14,12,12,15,14,14,13, - 13,15,14,14,12,11,15,14,14,12,12,15,14,14,13,13, - 15,14,14,13,13,15,14,14,12,12,15,14,14,12,12,15, - 14,14,12,12,15,15,15,13,13,15,15,15,13,13,15,14, - 14,13,13,15,15,15,13,13,15,14,15,12,12,15,15,15, - 13,13,14,10,10,12,13,17, 9, 9,12,12,17,10,10,13, - 13,17,11,11,12,12,18,14,14,12,12,18,10,10,13,13, - 18,14,14,12,12,17, 9, 9,12,12,18,10,11,13,13,18, - 14,14,12,12,17,10,10,12,12,17,14,14,12,12,17, 9, - 9,12,12,17,11,11,12,12,17,14,14,12,12,18,11,11, - 12,12,18,14,14,13,13,18,11,11,12,12,18,11,11,12, - 12,18,14,14,12,12,18,15,15,12,12,18,14,14,13,13, - 18,15,15,12,12,17,14,14,12,12,17,15,15,12,12,13, - 7, 7,11,11,14,15,15,11,11,14,15,15,11,11,14,15, - 14,12,12,15,15,15,12,11,14,15,15,12,12,14,15,15, - 12,12,14,15,15,11,11,14,15,15,11,11,15,15,15,13, - 13,14,15,15,11,11,14,15,15,13,12,14,15,15,11,11, - 14,15,15,11,11,15,15,15,13,13,14,15,15,12,12,15, - 15,15,12,12,15,15,15,11,11,15,15,15,11,11,15,15, - 15,12,12,15,15,15,13,13,15,16,16,12,12,15,15,15, - 12,13,15,15,15,12,12,15,15,15,12,12,13,13,13,11, - 11,14,14,14,11,11,14,14,14,12,12,14,14,14,10,10, - 15,14,14,11,11,14,15,15,12,12,14,14,14,12,12,14, - 15,15,11,11,14,15,14,12,12,15,14,14,11,11,14,15, - 15,12,12,14,14,14,11,11,14,15,15,11,11,14,14,14, - 12,12,15,15,14,11,11,15,15,15,12,12,15,14,14,12, - 12,14,15,15,11,11,14,15,14,11,11,15,15,15,10,10, - 15,15,15,12,12,15,14,14,14,13,15,15,15,11,11,15, - 15,15,11,11,15,15,15,10,10,14,11,11,10,10,15, 9, - 9,12,12,15,10,10,12,12,15,11,11,11,11,15,14,14, - 12,12,15,10,10,13,13,15,13,13,12,12,15, 9, 9,12, - 12,15,11,11,13,13,15,14,14,12,12,15,10,10,13,13, - 15,13,14,12,12,15, 9, 9,12,12,15,10,10,13,13,15, - 13,13,11,11,15,11,11,13,13,15,14,14,13,13,15,10, - 10,11,11,15,11,11,12,12,15,14,14,11,11,15,14,14, - 13,13,15,14,14,21,20,15,14,14,11,11,15,14,14,12, - 12,15,14,14,11,11,14,13,13,10,10,14,13,13,11,11, - 15,14,14,12,12,15,14,14,12,12,14,14,14,12,12,15, - 14,14,12,12,15,14,14,13,13,14,14,14,11,11,15,14, - 14,11,11,15,14,14,13,13,15,14,14,12,12,15,14,14, - 13,13,14,14,14,11,11,15,14,14,11,11,14,14,14,13, - 13,15,14,14,12,12,15,14,14,12,12,15,14,14,12,12, - 15,14,14,12,12,14,14,14,13,13,15,15,15,13,13,16, - 14,14,12,13,15,15,15,13,13,15,14,14,12,12,15,15, - 15,13,13,15,11,11,13,12,18,10,10,12,12,17,11,11, - 12,12,18,12,12,11,11,18,14,14,12,12,18,11,11,13, - 13,17,14,14,12,12,18,10,10,12,12,18,12,12,12,12, - 18,14,15,12,12,18,11,11,13,13,18,14,14,12,12,17, - 10,10,12,12,18,11,11,12,12,18,15,14,12,12,17,12, - 12,12,12,17,14,14,12,12,17,11,11,11,11,17,12,12, - 12,11,17,15,15,11,11,18,15,15,12,12,18,14,15,13, - 13,18,15,15,11,11,17,15,15,12,12,18,15,15,11,11, - 14, 9, 9,11,11,14,15,15,11,11,15,15,15,11,11,15, - 15,15,12,11,15,15,15,12,12,15,15,15,11,11,15,15, - 15,13,13,14,15,15,11,11,15,15,15,11,11,15,15,15, - 13,13,15,15,15,11,11,15,15,15,13,13,15,15,15,11, - 11,15,15,15,11,11,15,15,15,13,13,15,15,15,12,12, - 15,15,15,13,13,15,15,14,11,11,15,15,15,12,12,15, - 15,15,12,12,16,15,15,13,13,15,16,16,13,13,16,15, - 15,12,12,15,15,15,13,12,15,15,15,12,12,13,12,12, - 11,11,14,14,14,11,11,14,14,14,12,12,15,14,14,11, - 11,15,14,14,12,12,15,14,14,12,12,15,14,14,12,12, - 14,15,15,11,11,15,14,14,12,12,15,14,14,11,11,15, - 14,14,12,12,15,14,14,12,12,14,15,15,11,11,15,14, - 14,12,12,15,14,14,11,11,15,15,15,12,12,15,14,14, - 12,12,15,15,15,11,11,15,14,14,11,11,15,14,15,11, - 11,15,15,15,12,12,15,14,14,13,13,16,15,15,11,11, - 15,14,14,12,12,15,15,15,11,11,14,11,11, 9, 9,15, - 10,10,12,12,14,11,11,12,12,15,12,12,12,12,15,14, - 14,13,13,15,11,11,13,13,15,14,14,13,13,15,10,10, - 12,12,15,12,12,13,13,15,14,14,13,13,15,11,11,12, - 12,15,14,14,13,13,14,10,10,12,12,15,12,12,13,13, - 15,14,14,12,12,15,12,12,13,13,15,14,14,15,15,15, - 11,11,12,12,15,12,12,12,13,15,14,14,12,12,15,15, - 15,14,14,15,14,14,20,20,15,14,14,12,12,15,14,14, - 13,13,15,14,14,12,12,14,13,13,10,10,14,13,13,11, - 11,14,13,13,12,12,14,14,14,12,12,15,14,14,13,13, - 15,14,14,12,12,14,14,14,14,14,14,14,14,11,11,15, - 14,14,12,12,15,14,14,14,14,15,14,14,12,12,14,14, - 14,14,14,14,14,14,11,11,15,14,14,12,12,14,14,14, - 14,14,15,14,14,12,12,15,14,14,13,13,15,14,14,12, - 12,15,14,14,12,12,14,14,14,14,13,15,15,15,14,14, - 15,14,14,13,13,15,15,15,14,14,15,14,14,13,13,15, - 15,15,13,13,14,13,13,13,13,18,15,15,12,12,18,15, - 15,13,12,18,15,16,11,11,18,16,17,12,12,18,15,15, - 13,13,18,17,17,12,12,18,15,15,12,12,17,15,15,12, - 12,18,17,17,12,12,18,15,15,13,13,18,16,17,12,12, - 17,15,15,12,12,18,15,15,12,12,18,16,17,11,12,18, - 16,16,12,12,17,16,17,12,12,18,15,15,11,11,18,15, - 15,12,12,18,17,17,11,11,17,17,17,12,12,18,16,16, - 13,13,18,17,17,11,11,18,16,16,12,12,18,17,17,11, - 11,15,14,14,11,11,16,15,15,11,11,16,15,15,12,12, - 16,15,15,12,12,17,15,15,14,13,16,15,15,12,12,17, - 15,15,14,14,16,15,15,11,11,16,15,15,12,12,18,15, - 15,13,13,16,15,15,11,11,17,15,15,14,14,16,15,15, - 11,11,16,15,15,12,12,17,15,15,13,13,16,15,15,12, - 12,17,16,15,14,14,16,14,15,12,12,16,15,15,12,12, - 18,15,15,13,13,17,15,15,14,14,17,16,16,15,15,17, - 15,15,13,13,17,15,15,14,14,18,15,15,13,13,15,12, - 13,11,11,15,14,14,12,12,16,14,14,12,12,16,14,14, - 12,12,16,14,14,12,12,16,14,14,13,12,17,14,14,13, - 13,16,15,15,12,12,16,14,14,12,12,17,14,14,12,12, - 16,14,14,12,12,17,14,14,13,13,15,15,15,12,12,16, - 14,14,12,12,17,14,14,12,12,17,15,15,12,12,17,14, - 14,13,13,16,15,15,12,12,16,14,14,12,12,17,15,15, - 12,12,18,15,15,13,13,17,14,14,13,13,17,15,15,12, - 12,17,14,14,12,12,17,15,15,12,12,14,15,15, 9, 9, - 15,15,15,12,12,15,15,15,13,13,15,15,15,14,14,15, - 15,15,19,19,15,15,16,13,13,15,15,16,19,20,15,15, - 15,13,12,15,16,16,14,14,15,15,15,19,19,15,15,15, - 13,13,15,16,15,20,19,14,15,15,13,13,15,15,15,14, - 14,15,15,15,19,19,15,15,15,14,14,15,16,16,19,20, - 15,15,15,14,14,15,15,15,14,14,15,15,15,19,19,15, - 15,15,20,19,15,16,16,20,19,15,15,15,19,19,15,16, - 16,20,20,15,15,15,19,20,14,13,13,10,10,14,14,14, - 11,11,14,14,14,12,12,15,14,14,13,13,15,14,14,19, - 20,15,14,14,12,12,14,14,14,20,19,14,14,14,11,11, - 15,14,14,12,12,15,14,14,20,20,15,14,14,12,12,14, - 14,14,20,19,14,14,14,11,11,15,14,14,12,12,15,14, - 14,19,20,15,14,14,13,13,15,14,14,22,19,15,15,14, - 12,12,15,14,14,13,13,14,15,15,22,20,15,15,15,20, - 20,15,14,14,21,20,15,15,15,20,21,15,14,14,20,20, - 14,15,15,20,20, -}; - -static const static_codebook _44p3_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p3_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p3_p4_1, - 0 -}; - -static const long _vq_quantlist__44p3_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p3_p5_0[] = { - 2, 6, 6,14,14, 6, 7, 7,14,14, 7, 7, 7,15,15, 0, - 12,12,15,15, 0,13,13,15,15, 7, 8, 8,15,15,10,10, - 10,16,16, 9, 8, 8,15,15, 0,13,13,18,17, 0,13,13, - 16,16, 8, 8, 8,15,15,12,11,11,16,16, 9, 8, 8,15, - 15, 0,13,13,18,18, 0,13,13,16,16, 0,14,14,17,17, - 0,20, 0,19,20, 0,12,12,16,16, 0,16,16,20,22, 0, - 14,14,16,16, 0,14,14,17,17, 0,20,22,20,19, 0,13, - 13,15,16, 0,17,18, 0,21, 0,15,15,16,16, 5, 7, 7, - 13,13, 8, 9, 9,14,14,10,10,10,14,14, 0,20,22,18, - 18, 0,22,21,18,17, 9,10,10,14,14,12,12,12,17,17, - 12,10,10,14,14, 0, 0,20,17,17, 0,22,21,17,18,11, - 10,10,14,14,14,13,13,18,18,12,11,11,14,14, 0,22, - 21,18,19, 0,20, 0,17,17, 0,22, 0,18,18, 0, 0, 0, - 0, 0, 0,20,20,17,17, 0,22, 0,22,21, 0,21, 0,19, - 18, 0,22,22,18,18, 0, 0, 0, 0, 0, 0,21, 0,17,17, - 0,22, 0,20,20, 0, 0, 0,19,18, 6, 6, 6,12,12, 8, - 6, 6,10,10, 8, 6, 6,13,12, 0,10,10,11,11, 0,11, - 11,13,13, 8, 7, 7,13,13,11, 9, 9,13,13,10, 6, 6, - 12,12, 0,10,10,14,14, 0,10,10,13,13, 9, 7, 7,13, - 13,12,10,10,13,13,10, 6, 6,12,12, 0,11,11,15,15, - 0,10,10,13,13, 0,12,12,15,14, 0,19,20,16,17, 0, - 9, 9,13,13, 0,14,14,20,21, 0,12,11,13,12, 0,12, - 12,15,14, 0,20,19,17,17, 0,10,10,12,13, 0,15,15, - 22,21, 0,12,12,12,13, 0,10,10,12,12, 0,11,11,15, - 15, 0,11,11,15,15, 0,15,15,22,22, 0,16,17, 0, 0, - 0,11,11,15,15, 0,14,14,18,18, 0,11,11,16,16, 0, - 16,15, 0,21, 0,16,16, 0, 0, 0,12,12,15,15, 0,14, - 14,19,19, 0,11,11,15,15, 0,15,15,22, 0, 0,16,16, - 22, 0, 0,16,16, 0,21, 0, 0, 0, 0, 0, 0,15,15,19, - 20, 0,18,18, 0, 0, 0,17,17, 0, 0, 0,17,17, 0, 0, - 0, 0, 0, 0, 0, 0,16,15,22,21, 0,20,20, 0, 0, 0, - 18,18, 0, 0, 0,10,10,12,12, 0,10,10,11,11, 0,11, - 11,12,12, 0,11,11, 9, 9, 0,13,12,12,12, 0,11,11, - 13,13, 0,13,13,12,12, 0,10,10,12,12, 0,13,12,13, - 13, 0,12,12,12,12, 0,11,11,13,13, 0,13,13,12,12, - 0,10,10,12,12, 0,13,13,14,13, 0,12,12,12,12, 0, - 14,13,13,14, 0,20,21,15,15, 0,11,11,12,12, 0,15, - 16,20,20, 0,12,13,10,10, 0,13,13,14,13, 0,20,20, - 15,15, 0,11,11,12,12, 0,16,17,21,21, 0,13,13,11, - 11, 6, 7, 7,16,15,11, 9, 9,14,15,12, 9, 9,16,16, - 0,13,13,15,15, 0,14,14,17,17,10, 9, 9,16,16,14, - 12,12,16,16,12, 9, 9,15,15, 0,13,13,17,18, 0,13, - 13,15,15,12,10,10,17,17,15,12,12,17,17,13, 9, 9, - 16,16, 0,13,13,18,19, 0,14,14,16,16, 0,15,15,18, - 18, 0, 0, 0,20,19, 0,12,12,17,16, 0,16,17, 0,21, - 0,14,15,16,16, 0,15,15,18,18, 0, 0,22,19,21, 0, - 13,13,16,16, 0,18,17,22,22, 0,15,15,16,16, 7, 7, - 7,13,13,11,10,10,15,15,12,10,10,14,14, 0,21, 0, - 18,17, 0,21,22,18,18,11,10,10,15,15,14,12,12,17, - 17,14,11,11,14,14, 0,21,20,18,18, 0,22,21,18,17, - 12,11,10,16,16,16,14,14,17,19,14,11,11,15,15, 0, - 0,22,19,19, 0,21,22,18,18, 0,21, 0,18,19, 0, 0, - 0,22, 0, 0,22,21,17,17, 0, 0, 0,20,22, 0, 0,21, - 18,18, 0, 0, 0,19,20, 0, 0, 0, 0, 0, 0, 0,21,17, - 17, 0, 0, 0,22,21, 0, 0, 0,19,19,10, 9, 9,14,13, - 13,10,10,12,12,13,10,10,14,14, 0,13,13,12,12, 0, - 15,14,16,15,13,10,10,14,14,15,12,12,14,14,15,10, - 10,14,14, 0,14,14,15,15, 0,14,13,14,14,13,10,10, - 15,15,17,13,13,15,15,14,10,10,14,14, 0,14,14,15, - 16, 0,14,14,15,15, 0,15,15,16,16, 0,21,22,17,18, - 0,12,12,14,14, 0,17,17,20,21, 0,14,14,14,14, 0, - 15,15,16,16, 0,21,22,18,18, 0,13,13,14,14, 0,18, - 18,22, 0, 0,15,15,14,14, 0,11,11,13,13, 0,12,12, - 16,15, 0,12,12,16,16, 0,16,16, 0, 0, 0,16,17, 0, - 22, 0,12,12,16,16, 0,14,14,17,18, 0,11,11,16,16, - 0,15,15, 0,21, 0,16,16,21,22, 0,12,12,16,16, 0, - 15,15,19,19, 0,12,12,17,16, 0,16,16,21,22, 0,16, - 16, 0, 0, 0,17,17, 0,22, 0, 0, 0, 0, 0, 0,15,15, - 19,20, 0,17,19, 0, 0, 0,17,17,22, 0, 0,17,17, 0, - 22, 0, 0, 0, 0, 0, 0,15,15,21, 0, 0,19,20, 0, 0, - 0,19,18,22, 0, 0,11,12,14,14, 0,11,11,14,14, 0, - 12,12,15,15, 0,13,13,13,13, 0,14,14,16,16, 0,12, - 12,15,15, 0,14,14,16,15, 0,11,11,15,15, 0,13,13, - 16,16, 0,13,13,15,15, 0,12,12,15,15, 0,15,14,16, - 16, 0,11,11,15,15, 0,14,14,17,17, 0,13,13,15,15, - 0,15,15,16,16, 0, 0, 0,18,18, 0,12,12,14,14, 0, - 16,16,22, 0, 0,14,14,15,15, 0,15,15,16,17, 0,21, - 22,18,18, 0,13,13,15,14, 0,18,17,22, 0, 0,14,14, - 15,15, 8, 8, 8,16,15,12,10,10,16,15,12,10,10,16, - 16, 0,14,14,16,17, 0,14,14,17,16,12,10,10,17,18, - 14,12,12,18,18,14,10,10,16,16, 0,14,14,18,18, 0, - 14,14,16,16,12, 9, 9,16,16,17,13,13,16,17,14, 9, - 9,15,15, 0,14,14,18,19, 0,13,13,15,15, 0,15,15, - 18,19, 0, 0, 0,22,21, 0,13,13,16,16, 0,16,16,22, - 0, 0,15,15,16,16, 0,14,14,18,17, 0, 0, 0,20, 0, - 0,13,13,16,16, 0,18,18, 0, 0, 0,15,15,16,16, 8, - 7, 7,13,13,12,10,10,15,15,12,10,10,14,14, 0,22, - 22,19,18, 0, 0, 0,18,18,12,10,10,15,15,14,13,13, - 17,17,14,11,11,15,15, 0,19,20,18,18, 0,22,21,17, - 18,13,11,11,15,15,16,13,13,18,18,14,11,11,14,15, - 0,22,21,20,19, 0,22,21,17,17, 0, 0,22,19,18, 0, - 0, 0, 0, 0, 0,22,20,17,17, 0, 0, 0,21,20, 0, 0, - 0,19,17, 0, 0,22,19,19, 0, 0, 0, 0, 0, 0,22,20, - 18,17, 0, 0, 0, 0, 0, 0, 0, 0,18,18, 0,10,10,14, - 14, 0,11,11,14,14, 0,11,11,15,15, 0,14,14,14,14, - 0,15,15,16,16, 0,11,11,16,16, 0,13,13,16,16, 0, - 11,11,15,15, 0,14,14,16,16, 0,14,14,15,15, 0,11, - 11,15,15, 0,13,13,15,15, 0,10,10,15,15, 0,15,15, - 17,17, 0,14,14,14,14, 0,16,16,16,16, 0, 0,22,19, - 19, 0,13,13,14,14, 0,17,17, 0, 0, 0,15,15,14,14, - 0,16,16,17,17, 0, 0,22,18,18, 0,13,13,14,14, 0, - 21,18, 0, 0, 0,15,15,14,14, 0,11,11,13,13, 0,12, - 12,15,15, 0,12,12,16,15, 0,16,16, 0, 0, 0,17,17, - 22,22, 0,12,12,16,16, 0,14,14,18,18, 0,11,12,16, - 16, 0,15,16, 0,21, 0,16,16,22,21, 0,12,12,16,16, - 0,15,15,19,20, 0,11,12,16,16, 0,15,15,20,22, 0, - 16,16, 0,22, 0,17,17,22, 0, 0, 0, 0, 0, 0, 0,15, - 15,21,22, 0,19,18, 0, 0, 0,17,17, 0, 0, 0,17,17, - 0,22, 0, 0, 0, 0, 0, 0,16,15,22, 0, 0,19,19, 0, - 0, 0,17,18, 0, 0, 0,12,12,15,15, 0,12,12,15,15, - 0,12,12,15,15, 0,13,13,14,14, 0,15,15,16,17, 0, - 12,12,16,16, 0,14,14,16,16, 0,12,11,15,16, 0,14, - 14,16,17, 0,14,14,16,16, 0,13,12,16,16, 0,15,15, - 16,16, 0,11,11,15,15, 0,14,14,16,16, 0,14,14,15, - 15, 0,15,15,18,17, 0, 0,22, 0,20, 0,13,13,15,15, - 0,16,17,22,22, 0,14,14,15,15, 0,15,15,17,18, 0, - 20, 0,19,19, 0,13,13,15,15, 0,18,18,22, 0, 0,14, - 14,15,15, 0,11,11,16,16, 0,14,14,17,16, 0,13,13, - 17,17, 0,16,16,17,17, 0,17,17,18,19, 0,12,12,16, - 17, 0,15,15,18,18, 0,12,12,16,16, 0,16,16,19,18, - 0,16,16,17,16, 0,12,13,17,17, 0,17,16,18,17, 0, - 13,12,16,16, 0,16,16,18,19, 0,16,16,16,17, 0,16, - 16,18,18, 0,22, 0,22,22, 0,13,13,16,16, 0,19,18, - 22,20, 0,16,15,16,16, 0,16,17,18,18, 0, 0, 0,22, - 20, 0,14,14,16,16, 0,19,19, 0, 0, 0,16,16,16,16, - 0, 9, 9,13,13, 0,13,13,15,15, 0,14,14,15,15, 0, - 0,22,17,18, 0,22, 0,18,19, 0,12,12,15,15, 0,15, - 16,17,17, 0,14,14,14,14, 0,22, 0,18,18, 0,21,22, - 17,17, 0,13,13,15,15, 0,17,17,17,18, 0,14,14,15, - 15, 0,22,21,21,19, 0,20,21,17,17, 0,21,21,19,18, - 0, 0, 0, 0, 0, 0,21,21,17,17, 0, 0, 0,22,22, 0, - 0,22,19,18, 0, 0,21,19,18, 0, 0, 0, 0,22, 0,19, - 20,17,17, 0, 0, 0, 0,22, 0, 0, 0,19,18, 0,19,19, - 15,16, 0,21,19,16,17, 0, 0,21,17,17, 0, 0,22,17, - 17, 0,22,22,18,19, 0,20,20,16,16, 0, 0,22,18,18, - 0,20,19,16,17, 0,22,21,20,19, 0, 0,21,17,17, 0, - 21,20,17,17, 0, 0, 0,18,18, 0,19,19,17,16, 0,22, - 0,19,19, 0,21,22,17,18, 0, 0,22,19,18, 0, 0, 0, - 19,20, 0,19,19,16,16, 0,22,22,22, 0, 0,20,22,16, - 16, 0,22,20,18,19, 0, 0, 0,20,19, 0,20,20,16,16, - 0, 0, 0, 0, 0, 0,22,20,17,16, 0,11,11,13,13, 0, - 14,13,15,15, 0,13,13,16,15, 0,18,17,21, 0, 0,18, - 18,21, 0, 0,12,12,15,15, 0,15,16,17,18, 0,12,12, - 15,15, 0,17,17,22,20, 0,17,18,22, 0, 0,12,12,17, - 16, 0,16,17,19,19, 0,13,13,16,16, 0,17,17, 0,22, - 0,17,17, 0,21, 0,18,18,20,22, 0, 0, 0, 0, 0, 0, - 15,15,21,20, 0,20,19, 0, 0, 0,18,18,22, 0, 0,17, - 17,22, 0, 0, 0, 0, 0, 0, 0,15,16,20,22, 0,20,21, - 0, 0, 0,19,18, 0, 0, 0,15,15,19,19, 0,17,16,20, - 20, 0,16,17,20,21, 0,18,17, 0, 0, 0,19,19, 0, 0, - 0,15,15,21,19, 0,19,19, 0, 0, 0,15,15,22,22, 0, - 18,18, 0,22, 0,17,18,22,21, 0,15,15,20,19, 0,19, - 19, 0, 0, 0,15,15,20,22, 0,18,19,20, 0, 0,18,17, - 21,21, 0,18,18,19,22, 0, 0, 0, 0, 0, 0,15,15,20, - 19, 0,19,19, 0, 0, 0,18,18,21,22, 0,18,18,22, 0, - 0, 0, 0, 0, 0, 0,15,15,19,20, 0,21,21, 0, 0, 0, - 17,17,20,20, 0,12,12,17,17, 0,14,14,16,17, 0,13, - 14,17,17, 0,16,16,17,17, 0,17,17,17,19, 0,13,13, - 17,17, 0,16,16,18,18, 0,13,13,16,16, 0,16,16,18, - 18, 0,16,16,17,17, 0,13,13,17,17, 0,17,17,18,17, - 0,12,12,15,16, 0,17,18,19,20, 0,16,16,16,16, 0, - 17,16,18,19, 0, 0,22,21,22, 0,14,14,16,16, 0,19, - 19, 0, 0, 0,16,16,16,16, 0,16,16,18,17, 0, 0,22, - 21,21, 0,14,14,16,16, 0,22,20,22, 0, 0,16,16,15, - 15, 0, 9, 9,13,13, 0,14,14,15,15, 0,14,14,14,14, - 0,22,22,18,18, 0, 0,22,18,18, 0,12,12,15,15, 0, - 16,16,18,17, 0,14,14,14,14, 0,20,21,18,18, 0,22, - 21,17,17, 0,13,13,15,15, 0,17,17,18,18, 0,14,14, - 14,14, 0, 0,21,18,19, 0, 0,22,17,17, 0,22,22,19, - 18, 0, 0, 0, 0, 0, 0,19,21,17,17, 0, 0, 0,22,20, - 0, 0,21,18,19, 0, 0,22,18,18, 0, 0, 0, 0,22, 0, - 20,22,17,17, 0, 0, 0,20,22, 0, 0, 0,18,18, 0,19, - 21,16,16, 0,20,22,16,17, 0,20, 0,17,17, 0,22, 0, - 18,17, 0,21, 0,18,19, 0,20,20,17,17, 0,22, 0,18, - 18, 0,21,20,17,17, 0, 0,20,20,19, 0, 0,21,18,17, - 0,21,21,17,17, 0,22, 0,18,17, 0,19,19,17,17, 0, - 0,22,20,21, 0, 0,21,17,17, 0,22, 0,18,18, 0, 0, - 0,20,22, 0,20,19,16,16, 0, 0, 0, 0, 0, 0,22,22, - 17,17, 0,22, 0,18,19, 0, 0, 0,21,20, 0,19,21,16, - 17, 0, 0, 0, 0, 0, 0,22,22,17,16, 0,11,11,13,13, - 0,13,13,15,15, 0,13,13,15,15, 0,17,17,22,21, 0, - 18,18,22, 0, 0,12,13,16,15, 0,15,16,18,18, 0,13, - 13,16,16, 0,17,17, 0,22, 0,17,17,22,22, 0,13,13, - 16,16, 0,16,16,19,18, 0,13,13,16,16, 0,18,17, 0, - 20, 0,18,17,20, 0, 0,17,17,21, 0, 0, 0, 0, 0, 0, - 0,15,15,21,22, 0,19,20, 0, 0, 0,18,18, 0, 0, 0, - 18,17, 0, 0, 0, 0, 0, 0, 0, 0,16,16,22,22, 0,20, - 20, 0, 0, 0,21,19, 0, 0, 0,15,15,20,19, 0,16,16, - 22,20, 0,17,17, 0,22, 0,18,18, 0,22, 0,19,17, 0, - 0, 0,15,16,22,20, 0,18,19, 0, 0, 0,16,16,22,20, - 0,18,18, 0,22, 0,18,18,22, 0, 0,16,16,21,20, 0, - 19,20, 0,22, 0,16,16, 0,22, 0,18,18, 0,22, 0,18, - 18, 0,21, 0,19,18, 0,22, 0, 0, 0, 0, 0, 0,16,16, - 21,20, 0,20, 0, 0, 0, 0,18,18,21, 0, 0,18,18, 0, - 0, 0, 0, 0, 0, 0, 0,16,16,21,19, 0, 0, 0, 0, 0, - 0,18,18, 0,21, -}; - -static const static_codebook _44p3_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p3_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p3_p5_0, - 0 -}; - -static const long _vq_quantlist__44p3_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p3_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p3_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p3_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p3_p5_1, - 0 -}; - -static const long _vq_quantlist__44p3_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p6_0[] = { - 1, 6, 6, 7, 7, 7, 7, 8, 8, 7, 9, 9,11,11,11, 9, - 8, 8, 8, 9, 9,12,11,11, 9, 8, 8, 6, 7, 7,10,11, - 10,10,10,10,11,11,10,14,13,14,12,11,11,11,11,11, - 15,14,14,13,12,12, 5, 6, 6, 8, 5, 5, 8, 7, 7, 8, - 8, 8,12,10,10, 9, 7, 7, 9, 7, 8,12,10,10,10, 7, - 7, 7, 8, 8,12,10,10,12,10,10,11,10,10,15,13,13, - 13,10,10,11,10,10,16,13,14,14,10,10, 7, 7, 7,12, - 11,11,12,11,11,11,11,11,16,15,15,14,12,12,12,11, - 11,16,15,16,14,12,12,10, 9, 9,14,11,11,13,11,11, - 12,11,11,16,14,14,14,11,11,12,11,11,17,15,15,14, - 11,11, 7, 8, 8,12,11,11,12,10,10,12,10,10,16,14, - 13,14,10,10,12,10,10,17,14,14,14,10,10, 8, 7, 7, - 13,11,11,12,11,11,12,11,11,16,15,14,14,12,12,12, - 11,11,16,15,14,15,12,12,11,10,10,13,11,11,13,12, - 11,13,11,11,17,14,14,14,11,11,13,11,11,17,14,15, - 14,11,11, -}; - -static const static_codebook _44p3_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p3_p6_0, - 0 -}; - -static const long _vq_quantlist__44p3_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p6_1[] = { - 2, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, - 7, 7, 8, 8, 8, 9, 9, 9, 9, 7, 8, 6, 7, 7, 8, 8, - 8, 8, 8, 8, 9, 8, 8,10, 9, 9,10, 8, 8,10, 8, 8, - 10, 9, 9,10, 8, 8, 6, 6, 6, 8, 6, 6, 8, 7, 7, 8, - 7, 7,10, 8, 8, 9, 7, 7, 9, 7, 7,10, 8, 9, 9, 7, - 7, 7, 7, 7,10, 8, 8,11, 8, 8,10, 8, 8,12, 9, 9, - 12, 8, 8,11, 9, 9,12, 9, 9,11, 8, 8, 7, 7, 7,10, - 9, 9,10, 9, 9,10, 9, 9,11,10,10,10, 9, 9,11, 9, - 9,11,10,10,11, 9, 9, 9, 8, 8,10, 9, 9,10, 9, 9, - 11, 9, 9,11,10,10,11, 9, 9,11, 9, 9,11,10,10,11, - 9, 9, 8, 8, 8,11, 9, 9,11, 9, 9,11, 9, 9,12, 9, - 9,12, 8, 8,12, 9, 9,12, 9, 9,12, 8, 8, 8, 7, 7, - 10, 9, 9,10, 9, 9,11, 9, 9,11,11,11,11, 9, 9,11, - 10,10,11,11,11,11, 9, 9,10, 9, 9,11, 9, 9,11, 9, - 10,11,10, 9,11,10,10,11, 9, 9,11, 9,10,11,10,10, - 11, 9, 9, -}; - -static const static_codebook _44p3_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p3_p6_1, - 0 -}; - -static const long _vq_quantlist__44p3_p7_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p7_0[] = { - 1, 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p3_p7_0 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p7_0, - 1, -513979392, 1633504256, 2, 0, - (long *)_vq_quantlist__44p3_p7_0, - 0 -}; - -static const long _vq_quantlist__44p3_p7_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p3_p7_1[] = { - 1, 9, 9, 6, 9, 9, 5, 9, 9, 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, 9, 9, 9, 9, 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, 9, 9, 9, 9, 9, 9, 9, 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, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 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, 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,10,10,10,10,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 const static_codebook _44p3_p7_1 = { - 5, 243, - (long *)_vq_lengthlist__44p3_p7_1, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p3_p7_1, - 0 -}; - -static const long _vq_quantlist__44p3_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p3_p7_2[] = { - 1, 3, 2, 5, 4, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,14,14,15,15,15,15, -}; - -static const static_codebook _44p3_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p3_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p3_p7_2, - 0 -}; - -static const long _vq_quantlist__44p3_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p3_p7_3[] = { - 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p3_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p3_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p3_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p3_short[] = { - 4, 5,16, 9, 9,12,17,18, 4, 2,18, 6, 5, 9,13,15, - 10, 7, 7, 6, 7, 9,13,13, 8, 5, 6, 5, 5, 7,11,12, - 8, 4, 7, 4, 3, 6,10,12,11, 8, 9, 7, 6, 8,11,12, - 15,13,13,11, 9, 7,10,12,16,12,16,12, 6, 5, 8,11, -}; - -static const static_codebook _huff_book__44p3_short = { - 2, 64, - (long *)_huff_lengthlist__44p3_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p4_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p4_l0_0[] = { - 1, 4, 4, 8, 8, 9, 8, 9, 9,10,10,10,10, 4, 6, 5, - 8, 7, 9, 9, 9, 9,10, 9,10,10, 4, 5, 6, 7, 8, 9, - 9, 9, 9, 9,10, 9,10, 8, 9, 8, 9, 8,10, 9,11, 9, - 12,10,11,10, 8, 8, 9, 8, 9, 9,10, 9,11,10,11,10, - 12, 9,10,10,11,10,11,11,12,11,12,12,12,12, 9,10, - 10,11,11,11,11,11,12,12,12,12,12,10,11,11,12,12, - 12,12,12,12,12,12,12,12,10,11,11,12,12,12,12,12, - 12,12,12,12,12,11,12,12,12,12,12,12,12,12,12,13, - 12,12,11,12,11,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,13,12,12,12,12,12,12,11,13,12,12, - 12,13,12,12,12,12,12,12,12, -}; - -static const static_codebook _44p4_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p4_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p4_l0_0, - 0 -}; - -static const long _vq_quantlist__44p4_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p4_l0_1[] = { - 3, 4, 4, 5, 5, 4, 4, 5, 5, 5, 4, 5, 4, 5, 5, 5, - 5, 6, 5, 6, 5, 6, 5, 6, 5, -}; - -static const static_codebook _44p4_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p4_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p4_l0_1, - 0 -}; - -static const long _vq_quantlist__44p4_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_l1_0[] = { - 1, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const static_codebook _44p4_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44p4_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p4_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p4_lfe[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book__44p4_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p4_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p4_long[] = { - 3, 5,13, 9, 9,12,16,18, 4, 2,20, 6, 7,10,15,20, - 10, 7, 5, 5, 6, 8,10,13, 8, 5, 5, 3, 5, 7,10,11, - 9, 7, 6, 5, 5, 7, 9, 9,11,10, 8, 7, 6, 6, 8, 8, - 15,15,10,10, 9, 7, 8, 9,17,19,13,12,10, 8, 9, 9, -}; - -static const static_codebook _huff_book__44p4_long = { - 2, 64, - (long *)_huff_lengthlist__44p4_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p4_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p1_0[] = { - 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p4_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p4_p1_0, - 0 -}; - -static const long _vq_quantlist__44p4_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p4_p2_0[] = { - 3, 9, 9, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, - 12,12, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0,11,11, 0, 0, 0, 0, 0, - 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, - 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0,12,12, 0, 0, - 0, 0, 0, 0, 0, 0,11,11, 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, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7, 7, 0, 0, 0, - 5, 5, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, - 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 7, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 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,11,11, 0, 0, 0, 9, 9, 0, - 0, 0,10,10, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, - 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, - 10,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, - 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0,11,11, 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, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 9, 0, 0, 0, 7, 7, 0, 0, 0, 8, 8, 0, 0, - 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, - 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, - 0, 0, 0, 0, 0, 0, 0, 9, 9, 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, 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, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 7, 7, - 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, - 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, - 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, - 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, 0, - 0, 0, 0, 0,11,11, 0, 0, 0, 0, 0, 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, 9, 9, 0, 0, 0, 7, 7, 0, 0, 0, 8, 8, 0, - 0, 0,10,11, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, - 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0,11,11, - 0, 0, 0, 0, 0, 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, - 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, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 7, - 7, 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, - 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, - 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 9, 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, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,10,10, 0, 0, 0, 9, 9, 0, 0, 0,10,10, - 0, 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, - 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, - 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, - 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0,11, - 11, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 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, 0, 0, 0, 0, 0, 0, 0, - 0, 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,10,10, 0, 0, 0, - 9, 9, 0, 0, 0,10,10, 0, 0, 0,12,12, 0, 0, 0, 0, - 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, - 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0,10,10, 0, - 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, - 0, 0, 0, 0, 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0, - 10,10, 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, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44p4_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p4_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p4_p2_0, - 0 -}; - -static const long _vq_quantlist__44p4_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p3_0[] = { - 1, 6, 6, 5, 7, 8, 0, 8, 8, 6, 9, 9, 7,10,10, 0, - 8, 8, 0, 9, 9, 0,12,12, 0, 8, 8, 4, 7, 7, 6,10, - 10, 0,12,12, 7,11,11, 8,12,12, 0,12,12, 0,13,12, - 0,15,15, 0,12,12, 0, 7, 7, 0, 7, 7, 0, 7, 7, 0, - 8, 8, 0,10,10, 0, 7, 7, 0, 8, 8, 0,11,11, 0, 7, - 7, 5, 7, 7, 8, 9, 9, 0,10,10, 8, 9, 9,11,11,11, - 0,10, 9, 0,11,11, 0,13,13, 0,10,10, 6, 7, 7, 8, - 10,10, 0,12,12, 9,10,10,10,12,12, 0,12,12, 0,12, - 12, 0,15,15, 0,12,12, 0,10,10, 0,11,11, 0,11,11, - 0,11,11, 0,13,13, 0,11,11, 0,11,11, 0,15,15, 0, - 10,10, 0, 8, 8, 0,10,10, 0,12,12, 0,11,11, 0,12, - 12, 0,12,12, 0,12,12, 0,15,15, 0,11,11, 0, 7, 7, - 0,10,10, 0,12,12, 0,10,10, 0,12,12, 0,12,12, 0, - 13,13, 0,14,14, 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, 0, 0, -}; - -static const static_codebook _44p4_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p4_p3_0, - 0 -}; - -static const long _vq_quantlist__44p4_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p3_1[] = { - 3, 5, 5, 0, 8, 8, 0, 8, 8, 0, 9, 9, 0,10,10, 0, - 8, 8, 0, 8, 8, 0,10,10, 0, 8, 8, 0, 7, 7, 0, 8, - 8, 0, 7, 7, 0, 8, 8, 0, 8, 8, 0, 8, 8, 0, 8, 8, - 0, 8, 8, 0, 8, 8, 0, 7, 7, 0, 6, 6, 0, 7, 7, 0, - 7, 7, 0,10,10, 0, 6, 6, 0, 7, 7, 0,10,10, 0, 5, - 5, 0, 8, 8, 0, 7, 7, 0, 8, 8, 0, 8, 8, 0, 9, 9, - 0, 7, 7, 0, 8, 8, 0, 9, 9, 0, 7, 7, 0, 6, 6, 0, - 9,10, 0,10,10, 0,10,10, 0,11,11, 0, 9, 9, 0,10, - 10, 0,11,11, 0, 9, 9, 0, 8, 8, 0, 8, 8, 0, 8, 8, - 0, 9, 9, 0, 9, 9, 0, 7, 7, 0, 8, 8, 0, 9, 9, 0, - 7, 7, 0, 8, 8, 0, 7, 7, 0, 7, 7, 0, 8, 8, 0, 9, - 9, 0, 7, 7, 0, 7, 7, 0, 8, 8, 0, 6, 6, 0, 6, 6, - 0,10,10, 0,10,10, 0,10,10, 0,12,12, 0, 9, 9, 0, - 10,10, 0,12,12, 0, 9, 9, 0, 8, 8, 0, 7, 7, 0, 7, - 7, 0, 8, 8, 0, 9, 9, 0, 7, 7, 0, 8, 8, 0, 9, 9, - 0, 6, 6, -}; - -static const static_codebook _44p4_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p4_p3_1, - 0 -}; - -static const long _vq_quantlist__44p4_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p4_0[] = { - 1, 6, 6, 6, 7, 7, 7, 8, 8, 7, 8, 8,10,11,11, 9, - 8, 8, 8, 8, 8,11,11,12, 9, 8, 8, 5, 7, 7, 9,11, - 11,10,11,11,10,11,11,12,14,14,11,12,12,10,12,12, - 13,14,14,12,12,12, 5, 6, 6, 7, 6, 6, 8, 7, 7, 8, - 7, 7,11,10,10,10, 7, 7, 9, 8, 8,12,11,11,10, 7, - 7, 7, 7, 7,11,10,10,12,10,10,11,10,10,15,13,13, - 13,10,10,12,11,11,15,13,13,14,11,11, 7, 7, 7,11, - 11,11,12,11,11,12,11,11,14,14,14,13,12,12,12,12, - 12,16,15,15,14,12,12, 0,10,10, 0,11,11, 0,12,12, - 0,11,11, 0,14,14, 0,11,11, 0,12,12, 0,15,15, 0, - 11,11, 7, 8, 8,12,11,10,12,10,10,12,11,11,15,13, - 13,14,11,11,12,10,10,16,14,14,14,10,10, 8, 7, 7, - 12,11,11,12,11,11,12,11,11,15,14,14,14,12,12,13, - 12,12,15,14,14,15,13,13, 0,11,11, 0,12,12, 0,12, - 12, 0,12,12, 0,15,15, 0,12,12, 0,13,13, 0,15,14, - 0,12,12, -}; - -static const static_codebook _44p4_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p4_p4_0, - 0 -}; - -static const long _vq_quantlist__44p4_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p4_p4_1[] = { - 4, 5, 5, 9, 9,12, 9, 9,12,12,12,10,10,13,13,13, - 11,11,12,12,13,13,13,12,12,13,10,10,13,13,13,13, - 13,13,13,13,10,10,13,12,13,11,11,13,13,13,14,14, - 13,12,13,10,10,13,13,12,13,13,13,13,13,10,10,12, - 12,13,11,11,13,13,13,14,14,12,12,13,12,12,13,13, - 13,13,13,13,13,13,11,11,12,12,13,11,11,13,13,13, - 14,14,12,12,13,14,14,13,13,14,13,13,14,14,14,14, - 14,12,12,13,14,14,13,13,14,14,14,12,12,12, 8, 8, - 12,12,13,12,12,11,11,13,11,11,11,11,14,12,12,11, - 11,14,12,12,10,11,14,12,12,12,12,14,12,12,12,12, - 13,13,13,11,11,14,12,12,11,11,14,12,12,12,12,14, - 12,12,12,12,14,12,12,12,12,14,13,13,11,11,14,12, - 12,11,11,14,12,12,12,12,14,13,13,12,12,14,12,12, - 12,12,14,13,13,11,11,14,12,12,11,11,14,13,13,11, - 11,15,13,13,12,12,14,12,12,12,12,15,13,13,12,12, - 14,12,12,11,11,15,13,13,11,11,12, 9, 9,11,11,13, - 7, 7,11,11,13, 8, 8,12,12,14,10,10,10,10,14,14, - 14,11,11,14, 8, 8,12,12,14,14,14,12,12,14, 7, 7, - 11,11,14, 9, 9,12,12,14,14,14,11,11,14, 8, 8,12, - 12,14,14,14,12,12,14, 7, 7,11,11,14, 9, 9,12,12, - 14,14,14,11,11,14,10,10,12,12,14,14,14,13,13,14, - 9, 9,11,11,14,10,10,12,11,15,14,14,11,11,14,15, - 15,12,12,15,14,14,14,14,15,14,14,11,11,15,14,14, - 12,12,15,14,14,11,11,14,11,11,10,10,15,10,10,10, - 10,15,10,10,10,10,15,11,11, 9, 9,15,12,13, 9, 9, - 15,11,11,11,11,15,13,13,11,11,15,10,10,10,10,15, - 11,11,10,10,15,13,13,11,11,15,11,11,11,11,15,13, - 13,11,11,15,10,10,10,10,15,11,11,10,10,15,13,13, - 10,11,15,12,12,11,11,15,13,13,11,10,15,11,11,10, - 10,15,11,12,10, 9,15,13,13,10,10,15,14,14,11,11, - 15,13,13,11,11,15,14,14,10,10,15,13,13,10,10,15, - 14,14,10,10,14,13,13,10,10,15,13,13,10,10,15,13, - 13,10,10,14,14,14, 8, 9,15,14,14, 9, 9,15,14,14, - 11,11,15,14,14,10,10,15,14,14,10,10,15,14,14,11, - 11,15,14,14,10,10,15,14,14,11,11,15,14,14,10,10, - 15,14,14,10,10,15,14,14,10,10,15,14,14, 9, 9,15, - 14,14,11,11,15,14,14,11,11,15,14,14,10,10,15,14, - 14,10,10,14,14,14, 9, 9,15,15,15,11,11,15,14,14, - 12,12,15,15,15,10,10,15,14,15,10,10,15,15,15, 9, - 9,15,10,10,13,13,17, 8, 8,12,12,17,10, 9,13,13, - 18,11,11,12,12,18,14,14,12,12,17, 9, 9,13,13,17, - 13,13,12,12,18, 8, 8,12,12,18,10,10,12,12,18,14, - 14,12,12,18,10,10,13,13,18,13,13,13,13,18, 9, 9, - 12,12,18,10,10,13,13,18,14,14,12,12,18,11,11,13, - 13,18,14,14,13,13,18,10,10,12,12,17,11,11,12,12, - 18,14,14,12,12,18,14,14,13,13,18,14,14,13,13,19, - 14,15,12,12,18,14,14,12,12,18,15,15,12,12,13, 7, - 7,11,11,14,15,15,11,11,14,16,15,11,11,14,15,15, - 11,11,14,15,15,11,11,14,15,15,11,12,14,15,15,12, - 12,13,15,15,11,11,14,15,15,11,11,15,15,15,12,12, - 14,15,15,12,12,14,16,16,12,12,14,15,15,11,11,14, - 15,15,11,11,15,15,15,12,12,15,15,15,12,12,14,15, - 15,12,12,14,15,15,11,11,14,15,15,11,11,15,14,15, - 12,12,15,15,15,12,12,15,16,16,12,12,15,15,15,12, - 12,14,15,15,12,12,15,15,15,12,12,13,13,13,11,11, - 14,14,15,11,11,14,14,14,12,12,14,15,15,10,10,15, - 15,15,11,11,14,15,15,12,12,14,14,14,11,11,14,15, - 15,11,11,14,15,15,12,12,15,15,15,11,11,14,15,15, - 12,12,14,14,15,11,11,14,15,15,11,11,14,15,15,12, - 12,15,15,15,11,11,15,15,15,12,12,14,15,15,12,12, - 14,15,15,10,10,14,15,15,11,11,15,15,15,10,10,15, - 15,15,12,12,15,15,15,14,14,15,15,15,11,11,15,15, - 15,11,11,15,15,15,11,11,14,10,10,10,10,15, 9, 9, - 12,11,15,10,10,12,12,15,11,11,11,11,15,13,13,12, - 12,16,10,10,12,12,15,13,13,12,12,15, 9, 9,11,11, - 15,10,10,13,12,15,13,13,11,11,15,10,10,12,12,15, - 13,13,12,12,15, 9, 9,11,11,15,10,10,12,12,15,13, - 13,11,11,15,11,11,12,12,15,13,13,13,13,15,10,10, - 11,11,15,11,11,12,12,15,13,14,11,11,15,14,14,13, - 13,16,14,14,20,19,15,14,14,11,11,15,13,14,12,12, - 15,14,14,11,11,14,13,13,10,10,14,14,13,11,11,15, - 13,14,12,12,15,14,14,12,12,15,14,14,11,11,15,14, - 14,12,12,15,15,14,13,13,15,14,14,11,11,15,14,14, - 11,11,15,14,14,13,13,15,14,14,12,12,15,14,14,13, - 13,15,14,14,11,11,15,14,14,11,11,15,14,14,13,13, - 15,14,14,12,12,15,14,14,12,12,15,14,14,12,12,15, - 14,14,11,11,15,15,15,12,12,15,15,15,13,13,16,14, - 14,12,12,15,15,15,13,13,15,15,15,12,12,15,15,15, - 12,12,14,10,10,13,13,17, 9, 9,12,12,17, 9, 9,13, - 13,17,11,11,12,12,18,14,14,12,12,18,10,10,13,13, - 18,14,13,12,12,18, 9, 9,12,12,18,10,10,12,13,18, - 14,14,12,12,17, 9, 9,12,12,17,13,14,12,12,17, 9, - 9,12,12,17,10,10,12,12,17,14,14,11,11,18,11,11, - 12,12,18,14,14,12,13,18,10,10,12,12,18,11,11,12, - 12,18,14,14,11,11,18,15,15,12,12,18,14,14,13,13, - 18,14,15,12,12,17,14,14,12,12,17,15,15,12,12,13, - 7, 7,11,11,14,15,15,11,11,14,15,15,11,11,14,15, - 15,11,11,14,15,15,11,11,14,15,15,11,11,14,15,15, - 12,12,14,15,15,11,11,14,15,15,11,11,15,15,15,12, - 12,14,15,15,11,11,14,15,15,12,12,14,15,15,11,11, - 15,15,15,11,11,15,15,15,12,12,14,15,15,12,12,14, - 15,16,12,12,14,15,15,11,11,14,15,15,11,11,15,15, - 15,12,12,15,15,15,12,12,15,16,16,12,12,15,15,15, - 12,12,15,15,15,12,12,15,15,15,12,12,13,13,13,12, - 12,14,14,14,11,11,14,14,14,12,12,14,14,14,10,10, - 15,15,15,11,11,14,15,15,12,12,14,14,14,11,11,14, - 15,15,11,11,14,14,14,12,12,15,15,14,11,11,14,15, - 15,12,12,14,14,14,11,11,14,15,15,11,11,14,14,14, - 11,11,15,14,14,10,10,14,15,15,12,12,14,14,14,12, - 12,14,15,15,10,10,14,15,15,11,11,15,15,15,10,10, - 15,15,15,12,12,15,14,14,13,13,15,15,15,10,10,15, - 14,14,11,11,15,15,15,10,10,14,10,10,10,10,14, 9, - 9,12,12,15,10,10,12,12,14,11,11,11,11,15,13,14, - 12,12,15,10,10,13,13,15,13,13,12,12,15, 9, 9,12, - 12,15,10,10,13,13,15,13,14,11,11,15,10,10,12,12, - 15,13,13,12,12,15, 9, 9,11,11,15,10,10,12,12,15, - 13,13,11,11,15,11,11,12,12,15,13,13,13,13,15,10, - 10,11,11,15,11,11,12,12,15,14,14,11,11,15,14,14, - 13,13,15,14,14,20,19,15,14,14,11,11,15,14,14,12, - 12,15,14,14,11,11,14,13,13,11,11,15,13,13,11,11, - 15,14,13,12,12,15,14,14,11,12,15,14,14,11,11,15, - 14,14,12,12,14,14,14,13,13,15,14,14,11,11,15,14, - 14,11,11,15,14,14,13,13,15,14,14,12,12,15,14,14, - 13,13,14,14,14,11,11,15,14,14,11,11,15,14,14,13, - 13,15,14,14,12,12,15,14,14,12,12,15,14,14,12,12, - 15,14,14,11,11,14,14,14,12,12,15,15,15,13,13,16, - 14,14,12,12,15,15,15,13,13,15,14,14,12,12,15,15, - 15,12,12,15,11,11,13,13,18,10,10,12,12,17,11,11, - 12,12,18,12,12,11,11,18,14,14,12,12,18,10,10,13, - 13,18,14,14,12,12,18,10,10,12,12,18,11,11,12,12, - 18,14,14,12,12,18,11,11,12,13,18,14,14,12,12,18, - 10,10,12,12,18,11,11,12,12,18,14,14,11,11,18,11, - 11,12,12,18,14,14,12,12,17,10,10,11,11,17,12,12, - 11,11,17,14,14,11,11,18,15,15,12,12,18,14,14,13, - 13,18,15,15,11,11,18,15,14,12,12,18,15,15,11,11, - 14, 8, 8,11,11,14,15,15,10,10,14,15,15,11,11,14, - 15,15,11,11,15,15,15,12,12,15,15,15,11,11,15,15, - 15,12,12,14,15,15,10,10,15,15,15,11,11,15,15,15, - 12,12,15,15,15,11,11,15,15,15,13,13,14,15,15,10, - 10,15,15,15,11,11,15,15,15,12,12,15,15,15,12,12, - 15,16,16,12,12,15,14,14,11,11,15,15,15,11,11,15, - 15,15,12,12,16,15,15,13,13,15,16,16,13,13,16,15, - 15,12,12,15,15,15,12,12,15,15,15,12,12,14,13,13, - 11,11,14,14,14,11,11,14,14,14,12,12,15,14,14,11, - 11,15,15,14,11,11,15,14,14,12,12,15,14,14,12,12, - 14,15,15,11,11,15,14,14,12,12,15,14,14,11,11,15, - 14,15,12,12,15,14,14,12,12,14,15,15,11,11,15,14, - 14,11,11,15,14,14,11,11,15,15,14,12,12,15,14,14, - 12,12,15,15,15,10,11,15,14,14,11,11,15,15,15,10, - 10,15,15,15,12,12,16,14,14,13,13,15,15,15,11,11, - 15,14,14,11,11,15,15,15,11,11,14,11,11, 9, 9,14, - 10,10,12,12,15,11,11,12,12,15,12,12,12,12,15,14, - 14,13,13,15,11,11,12,12,15,14,14,13,13,14,10,10, - 12,12,15,11,11,13,13,15,14,14,12,12,15,10,10,12, - 12,14,14,14,13,13,14,10,10,11,11,15,11,11,12,12, - 15,14,14,12,12,15,12,12,13,13,15,14,14,14,14,15, - 11,11,11,11,15,12,11,12,12,15,14,14,11,11,15,15, - 15,13,14,15,14,14,20,19,15,14,14,12,12,15,14,14, - 13,13,15,14,14,12,12,14,13,13,10,10,14,13,13,11, - 11,14,13,13,11,11,15,14,14,12,12,15,14,14,12,12, - 15,14,14,12,11,14,14,14,13,13,15,14,14,11,11,15, - 14,14,11,11,15,14,14,14,14,15,14,14,11,12,15,14, - 14,13,13,14,14,14,11,11,15,14,14,11,11,15,14,14, - 14,14,15,14,14,12,12,15,14,14,13,13,15,14,14,11, - 11,14,14,14,12,12,15,14,14,13,13,15,15,15,13,13, - 15,14,14,13,13,15,15,15,13,13,15,14,14,13,13,15, - 15,15,13,13,15,14,14,13,13,18,15,15,12,12,18,15, - 15,12,12,18,16,16,11,11,18,17,17,12,12,18,15,15, - 13,13,18,17,17,12,12,18,15,15,12,12,18,15,16,12, - 12,18,17,17,12,12,18,15,15,13,12,17,16,17,12,12, - 17,15,15,11,12,18,15,15,12,12,18,17,17,11,11,18, - 16,16,12,12,18,17,16,12,12,18,15,15,11,11,18,15, - 15,12,12,18,17,17,11,11,18,17,17,12,12,18,16,16, - 13,13,18,17,17,11,11,17,16,16,11,11,18,17,17,11, - 11,15,15,15,11,11,16,15,15,11,11,16,15,15,11,11, - 16,15,15,12,12,17,15,15,14,14,16,15,15,11,11,17, - 15,15,14,14,16,15,15,11,11,16,15,15,12,12,18,15, - 15,13,13,16,15,15,11,11,17,15,15,14,14,16,15,15, - 11,11,16,15,15,12,12,17,15,15,13,13,16,15,15,12, - 12,17,16,15,14,14,16,15,15,11,11,16,15,15,12,12, - 18,15,15,13,13,17,15,15,14,14,17,16,16,15,15,18, - 14,15,13,13,18,15,15,14,14,18,15,15,13,13,15,13, - 13,12,12,15,14,14,12,12,16,14,14,12,12,16,14,14, - 12,12,17,14,15,12,12,16,14,14,12,12,17,14,14,13, - 13,16,15,15,12,12,16,14,14,12,12,17,14,14,12,12, - 16,14,14,12,12,17,14,14,13,13,15,15,15,11,11,16, - 14,14,12,12,17,14,14,12,12,16,15,15,12,12,17,14, - 14,13,12,16,15,15,11,11,16,14,14,12,12,17,15,15, - 11,11,17,15,15,13,13,17,14,14,13,13,18,15,15,12, - 12,17,14,14,12,12,17,15,15,12,12,14,15,15, 9, 9, - 14,15,15,12,12,15,16,15,13,13,15,15,15,14,14,15, - 15,15,21,19,15,15,15,13,13,15,15,15,19,19,15,15, - 15,12,12,15,16,16,14,14,15,15,15,19,19,15,16,15, - 13,13,15,16,16,19,20,15,15,15,12,13,15,16,16,14, - 14,15,15,15,20,19,15,15,15,14,14,15,16,16,19,19, - 15,15,15,14,13,15,15,15,14,14,15,15,15,19,19,15, - 16,16,20,19,15,17,16,21,20,15,15,15,20,19,15,16, - 16,20,20,15,15,15,19,20,14,13,13,10,10,14,14,14, - 11,11,14,14,14,12,12,15,14,14,13,13,15,15,14,20, - 20,15,14,14,12,12,14,14,14,19,19,15,14,14,11,11, - 15,14,14,12,12,15,14,14,20,19,15,14,14,12,12,14, - 14,14,20,20,14,14,14,11,11,15,14,14,12,12,15,14, - 14,20,21,15,14,14,13,13,15,14,14,20,20,15,14,14, - 12,12,15,14,14,13,13,14,15,15,20,20,15,15,15,20, - 19,15,14,14,20,19,15,15,15,20,20,15,14,14,21,20, - 15,15,15,20,20, -}; - -static const static_codebook _44p4_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p4_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p4_p4_1, - 0 -}; - -static const long _vq_quantlist__44p4_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p4_p5_0[] = { - 1, 7, 6,15,15, 7, 8, 8,15,15, 8, 8, 8,15,15, 0, - 13,13,16,16, 0,14,14,16,16, 7, 9, 9,16,16,10,11, - 11,17,17,10, 8, 8,15,16, 0,14,14,18,18, 0,14,14, - 16,16, 9, 9, 9,16,16,12,11,11,17,17,10, 9, 9,15, - 15, 0,14,14,19,19, 0,14,14,16,16, 0,15,15,18,17, - 0, 0, 0,20,20, 0,13,13,16,16, 0,17,17,22,20, 0, - 15,15,17,17, 0,15,15,18,18, 0,22,21,20,21, 0,13, - 13,16,16, 0,18,18, 0,22, 0,15,15,17,17, 6, 7, 7, - 13,13, 9,10,10,15,15,11,10,10,15,15, 0,21,22,18, - 18, 0, 0, 0,18,18,10,10,10,15,15,12,13,13,17,17, - 12,11,11,15,15, 0,22,22,18,18, 0, 0,21,18,18,12, - 11,11,15,15,15,14,14,18,18,13,11,11,15,15, 0, 0, - 21,18,19, 0,21,22,18,19, 0,22, 0,18,19, 0, 0, 0, - 0, 0, 0,21,21,18,18, 0,22, 0, 0,21, 0, 0, 0,19, - 18, 0, 0, 0,18,19, 0, 0, 0, 0, 0, 0,20,20,18,17, - 0, 0,22, 0,21, 0, 0, 0,19,19, 6, 6, 6,13,13, 8, - 6, 6,11,11, 9, 7, 7,13,13, 0,10,10,11,11, 0,12, - 12,14,14, 9, 8, 8,14,14,12,10,10,13,13,10, 7, 7, - 13,13, 0,11,11,15,15, 0,11,11,13,13, 9, 8, 8,14, - 14,13,10,10,13,14,11, 7, 7,13,13, 0,11,11,15,15, - 0,11,11,13,13, 0,12,12,15,15, 0,21,21,17,17, 0, - 10,10,13,13, 0,14,14,20,20, 0,12,12,13,13, 0,12, - 12,15,15, 0,21,22,17,18, 0,10,10,13,13, 0,16,16, - 20,21, 0,12,12,13,13, 0,11,11,13,13, 0,12,12,16, - 16, 0,12,12,16,16, 0,16,16, 0,21, 0,17,18, 0, 0, - 0,12,12,15,15, 0,15,15,18,18, 0,12,12,16,16, 0, - 16,16,21,22, 0,17,17,22,21, 0,12,12,16,16, 0,15, - 15,19,19, 0,12,12,16,16, 0,16,16,22,22, 0,17,16, - 22, 0, 0,17,18, 0, 0, 0, 0, 0, 0, 0, 0,15,15,21, - 20, 0,19,20, 0,22, 0,18,18, 0, 0, 0,18,17, 0, 0, - 0, 0, 0, 0, 0, 0,16,16,22,21, 0,20,20, 0,22, 0, - 20,19, 0, 0, 0,11,11,12,12, 0,10,10,11,11, 0,11, - 11,12,12, 0,12,12,10,10, 0,13,13,12,12, 0,11,11, - 13,13, 0,13,13,12,12, 0,10,10,12,12, 0,13,13,14, - 13, 0,12,12,12,12, 0,12,12,13,13, 0,14,14,13,13, - 0,10,10,12,12, 0,13,13,14,14, 0,13,12,12,12, 0, - 14,14,14,14, 0,21,21,16,16, 0,12,12,12,12, 0,16, - 16,20,21, 0,13,13,11,11, 0,14,14,14,14, 0,20,20, - 16,15, 0,12,12,12,12, 0,17,17,20,20, 0,13,13,11, - 11, 7, 8, 8,16,16,11,10,10,15,15,12,10,10,17,17, - 0,14,14,16,15, 0,15,15,17,17,11, 9, 9,16,16,14, - 12,12,17,17,13, 9, 9,16,15, 0,14,14,19,18, 0,14, - 14,16,16,12,10,10,17,18,16,13,13,17,18,14,10,10, - 16,16, 0,14,14,19,19, 0,14,15,17,17, 0,15,15,18, - 19, 0, 0, 0,20,20, 0,13,13,17,17, 0,17,18, 0,22, - 0,15,15,16,17, 0,15,15,18,18, 0, 0, 0,20,21, 0, - 14,14,17,17, 0,19,18, 0, 0, 0,16,16,17,17, 8, 7, - 7,14,14,12,11,11,15,15,13,11,11,15,15, 0, 0, 0, - 18,19, 0,21,20,18,18,12,10,11,15,16,14,13,13,18, - 18,14,11,11,15,15, 0,20,20,19,18, 0,20, 0,18,18, - 13,11,11,16,16,17,15,15,19,19,14,12,12,15,15, 0, - 21, 0,18,20, 0,22,22,18,19, 0,22,22,19,19, 0, 0, - 0, 0, 0, 0,21,22,19,18, 0, 0, 0, 0,21, 0, 0, 0, - 19,19, 0, 0,22,20,20, 0, 0, 0, 0, 0, 0,22, 0,18, - 18, 0, 0, 0, 0,22, 0, 0, 0,19,20,11,10,10,14,14, - 14,11,11,13,13,14,11,11,15,15, 0,14,13,12,12, 0, - 15,15,16,16,13,11,11,15,15,16,13,13,15,15,15,10, - 10,14,15, 0,14,14,16,16, 0,14,14,15,15,13,11,11, - 15,15,18,14,14,15,15,15,10,10,15,14, 0,14,14,16, - 16, 0,14,14,15,15, 0,15,15,17,16, 0,21,22,18,18, - 0,13,13,14,14, 0,18,17,20,21, 0,15,15,14,14, 0, - 15,16,16,17, 0, 0, 0,19,18, 0,13,13,15,14, 0,19, - 19, 0, 0, 0,15,15,14,14, 0,12,12,14,13, 0,13,13, - 16,16, 0,12,12,16,16, 0,16,16,22, 0, 0,17,18, 0, - 22, 0,13,13,16,16, 0,15,15,18,18, 0,12,12,16,16, - 0,16,16,22,22, 0,17,17, 0, 0, 0,13,13,17,17, 0, - 16,16,19,20, 0,12,12,17,17, 0,17,17,22, 0, 0,17, - 17,22,21, 0,18,18, 0, 0, 0, 0, 0, 0, 0, 0,16,16, - 21,21, 0,19,19, 0, 0, 0,18,18, 0,22, 0,18,18, 0, - 22, 0, 0, 0, 0, 0, 0,16,16,22, 0, 0,20,20, 0, 0, - 0,19,18, 0, 0, 0,12,12,15,15, 0,12,12,15,14, 0, - 13,13,15,15, 0,14,14,14,14, 0,15,15,16,16, 0,13, - 13,15,16, 0,15,15,16,16, 0,12,12,15,15, 0,14,14, - 16,16, 0,14,14,15,15, 0,13,13,15,16, 0,15,15,16, - 16, 0,12,12,15,15, 0,15,15,17,17, 0,14,14,15,15, - 0,15,15,17,17, 0,21,21,19,19, 0,13,13,14,14, 0, - 17,17,22, 0, 0,14,14,15,15, 0,15,15,17,17, 0,22, - 0,18,20, 0,13,13,15,15, 0,18,18, 0,22, 0,15,15, - 14,15, 8, 8, 8,17,16,12,10,10,16,16,13,10,10,17, - 16, 0,15,15,17,17, 0,15,15,17,17,12,11,11,18,18, - 15,12,12,18,18,15,10,10,16,17, 0,14,14,18,18, 0, - 14,14,17,17,13,10,10,16,16,17,14,14,17,17,15,10, - 10,16,15, 0,15,15,19,20, 0,14,14,15,16, 0,16,16, - 19,19, 0, 0, 0,21,22, 0,13,13,17,17, 0,18,17, 0, - 21, 0,15,15,17,17, 0,15,15,18,19, 0, 0,22, 0,21, - 0,13,13,16,17, 0,19,19, 0,22, 0,16,15,16,16, 9, - 8, 8,14,14,12,11,11,15,15,13,11,11,15,15, 0,21, - 20,19,18, 0, 0, 0,19,18,12,11,11,16,15,15,13,13, - 17,18,14,11,11,15,15, 0,22,22,19,18, 0,22,21,18, - 18,14,11,11,15,15,17,14,14,18,18,15,12,12,15,15, - 0,22,22,20,19, 0, 0,21,18,18, 0, 0,22,20,20, 0, - 0, 0, 0, 0, 0,20,21,18,18, 0, 0, 0,21,21, 0, 0, - 0,20,19, 0,22,21,19,19, 0, 0, 0, 0, 0, 0, 0,22, - 17,18, 0, 0,22, 0,22, 0,22, 0,19,19, 0,11,11,15, - 15, 0,11,11,14,14, 0,12,12,15,15, 0,15,15,14,14, - 0,16,16,16,16, 0,12,12,16,16, 0,14,14,16,16, 0, - 11,11,15,15, 0,15,15,17,17, 0,15,15,15,15, 0,12, - 12,16,16, 0,14,14,15,15, 0,11,11,15,15, 0,15,15, - 17,17, 0,15,15,14,15, 0,16,16,17,17, 0, 0, 0,19, - 19, 0,14,14,15,15, 0,18,18,21, 0, 0,15,15,14,15, - 0,16,16,17,17, 0,21, 0,19,19, 0,14,14,15,15, 0, - 20,20,22, 0, 0,16,15,14,14, 0,12,12,13,13, 0,12, - 12,16,16, 0,12,12,16,16, 0,16,16,22,21, 0,18,17, - 21, 0, 0,13,13,16,16, 0,15,15,18,19, 0,12,12,16, - 16, 0,16,17,22, 0, 0,17,17, 0,22, 0,13,13,17,16, - 0,15,15,19,19, 0,12,12,16,16, 0,16,16,21,20, 0, - 17,16,22, 0, 0,18,18,22,21, 0, 0, 0, 0, 0, 0,15, - 16,21,21, 0,19,19, 0, 0, 0,18,17, 0, 0, 0,18,18, - 21, 0, 0, 0, 0, 0, 0, 0,16,16,22,22, 0,20,21, 0, - 0, 0,18,19, 0,22, 0,13,13,16,16, 0,12,12,15,15, - 0,13,13,16,16, 0,14,14,15,15, 0,15,15,17,17, 0, - 13,13,17,16, 0,15,15,17,17, 0,12,12,16,16, 0,15, - 15,17,17, 0,14,14,16,16, 0,13,13,16,17, 0,15,15, - 17,17, 0,12,12,16,16, 0,14,14,17,17, 0,14,14,16, - 16, 0,16,16,17,17, 0,21, 0,21,19, 0,13,13,16,16, - 0,17,17, 0, 0, 0,15,15,16,16, 0,16,15,18,18, 0, - 22, 0,20,20, 0,13,13,15,15, 0,18,18, 0, 0, 0,15, - 15,15,15, 0,12,12,17,17, 0,14,14,17,17, 0,14,14, - 17,17, 0,17,17,18,17, 0,17,17,19,18, 0,13,13,17, - 17, 0,16,16,18,18, 0,13,13,16,16, 0,17,17,19,19, - 0,16,16,17,17, 0,13,13,18,18, 0,17,17,18,18, 0, - 13,13,17,17, 0,17,17,19,19, 0,16,17,17,17, 0,17, - 17,19,19, 0,21, 0,21,19, 0,14,14,16,16, 0,20,19, - 0,21, 0,16,16,16,16, 0,17,18,19,19, 0, 0, 0, 0, - 21, 0,15,15,16,17, 0,21,20, 0, 0, 0,17,18,16,17, - 0, 9, 9,14,14, 0,14,14,15,16, 0,14,14,15,15, 0, - 0, 0,18,18, 0,21, 0,18,19, 0,12,12,15,15, 0,16, - 16,17,17, 0,14,14,14,14, 0,22, 0,19,18, 0,22, 0, - 17,18, 0,14,14,16,15, 0,18,18,19,18, 0,14,15,15, - 15, 0, 0,21,20,20, 0, 0, 0,18,18, 0,21,21,19,19, - 0, 0, 0, 0, 0, 0,21,21,18,18, 0,22, 0,20,20, 0, - 22, 0,19,19, 0,22, 0,19,20, 0, 0, 0, 0, 0, 0, 0, - 21,17,18, 0, 0, 0,22,22, 0, 0, 0,19,18, 0,18,20, - 16,16, 0,21,20,17,17, 0, 0,21,18,18, 0,22,21,18, - 18, 0, 0,22,19,19, 0,20,20,17,17, 0, 0, 0,18,18, - 0,19,20,17,17, 0,22, 0,19,21, 0,22,21,18,18, 0, - 20,19,17,18, 0, 0, 0,19,19, 0,20,20,17,17, 0,22, - 22,21,21, 0,20, 0,18,18, 0,22,22,18,18, 0, 0, 0, - 20,22, 0,20,20,16,16, 0, 0, 0,21, 0, 0,21,20,16, - 17, 0,22, 0,19,20, 0, 0, 0,21,20, 0,19,21,17,17, - 0, 0, 0, 0, 0, 0,21,21,17,17, 0,12,12,13,13, 0, - 14,14,16,16, 0,14,14,16,16, 0,18,18, 0, 0, 0,19, - 18,22, 0, 0,13,13,16,16, 0,16,16,18,18, 0,13,13, - 16,16, 0,17,18,21, 0, 0,18,18,21, 0, 0,13,13,16, - 16, 0,17,17,19,20, 0,13,13,16,17, 0,18,18,21, 0, - 0,18,18,21, 0, 0,18,19, 0,21, 0, 0, 0, 0, 0, 0, - 16,16,21,20, 0,20,20, 0, 0, 0,18,19, 0, 0, 0,18, - 18, 0, 0, 0, 0, 0, 0, 0, 0,16,16, 0,21, 0,22,22, - 0, 0, 0,19,19, 0, 0, 0,16,16,19,20, 0,17,16,22, - 21, 0,17,17,21,20, 0,19,18, 0,22, 0,19,19,22,22, - 0,16,15,22,22, 0,19,19, 0,21, 0,15,15,20,20, 0, - 18,19, 0,21, 0,18,18,22,22, 0,16,16,21,20, 0,20, - 19,21,22, 0,16,15,20,20, 0,19,19, 0,22, 0,18,18, - 21, 0, 0,19,18,21,22, 0, 0, 0, 0, 0, 0,16,16,19, - 21, 0,20,22, 0,22, 0,18,18,20,21, 0,19,18, 0,22, - 0, 0, 0,22, 0, 0,16,16,20,20, 0,21,21, 0, 0, 0, - 18,18,21, 0, 0,12,12,17,17, 0,15,14,17,17, 0,14, - 14,18,18, 0,17,17,17,18, 0,18,18,18,18, 0,13,13, - 18,18, 0,16,17,19,18, 0,13,13,16,17, 0,17,17,18, - 19, 0,17,17,17,17, 0,13,13,17,17, 0,17,18,18,18, - 0,13,13,16,16, 0,18,18,19,20, 0,16,17,17,16, 0, - 17,18,19,18, 0, 0, 0,22,21, 0,15,15,16,16, 0,20, - 20,21,22, 0,17,17,16,16, 0,16,17,18,18, 0, 0, 0, - 21,21, 0,15,15,16,16, 0,21,20, 0, 0, 0,17,17,16, - 16, 0,10,10,14,14, 0,14,14,15,15, 0,14,14,15,15, - 0,22, 0,18,18, 0, 0, 0,19,19, 0,13,13,15,16, 0, - 17,16,18,18, 0,14,14,15,15, 0,21,21,19,18, 0,22, - 21,18,17, 0,14,14,15,15, 0,18,18,19,18, 0,15,15, - 14,14, 0,22,21,19,19, 0,22,21,17,18, 0, 0, 0,19, - 19, 0, 0, 0, 0, 0, 0,20,22,17,17, 0, 0,22,22,20, - 0, 0, 0,19,18, 0,21,22,19,18, 0, 0, 0, 0, 0, 0, - 22,22,17,18, 0, 0, 0,21,22, 0, 0, 0,19,18, 0,20, - 20,17,17, 0,21,21,17,18, 0,21,22,18,18, 0,21, 0, - 18,18, 0,22, 0,19,19, 0,19,21,18,18, 0, 0,22,18, - 18, 0,22,21,17,17, 0,22, 0,20,20, 0, 0, 0,18,18, - 0,22,21,18,18, 0,21, 0,19,19, 0,20,21,17,17, 0, - 0,22,22,20, 0,21,22,17,17, 0, 0,21,19,18, 0, 0, - 0,21,21, 0,21,20,16,17, 0, 0, 0, 0, 0, 0,21, 0, - 17,17, 0,21, 0,19,20, 0, 0, 0,20,22, 0,20,20,17, - 17, 0, 0, 0, 0, 0, 0,21,21,17,17, 0,12,12,13,13, - 0,14,14,16,16, 0,14,14,16,16, 0,18,18,21, 0, 0, - 19,19,22, 0, 0,13,13,16,16, 0,16,16,18,18, 0,13, - 13,16,16, 0,18,18,21,22, 0,18,18, 0,22, 0,13,13, - 16,16, 0,17,17,20,18, 0,13,13,16,16, 0,19,18, 0, - 22, 0,18,18,22,21, 0,18,19, 0, 0, 0, 0, 0, 0, 0, - 0,16,16,21,21, 0,21,21, 0, 0, 0,18,19, 0, 0, 0, - 19,19,21, 0, 0, 0, 0, 0, 0, 0,16,16, 0,21, 0,20, - 20, 0, 0, 0,20,20, 0, 0, 0,16,16,21,20, 0,18,17, - 21,22, 0,17,18, 0,21, 0,18,19,22,22, 0,19,19, 0, - 22, 0,16,17,21,22, 0,20,19, 0, 0, 0,16,16,20,21, - 0,19,19, 0, 0, 0,19,19, 0,22, 0,17,17,21,21, 0, - 19,20, 0, 0, 0,16,16, 0,20, 0,19,20, 0,21, 0,18, - 18, 0,22, 0,19,20,22,22, 0, 0, 0, 0,22, 0,17,17, - 0,21, 0,21,21, 0, 0, 0,18,19,23,21, 0,20,19, 0, - 0, 0, 0, 0, 0, 0, 0,17,17, 0,20, 0, 0, 0, 0, 0, - 0,19,19,23,22, -}; - -static const static_codebook _44p4_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p4_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p4_p5_0, - 0 -}; - -static const long _vq_quantlist__44p4_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p4_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p4_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p4_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p4_p5_1, - 0 -}; - -static const long _vq_quantlist__44p4_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p6_0[] = { - 1, 7, 7, 7, 8, 8, 7, 8, 8, 7, 9, 9,11,11,11, 9, - 8, 8, 8, 9, 9,12,11,12, 9, 8, 8, 6, 7, 7,10,11, - 11,10,10,10,11,11,11,14,14,14,12,11,12,11,11,11, - 15,15,14,13,12,12, 5, 6, 6, 8, 5, 5, 8, 7, 7, 8, - 7, 7,12,10,10,10, 7, 6, 9, 8, 8,12,10,10,10, 6, - 6, 7, 8, 8,12,10,10,12,10,10,11,10,10,16,14,14, - 13,10,10,12,10,10,15,14,14,14,10,10, 7, 7, 7,13, - 11,11,13,11,11,12,11,11,16,14,14,14,12,12,12,11, - 11,18,15,15,14,12,12,10, 9,10,14,11,11,13,11,11, - 12,11,11,17,14,14,14,11,11,13,11,11,16,15,15,14, - 11,11, 7, 8, 8,13,11,11,12,10,10,12,10,10,16,14, - 13,13,10,10,12,10,10,17,14,14,14,10,10, 8, 7, 7, - 12,11,11,13,11,11,12,11,11,16,15,14,14,12,12,12, - 11,11,16,15,15,14,12,12,11,10,10,14,11,11,13,11, - 11,13,11,11,17,14,14,14,11,11,13,11,11,18,14,15, - 15,11,10, -}; - -static const static_codebook _44p4_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p4_p6_0, - 0 -}; - -static const long _vq_quantlist__44p4_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p6_1[] = { - 2, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, - 7, 7, 8, 8, 8, 9, 9, 9, 9, 8, 8, 6, 7, 7, 8, 8, - 8, 8, 8, 8, 9, 8, 8, 9, 8, 9, 9, 8, 8,10, 8, 8, - 10, 9, 9,10, 8, 8, 6, 6, 6, 8, 6, 6, 8, 7, 7, 8, - 7, 7,10, 8, 8, 9, 7, 7, 9, 7, 7,10, 8, 8, 9, 7, - 7, 7, 7, 7,10, 8, 8,11, 9, 9,10, 9, 9,11, 9, 9, - 11, 8, 8,11, 9, 9,12, 9, 9,12, 8, 8, 7, 7, 7,10, - 9, 9,10, 9, 9,10, 9, 9,11,10,10,10, 9, 9,11, 9, - 10,11,10,11,10, 9, 9, 9, 8, 8,10, 9, 9,10, 9, 9, - 11, 9, 9,11,10,10,11, 9, 9,11, 9, 9,11,10,10,11, - 9, 9, 8, 8, 8,11, 9, 9,11, 9, 9,11, 9, 9,12, 9, - 9,12, 8, 8,11, 9, 9,12, 9, 9,12, 8, 8, 8, 7, 7, - 10, 9, 9,10, 9, 9,10, 9, 9,11,11,11,11, 9, 9,11, - 10,10,11,11,11,11, 9, 9,10, 9, 9,11, 9, 9,11, 9, - 10,11,10,10,11,10,10,11, 9, 9,11,10,10,11,10,10, - 11, 9, 9, -}; - -static const static_codebook _44p4_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p4_p6_1, - 0 -}; - -static const long _vq_quantlist__44p4_p7_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p7_0[] = { - 1, 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p4_p7_0 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p7_0, - 1, -513979392, 1633504256, 2, 0, - (long *)_vq_quantlist__44p4_p7_0, - 0 -}; - -static const long _vq_quantlist__44p4_p7_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p4_p7_1[] = { - 1, 9, 9, 7, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 8, - 9, 9, 7, 9, 9, 9, 9, 9, 9, 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, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 5, 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, 8, 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, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 5,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, 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, -}; - -static const static_codebook _44p4_p7_1 = { - 5, 243, - (long *)_vq_lengthlist__44p4_p7_1, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p4_p7_1, - 0 -}; - -static const long _vq_quantlist__44p4_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p4_p7_2[] = { - 1, 3, 2, 5, 4, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,14,14,15,15,15,15, -}; - -static const static_codebook _44p4_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p4_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p4_p7_2, - 0 -}; - -static const long _vq_quantlist__44p4_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p4_p7_3[] = { - 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p4_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p4_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p4_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p4_short[] = { - 3, 5,16, 9, 9,13,18,21, 4, 2,21, 6, 6,10,15,21, - 16,19, 6, 5, 7,10,13,16, 8, 6, 5, 4, 4, 8,13,16, - 8, 5, 6, 4, 4, 7,12,15,13,10, 9, 7, 7, 9,13,16, - 18,15,13,12, 9, 7,10,14,21,18,13,13, 7, 5, 8,12, -}; - -static const static_codebook _huff_book__44p4_short = { - 2, 64, - (long *)_huff_lengthlist__44p4_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p5_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p5_l0_0[] = { - 1, 4, 4, 8, 8,10,10,10,10, 9, 8,11,11, 4, 6, 5, - 8, 6,10,10,10,10,10, 9,10, 9, 4, 5, 6, 6, 9,10, - 10,10,10, 9,10, 9,10, 8, 9, 8, 9, 8, 9, 9,10, 9, - 11,10,12,10, 8, 8, 9, 8, 9, 9, 9, 9,10,10,11,10, - 12, 9,10,10,11,10,11,10,12,11,12,11,13,11, 9,10, - 10,10,11,10,11,11,12,11,12,11,12,11,12,12,12,12, - 13,12,13,12,13,12,13,13,11,12,12,12,12,12,12,12, - 13,13,13,13,13,12,12,12,13,13,13,13,13,13,13,13, - 13,13,12,13,12,13,13,13,13,13,13,13,13,13,13,12, - 13,13,13,14,14,13,13,13,13,13,13,13,12,13,12,13, - 13,13,13,13,13,13,13,13,13, -}; - -static const static_codebook _44p5_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p5_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p5_l0_0, - 0 -}; - -static const long _vq_quantlist__44p5_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p5_l0_1[] = { - 4, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 4, 4, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p5_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p5_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p5_l0_1, - 0 -}; - -static const long _vq_quantlist__44p5_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_l1_0[] = { - 1, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const static_codebook _44p5_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44p5_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p5_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p5_lfe[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book__44p5_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p5_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p5_long[] = { - 3, 7,12,14,14,16,18,19, 6, 2, 4, 6, 8, 9,12,14, - 12, 3, 3, 5, 7, 8,11,13,13, 6, 4, 5, 7, 8,10,11, - 14, 8, 7, 7, 7, 7, 9,10,15, 9, 8, 7, 7, 6, 8, 9, - 17,11,11,10, 9, 8, 9, 9,19,14,13,11,10, 9, 9, 9, -}; - -static const static_codebook _huff_book__44p5_long = { - 2, 64, - (long *)_huff_lengthlist__44p5_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p5_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p1_0[] = { - 2, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 8, 5, 7, 8, 8, 9, - 10, 8, 9,10, 8, 9,10, 9,10,12,10,11,11, 8,10,10, - 10,11,11, 9,11,11, 5, 8, 7, 8, 9, 9, 8,10, 9, 8, - 10,10, 9,11,11,10,11,11, 8,10, 9,10,11,11, 9,12, - 10, 5, 8, 8, 7, 9,10, 8,10, 9, 7, 9, 9, 9,10,11, - 9,11,11, 8,10, 9,10,11,11,10,11,11, 7, 9, 9, 9, - 10,11, 9,11,11, 9, 9,11,10,10,13,11,11,12, 9,11, - 11,11,12,13,11,13,12, 7, 9, 9, 9,11,11, 9,11,10, - 9,11,10,10,11,12,11,13,12, 9,11,11,11,12,13,11, - 13,11, 5, 8, 8, 8, 9,10, 7,10, 9, 8, 9,10,10,11, - 11,10,11,11, 7, 9, 9, 9,11,11, 9,11,10, 7, 9, 9, - 9,10,11, 9,11,11, 9,11,11,11,11,13,11,13,12, 9, - 10,11,11,12,13,10,12,11, 7, 9, 9, 9,11,11, 9,11, - 10, 9,11,11,11,12,13,11,13,12, 9,11, 9,11,12,11, - 10,13,10, -}; - -static const static_codebook _44p5_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p5_p1_0, - 0 -}; - -static const long _vq_quantlist__44p5_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p5_p2_0[] = { - 4, 6, 6, 9, 9, 6, 7, 8,10,10, 6, 8, 7,10,10, 8, - 10,10,12,13, 8,10,10,13,12, 6, 7, 8,10,10, 7, 8, - 9,10,11, 8, 9, 9,11,11,10,10,11,12,14,10,11,11, - 14,13, 6, 8, 7,10,10, 8, 9, 9,11,11, 7, 9, 8,11, - 10,10,11,11,13,14,10,11,10,14,12, 9,10,10,12,12, - 10,10,11,12,13,10,11,11,13,13,12,12,13,12,15,13, - 14,13,15,14, 9,10,10,12,12,10,11,11,13,13,10,11, - 10,13,12,13,13,14,14,15,12,13,12,15,12, 6, 7, 8, - 10,11, 8, 9,10,11,12, 8, 9, 9,11,12,10,11,12,13, - 14,10,11,11,14,13, 8, 9,10,11,12, 9,10,11,12,13, - 9,10,11,12,13,11,12,13,13,15,12,12,13,15,14, 8, - 9, 9,12,12, 9,10,11,12,13, 9,10,10,13,12,12,12, - 13,14,15,11,12,12,14,14,11,11,12,13,14,11,12,13, - 13,15,12,13,13,14,15,14,13,15,14,16,14,15,15,16, - 16,11,12,11,14,13,12,13,13,15,14,11,13,12,14,13, - 14,15,15,15,16,13,14,14,16,14, 6, 8, 7,11,10, 8, - 9, 9,11,12, 8,10, 9,12,11,10,11,11,13,14,10,12, - 11,14,13, 8, 9, 9,12,12, 9,10,10,12,13, 9,11,10, - 13,12,11,12,12,13,14,12,13,12,15,14, 8,10, 9,12, - 11, 9,11,10,13,12, 9,11,10,13,12,12,13,12,14,15, - 11,13,12,15,13,11,11,12,13,14,11,12,13,13,15,12, - 13,13,14,15,13,14,14,14,16,14,15,15,16,16,11,12, - 11,14,13,12,13,13,15,14,11,13,12,15,13,14,15,15, - 16,16,13,15,13,16,14, 9,10,11,12,14,11,11,12,13, - 15,11,12,12,13,14,13,14,15,15,17,13,14,14,15,16, - 11,11,12,13,15,12,12,13,14,16,12,13,13,14,15,14, - 14,16,15,17,15,15,15,16,17,11,12,12,14,14,12,13, - 13,15,16,12,13,13,15,15,15,15,15,16,17,14,15,15, - 16,16,14,14,15,15,17,14,15,15,15,17,15,15,16,16, - 17,16,16,17,16,18,17,17,17,18,18,14,15,14,16,16, - 15,15,16,17,17,14,15,15,17,16,17,17,17,18,18,16, - 16,16,17,17, 9,11,10,14,12,11,12,12,14,13,11,12, - 11,15,13,13,14,14,16,15,13,15,14,17,15,11,12,12, - 15,14,12,13,13,15,15,12,13,13,15,15,14,15,15,16, - 16,15,15,15,17,16,11,12,11,15,13,12,13,13,15,14, - 12,13,12,16,14,15,15,15,17,16,14,15,14,17,15,14, - 14,15,16,16,14,15,15,16,16,15,16,15,17,17,16,16, - 16,17,17,17,17,17,18,17,14,15,14,16,15,15,15,15, - 17,16,15,15,15,17,15,17,17,17,18,18,16,17,16,18, - 16, 6, 8, 8,11,11, 8, 9, 9,11,12, 8, 9, 9,12,11, - 10,11,11,13,14,10,12,11,14,13, 7, 9, 9,11,12, 9, - 10,10,12,13, 9,10,10,13,13,11,11,12,13,15,11,12, - 12,15,14, 8, 9, 9,12,11, 9,11,10,13,13, 9,11,10, - 13,12,12,13,12,14,15,11,13,12,15,13,10,11,12,13, - 14,11,12,12,13,15,12,12,13,14,15,13,13,14,14,16, - 14,15,15,16,16,11,12,11,14,13,12,13,13,15,14,11, - 13,12,15,13,14,15,15,15,16,13,14,14,16,14, 7, 9, - 9,11,12, 9,10,11,12,13, 9,10,10,13,12,11,12,12, - 14,15,11,12,12,15,14, 9, 9,11,11,13,10,10,12,12, - 14,10,11,12,13,14,12,12,13,14,16,12,13,13,15,15, - 9,11,10,13,13,10,12,12,13,14,10,12,11,14,13,12, - 13,13,15,16,12,13,13,15,14,11,11,13,13,15,12,12, - 14,13,16,13,13,13,14,15,14,14,15,14,17,15,15,15, - 16,16,12,13,12,15,14,13,14,14,15,15,12,14,13,16, - 14,15,15,16,16,17,14,15,14,17,15, 7, 9, 9,12,11, - 9,10,10,12,13, 9,11,10,13,12,11,12,12,14,14,11, - 13,12,15,14, 9,10,10,13,12,10,10,11,12,13,10,12, - 11,14,13,12,12,13,13,15,12,14,13,16,15, 9,10,10, - 13,12,11,11,12,13,13,10,12,10,14,12,13,13,13,15, - 15,12,13,12,15,13,11,12,12,14,14,12,12,13,14,15, - 13,14,13,15,15,14,13,15,13,16,15,16,15,17,16,12, - 13,12,14,14,13,14,14,15,15,12,13,12,15,14,15,15, - 16,16,17,14,15,13,16,13,10,11,12,13,14,11,12,13, - 14,15,12,13,13,15,15,14,14,15,15,17,14,15,15,16, - 16,12,12,13,12,15,12,12,14,13,16,13,13,14,14,16, - 14,14,16,15,17,15,15,16,16,17,12,13,13,15,15,13, - 14,14,16,16,13,14,13,16,15,15,16,16,17,17,14,15, - 15,17,16,14,14,15,14,17,15,15,16,15,17,15,15,16, - 15,17,16,16,17,16,18,17,17,17,17,18,14,15,15,17, - 16,15,16,16,17,17,15,16,15,17,16,17,17,17,18,18, - 16,17,16,18,17,10,12,11,14,14,12,13,13,15,15,12, - 13,12,15,14,14,15,15,16,16,14,15,15,17,16,11,13, - 12,15,14,12,13,13,15,15,13,14,13,16,14,15,15,15, - 16,16,15,16,15,17,16,12,13,13,15,15,13,14,14,16, - 16,12,14,13,16,15,15,16,16,17,17,15,16,15,17,16, - 14,15,15,16,16,14,15,15,16,16,15,16,16,17,16,16, - 16,16,16,17,17,18,17,18,17,14,15,15,17,16,15,16, - 16,17,17,15,16,15,17,16,17,17,18,18,18,16,17,16, - 18,16, 6, 8, 8,11,11, 8, 9, 9,11,12, 8, 9, 9,12, - 11,10,11,12,13,14,10,11,11,14,13, 8, 9, 9,11,12, - 9,10,11,12,13, 9,10,11,13,13,11,12,13,13,15,12, - 12,12,15,14, 7, 9, 9,12,11, 9,10,10,13,13, 9,10, - 10,13,12,11,12,12,14,15,11,12,11,15,13,11,11,12, - 13,14,11,12,13,13,15,12,13,13,14,15,13,14,14,14, - 16,14,15,15,16,16,10,12,11,14,13,12,13,12,14,14, - 11,12,12,15,13,14,15,15,16,16,13,14,13,16,14, 7, - 9, 9,11,12, 9,10,11,12,13, 9,10,10,13,12,11,12, - 13,14,15,11,12,12,14,14, 9,10,10,12,13,10,10,12, - 12,14,11,12,11,13,13,12,12,14,13,15,13,13,13,15, - 15, 9,10,10,12,13,10,11,12,13,14,10,11,10,13,12, - 13,13,14,15,16,12,13,12,15,13,12,13,13,14,14,12, - 12,13,14,15,13,14,14,15,15,14,13,15,13,16,15,16, - 15,17,16,11,12,12,14,14,13,13,14,15,15,12,13,12, - 15,14,15,15,16,16,17,14,14,13,16,13, 7, 9, 9,12, - 11, 9,10,10,12,13, 9,11,10,13,12,11,12,12,14,15, - 11,12,12,15,14, 9,10,11,13,13,10,11,12,13,14,10, - 12,12,14,13,12,13,13,14,16,12,13,13,16,15, 9,11, - 9,13,11,10,12,11,13,13,10,12,10,14,12,12,13,13, - 15,15,12,13,12,16,14,12,12,13,14,15,12,13,14,14, - 15,13,14,14,15,15,14,14,15,15,17,15,16,15,17,16, - 11,13,11,15,13,13,14,13,15,14,12,14,12,16,13,15, - 15,15,16,16,14,15,14,17,14,10,11,12,14,14,12,12, - 13,14,15,12,13,13,15,15,14,15,15,16,17,14,15,15, - 16,16,12,12,13,15,15,13,13,14,15,16,13,14,14,16, - 16,15,15,16,16,17,15,16,16,17,17,11,12,13,14,15, - 13,13,14,15,16,12,13,13,15,15,15,15,16,16,17,15, - 15,15,16,16,14,15,15,16,17,15,15,16,16,17,15,16, - 16,17,17,16,16,17,16,18,17,17,17,18,18,14,15,15, - 16,16,15,16,16,16,17,15,15,15,16,16,17,17,17,18, - 18,16,16,16,17,16,10,12,11,14,13,12,13,13,15,15, - 11,13,12,15,14,14,15,15,16,16,14,15,14,17,15,12, - 13,13,15,15,13,13,14,16,16,13,14,14,16,16,15,15, - 15,16,17,15,16,16,17,17,12,13,12,15,12,13,14,13, - 16,14,12,14,12,16,13,15,16,15,17,16,14,16,14,17, - 15,14,15,15,16,17,15,15,16,17,17,15,16,16,17,17, - 16,16,17,17,18,17,18,17,18,18,14,15,14,17,14,15, - 16,15,17,15,15,16,15,17,15,17,17,17,18,17,16,17, - 16,18,16, 9,11,11,14,14,11,12,12,14,14,11,12,12, - 15,14,13,14,14,16,16,13,15,14,16,16,10,11,12,14, - 14,11,12,13,15,15,12,13,13,15,15,13,14,15,16,17, - 14,15,15,17,16,11,12,12,15,14,12,13,13,15,15,12, - 13,13,15,15,14,15,15,16,16,14,15,15,17,16,12,13, - 14,15,16,13,14,14,15,16,13,14,15,16,16,15,15,16, - 16,18,16,16,16,18,17,14,14,14,16,15,15,15,15,17, - 16,14,15,15,17,16,16,17,17,18,17,16,16,16,18,16, - 10,12,12,14,14,11,12,13,15,15,12,13,13,15,15,13, - 14,15,16,17,14,15,15,17,16,11,12,13,14,15,12,12, - 14,15,16,13,13,14,15,16,14,14,15,16,17,15,15,16, - 17,17,12,13,13,15,15,13,14,14,16,16,13,14,13,16, - 15,15,16,15,17,17,15,16,15,17,16,13,13,15,14,17, - 14,13,16,15,17,15,14,16,15,17,15,15,17,16,18,16, - 16,17,17,18,14,15,15,17,16,15,16,16,17,17,15,16, - 15,17,16,17,17,17,18,18,16,17,16,18,17,10,12,11, - 14,14,11,12,13,15,15,12,13,12,15,15,14,15,15,16, - 16,14,15,15,17,16,11,12,12,15,15,12,13,13,15,15, - 13,14,13,16,15,14,15,15,16,16,15,16,15,17,16,11, - 13,13,15,15,13,14,14,15,15,12,14,13,16,15,15,16, - 15,17,17,15,16,15,17,16,13,15,14,16,16,14,15,14, - 16,16,15,16,15,17,16,15,16,16,16,17,16,17,16,18, - 17,14,15,15,16,16,15,16,16,17,17,15,15,15,17,16, - 17,17,17,18,18,16,16,16,18,16,12,13,13,15,16,13, - 14,14,15,16,13,14,14,16,16,15,15,16,16,18,15,16, - 16,17,17,13,13,14,15,16,14,14,15,15,17,14,15,15, - 16,17,15,15,17,16,18,16,16,17,17,17,13,14,14,16, - 16,14,15,15,17,17,14,15,14,17,16,16,17,16,17,18, - 16,17,16,18,17,15,15,16,14,17,16,15,17,14,18,16, - 16,16,15,18,16,16,18,15,19,18,18,18,17,19,15,16, - 16,18,17,16,17,17,18,17,16,17,16,18,17,18,18,18, - 19,19,17,18,16,18,17,11,12,12,15,15,13,13,14,15, - 16,13,14,13,16,15,15,16,16,16,17,15,16,16,17,16, - 12,14,13,16,15,13,13,14,15,16,14,15,14,17,15,15, - 15,16,16,17,16,17,16,18,17,12,13,14,15,16,14,15, - 15,16,16,13,14,13,16,15,16,16,16,17,17,15,16,15, - 17,15,15,16,15,17,16,15,15,15,16,16,16,17,16,18, - 16,16,15,16,15,17,17,18,17,18,17,15,15,16,17,17, - 16,16,17,17,17,15,16,15,17,16,18,18,18,18,18,16, - 17,16,18,15, 9,11,11,14,14,11,12,12,14,15,10,12, - 12,15,14,13,14,15,16,16,13,14,14,16,16,11,12,12, - 14,15,12,12,13,15,15,12,13,13,15,15,14,15,15,16, - 17,14,15,15,16,16,10,12,12,14,14,12,13,13,15,15, - 11,13,12,15,15,14,15,15,16,17,13,15,14,16,16,14, - 14,14,15,16,14,15,15,16,17,14,15,15,16,17,16,16, - 17,16,18,16,17,17,17,17,12,14,13,16,15,13,15,14, - 16,16,13,14,14,16,15,16,16,16,17,17,15,16,15,17, - 16,10,11,11,14,14,12,12,13,14,15,11,13,12,15,14, - 14,15,15,16,17,14,15,15,16,16,12,13,13,15,15,12, - 13,14,15,16,13,14,14,15,15,15,15,16,16,17,15,15, - 16,17,17,11,12,12,15,15,13,13,14,15,16,12,13,13, - 15,15,15,15,16,16,17,14,15,15,16,16,14,15,15,16, - 16,15,15,15,16,17,15,16,16,17,17,16,16,17,16,18, - 17,17,17,17,18,13,14,15,16,16,15,15,16,16,17,14, - 14,14,16,16,16,16,17,17,18,16,16,16,17,16,10,12, - 12,14,14,12,13,13,15,15,11,13,12,15,15,14,15,15, - 16,17,13,15,14,17,16,12,13,13,15,15,13,13,14,15, - 16,13,14,14,16,16,15,15,16,16,17,15,15,16,17,17, - 11,13,12,15,14,13,14,13,16,15,12,14,12,16,15,15, - 16,15,17,17,14,15,14,17,16,14,15,15,16,17,15,15, - 16,16,17,15,16,16,17,17,16,16,17,17,18,17,17,17, - 18,18,13,15,13,17,14,14,16,14,17,16,14,15,13,17, - 15,16,17,16,18,17,15,17,15,18,16,11,12,12,15,15, - 13,13,14,15,16,13,14,13,16,15,15,16,16,16,17,15, - 16,16,17,16,12,14,13,16,15,13,13,14,15,16,14,15, - 15,16,16,16,15,16,16,17,16,16,16,17,17,12,13,14, - 15,16,14,14,15,15,17,13,14,13,16,15,16,16,17,17, - 18,15,16,15,17,15,15,16,15,17,17,15,15,16,16,17, - 16,17,16,17,17,16,15,17,15,18,17,18,17,18,18,15, - 15,16,16,17,16,16,17,16,18,15,15,15,16,16,17,17, - 18,17,18,16,16,15,17,15,12,13,13,15,15,13,14,14, - 16,16,13,14,14,16,16,15,16,16,17,18,15,16,15,18, - 16,13,14,14,16,16,14,14,15,16,17,14,15,15,17,17, - 16,16,17,17,18,16,16,17,18,17,13,14,13,16,14,14, - 15,15,17,16,14,15,14,17,15,16,17,17,18,17,15,17, - 15,18,16,15,16,16,17,17,16,16,17,17,18,16,17,17, - 18,18,17,16,18,17,19,18,18,18,18,18,15,16,15,17, - 14,16,16,16,18,15,16,17,15,18,14,18,18,18,18,17, - 17,18,16,19,15, -}; - -static const static_codebook _44p5_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p5_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p5_p2_0, - 0 -}; - -static const long _vq_quantlist__44p5_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p3_0[] = { - 1, 5, 6, 5, 7, 8, 5, 8, 7, 5, 7, 8, 7, 8,10, 8, - 10,10, 5, 8, 7, 8,10,10, 7,10, 8, 6, 8, 9, 8,10, - 11, 9,10,10, 9,10,11,10,11,12,11,12,12, 9,11,10, - 11,12,12,10,12,11, 6, 9, 8, 9,10,10, 8,11,10, 9, - 10,11,10,11,12,11,12,12, 9,11,10,11,12,12,10,12, - 11, 6, 9, 9, 8,10,11, 9,11,10, 8,10,10,10,10,12, - 11,12,12, 9,11,10,11,12,12,10,12,11, 8,10,10,10, - 11,12,10,12,11,10,10,12,11,11,13,12,13,13,10,12, - 11,12,13,13,11,13,11, 7,10,10,10,11,12,10,12,11, - 10,12,11,11,11,12,12,14,13,10,12,12,12,14,14,11, - 13,11, 6, 9, 9, 9,10,11, 8,11,10, 9,10,11,10,11, - 12,11,12,12, 8,11,10,11,12,12,10,12,10, 7,10,10, - 10,11,12,10,12,11,10,12,12,11,11,13,12,13,13,10, - 11,12,12,13,14,11,12,11, 8,10,10,10,11,12,10,12, - 11,10,11,12,11,11,13,12,13,13,10,12,10,12,13,13, - 11,13,11, -}; - -static const static_codebook _44p5_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p5_p3_0, - 0 -}; - -static const long _vq_quantlist__44p5_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p3_1[] = { - 5, 6, 6, 6, 7, 7, 6, 7, 7, 6, 7, 7, 7, 7, 8, 7, - 8, 8, 6, 7, 7, 7, 8, 8, 7, 8, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, - 8, 9, 9, 8, 9, 9, 7, 8, 7, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, - 8, 6, 8, 8, 7, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, 9, - 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, 8, 7, 8, 8, 8, - 9, 9, 8, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 8, 9, - 9, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 9, 8, 9, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, 9, 8, - 9, 9, 6, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, - 9, 8, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, 8, 7, 8, 8, - 8, 8, 9, 8, 9, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 8, - 8, 8, 9, 9, 9, 8, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, - 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, 9, - 9, 9, 9, -}; - -static const static_codebook _44p5_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p5_p3_1, - 0 -}; - -static const long _vq_quantlist__44p5_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p4_0[] = { - 1, 5, 5, 5, 7, 9, 5, 9, 7, 5, 7, 8, 7, 7,10, 9, - 10,10, 5, 8, 7, 9,10,10, 7,10, 7, 6, 8, 9, 9,10, - 12, 9,11,11, 9,10,11,11,11,13,12,13,13, 9,11,11, - 11,12,13,11,13,11, 6, 9, 8, 9,11,11, 9,12,10, 9, - 11,11,11,11,13,11,13,12, 9,11,10,12,13,13,11,13, - 11, 6, 9, 9, 8,10,11, 9,12,11, 9,10,11,10,10,12, - 11,13,13, 9,11,11,11,13,12,11,13,11, 8,10,10, 9, - 10,12,10,12,11,10,10,12,10,10,13,12,13,13,10,12, - 11,12,13,13,10,13,10, 7,10,10,11,11,13,11,14,11, - 10,12,11,11,11,13,13,14,13,10,12,12,14,14,14,11, - 14,11, 6, 9, 9, 9,11,12, 8,11,10, 9,11,11,11,11, - 13,11,12,13, 8,11,10,11,13,13,10,12,10, 7,10,10, - 11,11,14,11,13,11,10,12,12,11,11,14,14,14,14,10, - 11,12,13,13,14,11,13,11, 8,10,10,10,11,12, 9,12, - 10,10,11,12,11,10,13,12,13,13,10,12,10,12,13,13, - 11,13,10, -}; - -static const static_codebook _44p5_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p5_p4_0, - 0 -}; - -static const long _vq_quantlist__44p5_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p5_p4_1[] = { - 5, 7, 7,10,10, 7, 8, 9,10,11, 7, 9, 8,11,10, 9, - 10,10,11,11, 9,10,10,11,11, 7, 9, 9,10,10, 8, 9, - 10,10,11, 9,10,10,11,11,10,10,11,11,11,10,11,11, - 12,12, 7, 9, 9,10,10, 9,10,10,11,11, 8,10, 9,11, - 10,10,11,11,11,11,10,11,10,11,11,10,10,10,11,11, - 10,10,11,11,11,11,11,11,11,11,11,11,12,11,12,11, - 12,11,12,12,10,10,10,11,11,10,11,11,11,11,10,11, - 10,11,11,11,12,11,12,12,11,12,11,12,11, 8, 9, 9, - 11,11, 9,10,10,11,12, 9,10,10,11,11,10,11,11,12, - 12,10,11,11,12,12, 9,10,10,11,11,10,10,11,11,12, - 10,11,11,12,12,11,11,12,12,12,11,12,12,12,12, 9, - 10,10,11,11,10,11,11,12,12,10,11,10,12,12,11,12, - 12,12,12,11,12,12,12,12,11,11,11,12,12,11,11,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,11,11,12,12,11,12,12,12,12,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12, 8, 9, 9,11,11, 9, - 10,10,11,11, 9,10,10,11,11,10,11,11,12,12,10,11, - 11,12,12, 9,10,10,11,11,10,10,11,12,12,10,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12, 9,10,10,11, - 11,10,11,11,12,12,10,11,10,12,11,11,12,12,12,12, - 11,12,11,12,12,11,11,11,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11, - 11,12,12,11,12,12,12,12,11,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,10,11,11,12,12,11,12,12,12, - 12,11,12,12,12,12,12,12,13,13,13,12,12,12,13,13, - 11,12,12,12,12,12,12,12,12,13,12,12,12,13,13,12, - 12,13,13,13,12,13,13,13,13,11,12,12,12,12,12,12, - 12,13,13,12,12,12,13,13,12,13,13,13,13,12,13,13, - 13,13,12,12,12,12,13,12,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,12,12,12,13,12, - 13,13,13,13,13,12,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,10,11,11,12,12,11,12,12,12,12,11,12, - 11,12,12,12,12,12,13,12,12,12,12,13,13,11,12,12, - 12,12,12,12,12,13,13,12,12,12,13,13,12,13,13,13, - 13,12,13,13,13,13,11,12,12,12,12,12,12,12,13,13, - 12,12,12,13,12,12,13,13,13,13,12,13,12,13,13,12, - 12,12,12,13,12,13,13,13,13,12,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,12,12,12,13,12,13,13,13, - 13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13, 8, 9, 9,11,11, 9,10,10,11,11, 9,10,10,12,11, - 10,11,11,12,12,10,11,11,12,12, 9,10,10,11,11,10, - 10,11,11,12,10,11,11,12,12,11,11,12,12,12,11,12, - 12,12,12, 9,10,10,11,11,10,11,11,12,12,10,11,10, - 12,12,11,12,12,12,12,11,12,12,12,12,11,11,11,12, - 12,11,11,12,12,12,11,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,11,11,11,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 9,10, - 10,11,11,10,10,11,12,12,10,11,11,12,12,11,11,12, - 12,12,11,12,12,12,12,10,10,11,11,12,11,11,12,12, - 12,11,11,12,12,12,11,11,12,12,13,12,12,12,12,12, - 10,11,11,12,12,11,12,11,12,12,11,12,11,12,12,12, - 12,12,12,12,12,12,12,12,12,11,11,12,12,12,12,12, - 12,12,12,12,12,12,12,13,12,12,13,12,13,12,12,13, - 13,13,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,13,12,12,12,12,13,12, 8,10,10,11,11, - 10,11,11,12,12,10,11,10,12,12,11,12,12,12,12,11, - 12,12,12,12,10,11,10,12,12,10,10,11,12,12,11,12, - 12,12,12,12,12,12,12,13,12,12,12,13,13,10,11,11, - 12,12,11,12,12,12,12,10,12,11,12,12,12,12,12,13, - 13,12,13,12,13,12,11,12,12,12,12,11,12,12,12,13, - 12,12,12,13,13,12,12,13,12,13,12,13,13,13,13,11, - 12,12,12,12,12,12,12,13,13,12,12,12,13,12,12,13, - 13,13,13,12,13,12,13,12,11,11,11,12,12,11,12,12, - 12,13,11,12,12,12,12,12,12,12,13,13,12,12,13,13, - 13,11,12,12,12,12,12,12,12,12,13,12,12,13,13,13, - 12,12,13,13,13,13,13,13,13,13,11,12,12,12,12,12, - 13,12,13,13,12,12,12,13,13,12,13,13,13,13,12,13, - 13,13,13,12,12,12,12,13,12,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,12,12,12,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,10,11,11,12,12,11,12,12,12,13,11, - 12,12,13,12,12,13,13,13,13,12,13,13,13,13,11,12, - 12,12,12,12,12,12,13,13,12,13,12,13,13,13,13,13, - 13,13,13,13,13,13,13,11,12,12,13,12,12,13,12,13, - 13,12,13,12,13,13,13,13,13,13,13,13,13,13,13,13, - 12,13,13,13,13,12,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, 8, 9, 9,11,11, 9,10,10,11,12, 9,10,10,11, - 11,10,11,11,12,12,10,11,11,12,12, 9,10,10,11,11, - 10,10,11,12,12,10,11,11,12,12,11,11,12,12,12,11, - 12,12,12,12, 9,10,10,11,11,10,11,11,12,12,10,11, - 10,12,12,11,12,12,12,12,11,12,11,12,12,11,11,11, - 12,12,11,11,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,11,11,11,12,12,11,12,12,12,12, - 11,12,11,12,12,12,12,12,12,12,12,12,12,12,12, 8, - 10,10,11,11,10,10,11,12,12,10,11,11,12,12,11,12, - 12,12,12,11,12,12,12,12,10,11,11,12,12,10,11,12, - 12,12,11,12,12,12,12,12,12,12,12,13,12,12,12,13, - 13,10,10,11,12,12,11,12,12,12,12,10,11,10,12,12, - 12,12,12,13,13,12,12,12,13,12,11,12,12,12,12,11, - 12,12,12,13,12,12,12,13,13,12,12,13,12,13,12,13, - 13,13,13,11,12,12,12,12,12,12,12,13,13,11,12,12, - 13,12,12,13,13,13,13,12,13,12,13,12, 9,10,10,11, - 11,10,11,11,12,12,10,11,11,12,12,11,12,12,12,12, - 11,12,11,12,12,10,11,11,12,12,11,11,12,12,12,11, - 11,12,12,12,12,12,12,12,13,12,12,12,13,12,10,11, - 10,12,11,11,12,11,12,12,11,12,11,12,12,12,12,12, - 12,12,12,12,11,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,13,12,13,12,13,13,13,13, - 11,12,11,12,12,12,12,12,13,12,12,12,12,12,12,12, - 13,12,13,13,12,12,12,13,12,10,11,11,12,12,11,12, - 12,12,13,11,12,12,13,12,12,12,13,13,13,12,13,13, - 13,13,11,12,12,12,13,12,12,13,13,13,12,12,13,13, - 13,13,13,13,13,13,13,13,13,13,13,11,12,12,12,12, - 12,12,13,13,13,12,13,12,13,13,13,13,13,13,13,13, - 13,13,13,13,12,13,13,13,13,12,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,13, - 13,13,13,13,13,13,13,12,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,11,11,11,12,12,11,12,12,12,12, - 11,12,12,12,12,12,12,13,13,13,12,13,12,13,13,11, - 12,12,12,12,12,12,13,13,13,12,12,13,13,13,12,13, - 13,13,13,12,13,13,13,13,11,12,12,12,12,12,13,12, - 13,13,12,12,12,13,12,13,13,13,13,13,12,13,12,13, - 13,12,12,12,13,13,12,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,12,12,12,13,12,13, - 13,13,13,13,12,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,10,11,11,12,12,11,12,12,12,12,11,12,12, - 12,12,12,12,12,13,13,12,12,12,13,13,11,12,12,12, - 12,11,12,12,13,13,12,12,12,13,13,12,12,13,13,13, - 12,13,13,13,13,11,12,12,12,12,12,12,12,13,13,12, - 12,12,13,12,12,13,13,13,13,12,13,12,13,13,12,12, - 12,12,12,12,12,13,13,13,12,13,13,13,13,12,13,13, - 13,13,13,13,13,13,13,12,12,12,13,12,12,13,13,13, - 13,12,13,12,13,13,13,13,13,13,13,13,13,13,13,13, - 10,11,11,12,12,11,12,12,12,13,11,12,12,13,12,12, - 12,12,13,13,12,12,12,13,13,11,12,12,12,12,12,12, - 13,13,13,12,12,12,13,13,12,12,13,13,13,12,13,13, - 13,13,11,12,12,12,12,12,12,12,13,13,12,12,12,13, - 13,12,13,13,13,13,12,13,13,13,13,12,12,12,12,13, - 12,12,13,13,13,12,13,13,13,13,12,13,13,13,13,13, - 13,13,13,13,12,12,12,13,13,13,13,13,13,13,12,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,10,11,11, - 12,12,11,12,12,12,13,11,12,12,13,12,12,13,13,13, - 13,12,13,12,13,13,11,12,12,13,13,12,12,12,13,13, - 12,12,13,13,13,12,13,13,13,13,13,13,13,13,13,11, - 12,12,13,12,12,13,12,13,13,12,13,12,13,13,13,13, - 13,13,13,12,13,13,13,13,12,12,12,13,13,12,13,13, - 13,13,12,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,12,12,12,13,13,12,13,13,13,13,12,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,11,11,11,12,12,11, - 12,12,12,12,11,12,12,12,12,12,12,12,13,13,12,12, - 12,13,13,11,12,12,12,12,12,12,12,12,13,12,12,12, - 13,13,12,12,13,13,13,12,13,13,13,13,11,12,12,12, - 12,12,12,12,13,13,12,12,12,13,12,12,13,13,13,13, - 12,13,12,13,13,12,12,12,12,12,12,12,13,12,13,12, - 13,13,13,13,12,13,13,12,13,13,13,13,13,13,12,12, - 12,12,12,12,13,13,13,13,12,13,12,13,13,13,13,13, - 13,13,12,13,13,13,12,10,11,11,12,12,11,12,12,12, - 12,11,12,12,12,12,12,12,12,13,13,12,13,12,13,13, - 11,12,12,12,12,12,12,12,13,13,12,12,12,13,13,12, - 12,13,13,13,13,13,13,13,13,11,12,12,12,12,12,13, - 12,13,13,12,13,12,13,13,12,13,13,13,13,12,13,12, - 13,13,12,12,12,12,12,12,13,13,13,13,12,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,12,12,12,13,12, - 12,13,13,13,13,12,13,12,13,13,13,13,13,13,13,13, - 13,13,13,13,10,11,11,12,12,11,12,12,12,12,11,12, - 12,12,12,12,12,12,13,13,12,12,12,13,13,11,12,12, - 12,12,12,12,12,13,13,12,12,12,13,13,12,12,13,13, - 13,12,12,13,13,13,11,12,11,12,12,12,12,12,13,13, - 11,12,12,13,13,12,13,13,13,13,12,13,12,13,13,12, - 12,12,12,12,12,13,13,13,13,12,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,12,12,12,13,12,12,13,13, - 13,13,12,13,12,13,13,13,13,13,13,13,12,13,13,13, - 13,10,11,11,12,12,11,12,12,12,13,11,12,12,13,12, - 12,12,13,13,13,12,13,13,13,13,11,12,12,13,13,12, - 12,13,13,13,12,12,13,13,13,12,13,13,13,13,13,13, - 13,13,13,11,12,12,13,12,12,13,12,13,13,12,12,12, - 13,13,12,13,13,13,13,13,13,13,13,13,12,12,13,13, - 13,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,12,12,12,13,13,13,13,13,13,13,12, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,10,12, - 11,12,12,11,12,12,12,13,11,12,12,12,12,12,12,12, - 13,13,12,12,12,13,13,11,12,12,12,13,12,12,12,13, - 13,12,12,12,13,13,12,13,13,13,13,12,13,13,13,13, - 11,12,12,13,12,12,12,12,13,13,12,12,12,13,13,12, - 13,13,13,13,12,13,12,13,13,12,13,12,13,13,12,13, - 13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,12,12,12,13,12,13,13,13,13,13,12,13,12,13, - 13,13,13,13,13,13,12,13,13,13,13,10,11,11,12,12, - 11,12,12,12,13,11,12,12,12,12,12,12,12,13,13,12, - 12,12,13,13,11,12,12,12,12,12,12,13,13,13,12,13, - 13,13,13,12,12,13,13,13,13,13,13,13,13,11,12,12, - 12,12,12,13,12,13,13,12,12,12,13,13,12,13,13,13, - 13,12,13,12,13,13,12,12,12,12,13,12,13,13,13,13, - 12,13,13,13,13,12,13,13,13,13,13,13,13,13,13,12, - 12,12,12,12,12,13,13,13,13,12,13,13,13,13,13,13, - 13,13,13,12,13,13,13,13,11,12,11,12,12,11,12,12, - 12,12,11,12,12,12,12,12,12,12,12,13,12,12,12,13, - 12,11,12,12,12,12,12,12,12,12,13,12,12,12,13,13, - 12,12,13,13,13,12,13,13,13,13,11,12,12,12,12,12, - 12,12,13,13,12,12,12,13,12,12,13,13,13,13,12,13, - 12,13,13,12,12,12,12,12,12,12,13,13,13,12,13,13, - 13,13,13,13,13,12,13,13,13,13,13,13,12,12,12,12, - 12,12,13,13,13,13,12,13,12,13,12,13,13,13,13,13, - 13,13,13,13,12, -}; - -static const static_codebook _44p5_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p5_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p5_p4_1, - 0 -}; - -static const long _vq_quantlist__44p5_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p5_p5_0[] = { - 1, 6, 6,10,10, 6, 7, 9,11,13, 5, 9, 7,13,11, 8, - 11,12,13,15, 8,12,11,15,13, 6, 7, 8,11,11, 7, 8, - 10,11,13, 9,10,10,13,13,11,11,13,12,16,12,13,13, - 16,15, 6, 8, 7,11,11, 9,10,10,13,13, 7,10, 7,13, - 11,12,13,13,15,16,11,13,11,16,12,10,11,11,11,13, - 11,11,13,12,15,13,13,13,14,15,13,12,15,12,17,15, - 16,16,16,16,10,11,11,14,11,13,13,13,15,14,11,13, - 11,15,12,15,15,16,16,16,13,15,12,17,12, 6, 8, 9, - 12,12, 9,10,12,13,15, 9,11,11,15,14,12,13,15,16, - 18,13,14,14,17,16, 9,10,11,13,14,11,10,13,14,16, - 11,12,12,15,15,14,13,16,15,18,14,15,15,17,17, 9, - 11,11,14,14,11,12,13,15,16,11,13,11,15,14,15,15, - 15,17,18,14,15,14,17,15,13,14,14,15,16,14,14,15, - 15,17,15,16,15,17,17,16,16,17,15,19,17,18,18,19, - 18,13,14,14,16,15,15,15,16,17,17,14,15,14,18,15, - 17,17,17,19,19,16,17,15,19,16, 6, 9, 8,13,12, 9, - 11,11,14,15, 9,12,10,15,13,13,14,14,16,17,12,15, - 13,18,16, 9,11,11,14,14,11,11,13,14,15,11,13,12, - 16,15,14,14,15,15,18,14,15,15,18,17, 9,11,10,14, - 13,11,12,12,15,15,11,13,10,16,14,14,15,15,16,18, - 14,16,13,18,15,13,14,14,16,16,14,14,15,15,17,15, - 16,15,17,17,16,16,17,16,19,17,18,17,18,19,13,14, - 14,16,15,15,15,15,17,17,14,15,14,17,15,17,17,17, - 18,19,16,17,15,19,15,11,13,13,15,16,13,14,15,16, - 18,14,15,15,17,17,16,16,18,18,20,17,18,17,19,20, - 13,14,14,16,17,15,15,16,17,18,15,16,16,17,17,18, - 17,19,18,19,18,18,18,19,21,14,14,15,16,17,15,15, - 16,18,18,15,16,16,17,18,18,18,19,19,21,18,19,19, - 22,20,16,16,17,17,19,17,17,17,18,20,17,18,18,20, - 19,19,19,20,19, 0,19,19,20,20,21,17,17,17,19,18, - 18,18,20,19,19,18,18,18,20,20,19,19,20,20,20,20, - 21,20,21,19,11,13,13,16,15,14,15,15,17,17,14,15, - 14,18,16,16,18,18,20,19,16,19,17,21,18,13,14,15, - 16,17,15,15,16,18,18,15,16,15,19,18,18,18,18,19, - 19,18,18,18,22,20,13,14,14,16,16,15,16,16,18,17, - 15,16,15,18,17,18,18,18,19,19,17,18,17,21,18,16, - 17,17,18,18,17,18,19,19,19,18,20,18,19,19,19,20, - 21,19,21,20,20,20, 0,21,16,17,17,19,19,18,18,18, - 19,21,17,18,18,19,18,20,19,21,20,21,19,20,20,22, - 19, 7, 9, 9,13,13, 8,10,11,14,15, 9,12,11,15,14, - 11,13,14,16,17,13,15,14,17,16, 8,10,11,14,14,10, - 10,12,14,16,11,12,12,16,15,13,12,15,15,18,14,15, - 15,19,17, 9,11,11,14,14,11,12,12,15,15,11,13,11, - 16,14,14,15,14,17,17,14,16,14,18,15,12,13,14,15, - 16,13,13,15,14,17,15,15,15,17,17,15,14,17,14,19, - 17,18,18,19,18,13,14,14,16,16,15,15,15,17,17,14, - 15,14,18,15,17,18,17,18,17,16,18,16,19,15, 7,10, - 10,13,13, 9,10,12,14,15,10,12,11,15,14,12,13,14, - 16,17,13,15,14,18,16,10,10,12,13,14,10,10,13,13, - 16,12,12,13,15,15,13,12,15,15,18,15,15,16,18,17, - 10,11,11,14,14,12,13,13,15,16,10,13,10,16,14,14, - 15,15,17,17,14,15,13,17,15,13,13,14,15,16,14,13, - 15,14,18,15,15,16,16,17,16,15,18,15,18,17,18,18, - 18,18,13,15,14,17,16,15,16,16,17,17,14,15,13,17, - 15,17,17,18,18,18,16,17,14,20,14, 8,10,10,14,14, - 11,11,13,14,16,11,13,11,16,14,14,15,16,16,18,14, - 16,15,18,16,10,12,11,15,14,11,11,13,14,16,13,14, - 13,16,15,15,14,16,15,19,16,17,16,20,18,10,11,12, - 14,15,13,13,14,16,16,11,14,11,16,14,16,16,17,18, - 19,15,17,14,20,15,14,15,14,17,16,13,14,15,15,18, - 16,17,16,19,18,16,15,18,15,19,18,19,18,21,21,14, - 14,15,16,17,16,16,17,18,18,13,15,14,17,15,18,18, - 19,18,22,16,18,15,21,15,12,13,14,16,16,14,14,16, - 16,18,14,15,15,17,18,16,16,18,18,20,18,18,17,20, - 20,13,14,15,15,17,15,14,16,16,18,16,16,16,17,19, - 17,15,18,17,21,18,18,18,19,19,14,15,15,18,17,15, - 16,16,18,19,15,16,15,18,18,17,18,18,20,21,17,19, - 17,20,19,16,16,17,16,19,17,17,18,17,20,18,18,18, - 18,19,19,18,20,17,22,20,20,19,20,20,17,17,18,18, - 19,18,18,20,21,20,17,18,17,20,20,21,21,21,21,21, - 19,21,18,22,20,11,13,13,17,16,14,14,16,16,18,14, - 16,14,18,16,17,18,19,19,20,18,19,18,21,19,14,15, - 14,17,16,14,14,16,18,18,16,17,16,18,17,18,17,19, - 18,20,19,19,18,20,20,13,14,15,16,17,16,16,17,18, - 19,14,16,14,19,17,18,19,18,20,20,18,20,17,21,18, - 17,17,17,19,18,16,17,18,18,19,18,19,18,21,21,18, - 18,20,17,21,19,20,20,22,21,16,17,18,18,19,18,18, - 19,21,20,16,17,17,20,18,21,21,22,21,22,18,21,18, - 0,18, 7, 9, 9,13,13, 9,11,12,14,15, 8,11,10,15, - 14,13,14,15,16,18,11,14,13,17,15, 9,11,11,14,14, - 11,11,13,14,16,11,12,12,15,15,14,14,16,15,18,14, - 14,15,17,17, 8,11,10,14,14,11,12,12,15,15,10,12, - 10,16,14,14,15,15,17,18,13,15,12,18,15,13,14,14, - 16,16,14,14,15,15,17,15,15,15,16,17,16,15,17,15, - 19,17,17,17,18,18,12,14,13,16,15,15,15,15,17,17, - 13,15,13,17,14,17,18,18,18,19,15,17,14,19,14, 8, - 10,10,14,14,11,11,13,14,16,11,13,11,16,14,14,15, - 16,17,19,14,16,15,18,17,10,12,11,15,14,11,11,14, - 14,17,13,14,13,17,15,15,14,17,15,19,16,17,16,19, - 17,10,11,12,14,15,13,13,14,15,17,11,13,11,17,14, - 16,16,17,18,19,15,16,14,18,15,14,15,14,16,16,13, - 14,15,15,18,16,16,16,18,18,16,15,18,15,20,18,19, - 18,21,18,14,14,15,16,17,16,16,17,17,18,13,15,14, - 17,16,19,19,19,19,19,15,18,15,20,15, 7,10,10,13, - 13,10,11,12,14,15, 9,12,10,15,14,13,14,15,16,17, - 12,15,13,17,16,10,11,11,14,14,10,10,13,14,16,12, - 13,13,16,15,14,13,16,15,18,15,15,16,17,17,10,12, - 10,14,13,12,13,12,15,15,10,13,10,16,13,15,16,15, - 17,18,13,16,12,18,15,13,14,14,16,17,14,13,15,15, - 18,15,16,15,17,17,16,14,17,15,19,17,18,18,19,19, - 13,15,13,17,14,15,15,15,18,17,14,15,13,17,14,18, - 17,18,18,19,15,17,15,19,15,11,13,13,16,17,14,14, - 16,16,18,14,16,15,18,17,17,18,19,18,21,18,18,17, - 20,18,13,15,14,17,16,14,14,16,17,18,16,17,16,19, - 17,18,17,19,18,22,18,19,19,21,21,13,14,15,16,18, - 16,16,17,17,20,14,16,14,18,17,18,18,19,19,21,17, - 18,17,21,18,17,18,17,19,18,16,17,17,18,19,18,18, - 18,22,22,18,17,19,17, 0,20,21,19,21,20,17,17,18, - 18,21,18,18,18,19,21,17,17,17,19,19,20,20,22,21, - 21,19,20,18,20,17,12,14,13,17,16,14,15,15,17,18, - 14,16,14,18,16,17,18,18,21,20,16,18,16,21,18,14, - 15,15,17,17,15,15,16,18,18,15,17,16,18,18,17,17, - 19,19,20,18,19,18,20,19,14,15,14,17,15,15,16,16, - 18,17,15,16,14,19,15,18,18,18,19,20,17,20,15,21, - 17,16,17,18,18,19,17,17,18,18,20,18,19,18,19,21, - 19,18,19,19,21,20, 0,19,21,20,16,17,16,19,16,18, - 18,18,19,19,17,18,17,20,17,19,20,20,22, 0,19,20, - 17,21,17,11,13,14,16,17,14,15,15,17,18,14,15,15, - 18,18,16,17,17,19,20,16,18,17,19,21,13,14,15,17, - 17,14,15,16,17,19,15,16,16,18,19,16,17,18,19,21, - 17,18,20,21,21,13,15,15,17,17,15,16,16,18,19,15, - 16,16,18,19,17,17,18,19,22,17,19,18,22,19,15,16, - 17,19,19,16,17,18,18,20,17,18,18,19,20,19,18,20, - 18,22,20,19,19,22,21,16,17,17,18,19,18,18,18,19, - 20,17,18,18,20,19,20,19,20,22,20,19,20,21,21,20, - 12,14,14,16,16,13,14,16,17,18,14,16,15,18,18,15, - 17,17,19,19,17,18,18,19,19,13,14,15,16,17,14,14, - 16,16,20,15,16,16,17,19,16,15,18,17,20,18,17,19, - 19,19,14,15,15,17,17,16,16,16,18,18,15,16,15,19, - 18,17,18,18,20,21,17,18,17,21,18,16,15,17,17,19, - 17,15,18,17,20,19,17,18,19,20,18,16,19,17,22,20, - 19,20,19,20,17,17,18,19,19,18,18,19,20,20,17,18, - 17,18,18,21,21,20,20,21,18,20,17,21,19,11,14,14, - 16,17,15,14,16,17,19,14,16,14,18,17,18,18,19,19, - 21,17,19,18,20,20,13,15,14,17,17,14,14,16,17,18, - 16,17,16,19,18,18,17,19,18,20,18,21,18,20,20,13, - 15,15,16,17,16,16,17,18,19,14,16,15,19,18,19,19, - 19,21,20,18,19,17,20,18,16,17,16,19,18,16,17,17, - 19,20,17,19,18,20,19,18,17,21,18, 0,21,20,20, 0, - 20,17,17,18,18,19,18,19,19,20,22,16,17,17,20,18, - 21,22,20,20,22,18,22,18,22,18,12,14,14,17,17,14, - 15,16,17,19,14,16,15,17,17,17,17,18,18,21,17,19, - 17,20,19,14,15,15,16,18,15,14,16,16,19,16,17,16, - 19,18,17,16,20,17,20,18,20,19,19,20,14,15,15,18, - 17,16,16,17,18,19,14,16,15,19,17,18,21,18,19,21, - 17,18,17,19,18,17,17,18,17,20,17,16,18,17,21,18, - 19,19,19,19,18,17,19,17,20,20,21,20,21,20,17,17, - 17,19,19,19,18,18,20,21,16,18,16,19,18,20,20,21, - 21,20,18,19,16, 0,17,12,14,14,17,17,15,15,18,17, - 19,15,18,15,20,16,20,19,21,18,22,20,20,20,22,19, - 14,16,14,20,17,14,15,17,17,20,18,18,17,20,18,18, - 17,19,17,21,20,21,20, 0,21,14,15,16,17,19,18,17, - 19,18,21,14,18,15,21,17,21,20,21,20, 0,18,21,17, - 21,17,18,19,17,20,18,16,17,17,19,19,19,21,20, 0, - 20,18,17,21,17, 0,22, 0,21, 0,22,17,17,19,18,20, - 20,20,21,19,22,16,17,18,20,18,22,22, 0,22, 0,17, - 21,17,22,17,11,14,13,16,16,14,15,15,17,18,14,15, - 14,18,17,17,18,18,19,20,16,17,17,21,19,13,14,15, - 17,17,15,16,16,18,18,15,16,16,19,18,18,18,18,19, - 20,17,18,18,20,19,13,15,14,17,17,15,16,16,17,18, - 14,16,15,19,17,17,18,19,21,21,17,18,17,20,18,16, - 17,17,19,19,17,18,19,19,20,18,19,18,21,21,21,20, - 19,21,22,20,20,19,21,20,15,17,16,19,19,17,18,18, - 20,21,16,18,17,20,18,19,19,21,21,21,19,19,19,20, - 18,11,14,13,17,16,14,14,16,16,19,14,16,15,19,16, - 18,18,18,19,22,17,18,17,20,19,13,15,14,17,17,15, - 15,16,17,19,16,17,16,20,18,18,17,19,18,21,19,19, - 18,22, 0,13,14,15,17,18,16,16,17,17,19,14,16,15, - 19,18,18,19,19,20,21,18,18,17,20,18,17,18,17,20, - 18,16,17,17,18,20,18,19,18,20,20,18,18,21,17,21, - 20,21,21, 0,19,16,16,18,18,19,19,18,20,19,20,16, - 17,17,20,18,21,20,21,22,22,18,20,17,21,17,12,14, - 14,17,16,14,15,16,18,18,13,15,14,18,17,17,18,18, - 19,19,15,17,16,19,19,14,15,15,17,17,15,15,16,18, - 19,15,16,16,19,18,17,17,18,18,20,18,18,18,21,20, - 13,15,14,17,16,15,16,15,18,18,14,16,14,18,17,18, - 18,18,19,21,16,18,16,20,17,17,18,17,18,19,17,17, - 18,18,19,18,19,19,21,19,19,18,20,18,21,21,20,20, - 21,20,16,17,15,20,17,17,19,17,19,19,17,18,15,20, - 17,19,20,19,21,22,17,20,16, 0,17,12,14,14,17,18, - 16,15,18,16,20,16,18,15,21,17,20,18,21,19,22,19, - 21,19, 0,19,14,16,15,19,17,14,15,17,16,21,18,19, - 18,21,17,19,17,21,17,22,20,21,21, 0,21,14,15,16, - 17,19,18,17,19,18,21,14,17,15,20,17,21,22,21,20, - 22,18,21,17,21,17,17,19,17,21,18,16,17,17,19,20, - 19,21,20,21,20,17,18,20,17,21, 0,22,20,21,22,17, - 17,20,18,21,21,20,22,20,21,16,17,17,21,19, 0,22, - 0,21,21,18,22,17,21,17,12,14,14,17,16,14,15,16, - 17,18,14,16,15,18,17,17,17,20,19,20,16,18,17,21, - 18,14,15,15,17,17,14,15,16,17,19,16,17,16,18,18, - 17,16,19,18,19,18,19,18,21,20,14,15,15,18,17,16, - 16,16,19,18,15,16,14,20,16,18,18,19,19,20,16,19, - 16,21,17,17,17,18,19,19,16,16,18,18,19,19,19,18, - 20,20,18,16,19,18,20,22,21,20,19,20,16,18,17,20, - 16,18,19,18,19,18,16,18,16,20,17,21,20,21,20,20, - 18,19,17,21,16, -}; - -static const static_codebook _44p5_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p5_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p5_p5_0, - 0 -}; - -static const long _vq_quantlist__44p5_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p5_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p5_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p5_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p5_p5_1, - 0 -}; - -static const long _vq_quantlist__44p5_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p6_0[] = { - 1, 5, 5, 5, 7, 9, 5, 9, 7, 5, 7, 8, 7, 7,10, 9, - 9,10, 5, 8, 7, 9,10, 9, 7,10, 7, 6, 9, 9, 9,10, - 12,10,12,11, 9,10,11,11,10,13,12,12,13,10,11,11, - 12,13,13,11,13,11, 6, 9, 9,10,11,12, 9,12,11,10, - 11,11,11,11,13,12,13,13, 9,11,10,12,13,13,11,13, - 10, 6, 9,10, 9,11,12,10,12,11, 9,10,11,10,10,13, - 11,13,13,10,11,11,12,13,12,11,13,11, 7, 9,10, 9, - 10,12,10,11,11,10,10,11,10,10,12,12,11,12,10,11, - 10,12,12,12,10,12,10, 7,10,10,11,11,13,11,13,11, - 10,12,11,11,10,13,13,14,13,10,11,12,13,13,14,11, - 13,10, 6,10, 9,10,11,12, 9,12,11, 9,11,11,11,11, - 13,12,12,13, 9,11,10,12,13,13,10,13,10, 7,10,10, - 11,11,14,11,13,11,10,12,11,11,10,14,13,14,13,10, - 11,12,13,13,14,11,13,10, 7,10, 9,10,10,12, 9,12, - 10,10,11,11,10,10,12,12,12,12, 9,11,10,11,12,12, - 10,12, 9, -}; - -static const static_codebook _44p5_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p5_p6_0, - 0 -}; - -static const long _vq_quantlist__44p5_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p6_1[] = { - 2, 6, 6, 5, 7, 8, 5, 8, 7, 6, 7, 7, 7, 7, 8, 8, - 8, 8, 6, 7, 7, 7, 8, 8, 7, 8, 7, 6, 8, 8, 8, 9, - 10, 8, 9, 9, 8, 9, 9, 9, 9,10,10,10,10, 8, 9, 9, - 10,10,10, 9,10,10, 6, 8, 8, 8, 9, 9, 8,10, 9, 9, - 9, 9, 9, 9,10,10,10,10, 8, 9, 9,10,10,10, 9,10, - 9, 6, 8, 9, 8, 9, 9, 8, 9, 9, 8, 9, 9, 9, 9,10, - 9,10,10, 8, 9, 9, 9,10,10, 9,10, 9, 7, 8, 9, 8, - 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, - 9, 9, 9, 9, 9, 9, 9, 7, 9, 9, 9,10,10, 9,10,10, - 9,10, 9, 9, 9,10,10,10,10, 9,10, 9,10,10,10, 9, - 10, 9, 6, 8, 8, 8, 9, 9, 8, 9, 9, 8, 9, 9, 9, 9, - 10, 9,10,10, 8, 9, 9, 9,10,10, 9,10, 9, 7, 9, 9, - 9,10,10, 9,10, 9, 9, 9,10,10, 9,10,10,10,10, 9, - 9, 9,10,10,10, 9,10, 9, 7, 9, 8, 8, 9, 9, 8, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, 9, - 9, 9, 9, -}; - -static const static_codebook _44p5_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p5_p6_1, - 0 -}; - -static const long _vq_quantlist__44p5_p7_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p7_0[] = { - 1, 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p5_p7_0 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p7_0, - 1, -513979392, 1633504256, 2, 0, - (long *)_vq_quantlist__44p5_p7_0, - 0 -}; - -static const long _vq_quantlist__44p5_p7_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p5_p7_1[] = { - 1, 7, 7, 6, 9, 9, 7, 9, 9, 6, 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, 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, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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, -}; - -static const static_codebook _44p5_p7_1 = { - 5, 243, - (long *)_vq_lengthlist__44p5_p7_1, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p5_p7_1, - 0 -}; - -static const long _vq_quantlist__44p5_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p5_p7_2[] = { - 1, 2, 3, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, - 11,12,12,13,13,14,14,14,14, -}; - -static const static_codebook _44p5_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p5_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p5_p7_2, - 0 -}; - -static const long _vq_quantlist__44p5_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p5_p7_3[] = { - 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p5_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p5_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p5_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p5_short[] = { - 4, 7,12,14,15,18,20,20, 5, 3, 4, 6, 9,11,15,19, - 9, 4, 3, 4, 7, 9,13,18,11, 6, 3, 3, 5, 8,13,19, - 14, 9, 6, 5, 7,10,16,20,16,11, 9, 8,10,10,14,16, - 21,14,13,11, 8, 7,11,14,21,14,13, 9, 6, 5,10,12, -}; - -static const static_codebook _huff_book__44p5_short = { - 2, 64, - (long *)_huff_lengthlist__44p5_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p6_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p6_l0_0[] = { - 1, 4, 4, 7, 7,10,10,12,12,12,12,13,12, 5, 5, 5, - 8, 6,11, 9,12,12,13,12,12,12, 4, 5, 5, 6, 8, 9, - 11,12,12,13,12,12,12, 7, 7, 8, 9, 9,11, 8,12, 9, - 12,12,12,12, 7, 8, 8, 9, 9, 8,11, 9,12,12,12,11, - 12,10,10,10,11,11,11,11,11,10,11,11,12,11,10,10, - 10,11,11,11,11,10,11,11,11,11,12,11,11,11,12,11, - 12,11,12,11,13,11,13,11,11,11,11,11,12,11,12,10, - 13,11,12,11,13,12,12,12,13,12,13,13,13,12,14,12, - 14,13,12,12,12,12,13,13,13,12,14,12,14,13,14,13, - 14,14,14,14,14,14,14,14,15,14,15,14,13,14,13,14, - 14,14,14,14,15,14,14,14,15, -}; - -static const static_codebook _44p6_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p6_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p6_l0_0, - 0 -}; - -static const long _vq_quantlist__44p6_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p6_l0_1[] = { - 4, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, - 5, 5, 4, 5, 5, 5, 5, 5, 4, -}; - -static const static_codebook _44p6_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p6_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p6_l0_1, - 0 -}; - -static const long _vq_quantlist__44p6_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_l1_0[] = { - 1, 3, 2, 5, 5, 6, 6, 6, 6, -}; - -static const static_codebook _44p6_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44p6_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p6_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p6_lfe[] = { - 2, 3, 1, 3, -}; - -static const static_codebook _huff_book__44p6_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p6_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p6_long[] = { - 2, 7,13,15,16,17,19,20, 6, 3, 4, 7, 9,10,12,15, - 13, 4, 3, 4, 7, 8,11,13,14, 7, 4, 4, 6, 7,10,11, - 16, 9, 7, 6, 7, 8, 9,10,16, 9, 8, 7, 7, 6, 8, 8, - 18,12,10,10, 9, 8, 8, 9,20,14,13,12,11, 8, 9, 9, -}; - -static const static_codebook _huff_book__44p6_long = { - 2, 64, - (long *)_huff_lengthlist__44p6_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p6_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p1_0[] = { - 2, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 8, 5, 7, 8, 8, 9, - 10, 8, 9, 9, 8, 9,10, 9,10,12,10,11,11, 8, 9,10, - 10,11,11, 9,11,11, 5, 8, 7, 8, 9, 9, 8,10, 9, 8, - 10, 9, 9,11,11,10,11,11, 8,10, 9,10,11,11, 9,12, - 10, 5, 8, 8, 7, 9,10, 8,10, 9, 7, 9, 9, 9,10,11, - 9,11,11, 8,10,10,10,11,11,10,12,11, 7, 9, 9, 9, - 10,11, 9,11,11, 9, 9,11,10,10,13,11,11,12, 9,11, - 11,11,12,13,11,13,12, 7, 9, 9, 9,11,11, 9,12,10, - 9,11,10,10,11,12,11,13,12, 9,11,11,11,13,13,11, - 13,11, 5, 8, 8, 8, 9,10, 7,10, 9, 8,10,10,10,11, - 11,10,11,11, 7, 9, 9, 9,11,11, 9,11,10, 7, 9, 9, - 9,10,12, 9,11,11, 9,11,11,11,11,13,11,13,13, 9, - 10,11,11,12,13,10,12,11, 7, 9, 9, 9,11,11, 9,11, - 10, 9,11,11,11,12,13,11,13,12, 9,11, 9,11,12,11, - 10,13,10, -}; - -static const static_codebook _44p6_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p6_p1_0, - 0 -}; - -static const long _vq_quantlist__44p6_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p6_p2_0[] = { - 4, 6, 6, 9, 9, 6, 7, 8,10,10, 6, 8, 7,10,10, 8, - 10,10,12,13, 8,10,10,13,12, 6, 8, 8,10,10, 7, 8, - 9,10,11, 8, 9, 9,11,11,10,10,11,12,13,10,11,11, - 14,13, 6, 8, 8,10,10, 8, 9, 9,11,11, 7, 9, 8,11, - 10,10,11,11,13,14,10,11,10,13,12, 9,10,10,12,12, - 10,10,11,12,13,10,11,11,13,13,12,12,13,12,15,13, - 14,13,15,14, 9,10,10,13,12,10,11,11,13,13,10,11, - 10,13,12,13,13,14,14,15,12,13,12,15,12, 6, 8, 8, - 10,11, 8, 9,10,11,12, 8, 9, 9,11,11,10,11,12,13, - 14,10,11,11,14,13, 8, 9, 9,11,12, 9,10,11,12,13, - 9,10,11,12,13,11,11,13,13,15,11,12,12,14,14, 8, - 9, 9,12,12, 9,10,11,12,13, 9,10,10,13,12,11,12, - 13,14,15,11,12,12,14,14,11,11,12,13,14,11,12,13, - 13,15,12,13,13,14,15,13,13,14,14,16,14,15,15,16, - 16,11,12,11,14,13,12,13,13,14,14,11,13,12,14,13, - 14,15,15,16,16,13,14,14,16,14, 6, 8, 8,11,10, 8, - 9, 9,12,11, 8,10, 9,12,11,10,11,11,13,13,10,12, - 11,14,13, 8, 9, 9,12,12, 9,10,10,12,13, 9,11,10, - 13,12,11,12,12,14,14,11,13,12,15,14, 8, 9, 9,12, - 11, 9,10,10,13,12, 9,11,10,13,12,12,12,12,14,14, - 11,13,12,15,13,11,11,12,13,14,11,12,13,13,14,12, - 13,13,14,15,13,13,14,14,16,14,15,15,16,16,11,12, - 11,14,13,12,13,13,15,14,11,13,12,15,13,14,15,15, - 16,16,13,15,13,16,14, 9,10,11,12,13,11,11,12,13, - 14,11,12,12,13,14,13,13,14,14,16,13,14,14,15,16, - 11,11,12,13,14,12,12,13,14,15,12,13,13,14,15,14, - 14,15,15,17,14,15,15,16,17,11,12,12,14,14,12,13, - 13,14,15,12,13,12,15,15,14,15,15,16,17,14,15,15, - 16,16,13,14,14,15,16,14,14,15,15,17,15,15,15,16, - 17,16,16,17,16,18,16,17,17,18,18,13,14,14,16,15, - 14,15,15,17,16,14,15,15,16,16,16,17,17,18,18,16, - 16,16,17,16, 9,11,10,13,12,11,12,12,14,13,11,12, - 11,15,13,13,14,14,16,15,13,14,13,17,14,11,12,12, - 14,14,12,12,13,15,15,12,13,13,15,14,14,14,15,16, - 16,14,15,15,17,16,11,12,11,14,13,12,13,13,15,14, - 12,13,12,15,13,14,15,15,16,16,14,15,14,17,15,13, - 14,14,15,16,14,15,15,16,17,14,15,15,16,17,16,16, - 16,17,17,16,17,17,18,18,13,15,14,16,15,15,15,15, - 17,16,14,15,14,17,15,16,17,17,18,18,16,17,16,18, - 16, 6, 8, 8,11,11, 8, 9, 9,11,12, 8, 9, 9,12,11, - 10,11,11,13,14,10,12,11,14,13, 7, 9, 9,11,12, 9, - 10,10,12,13, 9,10,10,13,12,11,11,12,13,15,11,12, - 12,15,14, 8, 9, 9,12,11, 9,10,10,13,13, 9,11,10, - 13,12,12,12,12,14,15,11,13,12,15,13,10,11,11,13, - 14,11,12,12,13,15,11,12,12,14,14,13,13,14,14,16, - 14,15,14,16,16,11,12,11,14,13,12,13,13,15,14,11, - 13,12,15,13,14,15,15,16,16,13,14,14,16,14, 8, 9, - 9,11,12, 9,10,11,12,13, 9,10,10,13,12,11,12,13, - 14,15,11,12,12,15,14, 9, 9,11,11,13,10,10,12,12, - 14,10,10,11,13,14,12,12,13,14,16,12,13,13,15,15, - 9,11,10,13,12,10,11,11,13,14,10,12,11,14,13,12, - 13,13,15,16,12,13,13,15,15,11,11,13,13,15,12,12, - 14,13,15,13,13,14,14,15,14,14,15,14,17,15,15,15, - 16,16,12,13,12,15,14,13,14,14,15,15,12,14,13,15, - 14,15,15,15,17,17,14,15,14,17,15, 7, 9, 9,12,11, - 9,10,10,12,12, 9,11,10,13,12,11,12,12,14,14,11, - 13,12,15,14, 9,10,10,12,12,10,10,11,12,13,10,11, - 11,14,13,12,12,13,14,15,12,13,13,16,15, 9,10,10, - 13,12,10,11,11,13,13,10,11,10,14,12,13,13,13,15, - 15,12,13,12,15,14,11,12,12,14,14,12,12,13,14,15, - 13,14,13,15,15,14,13,15,14,16,15,16,15,17,16,12, - 12,12,14,14,13,13,14,15,15,12,13,12,15,14,15,15, - 16,16,17,14,15,14,17,14,10,11,12,13,14,11,12,13, - 14,15,11,12,13,14,15,13,14,15,15,17,14,15,15,16, - 16,11,12,13,12,15,12,12,14,13,16,13,13,14,13,16, - 14,14,16,14,18,15,15,16,16,17,12,13,12,15,15,13, - 14,14,15,16,13,14,13,16,15,15,15,16,17,18,15,15, - 15,17,16,14,14,15,14,17,15,14,16,14,17,15,15,16, - 15,18,16,16,17,16,19,17,17,17,17,18,14,15,15,17, - 16,15,16,16,17,17,15,16,15,18,16,17,17,18,18,18, - 16,17,16,18,17,10,11,11,14,13,11,12,12,15,14,11, - 13,12,15,14,14,15,15,16,16,14,15,15,17,16,11,12, - 12,15,14,12,13,13,15,14,13,14,13,16,14,14,15,15, - 16,16,15,16,15,18,16,11,13,12,15,15,13,14,14,15, - 15,12,14,13,16,15,15,16,16,17,17,15,16,15,17,16, - 14,15,14,16,16,14,15,15,16,16,15,16,15,17,16,16, - 16,17,16,17,17,18,17,19,18,14,15,15,17,16,15,16, - 16,17,17,15,15,15,18,16,17,18,18,18,18,16,17,16, - 19,16, 6, 8, 8,11,11, 8, 9, 9,11,12, 8, 9, 9,12, - 11,10,11,12,13,14,10,11,11,14,13, 8, 9, 9,11,12, - 9,10,11,12,13, 9,10,10,13,13,11,12,13,13,15,11, - 12,12,15,14, 7, 9, 9,12,11, 9,10,10,12,13, 9,10, - 10,13,12,11,12,12,14,15,11,12,11,14,13,11,11,12, - 13,14,11,12,13,13,15,12,13,13,14,15,13,14,14,14, - 16,14,15,15,16,16,10,11,11,14,13,11,12,12,14,14, - 11,12,12,15,13,14,14,14,16,16,13,14,13,16,14, 7, - 9, 9,11,12, 9,10,10,12,13, 9,10,10,12,12,11,12, - 13,14,15,11,12,12,14,14, 9,10,10,12,13,10,10,11, - 12,14,10,11,11,13,13,12,12,13,14,15,13,13,13,15, - 15, 9,10,10,12,12,10,11,11,13,14,10,11,10,13,12, - 12,13,13,15,16,12,13,12,15,14,11,12,13,14,14,12, - 12,13,14,15,13,14,13,15,15,14,14,15,14,17,15,16, - 15,17,16,11,12,12,14,14,13,13,13,15,15,12,13,12, - 15,14,15,15,15,16,17,14,15,14,16,14, 8, 9, 9,12, - 11, 9,10,10,12,13, 9,11,10,13,12,11,12,12,14,15, - 11,12,12,15,14, 9,10,11,13,13,10,11,12,13,14,10, - 11,11,14,13,12,13,13,15,15,12,13,13,16,15, 9,11, - 9,13,11,10,11,10,14,13,10,12,10,14,12,12,13,13, - 15,15,12,13,12,16,14,12,12,13,14,15,12,13,14,14, - 16,13,14,14,15,15,14,14,15,15,17,15,16,15,17,16, - 11,13,11,15,13,13,14,13,15,14,12,14,12,16,13,15, - 15,15,16,16,14,15,14,17,14,10,11,11,13,14,11,12, - 13,14,15,11,12,12,14,15,14,14,15,16,17,14,15,15, - 16,16,11,12,13,14,15,12,13,14,15,16,13,14,14,15, - 16,15,15,16,16,18,15,16,16,17,17,11,12,12,14,15, - 13,13,14,14,16,12,13,13,15,15,15,15,16,16,18,14, - 15,15,16,16,14,15,15,16,17,15,15,16,16,17,15,16, - 16,17,17,16,16,17,16,19,17,18,17,18,18,14,14,15, - 16,16,15,15,16,16,17,14,15,15,16,16,17,17,18,18, - 19,16,17,16,17,16,10,12,11,14,13,11,13,12,15,14, - 11,13,12,15,14,14,15,15,16,16,13,15,14,17,15,12, - 13,13,15,15,13,13,14,15,16,13,14,14,16,16,14,15, - 15,17,17,15,16,16,17,17,11,13,12,15,12,13,14,13, - 16,13,12,14,12,16,13,15,16,15,17,16,14,16,14,18, - 14,14,15,15,16,17,15,15,16,16,17,15,16,16,17,17, - 16,16,17,17,18,17,18,17,18,18,14,15,14,17,14,15, - 16,15,18,15,15,16,15,18,14,17,17,17,18,17,16,17, - 16,19,16, 9,11,11,13,13,10,12,12,14,14,11,12,12, - 15,14,13,14,14,16,16,13,14,14,16,16,10,11,12,14, - 14,11,12,13,14,15,12,13,13,15,15,13,14,15,16,16, - 14,15,15,17,16,11,12,12,15,14,12,13,13,15,15,12, - 13,12,15,15,14,15,15,16,17,14,15,14,17,16,12,13, - 14,15,16,13,13,14,15,16,13,14,15,16,16,14,15,16, - 16,18,15,16,16,18,18,13,14,14,16,15,14,15,15,17, - 16,14,15,15,17,16,16,17,17,18,18,16,17,16,18,17, - 10,12,12,14,14,11,12,13,15,15,12,13,13,15,15,13, - 14,15,16,17,14,15,15,17,16,11,11,13,14,15,12,12, - 14,15,16,13,13,14,15,16,14,14,15,16,17,15,15,16, - 17,17,12,13,12,15,15,13,14,14,16,16,13,14,13,16, - 15,15,16,15,17,17,15,16,15,18,16,13,12,15,14,17, - 14,13,16,14,17,14,14,16,15,18,15,14,17,16,18,16, - 16,17,17,18,14,15,15,17,16,15,16,16,17,17,15,16, - 15,18,16,17,17,17,18,18,16,17,16,19,17,10,11,11, - 14,14,11,12,12,15,15,11,13,12,15,15,14,15,14,16, - 16,14,15,15,17,16,11,12,12,15,14,12,12,13,15,15, - 13,14,13,16,15,14,15,15,16,16,15,16,15,18,17,11, - 13,12,15,15,13,14,13,15,15,12,14,13,16,15,15,16, - 15,17,17,15,16,15,18,16,13,14,13,16,16,14,15,14, - 16,16,14,15,15,17,16,16,16,16,16,18,16,18,17,19, - 18,14,15,15,17,16,15,16,16,17,17,15,15,15,17,16, - 17,17,18,18,19,16,17,16,18,16,12,13,13,15,16,13, - 14,14,16,17,13,14,14,16,16,15,15,16,17,18,15,16, - 16,18,17,13,13,14,14,17,14,14,15,15,17,14,14,15, - 16,17,15,15,17,16,18,16,17,17,18,18,13,14,14,17, - 16,14,15,15,17,17,14,15,14,17,16,16,17,17,18,18, - 16,17,16,18,17,15,14,16,13,18,16,15,17,14,19,16, - 16,17,15,18,17,16,18,15,19,18,18,18,17,19,15,16, - 16,18,17,16,17,17,18,18,16,17,16,19,17,18,19,18, - 19,19,17,18,17,20,18,11,12,12,15,15,13,13,14,15, - 16,13,14,13,16,15,15,16,16,17,17,15,16,16,18,17, - 12,14,13,16,15,13,13,14,15,16,14,15,14,17,16,16, - 16,16,16,17,16,17,17,19,17,12,13,14,16,16,14,15, - 15,16,17,13,15,13,17,15,16,17,17,18,18,16,17,16, - 18,16,15,16,15,17,16,15,15,15,17,17,16,17,16,18, - 17,17,16,17,16,18,18,19,18,20,18,15,16,16,17,17, - 16,17,17,18,18,15,16,15,18,17,18,18,19,19,19,17, - 18,16,19,16, 9,11,11,13,13,11,12,12,14,15,10,12, - 12,14,14,13,14,14,16,16,13,14,14,16,16,11,12,12, - 14,14,12,12,13,15,15,12,13,13,15,15,14,15,15,16, - 17,14,15,15,16,16,10,12,11,14,14,12,13,13,15,15, - 11,13,12,15,14,14,15,15,16,17,13,15,14,17,16,13, - 14,14,15,16,14,15,15,16,17,14,15,15,16,17,16,16, - 17,17,18,16,17,17,18,18,12,14,13,16,15,13,15,14, - 17,16,13,14,13,17,15,15,16,16,18,18,15,16,15,18, - 16,10,11,11,14,14,11,12,13,14,15,11,12,12,15,15, - 14,15,15,16,17,14,15,15,16,16,11,12,13,15,15,12, - 13,14,15,16,13,14,14,15,16,15,15,16,16,18,15,15, - 16,17,17,11,12,12,14,15,13,13,14,15,16,12,13,13, - 15,15,15,15,16,17,18,14,15,15,17,16,14,15,15,16, - 17,15,15,16,16,17,15,16,16,17,17,16,16,17,16,19, - 17,17,18,19,18,13,13,14,16,16,14,15,16,17,17,14, - 14,15,16,16,16,16,17,18,18,16,16,16,18,16,10,12, - 12,14,14,12,13,13,15,15,11,13,12,15,15,14,15,15, - 16,17,13,15,14,17,16,12,13,13,15,15,13,13,14,15, - 16,13,14,14,16,16,15,15,16,17,18,15,15,16,17,17, - 11,13,12,15,14,13,14,13,16,15,12,14,12,16,14,15, - 16,15,17,17,14,16,14,17,16,14,15,15,16,17,15,15, - 16,16,18,15,16,16,17,17,16,17,17,17,19,17,17,17, - 18,18,13,15,12,17,14,14,16,14,17,15,14,15,13,17, - 14,16,17,16,18,17,15,17,14,19,15,11,12,12,15,15, - 13,13,14,15,16,13,14,13,16,15,15,16,16,17,18,15, - 16,16,17,17,12,14,13,16,16,13,13,15,15,17,14,15, - 15,17,16,16,16,17,16,19,16,17,17,18,18,12,13,14, - 15,16,14,14,15,16,17,13,14,13,16,15,16,17,17,18, - 19,15,16,16,17,16,15,16,16,18,17,15,15,16,17,18, - 16,17,17,18,18,16,16,18,16,19,18,19,19,20,19,15, - 15,16,16,17,16,16,17,17,18,15,15,15,17,16,18,18, - 19,18,20,17,17,16,18,16,12,13,13,16,15,13,14,14, - 16,16,13,14,14,16,16,15,16,16,17,18,15,16,15,18, - 17,13,14,14,16,16,14,15,15,16,17,14,15,15,17,17, - 16,17,17,18,18,16,17,17,18,18,13,14,13,17,14,14, - 15,14,17,16,14,15,14,17,15,16,17,17,18,18,15,17, - 15,19,15,16,16,16,17,18,16,16,17,17,19,16,17,17, - 18,19,17,17,18,18,20,18,18,18,19,19,15,16,14,18, - 13,16,17,16,19,15,16,17,15,19,14,18,18,18,19,17, - 17,18,16,20,15, -}; - -static const static_codebook _44p6_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p6_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p6_p2_0, - 0 -}; - -static const long _vq_quantlist__44p6_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p3_0[] = { - 1, 5, 5, 5, 7, 8, 5, 8, 7, 5, 7, 8, 8, 8,10, 8, - 10,10, 5, 8, 7, 8,10,10, 8,10, 8, 6, 8, 9, 8,10, - 12, 9,11,11, 9,10,11,11,11,13,12,13,13, 9,11,11, - 11,13,13,11,13,12, 6, 9, 8, 9,11,11, 8,12,10, 9, - 11,11,11,12,13,11,13,13, 9,11,10,11,13,13,11,13, - 11, 5, 9, 9, 8,11,11, 9,12,11, 8,10,11,10,11,13, - 11,13,13, 9,11,11,11,13,13,11,13,12, 8,10,11,10, - 12,13,10,13,12,10,10,13,11,11,14,12,13,14,11,13, - 12,13,14,14,12,14,12, 8,11,10,11,12,13,11,14,12, - 10,13,12,12,12,13,13,15,14,11,12,13,13,14,15,12, - 14,12, 5, 9, 9, 9,11,12, 8,11,11, 9,11,11,11,12, - 13,11,13,13, 8,11,10,11,13,13,10,13,11, 8,10,11, - 11,12,14,11,13,12,11,13,12,12,12,14,13,15,14,10, - 12,13,13,14,15,12,13,12, 8,11,10,10,12,13,10,13, - 12,11,12,13,12,12,14,13,14,14,10,13,10,12,14,13, - 11,14,11, -}; - -static const static_codebook _44p6_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p6_p3_0, - 0 -}; - -static const long _vq_quantlist__44p6_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p3_1[] = { - 5, 7, 7, 6, 7, 7, 6, 7, 7, 6, 7, 7, 7, 8, 8, 7, - 8, 8, 6, 7, 7, 7, 8, 8, 7, 8, 8, 7, 7, 8, 7, 8, - 8, 7, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, - 8, 9, 9, 8, 9, 8, 7, 8, 7, 7, 8, 8, 7, 8, 8, 8, - 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, - 8, 6, 8, 8, 7, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, 9, - 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, 8, 7, 8, 8, 8, - 8, 9, 8, 9, 9, 8, 8, 9, 8, 9, 9, 9, 9, 9, 8, 9, - 9, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, 9, 9, - 9, 9, 6, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, - 9, 8, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, 8, 7, 8, 8, - 8, 8, 9, 8, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 8, - 8, 8, 9, 9, 9, 8, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, - 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, 9, - 9, 9, 9, -}; - -static const static_codebook _44p6_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p6_p3_1, - 0 -}; - -static const long _vq_quantlist__44p6_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p4_0[] = { - 2, 5, 5, 5, 7, 8, 5, 8, 7, 5, 7, 7, 7, 7, 9, 7, - 9, 9, 5, 7, 7, 8, 9, 9, 7, 9, 7, 6, 8, 8, 8, 9, - 10, 8, 9, 9, 8, 9,10, 9, 9,11,10,11,11, 8, 9, 9, - 10,11,11, 9,11,10, 6, 8, 8, 8, 9, 9, 8,10, 9, 8, - 9, 9, 9,10,11,10,11,10, 8,10, 9,10,11,11, 9,11, - 9, 6, 8, 8, 7, 9, 9, 8,10, 9, 7, 9, 9, 9, 9,10, - 9,10,10, 8, 9, 9, 9,10,10, 9,11,10, 7, 9, 9, 8, - 10,10, 9,10,10, 9, 9,10,10,10,11,10,11,11, 9,10, - 10,10,11,11,10,11,10, 7, 9, 9, 9, 9,10, 9,10, 9, - 8,10, 9, 9, 9,11,10,11,11, 9,10,10,10,11,11, 9, - 11, 9, 6, 8, 8, 8, 9,10, 7, 9, 9, 8, 9, 9, 9,10, - 10, 9,10,10, 7, 9, 9, 9,10,10, 9,10, 9, 7, 9, 9, - 9, 9,10, 9,10, 9, 9,10,10, 9, 9,11,10,11,11, 8, - 9,10,10,11,11, 9,11, 9, 7, 9, 9, 9,10,10, 8,10, - 10, 9,10,10,10,10,11,10,11,11, 9,10, 9,10,11,11, - 10,11,10, -}; - -static const static_codebook _44p6_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p6_p4_0, - 0 -}; - -static const long _vq_quantlist__44p6_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p6_p4_1[] = { - 6, 8, 8,10,10, 8, 9, 9,10,11, 8,10, 9,11,10, 9, - 10,10,11,11, 9,10,10,11,11, 8, 9, 9,10,10, 9, 9, - 10,11,11,10,10,10,11,11,10,11,11,11,11,10,11,11, - 11,11, 8, 9, 9,11,10,10,10,10,11,11, 9,10, 9,11, - 11,10,11,11,11,11,10,11,10,11,11,10,10,11,11,11, - 10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,10,11,10,11,11,11,11,11,11,11,10,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11, 8, 9,10, - 11,11,10,10,11,11,11,10,10,10,11,11,10,11,11,12, - 12,10,11,11,12,12,10,10,11,11,11,10,10,11,11,12, - 11,11,11,12,12,11,11,12,12,12,11,11,12,12,12,10, - 10,10,11,11,11,11,11,12,12,10,11,11,12,12,11,12, - 12,12,12,11,12,11,12,12,11,11,11,11,12,11,11,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,11,11,12,11,11,12,12,12,12,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12, 8,10, 9,11,11,10, - 10,10,11,11,10,11,10,11,11,10,11,11,12,12,10,11, - 11,12,12,10,10,10,11,11,10,11,11,12,12,11,11,11, - 12,12,11,11,12,12,12,11,12,12,12,12,10,11,10,11, - 11,11,11,11,12,12,10,11,10,12,11,11,12,11,12,12, - 11,12,11,12,12,11,11,11,12,12,11,11,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11, - 11,12,11,11,12,12,12,12,11,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,10,11,11,11,12,11,11,12,12, - 12,11,11,11,12,12,11,12,12,12,12,11,12,12,12,12, - 11,11,12,12,12,11,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,13,11,12,11,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,13,12,13,12,12,12,12,13,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,12, - 12,12,13,12,10,11,11,12,11,11,11,12,12,12,11,12, - 11,12,12,11,12,12,12,12,11,12,12,12,12,11,11,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,11,12,11,12,12,12,12,12,12,12, - 11,12,12,12,12,12,12,12,12,12,12,12,12,13,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,12,12,12,12,13,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,13,12,13,12,13, - 12, 8,10,10,11,11,10,10,11,11,11,10,11,10,11,11, - 10,11,11,12,12,10,11,11,12,12, 9,10,11,11,11,10, - 10,11,12,12,10,11,11,12,12,11,11,12,12,12,11,12, - 12,12,12,10,11,10,11,11,11,11,11,12,12,10,11,11, - 12,12,11,12,12,12,12,11,12,11,12,12,11,11,11,12, - 12,11,11,12,12,12,11,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,11,11,11,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 9,10, - 10,11,11,10,11,11,12,12,10,11,11,12,12,11,11,12, - 12,12,11,12,12,12,12,10,11,11,12,12,11,11,12,12, - 12,11,11,12,12,12,11,11,12,12,12,12,12,12,12,12, - 10,11,11,12,12,11,12,12,12,12,11,12,11,12,12,12, - 12,12,12,12,12,12,12,12,12,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,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, 9,10,10,11,11, - 10,11,11,12,12,10,11,11,12,11,11,12,12,12,12,11, - 12,12,12,12,10,11,11,12,12,11,11,11,12,12,11,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,10,11,11, - 12,12,11,12,12,12,12,11,12,11,12,12,12,12,12,12, - 12,12,12,12,12,12,11,12,12,12,12,11,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,11,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,11,11,11,12,12,11,12,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 13,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,12,13,12,12,13,13,13,11,12,12,12,12,12, - 12,12,13,13,12,12,12,13,12,12,12,12,13,13,12,13, - 12,13,13,12,12,12,12,12,12,12,12,12,13,12,13,13, - 13,13,12,13,13,13,13,13,13,13,13,13,12,12,12,12, - 12,12,12,13,13,13,12,13,12,13,13,12,13,13,13,13, - 12,13,13,13,13,11,11,11,12,12,11,12,12,12,12,11, - 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,13, - 12,13,12,12,12,13,13,11,12,12,12,12,12,12,12,12, - 13,12,12,12,13,12,12,13,12,13,13,12,13,12,13,13, - 12,12,12,12,12,12,12,13,13,13,12,12,13,13,13,12, - 13,13,12,13,13,13,13,13,13,12,12,12,12,12,12,13, - 12,13,13,12,13,12,13,12,12,13,13,13,13,12,13,13, - 13,13, 8,10,10,11,11,10,10,11,11,11, 9,11,10,11, - 11,10,11,11,12,12,10,11,11,12,12,10,10,11,11,11, - 10,11,11,12,12,11,11,11,12,12,11,11,12,12,12,11, - 12,12,12,12, 9,11,10,11,11,10,11,11,12,12,10,11, - 10,12,12,11,12,12,12,12,11,12,11,12,12,11,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,11,11,11,12,12,11,12,12,12,12, - 11,12,11,12,12,12,12,12,12,12,12,12,12,12,12, 9, - 10,10,11,11,10,11,11,12,12,10,11,11,12,12,11,12, - 12,12,12,11,12,12,12,12,10,11,11,12,12,11,11,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,10,11,11,12,12,11,11,12,12,12,11,11,11,12,12, - 12,12,12,12,12,11,12,12,12,12,11,12,12,12,12,11, - 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,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12, 9,10,10,11, - 11,10,11,11,12,12,10,11,11,12,12,11,12,12,12,12, - 11,12,11,12,12,10,11,11,12,12,11,11,12,12,12,11, - 11,12,12,12,12,12,12,12,12,12,12,12,12,12,10,11, - 11,12,12,11,12,11,12,12,11,12,11,12,12,12,12,12, - 12,12,11,12,11,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, - 11,12,11,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,12,12,11,12, - 12,12,12,11,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,13, - 13,12,12,12,13,13,12,12,13,13,13,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,13,12,13,13,12, - 12,12,13,12,12,12,12,12,12,12,12,13,13,13,12,12, - 13,13,13,12,13,13,12,13,12,13,13,13,13,12,12,12, - 12,12,12,12,13,13,13,12,12,12,13,12,12,13,13,13, - 13,12,13,13,13,13,11,11,11,12,12,11,12,12,12,12, - 11,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,13,12,12,12, - 13,13,13,12,12,12,13,13,11,12,12,12,12,12,12,12, - 13,12,12,12,12,13,12,12,13,12,13,13,12,13,12,13, - 12,12,12,12,12,12,12,12,13,13,13,12,13,13,13,13, - 12,13,13,13,13,13,13,13,13,13,12,12,12,12,12,12, - 13,12,13,12,12,13,12,13,12,13,13,13,13,13,12,13, - 13,13,13,10,11,11,12,12,11,12,12,12,12,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,11,11,12,12, - 12,11,12,12,12,12,12,12,12,12,12,12,12,12,13,13, - 12,12,12,13,13,11,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,13,13,12,12,12,13,12,12,12, - 12,12,12,12,12,12,12,13,12,12,12,12,13,12,12,13, - 12,13,12,13,13,13,13,12,12,12,12,12,12,12,12,13, - 12,12,12,12,13,12,12,13,13,13,13,12,13,12,13,13, - 11,11,11,12,12,11,12,12,12,12,11,12,12,12,12,12, - 12,12,12,13,12,12,12,13,12,11,12,12,12,12,12,12, - 12,12,13,12,12,12,12,13,12,12,13,13,13,12,12,13, - 13,13,11,12,12,12,12,12,12,12,12,13,12,12,12,13, - 12,12,13,12,13,13,12,13,12,13,13,12,12,12,12,12, - 12,12,13,12,13,12,12,13,13,13,12,12,13,13,13,13, - 13,13,13,13,12,12,12,12,12,12,13,13,13,13,12,13, - 12,13,12,12,13,13,13,13,12,13,13,13,13,11,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,13,11,12,12,12,12,12,12,12,12,13, - 12,12,12,13,13,12,12,13,13,13,12,12,13,13,13,11, - 12,12,12,12,12,12,12,13,13,12,12,12,13,12,12,13, - 12,13,13,12,13,12,13,13,12,12,12,12,12,12,12,12, - 12,13,12,13,12,13,13,12,13,13,13,13,12,13,13,13, - 13,12,12,12,12,12,12,13,12,13,13,12,12,12,13,13, - 12,13,13,13,13,12,13,12,13,13,11,12,12,12,12,11, - 12,12,12,12,11,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,13,12,13,12,12,12,13,13,11,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13, - 12,13,12,13,13,12,12,12,12,12,12,12,13,12,13,12, - 12,13,12,13,12,12,13,12,13,12,13,13,13,13,12,12, - 12,12,12,12,12,12,12,12,12,12,12,13,12,12,13,13, - 13,13,12,13,12,13,12,11,11,11,12,12,11,12,12,12, - 12,11,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,13,13,11,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,13,13,12,12,12, - 13,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,13,12,12,12,13,12,12,12,12,12,12,12,12, - 12,12,12,13,12,12,12,12,13,12,12,13,12,13,12,12, - 13,12,13,12,10,11,11,12,12,11,12,12,12,12,11,12, - 11,12,12,11,12,12,12,12,11,12,12,12,12,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 13,12,12,12,13,13,11,12,11,12,12,12,12,12,12,12, - 11,12,12,12,12,12,12,12,13,13,12,12,12,13,12,12, - 12,12,12,12,12,12,12,12,13,12,12,12,12,13,12,13, - 13,12,13,12,13,13,13,13,12,12,12,12,12,12,12,12, - 13,13,12,12,12,13,12,12,13,13,13,13,12,13,12,13, - 12,11,11,11,12,12,11,12,12,12,12,11,12,12,12,12, - 12,12,12,13,13,12,12,12,13,12,11,12,12,12,12,12, - 12,12,12,13,12,12,12,13,13,12,12,13,13,13,12,12, - 13,13,13,11,12,12,12,12,12,12,12,13,13,12,12,12, - 13,12,12,13,12,13,13,12,12,12,13,13,12,12,12,12, - 12,12,12,13,13,13,12,12,13,13,13,12,12,13,13,13, - 12,13,13,13,13,12,12,12,12,12,12,12,13,13,13,12, - 12,12,13,12,12,13,13,13,13,12,13,13,13,13,11,11, - 11,12,12,11,12,12,12,12,11,12,12,12,12,12,12,12, - 12,13,12,12,12,13,13,11,12,12,12,12,12,12,12,12, - 13,12,12,12,13,13,12,12,13,13,13,12,12,13,13,13, - 11,12,12,12,12,12,12,12,13,12,12,12,12,13,12,12, - 13,12,13,13,12,13,12,13,13,12,12,12,12,12,12,12, - 12,13,13,12,13,12,13,13,12,13,13,13,13,13,13,13, - 13,13,12,12,12,12,12,12,13,12,13,13,12,13,12,13, - 12,12,13,13,13,13,12,13,12,13,13,11,11,11,12,12, - 11,12,12,12,12,11,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,13,12,12,12,13,13,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13, - 13,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13, - 12,12,12,12,13,12,12,12,12,13,12,12,13,12,13,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 13,12,12,12,13,12,12,12,11,12,11,12,12,11,12,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,12,12,12,12,12,12,12,12,13,12,12,12,12,12, - 12,12,12,13,13,12,12,12,13,13,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,12,13,13,12,12, - 12,13,12,12,12,12,12,12,12,12,12,12,13,12,12,12, - 13,13,12,12,13,12,13,12,13,13,13,13,12,12,12,12, - 12,12,12,12,13,12,12,12,12,13,12,12,13,12,13,13, - 12,13,12,13,12, -}; - -static const static_codebook _44p6_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p6_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p6_p4_1, - 0 -}; - -static const long _vq_quantlist__44p6_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p6_p5_0[] = { - 2, 6, 6,10,10, 5, 7, 8,11,12, 5, 8, 7,12,11, 9, - 11,11,13,15, 9,11,11,15,13, 6, 7, 8,11,11, 7, 7, - 9,11,13, 8, 9, 9,13,12,11,11,12,12,15,11,12,12, - 15,14, 6, 8, 7,11,11, 8, 9, 9,12,13, 7, 9, 7,13, - 11,11,12,12,14,15,11,12,11,15,12,10,11,11,12,14, - 10,11,12,12,15,12,13,13,14,15,13,12,14,12,16,15, - 15,15,16,16,10,11,11,14,12,12,13,13,15,14,10,12, - 11,15,12,15,15,15,16,17,13,14,12,17,12, 6, 8, 8, - 12,12, 8, 9,10,13,13, 8, 9, 9,13,13,12,12,13,15, - 16,12,13,13,16,15, 8, 9,10,12,13, 9, 9,11,13,14, - 10,11,11,14,14,13,13,14,15,16,13,14,14,16,16, 8, - 10, 9,13,13,10,11,11,14,14, 9,10,10,14,13,13,14, - 14,16,17,13,13,13,16,15,12,13,13,14,16,13,13,14, - 14,16,14,14,14,16,16,15,15,16,15,18,16,17,17,18, - 18,12,13,13,15,15,14,14,14,16,16,13,14,13,16,15, - 16,16,17,18,18,15,16,15,18,15, 6, 8, 8,12,12, 8, - 9, 9,13,13, 8,10, 9,13,13,12,13,13,15,16,12,13, - 12,16,15, 8, 9,10,13,13, 9,10,10,13,14,10,11,11, - 14,14,13,13,13,15,16,13,14,14,17,16, 8,10, 9,13, - 13,10,11,11,14,14, 9,11, 9,14,13,13,14,14,16,16, - 13,14,13,16,14,12,13,13,15,16,13,13,14,15,16,14, - 14,14,16,16,15,15,16,15,18,17,17,17,18,18,12,13, - 13,16,14,14,14,14,16,16,13,14,13,16,14,16,17,17, - 18,18,15,16,15,18,15,11,12,13,14,16,13,13,14,15, - 17,13,14,14,16,17,16,16,17,17,19,16,17,17,18,19, - 13,13,14,16,16,14,14,15,16,17,14,15,15,17,17,17, - 16,17,17,19,17,17,18,19,19,13,14,14,16,16,14,14, - 15,17,18,14,15,14,17,17,17,17,18,18,19,17,17,17, - 18,19,16,16,16,17,18,17,17,17,18,19,17,17,17,18, - 19,18,18,19,18,20,19,20,19,21,20,16,17,17,18,18, - 17,17,18,19,19,17,17,17,19,18,19,19,19,19,20,19, - 19,19,20,19,11,13,12,16,14,13,14,14,17,16,13,14, - 13,17,15,16,17,17,18,18,16,17,16,19,17,13,14,14, - 16,16,14,14,14,17,17,14,15,15,17,16,17,17,17,19, - 19,17,18,17,19,18,13,14,13,17,16,14,15,15,17,17, - 14,15,14,18,16,17,17,17,19,19,17,17,16,19,17,16, - 17,17,18,19,17,17,17,18,18,17,18,17,19,18,18,19, - 18,19,19,19,20,19,20,20,16,17,16,18,17,17,17,17, - 18,18,17,18,17,19,17,19,19,19,19,20,18,19,19,20, - 18, 6, 8, 8,12,12, 8, 9, 9,13,13, 8,10, 9,13,13, - 11,13,13,15,16,12,13,13,16,15, 8, 9, 9,13,13, 9, - 9,10,13,14,10,11,11,14,14,12,12,13,14,16,13,14, - 14,17,16, 8,10, 9,13,13,10,11,11,14,14, 9,11,10, - 14,13,13,14,14,16,16,13,14,13,16,15,12,13,13,14, - 16,12,13,14,14,16,13,14,14,16,16,15,14,16,15,18, - 16,17,17,18,17,12,13,13,16,15,14,14,14,16,16,13, - 14,13,16,15,16,16,17,17,17,15,16,15,18,15, 7, 9, - 9,13,13, 9, 9,11,13,14, 9,10,10,14,13,12,13,14, - 15,16,12,14,13,17,15, 9, 9,10,13,14,10, 9,11,13, - 15,11,11,11,14,14,13,12,14,14,17,14,14,14,17,16, - 9,10,10,14,13,11,11,11,14,14,10,11,10,15,13,14, - 14,14,16,17,13,14,13,17,14,13,13,14,14,16,13,13, - 14,14,17,14,14,14,16,16,15,14,16,15,18,17,17,17, - 18,18,13,14,13,16,15,14,14,15,17,16,13,14,13,17, - 15,17,16,17,17,17,15,16,14,18,14, 7, 9, 9,13,13, - 9,10,10,13,14, 9,11,10,14,13,13,14,14,16,16,13, - 14,14,17,15, 9,10,10,14,13, 9,10,11,13,14,11,12, - 11,15,14,13,13,14,14,16,14,15,15,17,17, 9,10,10, - 14,14,11,12,12,14,15,10,11,10,15,13,14,15,15,17, - 17,14,15,13,17,14,13,14,13,16,16,13,13,14,15,16, - 14,15,15,17,17,15,14,16,15,18,17,18,17,20,18,13, - 14,14,16,16,15,15,15,17,17,13,14,13,17,15,17,17, - 18,18,18,15,16,14,19,14,12,13,13,15,16,13,13,15, - 16,17,13,14,14,16,16,15,15,17,17,19,16,17,17,19, - 18,13,13,14,15,17,14,13,15,15,17,14,15,15,16,17, - 16,15,18,16,19,17,17,17,18,19,13,14,14,17,16,14, - 15,15,17,17,14,15,14,17,16,17,17,17,18,19,16,17, - 16,19,17,16,16,17,16,18,16,16,17,16,19,17,17,18, - 18,19,18,17,18,17,21,19,19,19,20,19,16,17,17,18, - 18,17,17,18,18,19,16,17,16,18,18,19,19,19,19,20, - 18,18,17,20,18,11,13,13,16,15,13,14,14,16,17,13, - 15,14,17,16,16,17,17,18,18,17,17,17,19,18,13,14, - 13,17,16,14,13,14,16,17,15,16,15,18,16,17,16,17, - 17,19,18,18,18,20,18,13,14,14,16,17,15,15,15,17, - 18,14,15,14,18,16,18,18,18,19,20,17,18,16,20,17, - 16,17,16,18,18,16,16,17,18,18,17,18,18,19,18,18, - 17,19,17,20,19,20,19,22,20,16,16,17,18,18,18,17, - 17,19,19,16,17,16,18,17,19,20,19,22,21,18,19,18, - 21,17, 6, 8, 8,12,12, 8, 9,10,13,13, 8, 9, 9,13, - 13,12,13,13,15,16,11,13,13,16,15, 8, 9,10,13,13, - 9,10,11,13,14,10,11,11,14,14,13,13,14,15,16,13, - 14,14,16,16, 8, 9, 9,13,13,10,11,11,14,14, 9,10, - 9,14,13,13,14,14,16,17,12,14,12,16,14,12,13,13, - 15,16,13,13,14,15,16,13,14,14,15,17,15,15,16,15, - 18,16,16,17,17,17,12,13,13,16,14,13,14,14,16,16, - 12,14,13,16,14,16,17,17,18,18,15,15,14,18,14, 7, - 9, 9,13,13, 9,10,11,13,14, 9,10,10,14,13,13,14, - 14,15,17,13,14,14,16,15, 9,10,10,14,14,10,10,11, - 13,15,11,12,12,15,14,14,13,15,14,17,14,15,15,17, - 17, 9,10,10,13,14,11,11,12,14,15, 9,11,10,14,13, - 14,15,15,16,18,13,14,13,16,14,13,14,14,16,16,13, - 13,14,15,17,15,15,15,16,17,15,14,16,15,18,17,17, - 18,19,18,13,14,14,16,16,14,15,15,17,17,13,14,13, - 16,15,17,17,18,18,18,15,16,14,18,15, 7, 9, 9,13, - 13, 9,10,10,13,14, 9,11,10,14,13,12,13,14,15,16, - 12,14,13,16,15, 9,10,10,13,14,10,10,11,13,14,11, - 11,11,15,14,13,13,14,14,16,14,14,14,17,16, 9,10, - 9,14,13,11,11,11,14,14,10,11, 9,15,13,14,14,14, - 16,16,13,14,12,17,14,13,13,14,15,16,13,13,14,15, - 16,14,15,14,16,17,15,14,16,14,18,16,17,17,18,18, - 13,14,13,16,14,14,14,14,16,16,13,14,13,17,14,17, - 17,17,18,18,15,16,14,18,15,11,13,13,16,16,13,14, - 15,16,17,13,14,14,17,16,16,17,17,18,19,17,17,17, - 19,18,13,14,14,17,17,13,13,15,16,18,15,15,15,17, - 17,17,16,18,17,20,18,17,18,19,19,13,14,14,16,17, - 15,15,16,16,18,14,15,14,16,16,17,17,18,18,20,17, - 18,16,18,17,16,17,16,19,18,16,16,17,18,19,18,18, - 18,19,19,18,17,18,17,21,20,19,19,21,21,16,16,17, - 18,18,17,17,18,19,19,16,17,16,19,18,20,20,20,19, - 21,18,18,17,20,18,12,13,13,16,15,13,14,14,16,16, - 13,14,13,17,16,16,17,17,18,18,15,17,15,19,17,13, - 14,14,16,17,14,14,15,16,17,14,15,15,17,17,16,16, - 17,17,18,17,17,17,19,19,13,14,13,17,15,14,15,15, - 17,16,14,15,13,17,15,17,18,17,19,18,16,17,15,20, - 16,16,17,17,18,18,16,16,17,18,18,17,18,17,19,18, - 17,17,18,18,20,19,20,19,20,19,16,16,16,19,16,17, - 17,17,19,18,16,17,16,19,16,19,19,19,19,19,18,19, - 17,19,17,11,13,13,16,16,13,14,14,17,17,13,14,14, - 17,17,15,17,17,19,19,16,18,17,20,19,12,14,14,17, - 17,13,14,15,17,18,14,15,15,17,18,16,16,17,18,20, - 17,18,18,20,18,13,14,14,17,17,14,15,15,17,18,14, - 15,15,17,17,17,18,17,19,19,17,18,17,19,19,15,16, - 16,18,18,15,16,17,18,19,16,17,17,19,19,17,17,18, - 18,21,18,19,19,21,19,16,17,17,18,18,17,17,18,19, - 19,17,18,17,19,19,19,19,19,20,20,18,19,18,21,19, - 12,13,13,16,16,13,14,14,16,17,13,15,14,17,16,15, - 16,17,17,19,16,17,17,19,18,13,13,14,16,17,14,13, - 15,16,17,14,15,15,17,17,15,15,17,17,20,17,17,18, - 19,18,13,14,14,17,16,15,15,15,17,18,14,15,14,17, - 16,17,17,17,18,18,16,17,16,19,17,16,15,17,17,19, - 16,15,17,16,19,17,16,17,18,19,17,16,19,16,20,19, - 18,19,19,19,16,17,17,18,18,17,17,17,18,19,16,17, - 16,19,18,20,19,19,20,19,18,18,17,20,17,11,13,13, - 16,16,13,14,15,16,17,14,15,14,18,16,17,17,17,18, - 21,17,18,17,20,19,13,14,14,17,16,13,14,15,16,18, - 15,16,15,18,17,17,16,17,17,19,17,18,18,20,19,13, - 14,14,16,17,15,15,16,17,18,14,15,14,18,17,17,18, - 18,19,20,17,18,16,19,17,16,17,15,19,18,16,16,16, - 18,18,17,18,17,20,19,18,17,18,17,20,20,20,19,22, - 20,16,17,17,18,19,18,18,18,19,20,16,17,16,19,18, - 20,19,19,20,20,18,19,17,20,17,13,14,14,16,17,14, - 14,16,16,18,14,16,15,17,16,16,16,17,17,18,17,17, - 16,19,18,14,14,15,16,17,14,14,16,16,18,16,16,16, - 17,17,16,15,17,16,19,18,18,18,19,19,14,15,15,17, - 17,15,16,16,17,18,14,16,14,18,16,17,17,18,18,19, - 16,17,16,19,17,16,16,17,16,18,16,16,17,16,19,18, - 18,18,17,18,17,16,18,16,20,19,19,19,19,19,16,17, - 17,18,18,17,17,18,19,19,16,17,16,19,17,18,19,19, - 19,20,17,18,16,20,16,11,14,13,17,17,14,14,16,16, - 18,14,16,14,19,16,18,18,19,18,19,18,19,18,21,18, - 13,15,14,18,16,14,14,16,16,18,16,17,16,19,17,18, - 16,19,17,20,19,19,19,21,19,13,14,15,17,18,17,16, - 17,17,19,14,16,14,18,16,20,19,19,20,21,18,19,16, - 21,17,17,18,16,19,17,16,16,17,18,18,19,19,18,21, - 18,17,17,18,17,20,20,20,20,22,20,17,17,18,18,20, - 19,19,19,18,20,16,17,17,19,19,21,21,21,20,21,17, - 19,17,23,17,11,13,13,16,16,13,14,14,17,17,13,14, - 14,17,17,16,17,17,19,20,15,16,16,19,19,13,14,14, - 16,17,14,15,15,17,18,14,15,15,17,17,17,17,18,19, - 19,17,17,18,19,19,13,14,14,17,16,14,15,15,17,17, - 13,15,14,18,17,17,18,18,19,20,16,17,16,19,18,16, - 16,17,18,18,17,17,17,18,19,17,18,17,19,19,19,19, - 19,19,20,19,20,19,20,20,15,16,16,18,17,16,17,17, - 20,18,15,16,16,19,17,19,19,19,20,20,17,18,17,21, - 17,11,13,13,16,16,13,14,15,16,17,13,15,14,17,16, - 17,17,18,18,20,17,17,17,19,19,13,14,14,17,17,14, - 14,15,17,18,15,15,15,18,17,17,17,18,17,20,18,18, - 17,20,18,13,14,14,16,17,15,15,16,17,18,14,15,13, - 17,17,17,18,18,19,20,17,17,16,19,17,16,17,17,18, - 18,16,16,17,18,18,18,18,18,19,19,18,17,19,18,21, - 19,20,20,20,20,16,15,17,18,18,17,17,18,18,20,16, - 16,16,18,17,20,19,20,21,22,17,18,17,20,17,12,13, - 13,16,16,13,14,15,16,17,13,14,14,17,16,16,17,18, - 18,19,15,16,16,19,18,13,14,14,16,17,14,14,15,16, - 17,14,15,15,17,17,16,16,17,17,19,17,17,17,19,18, - 13,14,13,17,16,14,15,15,17,17,13,15,13,17,16,17, - 17,17,19,19,15,17,15,19,17,16,17,17,18,18,16,16, - 17,17,19,17,18,17,19,19,18,17,19,17,19,19,19,19, - 20,19,15,17,15,19,16,17,17,16,19,18,16,17,15,18, - 16,19,19,19,20,19,17,19,16,19,16,11,14,14,17,17, - 15,14,16,16,18,15,16,14,18,16,18,18,19,18,21,18, - 19,18,20,18,13,15,14,18,17,14,14,16,16,18,16,17, - 16,19,17,17,17,19,17,22,19,19,19,21,19,13,14,15, - 17,18,17,16,17,17,19,14,16,14,18,16,19,19,19,20, - 21,18,18,16,20,17,17,18,16,19,18,15,17,17,19,19, - 19,19,18,21,19,18,17,20,17,21,22,21,20,21,21,17, - 16,19,18,20,19,18,19,18,20,16,17,16,19,18,21,20, - 21,19,23,18,19,16,20,17,13,14,14,17,16,14,14,15, - 16,18,14,16,14,17,16,16,16,17,17,19,16,17,16,19, - 17,14,15,15,17,17,14,14,16,16,17,15,16,16,18,17, - 16,16,17,17,19,17,18,17,19,18,14,15,14,17,16,16, - 16,16,17,17,14,16,14,17,16,18,18,18,18,19,16,17, - 15,19,16,17,17,17,18,18,16,15,17,17,18,18,18,18, - 19,19,17,16,18,16,19,19,19,19,19,19,16,17,16,19, - 16,18,18,17,19,18,16,17,16,19,16,19,19,20,19,19, - 17,18,16,20,16, -}; - -static const static_codebook _44p6_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p6_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p6_p5_0, - 0 -}; - -static const long _vq_quantlist__44p6_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p6_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p6_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p6_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p6_p5_1, - 0 -}; - -static const long _vq_quantlist__44p6_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p6_0[] = { - 1, 5, 5, 5, 7, 9, 5, 9, 7, 5, 7, 8, 7, 7,10, 9, - 10,10, 5, 8, 7, 9,10,10, 7,10, 7, 6, 9, 9, 9,10, - 12, 9,11,11, 9,10,11,11,11,13,12,13,13, 9,11,11, - 12,13,13,11,13,11, 6, 9, 9, 9,11,11, 9,12,10, 9, - 11,11,11,11,13,12,13,13, 9,11,10,12,13,13,11,13, - 11, 6, 9, 9, 9,11,12, 9,12,11, 9,10,11,10,10,13, - 12,13,13, 9,11,11,12,13,12,11,13,11, 7, 9,10, 9, - 10,12,10,12,11,10,10,12,10,10,12,12,12,13,10,11, - 11,12,12,13,10,12,10, 7,10,10,11,11,14,11,14,11, - 10,12,11,11,11,14,14,14,14,10,11,12,14,14,14,11, - 14,11, 6, 9, 9, 9,11,12, 9,12,11, 9,11,11,11,11, - 13,12,12,13, 9,11,10,12,13,13,10,13,10, 7,10,10, - 11,11,14,11,14,11,10,12,11,11,11,14,14,15,14,10, - 11,12,13,14,15,11,14,11, 7,10, 9,10,11,12, 9,12, - 10,10,11,11,10,10,12,12,13,12, 9,12,10,12,13,12, - 10,12,10, -}; - -static const static_codebook _44p6_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p6_p6_0, - 0 -}; - -static const long _vq_quantlist__44p6_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p6_1[] = { - 2, 6, 6, 6, 7, 8, 6, 8, 7, 6, 7, 7, 7, 7, 8, 7, - 8, 8, 6, 7, 7, 7, 8, 8, 7, 8, 7, 6, 8, 8, 8, 9, - 9, 8, 9, 9, 8, 9, 9, 9, 9,10, 9,10,10, 8, 9, 9, - 9,10,10, 9,10, 9, 6, 8, 8, 8, 9, 9, 8, 9, 9, 8, - 9, 9, 9, 9,10, 9,10,10, 8, 9, 9, 9,10, 9, 9,10, - 9, 6, 8, 8, 8, 9, 9, 8, 9, 9, 8, 9, 9, 9, 9,10, - 9, 9,10, 8, 9, 9, 9,10, 9, 9,10, 9, 7, 8, 8, 8, - 9, 9, 8, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 8, 9, - 9, 9,10, 9, 9, 9, 9, 7, 9, 9, 9, 9,10, 9,10, 9, - 9, 9, 9, 9, 9,10,10,10,10, 9, 9, 9,10,10,10, 9, - 10, 9, 6, 8, 8, 8, 9, 9, 8, 9, 9, 8, 9, 9, 9, 9, - 10, 9,10,10, 8, 9, 9, 9,10, 9, 9,10, 9, 7, 9, 9, - 9, 9,10, 9,10, 9, 9, 9, 9, 9, 9,10,10,10,10, 9, - 9, 9,10,10,10, 9,10, 9, 7, 8, 8, 8, 9, 9, 8, 9, - 9, 8, 9, 9, 9, 9,10, 9, 9,10, 8, 9, 8, 9, 9, 9, - 9,10, 9, -}; - -static const static_codebook _44p6_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p6_p6_1, - 0 -}; - -static const long _vq_quantlist__44p6_p7_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p7_0[] = { - 1, 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p6_p7_0 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p7_0, - 1, -513979392, 1633504256, 2, 0, - (long *)_vq_quantlist__44p6_p7_0, - 0 -}; - -static const long _vq_quantlist__44p6_p7_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p6_p7_1[] = { - 1, 4, 5, 5,10,10, 5,10,10, 5,10,10,10,10,10,10, - 10,10, 5,10,10,10,10,10,10,10,10, 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, 6,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10, 6,10,10,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,10,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,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10, 6,10,10,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,10, - 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,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, -}; - -static const static_codebook _44p6_p7_1 = { - 5, 243, - (long *)_vq_lengthlist__44p6_p7_1, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p6_p7_1, - 0 -}; - -static const long _vq_quantlist__44p6_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p6_p7_2[] = { - 1, 2, 3, 4, 5, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,14,14,15,15,15,15, -}; - -static const static_codebook _44p6_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p6_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p6_p7_2, - 0 -}; - -static const long _vq_quantlist__44p6_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p6_p7_3[] = { - 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p6_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p6_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p6_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p6_short[] = { - 2, 8,13,15,16,18,21,22, 5, 4, 6, 8,10,12,17,21, - 9, 5, 5, 6, 8,11,15,19,11, 6, 5, 5, 6, 7,12,14, - 14, 8, 7, 5, 4, 4, 9,11,16,11, 9, 7, 4, 3, 7,10, - 22,15,14,12, 8, 7, 9,11,21,16,15,12, 9, 5, 6, 8, -}; - -static const static_codebook _huff_book__44p6_short = { - 2, 64, - (long *)_huff_lengthlist__44p6_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p7_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p7_l0_0[] = { - 2, 4, 4, 7, 7, 8, 8,10,10,11,11,12,12, 4, 5, 5, - 7, 7, 9, 9,11, 9,12,11,12,12, 4, 5, 5, 7, 7, 9, - 9, 9,10,10,11,12,12, 7, 7, 7, 7, 8, 9, 8,11, 5, - 12, 6,12,10, 7, 7, 7, 8, 7, 8, 9, 5,11, 6,12,10, - 12, 8, 9, 9, 9, 9,10,10,11, 7,11, 7,12, 9, 8, 9, - 8, 9, 9,10,10, 7,11, 7,11, 9,11,10,10,10,10,10, - 10,10,11,10,11, 8,11, 9,10,10,10,10,10,10,10,10, - 11, 8,10, 9,11,10,11,11,11,11,11,10,11,10,12,10, - 12,11,10,11,11,11,11,10,11,10,11,10,12,11,12,11, - 12,12,12,12,12,12,12,12,12,12,13,12,11,12,11,12, - 12,12,12,12,11,12,11,12,13, -}; - -static const static_codebook _44p7_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p7_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p7_l0_0, - 0 -}; - -static const long _vq_quantlist__44p7_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p7_l0_1[] = { - 4, 4, 4, 5, 5, 4, 4, 5, 5, 5, 4, 5, 4, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p7_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p7_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p7_l0_1, - 0 -}; - -static const long _vq_quantlist__44p7_l1_0[] = { - 54, - 29, - 79, - 0, - 108, -}; - -static const long _vq_lengthlist__44p7_l1_0[] = { - 1, 2, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, -}; - -static const static_codebook _44p7_l1_0 = { - 2, 25, - (long *)_vq_lengthlist__44p7_l1_0, - 1, -514516992, 1620639744, 7, 0, - (long *)_vq_quantlist__44p7_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p7_lfe[] = { - 2, 3, 1, 3, -}; - -static const static_codebook _huff_book__44p7_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p7_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p7_long[] = { - 2, 7,14,16,17,17,18,20, 6, 3, 5, 8,10,11,13,15, - 13, 5, 3, 5, 8, 9,11,12,15, 7, 4, 3, 5, 7, 9,11, - 16,10, 7, 5, 6, 7, 9,10,17,11, 8, 7, 7, 6, 8, 8, - 19,13,11, 9, 9, 8, 8, 9,20,14,13,11,10, 8, 9, 9, -}; - -static const static_codebook _huff_book__44p7_long = { - 2, 64, - (long *)_huff_lengthlist__44p7_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p7_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p1_0[] = { - 2, 5, 5, 4, 7, 7, 4, 7, 7, 5, 7, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 8, 6, 7, 8, 8, 9, - 10, 8, 9,10, 8, 9,10,10,10,12,10,11,11, 8,10,10, - 10,11,12,10,11,11, 6, 8, 7, 8,10, 9, 8,10, 9, 8, - 10,10,10,11,11,10,12,11, 8,10, 9,10,11,11,10,12, - 10, 5, 8, 8, 8,10,10, 8,10,10, 7, 9,10, 9,10,11, - 9,11,11, 8,10,10,10,11,12,10,12,11, 7, 9, 9, 9, - 10,11, 9,11,11, 9, 9,11,10,11,12,11,11,12, 9,11, - 11,11,12,12,11,12,12, 7, 9, 9,10,11,11,10,12,11, - 9,11,10,11,11,12,11,13,12,10,11,11,12,13,13,11, - 13,11, 5, 8, 8, 8,10,10, 8,10,10, 8,10,10,10,11, - 12,10,12,11, 7,10, 9, 9,11,11, 9,11,10, 7, 9, 9, - 10,11,12,10,11,11,10,11,11,11,11,13,12,13,13, 9, - 10,11,11,12,13,11,12,11, 7, 9, 9, 9,11,11, 9,11, - 10, 9,11,11,11,12,12,11,12,12, 9,11, 9,11,12,11, - 10,12,11, -}; - -static const static_codebook _44p7_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p7_p1_0, - 0 -}; - -static const long _vq_quantlist__44p7_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p7_p2_0[] = { - 4, 6, 6, 9, 9, 6, 8, 8,10,10, 6, 8, 8,10,10, 8, - 10,10,12,13, 8,10,10,13,12, 6, 8, 8,10,10, 8, 8, - 9,10,11, 8, 9, 9,11,11,10,10,11,12,13,10,11,11, - 13,13, 6, 8, 8,10,10, 8, 9, 9,11,11, 8, 9, 8,11, - 10,10,11,11,13,13,10,11,10,13,12, 9,10,10,12,12, - 10,10,11,12,13,10,11,11,13,13,12,12,13,12,15,13, - 13,13,15,14, 9,10,10,12,12,10,11,11,13,13,10,11, - 10,13,12,12,13,13,14,15,12,13,12,15,12, 6, 8, 8, - 10,11, 8, 9,10,11,12, 8, 9, 9,11,11,10,11,12,13, - 14,10,11,11,13,13, 8, 9, 9,11,12, 9,10,11,12,13, - 9,10,10,12,13,11,12,13,13,15,11,12,12,14,14, 8, - 9, 9,11,12, 9,10,11,12,13, 9,10,10,13,12,11,12, - 13,14,15,11,12,12,14,13,10,11,12,13,14,11,12,13, - 13,15,12,13,13,14,14,13,13,14,14,16,14,15,14,16, - 15,10,12,11,14,13,12,12,13,14,14,11,12,12,14,14, - 14,14,15,15,16,13,14,14,16,14, 6, 8, 8,11,10, 8, - 9, 9,11,11, 8,10, 9,12,11,10,11,11,13,13,10,12, - 11,14,13, 8, 9, 9,12,11, 9,10,10,12,13, 9,11,10, - 13,12,11,12,12,14,14,11,13,12,15,14, 8, 9, 9,12, - 11, 9,10,10,13,12, 9,11,10,13,12,11,12,12,14,14, - 11,13,12,15,13,10,11,12,13,14,11,12,13,13,14,12, - 13,12,14,14,13,13,14,14,16,14,15,14,16,16,10,12, - 11,14,13,12,13,13,14,14,11,13,12,15,13,14,14,15, - 16,16,13,14,13,16,14, 9,10,11,12,13,11,11,12,13, - 14,11,11,12,13,14,13,13,14,14,16,13,14,14,15,15, - 11,11,12,13,14,12,12,13,13,15,12,13,13,14,15,14, - 14,15,15,17,14,14,15,16,16,11,12,12,13,14,12,12, - 13,14,15,12,13,12,14,15,14,14,15,15,17,14,15,14, - 16,16,13,14,14,15,16,14,14,15,15,17,14,15,15,16, - 16,15,16,17,16,18,16,17,16,17,17,13,14,14,16,15, - 14,15,15,16,16,14,15,14,16,15,16,16,17,17,18,16, - 16,16,17,16, 9,11,10,13,12,11,12,11,14,13,11,12, - 11,14,13,13,14,14,16,15,13,14,13,16,14,11,12,12, - 14,13,12,12,13,14,14,12,13,13,15,14,14,14,15,16, - 16,14,15,14,17,15,11,12,11,14,13,12,13,13,15,14, - 12,13,12,15,13,14,15,14,16,16,14,15,14,17,15,13, - 14,14,15,16,14,14,15,16,16,14,15,15,16,16,15,16, - 16,16,17,16,16,16,17,17,13,14,14,16,15,14,15,15, - 17,16,14,15,14,17,15,16,17,17,17,17,16,16,16,18, - 16, 6, 8, 8,11,11, 8, 9, 9,11,12, 8, 9, 9,12,11, - 10,11,11,13,14,10,11,11,14,13, 8, 9, 9,11,12, 9, - 10,10,12,13, 9,10,10,13,12,11,11,12,13,15,11,12, - 12,15,14, 8, 9, 9,12,11, 9,10,11,12,13, 9,11,10, - 13,12,11,12,12,14,15,11,13,12,15,14,10,11,11,13, - 14,11,12,12,13,14,11,12,12,14,14,13,13,14,14,16, - 13,14,14,16,15,11,12,11,14,13,12,13,13,14,14,11, - 13,12,14,13,14,14,15,16,16,13,14,14,16,14, 8, 9, - 9,11,12, 9,10,10,12,13, 9,10,10,13,12,11,12,12, - 14,15,11,12,12,14,14, 9, 9,10,11,13,10,10,12,12, - 14,10,10,11,13,13,12,12,13,14,16,12,12,13,15,15, - 9,10,10,13,12,10,11,11,13,14,10,12,11,14,13,12, - 13,13,15,15,12,13,13,15,15,11,11,12,13,15,12,12, - 13,13,15,12,13,13,14,15,14,14,15,15,17,14,15,15, - 16,16,11,13,12,15,14,13,13,13,15,15,12,14,13,15, - 14,15,15,15,16,16,14,15,15,17,15, 7, 9, 9,12,11, - 9,10,10,12,12, 9,11,10,13,12,11,12,12,14,14,11, - 13,12,15,14, 9,10,10,12,12,10,10,11,12,13,10,11, - 11,14,13,12,12,13,14,15,12,13,13,15,14, 9,10,10, - 12,12,10,11,11,13,13,10,11,10,14,12,12,13,13,15, - 15,12,13,12,15,13,11,12,12,14,14,12,12,13,14,15, - 12,13,13,15,15,14,13,14,13,16,14,15,15,16,16,11, - 12,12,14,14,13,13,14,15,15,12,13,12,15,14,15,15, - 15,16,16,14,15,14,17,14,10,11,12,13,14,11,12,13, - 14,15,11,12,12,14,15,13,14,15,15,17,14,14,14,16, - 16,11,12,13,12,15,12,12,14,13,16,13,13,14,13,16, - 14,14,15,14,17,15,15,15,15,17,11,13,12,15,15,13, - 13,14,15,16,12,14,13,16,15,15,15,15,17,17,15,15, - 15,17,16,14,14,15,14,16,14,14,16,14,17,15,15,15, - 14,17,16,16,17,15,18,17,17,17,16,18,14,15,15,17, - 16,15,16,16,17,17,15,16,15,17,16,17,17,17,18,18, - 16,17,16,18,17,10,11,11,14,13,11,12,12,14,14,11, - 13,12,15,14,14,14,14,16,16,14,15,14,16,15,11,12, - 12,15,13,12,13,13,15,14,13,14,13,16,14,14,15,15, - 16,16,15,16,15,17,16,11,13,12,15,14,13,13,14,15, - 15,12,14,13,16,14,15,15,15,17,17,14,16,15,17,16, - 14,14,14,16,15,14,15,15,16,16,15,16,15,17,16,16, - 16,16,16,17,16,17,17,18,17,14,15,15,16,16,15,15, - 16,17,16,14,15,15,17,16,17,17,17,18,18,16,17,16, - 18,16, 6, 8, 8,11,11, 8, 9, 9,11,12, 8, 9, 9,12, - 11,10,11,12,13,14,10,11,11,14,13, 8, 9, 9,11,12, - 9,10,11,12,13, 9,11,10,13,12,11,12,13,14,15,11, - 12,12,15,14, 8, 9, 9,12,11, 9,10,10,12,13, 9,10, - 10,13,12,11,12,12,14,15,11,12,12,14,13,11,11,12, - 13,14,11,12,13,13,15,12,13,13,14,14,13,14,14,14, - 16,14,15,14,16,16,10,11,11,14,13,11,12,12,14,14, - 11,12,12,14,13,13,14,14,15,16,13,14,13,16,14, 7, - 9, 9,11,11, 9,10,11,12,13, 9,10,10,12,12,11,12, - 13,14,15,11,12,12,14,14, 9,10,10,12,12,10,10,11, - 12,13,10,11,11,13,13,12,12,13,13,15,12,13,13,15, - 15, 9,10,10,12,12,10,11,11,13,13,10,11,10,13,12, - 12,13,13,14,15,12,13,12,15,13,11,12,12,14,14,12, - 12,13,14,15,13,14,13,15,15,14,13,15,13,16,15,15, - 15,16,16,11,12,12,14,14,12,13,13,14,15,12,13,12, - 15,14,14,15,15,16,17,13,14,13,16,13, 8, 9, 9,12, - 11, 9,10,10,12,13, 9,10,10,13,12,11,12,12,14,15, - 11,12,12,15,14, 9,10,10,12,13,10,11,12,13,14,10, - 11,11,14,13,12,13,13,15,15,12,13,13,15,15, 9,10, - 9,13,11,10,11,10,13,13,10,12,10,14,12,12,13,12, - 15,15,12,13,12,15,14,11,12,13,14,15,12,13,14,14, - 15,13,13,13,15,15,14,15,15,15,17,15,15,15,16,16, - 11,12,11,15,13,12,13,13,15,14,12,13,12,16,13,14, - 15,15,16,16,14,15,14,17,14,10,11,11,13,14,11,12, - 13,14,15,11,12,12,14,14,14,14,15,15,17,14,14,14, - 15,16,11,12,13,14,15,12,13,14,14,16,13,14,13,15, - 15,14,15,16,15,17,15,15,15,17,17,11,12,12,13,15, - 13,13,14,14,16,12,13,13,14,15,15,15,15,16,17,14, - 15,15,16,16,14,15,15,16,16,14,15,15,16,17,15,15, - 16,16,17,16,16,17,16,18,17,17,17,18,18,14,14,15, - 15,16,15,15,15,16,17,14,15,15,16,16,16,17,17,17, - 18,16,16,16,17,16,10,11,11,14,13,11,13,12,15,14, - 11,13,12,15,14,14,15,14,16,16,13,15,14,17,15,11, - 12,13,15,15,12,13,14,15,16,13,14,13,16,15,15,15, - 15,16,17,15,15,15,17,16,11,13,11,15,12,13,14,13, - 16,13,12,14,12,16,13,15,15,15,17,15,14,16,14,17, - 14,14,15,15,16,17,15,15,16,16,17,15,16,15,17,17, - 16,16,17,17,18,16,17,17,18,18,14,15,14,17,13,15, - 16,15,17,15,15,16,15,17,14,16,17,16,18,16,16,17, - 16,18,15, 9,11,11,13,13,10,12,12,14,14,11,12,12, - 14,14,13,14,14,15,16,13,14,14,16,16,10,11,12,14, - 14,11,12,13,14,15,11,13,13,15,15,13,14,14,15,16, - 14,15,15,16,16,11,12,12,14,14,12,13,13,15,15,12, - 13,12,15,14,14,15,15,16,16,14,15,14,17,16,12,13, - 13,15,16,13,13,14,15,16,13,14,14,16,16,14,15,16, - 16,17,15,16,16,17,17,13,14,14,16,15,14,15,15,17, - 16,14,15,14,17,15,16,16,17,17,17,16,16,16,18,16, - 10,11,12,14,14,11,12,13,14,15,11,13,12,15,15,13, - 14,15,16,16,14,15,15,17,16,11,11,13,14,15,12,12, - 14,14,16,12,13,14,15,15,14,14,15,16,17,15,15,15, - 17,17,12,13,12,15,15,13,14,14,16,15,13,14,13,16, - 15,15,16,15,17,17,15,16,15,17,16,13,12,15,14,16, - 14,13,15,14,17,14,13,15,15,17,15,14,17,15,18,16, - 15,17,17,18,14,15,15,17,16,15,16,16,17,17,15,16, - 15,17,16,16,17,17,18,18,16,17,16,18,17,10,11,11, - 14,14,11,12,12,14,15,11,13,12,15,14,13,14,14,16, - 16,14,15,14,16,16,11,12,12,14,14,12,12,13,15,15, - 12,13,13,15,15,14,14,15,16,16,14,15,15,17,16,11, - 12,12,15,15,13,13,13,15,15,12,13,13,15,15,15,15, - 15,17,17,14,15,15,17,16,13,14,13,16,15,14,14,14, - 16,16,14,15,14,17,16,15,15,16,16,17,16,17,16,18, - 17,14,15,15,16,16,15,15,15,17,17,14,15,15,17,16, - 16,17,17,18,18,16,17,16,18,16,12,13,13,15,15,13, - 14,14,16,16,13,14,14,16,16,14,15,16,16,18,15,16, - 16,17,17,13,13,14,14,16,14,14,15,15,17,14,14,15, - 15,17,15,15,17,15,18,16,16,17,17,18,13,14,14,16, - 16,14,15,15,16,17,14,15,15,17,16,16,17,16,17,18, - 16,17,16,18,17,15,14,16,13,18,16,15,17,14,18,16, - 15,17,14,18,17,16,18,15,19,17,17,18,16,19,15,16, - 16,17,17,16,17,17,18,18,16,17,16,18,17,18,18,18, - 19,18,17,18,17,19,17,11,12,12,15,15,13,13,14,15, - 16,13,14,13,16,15,15,15,15,16,17,15,16,15,17,16, - 12,13,13,15,15,13,13,14,15,16,14,15,14,16,15,15, - 15,16,16,17,16,16,16,18,17,12,13,13,15,15,14,14, - 15,16,16,13,14,13,16,15,16,16,16,17,17,15,16,15, - 18,16,15,15,15,17,15,14,15,15,16,16,16,17,16,17, - 16,16,16,17,16,17,17,18,17,19,18,15,15,16,17,17, - 16,16,16,17,17,15,16,15,17,16,17,18,18,18,18,16, - 17,16,18,16, 9,11,11,13,13,11,12,12,14,14,10,12, - 12,14,14,13,14,14,15,16,13,14,14,16,15,11,12,12, - 14,14,12,12,13,14,15,12,13,13,15,15,14,14,15,16, - 17,14,15,15,16,16,10,12,11,14,14,11,13,13,15,15, - 11,13,12,15,14,14,14,15,16,16,13,14,14,16,15,13, - 14,14,15,16,14,14,15,15,17,14,15,15,16,17,16,16, - 16,16,18,16,16,17,17,17,12,13,13,16,15,13,14,14, - 16,16,12,14,13,16,15,15,16,16,17,17,14,16,15,17, - 16,10,11,11,14,14,11,12,13,14,15,11,12,12,15,14, - 14,14,15,16,16,13,14,14,16,16,11,12,12,14,15,12, - 13,14,15,15,13,13,13,15,15,14,15,15,16,17,15,15, - 15,16,17,11,12,12,14,14,12,13,13,15,15,12,13,12, - 15,15,14,15,15,16,17,14,15,14,16,16,14,14,15,16, - 16,14,15,15,16,17,15,16,15,17,17,16,16,17,16,18, - 16,17,17,18,18,13,13,14,15,16,14,14,15,16,17,14, - 14,14,16,15,16,16,17,17,18,15,16,15,17,16,10,12, - 11,14,14,11,13,13,15,15,11,13,12,15,15,14,15,15, - 16,16,13,15,14,16,16,12,12,13,15,15,13,13,14,15, - 16,13,14,14,16,15,15,15,16,16,17,15,15,15,17,17, - 11,13,11,15,14,12,14,13,16,15,12,14,12,16,14,15, - 15,15,17,17,14,15,14,17,15,14,15,15,16,17,15,15, - 16,16,17,15,16,16,17,17,16,16,17,17,18,16,17,17, - 18,18,13,14,12,16,14,14,15,13,17,15,14,15,13,17, - 14,16,17,15,18,17,15,17,14,18,15,11,12,12,14,15, - 13,13,14,15,16,13,14,13,16,15,15,15,16,16,17,15, - 15,15,16,16,12,13,13,15,15,13,13,14,15,16,14,15, - 14,16,16,15,15,16,16,18,16,16,16,18,17,12,13,13, - 15,15,14,14,15,15,16,13,14,13,15,15,16,16,16,17, - 18,15,16,15,17,16,15,16,15,17,16,15,15,16,16,17, - 16,17,16,17,17,16,16,17,16,18,17,18,18,18,18,14, - 15,15,15,17,16,15,17,16,17,14,15,15,16,16,17,17, - 18,18,19,16,16,16,17,16,12,13,13,15,15,13,14,14, - 16,16,13,14,14,16,16,15,16,16,17,17,15,16,15,18, - 16,13,14,14,16,16,14,15,15,16,17,14,15,15,17,16, - 16,16,17,17,18,16,17,16,18,18,13,14,13,16,14,14, - 15,14,17,15,14,15,14,17,14,16,17,16,18,17,15,17, - 15,18,15,15,16,16,17,18,16,16,17,17,18,16,17,17, - 17,18,17,17,18,18,19,17,18,18,19,18,15,16,14,17, - 13,16,17,15,18,14,16,17,15,18,14,18,18,17,19,16, - 17,18,16,19,15, -}; - -static const static_codebook _44p7_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p7_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p7_p2_0, - 0 -}; - -static const long _vq_quantlist__44p7_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p3_0[] = { - 2, 5, 5, 4, 7, 7, 4, 7, 7, 5, 7, 8, 7, 8,10, 8, - 9, 9, 5, 7, 7, 8, 9, 9, 7,10, 8, 5, 7, 8, 8, 9, - 10, 8,10,10, 8, 9,10,10,10,12,10,12,12, 8,10,10, - 10,12,12,10,12,11, 5, 8, 7, 8,10,10, 8,10, 9, 8, - 10,10,10,11,12,10,12,12, 8,10, 9,10,12,12,10,12, - 10, 5, 8, 8, 7,10,10, 8,10,10, 7, 9,10, 9,10,12, - 10,12,12, 8,10,10,10,12,12,10,12,11, 7, 9,10, 9, - 11,12,10,12,11, 9, 9,12,11,10,14,12,12,13,10,12, - 11,12,13,13,11,14,12, 7,10, 9,10,11,11,10,12,11, - 9,11,11,11,11,13,12,14,13,10,12,12,12,14,14,11, - 14,12, 5, 8, 8, 8,10,10, 7,10,10, 8,10,10,10,11, - 12,10,12,12, 7,10, 9,10,12,12, 9,12,10, 7, 9,10, - 10,11,12,10,11,11,10,12,12,11,12,14,12,14,14, 9, - 11,11,12,13,14,11,13,11, 7,10, 9,10,11,12, 9,12, - 11,10,11,12,11,12,14,12,13,13, 9,12, 9,12,13,12, - 11,14,10, -}; - -static const static_codebook _44p7_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p7_p3_0, - 0 -}; - -static const long _vq_quantlist__44p7_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p3_1[] = { - 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 8, 7, - 8, 8, 7, 8, 7, 7, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 8, 8, 8, - 8, 8, 8, 8, 9, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, - 8, 7, 8, 8, 7, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 8, 7, 8, 8, 8, - 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, - 8, 9, 9, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, - 9, 8, 7, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, - 9, 8, 8, 9, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, - 8, 8, 8, 9, 9, 8, 9, 8, 7, 8, 8, 8, 8, 8, 8, 9, - 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, - 8, 9, 8, -}; - -static const static_codebook _44p7_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p7_p3_1, - 0 -}; - -static const long _vq_quantlist__44p7_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p4_0[] = { - 1, 5, 5, 5, 7, 8, 5, 8, 7, 5, 7, 8, 7, 8,10, 8, - 10,10, 5, 8, 7, 8,10,10, 7,10, 8, 6, 8, 9, 9,10, - 12, 9,11,11, 9,10,11,11,11,13,11,13,13, 9,11,11, - 11,12,13,11,13,11, 6, 9, 8, 9,11,11, 9,12,10, 9, - 11,11,11,11,13,11,13,13, 9,11,10,11,13,13,11,13, - 11, 6, 9, 9, 8,10,11, 9,12,11, 8,10,11,10,11,13, - 11,13,13, 9,11,11,11,13,12,11,13,11, 8,10,10, 9, - 11,12,10,12,12,10,10,12,11,11,14,12,13,14,10,12, - 12,12,13,13,11,14,11, 8,11,10,11,12,13,11,14,12, - 10,12,11,11,12,14,13,15,14,10,12,12,13,14,15,12, - 14,12, 5, 9, 9, 9,11,12, 8,11,10, 9,11,11,11,11, - 13,11,12,13, 8,11,10,11,13,13,10,13,11, 8,10,11, - 11,12,14,11,13,12,10,12,12,12,12,14,14,15,14,10, - 11,12,13,14,15,11,14,12, 8,10,10,10,12,12, 9,12, - 11,10,12,12,11,11,14,12,13,13,10,12,10,12,14,13, - 11,13,11, -}; - -static const static_codebook _44p7_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p7_p4_0, - 0 -}; - -static const long _vq_quantlist__44p7_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p7_p4_1[] = { - 7, 8, 8,10,10, 8, 9, 9,10,11, 8, 9, 9,10,10, 9, - 10,10,11,11, 9,10,10,11,11, 8, 9, 9,10,10, 9, 9, - 10,11,11, 9,10,10,11,11,10,10,11,11,11,10,11,11, - 11,11, 8, 9, 9,10,10, 9,10,10,11,11, 9,10, 9,11, - 11,10,11,11,11,11,10,11,10,11,11,10,10,10,11,11, - 10,11,11,11,11,10,11,11,11,11,11,11,11,11,12,11, - 11,11,11,12,10,10,10,11,11,10,11,11,11,11,10,11, - 11,11,11,11,11,11,12,11,11,11,11,12,11, 8, 9,10, - 11,11, 9,10,11,11,11, 9,10,10,11,11,10,11,11,12, - 12,10,11,11,12,12,10,10,10,11,11,10,10,11,11,12, - 10,11,11,12,12,11,11,12,12,12,11,11,12,12,12,10, - 10,10,11,11,10,11,11,12,12,10,11,11,12,11,11,12, - 12,12,12,11,12,11,12,12,11,11,11,11,12,11,11,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,11,11,12,12,11,12,12,12,12,11,12,11,12,12, - 12,12,12,12,12,12,12,12,12,12, 8,10, 9,11,11, 9, - 10,10,11,11, 9,10,10,11,11,10,11,11,12,12,10,11, - 11,12,12,10,10,10,11,11,10,11,11,12,12,10,11,11, - 12,12,11,11,12,12,12,11,12,12,12,12,10,10,10,11, - 11,10,11,11,12,12,10,11,10,12,11,11,12,11,12,12, - 11,12,11,12,12,11,11,11,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11, - 11,12,11,11,12,12,12,12,11,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,10,11,11,11,12,11,11,12,12, - 12,11,11,11,12,12,11,12,12,12,12,11,12,12,12,12, - 11,11,12,12,12,11,12,12,12,12,12,12,12,12,12,12, - 12,13,12,13,12,12,12,13,13,11,12,11,12,12,11,12, - 12,12,12,11,12,12,12,12,12,12,12,13,13,12,12,12, - 13,13,12,12,12,12,12,12,12,12,12,13,12,12,13,13, - 13,12,13,13,13,13,12,13,13,13,13,12,12,12,12,12, - 12,12,13,13,13,12,12,12,13,12,12,13,13,13,13,12, - 13,13,13,13,10,11,11,12,11,11,11,11,12,12,11,12, - 11,12,12,11,12,12,12,12,11,12,12,12,12,11,11,11, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,13, - 13,12,12,12,13,13,11,12,11,12,12,12,12,12,12,12, - 11,12,11,12,12,12,12,12,13,13,12,12,12,13,12,12, - 12,12,12,12,12,12,12,13,13,12,12,12,13,13,12,13, - 13,13,13,12,13,13,13,13,12,12,12,12,12,12,12,12, - 13,13,12,13,12,13,12,12,13,13,13,13,13,13,13,13, - 13, 8,10,10,11,11, 9,10,10,11,11, 9,10,10,11,11, - 10,11,11,12,12,10,11,11,12,12, 9,10,10,11,11,10, - 10,11,11,12,10,11,11,12,12,11,11,12,12,12,11,11, - 12,12,12,10,10,10,11,11,10,11,11,12,12,10,11,10, - 12,11,11,12,11,12,12,11,12,11,12,12,11,11,11,12, - 12,11,11,12,12,12,11,12,12,12,12,11,12,12,12,12, - 12,12,12,12,12,11,11,11,12,11,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 9,10, - 10,11,11,10,11,11,11,12,10,11,11,12,12,11,11,11, - 12,12,11,11,11,12,12,10,10,11,11,12,11,11,12,12, - 12,11,11,11,12,12,11,11,12,12,12,11,12,12,12,12, - 10,11,11,12,12,11,11,11,12,12,11,12,11,12,12,11, - 12,12,12,12,11,12,12,12,12,11,11,12,12,12,11,12, - 12,12,12,12,12,12,12,12,12,12,12,12,13,12,12,12, - 12,13,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,13,12, 9,10,10,11,11, - 10,11,11,12,12,10,11,11,12,11,11,12,11,12,12,11, - 12,11,12,12,10,11,11,12,12,11,11,11,12,12,11,12, - 11,12,12,11,12,12,12,12,12,12,12,12,12,10,11,11, - 12,12,11,12,11,12,12,11,12,11,12,12,12,12,12,13, - 12,12,12,12,12,12,11,12,11,12,12,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,13,12,12,12,12,13,11, - 12,12,12,12,12,12,12,13,12,11,12,12,12,12,12,12, - 12,13,12,12,12,12,13,12,10,11,11,12,12,11,12,12, - 12,12,11,12,12,12,12,12,12,12,12,13,12,12,12,13, - 13,11,11,12,12,12,12,12,12,12,13,12,12,12,12,12, - 12,12,13,12,13,12,12,13,13,13,11,12,12,12,12,12, - 12,12,13,13,12,12,12,13,12,12,13,12,13,13,12,13, - 12,13,13,12,12,12,12,12,12,12,13,12,13,12,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,12,12,12,13, - 13,12,13,13,13,13,12,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,10,11,11,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,13,13,12,12,12,13,13,11,12, - 12,12,12,12,12,12,12,13,12,12,12,13,12,12,12,13, - 13,13,12,13,13,13,13,11,12,12,12,12,12,12,12,13, - 13,12,12,12,13,12,12,13,13,13,13,12,13,12,13,13, - 12,12,12,12,12,12,13,13,13,13,12,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,12,12,12,13,12,12,13, - 13,13,13,12,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13, 8,10,10,11,11, 9,10,10,11,11, 9,10,10,11, - 11,10,11,11,12,12,10,11,11,12,12,10,10,10,11,11, - 10,11,11,11,12,10,11,11,12,12,11,11,12,12,12,11, - 11,12,12,12, 9,10,10,11,11,10,11,11,12,12,10,11, - 10,12,11,11,12,11,12,12,11,12,11,12,12,11,11,11, - 12,12,11,11,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,11,11,11,12,11,11,12,12,12,12, - 11,12,11,12,12,12,12,12,12,12,12,12,12,12,12, 9, - 10,10,11,11,10,11,11,12,12,10,11,11,12,12,11,11, - 12,12,12,11,12,12,12,12,10,11,11,12,12,11,11,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,10,11,11,12,12,11,11,12,12,12,11,11,11,12,12, - 12,12,12,12,12,11,12,12,12,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,13,12,13,12,12, - 12,13,12,11,12,12,12,12,12,12,12,12,12,11,12,12, - 12,12,12,12,12,13,12,12,12,12,13,12, 9,10,10,11, - 11,10,11,11,12,12,10,11,11,12,12,11,11,11,12,12, - 11,12,11,12,12,10,11,11,12,12,11,11,12,12,12,11, - 11,11,12,12,11,12,12,12,12,11,12,12,12,12,10,11, - 10,12,11,11,11,11,12,12,11,12,11,12,12,11,12,12, - 12,12,11,12,11,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,12,12,12,12,13, - 11,12,11,12,12,12,12,12,12,12,11,12,12,12,12,12, - 12,12,13,12,12,12,12,13,12,10,11,11,12,12,11,12, - 12,12,12,11,12,12,12,12,12,12,12,13,13,12,12,12, - 13,13,11,12,12,12,12,12,12,12,12,13,12,12,12,13, - 13,12,12,13,13,13,12,13,13,13,13,11,12,12,12,12, - 12,12,12,12,13,12,12,12,12,12,12,13,13,13,13,12, - 13,12,13,13,12,12,12,12,13,12,13,13,13,13,12,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,12, - 12,12,12,13,13,13,13,12,13,12,13,13,13,13,13,13, - 13,13,13,13,13,13,11,11,11,12,12,11,12,12,12,12, - 11,12,12,12,12,12,12,12,13,13,12,12,12,13,12,11, - 12,12,12,12,12,12,12,13,13,12,12,12,13,13,12,12, - 13,13,13,12,13,13,13,13,11,12,11,12,12,12,12,12, - 13,12,12,12,12,13,12,12,13,12,13,13,12,13,12,13, - 12,12,12,12,12,13,12,12,13,13,13,12,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,12,12,12,12,12,12, - 13,13,13,13,12,13,12,13,12,13,13,13,13,13,13,13, - 13,13,13,10,11,11,12,12,10,11,11,12,12,10,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,11,11,11,12, - 12,11,11,12,12,12,11,12,12,12,12,12,12,12,13,13, - 12,12,12,13,13,11,11,11,12,12,11,12,12,12,12,11, - 12,11,13,12,12,12,12,13,13,12,12,12,13,13,11,12, - 12,12,12,12,12,12,12,13,12,12,12,13,13,12,12,13, - 13,13,12,13,12,13,13,11,12,12,12,12,12,12,12,13, - 12,12,12,12,13,12,12,13,13,13,13,12,13,13,13,13, - 10,11,11,12,12,11,12,12,12,12,11,12,12,12,12,12, - 12,12,13,13,12,12,12,13,13,11,11,12,12,12,11,12, - 12,12,13,12,12,12,13,13,12,12,13,13,13,12,12,13, - 13,13,11,12,12,12,12,12,12,12,13,13,12,12,12,13, - 13,12,13,13,13,13,12,13,12,13,13,12,12,12,12,13, - 12,12,13,12,13,12,12,13,13,13,12,12,13,13,13,12, - 13,13,13,13,12,12,12,12,13,12,12,13,13,13,12,12, - 12,13,13,13,13,13,13,13,12,13,13,13,13,10,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,13, - 13,12,12,12,13,13,11,12,12,12,12,11,12,12,12,13, - 12,12,12,13,13,12,12,13,13,13,12,13,13,13,13,11, - 12,12,12,12,12,12,12,13,13,12,12,12,13,12,12,13, - 12,13,13,12,13,12,13,13,12,12,12,12,12,12,12,12, - 13,13,12,13,12,13,13,12,13,13,13,13,13,13,13,13, - 13,12,12,12,13,12,12,13,13,13,13,12,13,12,13,13, - 13,13,13,13,13,13,13,13,13,13,11,11,11,12,12,11, - 12,12,12,12,11,12,12,12,12,12,12,12,13,13,12,12, - 12,13,13,11,12,12,12,12,12,12,12,12,13,12,12,12, - 13,13,12,12,13,13,13,12,12,13,13,13,11,12,12,12, - 12,12,12,12,13,13,12,12,12,13,13,12,13,13,13,13, - 12,13,12,13,13,12,12,12,12,12,12,12,13,12,13,12, - 13,13,13,13,12,13,13,12,13,13,13,13,13,13,12,12, - 12,12,12,12,13,13,13,13,12,13,12,13,13,13,13,13, - 13,13,13,13,13,13,13,10,11,11,12,12,11,12,12,12, - 13,11,12,12,13,12,12,12,12,13,13,12,12,12,13,13, - 11,12,12,12,12,12,12,12,13,13,12,13,12,13,13,12, - 12,13,13,13,12,13,13,13,13,11,12,12,12,13,12,12, - 12,13,13,12,12,12,13,12,12,13,13,13,13,12,13,12, - 13,13,12,12,12,12,12,12,12,13,13,13,12,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,12,12,12,13,12, - 12,13,13,13,13,12,13,12,13,13,13,13,13,13,13,13, - 13,13,13,13,10,11,11,12,12,10,11,11,12,12,10,11, - 11,12,12,11,12,12,12,12,11,12,12,12,12,11,11,11, - 12,12,11,11,12,12,13,11,12,12,12,12,12,12,12,13, - 13,12,12,12,13,13,10,11,11,12,12,11,12,12,12,12, - 11,12,11,12,12,12,12,12,13,13,12,12,12,13,12,11, - 12,12,12,12,12,12,12,12,13,12,12,12,13,13,12,12, - 13,13,13,12,13,13,13,13,11,12,12,12,12,12,12,12, - 13,13,12,12,12,13,12,12,13,13,13,13,12,13,12,13, - 13,10,11,11,12,12,11,12,12,12,12,11,12,12,12,12, - 12,12,12,13,13,12,12,12,13,13,11,12,12,12,12,12, - 12,12,12,13,12,12,12,13,13,12,12,13,13,13,12,12, - 13,13,13,11,12,12,12,12,12,12,12,13,13,11,12,12, - 13,12,12,13,13,13,13,12,13,12,13,13,12,12,12,12, - 13,12,12,13,13,13,12,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,12,12,12,13,12,12,12,13,13,13,12, - 12,12,13,13,13,13,13,13,13,12,13,13,13,13,10,11, - 11,12,12,11,12,12,12,12,11,12,12,12,12,12,12,12, - 13,13,12,12,12,13,13,11,12,12,12,12,12,12,12,12, - 13,12,12,12,13,13,12,12,13,13,13,12,12,13,13,13, - 11,12,11,12,12,12,12,12,13,13,11,12,12,13,12,12, - 13,12,13,13,12,13,12,13,13,12,12,12,12,12,12,12, - 13,13,13,12,13,12,13,13,12,13,13,13,13,13,13,13, - 13,13,12,12,12,13,12,12,13,12,13,13,12,13,12,13, - 13,13,13,13,13,13,12,13,12,13,13,10,11,11,12,12, - 11,12,12,12,12,11,12,12,13,12,12,12,12,13,13,12, - 12,12,13,13,11,12,12,12,12,12,12,12,12,13,12,12, - 12,13,13,12,12,13,13,13,12,13,13,13,13,11,12,12, - 12,12,12,12,12,13,13,12,12,12,13,12,12,13,13,13, - 13,12,13,12,13,13,12,12,12,12,13,12,12,13,13,13, - 12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12, - 12,12,12,12,12,13,13,13,13,12,13,12,13,13,13,13, - 13,13,13,13,13,13,13,13,11,11,11,12,12,11,12,12, - 12,12,11,12,12,12,12,12,12,12,13,13,12,12,12,13, - 13,11,12,12,12,12,12,12,12,13,13,12,12,12,13,13, - 12,12,13,13,13,12,13,13,13,13,11,12,12,12,12,12, - 12,12,13,13,12,12,12,13,12,12,13,12,13,13,12,13, - 12,13,13,12,12,12,12,12,12,13,13,13,13,12,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,12,12,12,12, - 12,12,13,13,13,13,12,13,12,13,12,13,13,13,13,13, - 13,13,13,13,12, -}; - -static const static_codebook _44p7_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p7_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p7_p4_1, - 0 -}; - -static const long _vq_quantlist__44p7_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p7_p5_0[] = { - 2, 6, 6, 9, 9, 5, 7, 8,10,11, 5, 8, 7,11,10, 8, - 10,11,12,13, 8,11,10,13,12, 6, 7, 8,10,11, 7, 8, - 10,10,12, 8, 9, 9,12,11,10,10,12,11,14,10,11,12, - 14,13, 6, 8, 7,11,10, 8, 9, 9,11,12, 7,10, 8,12, - 10,10,12,12,13,14,10,12,10,14,11, 9,10,11,11,12, - 10,10,11,11,13,11,12,12,13,13,12,11,13,11,15,13, - 14,13,14,14, 9,11,10,12,11,11,12,12,13,13,10,11, - 10,13,11,13,13,14,14,14,12,13,11,14,11, 7, 8, 9, - 11,12, 9, 9,11,12,13, 9,10,10,13,12,11,12,13,13, - 15,11,12,12,14,14, 9,10,10,12,13,10,10,12,12,14, - 11,11,11,13,13,12,12,13,13,15,12,13,13,15,14, 9, - 10,10,12,13,10,11,11,13,14,10,12,11,14,13,12,13, - 13,14,15,12,13,13,15,14,12,12,13,13,14,12,13,13, - 13,15,13,14,14,14,15,14,14,15,14,16,14,15,15,16, - 16,12,13,13,14,14,13,13,14,15,14,12,13,13,15,14, - 14,15,15,15,16,14,15,14,16,14, 7, 9, 8,12,11, 9, - 10,10,12,13, 9,11, 9,13,12,11,12,12,14,14,11,13, - 12,15,13, 9,10,10,13,12,10,11,12,13,14,10,12,11, - 14,13,12,13,13,14,15,13,13,13,15,14, 9,10,10,13, - 12,11,11,11,13,13,10,12,10,14,12,13,13,13,14,15, - 12,13,12,15,13,12,13,13,14,14,12,13,13,14,15,13, - 14,13,15,15,14,14,15,14,16,14,15,15,16,15,12,13, - 12,14,13,13,13,13,15,14,12,13,13,15,13,14,15,15, - 16,15,14,15,14,16,14,11,12,12,13,14,12,13,14,14, - 15,12,13,13,14,15,14,14,15,15,16,14,15,15,16,16, - 12,13,13,14,15,13,13,14,14,16,13,14,14,15,15,15, - 15,16,15,17,15,15,15,16,16,12,13,13,14,15,13,14, - 14,15,16,13,14,14,15,15,15,15,16,16,17,15,15,15, - 17,16,14,15,15,16,16,15,15,16,15,16,15,16,16,16, - 17,16,16,17,16,18,16,16,17,18,17,14,15,15,16,16, - 15,16,16,16,17,15,16,15,17,16,16,17,17,17,18,16, - 16,16,17,16,11,12,12,14,13,12,13,13,15,14,12,14, - 13,15,14,14,15,15,16,16,14,15,14,16,15,12,13,13, - 15,14,13,14,14,15,15,13,14,14,16,15,15,15,15,16, - 16,15,16,15,17,16,12,13,13,15,14,13,14,14,15,15, - 13,14,13,16,14,15,15,15,16,16,15,15,15,17,15,14, - 15,15,16,16,15,15,15,16,16,15,16,16,17,17,16,16, - 17,17,17,16,17,17,18,17,14,15,15,16,15,15,15,16, - 16,16,15,15,15,17,15,17,17,17,18,17,16,17,16,18, - 16, 6, 9, 9,12,12, 8,10,10,12,13, 9,11,10,13,12, - 10,12,12,14,14,11,13,12,14,14, 8,10,10,12,12, 9, - 10,11,12,14,10,11,11,13,13,12,12,13,13,15,12,13, - 13,15,14, 9,10,10,13,13,10,11,11,13,13,10,12,10, - 14,13,12,13,13,14,15,12,13,13,15,14,11,12,12,13, - 14,12,12,13,13,15,12,13,13,14,14,13,13,14,13,16, - 14,15,15,16,15,11,12,12,14,14,13,13,13,15,14,12, - 13,13,15,14,14,15,15,16,15,14,14,14,16,14, 7, 9, - 10,12,12, 9,10,11,13,13, 9,11,10,13,13,11,12,13, - 14,15,12,13,13,15,14, 9,10,11,12,13,10,10,12,13, - 14,11,11,12,14,14,12,12,14,14,15,13,13,13,15,15, - 9,11,11,13,13,11,12,12,14,14,10,12,10,14,13,13, - 14,13,15,15,12,14,13,15,14,12,12,13,13,15,12,12, - 14,13,15,13,14,14,15,15,14,14,15,14,17,14,15,15, - 16,16,12,13,13,15,14,13,14,14,15,15,12,14,13,15, - 14,14,15,15,16,16,14,15,14,16,14, 7,10,10,12,12, - 10,11,11,12,13,10,12,10,14,12,12,13,13,14,15,12, - 13,13,15,14, 9,11,10,13,12,10,10,12,12,14,11,13, - 12,14,13,13,13,14,13,15,13,14,14,15,14,10,11,11, - 13,13,12,12,12,13,14,10,12,10,14,12,13,14,14,15, - 15,13,14,13,15,13,12,13,13,14,14,12,12,13,14,15, - 13,14,14,15,15,13,13,14,13,15,14,15,15,16,16,12, - 13,13,14,14,13,14,14,15,15,12,13,13,15,13,15,15, - 15,16,16,13,14,13,16,13,11,12,13,14,14,12,13,14, - 14,15,12,13,13,15,15,14,14,15,15,17,14,15,15,16, - 16,12,13,14,14,15,13,13,14,14,16,13,14,14,15,16, - 14,14,16,15,17,15,15,16,16,16,12,13,13,15,15,13, - 14,14,15,16,13,14,14,15,16,15,15,16,17,17,15,16, - 15,17,16,14,15,15,15,16,15,15,16,15,17,15,15,16, - 16,17,16,16,16,16,18,16,16,17,17,17,14,15,15,16, - 16,15,16,16,16,17,15,16,15,17,16,16,17,17,17,17, - 16,17,16,18,17,11,12,12,14,14,13,13,14,14,15,13, - 14,13,15,14,14,15,15,15,16,14,15,15,17,15,12,13, - 13,15,14,13,13,14,15,15,14,15,14,16,15,15,15,15, - 15,16,15,16,15,17,16,12,13,13,15,15,14,14,14,15, - 16,13,14,13,16,15,15,15,16,16,17,15,16,15,17,15, - 14,15,15,16,16,14,15,15,16,16,15,16,16,17,16,15, - 15,16,15,17,16,17,17,18,17,14,15,15,16,16,15,16, - 16,16,17,14,15,15,17,16,17,17,17,17,18,15,16,16, - 18,15, 6, 9, 9,12,12, 9,10,11,12,13, 8,10,10,13, - 12,11,12,13,14,14,10,12,12,14,13, 9,10,10,12,13, - 10,10,12,13,14,10,11,11,13,13,12,13,13,14,15,12, - 13,13,15,14, 8,10,10,12,12,10,11,11,13,13, 9,11, - 10,13,13,12,13,13,14,15,12,13,12,15,13,11,12,12, - 14,14,12,13,13,13,15,13,13,13,14,15,14,14,15,14, - 16,14,15,15,15,15,11,12,12,14,13,12,13,13,15,14, - 12,13,12,15,13,14,14,15,16,16,13,14,13,16,13, 7, - 10,10,12,12,10,10,12,12,14,10,11,11,13,12,12,13, - 13,13,15,12,13,13,15,14,10,11,11,13,13,10,10,12, - 12,14,12,12,12,14,13,13,13,14,13,15,13,14,14,15, - 14, 9,10,11,13,13,11,12,12,13,14,10,12,10,14,12, - 13,13,14,14,15,13,13,12,15,13,12,13,13,14,14,12, - 13,13,14,15,13,14,14,15,15,13,13,15,13,16,15,15, - 15,16,16,12,13,13,14,14,13,14,14,15,15,12,13,12, - 15,14,15,15,15,16,16,13,14,13,15,13, 7,10, 9,12, - 12, 9,10,11,13,13, 9,11,10,13,13,11,13,13,14,15, - 11,13,12,15,14, 9,11,11,13,13,10,10,12,13,14,11, - 12,12,14,14,12,13,14,14,15,13,13,13,15,15, 9,11, - 10,13,12,11,12,11,14,14,10,12,10,14,13,13,14,13, - 15,15,12,14,12,15,14,12,13,13,14,15,13,13,14,14, - 15,13,14,14,15,15,14,14,15,14,17,14,15,15,16,16, - 12,13,12,15,13,13,14,14,15,15,12,14,13,15,13,14, - 15,15,16,16,14,15,14,16,14,11,12,12,14,14,13,13, - 14,14,15,13,14,13,15,15,14,15,15,16,17,14,15,15, - 16,15,12,13,13,15,15,13,13,14,15,16,14,14,14,16, - 15,15,15,16,15,17,15,16,15,17,16,12,13,13,14,15, - 14,14,15,15,16,13,14,13,15,15,15,15,16,16,17,15, - 15,15,16,15,14,15,15,16,16,14,15,15,16,17,15,16, - 16,17,17,16,15,16,15,17,16,17,17,17,17,14,15,15, - 15,16,15,15,16,16,17,14,15,15,16,16,16,16,17,17, - 18,15,16,15,17,15,11,13,12,14,14,12,13,13,15,15, - 12,14,13,15,14,14,15,15,16,16,14,15,14,16,15,12, - 13,13,15,15,13,14,14,15,16,13,14,14,16,16,15,15, - 16,16,17,15,16,15,17,16,12,13,13,15,14,13,14,14, - 16,15,13,14,13,16,14,15,16,15,17,16,15,15,14,18, - 15,14,15,15,16,16,15,15,16,16,17,15,16,15,17,16, - 16,16,17,17,18,16,17,17,18,17,14,15,15,16,15,15, - 16,15,17,16,15,15,15,17,15,16,17,17,18,17,16,17, - 16,18,15,10,12,12,14,14,12,13,13,14,14,12,13,13, - 14,14,13,14,14,15,15,13,14,14,16,15,11,12,13,14, - 14,12,13,13,15,15,12,13,13,15,15,13,14,15,15,16, - 14,15,15,16,16,12,13,13,14,14,13,13,14,15,15,13, - 14,13,15,15,14,15,15,16,16,14,15,14,16,15,13,14, - 14,15,15,13,14,14,15,16,14,14,15,16,16,14,15,15, - 15,17,15,16,16,17,17,13,14,14,15,15,14,15,15,16, - 16,14,15,15,16,16,15,16,16,16,17,15,16,15,17,16, - 11,12,12,14,14,12,13,13,14,15,12,13,13,15,14,13, - 14,14,15,16,13,14,14,16,15,12,13,13,14,15,13,13, - 14,15,15,13,14,14,15,15,14,14,15,15,17,14,15,15, - 16,16,12,13,13,15,15,13,14,14,15,15,13,14,13,15, - 15,14,15,15,16,17,14,15,15,16,16,13,13,14,15,16, - 14,14,15,15,16,14,15,15,16,16,15,15,16,15,18,15, - 16,16,17,17,14,15,15,16,16,15,15,15,16,16,14,15, - 15,17,16,16,16,16,17,17,15,16,16,17,16,10,12,12, - 14,14,12,13,13,14,15,12,13,13,15,14,14,14,15,15, - 16,14,15,14,16,15,12,13,13,15,14,13,13,14,15,15, - 13,14,14,15,15,14,14,15,15,16,14,15,15,16,16,12, - 13,13,15,15,13,14,14,15,16,13,14,13,15,14,15,15, - 15,16,16,14,15,15,16,15,13,14,14,16,15,14,14,14, - 15,16,14,15,15,16,16,15,15,16,15,17,16,17,16,17, - 17,14,14,15,15,16,15,15,16,16,16,14,15,14,16,15, - 16,16,16,17,17,15,16,15,17,15,11,13,13,14,15,13, - 13,14,15,15,13,14,13,15,15,14,15,15,15,16,14,15, - 15,17,15,13,13,14,15,15,13,14,15,15,16,14,14,14, - 16,16,15,14,16,15,17,15,16,16,17,16,13,14,14,15, - 15,14,14,14,16,16,13,15,14,16,15,15,15,16,17,17, - 15,16,15,17,16,14,15,15,15,16,15,15,16,15,17,15, - 16,16,16,17,16,16,17,15,18,16,17,17,17,17,14,15, - 15,16,16,15,16,16,17,17,15,16,15,17,16,16,17,17, - 18,18,16,17,15,18,16,10,12,12,14,14,13,13,14,14, - 15,13,14,13,15,14,14,15,15,15,16,15,15,15,16,15, - 12,13,13,15,14,12,12,14,14,15,14,15,14,16,15,15, - 14,15,14,17,15,16,16,17,16,12,13,13,14,15,14,14, - 15,15,16,13,14,12,16,14,15,16,16,16,17,15,16,14, - 17,15,14,15,14,16,15,14,14,15,15,15,15,16,15,17, - 16,15,14,16,14,16,16,17,17,18,17,14,14,15,15,16, - 15,16,16,16,17,14,15,14,16,15,16,16,17,17,17,15, - 16,14,17,14,10,12,12,14,13,12,13,13,14,14,11,13, - 12,14,14,13,14,14,15,16,13,14,14,16,15,12,13,13, - 14,14,13,13,14,15,15,13,14,13,15,15,14,14,15,15, - 16,14,15,15,16,16,11,13,12,14,14,12,13,13,15,15, - 12,13,13,15,15,14,15,15,16,16,13,14,14,16,15,13, - 14,14,15,15,14,15,15,15,16,14,15,15,16,16,15,16, - 16,16,17,16,16,16,17,17,13,14,14,15,15,14,15,15, - 16,16,13,14,14,16,15,15,16,16,17,17,15,15,15,17, - 15,11,12,12,14,14,12,13,13,14,15,12,13,13,15,14, - 14,14,15,15,16,14,14,14,16,15,12,13,13,15,14,13, - 13,14,15,15,13,14,14,16,15,14,15,15,15,16,15,15, - 15,16,16,12,13,13,14,15,13,13,14,15,15,13,14,13, - 15,15,15,15,15,16,16,14,15,14,16,15,14,14,15,16, - 16,14,15,15,15,16,15,16,15,16,16,15,15,16,15,17, - 16,16,16,17,17,13,14,14,15,16,14,15,15,16,16,14, - 14,14,16,16,16,16,16,17,17,15,15,15,17,15,11,12, - 12,14,14,12,13,13,14,15,12,13,13,15,14,14,14,14, - 15,16,13,14,14,16,15,12,13,13,15,15,13,13,14,15, - 16,13,14,14,15,15,14,15,15,16,17,14,15,15,17,16, - 12,13,13,15,14,13,14,14,15,15,13,14,13,15,15,14, - 15,15,16,16,14,15,14,17,15,14,15,15,16,16,14,15, - 15,16,17,15,15,15,17,17,15,16,16,16,17,16,17,16, - 17,17,13,15,14,16,15,14,15,15,16,16,14,15,14,16, - 15,16,16,16,17,17,15,16,15,17,15,10,12,12,14,14, - 13,13,14,14,15,13,14,13,15,14,14,15,15,15,17,14, - 15,15,16,15,12,13,13,15,14,12,12,14,14,15,14,15, - 14,16,15,15,14,16,15,17,15,16,16,17,16,12,13,13, - 14,15,14,14,15,15,16,12,14,12,15,14,15,16,16,16, - 17,15,16,14,17,14,14,15,14,16,16,14,14,15,15,16, - 15,16,16,17,16,15,14,16,14,17,16,17,17,18,17,14, - 14,15,15,16,15,15,16,16,17,14,15,14,16,15,16,17, - 17,17,18,15,16,14,17,14,11,13,13,15,14,13,13,14, - 15,15,12,14,13,15,15,14,15,15,15,17,14,15,14,16, - 15,13,14,14,15,15,13,14,15,15,16,14,15,14,16,16, - 15,15,16,16,17,15,16,16,17,17,13,14,13,15,15,14, - 14,14,16,16,13,15,14,16,15,15,16,16,17,17,15,16, - 14,17,15,15,15,15,16,17,15,15,16,16,17,15,16,16, - 17,17,16,15,17,16,17,17,17,17,18,18,14,15,15,17, - 15,15,16,16,17,16,15,16,15,17,15,16,17,17,17,17, - 16,17,15,18,15, -}; - -static const static_codebook _44p7_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p7_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p7_p5_0, - 0 -}; - -static const long _vq_quantlist__44p7_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p7_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p7_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p7_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p7_p5_1, - 0 -}; - -static const long _vq_quantlist__44p7_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p6_0[] = { - 2, 5, 6, 5, 7, 8, 5, 8, 7, 5, 7, 7, 7, 7, 9, 8, - 9, 9, 5, 7, 7, 8, 9, 9, 7, 9, 7, 6, 8, 8, 8, 9, - 10, 8, 9, 9, 8, 9,10, 9, 9,11,10,10,11, 8,10, 9, - 10,10,11, 9,10,10, 6, 8, 8, 8, 9, 9, 8,10, 9, 8, - 9,10, 9,10,10,10,11,10, 8,10, 9,10,11,10, 9,11, - 9, 6, 8, 8, 7, 9, 9, 8, 9, 9, 7, 9, 9, 9, 9,10, - 9,10,10, 8, 9, 9, 9,10,10, 9,10, 9, 7, 9, 9, 9, - 10,10, 9,10,10, 9, 9,10,10, 9,11,10,11,11, 9,10, - 10,10,11,11,10,11,10, 6, 9, 8, 9,10,10, 9,10, 9, - 8,10,10, 9, 9,10,10,11,11, 9,10,10,10,11,11, 9, - 11, 9, 6, 8, 8, 8, 9, 9, 7, 9, 9, 8, 9, 9, 9, 9, - 10, 9,10,10, 7, 9, 9, 9,10,10, 9,10, 9, 6, 8, 9, - 9, 9,10, 9,10,10, 9,10,10, 9, 9,11,10,11,11, 8, - 10,10,10,11,11, 9,10, 9, 7, 9, 9, 9,10,10, 9,10, - 10, 9,10,10,10,10,11,10,11,11, 9,10, 9,10,11,11, - 10,11, 9, -}; - -static const static_codebook _44p7_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p7_p6_0, - 0 -}; - -static const long _vq_quantlist__44p7_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p6_1[] = { - 4, 7, 7, 6, 7, 8, 6, 8, 7, 7, 7, 8, 7, 7, 8, 8, - 8, 8, 7, 7, 7, 8, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, - 8, 9, 9, 8, 9, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, - 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, - 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, 8, 7, 8, 8, 8, - 8, 9, 8, 9, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, - 8, 9, 9, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, - 9, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, 8, 7, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, - 8, 8, 8, 9, 9, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, 9, 9, 9, - 8, 9, 8, -}; - -static const static_codebook _44p7_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p7_p6_1, - 0 -}; - -static const long _vq_quantlist__44p7_p7_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p7_0[] = { - 1, 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p7_p7_0 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p7_0, - 1, -513979392, 1633504256, 2, 0, - (long *)_vq_quantlist__44p7_p7_0, - 0 -}; - -static const long _vq_quantlist__44p7_p7_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p7_p7_1[] = { - 1, 5, 5, 4,10,10, 5,10,10, 5,10,10,10,10,10,10, - 10,10, 5,10,10,10,10,10, 9,10,10, 6,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10, 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, 6,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10, 6,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,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, -}; - -static const static_codebook _44p7_p7_1 = { - 5, 243, - (long *)_vq_lengthlist__44p7_p7_1, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44p7_p7_1, - 0 -}; - -static const long _vq_quantlist__44p7_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p7_p7_2[] = { - 1, 3, 2, 4, 5, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,14,14,15,15,15,15, -}; - -static const static_codebook _44p7_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p7_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p7_p7_2, - 0 -}; - -static const long _vq_quantlist__44p7_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p7_p7_3[] = { - 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p7_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p7_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p7_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p7_short[] = { - 3, 9,14,16,17,19,22,22, 5, 4, 6, 9,11,13,17,20, - 9, 5, 5, 6, 9,11,15,19,11, 7, 5, 5, 7, 9,13,17, - 14, 9, 7, 6, 6, 7,11,14,16,11, 9, 7, 6, 4, 4, 8, - 19,15,13,11, 9, 4, 3, 4,21,16,16,15,12, 6, 4, 4, -}; - -static const static_codebook _huff_book__44p7_short = { - 2, 64, - (long *)_huff_lengthlist__44p7_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p8_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p8_l0_0[] = { - 2, 4, 4, 7, 7, 8, 8,10,10,11,11,12,12, 4, 5, 5, - 7, 7, 9, 9,10, 9,12,10,12,12, 4, 5, 5, 7, 7, 9, - 9, 9,10,10,12,12,12, 7, 7, 7, 7, 8, 9, 8,11, 5, - 12, 6,12,10, 7, 7, 7, 8, 7, 8, 9, 5,11, 6,12,10, - 12, 8, 9, 9, 9, 9, 9, 9,11, 7,11, 7,11, 9, 8, 9, - 9, 9, 9, 9, 9, 7,10, 7,11, 9,11,10,10,10,10,10, - 10,10,11,10,11, 8,12, 9,10,10,10,10,10,10,10,10, - 11, 8,11, 9,12,10,11,11,11,11,11,11,11,11,12,10, - 12,11,10,11,11,11,11,11,11,11,11,10,12,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,11,12,12,12, - 12,12,12,12,12,12,11,12,12, -}; - -static const static_codebook _44p8_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p8_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p8_l0_0, - 0 -}; - -static const long _vq_quantlist__44p8_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p8_l0_1[] = { - 4, 4, 4, 5, 5, 4, 4, 5, 5, 5, 4, 5, 4, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p8_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p8_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p8_l0_1, - 0 -}; - -static const long _vq_quantlist__44p8_l1_0[] = { - 54, - 29, - 79, - 0, - 108, -}; - -static const long _vq_lengthlist__44p8_l1_0[] = { - 1, 2, 3, 6, 7, 7, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, -}; - -static const static_codebook _44p8_l1_0 = { - 2, 25, - (long *)_vq_lengthlist__44p8_l1_0, - 1, -514516992, 1620639744, 7, 0, - (long *)_vq_quantlist__44p8_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p8_lfe[] = { - 2, 3, 1, 3, -}; - -static const static_codebook _huff_book__44p8_lfe = { - 2, 4, - (long *)_huff_lengthlist__44p8_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p8_long[] = { - 2, 7,14,16,17,18,20,21, 7, 4, 6, 8,11,12,14,16, - 13, 5, 4, 4, 8, 9,11,13,15, 8, 4, 3, 5, 7, 9,10, - 17,11, 8, 4, 4, 6, 9, 9,17,11, 9, 7, 6, 5, 7, 8, - 19,13,11, 9, 9, 7, 8, 8,21,15,13,11,10, 8, 8, 7, -}; - -static const static_codebook _huff_book__44p8_long = { - 2, 64, - (long *)_huff_lengthlist__44p8_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p8_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p8_p1_0[] = { - 2, 5, 5, 4, 7, 7, 4, 7, 7, 5, 7, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 8, 6, 7, 8, 8, 9, - 10, 8, 9,10, 8, 9,10,10,10,12,10,11,12, 8,10,10, - 10,11,12,10,11,11, 6, 8, 7, 8,10, 9, 8,10, 9, 8, - 10,10,10,11,11,10,12,11, 8,10, 9,10,12,11,10,12, - 10, 5, 8, 8, 8,10,10, 8,10,10, 7, 9,10, 9,10,11, - 9,11,11, 8,10,10,10,12,12,10,12,11, 7, 9, 9, 9, - 10,11, 9,11,11, 9, 9,11,10,11,12,10,11,12, 9,11, - 11,11,12,12,11,12,12, 7, 9, 9,10,11,11,10,12,11, - 9,11,10,11,11,12,11,13,12,10,11,11,12,13,13,11, - 13,11, 5, 8, 8, 8,10,10, 8,10,10, 8,10,10,10,11, - 12,10,12,11, 7,10, 9, 9,11,11, 9,11,10, 7, 9, 9, - 10,11,12,10,11,11,10,11,11,11,11,13,12,13,13, 9, - 10,11,12,12,13,11,12,11, 7, 9, 9, 9,11,11, 9,11, - 10, 9,11,11,11,12,12,11,12,12, 9,11, 9,10,12,11, - 10,12,11, -}; - -static const static_codebook _44p8_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p8_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p8_p1_0, - 0 -}; - -static const long _vq_quantlist__44p8_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p8_p2_0[] = { - 4, 6, 6, 9, 9, 6, 8, 8,10,10, 6, 8, 8,10,10, 8, - 9,10,12,12, 8,10, 9,12,12, 6, 8, 8,10,10, 8, 8, - 9,10,11, 8, 9, 9,11,11, 9,10,11,12,13,10,11,11, - 13,13, 6, 8, 8,10,10, 8, 9, 9,11,11, 8, 9, 8,11, - 10,10,11,11,13,13, 9,11,10,13,12, 9,10,10,12,12, - 10,10,11,12,13,10,11,11,13,13,12,12,13,12,15,12, - 13,13,15,14, 9,10,10,12,12,10,11,11,13,13,10,11, - 10,13,12,12,13,13,14,15,12,13,12,15,12, 7, 8, 8, - 10,11, 8, 9,10,11,12, 8, 9, 9,11,11,10,11,11,13, - 14,10,11,11,13,13, 8, 9, 9,11,12, 9,10,11,11,13, - 9,10,10,12,12,11,11,12,13,15,11,12,12,14,14, 8, - 9, 9,11,11, 9,10,11,12,13, 9,10,10,12,12,11,12, - 12,14,15,11,12,12,14,14,10,11,12,13,13,11,12,12, - 13,14,12,12,12,14,14,13,13,14,14,16,14,14,14,16, - 15,10,11,11,13,13,12,12,12,14,14,11,12,12,14,13, - 14,14,14,15,16,13,14,13,16,14, 7, 8, 8,11,10, 8, - 9, 9,11,11, 8,10, 9,12,11,10,11,11,13,13,10,11, - 11,14,13, 8, 9, 9,12,11, 9,10,10,12,12, 9,11,10, - 13,12,11,12,12,13,14,11,12,12,15,14, 8, 9, 9,12, - 11, 9,10,10,12,12, 9,11,10,13,11,11,12,12,14,14, - 11,12,12,14,13,10,11,11,13,13,11,12,12,13,14,12, - 13,12,14,14,13,13,14,14,16,13,14,14,16,15,10,11, - 11,13,13,12,12,12,14,14,11,12,12,14,13,13,14,14, - 15,15,13,14,13,16,14, 9,10,11,12,13,11,11,12,12, - 14,11,11,12,13,14,13,13,14,14,16,13,13,14,15,15, - 11,11,12,12,14,12,12,13,13,15,12,12,13,13,15,14, - 14,15,15,16,14,14,14,15,16,11,12,12,13,14,12,12, - 13,14,15,12,13,12,14,14,14,14,15,15,16,14,14,14, - 16,16,13,13,14,15,16,14,14,15,15,16,14,15,15,16, - 16,15,15,16,16,18,16,16,16,17,17,13,14,14,15,15, - 14,14,15,16,16,14,15,14,16,16,16,16,16,17,18,15, - 16,16,17,16, 9,11,10,13,12,11,12,11,14,13,11,12, - 11,14,12,13,14,13,15,14,13,14,13,16,14,11,12,12, - 14,13,12,12,13,14,14,12,13,12,15,14,14,14,14,16, - 16,14,15,14,17,15,11,12,11,14,12,12,13,12,15,13, - 12,13,12,15,13,14,14,14,16,15,14,15,14,16,15,13, - 14,14,15,15,14,14,15,16,16,14,15,14,16,16,15,15, - 16,16,17,16,16,16,17,17,13,14,14,16,15,14,15,15, - 16,16,14,15,14,17,15,16,16,16,17,17,15,16,15,18, - 16, 7, 8, 8,10,11, 8, 9, 9,11,12, 8, 9, 9,12,11, - 10,11,11,13,14,10,11,11,14,13, 8, 9, 9,11,11, 9, - 10,10,12,12, 9,10,10,12,12,11,12,12,13,14,11,12, - 12,14,14, 8, 9, 9,12,11, 9,10,11,12,13, 9,11,10, - 13,12,11,12,12,14,14,11,12,12,14,13,10,11,11,13, - 13,11,12,12,13,14,11,12,12,14,14,13,13,14,14,16, - 13,14,14,16,15,10,12,11,13,13,12,12,12,14,14,11, - 12,12,14,13,14,14,14,15,16,13,14,14,16,14, 8, 9, - 9,11,11, 9,10,10,12,12, 9,10,10,12,12,11,11,12, - 13,14,11,12,12,14,14, 9, 9,10,11,12,10,10,11,12, - 13,10,10,11,12,13,12,12,13,14,15,12,12,13,14,15, - 9,10,10,12,12,10,11,11,13,13,10,11,11,13,13,12, - 13,13,15,15,12,13,13,15,14,11,11,12,13,14,12,12, - 13,13,15,12,12,13,14,15,14,14,15,14,16,14,14,15, - 15,16,11,12,12,14,14,12,13,13,15,15,12,13,13,15, - 14,14,15,15,16,16,14,15,14,17,15, 8, 9, 9,11,11, - 9,10,10,12,12, 9,11,10,13,12,11,12,12,14,14,11, - 13,12,15,13, 9,10,10,12,12,10,10,11,12,13,10,12, - 11,13,13,12,12,13,13,15,12,13,13,15,14, 9,10,10, - 12,12,11,11,12,13,13,10,12,10,13,12,12,13,13,15, - 15,12,13,13,15,13,11,12,12,14,14,12,12,13,14,14, - 12,13,13,15,14,13,13,14,13,16,14,15,14,16,16,11, - 12,12,14,14,13,13,13,15,15,12,13,12,15,14,14,15, - 15,16,17,14,15,13,16,13,10,11,11,13,14,11,12,12, - 13,15,11,12,12,14,14,13,14,14,15,16,13,14,14,16, - 16,11,11,12,12,14,12,12,13,13,15,12,13,13,13,15, - 14,14,15,14,17,14,14,15,15,16,11,12,12,14,14,12, - 13,13,15,15,12,13,13,15,15,14,15,15,16,17,14,15, - 15,16,16,13,14,14,14,16,14,14,15,14,17,14,15,15, - 14,17,16,16,17,15,18,16,16,17,16,18,13,14,14,16, - 16,14,15,15,17,16,14,15,15,17,16,16,17,17,18,18, - 16,17,16,18,17,10,11,11,14,13,11,12,12,14,14,11, - 13,12,15,14,14,14,14,16,15,14,15,14,16,15,11,12, - 12,14,13,12,13,13,15,14,13,14,13,15,14,14,15,15, - 16,16,14,15,15,17,15,11,12,12,14,14,13,13,13,15, - 15,12,13,13,15,14,15,15,15,17,17,14,15,15,17,15, - 13,14,14,16,15,14,15,15,16,16,15,15,15,17,16,16, - 16,16,16,17,16,17,16,18,17,14,14,14,16,16,15,15, - 15,16,16,14,15,14,17,16,16,17,17,17,18,16,17,16, - 18,16, 7, 8, 8,11,11, 8, 9, 9,11,12, 8, 9, 9,12, - 11,10,11,11,13,14,10,11,11,14,13, 8, 9, 9,11,12, - 9,10,11,12,13, 9,11,10,13,12,11,12,12,13,14,11, - 12,12,14,14, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, - 10,13,12,11,12,12,14,14,11,12,11,14,13,10,11,12, - 13,13,11,12,12,13,14,12,13,12,14,14,13,13,14,14, - 16,13,14,14,16,15,10,11,11,13,13,11,12,12,14,14, - 11,12,12,14,13,13,14,14,15,16,13,14,13,16,14, 8, - 9, 9,11,11, 9,10,11,12,13, 9,10,10,12,12,11,12, - 13,13,14,11,12,12,14,14, 9,10,10,12,12,10,10,11, - 12,13,11,12,11,13,13,12,12,13,13,15,12,13,13,15, - 15, 9,10,10,12,12,10,11,12,13,14,10,11,10,13,12, - 12,13,13,14,15,12,13,12,15,13,12,12,12,14,14,12, - 12,13,14,15,13,13,13,15,15,14,14,15,13,16,14,15, - 15,16,16,11,12,12,14,14,12,13,13,14,15,12,13,12, - 14,14,14,14,15,16,16,13,14,13,16,14, 8, 9, 9,11, - 11, 9,10,10,12,12, 9,10,10,12,12,11,12,12,14,14, - 11,12,11,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,15,14, 9,10, - 9,12,11,10,11,10,13,12,10,11,10,13,12,12,13,12, - 15,14,12,13,12,15,14,11,12,12,14,14,12,13,13,14, - 15,12,13,13,15,15,14,14,15,15,17,14,15,15,16,16, - 11,12,11,14,13,12,13,12,15,14,12,13,12,15,13,14, - 15,14,16,15,13,15,14,17,14,10,11,11,13,14,11,12, - 13,13,15,11,12,12,14,14,14,14,15,15,17,13,14,14, - 15,16,11,12,12,14,14,12,12,13,14,15,13,13,13,15, - 15,14,15,15,15,17,15,15,15,16,16,11,12,12,13,14, - 13,13,14,14,15,12,13,13,14,15,14,15,15,16,17,14, - 15,15,16,16,14,14,14,16,16,14,14,15,15,17,15,15, - 15,17,16,16,16,17,16,18,16,17,17,18,17,13,14,14, - 15,16,14,15,15,16,17,14,15,15,16,16,16,17,17,17, - 18,16,16,16,17,16,10,11,11,14,13,11,12,12,14,14, - 11,12,12,15,13,13,14,14,16,15,13,14,14,16,15,11, - 12,12,14,14,12,13,13,15,15,12,13,13,15,15,14,15, - 15,16,17,14,15,15,17,16,11,12,11,14,12,12,13,13, - 15,13,12,13,12,15,13,14,15,15,16,15,14,15,14,17, - 14,13,14,14,16,16,14,15,15,16,17,14,15,15,16,17, - 16,16,17,17,18,16,17,17,18,18,13,14,14,16,13,14, - 15,15,17,14,14,15,14,17,14,16,17,16,17,16,16,17, - 16,18,15, 8,11,11,13,13,10,12,12,14,14,11,12,12, - 14,14,13,13,14,15,16,13,14,14,16,15,10,11,11,14, - 14,11,12,12,14,15,11,12,12,15,14,13,14,14,15,16, - 13,14,14,16,16,11,12,12,14,14,12,13,13,15,15,12, - 13,12,15,14,14,14,15,16,16,14,15,14,16,16,12,13, - 13,15,15,12,13,14,15,16,13,14,14,16,16,14,15,15, - 16,17,15,15,16,17,17,13,14,14,16,15,14,15,15,16, - 16,14,15,14,16,16,16,16,16,17,17,15,16,16,18,16, - 10,11,11,13,14,11,12,12,14,15,11,12,12,15,14,13, - 14,14,16,16,13,14,14,16,16,11,11,12,14,14,12,12, - 13,14,15,12,13,13,15,15,14,14,15,15,17,14,14,15, - 16,16,11,12,12,15,14,12,13,13,15,15,12,13,13,15, - 15,14,15,15,17,17,14,15,15,17,16,13,12,14,14,16, - 13,13,15,14,17,14,13,15,15,17,15,14,16,15,18,16, - 15,16,16,18,13,14,14,16,16,14,15,15,17,17,14,15, - 15,17,16,16,17,17,18,18,16,17,16,18,17,10,11,11, - 14,13,11,12,12,14,14,11,13,12,15,14,13,14,14,15, - 16,13,14,14,16,16,11,12,12,14,14,12,13,13,14,15, - 12,13,13,15,15,14,14,15,15,16,14,15,15,17,16,11, - 12,12,14,14,13,13,13,15,15,12,13,13,15,14,14,15, - 15,16,17,14,15,14,17,15,13,14,13,16,15,14,14,14, - 15,16,14,15,14,16,16,15,15,16,16,17,16,16,16,18, - 17,14,14,14,16,16,15,15,15,17,16,14,15,14,17,16, - 16,16,17,17,18,16,17,16,18,16,11,13,13,15,15,12, - 13,14,15,16,12,14,14,15,15,14,15,15,16,17,14,15, - 15,17,17,12,13,14,14,16,13,14,14,14,16,14,14,14, - 15,16,15,15,16,15,18,15,16,16,17,17,13,14,14,16, - 16,14,14,15,16,16,14,15,14,16,16,15,16,16,17,18, - 15,16,16,18,17,14,14,16,13,17,15,15,16,14,18,15, - 15,16,14,18,16,16,18,15,19,17,17,18,16,18,15,16, - 15,17,17,15,16,17,18,18,16,16,16,18,17,17,18,18, - 19,19,17,18,17,19,18,11,12,12,15,14,13,13,14,15, - 16,13,14,13,16,14,15,15,15,16,17,15,16,15,17,16, - 12,13,13,15,14,13,13,14,15,15,14,15,14,16,15,15, - 15,16,16,17,16,16,16,18,17,12,13,13,15,15,14,14, - 15,16,16,13,14,13,16,15,16,16,16,17,18,15,16,15, - 17,16,14,15,14,17,15,14,15,15,16,16,15,16,15,17, - 16,16,15,16,15,17,17,18,17,18,17,15,15,15,16,17, - 16,16,16,17,17,15,16,15,17,16,17,18,18,18,18,16, - 17,16,18,15, 8,11,11,13,13,11,12,12,14,14,10,12, - 12,14,14,13,14,14,15,16,13,14,13,16,15,11,12,12, - 14,14,12,12,13,14,15,12,13,13,15,15,14,14,15,15, - 16,14,14,14,16,16,10,11,11,14,14,11,12,12,14,15, - 11,12,12,15,14,13,14,14,16,16,13,14,14,16,15,13, - 14,14,15,16,14,14,15,16,16,14,15,15,16,16,15,16, - 16,16,18,16,16,16,17,17,12,13,13,15,15,13,14,14, - 16,16,12,14,13,16,15,15,16,15,17,17,14,16,15,17, - 16,10,11,11,13,14,11,12,13,14,15,11,13,12,14,14, - 14,14,15,16,16,13,14,14,16,16,11,12,12,14,14,12, - 13,13,14,15,13,14,13,15,15,14,15,15,16,17,14,15, - 15,17,16,11,12,12,14,14,12,13,13,15,15,12,13,12, - 15,14,14,15,15,16,17,14,15,15,16,16,14,14,14,16, - 16,14,14,15,16,16,15,15,15,16,16,16,16,17,16,18, - 16,17,17,18,18,13,13,14,15,16,14,14,15,16,17,13, - 14,14,16,16,16,16,17,17,18,15,16,15,17,16,10,11, - 11,14,13,11,12,12,14,14,11,12,12,15,14,13,14,14, - 16,16,13,14,14,16,16,11,12,12,14,14,12,13,13,15, - 15,12,13,13,15,15,14,15,15,16,17,14,15,15,17,16, - 11,12,11,14,14,12,13,13,15,15,12,13,12,15,14,14, - 15,14,16,16,14,15,14,17,16,14,14,14,16,16,14,15, - 15,16,17,14,15,15,17,17,16,16,17,17,18,16,17,17, - 18,18,13,14,12,16,14,14,15,13,17,15,13,15,13,17, - 14,16,16,15,18,16,15,17,14,18,15,11,12,12,14,15, - 13,13,14,14,16,13,14,13,15,14,15,15,16,16,17,15, - 16,15,17,16,12,13,13,15,15,13,13,14,15,16,14,15, - 14,16,16,15,15,16,15,18,16,16,16,18,17,12,13,13, - 15,15,14,14,15,15,16,13,14,13,15,15,16,16,16,16, - 18,15,16,15,17,16,15,15,15,17,16,15,15,16,16,17, - 16,16,16,18,17,16,16,17,15,18,17,18,17,19,18,14, - 14,15,15,17,15,15,16,16,17,14,15,15,16,16,17,17, - 18,17,19,16,17,15,17,15,11,13,12,15,15,12,14,14, - 15,15,12,14,13,16,15,15,15,15,17,17,14,15,15,17, - 16,12,14,14,16,16,14,14,15,16,16,14,14,14,16,16, - 15,16,17,17,18,15,16,16,18,17,12,14,13,16,14,13, - 14,14,16,15,13,15,14,16,14,15,16,16,17,17,15,16, - 15,18,15,15,15,16,17,17,15,16,16,17,18,16,16,16, - 18,18,17,17,18,18,19,17,17,18,19,19,14,15,14,17, - 13,15,16,15,18,14,15,16,15,18,14,17,18,17,18,16, - 16,18,16,19,15, -}; - -static const static_codebook _44p8_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p8_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p8_p2_0, - 0 -}; - -static const long _vq_quantlist__44p8_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p8_p3_0[] = { - 2, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 8, 5, 7, 8, 7, 9, - 10, 8, 9, 9, 8, 9,10, 9,10,12,10,11,11, 8,10, 9, - 10,11,12, 9,11,10, 5, 8, 7, 8,10, 9, 7,10, 9, 8, - 9,10, 9,10,11,10,12,11, 8,10, 9,10,11,11, 9,12, - 10, 5, 8, 8, 7, 9,10, 8,10, 9, 7, 9,10, 9,10,11, - 9,11,11, 8,10, 9,10,11,11,10,12,10, 7, 9,10, 9, - 10,12, 9,11,11, 9, 9,12,11,10,13,11,11,13,10,12, - 11,11,13,13,11,13,12, 7, 9, 9, 9,11,11, 9,12,11, - 9,11,10,10,11,12,11,13,12, 9,11,11,12,13,13,11, - 13,11, 5, 8, 8, 8, 9,10, 7,10, 9, 8, 9,10,10,10, - 12,10,11,11, 7,10, 9, 9,11,11, 9,11,10, 7, 9, 9, - 9,11,12, 9,11,11, 9,11,11,11,11,13,12,13,13, 9, - 10,11,11,12,13,10,12,11, 7,10, 9, 9,11,11, 9,12, - 10,10,11,12,11,12,13,12,13,13, 9,12, 9,11,13,11, - 10,13,10, -}; - -static const static_codebook _44p8_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p8_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p8_p3_0, - 0 -}; - -static const long _vq_quantlist__44p8_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p8_p3_1[] = { - 6, 7, 7, 7, 7, 8, 7, 8, 7, 7, 7, 8, 7, 8, 8, 8, - 8, 8, 7, 8, 7, 7, 8, 8, 7, 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, 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, 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, 7, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 8, 8, - 8, 8, 9, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 9, 9, 8, - 9, 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, 7, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, - 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, 8, 9, 8, - 8, 9, 8, -}; - -static const static_codebook _44p8_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p8_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p8_p3_1, - 0 -}; - -static const long _vq_quantlist__44p8_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p8_p4_0[] = { - 2, 5, 5, 4, 7, 8, 4, 8, 7, 5, 7, 8, 7, 7,10, 8, - 9, 9, 5, 7, 7, 8, 9, 9, 7,10, 7, 5, 7, 8, 8, 9, - 11, 8,10,10, 8, 9,10,10,10,12,11,12,12, 8,10,10, - 10,12,12,10,12,11, 5, 8, 7, 8,10,10, 8,11, 9, 8, - 10,10,10,11,12,10,12,12, 8,10, 9,11,12,12,10,12, - 10, 5, 8, 8, 7,10,10, 8,11,10, 7, 9,10, 9,10,12, - 10,12,12, 8,10,10,10,12,12,10,12,11, 7, 9,10, 9, - 11,12,10,12,11, 9, 9,12,10,10,13,12,12,13,10,12, - 11,12,13,13,11,13,11, 7,10, 9,10,11,12,10,13,11, - 9,11,11,11,11,13,12,14,13,10,11,11,12,14,14,11, - 14,11, 5, 8, 8, 8,10,11, 7,10,10, 8,10,10,10,11, - 12,10,12,12, 7,10, 9,10,12,12, 9,12,10, 7, 9,10, - 10,11,13,10,12,11,10,11,11,11,11,14,12,14,14, 9, - 11,11,12,13,14,11,13,11, 7,10, 9,10,11,12, 9,12, - 10,10,11,12,11,11,13,12,13,13, 9,12, 9,12,13,12, - 10,13,10, -}; - -static const static_codebook _44p8_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p8_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p8_p4_0, - 0 -}; - -static const long _vq_quantlist__44p8_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p8_p4_1[] = { - 7, 9, 9,10,10, 9,10,10,10,11, 9,10,10,11,10, 9, - 10,10,11,11, 9,10,10,11,11, 9,10,10,11,11,10,10, - 10,11,11,10,10,10,11,11,10,11,11,11,11,10,11,11, - 11,11, 9,10,10,11,11,10,10,10,11,11, 9,10,10,11, - 11,10,11,11,11,11,10,11,11,11,11,10,11,11,11,11, - 10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,12,10,11,11,11,11,11,11,11,11,11,10,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11, 9,10,10, - 11,11,10,10,11,11,11,10,10,11,11,11,10,11,11,11, - 12,10,11,11,12,12,10,10,11,11,11,10,11,11,11,12, - 11,11,11,12,12,11,11,12,12,12,11,11,12,12,12,10, - 11,11,11,11,11,11,11,12,12,10,11,11,12,12,11,12, - 11,12,12,11,12,11,12,12,11,11,11,11,12,11,11,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,11,11,12,12,11,12,12,12,12,11,12,11,12,12, - 12,12,12,12,12,12,12,12,12,12, 9,10,10,11,11,10, - 11,10,11,11,10,11,10,11,11,10,11,11,12,12,10,11, - 11,12,11,10,11,11,11,11,10,11,11,11,12,11,11,11, - 12,12,11,11,12,12,12,11,11,11,12,12,10,11,10,11, - 11,11,11,11,12,12,10,11,11,12,11,11,12,11,12,12, - 11,12,11,12,12,11,11,11,12,12,11,11,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,11, - 11,12,11,11,12,12,12,12,11,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,10,11,11,11,11,11,11,11,12, - 12,11,11,11,12,12,11,12,12,12,12,11,12,12,12,12, - 11,11,11,12,12,11,11,12,12,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,11,11,11,12,12,11,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,13,12,13,12,12,12,12,13,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,12,10,11,11,11,11,11,11,11,12,12,11,11, - 11,12,12,11,12,12,12,12,11,12,12,12,12,11,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,11,11,11,12,12,11,12,12,12,12, - 11,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,13,12,12,13,12,13, - 12, 9,10,10,11,11,10,10,11,11,11,10,11,10,11,11, - 10,11,11,12,12,10,11,11,12,12,10,10,11,11,11,10, - 11,11,11,12,10,11,11,12,12,11,11,12,12,12,11,11, - 11,12,12,10,11,10,11,11,11,11,11,12,12,10,11,11, - 12,11,11,12,11,12,12,11,12,11,12,12,11,11,11,11, - 12,11,11,12,12,12,11,12,12,12,12,11,12,12,12,12, - 11,12,12,12,12,11,11,11,12,11,11,12,12,12,12,11, - 12,11,12,12,12,12,12,12,12,12,12,12,12,12,10,10, - 11,11,11,10,11,11,12,12,10,11,11,12,12,11,11,11, - 12,12,11,11,12,12,12,10,11,11,11,12,11,11,12,12, - 12,11,11,12,12,12,11,11,12,12,12,11,12,12,12,12, - 11,11,11,12,12,11,12,12,12,12,11,12,11,12,12,11, - 12,12,12,12,11,12,12,12,12,11,11,12,12,12,11,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, 9,10,10,11,11, - 10,11,11,11,12,10,11,11,12,11,11,12,11,12,12,11, - 12,11,12,12,10,11,11,12,11,11,11,11,12,12,11,12, - 11,12,12,11,12,12,12,12,11,12,12,12,12,10,11,11, - 12,12,11,12,11,12,12,11,12,11,12,12,12,12,12,12, - 12,11,12,12,12,12,11,12,11,12,12,11,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,11,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,11,11,11,12,12,11,12,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,13,12,12,12,12,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,13,13,12,12, - 12,13,13,12,12,12,12,12,12,12,12,12,13,12,12,12, - 12,13,12,12,13,12,13,12,13,13,13,13,12,12,12,12, - 12,12,12,12,13,12,12,12,12,13,12,12,13,13,13,13, - 12,13,13,13,13,10,11,11,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,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,11,12,12,12,12,12,12,12,12, - 12,12,12,12,13,12,12,12,12,13,13,12,12,12,13,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,12, - 13,13,12,13,12,13,13,13,13,12,12,12,12,12,12,12, - 12,13,12,12,12,12,13,12,12,13,13,13,13,12,13,13, - 13,13, 9,10,10,11,11,10,10,11,11,11,10,11,10,11, - 11,10,11,11,12,12,10,11,11,12,12,10,11,11,11,11, - 10,11,11,12,12,11,11,11,12,12,11,11,12,12,12,11, - 11,12,12,12,10,11,10,11,11,10,11,11,12,12,10,11, - 11,12,11,11,12,11,12,12,11,11,11,12,12,11,11,11, - 11,12,11,11,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,11,11,11,12,11,11,12,12,12,12, - 11,12,11,12,12,12,12,12,12,12,11,12,12,12,12, 9, - 10,10,11,11,10,11,11,11,12,10,11,11,12,11,11,11, - 12,12,12,11,11,12,12,12,10,11,11,12,12,11,11,12, - 12,12,11,11,12,12,12,12,12,12,12,12,12,12,12,12, - 12,10,11,11,12,12,11,11,11,12,12,11,11,11,12,12, - 11,12,12,12,12,11,12,12,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,11,11,12,12,12,12,12,12,12,12,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,10,11,10,11, - 11,10,11,11,12,12,10,11,11,12,12,11,11,11,12,12, - 11,12,11,12,12,11,11,11,12,12,11,11,12,12,12,11, - 11,12,12,12,11,12,12,12,12,11,12,12,12,12,10,11, - 11,12,11,11,12,11,12,12,11,12,11,12,12,11,12,12, - 12,12,11,12,11,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, - 11,12,11,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,12,12,11,11, - 12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,11,12,12,12,12,12,12,12,12,13,12,12,12,12, - 12,12,12,12,13,13,12,12,12,13,13,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,12, - 12,12,12,12,12,12,12,12,12,12,12,13,12,13,12,12, - 12,13,13,12,13,13,12,13,12,13,13,13,13,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13, - 13,12,13,12,13,12,11,11,11,12,12,11,12,12,12,12, - 11,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,13,13,12,12,12,13,13,11,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,12,12,12,12,13, - 12,12,12,12,12,12,12,12,12,13,13,12,12,12,12,13, - 12,13,13,13,13,12,13,13,13,13,12,12,12,12,12,12, - 12,12,13,12,12,12,12,13,12,12,13,13,13,13,12,13, - 13,13,12,10,11,11,12,12,11,11,11,12,12,11,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,11,11,11,12, - 12,11,11,12,12,12,11,12,12,12,12,11,12,12,12,12, - 12,12,12,12,12,11,11,11,12,12,11,12,12,12,12,11, - 12,11,12,12,12,12,12,12,12,12,12,12,12,12,11,12, - 12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12, - 12,13,12,12,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12, - 11,11,11,12,12,11,12,12,12,12,11,12,12,12,12,12, - 12,12,12,12,11,12,12,12,12,11,11,12,12,12,11,12, - 12,12,12,12,12,12,12,12,12,12,12,12,13,12,12,12, - 13,13,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,13,13,12,12,12,13,13,12,12,12,12,12, - 12,12,12,12,13,12,12,12,12,13,12,12,13,12,13,12, - 12,13,13,13,12,12,12,12,12,12,12,12,12,13,12,12, - 12,13,12,12,13,13,13,13,12,13,13,13,13,10,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,11,12,12,12, - 12,12,12,12,12,12,11,11,12,12,12,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,13,12,12,12,13,13,11, - 12,11,12,12,12,12,12,12,12,11,12,12,12,12,12,12, - 12,13,13,12,12,12,13,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,13,12,12,12,12,12,13,12,13,12,13, - 13,12,12,12,12,12,12,12,12,13,12,12,12,12,13,12, - 12,13,12,13,13,12,13,12,13,12,11,11,11,12,12,11, - 12,12,12,12,11,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,13,12,13,12,12,13,13,13,11,12,12,12, - 12,12,12,12,12,12,12,12,12,13,12,12,12,12,13,13, - 12,12,12,13,12,12,12,12,12,12,12,12,13,12,13,12, - 12,12,12,13,12,12,13,12,13,12,13,13,12,13,12,12, - 12,12,12,12,13,13,13,12,12,12,12,13,12,12,13,13, - 13,13,12,13,13,13,12,11,11,11,12,12,11,12,12,12, - 12,11,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,13,12,12,13,13,13,11,12,12,12,12,12,12, - 12,12,13,12,12,12,13,12,12,13,12,13,13,12,13,12, - 13,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,13,12,13,12,13,13,13,12,12,12,12,12,12, - 12,13,12,13,12,12,12,12,13,12,12,13,13,13,12,12, - 13,12,13,12,10,11,11,12,12,11,11,11,12,12,11,11, - 11,12,12,11,12,12,12,12,11,12,12,12,12,11,11,11, - 12,12,11,11,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,11,11,11,12,12,11,12,12,12,12, - 11,12,11,12,12,12,12,12,12,12,11,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,12,12,12,12,12,11,12,12,12,12,12,12,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,10,11,11,12,12,11,11,12,12,12,11,12,12,12,12, - 11,12,12,12,12,12,12,12,12,12,11,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,13,12,12, - 12,13,13,11,11,11,12,12,12,12,12,12,12,11,12,12, - 12,12,12,12,12,13,13,12,12,12,13,13,12,12,12,12, - 12,12,12,12,12,13,12,12,12,12,13,12,12,13,12,13, - 12,12,13,13,13,12,12,12,12,12,12,12,12,12,13,12, - 12,12,12,12,12,12,13,13,13,12,12,12,13,12,11,11, - 11,12,12,11,12,12,12,12,11,12,12,12,12,12,12,12, - 12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,13,13,12,12,12,13,13, - 11,12,11,12,12,12,12,12,12,12,11,12,12,12,12,12, - 12,12,13,13,12,12,12,13,12,12,12,12,12,12,12,12, - 12,12,13,12,12,12,13,13,12,13,13,13,13,12,13,13, - 13,13,12,12,12,12,12,12,12,12,13,12,12,12,12,13, - 12,12,13,12,13,13,12,13,12,13,12,11,11,11,12,12, - 11,12,12,12,12,11,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,11,12,12,12,12,12,12,12,12,13,12,12, - 12,13,13,12,12,13,12,13,12,12,13,13,13,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13, - 13,12,12,12,13,12,12,12,12,12,12,12,12,12,12,13, - 12,12,12,13,13,12,12,13,12,13,12,13,13,13,13,12, - 12,12,12,12,12,12,13,12,13,12,12,12,12,12,12,13, - 13,12,12,12,13,12,12,12,11,11,11,12,12,11,12,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,12,12,12,12,12,12,12,12,13,12,12,12,12,13, - 12,12,13,13,13,12,12,12,13,13,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,12,13,13,12,13, - 12,13,12,12,12,12,12,12,12,12,12,12,13,12,13,12, - 13,13,12,13,13,12,13,12,13,13,13,13,12,12,12,12, - 12,12,12,12,13,12,12,13,12,13,12,12,13,12,13,12, - 12,13,12,13,12, -}; - -static const static_codebook _44p8_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p8_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p8_p4_1, - 0 -}; - -static const long _vq_quantlist__44p8_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p8_p5_0[] = { - 2, 6, 6, 9, 9, 5, 7, 8,10,11, 5, 8, 7,11,10, 8, - 10,11,12,13, 8,11,10,13,12, 6, 7, 8,10,11, 7, 8, - 10,10,12, 8, 9, 9,12,12,10,10,12,12,14,10,12,12, - 14,13, 6, 8, 7,11,10, 8, 9, 9,12,12, 7,10, 8,12, - 11,10,12,12,13,14,10,12,10,14,12, 9,10,11,11,13, - 10,10,11,11,13,11,12,12,13,14,12,12,13,11,15,13, - 14,14,15,14, 9,11,10,13,11,11,12,12,13,13,10,11, - 10,13,11,13,14,14,15,15,12,13,12,15,11, 6, 8, 9, - 11,12, 8, 9,11,12,13, 8,10,10,13,13,11,12,13,14, - 15,11,12,13,14,14, 9, 9,10,12,13,10,10,12,12,14, - 10,11,11,13,14,12,12,14,14,15,13,13,14,15,15, 9, - 10,10,13,13,10,11,11,13,14,10,11,10,14,13,13,13, - 14,15,15,12,14,13,15,14,12,12,13,13,14,12,13,14, - 13,15,13,14,14,15,15,14,14,15,14,16,15,15,15,16, - 16,12,13,13,14,14,13,14,14,15,15,12,14,13,15,14, - 14,15,15,16,16,14,15,14,16,14, 6, 9, 8,12,11, 8, - 10,10,13,13, 8,11, 9,13,12,11,12,12,14,14,11,13, - 12,15,14, 9,10,10,13,13,10,10,11,13,14,10,12,11, - 14,13,12,13,14,14,15,13,13,13,15,14, 9,10, 9,13, - 12,10,11,11,14,13,10,12,10,14,12,13,14,13,15,15, - 12,14,12,15,14,12,13,13,14,14,13,13,13,14,15,13, - 14,14,15,15,14,14,15,14,16,14,15,15,16,16,12,13, - 12,14,13,13,14,14,15,15,12,14,13,15,13,15,15,15, - 16,16,14,15,14,16,14,11,12,12,13,14,12,13,14,14, - 16,12,13,13,15,15,14,14,16,15,17,14,15,15,16,16, - 12,13,14,14,15,13,13,15,15,16,14,14,14,15,16,15, - 15,16,16,17,15,15,16,16,17,13,13,13,15,15,14,14, - 15,15,16,13,14,14,15,16,15,15,16,16,17,15,16,15, - 17,16,14,15,15,16,16,15,15,16,16,17,15,16,16,17, - 17,16,16,17,16,18,16,17,17,17,17,15,15,15,16,16, - 15,16,16,17,17,15,16,16,17,16,16,17,17,18,18,16, - 17,16,17,16,11,12,12,15,13,13,13,13,15,15,12,14, - 13,16,14,14,15,15,16,16,14,15,14,17,15,13,13,13, - 15,14,13,14,14,16,15,14,14,14,16,15,15,15,16,16, - 17,15,16,15,17,16,12,14,13,15,14,14,14,14,16,15, - 13,14,13,16,15,15,16,16,17,16,15,16,15,17,16,15, - 15,15,16,16,15,15,16,16,17,15,16,16,17,17,16,16, - 17,17,17,17,17,17,18,17,14,15,15,16,16,15,16,16, - 17,16,15,16,15,17,16,17,17,17,18,17,16,17,16,18, - 16, 6, 9, 9,12,12, 8,10,10,12,13, 8,10,10,13,12, - 10,12,12,14,15,11,13,12,15,14, 8, 9,10,12,13, 9, - 10,11,13,14,10,11,11,14,13,12,12,13,14,15,12,13, - 13,15,15, 8,10,10,13,13,10,11,11,13,14,10,12,10, - 14,13,12,13,13,15,15,12,14,13,15,14,11,12,12,13, - 14,12,12,13,13,15,12,13,13,15,15,14,13,15,14,16, - 14,15,15,16,16,12,13,13,14,14,13,13,14,15,14,12, - 14,13,15,14,14,15,15,16,15,14,15,14,16,14, 7, 9, - 10,12,12, 9,10,11,13,14, 9,11,10,13,13,11,12,13, - 14,15,12,13,13,15,14, 9,10,11,12,13,10,10,12,13, - 14,11,11,12,14,14,12,12,14,14,15,13,13,14,15,15, - 9,11,11,13,13,11,12,12,14,14,10,12,10,14,13,13, - 14,14,15,15,13,14,13,16,14,12,12,13,14,15,13,13, - 14,14,16,13,14,14,15,15,14,14,15,14,17,14,15,15, - 16,16,12,13,13,15,14,13,14,14,15,15,13,14,13,16, - 14,15,15,15,16,16,14,15,14,16,14, 7,10, 9,13,12, - 10,11,12,12,14,10,12,11,14,12,12,13,13,14,15,12, - 14,13,15,14, 9,11,10,13,13,10,11,12,13,14,12,13, - 12,15,13,13,13,14,13,15,13,14,14,16,15,10,11,11, - 13,13,12,12,13,14,14,11,12,11,14,13,14,14,14,15, - 16,13,14,13,16,13,12,13,13,14,14,12,13,13,14,15, - 14,14,14,15,15,14,13,15,13,16,15,15,15,17,16,13, - 13,13,14,14,14,14,14,15,15,12,13,13,15,14,15,16, - 16,16,16,14,15,14,16,13,11,12,13,14,15,12,13,14, - 15,16,13,14,14,15,15,14,14,15,15,17,14,15,15,16, - 16,13,13,14,14,15,13,13,15,14,16,14,14,15,15,16, - 15,14,16,15,17,15,16,16,16,17,13,14,14,15,15,14, - 14,15,16,16,13,15,14,16,16,15,16,16,17,17,15,16, - 15,17,16,14,15,15,15,17,15,15,16,15,17,15,16,16, - 16,17,16,16,17,16,18,17,17,17,17,18,15,15,15,17, - 16,15,16,16,17,17,15,16,16,17,16,16,17,17,18,18, - 16,17,16,18,17,11,13,12,15,14,13,13,14,15,15,13, - 14,13,16,14,15,15,15,16,16,15,16,15,17,16,13,14, - 13,15,14,13,13,14,15,15,14,15,14,16,15,15,15,16, - 16,16,15,16,15,18,16,13,14,14,15,15,14,15,15,15, - 16,13,15,13,16,15,15,16,16,17,17,15,16,15,17,16, - 15,15,15,16,16,15,15,15,16,17,16,16,16,17,16,16, - 16,17,16,17,17,17,17,18,17,15,15,15,16,16,16,16, - 16,17,17,15,16,15,17,16,17,17,17,18,18,16,17,16, - 17,15, 6, 9, 9,12,12, 8,10,10,12,13, 8,10,10,13, - 12,11,12,13,14,15,10,12,12,14,14, 9,10,10,13,13, - 10,10,12,13,14,10,11,11,14,13,12,13,14,14,15,12, - 13,13,15,15, 8,10, 9,13,12,10,11,11,13,14, 9,11, - 10,14,13,12,13,13,15,15,12,13,12,15,14,12,13,13, - 14,14,12,13,13,14,15,13,14,14,14,15,14,14,15,14, - 16,14,15,15,16,16,11,12,12,14,13,13,13,13,15,15, - 12,13,12,15,13,14,15,15,16,16,14,15,14,16,14, 7, - 9,10,12,13,10,10,12,12,14,10,12,11,14,13,12,13, - 14,14,15,12,13,13,15,14,10,11,11,13,13,11,11,12, - 13,14,12,13,12,14,14,13,13,14,13,16,14,14,14,15, - 15, 9,10,11,13,14,12,12,13,13,15,10,12,10,14,13, - 13,14,14,15,16,13,14,13,15,13,13,14,13,14,15,12, - 13,13,14,15,14,14,14,15,15,14,13,15,13,16,15,16, - 16,16,16,12,13,13,14,14,14,14,14,15,15,12,13,13, - 15,14,15,15,16,16,16,14,15,13,16,13, 7,10, 9,12, - 12, 9,10,11,13,13, 9,11,10,14,13,12,13,13,14,15, - 11,13,12,15,14, 9,11,11,13,13,10,10,12,13,14,11, - 12,12,14,14,13,13,14,14,16,13,14,14,16,15, 9,11, - 10,13,12,11,12,11,14,14,10,12,10,14,13,13,14,13, - 15,15,12,14,12,16,14,12,13,13,14,15,13,13,14,14, - 16,13,14,14,15,15,14,14,15,14,16,15,15,15,16,16, - 12,13,12,15,14,13,14,14,15,15,12,14,13,16,14,14, - 15,15,16,16,14,15,14,17,14,11,12,13,14,15,13,13, - 14,14,16,13,14,13,15,15,15,15,16,16,17,15,15,15, - 16,16,13,14,13,15,15,13,13,15,15,16,14,15,15,16, - 16,15,15,16,15,17,16,16,16,17,17,13,13,14,14,15, - 14,14,15,15,16,13,14,13,15,15,15,16,16,16,17,15, - 16,15,16,16,15,15,15,16,16,15,15,16,16,17,16,16, - 16,17,17,16,16,17,16,18,17,17,17,18,18,15,15,15, - 16,16,16,16,16,17,17,15,15,15,16,16,17,17,17,17, - 18,16,16,16,17,15,11,13,12,15,14,13,13,14,15,15, - 12,14,13,16,14,14,15,15,16,16,14,15,14,16,15,13, - 14,14,15,15,13,14,14,16,16,14,15,14,16,16,15,15, - 16,17,17,15,16,16,17,17,13,14,13,15,14,14,14,14, - 16,15,13,15,13,16,14,15,16,15,17,16,15,16,14,17, - 15,14,16,15,16,17,15,16,16,16,17,15,16,16,17,17, - 16,16,17,17,18,16,17,17,18,17,14,15,15,17,15,15, - 16,16,17,16,15,16,15,17,15,16,17,17,18,17,16,17, - 16,18,15,10,12,12,14,14,12,13,13,15,15,12,13,13, - 15,15,13,14,14,15,16,14,15,14,16,16,12,13,13,15, - 15,12,13,14,15,15,13,14,14,15,15,14,14,15,16,17, - 14,15,15,17,16,12,13,13,15,15,13,14,14,15,16,13, - 14,14,16,15,14,15,15,16,17,14,15,15,17,16,13,14, - 14,15,16,14,14,15,15,16,14,15,15,16,16,15,15,16, - 16,17,15,16,16,17,17,14,15,15,16,16,15,15,15,16, - 16,15,15,15,16,16,16,17,16,17,17,16,16,16,18,16, - 11,12,12,14,14,12,13,14,15,15,12,13,13,15,15,13, - 14,15,16,16,14,15,15,16,16,12,13,13,15,15,13,13, - 14,15,16,13,14,14,15,16,14,14,15,16,17,15,15,15, - 16,17,12,13,13,15,15,13,14,14,15,16,13,14,14,16, - 15,15,15,15,16,17,15,16,15,17,16,14,14,15,15,16, - 14,14,15,15,17,15,15,16,16,17,15,15,16,15,18,16, - 16,16,17,17,14,15,15,16,16,15,16,16,17,17,15,15, - 15,17,16,16,17,16,17,17,16,16,16,18,16,11,12,12, - 14,14,13,13,14,15,15,13,14,13,15,15,14,15,15,16, - 16,14,15,15,16,16,12,13,13,15,15,13,13,14,15,15, - 14,14,14,16,15,15,15,15,15,16,15,16,15,17,16,12, - 13,13,15,15,14,14,15,15,16,13,14,13,16,15,15,15, - 16,16,17,15,16,15,17,15,14,15,14,16,16,14,15,15, - 16,16,15,16,15,17,16,15,15,16,15,17,16,17,16,17, - 17,14,15,15,16,16,15,16,16,16,17,14,15,15,16,16, - 16,17,17,17,18,16,16,16,17,16,12,13,13,15,15,13, - 13,14,15,16,13,14,14,16,15,14,15,15,16,17,14,15, - 15,17,16,13,14,14,15,16,14,14,15,15,17,14,15,15, - 16,16,15,14,16,15,17,15,16,16,17,17,13,14,14,16, - 16,14,15,15,16,16,14,15,14,16,16,15,16,16,17,17, - 15,16,15,17,16,15,15,16,15,17,15,15,16,15,17,15, - 16,16,16,17,16,15,17,15,18,17,17,17,17,17,15,15, - 15,17,17,16,16,16,17,17,15,16,15,17,17,16,17,17, - 18,18,16,17,15,18,15,11,12,12,15,15,13,13,15,14, - 16,13,14,13,16,14,15,15,16,16,17,15,16,15,17,15, - 12,14,13,16,14,13,13,14,14,16,14,15,14,16,15,15, - 15,16,15,17,16,16,16,17,16,12,13,14,15,16,15,15, - 15,15,16,13,15,13,16,14,16,16,16,17,17,15,16,15, - 17,15,15,16,15,16,15,14,14,15,16,16,16,16,16,17, - 16,15,15,16,15,17,17,17,17,18,17,15,15,15,16,16, - 16,16,16,16,17,14,15,15,17,16,17,17,17,17,18,15, - 16,15,18,14,10,12,12,14,14,12,13,13,15,15,12,13, - 13,15,15,14,14,15,15,16,13,15,14,16,16,12,13,13, - 15,15,13,14,14,15,16,13,14,14,15,15,14,15,15,16, - 17,14,15,15,17,16,12,13,13,15,15,13,14,14,15,15, - 12,14,13,15,15,14,15,15,16,17,14,15,14,17,15,14, - 15,15,16,16,14,15,15,16,17,15,15,15,17,16,16,16, - 16,16,17,16,16,16,17,17,13,14,14,16,15,14,15,15, - 16,16,14,15,14,16,16,15,16,16,17,17,15,16,15,17, - 16,11,12,12,14,15,13,13,14,14,15,13,14,13,15,15, - 14,15,15,16,16,14,15,15,16,16,12,14,13,15,15,13, - 13,14,15,16,14,15,14,16,15,15,15,16,15,17,15,16, - 16,17,16,12,13,13,15,15,14,14,15,15,16,13,14,13, - 16,15,15,15,16,16,17,15,15,15,16,16,14,15,15,16, - 16,14,15,15,16,16,15,16,16,17,17,16,16,16,16,17, - 16,17,17,18,17,14,14,15,15,16,15,15,16,16,17,14, - 15,15,16,16,16,16,16,17,17,15,16,15,17,15,11,12, - 12,14,14,12,13,14,15,15,12,13,13,15,15,14,15,15, - 16,16,13,15,14,16,16,12,13,13,15,15,13,14,14,15, - 16,13,14,14,16,16,15,15,15,16,17,15,15,15,17,16, - 12,13,13,15,15,13,14,14,16,15,13,14,13,16,15,15, - 16,15,17,17,14,15,14,17,16,14,15,15,16,16,15,15, - 16,16,17,15,16,16,17,17,16,16,16,16,18,16,17,16, - 18,17,14,15,14,16,15,15,15,15,17,16,14,15,14,17, - 15,16,17,16,17,17,15,16,15,17,15,11,12,12,15,15, - 13,13,15,14,16,13,15,13,16,14,15,15,16,15,17,15, - 16,15,17,16,12,14,13,15,15,13,13,15,15,16,15,15, - 15,16,15,15,15,16,15,17,16,16,16,17,16,12,13,14, - 15,16,14,14,15,15,16,13,14,13,16,14,16,16,16,16, - 17,15,16,15,17,15,15,16,15,16,16,14,15,15,16,16, - 16,16,16,17,16,15,15,16,15,17,17,17,17,18,17,15, - 15,15,15,16,16,16,16,16,17,14,15,14,16,15,17,17, - 17,17,18,15,16,15,17,15,12,13,13,15,15,13,14,14, - 15,16,13,14,14,16,15,14,15,15,16,17,14,15,15,17, - 16,13,14,14,16,15,13,14,15,16,16,14,15,15,16,16, - 15,15,16,16,17,15,16,16,17,17,13,14,13,16,15,14, - 15,15,16,16,13,15,14,16,15,15,16,16,17,17,15,16, - 14,17,15,15,15,16,17,17,15,15,16,16,17,16,16,16, - 17,17,16,15,17,16,18,17,17,17,18,18,15,15,15,17, - 14,16,16,16,17,16,15,16,15,17,15,16,17,17,18,17, - 16,17,15,18,15, -}; - -static const static_codebook _44p8_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p8_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p8_p5_0, - 0 -}; - -static const long _vq_quantlist__44p8_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p8_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p8_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p8_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p8_p5_1, - 0 -}; - -static const long _vq_quantlist__44p8_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p8_p6_0[] = { - 2, 6, 6, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 7, 9, 7, - 9, 9, 6, 7, 7, 8, 9, 9, 7, 9, 7, 6, 8, 8, 8, 9, - 10, 8, 9, 9, 8, 9,10, 9, 9,10,10,10,10, 8, 9, 9, - 10,10,11, 9,10,10, 6, 8, 8, 8, 9, 9, 8,10, 9, 8, - 9, 9, 9,10,10,10,11,10, 8,10, 9,10,11,10, 9,11, - 9, 6, 8, 8, 7, 9, 9, 7, 9, 9, 7, 9, 9, 8, 9,10, - 9,10,10, 8, 9, 9, 9,10,10, 9,10, 9, 7, 9, 9, 9, - 9,10, 9,10,10, 9, 9,10,10, 9,11,10,11,11, 9,10, - 10,10,11,11,10,11,10, 6, 9, 8, 9, 9,10, 9,10, 9, - 8,10,10, 9, 9,10,10,11,11, 9,10,10,10,11,11, 9, - 11, 9, 6, 8, 8, 7, 9, 9, 7, 9, 9, 8, 9, 9, 9, 9, - 10, 9,10,10, 7, 9, 9, 9,10,10, 8,10, 9, 6, 8, 9, - 9, 9,10, 9,10, 9, 9,10,10, 9, 9,11,10,11,11, 8, - 9,10,10,11,11, 9,10, 9, 7, 9, 9, 9,10,10, 9,10, - 9, 9,10,10,10,10,11,10,11,11, 9,10, 9,10,11,11, - 10,11, 9, -}; - -static const static_codebook _44p8_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p8_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p8_p6_0, - 0 -}; - -static const long _vq_quantlist__44p8_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p8_p6_1[] = { - 4, 7, 7, 7, 7, 8, 7, 8, 7, 7, 7, 8, 7, 8, 8, 8, - 8, 8, 7, 8, 7, 8, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 8, 8, 8, - 8, 9, 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, 9, 8, 8, 9, - 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, - 8, 8, 9, 8, 8, 8, 8, 9, 9, 8, 9, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, - 8, 8, 9, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 8, 9, 8, 8, 8, 8, 8, 9, 9, 8, - 9, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 8, 9, 9, 8, 8, 8, 8, 9, 8, 8, 9, 8, 7, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, - 8, 8, 8, 9, 9, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, - 8, 9, 8, -}; - -static const static_codebook _44p8_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p8_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p8_p6_1, - 0 -}; - -static const long _vq_quantlist__44p8_p7_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p8_p7_0[] = { - 1, 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, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44p8_p7_0 = { - 5, 243, - (long *)_vq_lengthlist__44p8_p7_0, - 1, -512202240, 1635281408, 2, 0, - (long *)_vq_quantlist__44p8_p7_0, - 0 -}; - -static const long _vq_quantlist__44p8_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p8_p7_1[] = { - 1, 7, 7,12,12, 5,11,12,12,12, 5,12,11,12,12,12, - 12,12,12,12,12,13,13,13,13, 7,11,11,13,13,13,12, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13, 7,13,10,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,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13, 7,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,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,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13, 8,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,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,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13, 8,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,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, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,10,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13, 8,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,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,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,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 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,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,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 const static_codebook _44p8_p7_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p8_p7_1, - 1, -514619392, 1630767104, 3, 0, - (long *)_vq_quantlist__44p8_p7_1, - 0 -}; - -static const long _vq_quantlist__44p8_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p8_p7_2[] = { - 1, 3, 2, 4, 5, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,14,14,15,15,15,15, -}; - -static const static_codebook _44p8_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p8_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p8_p7_2, - 0 -}; - -static const long _vq_quantlist__44p8_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p8_p7_3[] = { - 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p8_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p8_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p8_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p8_short[] = { - 3, 9,15,17,20,21,22,23, 5, 5, 7, 9,11,13,17,20, - 9, 5, 5, 6, 8,10,15,18,11, 7, 5, 4, 6, 9,13,17, - 14, 9, 7, 5, 6, 7,10,14,17,10, 8, 6, 6, 4, 5, 8, - 20,14,13,10, 8, 4, 3, 4,23,17,16,14,12, 6, 4, 4, -}; - -static const static_codebook _huff_book__44p8_short = { - 2, 64, - (long *)_huff_lengthlist__44p8_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p9_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44p9_l0_0[] = { - 2, 5, 5, 7, 6, 8, 8, 9, 9,10,10,11,11, 4, 5, 5, - 6, 7, 8, 8, 9, 9,10,10,11,10, 4, 5, 5, 7, 6, 8, - 8, 9, 9,10,10,10,10, 6, 6, 7, 6, 7, 8, 8, 9, 9, - 10, 9,11, 9, 6, 6, 6, 7, 6, 8, 8, 9, 9, 9,10, 9, - 11, 7, 7, 8, 8, 8, 8, 9, 9, 9,10, 9,11, 9, 7, 8, - 8, 8, 8, 9, 8, 9, 9, 9,10, 9,11, 8, 9, 9, 9, 9, - 9, 9,10,10,11,10,12,10, 8, 9, 9, 9, 9, 9, 9,10, - 9,10,11,11,12, 9,10,10,10,10,10,10,10,11,11,11, - 11,12, 9,10,10,10,10,11,10,11,10,11,11,12,11,11, - 11,11,11,11,11,11,11,12,11,12,11,12,11,11,11,11, - 11,11,11,12,11,12,11,12,11, -}; - -static const static_codebook _44p9_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44p9_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44p9_l0_0, - 0 -}; - -static const long _vq_quantlist__44p9_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p9_l0_1[] = { - 4, 4, 4, 5, 5, 4, 4, 5, 5, 5, 4, 5, 4, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p9_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44p9_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p9_l0_1, - 0 -}; - -static const long _vq_quantlist__44p9_l1_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p9_l1_0[] = { - 1, 2, 3, 5, 9, 9, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9,10,10,10,10,10,10,10,10, -}; - -static const static_codebook _44p9_l1_0 = { - 2, 25, - (long *)_vq_lengthlist__44p9_l1_0, - 1, -514619392, 1630767104, 3, 0, - (long *)_vq_quantlist__44p9_l1_0, - 0 -}; - -static const long _huff_lengthlist__44p9_lfe[] = { - 1, 1, -}; - -static const static_codebook _huff_book__44p9_lfe = { - 1, 2, - (long *)_huff_lengthlist__44p9_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44p9_long[] = { - 3, 3, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _huff_book__44p9_long = { - 1, 8, - (long *)_huff_lengthlist__44p9_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44p9_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p9_p1_0[] = { - 1, 5, 5, 4, 8, 8, 4, 8, 8, 5, 7, 8, 8, 9,10, 8, - 10,10, 5, 8, 7, 8,10,10, 8,10, 9, 7, 9, 9, 9,11, - 11, 9,11,11, 9,11,11,11,12,13,11,13,13, 9,11,11, - 11,13,13,11,13,13, 7, 9, 9, 9,11,11, 9,11,11, 9, - 11,11,11,13,13,11,13,13, 9,11,11,11,13,13,11,13, - 12, 5, 9, 9, 9,11,11, 9,11,11, 9,11,11,11,12,13, - 11,13,13, 9,11,11,11,13,13,11,13,13, 9,11,12,11, - 13,13,12,13,13,11,12,13,13,14,15,13,14,14,12,13, - 13,13,15,15,13,15,14, 8,10,10,11,13,13,12,14,13, - 11,12,12,13,14,15,13,15,15,11,12,12,13,15,15,13, - 15,14, 5, 9, 9, 9,11,11, 9,11,11, 9,11,11,11,13, - 13,11,13,13, 9,11,10,11,13,13,11,13,12, 8,10,10, - 11,13,13,12,13,13,11,12,12,13,14,15,14,15,15,10, - 12,12,13,14,15,13,15,14, 9,12,11,12,13,13,11,13, - 13,12,13,13,13,15,15,13,14,15,11,13,12,13,15,14, - 13,15,14, -}; - -static const static_codebook _44p9_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44p9_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p9_p1_0, - 0 -}; - -static const long _vq_quantlist__44p9_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p9_p2_0[] = { - 4, 6, 6, 8, 8, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 6, - 8, 8,11,11, 6, 8, 8,11,11, 6, 7, 7, 9, 9, 7, 8, - 9,10,11, 7, 9, 9,11,10, 8, 9,10,12,12, 8,10,10, - 12,12, 6, 7, 7, 9, 9, 7, 9, 9,10,10, 7, 9, 8,11, - 10, 8,10,10,12,12, 8,10, 9,12,12, 8, 9, 9,11,11, - 9,10,10,12,12, 9,11,11,12,13,11,12,12,13,14,11, - 12,12,14,14, 8, 9, 9,11,11, 9,11,10,13,12, 9,10, - 10,13,12,11,12,12,14,14,11,12,12,14,13, 7, 8, 9, - 10,10, 8,10,10,11,11, 8,10,10,11,11,10,11,11,13, - 13,10,11,11,13,13, 8, 9,10,10,11,10,11,11,12,13, - 10,11,11,12,12,11,11,12,13,14,11,12,12,14,14, 8, - 10,10,11,11,10,11,11,12,13,10,11,11,12,12,11,12, - 12,14,14,11,12,12,14,14,10,11,11,12,13,11,12,12, - 13,14,12,13,13,14,14,13,13,14,14,16,13,14,14,15, - 16,10,11,11,13,13,12,12,12,14,14,11,12,12,14,14, - 13,14,14,15,16,13,14,14,16,15, 7, 8, 8,10,10, 8, - 10,10,11,11, 8,10,10,12,11,10,11,11,13,13,10,11, - 11,13,13, 8,10,10,11,11,10,11,11,12,12,10,11,11, - 12,12,11,12,12,14,14,11,12,12,14,14, 8,10, 9,11, - 10,10,11,11,13,12,10,11,10,13,12,11,12,12,14,14, - 11,12,11,14,13,10,11,11,13,13,11,12,12,14,14,12, - 12,12,14,14,13,14,14,15,16,13,14,14,15,15,10,11, - 11,13,12,12,12,12,14,14,11,12,12,14,13,13,14,14, - 16,15,13,14,13,16,14,10,11,11,13,13,12,12,13,14, - 15,12,13,13,14,15,13,14,15,15,16,13,14,14,16,16, - 11,12,13,14,14,13,13,14,15,16,13,14,14,15,16,14, - 15,15,16,17,14,15,16,17,17,11,12,12,14,14,13,14, - 14,15,16,13,14,14,15,15,14,15,15,16,18,14,15,15, - 17,16,13,14,15,15,16,15,15,16,16,18,15,15,15,17, - 17,16,16,17,17,18,16,16,16,18,18,14,14,14,16,16, - 15,15,15,16,17,15,15,15,16,17,16,17,17,18,18,16, - 16,17,18,17,10,11,11,14,13,12,13,13,15,14,11,13, - 13,15,14,13,15,15,16,16,13,14,14,16,16,11,12,12, - 14,14,13,13,13,15,15,13,14,13,15,15,15,15,15,17, - 16,14,15,15,17,16,11,13,12,14,14,13,14,13,15,15, - 13,14,13,15,15,14,15,15,17,17,14,15,15,17,16,14, - 14,14,16,16,14,15,15,17,17,15,15,16,17,16,17,16, - 17,18,18,16,17,17,18,18,13,14,14,16,15,15,15,15, - 17,17,14,16,15,16,16,17,17,17,18,18,16,17,16,20, - 19, 6, 8, 8,10,10, 8,10,10,11,11, 8,10,10,12,11, - 10,11,11,13,13,10,11,11,13,13, 8, 9,10,11,11,10, - 11,11,12,12,10,11,11,13,12,11,12,12,14,14,11,12, - 12,14,14, 9,10,10,11,11,10,11,11,12,12,10,11,11, - 13,12,11,12,12,14,14,11,12,12,14,14,10,10,11,12, - 13,11,12,12,14,14,11,12,12,14,14,13,14,14,15,16, - 13,14,14,15,16,10,11,11,13,13,12,12,12,14,14,12, - 13,12,14,14,13,14,14,16,16,13,14,14,15,15, 9,10, - 10,11,12,10,11,11,12,13,10,11,11,13,12,11,12,12, - 14,14,11,12,12,14,14,10,10,11,12,13,11,12,12,13, - 14,11,12,12,13,14,12,13,14,14,15,12,13,13,15,15, - 10,11,11,13,13,11,12,12,13,14,11,12,12,14,13,12, - 13,13,15,15,12,13,13,15,15,12,11,13,12,14,13,13, - 14,14,15,13,13,14,14,15,14,15,15,16,17,14,15,15, - 16,17,12,13,12,14,14,13,14,14,15,15,13,14,14,15, - 15,14,15,15,16,17,14,15,15,16,17, 8, 9, 9,11,11, - 10,11,11,12,13,10,11,11,13,12,12,13,13,14,15,11, - 13,12,15,14, 9,11,10,12,12,11,12,12,13,14,11,12, - 12,14,13,13,13,14,15,15,13,14,13,15,15, 9,11,11, - 12,12,11,12,12,14,14,11,12,12,14,13,13,14,14,15, - 16,13,14,13,15,14,11,12,12,14,13,12,13,13,14,15, - 13,14,14,16,15,15,15,15,15,16,15,16,15,17,17,11, - 12,12,14,14,13,14,14,15,15,12,13,13,15,14,15,15, - 15,17,17,14,15,15,17,15,11,12,12,14,14,12,13,13, - 15,15,12,13,13,15,15,14,15,15,17,17,14,15,15,16, - 16,12,13,13,14,15,13,14,14,16,16,14,14,14,15,16, - 15,16,16,17,17,15,16,16,17,17,12,13,13,15,15,14, - 14,14,16,16,14,14,15,16,16,15,16,16,17,17,15,16, - 16,17,17,14,15,15,15,16,15,15,16,16,18,15,16,16, - 17,17,17,17,17,18,18,16,17,17,19,18,14,15,15,16, - 17,15,16,16,17,17,15,16,16,18,17,16,17,17,19,18, - 17,17,17,19,18,10,12,12,14,14,13,13,14,15,15,12, - 14,13,16,15,15,15,15,17,17,14,15,15,17,16,12,13, - 13,15,14,13,14,14,16,16,14,14,15,17,16,15,16,16, - 17,17,15,16,16,18,17,12,13,13,15,14,14,15,15,16, - 16,13,15,14,16,15,16,17,16,19,17,15,16,16,17,17, - 14,15,15,17,15,15,16,15,17,17,16,17,16,18,17,17, - 17,18,18,18,17,17,18,19,18,14,15,15,16,16,15,16, - 16,17,18,15,16,16,18,16,17,18,18,19,19,17,18,17, - 18,19, 6, 8, 8,10,10, 8,10,10,11,11, 8,10,10,12, - 11,10,11,11,13,13, 9,11,11,13,13, 9,10,10,11,11, - 10,11,11,12,12,10,11,11,12,12,11,12,12,14,14,11, - 12,12,14,14, 8,10, 9,11,11,10,11,11,12,12,10,11, - 11,12,12,11,12,12,14,14,11,12,12,14,14,10,11,11, - 13,13,11,12,13,14,14,12,12,12,14,14,13,14,14,15, - 16,13,14,14,16,16,10,11,10,13,12,11,12,12,14,14, - 11,12,12,14,14,13,14,14,15,16,13,14,14,16,15, 8, - 9, 9,11,11,10,11,11,12,13,10,11,11,13,12,12,13, - 13,14,15,12,13,13,15,14,10,11,11,12,12,11,11,12, - 13,14,11,12,12,14,14,13,13,14,15,16,13,14,14,15, - 15, 9,10,11,12,12,11,12,12,13,14,11,12,12,14,13, - 13,14,14,15,16,12,14,13,15,15,11,12,12,14,14,12, - 13,13,14,15,13,14,14,16,15,14,15,15,15,17,15,15, - 16,16,17,11,12,12,13,14,13,14,14,15,15,12,13,13, - 15,14,15,16,15,16,17,14,16,15,17,15, 9,10,10,12, - 11,10,11,11,13,13,10,11,11,13,12,11,12,12,14,14, - 11,12,12,14,14,10,11,11,12,13,11,12,12,13,14,11, - 12,12,14,14,12,13,13,15,15,12,13,13,15,15,10,11, - 10,13,12,11,12,12,13,13,11,12,12,14,13,12,13,13, - 15,15,12,13,13,15,14,12,13,12,14,14,13,14,14,15, - 15,13,14,14,15,15,14,15,15,16,16,14,15,15,16,16, - 11,13,11,14,12,13,13,13,15,14,12,14,13,15,14,15, - 15,15,17,16,14,15,14,17,15,10,12,12,14,14,13,13, - 14,15,16,12,14,13,15,15,14,15,16,17,17,14,15,16, - 17,17,12,13,13,14,15,13,14,14,16,16,14,14,15,16, - 16,16,16,16,17,17,16,16,16,18,18,12,13,13,14,15, - 14,14,15,16,16,13,14,14,16,15,16,16,16,17,18,15, - 16,16,17,17,14,15,15,16,16,15,15,16,17,17,15,16, - 16,17,18,17,18,18,18,19,17,18,18,19,19,14,15,15, - 16,16,15,16,16,17,17,15,16,16,17,17,17,17,18,20, - 18,17,18,17,18,18,11,12,12,14,14,12,13,14,15,15, - 12,13,13,15,15,14,15,15,16,17,14,15,15,16,17,12, - 13,13,15,15,14,14,14,16,16,14,14,14,16,16,15,16, - 16,17,17,15,16,16,17,17,12,13,13,15,14,13,14,14, - 16,15,14,15,14,16,15,15,16,16,17,17,15,16,16,17, - 16,14,15,15,16,16,15,16,16,17,17,16,16,16,17,17, - 17,17,17,19,18,17,17,17,18,19,14,15,14,17,15,15, - 16,16,17,17,15,16,15,17,17,16,17,17,18,18,16,17, - 17,18,17, 6,11,11,13,13,11,12,12,14,14,11,12,12, - 14,14,13,14,14,16,16,13,14,14,16,16,11,12,12,14, - 14,12,13,13,15,15,12,13,13,15,15,14,15,15,16,17, - 14,15,15,17,18,11,12,12,14,14,12,13,13,15,15,12, - 13,13,15,15,14,15,15,17,17,14,15,15,16,16,13,14, - 14,15,16,14,15,15,16,17,14,15,15,17,16,15,16,17, - 18,17,16,16,16,18,17,14,14,15,16,16,14,15,15,18, - 16,14,15,15,17,16,16,17,17,18,18,16,17,16,18,17, - 11,12,12,14,14,12,13,13,15,15,12,13,13,15,15,14, - 15,15,17,17,14,15,15,16,16,12,13,13,15,15,13,14, - 14,15,16,13,14,14,16,16,15,16,16,17,17,15,15,16, - 17,17,12,13,13,15,15,14,14,14,16,16,13,14,14,16, - 16,15,16,16,17,17,15,16,16,17,17,14,14,15,15,16, - 15,15,16,16,17,15,15,16,16,17,16,17,17,17,18,16, - 17,17,18,18,14,15,15,16,16,15,16,16,17,17,15,16, - 16,17,17,17,17,17,18,19,17,17,17,18,18,10,12,12, - 14,14,12,13,14,15,16,13,14,13,15,15,14,15,15,17, - 17,14,15,16,17,17,12,13,13,15,15,13,14,14,15,15, - 14,15,14,16,16,15,16,16,17,18,15,17,16,18,17,12, - 13,13,15,15,14,14,14,16,16,13,14,14,16,15,15,16, - 16,17,18,15,16,16,17,17,14,14,14,16,16,15,15,16, - 17,17,15,16,16,17,17,17,17,17,18,20,17,17,17,19, - 19,14,15,15,16,16,15,17,16,18,18,15,16,15,17,16, - 17,18,19,19,19,17,17,17,18,17,13,14,14,16,16,14, - 15,15,17,17,14,15,15,16,17,15,17,17,18,18,16,16, - 17,18,17,14,15,15,16,17,15,16,16,17,17,15,16,16, - 17,17,16,17,17,18,18,17,17,17,18,19,14,15,15,16, - 17,15,16,16,17,17,15,16,16,17,17,16,17,17,18,18, - 17,17,17,19,19,16,16,16,16,18,16,17,17,17,18,17, - 17,17,17,19,18,18,18,19,19,18,18,18,19,20,16,16, - 17,18,18,16,18,17,18,18,17,17,17,20,19,18,18,19, - 21,20,18,20,18,18,19,10,12,12,14,14,14,14,15,15, - 17,14,15,14,17,15,16,16,17,18,18,16,18,17,19,18, - 12,14,13,16,15,14,14,15,15,17,15,16,16,18,17,16, - 17,18,17,19,17,19,18,20,19,12,13,13,15,15,15,16, - 17,17,18,14,16,14,17,16,17,18,18,19,19,17,17,17, - 18,18,15,15,15,17,16,15,16,16,17,17,17,19,17,18, - 18,18,18,18,18,21,19,20,19,20,19,15,15,16,16,17, - 17,17,18,20,20,15,16,16,18,17,18,19,19,19,20,18, - 19,18,19,17, 6,11,11,13,13,11,12,12,14,14,11,12, - 12,14,14,13,14,14,16,16,13,14,14,16,16,11,12,12, - 14,14,12,13,13,15,15,12,13,13,15,15,14,15,15,17, - 17,14,15,15,17,16,11,12,12,14,14,12,13,13,15,15, - 12,13,13,15,15,14,15,15,16,16,14,15,15,16,16,13, - 14,14,16,16,15,15,15,16,16,14,15,15,17,16,16,17, - 17,19,18,16,17,17,18,18,13,14,14,15,15,14,15,15, - 17,16,14,15,15,17,16,16,17,16,17,18,15,16,16,18, - 18,10,12,12,14,14,12,13,14,15,15,12,13,13,15,15, - 14,15,15,17,17,14,15,15,17,16,12,13,13,15,15,14, - 14,14,15,16,14,15,15,16,16,15,16,16,17,18,16,16, - 16,18,18,12,13,13,14,14,14,14,15,16,16,13,14,14, - 16,16,15,16,16,18,18,15,16,16,19,17,14,15,15,16, - 17,15,15,16,17,17,16,17,16,17,18,17,17,18,17,19, - 17,17,18,18,19,14,14,14,16,16,15,16,16,17,17,15, - 16,15,17,17,17,17,17,19,20,16,17,17,18,18,11,12, - 12,14,14,12,13,13,15,15,12,13,13,15,15,14,15,15, - 16,16,14,15,14,16,16,12,13,13,15,15,14,14,14,16, - 16,13,14,14,16,16,15,16,16,18,17,15,16,16,17,17, - 12,13,13,15,15,13,14,14,16,16,13,14,14,16,16,15, - 16,15,18,18,15,16,15,17,16,14,15,15,16,16,15,16, - 16,17,17,15,16,16,18,17,16,17,17,18,18,16,17,17, - 18,18,14,15,14,16,15,15,16,15,17,17,15,16,15,17, - 16,16,17,17,18,18,17,17,16,19,17,10,12,12,14,15, - 14,14,15,15,17,14,15,14,17,15,16,17,17,17,18,16, - 17,17,18,18,12,14,13,16,15,14,14,16,15,17,15,17, - 16,18,17,17,17,18,17,19,18,18,18,19,18,12,13,14, - 15,15,15,16,16,16,17,14,15,14,18,16,18,17,18,19, - 19,17,18,17,20,18,15,15,15,17,17,15,16,16,17,18, - 18,18,18,19,18,18,18,19,18,20,18,19,19,21,21,15, - 15,16,16,17,17,18,18,18,18,15,16,16,17,17,17,19, - 20,19,20,17,18,18,19,17,13,14,14,16,16,14,15,15, - 16,17,14,15,15,17,17,16,16,17,17,18,15,17,16,17, - 17,14,15,15,16,16,15,16,16,17,17,16,16,16,17,17, - 17,17,18,17,18,17,17,17,18,20,14,15,15,17,16,15, - 16,16,17,17,15,16,16,17,17,17,17,17,18,18,16,17, - 17,19,18,16,16,17,17,17,17,18,17,19,18,17,17,17, - 18,19,17,20,18,19,21,17,19,18,19,20,15,17,15,17, - 16,16,17,17,18,18,17,17,17,18,17,18,19,18,19,21, - 18,18,17,19,19, -}; - -static const static_codebook _44p9_p2_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p9_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p9_p2_0, - 0 -}; - -static const long _vq_quantlist__44p9_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p9_p3_0[] = { - 2, 5, 4, 4, 7, 7, 4, 7, 6, 5, 6, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 6, 7, 9, 9, 7, 9, 8, 6, 8, 8, 8,10, - 10, 8,10,10, 8, 9,10,10,11,12,10,12,12, 8,10,10, - 10,12,12,10,12,11, 6, 8, 8, 8,10,10, 8,10,10, 8, - 10,10,10,11,12,10,12,12, 8,10, 9,10,12,11,10,12, - 11, 5, 8, 8, 8,10,10, 8,10,10, 8, 9,10,10,11,11, - 10,11,11, 8,10,10,10,11,12,10,12,11, 8,10,10,10, - 11,11,10,11,11,10,11,11,11,12,13,11,12,13,10,11, - 11,11,13,13,11,13,13, 7, 9, 9,10,11,12,10,12,11, - 9,11,11,11,12,13,12,14,13, 9,11,11,12,13,14,11, - 13,12, 5, 8, 8, 8,10,10, 8,10,10, 8,10,10,10,11, - 12,10,12,12, 8,10, 9,10,12,11, 9,11,11, 7, 9, 9, - 10,11,12,10,12,11, 9,11,11,11,12,13,12,14,13, 9, - 11,11,12,13,14,11,13,12, 8,10,10,10,11,11,10,11, - 11,10,11,11,11,13,13,11,13,13,10,11,10,11,13,12, - 11,13,12, -}; - -static const static_codebook _44p9_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44p9_p3_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44p9_p3_0, - 0 -}; - -static const long _vq_quantlist__44p9_p3_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p9_p3_1[] = { - 4, 6, 6, 6, 7, 7, 6, 7, 7, 6, 7, 7, 7, 7, 8, 7, - 7, 8, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, - 8, 9, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, - 9, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, - 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, 8, - 9, 9, 8, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 8, 9, - 9, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 9, 9, 8, 9, 9, - 8, 9, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, - 9, 9, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, - 9, 8, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, 9, 7, 8, 8, - 8, 9, 9, 8, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 8, - 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 8, 9, - 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, 9, - 9, 9, 9, -}; - -static const static_codebook _44p9_p3_1 = { - 5, 243, - (long *)_vq_lengthlist__44p9_p3_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44p9_p3_1, - 0 -}; - -static const long _vq_quantlist__44p9_p4_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p9_p4_0[] = { - 2, 5, 5, 4, 7, 7, 4, 7, 6, 5, 7, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 8, 6, 7, 8, 8, 9, - 10, 8,10,10, 8, 9,10,10,11,12,10,11,12, 8,10,10, - 10,11,12,10,12,11, 6, 8, 7, 8,10,10, 8,10, 9, 8, - 10,10,10,11,12,10,12,12, 8,10, 9,10,12,11,10,12, - 11, 5, 8, 8, 8,10,10, 8,10,10, 7, 9,10, 9,10,11, - 10,11,11, 8,10,10,10,12,12,10,12,11, 7, 9, 9, 9, - 11,11, 9,11,11, 9,10,11,11,11,12,11,12,12, 9,11, - 11,11,12,12,11,12,12, 7, 9, 9,10,11,12,10,12,11, - 9,11,10,11,11,12,12,13,13, 9,11,11,12,13,13,11, - 13,11, 5, 8, 8, 8,10,10, 8,10,10, 8,10,10,10,11, - 12,10,12,12, 7, 9, 9, 9,11,11, 9,11,10, 7, 9, 9, - 10,11,12,10,12,11, 9,11,11,11,11,13,12,13,13, 9, - 10,11,12,13,13,11,12,11, 7, 9, 9, 9,11,11, 9,11, - 11, 9,11,11,11,12,12,11,12,12, 9,11,10,11,12,12, - 10,12,11, -}; - -static const static_codebook _44p9_p4_0 = { - 5, 243, - (long *)_vq_lengthlist__44p9_p4_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44p9_p4_0, - 0 -}; - -static const long _vq_quantlist__44p9_p4_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p9_p4_1[] = { - 6, 8, 8,10, 9, 8, 9, 9,10,10, 8, 9, 9,10,10, 8, - 10,10,10,10, 8,10,10,10,10, 9, 9, 9,10,10, 9,10, - 10,10,11, 9,10,10,11,11,10,10,10,11,11,10,10,10, - 11,11, 9, 9, 9,10,10, 9,10,10,11,11, 9,10,10,11, - 10,10,10,10,11,11,10,10,10,11,11,10,10,10,10,11, - 10,10,11,11,11,10,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,10,10,10,11,10,10,11,11,11,11,10,11, - 10,11,11,11,11,11,11,11,10,11,11,11,11, 9,10,10, - 10,11,10,10,11,11,11,10,11,11,11,11,10,11,11,11, - 11,10,11,11,11,11,10,10,11,11,11,11,11,11,11,11, - 11,11,11,11,12,11,11,12,12,12,11,11,11,12,12,10, - 11,11,11,11,11,11,11,12,12,11,11,11,11,11,11,11, - 11,12,12,11,11,11,12,12,11,11,11,11,11,11,12,12, - 12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,12, - 12,11,11,11,11,11,11,12,12,12,12,11,12,11,12,12, - 11,12,12,12,12,12,12,12,12,12, 9,10,10,11,10,10, - 11,11,11,11,10,11,11,11,11,10,11,11,11,11,10,11, - 11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11, - 12,12,11,11,12,12,12,11,11,11,12,12,10,11,10,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12, - 11,11,11,12,12,11,11,11,11,11,11,12,12,12,12,11, - 12,12,12,12,11,12,12,12,12,12,12,12,12,12,11,11, - 11,11,11,11,12,12,12,12,11,12,11,12,12,12,12,12, - 12,12,11,12,12,12,12,11,11,11,11,11,11,12,12,12, - 12,11,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,13,13,12,12,12,13,13,11,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,13,13,12,12,12, - 13,13,12,12,12,12,12,12,12,12,12,13,12,12,12,13, - 13,12,13,13,13,13,12,13,13,13,13,12,12,12,12,12, - 12,12,12,13,13,12,12,12,13,13,12,13,13,13,13,12, - 13,13,13,13,11,11,11,11,11,11,12,12,12,12,11,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,13, - 13,12,12,12,13,13,11,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,13,13,12,12,12,13,13,12, - 12,12,12,12,12,12,12,13,13,12,12,12,13,13,12,13, - 13,13,13,12,13,13,13,13,12,12,12,12,12,12,12,12, - 13,13,12,12,12,13,12,12,13,13,13,13,12,13,13,13, - 13, 7,10,10,11,11,10,10,11,11,11,10,11,11,11,11, - 10,11,11,11,11,10,11,11,11,11,10,10,10,11,11,10, - 11,11,11,11,11,11,11,11,12,11,11,11,12,12,11,11, - 11,12,12,10,11,11,11,11,11,11,11,12,11,11,11,11, - 12,11,11,11,11,12,12,11,11,11,12,12,11,11,11,11, - 11,11,11,11,12,12,11,11,12,12,12,11,12,12,12,12, - 11,12,12,12,12,11,11,11,11,11,11,12,12,12,12,11, - 11,12,12,12,11,12,12,12,12,11,12,12,12,12,10,11, - 11,11,11,11,11,11,11,12,11,11,11,11,11,11,11,11, - 12,12,11,11,11,12,12,11,11,11,11,11,11,11,12,12, - 12,11,11,11,12,12,11,12,12,12,12,11,12,12,12,12, - 11,11,11,11,11,11,12,11,12,12,11,11,11,12,12,11, - 12,12,12,12,11,12,12,12,12,11,11,11,11,12,11,12, - 12,12,12,11,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,11,11,11,12,12,11,12,12,12,12,11,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,10,11,10,11,11, - 11,11,11,12,12,11,11,11,12,12,11,12,12,12,12,11, - 12,12,12,12,10,11,11,12,11,11,11,12,12,12,11,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,11,11,11, - 12,11,11,12,12,12,12,11,12,11,12,12,12,12,12,12, - 12,12,12,12,12,12,11,12,11,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,12,12,12,13,12,11,11,11,12,12,12,12,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 13,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,13,13,12,12,12,13,13,11,12,12,12,12,12, - 12,12,12,13,12,12,12,12,12,12,12,13,13,13,12,13, - 12,13,13,12,12,12,12,12,12,12,12,13,13,12,12,12, - 13,13,12,13,13,13,13,12,13,13,13,13,12,12,12,12, - 12,12,12,12,13,13,12,13,12,13,13,12,13,13,13,13, - 12,13,13,13,13,11,11,11,12,12,12,12,12,12,12,11, - 12,12,12,12,12,12,12,13,13,12,12,12,13,13,11,12, - 12,12,12,12,12,12,12,12,12,12,12,13,13,12,13,12, - 13,13,12,13,13,13,13,11,12,12,12,12,12,12,12,13, - 13,12,12,12,13,12,12,13,13,13,13,12,13,13,13,13, - 12,12,12,12,12,12,12,13,13,13,12,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,12,12,12,12,12,12,13, - 13,13,13,12,12,12,13,13,13,13,13,13,13,13,13,13, - 13,13, 7,10,10,11,11,10,11,11,11,11,10,11,11,11, - 11,10,11,11,11,11,10,11,11,11,11,10,11,11,11,11, - 11,11,11,11,11,11,11,11,12,11,11,11,12,12,12,11, - 11,11,12,12,10,10,10,11,11,11,11,11,12,11,10,11, - 11,11,11,11,11,11,12,12,11,11,11,12,12,11,11,11, - 11,11,11,11,12,12,12,11,12,11,12,12,11,12,12,12, - 12,11,12,12,12,12,11,11,11,11,11,11,11,11,12,12, - 11,12,11,12,12,11,12,12,12,12,11,12,12,12,12,10, - 10,10,11,11,11,11,11,12,12,11,11,11,12,12,11,12, - 12,12,12,11,12,12,12,12,11,11,11,11,11,11,11,12, - 12,12,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,11,11,11,11,11,11,12,12,12,12,11,12,11,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,13,12,12, - 12,13,12,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,10,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12, - 11,11,11,12,12,11,11,11,11,11,11,11,12,12,12,11, - 12,11,12,12,11,12,12,12,12,11,12,12,12,12,11,11, - 11,11,11,11,11,11,12,12,11,11,11,12,12,11,12,12, - 12,12,11,12,12,12,12,11,11,11,12,11,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 11,11,11,12,11,11,12,12,12,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,11,11,11,12,12,11,12, - 12,12,12,12,12,12,12,12,12,12,12,13,13,12,12,12, - 13,12,11,12,12,12,12,12,12,12,12,13,12,12,12,13, - 13,12,13,13,13,13,12,13,13,13,13,11,12,12,12,12, - 12,12,12,12,13,12,12,12,12,12,12,13,13,13,13,12, - 13,13,13,13,12,12,12,12,12,12,12,13,13,13,12,13, - 12,13,13,13,13,13,13,13,13,13,13,13,13,12,12,12, - 12,12,12,13,13,13,13,12,13,12,13,13,13,13,13,13, - 13,13,13,13,13,13,11,11,11,12,12,11,12,12,12,12, - 11,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,13, - 12,13,13,12,12,12,13,13,11,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,13,12,13,12,13, - 13,12,12,12,12,12,12,12,12,13,13,12,12,12,13,13, - 13,13,13,13,13,12,13,13,13,13,12,12,12,12,12,12, - 13,12,13,13,12,13,12,13,12,12,13,13,13,13,12,13, - 13,13,13, 8,11,11,12,12,11,12,12,12,12,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,12, - 12,11,12,12,12,12,12,12,12,12,12,12,12,12,13,13, - 12,12,12,13,13,11,11,11,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,13,13,12,12,12,13,13,11,12, - 12,12,12,12,12,12,12,13,12,12,12,12,12,12,12,13, - 13,13,12,12,13,13,13,11,12,12,12,12,12,12,12,13, - 12,12,12,12,13,13,12,13,13,13,13,12,13,13,13,13, - 11,11,11,12,12,11,12,12,12,12,11,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,13,13,12,12,12, - 13,13,11,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,12,13,13,12,13,12,13,13,12,12,12,12,12, - 12,12,12,12,13,12,12,12,13,13,12,13,13,13,13,12, - 13,13,13,13,12,12,12,12,12,12,12,12,13,13,12,12, - 12,13,13,12,13,13,13,13,12,13,13,13,13,11,11,11, - 12,12,11,12,12,12,12,11,12,12,12,12,12,12,12,13, - 12,12,12,12,12,13,11,12,12,12,12,12,12,12,12,13, - 12,12,12,12,13,12,13,13,13,13,12,13,13,13,13,11, - 12,12,12,12,12,12,12,12,13,12,12,12,13,12,12,13, - 13,13,13,12,13,13,13,13,12,12,12,12,12,12,12,12, - 13,13,12,12,13,13,13,12,13,13,13,13,12,13,13,13, - 13,12,12,12,12,12,12,13,13,13,13,12,13,12,13,13, - 12,13,13,13,13,13,13,13,13,13,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,11,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,13,13,13,12,13,13,13,13,11,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13, - 12,13,12,13,13,12,12,12,12,12,12,12,12,13,13,12, - 12,12,13,13,12,13,13,13,13,12,13,13,13,13,12,12, - 12,12,12,12,13,12,13,13,12,12,12,13,13,13,13,13, - 13,13,12,13,13,13,13,11,11,11,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,12,12,12,13,12, - 11,12,12,12,12,12,12,12,12,12,12,12,12,13,13,12, - 12,13,13,13,12,13,13,13,13,11,12,12,12,12,12,12, - 12,12,13,12,12,12,13,12,12,13,13,13,13,12,13,13, - 13,13,12,12,12,12,12,12,12,12,13,13,12,12,12,13, - 13,13,13,13,13,13,13,13,13,13,13,12,12,12,12,12, - 12,13,13,13,13,12,13,12,13,13,13,13,13,13,13,13, - 13,13,13,13, 8,11,11,11,11,11,12,12,12,12,11,12, - 12,12,12,12,12,12,12,12,11,12,12,12,12,11,11,11, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 13,12,12,12,13,13,11,11,11,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,13,13,12,12,12,13,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,13,13,12,13, - 13,13,13,12,13,13,13,13,11,12,12,12,12,12,12,12, - 12,13,12,12,12,13,12,12,13,13,13,13,12,13,12,13, - 13,11,11,11,12,12,12,12,12,12,12,11,12,12,12,12, - 12,12,12,13,13,12,12,12,13,12,11,12,12,12,12,12, - 12,12,12,12,12,12,12,13,13,12,12,13,13,13,12,13, - 13,13,13,11,12,12,12,12,12,12,12,13,13,12,12,12, - 12,12,12,13,13,13,13,12,13,13,13,13,12,12,12,12, - 12,12,12,13,13,13,12,12,13,13,13,13,13,13,13,13, - 12,13,13,13,13,12,12,12,12,12,12,13,12,13,13,12, - 12,12,13,13,13,13,13,13,13,12,13,13,13,13,11,11, - 11,12,12,11,12,12,12,12,11,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,13,12,13,13,12,12,12,13,13, - 11,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12, - 12,12,13,13,12,13,12,13,13,12,12,12,12,12,12,12, - 12,13,12,12,12,12,13,13,12,13,13,13,13,12,13,13, - 13,13,12,12,12,12,12,12,12,12,13,13,12,12,12,13, - 12,12,13,13,13,13,12,13,13,13,13,11,11,11,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,13,13,11,12,12,12,12,12,12,12,12,13,12,12, - 12,12,12,12,13,13,13,13,12,13,13,13,13,11,12,12, - 12,12,12,12,12,12,13,12,12,12,12,12,12,13,13,13, - 13,12,13,13,13,13,12,12,12,12,12,12,12,12,13,13, - 12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,12, - 12,12,12,12,12,13,13,13,13,12,12,12,13,12,13,13, - 13,13,13,12,13,13,13,13,11,11,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 13,11,12,12,12,12,12,12,12,12,12,12,12,12,13,12, - 12,12,12,13,13,12,13,13,13,13,11,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,13,13,13,13,12,13, - 12,13,13,12,12,12,12,12,12,12,13,13,13,12,13,12, - 13,13,12,13,13,13,13,13,13,13,13,13,12,12,12,12, - 12,12,12,12,12,13,12,12,12,13,13,13,13,13,13,13, - 12,13,13,13,13, -}; - -static const static_codebook _44p9_p4_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p9_p4_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44p9_p4_1, - 0 -}; - -static const long _vq_quantlist__44p9_p5_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p9_p5_0[] = { - 4, 6, 6, 9, 9, 6, 7, 8,10,11, 6, 8, 7,10,10, 8, - 10,10,12,12, 8,10,10,12,12, 6, 7, 8,10,10, 7, 8, - 9,10,11, 8, 9, 9,11,11,10,10,11,12,13,10,11,11, - 13,13, 6, 8, 7,10,10, 8, 9, 9,11,11, 7, 9, 8,11, - 10,10,11,11,13,13,10,11,10,13,12, 9,10,10,11,12, - 10,10,11,12,13,10,11,11,12,13,12,12,13,12,14,12, - 13,13,14,14, 9,10,10,12,11,10,11,11,13,12,10,11, - 10,13,12,12,13,13,14,14,12,13,12,14,12, 7, 8, 8, - 10,11, 8, 9,10,11,12, 8, 9, 9,11,12,10,11,12,13, - 14,10,11,11,13,13, 8, 9,10,11,12, 9,10,11,12,13, - 10,10,11,12,12,11,12,12,13,14,11,12,12,14,14, 8, - 9, 9,11,12,10,10,11,12,13, 9,10,10,12,12,11,12, - 12,14,14,11,12,12,14,13,11,11,12,12,13,11,12,12, - 13,14,12,12,13,14,14,13,13,14,14,16,13,14,14,15, - 15,11,12,11,13,13,12,12,12,14,14,11,12,12,14,13, - 13,14,14,15,15,13,14,13,15,14, 7, 8, 8,11,10, 8, - 10, 9,12,11, 8,10, 9,12,11,10,11,11,13,13,10,12, - 11,14,13, 8, 9, 9,12,11, 9,10,10,12,12,10,11,10, - 13,12,11,12,12,13,14,11,12,12,14,14, 8,10, 9,12, - 11,10,11,10,12,12, 9,11,10,13,11,11,12,12,14,14, - 11,12,12,14,13,11,11,12,13,13,11,12,12,13,14,12, - 12,12,14,14,13,13,14,14,15,13,14,14,15,15,11,12, - 11,13,12,12,12,12,14,14,11,12,12,14,13,13,14,14, - 15,15,13,14,13,15,14,10,11,11,12,13,11,12,12,13, - 14,11,12,12,13,14,13,13,14,14,16,13,14,14,15,15, - 11,12,12,12,14,12,12,13,13,15,12,13,13,13,15,14, - 14,15,15,16,14,14,15,15,16,11,12,12,13,14,12,13, - 13,14,15,12,13,13,14,14,14,14,15,15,16,14,14,14, - 15,15,13,14,14,14,15,14,14,15,15,16,14,15,15,15, - 16,15,15,16,16,18,16,16,16,17,17,13,14,14,15,15, - 14,14,15,16,16,14,14,14,16,15,16,16,16,17,17,15, - 16,16,17,16,10,11,11,13,12,11,12,12,14,13,11,12, - 12,14,13,13,14,14,15,15,13,14,13,16,14,11,12,12, - 14,13,12,13,13,14,14,12,13,13,15,14,14,14,14,15, - 15,14,15,14,16,15,11,12,12,14,12,12,13,13,15,14, - 12,13,12,15,13,14,15,14,16,15,14,15,14,16,15,13, - 14,14,15,15,14,14,14,15,16,14,15,14,16,16,15,16, - 16,16,17,16,16,16,17,17,13,14,14,15,14,14,15,15, - 16,15,14,15,14,16,15,16,16,16,17,17,15,16,15,18, - 16, 6, 8, 8,11,11, 8, 9,10,11,12, 8,10, 9,12,12, - 10,11,11,13,13,10,12,11,14,13, 8, 9, 9,11,12, 9, - 10,10,12,12, 9,10,10,12,12,11,11,12,13,14,11,12, - 12,14,14, 8,10, 9,12,11,10,11,11,12,12, 9,11,10, - 13,12,11,12,12,14,14,11,12,12,14,13,10,11,11,13, - 13,11,12,12,13,14,11,12,12,14,14,13,13,14,13,15, - 13,14,14,15,15,11,12,11,13,13,12,12,12,14,14,11, - 12,12,14,13,13,14,14,15,15,13,14,13,15,14, 8, 9, - 9,11,11, 9,10,10,12,12, 9,10,10,12,12,11,12,12, - 13,14,11,12,12,14,14, 9, 9,10,11,12,10,10,11,12, - 13,10,10,11,12,13,12,12,13,13,15,12,12,13,14,14, - 9,10,10,12,12,10,11,11,13,13,10,11,11,13,13,12, - 13,13,14,15,12,13,12,14,14,11,11,12,12,14,12,12, - 13,13,14,12,12,13,13,14,13,13,14,14,16,14,14,14, - 15,15,11,12,12,14,13,12,13,13,14,14,12,13,13,15, - 14,14,14,14,16,16,13,14,14,16,14, 7, 9, 9,12,11, - 9,10,10,12,12, 9,11,10,13,12,11,12,12,13,14,11, - 13,12,14,13, 9,10,10,12,12,10,10,11,12,13,10,12, - 11,13,13,12,12,13,13,14,12,13,13,15,14, 9,10,10, - 12,12,11,11,11,13,13,10,12,10,13,12,12,13,13,14, - 15,12,13,12,15,13,11,12,12,14,13,12,12,13,13,14, - 12,13,13,15,14,13,13,14,13,16,14,15,14,16,15,12, - 12,12,14,14,13,13,13,14,14,12,13,12,14,13,14,15, - 15,16,16,13,14,13,16,13,10,11,12,13,14,11,12,13, - 13,15,12,12,13,14,14,13,14,14,15,16,13,14,14,16, - 15,12,12,13,12,14,12,12,13,13,15,13,13,13,13,15, - 14,14,15,14,16,14,15,15,15,16,12,13,12,14,14,13, - 13,13,15,15,12,13,13,15,15,14,15,15,16,16,14,15, - 15,16,16,13,14,14,13,16,14,14,15,14,16,14,14,15, - 14,16,15,15,16,15,18,16,16,16,16,17,14,14,14,16, - 15,14,15,15,16,16,14,15,15,16,16,16,16,16,17,17, - 15,16,16,17,16,10,12,11,14,13,12,13,13,14,14,12, - 13,12,15,14,14,14,14,15,15,14,15,14,16,15,12,13, - 12,14,13,12,13,13,15,14,13,14,13,15,14,14,15,15, - 16,16,14,15,15,17,15,12,13,12,14,14,13,14,14,15, - 15,13,14,13,15,14,15,15,15,16,16,14,15,15,17,15, - 14,14,14,16,15,14,15,15,16,16,14,15,15,16,15,16, - 16,16,16,17,16,17,16,18,17,14,14,14,16,15,15,15, - 15,16,16,14,15,14,16,15,16,16,17,17,17,15,16,15, - 17,16, 6, 8, 8,11,11, 8, 9,10,12,12, 8,10, 9,12, - 11,10,11,12,13,13,10,11,11,13,13, 8, 9,10,11,12, - 9,10,11,12,13,10,11,11,12,12,11,12,12,13,14,11, - 12,12,14,14, 8, 9, 9,12,11, 9,10,10,12,12, 9,10, - 10,12,12,11,12,12,14,14,11,12,11,14,13,11,11,12, - 13,13,11,12,12,13,14,12,12,12,14,14,13,13,14,14, - 15,13,14,14,15,15,10,11,11,13,13,11,12,12,14,14, - 11,12,12,14,13,13,14,14,15,15,13,14,13,15,13, 7, - 9, 9,11,12, 9,10,11,12,13, 9,10,10,12,12,11,12, - 13,13,14,11,12,12,14,14, 9,10,10,12,12,10,10,11, - 12,13,11,12,11,13,13,12,12,13,13,15,12,13,13,15, - 14, 9,10,10,12,12,10,11,12,13,13,10,11,10,13,12, - 12,13,13,14,15,12,13,12,14,13,12,12,12,14,14,12, - 12,13,13,14,13,13,13,15,14,14,13,14,13,16,14,15, - 15,16,16,11,12,12,13,14,12,13,13,14,15,12,13,12, - 14,13,14,14,15,15,16,13,14,13,15,13, 8, 9, 9,11, - 11, 9,10,10,12,12, 9,10,10,12,12,11,12,12,14,14, - 11,12,11,14,13, 9,10,10,12,12,10,11,11,13,13,10, - 11,11,13,13,12,12,13,14,15,12,13,13,15,14, 9,10, - 9,12,11,10,11,10,13,12,10,11,10,13,12,12,13,12, - 14,14,12,13,12,15,13,11,12,12,13,14,12,13,13,14, - 14,12,13,13,14,14,14,14,14,14,16,14,14,14,16,15, - 11,12,11,14,12,12,13,12,15,13,12,13,12,15,13,14, - 14,14,16,15,13,14,13,16,14,10,11,12,13,14,12,12, - 13,13,15,12,13,13,14,14,14,14,15,15,16,14,14,14, - 15,16,12,12,13,14,14,12,13,14,14,15,13,14,14,15, - 15,14,15,15,15,17,15,15,15,16,16,12,12,13,13,14, - 13,13,14,14,15,12,13,13,14,15,15,15,15,15,17,14, - 15,15,15,15,14,14,14,16,16,14,15,15,15,16,15,15, - 15,16,16,16,15,16,16,18,16,16,17,17,17,14,14,14, - 15,16,15,15,15,16,17,14,15,14,16,16,16,16,17,17, - 18,16,16,15,17,16,10,12,11,14,13,12,12,12,14,14, - 11,13,12,14,13,13,14,14,15,15,13,14,13,16,15,12, - 12,13,14,14,12,13,13,15,15,13,13,13,15,15,14,15, - 15,16,16,14,15,15,17,16,12,13,12,14,12,13,13,13, - 15,13,12,13,12,15,13,14,15,15,16,15,14,15,14,16, - 14,14,14,14,16,16,14,15,15,16,16,14,15,15,16,16, - 15,16,16,16,17,16,17,16,18,17,13,14,14,16,13,14, - 15,15,16,14,14,15,14,16,14,16,16,16,17,16,15,16, - 15,18,15, 9,11,11,13,13,11,12,12,14,14,11,12,12, - 14,14,13,14,14,15,15,13,14,14,15,15,11,12,12,14, - 14,11,12,13,14,15,12,13,13,15,14,13,14,14,15,16, - 13,14,14,16,16,11,12,12,14,14,12,13,13,15,15,12, - 13,13,15,14,14,14,14,16,16,14,15,14,16,15,12,13, - 13,14,15,12,13,14,15,16,13,14,14,16,16,14,14,15, - 16,17,15,15,15,17,17,13,14,14,15,15,14,15,14,16, - 16,14,15,14,16,15,15,16,16,17,17,15,16,15,17,16, - 10,12,12,13,14,11,12,13,14,14,12,13,12,14,14,13, - 14,14,15,16,13,14,14,16,15,11,12,12,14,14,12,12, - 13,14,15,12,13,13,15,15,13,13,15,15,17,14,14,15, - 16,16,12,13,12,14,14,12,13,13,15,15,12,13,13,15, - 14,14,15,15,16,16,14,15,14,16,16,13,12,14,13,16, - 13,13,15,14,16,14,13,15,15,16,14,14,16,15,17,15, - 15,16,16,17,13,14,14,16,15,14,15,15,16,16,14,15, - 14,16,15,16,16,16,17,17,15,16,16,18,16,10,12,12, - 14,14,12,12,13,14,14,12,13,12,15,14,13,14,14,15, - 16,14,15,14,16,15,11,12,12,14,14,12,13,13,14,15, - 13,14,13,15,15,14,14,15,15,16,14,15,15,17,16,12, - 13,13,14,14,13,13,14,15,15,12,14,13,15,15,14,15, - 15,16,16,14,15,15,17,15,13,14,13,15,15,13,14,14, - 15,16,14,15,14,17,16,15,15,15,15,17,16,16,16,18, - 17,14,14,14,16,16,15,15,15,16,16,14,15,14,16,16, - 16,16,17,17,17,16,16,16,17,16,11,12,13,14,14,12, - 13,13,15,15,12,13,13,15,15,14,15,15,16,16,14,15, - 15,17,16,12,13,13,14,15,13,13,14,14,16,13,14,14, - 15,16,15,14,16,15,17,15,15,16,16,17,12,13,13,15, - 15,13,14,14,16,16,13,14,14,16,15,15,15,16,17,17, - 15,16,15,17,16,14,14,15,13,16,15,14,16,14,17,15, - 15,16,14,17,16,15,17,15,18,16,16,17,16,18,14,15, - 15,17,16,15,16,16,17,17,15,16,15,17,16,16,17,17, - 18,18,16,17,15,18,16,11,12,12,14,14,13,13,14,14, - 15,13,14,13,16,14,15,15,15,16,16,15,16,15,17,16, - 12,13,13,15,14,13,13,14,15,15,14,15,14,16,15,15, - 15,16,15,16,16,16,16,18,16,12,13,13,15,15,14,14, - 15,15,16,13,14,13,16,15,16,16,16,17,17,15,16,15, - 17,15,14,15,14,16,15,14,15,15,16,16,15,16,15,17, - 16,16,15,16,15,17,17,18,17,18,17,15,15,15,16,16, - 16,16,16,17,17,14,15,15,17,16,17,17,18,18,18,16, - 17,15,18,15, 9,11,11,13,13,11,12,12,14,14,11,12, - 12,14,14,13,14,14,15,16,13,14,14,15,15,11,12,12, - 14,14,12,13,13,14,15,12,13,13,14,14,14,14,15,15, - 16,14,14,14,16,16,11,12,12,14,14,12,13,13,14,15, - 11,13,12,14,14,13,14,14,16,16,13,14,14,16,15,13, - 14,14,15,15,14,14,15,15,16,14,15,14,16,16,15,15, - 16,16,17,15,16,16,17,17,12,13,13,15,15,13,14,14, - 16,15,12,14,13,16,15,15,16,15,17,17,14,15,15,17, - 15,10,12,12,14,14,12,12,13,14,15,12,13,12,14,14, - 14,14,15,15,16,13,14,14,16,16,12,13,13,14,14,13, - 13,14,14,15,13,14,13,15,15,14,15,15,15,17,14,15, - 15,16,16,11,12,12,14,14,13,13,14,15,15,12,13,13, - 15,14,14,15,15,16,17,14,15,14,16,15,14,14,14,16, - 16,14,15,15,16,16,15,15,15,16,16,15,16,16,16,18, - 16,17,16,18,17,13,13,14,15,15,14,14,15,16,16,13, - 14,14,16,15,16,16,17,17,17,15,15,15,17,15,10,12, - 12,14,13,12,12,13,14,14,11,13,12,14,14,13,14,14, - 16,16,13,14,14,16,15,12,12,13,14,14,12,13,13,14, - 15,13,13,13,15,15,14,14,15,16,16,14,15,15,16,16, - 11,12,12,14,14,12,13,13,15,15,12,13,12,15,14,14, - 15,14,16,16,13,15,13,16,15,13,14,14,15,16,14,15, - 15,15,17,14,15,15,16,16,16,15,16,16,17,16,16,16, - 17,17,13,14,12,16,13,14,15,13,16,15,13,15,13,16, - 14,15,16,15,17,16,15,16,14,17,15,11,12,12,14,15, - 13,13,14,14,16,13,14,13,15,14,15,15,16,16,17,15, - 15,15,16,16,12,13,13,15,15,13,13,14,15,16,14,15, - 14,16,15,15,15,16,15,17,16,16,16,17,17,12,13,13, - 14,15,14,14,15,15,16,13,14,13,15,15,16,16,16,17, - 17,15,16,15,16,15,15,15,15,16,16,14,15,15,16,17, - 16,16,16,17,17,16,15,17,15,18,17,18,17,18,18,14, - 14,15,15,17,15,15,16,16,17,14,15,15,16,16,17,17, - 17,17,18,16,16,15,17,15,11,12,12,14,14,12,13,13, - 15,15,12,13,13,15,15,14,15,15,16,16,14,15,14,17, - 16,13,13,13,15,15,13,14,14,15,16,13,14,14,16,16, - 15,15,16,16,17,15,16,16,17,17,12,13,13,15,14,13, - 14,14,16,15,13,14,13,16,14,15,16,16,17,16,15,16, - 14,17,15,14,15,15,16,17,15,15,16,16,17,15,16,16, - 17,17,16,15,17,16,18,16,17,17,18,18,14,15,14,16, - 13,15,16,15,17,14,15,16,14,17,14,16,17,16,18,16, - 16,17,15,18,15, -}; - -static const static_codebook _44p9_p5_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p9_p5_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44p9_p5_0, - 0 -}; - -static const long _vq_quantlist__44p9_p5_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44p9_p5_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44p9_p5_1 = { - 1, 7, - (long *)_vq_lengthlist__44p9_p5_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44p9_p5_1, - 0 -}; - -static const long _vq_quantlist__44p9_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p9_p6_0[] = { - 2, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 8, 9, 7, - 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 8, 5, 7, 8, 8, 9, - 10, 8, 9,10, 8, 9,10,10,10,12,10,11,11, 8,10,10, - 10,11,12,10,11,10, 5, 8, 7, 8,10,10, 8,10, 9, 8, - 10,10,10,10,11,10,12,11, 8,10, 9,10,11,11,10,12, - 10, 5, 8, 8, 7, 9,10, 8,10, 9, 7, 9,10, 9,10,11, - 9,11,11, 8,10, 9,10,11,11, 9,11,10, 7, 9, 9, 9, - 10,11, 9,11,11, 9, 9,11,10,10,13,11,12,12, 9,11, - 11,11,12,13,11,13,11, 7, 9, 9, 9,10,11, 9,11,10, - 9,11,10,10,10,12,11,13,12, 9,11,11,11,12,12,10, - 12,10, 5, 8, 8, 8, 9,10, 7,10, 9, 8, 9,10, 9,10, - 11,10,11,11, 7,10, 9, 9,11,11, 9,11,10, 7, 9, 9, - 9,10,11, 9,11,10, 9,11,11,10,10,12,11,12,12, 9, - 10,11,11,12,13,10,12,10, 7, 9, 9, 9,11,11, 9,11, - 10, 9,11,11,11,11,13,11,13,12, 9,11, 9,11,12,12, - 10,13,10, -}; - -static const static_codebook _44p9_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44p9_p6_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44p9_p6_0, - 0 -}; - -static const long _vq_quantlist__44p9_p6_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44p9_p6_1[] = { - 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 8, 7, - 8, 8, 7, 8, 7, 7, 8, 8, 7, 8, 8, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 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, 9, - 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, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 8, 8, - 8, 8, 9, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 9, 9, 8, - 9, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, - 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 8, 9, 9, 8, 8, 8, 8, 9, 8, - 8, 9, 8, -}; - -static const static_codebook _44p9_p6_1 = { - 5, 243, - (long *)_vq_lengthlist__44p9_p6_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44p9_p6_1, - 0 -}; - -static const long _vq_quantlist__44p9_p7_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p9_p7_0[] = { - 1,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, - 12,12,12,12,12,12,12,12,12,12,12,12,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,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,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 const static_codebook _44p9_p7_0 = { - 5, 3125, - (long *)_vq_lengthlist__44p9_p7_0, - 1, -510105088, 1635281408, 3, 0, - (long *)_vq_quantlist__44p9_p7_0, - 0 -}; - -static const long _vq_quantlist__44p9_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44p9_p7_1[] = { - 1, 4, 4,16,16, 4, 9,11,15,16, 4,12, 8,16,16,12, - 16,16,16,16,13,16,16,16,16, 5, 8,10,16,16, 9, 9, - 14,15,16,12,14,14,16,16,16,16,16,16,16,16,16,16, - 16,16, 5,11, 8,16,15,12,14,16,16,16, 9,15, 9,16, - 16,16,16,16,16,16,16,16,16,16,16,15,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,16,16,16,16,16,16,16, 6,11,11, - 16,16,12,13,16,16,16,12,16,14,16,16,16,16,16,16, - 16,16,16,16,16,16,11,15,15,16,16,14,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,12, - 15,16,16,16,16,16,16,16,16,14,16,15,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,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16, 5,11,11,16,16,12, - 15,16,16,16,12,16,14,16,16,16,16,16,16,16,16,16, - 16,16,16,12,15,15,16,16,14,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,11,15,15,16, - 16,16,16,16,16,16,15,16,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,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,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,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,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,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,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,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16, 6,11,12,16,16,11,15,16,16,16,13,16,14,16,16, - 16,16,16,16,16,16,16,16,16,16,11,16,14,16,16,14, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,12,14,14,16,16,16,16,16,16,16,15,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,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, 8,13, - 15,16,16,15,15,16,16,16,14,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,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, - 15,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,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, 7,12,12,16,16, - 13,12,16,16,16,14,16,14,16,16,16,16,16,16,16,16, - 16,16,16,16,13,16,16,16,16,14,14,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,12,14,16, - 16,16,16,16,16,16,16,14,16,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,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,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,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,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,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,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, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16, 6,11,11,16,16,13,15,16,16,16,11,15,14,16, - 16,16,16,16,16,16,14,16,16,16,16,11,16,16,16,16, - 16,16,16,16,16,15,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,11,16,14,16,16,14,16,16,16,16,13,15, - 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,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 7, - 11,11,16,16,13,13,16,16,16,13,16,13,16,16,16,16, - 16,16,16,16,16,16,16,16,12,16,15,16,16,14,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,12,14,16,16,16,16,16,16,16,16,14,16,13,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,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16, 8,13,14,16, - 16,15,16,16,16,16,14,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,16,16,16,16,16,16,16,16,16,16,16,16,16,15,16, - 15,16,16,16,16,16,16,16,16,16,15,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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, - 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,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,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,15,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,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,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, - 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,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,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,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,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,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,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,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, - 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 const static_codebook _44p9_p7_1 = { - 5, 3125, - (long *)_vq_lengthlist__44p9_p7_1, - 1, -514619392, 1630767104, 3, 0, - (long *)_vq_quantlist__44p9_p7_1, - 0 -}; - -static const long _vq_quantlist__44p9_p7_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p9_p7_2[] = { - 1, 3, 2, 5, 4, 7, 7, 8, 8, 9,10,10,10,11,11,11, - 12,12,12,13,13,13,13,13,13, -}; - -static const static_codebook _44p9_p7_2 = { - 1, 25, - (long *)_vq_lengthlist__44p9_p7_2, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44p9_p7_2, - 0 -}; - -static const long _vq_quantlist__44p9_p7_3[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44p9_p7_3[] = { - 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44p9_p7_3 = { - 1, 25, - (long *)_vq_lengthlist__44p9_p7_3, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44p9_p7_3, - 0 -}; - -static const long _huff_lengthlist__44p9_short[] = { - 3, 3, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _huff_book__44p9_short = { - 1, 8, - (long *)_huff_lengthlist__44p9_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44pn1_l0_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__44pn1_l0_0[] = { - 1, 3, 3, 8, 8,10,10,10,10,10,10,10,10, 5, 7, 5, - 9, 8,10,10,10,10,11,10,11,10, 5, 5, 7, 8, 9,10, - 10,11,10,10,11,10,11,10,10,10,11,11,11,11,11,11, - 11,10,11,11,10,10,10,10,11,11,11,11,11,10,11,11, - 11,11,11,11,11,11,12,11,10,11,11,11,11,11,11,11, - 11,11,11,11,11,10,10,11,11,12,11,11,11,11,11,11, - 12,11,11,11,10,11,11,11,11,11,11,11,11,10,11,11, - 10,11,10,11,11,11,11,11,11,11,11,11,11,12,11,11, - 12,12,11,11,11,11,11,11,11,11,11,11,11,11,12,11, - 10,11,11,11,11,11,11,11,12,11,13,11,11,11,11,11, - 11,11,11,11,11,11,12,11,13, -}; - -static const static_codebook _44pn1_l0_0 = { - 2, 169, - (long *)_vq_lengthlist__44pn1_l0_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44pn1_l0_0, - 0 -}; - -static const long _vq_quantlist__44pn1_l0_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44pn1_l0_1[] = { - 1, 4, 4, 7, 7, 4, 5, 6, 7, 7, 4, 6, 5, 7, 7, 7, - 6, 7, 6, 7, 7, 7, 6, 7, 6, -}; - -static const static_codebook _44pn1_l0_1 = { - 2, 25, - (long *)_vq_lengthlist__44pn1_l0_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44pn1_l0_1, - 0 -}; - -static const long _vq_quantlist__44pn1_l1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_l1_0[] = { - 1, 4, 4, 4, 4, 4, 4, 4, 4, -}; - -static const static_codebook _44pn1_l1_0 = { - 2, 9, - (long *)_vq_lengthlist__44pn1_l1_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44pn1_l1_0, - 0 -}; - -static const long _huff_lengthlist__44pn1_lfe[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book__44pn1_lfe = { - 2, 4, - (long *)_huff_lengthlist__44pn1_lfe, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__44pn1_long[] = { - 2, 3, 6, 7, 9,13,17, 3, 2, 5, 7, 9,13,17, 6, 5, - 5, 6, 9,12,16, 7, 7, 6, 6, 7,10,13,10,10, 9, 7, - 6,10,13,13,13,12,10,10,11,15,17,17,17,14,14,15, - 17, -}; - -static const static_codebook _huff_book__44pn1_long = { - 2, 49, - (long *)_huff_lengthlist__44pn1_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44pn1_p1_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_p1_0[] = { - 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 const static_codebook _44pn1_p1_0 = { - 5, 243, - (long *)_vq_lengthlist__44pn1_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44pn1_p1_0, - 0 -}; - -static const long _vq_quantlist__44pn1_p2_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_p2_0[] = { - 1, 5, 5, 0, 7, 7, 0, 8, 8, 0, 9, 9, 0,12,12, 0, - 8, 8, 0, 9, 9, 0,13,13, 0, 8, 8, 0, 6, 6, 0,11, - 11, 0,12,12, 0,12,12, 0,14,14, 0,11,12, 0,12,12, - 0,15,15, 0,12,12, 0, 5, 5, 0, 5, 5, 0, 6, 6, 0, - 7, 7, 0,10,10, 0, 6, 6, 0, 7, 7, 0,11,11, 0, 6, - 6, 0, 7, 7, 0,11,11, 0,12,11, 0,11,11, 0,14,14, - 0,10,10, 0,12,12, 0,15,15, 0,12,12, 0, 6, 6, 0, - 12,12, 0,12,12, 0,12,12, 0,14,14, 0,11,11, 0,12, - 12, 0,16,16, 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, - 0, 0, 0, 8, 8, 0,12,12, 0,12,12, 0,12,12, 0,15, - 15, 0,12,12, 0,11,11, 0,16,16, 0,11,11, 0, 6, 6, - 0,12,12, 0,12,12, 0,13,13, 0,15,15, 0,12,12, 0, - 13,13, 0,15,15, 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, 0, 0, -}; - -static const static_codebook _44pn1_p2_0 = { - 5, 243, - (long *)_vq_lengthlist__44pn1_p2_0, - 1, -533200896, 1614282752, 2, 0, - (long *)_vq_quantlist__44pn1_p2_0, - 0 -}; - -static const long _vq_quantlist__44pn1_p2_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_p2_1[] = { - 1, 3, 3, 0, 9, 9, 0, 9, 9, 0,10,10, 0, 9, 9, 0, - 10,10, 0,10,10, 0,10,10, 0,10,10, 0, 7, 7, 0, 7, - 7, 0, 6, 6, 0, 8, 8, 0, 7, 7, 0, 8, 8, 0, 8, 8, - 0, 7, 7, 0, 8, 8, 0, 7, 7, 0, 9, 9, 0, 8, 9, 0, - 10,10, 0, 9, 9, 0,10,10, 0,10,11, 0, 9, 9, 0,10, - 10, 0, 9, 9, 0,11,11, 0,12,12, 0,12,12, 0,11,11, - 0,12,12, 0,13,13, 0,12,12, 0,13,13, 0, 8, 8, 0, - 12,12, 0,12,12, 0,13,13, 0,13,13, 0,13,13, 0,13, - 13, 0,13,13, 0,13,13, 0, 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, 9, 9, 0,11,11, 0,12,12, 0,13,13, 0,12, - 12, 0,13,13, 0,13,13, 0,12,12, 0,12,12, 0, 9, 9, - 0,12,12, 0,13,13, 0,14,14, 0,13,13, 0,14,14, 0, - 14,14, 0,13,13, 0,14,14, 0, 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, -}; - -static const static_codebook _44pn1_p2_1 = { - 5, 243, - (long *)_vq_lengthlist__44pn1_p2_1, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44pn1_p2_1, - 0 -}; - -static const long _vq_quantlist__44pn1_p3_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_p3_0[] = { - 1, 6, 6, 6, 8, 8, 6, 8, 8, 7, 9, 9,10,11,11, 8, - 8, 8, 7, 9, 9,11,12,12, 9, 9, 9, 6, 7, 7,10,11, - 11,10,11,11,10,11,11,13,13,13,12,12,12,10,12,11, - 14,14,14,12,12,12, 6, 5, 5, 9, 6, 6, 9, 6, 6, 9, - 7, 7,12,10,10,11, 7, 6, 9, 7, 7,13,11,11,12, 7, - 7, 7, 8, 8,12,10,10,12,10,10,11,10,10,15,13,13, - 13, 9, 9,12,11,11,15,14,14,15,11,11, 8, 7, 7,12, - 11,11,12,11,11,11,11,11,14,13,14,14,12,12,12,11, - 11,16,15,15,14,12,12, 0,10,10, 0,12,12, 0,12,12, - 0,11,11, 0,14,14, 0,11,11, 0,11,11, 0,15,15, 0, - 11,11, 7, 8, 8,13,11,11,12,10,10,12,11,11,15,13, - 13,14,11,11,12,10,10,16,14,14,15,10,10, 9, 7, 7, - 13,11,12,13,12,11,12,11,11,15,14,14,14,12,12,13, - 12,12,16,15,15,15,12,12, 0,11,11, 0,12,12, 0,12, - 13, 0,12,12, 0,15,15, 0,12,12, 0,12,12, 0,16,15, - 0,12,12, -}; - -static const static_codebook _44pn1_p3_0 = { - 5, 243, - (long *)_vq_lengthlist__44pn1_p3_0, - 1, -531365888, 1616117760, 2, 0, - (long *)_vq_quantlist__44pn1_p3_0, - 0 -}; - -static const long _vq_quantlist__44pn1_p3_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44pn1_p3_1[] = { - 2, 3, 4, 9, 9,10,12,12,12,11,10,12,12,13,12,11, - 13,12,11,11,11,12,12,12,11,11,13,13,13,13,11,12, - 12,14,14,12,13,13,13,13,11,13,13,13,13,11,13,13, - 13,13,11,13,13,13,13,11,12,12,14,14,12,13,13,12, - 12,11,13,13,13,13,11,13,13,12,12,11,13,13,13,13, - 12,12,13,14,14,12,13,13,12,12,11,13,13,13,13,11, - 13,13,12,12,11,13,13,13,13,12,13,13,14,14,12,13, - 13,12,12,11,13,13,13,13,11,13,13,12,12,11,10,10, - 10,10,12,10,10,11,11,12, 9, 9,11,11,13,11,11,10, - 10,13,10,10,10,10,13,11,11,12,12,13,10,10,12,12, - 14,12,11,12,12,13,11,11,11,12,13,12,12,12,12,13, - 11,11,12,12,13,10,10,12,12,14,11,11,12,12,13,11, - 11,12,12,13,11,11,12,12,14,12,12,12,12,14,10,10, - 11,11,14,12,11,11,11,13,11,11,11,11,13,12,12,11, - 11,14,12,12,12,11,14,10,10,11,11,14,12,11,11,11, - 13,11,11,11,11,13,12,12,11,11,11,11,11,10,10,12, - 10,11, 9, 9,12,12,12,11,11,13,12,12, 9, 9,13,13, - 13,10,10,13,13,13,12,12,13,13,13,14,14,13,12,12, - 11,11,14,13,13,12,12,14,13,13,11,11,13,13,13,12, - 11,13,13,13,14,14,13,12,12,10,10,14,13,13,11,11, - 13,13,13,10,10,13,13,13,11,11,14,13,13,14,14,14, - 12,12,10,10,13,13,13,11,11,13,13,13,10,10,13,13, - 13,11,11,14,13,13,14,14,14,13,13,10,10,13,13,13, - 11,11,13,13,13,10,10,14,12,12, 8, 8,14,12,12, 9, - 9,14,11,11, 9, 9,14,12,12, 8, 8,14,12,12, 7, 7, - 15,13,13,10,10,15,12,12,10,10,15,13,13,10,10,15, - 12,13, 9, 9,15,13,13,10,10,15,13,13,10,10,15,12, - 12,10,10,15,13,13,10,10,15,13,13, 9, 9,15,13,13, - 10,10,15,13,13,10,10,15,12,12,10,10,15,13,13, 9, - 9,14,13,12, 9, 9,14,13,13, 9, 9,15,13,13,10,10, - 15,12,12,10,10,15,13,13, 9, 9,15,13,13, 9, 9,14, - 13,13, 9, 9,14,12,12, 8, 8,13,13,13, 8, 8,14,14, - 13, 9, 9,14,14,13, 7, 7,14,14,14, 8, 8,14,14,14, - 10,10,15,14,14,12,12,14,14,14, 9, 9,15,14,14,10, - 10,14,14,14, 9, 9,14,14,14,10, 9,15,14,14,12,12, - 14,14,14, 9, 9,15,14,14,10,10,14,14,14, 9, 9,15, - 14,15, 9, 9,15,14,14,11,11,14,14,14, 8, 8,14,14, - 14, 9, 9,14,14,14, 8, 8,14,15,14,10,10,15,14,14, - 11,11,14,14,14, 8, 8,15,14,14, 9, 9,14,14,14, 8, - 8,12,12,12,13,13,16,16,15,12,12,17,16,16,13,13, - 17,16,16,11,11,17,16,16,12,12,17,16,17,13,13,17, - 16,16,14,14,17,17,16,12,12,18,16,16,13,13,17,16, - 17,12,12,17,17,17,13,13,18,16,16,14,14,18,17,17, - 12,12,17,17,17,13,13,18,17,17,13,13,17,17,17,13, - 13,17,16,16,14,14,17,17,17,12,12,16,16,17,13,13, - 17,17,16,12,12,18,17,17,13,13,18,16,16,14,14,18, - 17,17,12,12,19,16,17,13,13,17,16,17,12,12,13,14, - 14,10,10,16,14,14,13,13,17,15,15,14,14,17,14,14, - 13,13,16,14,14,13,13,17,16,15,14,14,16,16,16,15, - 15,17,15,15,14,14,17,15,15,14,14,17,15,15,14,14, - 17,16,15,14,14,16,16,16,15,15,18,15,15,13,13,16, - 16,15,14,14,17,15,15,14,13,17,15,15,14,14,16,16, - 16,15,15,18,15,14,13,13,17,15,15,14,14,18,14,15, - 13,13,18,15,15,14,14,16,16,16,15,15,17,15,15,13, - 13,17,15,15,14,14,17,15,15,13,13,13,11,11,10,10, - 16,14,14,13,13,17,14,15,14,14,17,15,15,12,12,17, - 14,14,12,12,16,15,15,14,14,16,14,14,14,14,16,15, - 15,14,14,16,15,15,14,14,16,15,15,14,14,16,15,15, - 14,14,16,15,14,15,15,17,15,15,14,14,17,15,15,14, - 14,17,15,15,14,14,17,15,16,14,14,16,14,14,14,14, - 17,15,15,13,13,17,15,15,13,13,16,15,15,13,13,17, - 16,16,14,14,17,15,14,15,14,17,15,15,13,13,17,15, - 15,13,13,17,15,15,13,13,14,14,14, 9, 9,14,14,14, - 18,19,14,15,15,19,18,14,14,14,19,19,15,14,14,19, - 19,15,16,16,19,19,15,16,16,19,19,15,15,15,19,19, - 15,16,16,19,20,15,15,15,19,19,15,15,15,19,19,15, - 16,16,20,20,15,15,15,18,19,15,15,16,19,20,15,15, - 15,19,18,15,15,15,18,18,15,16,16,21,20,15,15,15, - 19,19,15,15,15,19,19,15,15,14,19,20,15,15,15,20, - 19,15,16,16,19,20,15,15,15,19,19,15,15,15,20,21, - 15,14,15,19,19,14,12,12, 9, 9,14,14,15,21,19,14, - 14,14,18,19,14,15,15,19,20,14,14,14,19,19,15,15, - 15,19,20,15,15,14,21,19,15,15,15,20,19,15,14,15, - 20,21,15,15,15,18,18,15,15,15,20,21,16,14,14,18, - 19,15,15,15,20,19,15,15,15,18,21,15,15,15,19,19, - 15,15,15,19,20,16,15,14,20,19,15,16,15,19,19,15, - 15,15,19, 0,14,15,15,19,19,15,15,15,19,19,15,15, - 14,20,19,15,15,15,20,19,15,15,15,19,19,15,15,15, - 20,19,12,12,12,13,13,16,15,16,11,11,16,16,16,12, - 12,17,16,16,11,11,17,16,16,12,11,17,17,17,13,13, - 18,16,16,14,14,18,18,17,13,13,17,16,16,13,13,17, - 17,17,13,13,17,16,17,12,12,17,15,16,13,13,17,16, - 17,12,12,17,16,16,13,12,17,16,16,12,12,18,17,17, - 13,13,18,16,16,13,14,18,17,17,12,12,17,16,16,12, - 12,17,17,17,12,12,18,17,17,13,13,17,16,16,14,14, - 17,17,17,12,12,17,16,16,12,12,18,17,17,12,12,13, - 14,14, 9, 9,16,14,14,13,13,16,15,15,14,14,16,14, - 14,13,13,16,14,14,13,13,17,16,15,15,15,16,15,16, - 16,15,17,15,15,14,14,17,15,15,15,15,17,15,15,14, - 14,17,15,15,14,14,16,15,16,16,16,17,15,15,14,14, - 16,15,15,14,15,16,15,15,14,14,17,15,15,15,15,16, - 16,16,15,16,18,15,14,13,14,17,15,15,14,14,17,14, - 14,13,13,17,15,15,14,14,16,15,15,15,15,17,15,14, - 14,14,17,15,15,14,14,17,14,14,13,13,13,11,11,11, - 11,16,14,14,12,12,16,14,14,13,13,16,14,14,12,12, - 16,14,14,12,12,16,15,15,13,13,17,14,14,14,14,17, - 15,15,13,13,16,15,15,14,13,16,15,15,13,13,16,15, - 15,13,13,16,14,14,14,14,16,15,15,13,13,16,14,15, - 13,13,17,15,15,13,13,17,15,15,13,13,16,14,14,14, - 14,17,15,15,12,12,17,14,15,13,13,17,15,15,12,12, - 16,15,15,13,13,17,14,14,14,14,17,15,15,12,12,17, - 15,15,13,13,16,15,15,12,12,14,15,15, 8, 8,14,14, - 14,19,18,14,15,15,19,20,14,14,14,19,19,14,14,15, - 19,20,15,16,15,19,21,15,16,16,21,19,15,15,15,20, - 19,15,16,16,19,20,15,15,15,19,18,15,16,15,20,19, - 15,16,16,19,20,15,15,15,19,19,15,16,15,20,20,14, - 15,15,19,19,15,15,15,21,19,15,17,16,19,20,15,14, - 15, 0,21,15,15,15,19,20,14,14,14,19,19,15,15,15, - 20,19,15,16,16,19,19,15,15,15,19,18,15,15,15,20, - 19,14,14,15,18,18,14,12,12, 9, 9,14,14,14,18,18, - 14,14,14,18,18,14,15,14,19,18,14,14,14,19,18,15, - 15,15,19,20,15,14,14,18,18,15,15,15,20,19,15,15, - 15,18,20,15,15,15,19,18,15,15,15,19,19,15,14,14, - 19,21,15,15,15,20,20,15,15,15,18,19,14,15,15,19, - 20,15,15,15,20,19,15,14,14,19,21,15,15,15,18,19, - 15,14,15,20,19,14,15,15,21,21,14,15,15,19,20,15, - 14,14,19,20,15,15,15,19,20,15,15,14,20,20,14,15, - 15,20,19,13,12,12,13,13,17,16,16,11,11,17,16,16, - 12,12,18,17,16,11,11,18,16,16,11,11,17,17,17,13, - 13,18,16,16,13,13,18,17,17,12,12,18,16,16,13,13, - 18,17,17,12,12,18,17,17,13,13,18,16,16,14,14,18, - 16,17,12,12,18,17,17,13,13,17,17,17,12,12,17,17, - 17,12,12,17,16,15,13,13,18,16,16,11,11,17,16,16, - 12,12,17,16,17,11,11,18,17,17,13,12,17,16,16,13, - 13,17,17,17,12,12,17,16,17,12,12,18,17,17,11,11, - 14,14,14, 9, 9,16,14,14,13,13,17,15,15,14,14,17, - 14,14,13,13,16,14,14,13,13,17,15,15,14,14,16,16, - 16,16,15,18,15,15,14,14,17,16,15,15,15,17,15,15, - 14,14,17,15,15,14,15,16,16,16,15,16,18,15,15,14, - 14,17,15,15,14,15,17,15,15,14,14,17,15,15,14,14, - 16,16,16,15,16,17,14,14,13,13,17,15,15,14,14,18, - 15,15,13,13,17,15,15,14,14,16,16,16,15,15,17,14, - 14,13,13,17,15,15,14,14,17,14,14,13,13,13,11,11, - 11,11,16,14,14,12,12,16,14,14,12,13,17,15,14,11, - 11,17,14,14,11,11,17,15,15,13,14,17,14,14,14,14, - 17,15,15,13,13,17,14,14,13,13,17,15,15,13,13,17, - 15,15,13,13,17,14,14,14,14,17,15,15,13,13,18,14, - 15,13,13,17,15,15,13,13,16,15,15,13,13,17,14,14, - 13,13,17,15,15,12,12,16,14,14,12,12,16,15,15,12, - 12,17,16,15,13,13,17,14,14,13,13,17,15,15,12,12, - 16,15,15,12,12,16,15,15,12,12,13,15,15, 8, 8,14, - 14,14,18,19,14,15,15,19,20,14,14,14,18,18,14,15, - 15,18,18,15,16,16,19,19,15,16,17,20,20,15,15,15, - 19,19,15,16,16,18,20,15,15,15,19,19,15,15,16,18, - 18,15,17,16,19,19,15,15,15,18,21,15,16,16,21,20, - 15,15,15,19,21,15,16,15,20,19,15,16,17,20,20,15, - 15,15,19,19,15,16,16,21,20,15,15,15,19,20,15,15, - 15,19,19,15,16,16,20,19,15,15,15,19,19,15,16,15, - 20,21,15,15,15,21,19,14,12,12, 8, 8,14,14,14,20, - 18,14,13,13,19,19,14,14,14,19,18,15,14,14,19,20, - 14,15,15,20,20,15,14,14,21,20,15,15,15,20,20,15, - 15,14,21,19,15,15,15,19,19,15,15,15,19,20,15,14, - 14,20,20,15,15,15,19,20,15,14,14,19,20,15,15,15, - 20,20,15,15,15,20,19,15,14,14,20,21,15,15,15,20, - 21,15,14,14,20, 0,15,16,15,20,21,15,15,15,19,20, - 15,14,14,19,19,15,15,15,19,20,15,15,15,19,19,15, - 15,15,18,20,13,12,12,13,13,18,16,17,12,12,17,16, - 16,12,12,17,17,16,11,11,18,16,16,11,11,17,17,18, - 13,13,18,16,16,14,14,18,17,17,13,13,18,16,16,13, - 13,18,17,17,12,12,17,17,16,13,13,17,16,16,13,14, - 18,17,17,12,12,18,16,16,12,13,17,16,17,12,12,17, - 18,17,13,13,18,16,16,13,13,18,17,17,12,12,17,16, - 16,12,12,17,17,17,11,11,17,16,17,12,12,17,16,16, - 13,13,17,16,16,11,11,17,16,16,12,12,18,16,17,11, - 11,14,14,14, 9, 9,16,14,15,13,13,17,15,15,14,14, - 17,14,14,12,12,16,14,14,13,13,18,15,15,15,15,17, - 15,16,15,16,18,15,15,14,14,17,15,16,15,15,17,15, - 15,14,14,18,15,15,14,14,16,16,16,16,15,17,15,15, - 14,14,16,15,15,14,14,17,15,15,14,14,17,15,15,14, - 14,17,16,16,15,15,17,15,14,13,13,17,15,15,14,14, - 17,15,15,13,13,17,15,15,14,14,16,16,16,15,15,18, - 15,14,14,14,17,15,15,14,14,18,15,15,13,13,13,12, - 12,11,11,16,14,14,12,12,16,14,14,13,13,17,15,15, - 12,12,17,14,14,12,12,17,15,15,14,14,17,14,14,14, - 14,17,15,15,13,13,17,15,14,13,13,17,15,15,13,13, - 17,15,15,13,13,16,14,14,14,14,17,15,15,13,13,16, - 14,14,13,13,16,15,15,13,13,17,15,16,13,13,17,14, - 14,14,13,17,15,15,12,12,16,15,14,12,12,17,15,15, - 12,12,16,15,16,13,13,16,14,14,14,13,17,15,15,12, - 12,16,14,14,12,12,17,15,15,12,12,14,15,15, 8, 8, - 14,14,14,18,18,14,15,15,19,18,14,14,14,18,18,14, - 15,15,19,20,15,16,15,21,18,15,16,16,18, 0,15,15, - 15,19,20,15,16,16,20, 0,15,16,15,19,18,15,15,15, - 19,19,15,16,16,21,19,15,15,15,19,19,15,16,16,20, - 20,15,15,15,19,19,15,15,15,19,18,15,16,16,20,20, - 15,14,15,20,19,15,15,15,19,20,15,15,15,19,19,15, - 16,15,19,20,15,16,16,19,20,15,15,15,19,19,15,16, - 15,20,20,15,15,15,20,18,13,12,12, 8, 8,14,14,14, - 19,20,14,14,14,19,19,14,15,15,20,20,14,14,14,18, - 19,15,15,15,20, 0,15,14,14,18,20,15,15,15,19,19, - 15,15,15,21,19,15,15,15,19,20,15,15,15,20,21,15, - 14,14,20,19,15,15,15,20,19,15,15,14,21,19,15,15, - 15,19,18,15,15,15,20,19,15,14,14,19,19,15,15,16, - 20,19,15,15,15,20, 0,15,15,15,19,21,15,15,15,22, - 20,15,14,14,22,19,15,15,15,19,20,15,14,14,20,19, - 14,15,15,19,21, -}; - -static const static_codebook _44pn1_p3_1 = { - 5, 3125, - (long *)_vq_lengthlist__44pn1_p3_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44pn1_p3_1, - 0 -}; - -static const long _vq_quantlist__44pn1_p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__44pn1_p4_0[] = { - 1, 7, 7,14,14, 6, 8, 8,15,16, 7, 8, 8,16,15, 0, - 14,14,17,17, 0,14,14,16,16, 7, 9, 9,16,16,10,11, - 11,17,18, 9, 8, 8,16,16, 0,14,14,19,19, 0,14,14, - 17,16, 8, 9, 9,16,16,12,12,12,17,17,10, 9, 9,16, - 16, 0,15,14,18,20, 0,14,14,17,17, 0,15,15,18,17, - 0,21, 0, 0,21, 0,13,13,17,17, 0,17,17, 0, 0, 0, - 15,15,17,17, 0,15,15,17,18, 0, 0, 0, 0,21, 0,13, - 13,17,17, 0,18,18, 0,21, 0,16,15,17,18, 6, 7, 7, - 14,14, 9,10,10,16,16,11,10,10,15,15, 0,21, 0,20, - 21, 0, 0, 0,18,20,10,10,10,15,16,12,13,13,18,18, - 12,11,11,15,15, 0, 0, 0,20,20, 0, 0,21,19,19,12, - 11,11,15,15,15,14,14,18,18,13,11,11,15,16, 0, 0, - 0,20,19, 0, 0, 0,20,21, 0, 0,20,19,19, 0, 0, 0, - 0, 0, 0,20, 0,17,18, 0, 0,21, 0, 0, 0, 0, 0,21, - 0, 0,21, 0,20,19, 0, 0, 0, 0, 0, 0,21, 0,18,18, - 0, 0, 0,21, 0, 0, 0, 0, 0,20, 7, 6, 6,13,13, 9, - 6, 6,12,12, 9, 7, 7,14,14, 0,10,10,12,12, 0,11, - 11,15,15, 9, 7, 7,14,14,12, 9, 9,14,14,10, 7, 7, - 14,13, 0,11,11,16,15, 0,11,11,14,14, 9, 7, 7,14, - 14,13,10,10,14,14,11, 7, 7,14,13, 0,11,11,16,16, - 0,11,11,14,14, 0,12,12,16,16, 0,19, 0,17,18, 0, - 10,10,14,14, 0,15,14, 0, 0, 0,12,12,14,14, 0,12, - 12,15,15, 0,20, 0,18,19, 0,10,10,14,14, 0,16,15, - 0,20, 0,13,13,14,14, 0,11,11,13,13, 0,12,13,16, - 16, 0,12,12,16,16, 0,16,16, 0,21, 0,17,18, 0, 0, - 0,12,12,16,16, 0,15,15,18, 0, 0,12,12,16,16, 0, - 17,16,21,21, 0,16,17, 0, 0, 0,13,13,17,16, 0,16, - 16,20,21, 0,12,12,17,16, 0,17,17, 0,21, 0,17,17, - 21,21, 0,17,18, 0, 0, 0, 0, 0, 0, 0, 0,15,15, 0, - 0, 0,18,21, 0, 0, 0,18,19, 0, 0, 0,18,17,21,21, - 0, 0, 0, 0, 0, 0,16,16, 0, 0, 0, 0, 0, 0, 0, 0, - 19,19, 0, 0, 0,11,11,12,12, 0,11,11,10,10, 0,12, - 12,13,13, 0,12,12, 9, 9, 0,14,14,13,13, 0,12,12, - 13,13, 0,14,14,12,13, 0,11,11,12,12, 0,13,13,13, - 13, 0,13,13,13,13, 0,12,12,13,13, 0,14,14,12,12, - 0,11,11,12,12, 0,14,13,14,14, 0,13,13,13,13, 0, - 15,15,14,15, 0, 0, 0,16,16, 0,12,12,13,13, 0,16, - 17,20,21, 0,14,13,12,12, 0,14,14,14,14, 0,21, 0, - 16,16, 0,12,12,13,13, 0,18,17,21, 0, 0,14,14,13, - 13, 7, 8, 8,17,17,11,10,10,18,18,12,10,10,17,17, - 0,15,15,20,18, 0,15,15,17,17,11, 9, 9,17,17,14, - 12,12,19,19,13, 9, 9,16,16, 0,15,14, 0,19, 0,14, - 14,16,16,12,10,10,20,18,16,13,13,21,20,14,10,10, - 17,17, 0,15,15,21,20, 0,15,14,17,17, 0,15,15,21, - 21, 0, 0,21, 0, 0, 0,13,13,18,18, 0,19,16, 0, 0, - 0,15,15,17,16, 0,16,16, 0,21, 0, 0, 0, 0,21, 0, - 13,14,18,17, 0,20,19, 0, 0, 0,15,15,18,18, 8, 7, - 7,15,15,12,11,11,17,16,13,11,11,16,16, 0, 0, 0, - 21,20, 0, 0, 0, 0,20,11,10,10,17,17,14,13,13,19, - 18,14,11,11,16,16, 0,20, 0,21,19, 0, 0,21, 0,20, - 12,11,11,17,17,16,15,15, 0,19,14,11,11,17,16, 0, - 21, 0, 0,19, 0, 0, 0,21,20, 0, 0,21,20, 0, 0, 0, - 0, 0, 0, 0, 0, 0,19,21, 0, 0, 0, 0, 0, 0, 0, 0, - 19,20, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0,20, 0,19, - 21, 0, 0, 0, 0, 0, 0, 0, 0,21,20,11,10, 9,15,15, - 14,11,11,15,15,14,11,11,16,16, 0,14,14,14,14, 0, - 16,15,17,16,13,11,11,16,16,16,13,13,16,16,15,10, - 10,15,15, 0,14,15,17,17, 0,14,14,16,15,13,11,11, - 16,16,17,15,14,16,16,15,10,10,15,15, 0,15,15,17, - 18, 0,15,15,16,16, 0,16,16,17,17, 0,21, 0,21,20, - 0,13,13,15,15, 0,18,18, 0,21, 0,15,15,15,15, 0, - 16,16,17,17, 0, 0, 0, 0,18, 0,13,13,15,15, 0,19, - 18, 0, 0, 0,15,15,16,16, 0,12,12,15,15, 0,13,13, - 17,17, 0,13,13,17,18, 0,16,17,21, 0, 0,20,18, 0, - 0, 0,13,13,17,17, 0,15,15, 0,18, 0,12,12,17,18, - 0,16,16, 0, 0, 0,17,17,21, 0, 0,13,13,18,18, 0, - 16,16,21,21, 0,12,12,17,18, 0,16,17,21, 0, 0,17, - 17, 0,21, 0,17,18, 0, 0, 0, 0, 0, 0, 0, 0,16,15, - 0,21, 0,21,19, 0, 0, 0,18,18, 0, 0, 0,18,19, 0, - 0, 0, 0, 0, 0, 0, 0,16,16,21,21, 0,20,19, 0, 0, - 0,19,21, 0,21, 0,12,12,15,15, 0,12,12,15,16, 0, - 13,13,16,16, 0,14,14,15,15, 0,16,15,17,17, 0,13, - 13,17,17, 0,15,15,16,18, 0,12,12,16,16, 0,14,14, - 17,17, 0,15,14,16,16, 0,13,13,16,16, 0,16,15,17, - 17, 0,12,12,16,16, 0,15,15,18,18, 0,14,14,17,16, - 0,16,16,17,18, 0, 0, 0,20,21, 0,13,13,16,17, 0, - 17,17, 0, 0, 0,15,15,16,16, 0,15,16,17,17, 0, 0, - 0,19, 0, 0,13,13,15,16, 0,19,18, 0, 0, 0,16,15, - 16,17, 8, 8, 8,17,17,13,11,10,17,18,13,10,10,17, - 17, 0,15,15,20,19, 0,15,15,17,17,12,10,10,19,18, - 15,12,12,20,18,14,10,10,17,16, 0,15,15,20,20, 0, - 14,15,16,16,13,10,10,17,17,17,14,14, 0,18,15,10, - 10,17,17, 0,16,15,20,20, 0,14,14,17,17, 0,15,16, - 20,20, 0, 0,21, 0, 0, 0,13,13,17,17, 0,18,17, 0, - 0, 0,15,16,17,18, 0,15,15,18,21, 0, 0, 0,21, 0, - 0,13,13,18,18, 0,19,19, 0, 0, 0,16,16,18,17, 9, - 8, 8,15,15,12,11,11,16,16,13,11,11,16,15, 0, 0, - 0, 0,21, 0,21, 0,19,19,12,11,11,17,18,15,13,13, - 18,19,14,11,11,16,16, 0, 0,21,21,19, 0, 0, 0,21, - 20,13,11,11,18,17,17,14,15,20,21,15,11,12,16,16, - 0, 0, 0,20, 0, 0, 0,21, 0,19, 0, 0, 0, 0,19, 0, - 0, 0, 0, 0, 0,21,21,19,19, 0, 0, 0,21, 0, 0, 0, - 0,19,21, 0, 0, 0,19,20, 0, 0, 0,21, 0, 0, 0,21, - 19,19, 0, 0, 0, 0, 0, 0, 0, 0,21,20, 0,11,11,15, - 15, 0,12,12,15,16, 0,12,12,16,16, 0,15,15,16,15, - 0,16,16,17,17, 0,12,12,17,17, 0,14,14,17,17, 0, - 11,11,16,16, 0,15,15,19,18, 0,15,15,16,16, 0,12, - 12,17,16, 0,14,15,16,16, 0,11,11,15,15, 0,16,16, - 18,19, 0,15,15,15,16, 0,17,17,18,20, 0,21, 0,21, - 19, 0,14,14,16,16, 0,18,18, 0, 0, 0,16,16,15,15, - 0,16,16,18,17, 0, 0, 0,19,20, 0,14,14,16,16, 0, - 19,19, 0, 0, 0,16,17,15,15, 0,12,12,14,15, 0,13, - 13,16,17, 0,12,12,17,17, 0,17,16, 0, 0, 0,18,17, - 21, 0, 0,13,13,19,17, 0,15,15,20,21, 0,12,12,17, - 17, 0,17,17, 0, 0, 0,17,17, 0, 0, 0,13,13,17,18, - 0,16,16,21, 0, 0,12,12,17,17, 0,17,17, 0, 0, 0, - 17,17, 0, 0, 0,18,21, 0, 0, 0, 0, 0, 0, 0, 0,15, - 15,21, 0, 0,20,21, 0, 0, 0,18,19, 0, 0, 0,18,17, - 0, 0, 0, 0, 0, 0, 0, 0,16,16,21, 0, 0,21,21, 0, - 0, 0,18,19, 0, 0, 0,12,12,16,16, 0,13,13,16,17, - 0,13,13,17,16, 0,14,14,16,16, 0,16,15,19,18, 0, - 13,13,17,17, 0,15,15,18,18, 0,12,12,16,16, 0,15, - 15,18,19, 0,15,15,17,16, 0,13,13,17,17, 0,16,16, - 18,17, 0,12,12,17,16, 0,15,15,18,18, 0,15,15,17, - 17, 0,16,16, 0,19, 0, 0, 0, 0, 0, 0,14,14,16,17, - 0,18,18, 0, 0, 0,15,15,17,17, 0,16,16,21,19, 0, - 21, 0,21,21, 0,13,14,16,16, 0,19,19, 0, 0, 0,15, - 16,16,16, 0,11,11,17,16, 0,15,14,19,18, 0,14,14, - 19,19, 0,18,17,18,20, 0,17,17,18,19, 0,13,13,17, - 17, 0,16,17,21,18, 0,13,13,17,16, 0,18,17,19, 0, - 0,16,17,18,18, 0,12,12,19,18, 0,18,18,20,20, 0, - 13,13,17,17, 0,17,17,21, 0, 0,16,17,17,18, 0,18, - 17,19,18, 0, 0, 0, 0, 0, 0,14,14,17,17, 0,19,19, - 21, 0, 0,16,16,16,17, 0,17,17,19,20, 0, 0, 0, 0, - 21, 0,15,15,17,18, 0,21,21, 0, 0, 0,17,17,17,18, - 0,10,10,15,15, 0,15,14,17,18, 0,14,14,16,16, 0, - 0, 0,18, 0, 0,21, 0,19, 0, 0,13,13,17,16, 0,17, - 17,18, 0, 0,14,14,16,15, 0, 0, 0,21, 0, 0,21, 0, - 19,18, 0,13,13,17,17, 0,18,18,20,20, 0,15,15,16, - 16, 0, 0, 0,21,21, 0, 0, 0,20,20, 0, 0, 0,19, 0, - 0, 0, 0, 0, 0, 0,21,20,18,18, 0, 0, 0, 0, 0, 0, - 0, 0, 0,20, 0, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, - 0,19,18, 0, 0, 0, 0,21, 0, 0, 0,18,20, 0,18,19, - 16,17, 0,21,19,17,17, 0, 0,21,18,18, 0, 0,21,20, - 19, 0, 0, 0,20,20, 0, 0,21,17,17, 0, 0, 0,19,19, - 0,20,20,17,17, 0, 0, 0, 0,20, 0, 0,20,18,18, 0, - 21,20,17,17, 0, 0, 0,20,21, 0,19, 0,17,17, 0, 0, - 21, 0, 0, 0,20, 0,18,19, 0, 0, 0,21,21, 0, 0, 0, - 0,21, 0,20,20,17,17, 0, 0, 0, 0, 0, 0,21, 0,18, - 17, 0, 0, 0,20,19, 0, 0, 0, 0,21, 0,20,20,17,17, - 0, 0, 0, 0, 0, 0,21,21,18,18, 0,12,12,15,14, 0, - 14,14,17,17, 0,14,14,17,16, 0,18,18,21, 0, 0,19, - 20, 0, 0, 0,13,13,18,17, 0,16,16,19,18, 0,13,13, - 17,17, 0,17,17, 0, 0, 0,17,17,21, 0, 0,13,13,17, - 17, 0,17,17,21,20, 0,13,13,18,17, 0,18,19,21,21, - 0,19,18, 0, 0, 0,18,17, 0, 0, 0, 0, 0, 0, 0, 0, - 15,16, 0, 0, 0,21,21, 0, 0, 0,20,18,21, 0, 0,17, - 18, 0, 0, 0, 0, 0, 0, 0, 0,15,16, 0, 0, 0, 0,20, - 0, 0, 0, 0,19, 0, 0, 0,15,15,18,19, 0,18,17,21, - 0, 0,16,18, 0,20, 0,17,18,21, 0, 0,18,20, 0, 0, - 0,16,16,21,21, 0,19,20,21, 0, 0,16,15, 0,21, 0, - 18,20, 0, 0, 0,18,19, 0, 0, 0,16,15,21,21, 0,21, - 0, 0, 0, 0,16,15,21, 0, 0,20,19, 0, 0, 0,18,21, - 21, 0, 0,20,18, 0, 0, 0, 0, 0, 0, 0, 0,16,16, 0, - 20, 0,21, 0, 0, 0, 0,17,18,20,21, 0,18,18,21,21, - 0, 0, 0, 0, 0, 0,16,16,20, 0, 0, 0,21, 0, 0, 0, - 21,18, 0, 0, 0,12,12,20,17, 0,15,15,19,18, 0,14, - 14,19,18, 0,18,17,21,19, 0,17,17,21,17, 0,13,13, - 21,19, 0,16,17,20,19, 0,13,13,16,16, 0,17,17,20, - 21, 0,16,16,19,17, 0,13,13,18,18, 0,17,19,19,19, - 0,13,13,17,17, 0,18,18, 0,19, 0,16,17,18,18, 0, - 16,17,19,21, 0, 0, 0, 0, 0, 0,15,15,16,17, 0,20, - 19,21, 0, 0,17,17,17,17, 0,17,17,21,19, 0, 0, 0, - 0, 0, 0,15,15,17,17, 0,21, 0, 0, 0, 0,18,18,17, - 17, 0,10,10,15,15, 0,15,15,17,17, 0,15,14,16,16, - 0, 0, 0,21,19, 0,21,21,19,21, 0,13,13,17,16, 0, - 17,17,18,19, 0,14,15,16,15, 0, 0, 0,21,19, 0,21, - 21,18,19, 0,14,14,16,17, 0,18,18,18,19, 0,15,15, - 15,16, 0, 0,21, 0,21, 0, 0, 0,19,20, 0, 0, 0,21, - 19, 0, 0, 0, 0, 0, 0,21,21,19,17, 0, 0, 0, 0, 0, - 0, 0, 0,21,21, 0,21, 0, 0,21, 0, 0, 0, 0, 0, 0, - 21,21,19,18, 0, 0, 0, 0, 0, 0, 0, 0, 0,19, 0,21, - 18,18,17, 0,21, 0,20,20, 0, 0, 0,18,20, 0, 0,21, - 18,21, 0, 0, 0,21,18, 0, 0, 0, 0,19, 0, 0, 0,21, - 21, 0,20,21,17,19, 0,21, 0,21, 0, 0,21, 0,18,18, - 0,20,21,17,18, 0, 0, 0,21,19, 0,20,21,17,18, 0, - 0, 0,21,21, 0, 0, 0,20,19, 0, 0, 0,21,21, 0, 0, - 0, 0, 0, 0,21,21,19,18, 0, 0, 0, 0, 0, 0, 0,21, - 19,18, 0,21,21,19, 0, 0, 0, 0,21, 0, 0,21,21,18, - 17, 0, 0, 0, 0, 0, 0,21, 0,21,18, 0,12,12,14,14, - 0,15,14,17,17, 0,14,14,17,16, 0,19,17, 0, 0, 0, - 19,19, 0, 0, 0,13,13,17,17, 0,17,17,20,20, 0,13, - 13,18,18, 0,18,17, 0, 0, 0,18,21, 0, 0, 0,13,13, - 17,17, 0,18,18,21,20, 0,14,14,18,19, 0,19,18,21, - 0, 0,19,19, 0, 0, 0,20,18,20, 0, 0, 0, 0, 0, 0, - 0,15,16, 0, 0, 0,21,21, 0, 0, 0,19,19, 0, 0, 0, - 18,18, 0, 0, 0, 0, 0, 0, 0, 0,16,16, 0,21, 0, 0, - 0, 0, 0, 0,19,20, 0, 0, 0,15,15,20,21, 0,17,17, - 21,21, 0,17,17, 0, 0, 0,19,18, 0, 0, 0,18,19, 0, - 0, 0,17,16, 0,21, 0, 0,20, 0, 0, 0,16,16, 0,20, - 0,19,19, 0,21, 0,19,18, 0,21, 0,16,16, 0, 0, 0, - 21,21, 0, 0, 0,16,16, 0, 0, 0,21,21, 0, 0, 0,19, - 19, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0, 0,17,17, - 0,21, 0, 0,20, 0, 0, 0,20,18,21,21, 0,19,18, 0, - 20, 0, 0, 0, 0, 0, 0,16,17,21, 0, 0, 0,21, 0, 0, - 0,19,20,21,20, -}; - -static const static_codebook _44pn1_p4_0 = { - 5, 3125, - (long *)_vq_lengthlist__44pn1_p4_0, - 1, -528744448, 1616642048, 3, 0, - (long *)_vq_quantlist__44pn1_p4_0, - 0 -}; - -static const long _vq_quantlist__44pn1_p4_1[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const long _vq_lengthlist__44pn1_p4_1[] = { - 2, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _44pn1_p4_1 = { - 1, 7, - (long *)_vq_lengthlist__44pn1_p4_1, - 1, -533200896, 1611661312, 3, 0, - (long *)_vq_quantlist__44pn1_p4_1, - 0 -}; - -static const long _vq_quantlist__44pn1_p5_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_p5_0[] = { - 1, 7, 7, 6, 8, 8, 7, 8, 8, 7, 9, 9,11,11,11, 9, - 8, 8, 7, 9, 9,11,12,11, 9, 9, 9, 6, 7, 7,10,11, - 11,10,10,10,10,11,11,15,14,14,12,12,12,11,11,11, - 14,14,14,12,12,12, 5, 6, 6, 8, 5, 5, 8, 7, 7, 8, - 8, 8,12,10,10,10, 7, 7, 8, 7, 7,12,10,10,10, 7, - 7, 6, 7, 7,12,11,11,12,10,10,11,10,10,14,14,13, - 13,10,10,11,10,10,16,14,14,14,11,10, 7, 7, 7,13, - 12,12,12,12,11,11,11,11,15,14,17,13,12,12,12,11, - 11,15,15,15,14,13,13,10, 9, 9,14,12,11,13,11,11, - 12,11,11,16,15,14,14,11,11,12,11,11,17,14,14,15, - 11,11, 7, 8, 8,12,11,11,13,10,10,11,10,10,17,14, - 13,14,10,10,12,10,10,18,15,15,14,10,10, 8, 7, 7, - 13,12,12,13,11,11,12,11,11,16,14,15,14,12,12,12, - 11,11,18,16,16,14,12,12,11,10,10,13,12,11,13,11, - 11,13,12,12, 0,15,14,14,11,11,13,11,11,16,15,15, - 15,11,11, -}; - -static const static_codebook _44pn1_p5_0 = { - 5, 243, - (long *)_vq_lengthlist__44pn1_p5_0, - 1, -527106048, 1620377600, 2, 0, - (long *)_vq_quantlist__44pn1_p5_0, - 0 -}; - -static const long _vq_quantlist__44pn1_p5_1[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_p5_1[] = { - 2, 6, 7, 6, 8, 8, 7, 7, 8, 7, 8, 8, 9, 9, 9, 8, - 7, 7, 8, 8, 8, 9, 9, 9, 9, 8, 8, 6, 6, 6, 9, 7, - 7, 9, 7, 7, 9, 8, 8,10, 8, 8,10, 8, 8,10, 8, 8, - 10, 9, 8,10, 8, 8, 7, 6, 6, 9, 6, 6, 9, 6, 6, 9, - 7, 7,10, 8, 8,10, 6, 6, 9, 7, 7,10, 8, 8,10, 6, - 6, 7, 7, 7,11, 9, 9,11, 9, 9,10, 9, 9,12,10,10, - 12, 8, 8,11, 9, 9,13, 9,10,12, 8, 8, 8, 7, 7,11, - 9,10,11,10,10,10, 9, 9,11,11,11,11, 9, 9,11,10, - 9,12,11,11,11, 9,10,10, 8, 8,11, 9,10,11, 9, 9, - 11, 9, 9,12,10,10,11, 9, 9,11, 9, 9,12,10,11,11, - 9, 9, 8, 8, 8,12, 9, 9,12, 9, 9,11, 9, 9,13, 9, - 9,13, 8, 8,12, 9, 9,13,10,10,12, 8, 8, 9, 7, 7, - 11,10,10,11,10,10,11,10,10,12,11,11,11,10, 9,11, - 10,10,11,11,11,11, 9, 9,11, 9, 9,12,10,10,11,10, - 10,12,10,10,11,11,11,11, 9, 9,11,10,10,12,11,11, - 11, 9, 9, -}; - -static const static_codebook _44pn1_p5_1 = { - 5, 243, - (long *)_vq_lengthlist__44pn1_p5_1, - 1, -530841600, 1616642048, 2, 0, - (long *)_vq_quantlist__44pn1_p5_1, - 0 -}; - -static const long _vq_quantlist__44pn1_p6_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__44pn1_p6_0[] = { - 1, 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, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 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, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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 const static_codebook _44pn1_p6_0 = { - 5, 243, - (long *)_vq_lengthlist__44pn1_p6_0, - 1, -516716544, 1630767104, 2, 0, - (long *)_vq_quantlist__44pn1_p6_0, - 0 -}; - -static const long _vq_quantlist__44pn1_p6_1[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44pn1_p6_1[] = { - 1, 3, 2, 5, 4, 7, 7, 8, 8, 9, 9,10,10,11,11,12, - 12,13,13,14,14,15,15,15,15, -}; - -static const static_codebook _44pn1_p6_1 = { - 1, 25, - (long *)_vq_lengthlist__44pn1_p6_1, - 1, -518864896, 1620639744, 5, 0, - (long *)_vq_quantlist__44pn1_p6_1, - 0 -}; - -static const long _vq_quantlist__44pn1_p6_2[] = { - 12, - 11, - 13, - 10, - 14, - 9, - 15, - 8, - 16, - 7, - 17, - 6, - 18, - 5, - 19, - 4, - 20, - 3, - 21, - 2, - 22, - 1, - 23, - 0, - 24, -}; - -static const long _vq_lengthlist__44pn1_p6_2[] = { - 3, 5, 4, 5, 4, 5, 4, 5, 5, 5, 4, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _44pn1_p6_2 = { - 1, 25, - (long *)_vq_lengthlist__44pn1_p6_2, - 1, -529006592, 1611661312, 5, 0, - (long *)_vq_quantlist__44pn1_p6_2, - 0 -}; - -static const long _huff_lengthlist__44pn1_short[] = { - 4, 3, 7, 9,12,16,16, 3, 2, 5, 7,11,14,15, 7, 4, - 5, 6, 9,12,15, 8, 5, 5, 5, 8,10,14, 9, 7, 6, 6, - 8,10,12,12,10,10, 7, 6, 8,10,15,12,10, 6, 4, 7, - 9, -}; - -static const static_codebook _huff_book__44pn1_short = { - 2, 49, - (long *)_huff_lengthlist__44pn1_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - diff --git a/src/lib/dl/ext/vorbis/books/coupled/res_books_stereo.h b/src/lib/dl/ext/vorbis/books/coupled/res_books_stereo.h deleted file mode 100755 index 5f26215e..00000000 --- a/src/lib/dl/ext/vorbis/books/coupled/res_books_stereo.h +++ /dev/null @@ -1,15783 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: res_books_stereo.h 17025 2010-03-25 04:56:56Z xiphmont $ - - ********************************************************************/ - -#include "codebook.h" - -static const long _vq_quantlist__16c0_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16c0_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__16c0_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16c0_s_p1_0, - 0 -}; - -static const long _vq_quantlist__16c0_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16c0_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__16c0_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16c0_s_p3_0, - 0 -}; - -static const long _vq_quantlist__16c0_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _16c0_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__16c0_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16c0_s_p4_0, - 0 -}; - -static const long _vq_quantlist__16c0_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _16c0_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__16c0_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16c0_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _16c0_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__16c0_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__16c0_s_p6_0, - 0 -}; - -static const long _vq_quantlist__16c0_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16c0_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__16c0_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__16c0_s_p7_0, - 0 -}; - -static const long _vq_quantlist__16c0_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _16c0_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__16c0_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16c0_s_p7_1, - 0 -}; - -static const long _vq_quantlist__16c0_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _16c0_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__16c0_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__16c0_s_p8_0, - 0 -}; - -static const long _vq_quantlist__16c0_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16c0_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__16c0_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16c0_s_p8_1, - 0 -}; - -static const long _vq_quantlist__16c0_s_p9_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16c0_s_p9_0 = { - 4, 81, - (long *)_vq_lengthlist__16c0_s_p9_0, - 1, -518803456, 1628680192, 2, 0, - (long *)_vq_quantlist__16c0_s_p9_0, - 0 -}; - -static const long _vq_quantlist__16c0_s_p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _16c0_s_p9_1 = { - 2, 225, - (long *)_vq_lengthlist__16c0_s_p9_1, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__16c0_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _16c0_s_p9_2 = { - 2, 441, - (long *)_vq_lengthlist__16c0_s_p9_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__16c0_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__16c0_s_single = { - 2, 100, - (long *)_huff_lengthlist__16c0_s_single, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__16c1_s_long = { - 2, 100, - (long *)_huff_lengthlist__16c1_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__16c1_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16c1_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__16c1_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16c1_s_p1_0, - 0 -}; - -static const long _vq_quantlist__16c1_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16c1_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__16c1_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16c1_s_p3_0, - 0 -}; - -static const long _vq_quantlist__16c1_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _16c1_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__16c1_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16c1_s_p4_0, - 0 -}; - -static const long _vq_quantlist__16c1_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _16c1_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__16c1_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16c1_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _16c1_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__16c1_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__16c1_s_p6_0, - 0 -}; - -static const long _vq_quantlist__16c1_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16c1_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__16c1_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__16c1_s_p7_0, - 0 -}; - -static const long _vq_quantlist__16c1_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _16c1_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__16c1_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16c1_s_p7_1, - 0 -}; - -static const long _vq_quantlist__16c1_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _16c1_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__16c1_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__16c1_s_p8_0, - 0 -}; - -static const long _vq_quantlist__16c1_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16c1_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__16c1_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16c1_s_p8_1, - 0 -}; - -static const long _vq_quantlist__16c1_s_p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _16c1_s_p9_0 = { - 2, 169, - (long *)_vq_lengthlist__16c1_s_p9_0, - 1, -513964032, 1628680192, 4, 0, - (long *)_vq_quantlist__16c1_s_p9_0, - 0 -}; - -static const long _vq_quantlist__16c1_s_p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _16c1_s_p9_1 = { - 2, 225, - (long *)_vq_lengthlist__16c1_s_p9_1, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__16c1_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _16c1_s_p9_2 = { - 2, 441, - (long *)_vq_lengthlist__16c1_s_p9_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__16c1_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__16c1_s_short = { - 2, 100, - (long *)_huff_lengthlist__16c1_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__16c2_s_long[] = { - 4, 7, 9, 9, 9, 8, 9,10,13,16, 5, 4, 5, 6, 7, 7, - 8, 9,12,16, 6, 5, 5, 5, 7, 7, 9,10,12,15, 7, 6, - 5, 4, 5, 6, 8, 9,10,13, 8, 7, 7, 5, 5, 5, 7, 9, - 10,12, 7, 7, 7, 6, 5, 5, 6, 7,10,12, 8, 8, 8, 7, - 7, 5, 5, 6, 9,11, 8, 9, 9, 8, 8, 6, 6, 5, 8,11, - 10,11,12,12,11, 9, 9, 8, 9,12,13,14,15,15,14,12, - 12,11,11,13, -}; - -static const static_codebook _huff_book__16c2_s_long = { - 2, 100, - (long *)_huff_lengthlist__16c2_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__16c2_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16c2_s_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__16c2_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16c2_s_p1_0, - 0 -}; - -static const long _vq_quantlist__16c2_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__16c2_s_p2_0[] = { - 2, 4, 4, 7, 7, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, - 0, 0, 8, 8, 0, 0, 0, 8, 8, 4, 4, 4, 8, 7, 0, 0, - 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, - 9, 9, 4, 4, 4, 7, 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, 9, - 0, 0, 0,12,11, 0, 0, 0,11,12, 0, 0, 0,14,13, 0, - 0, 0,14,14, 7, 8, 8, 9,10, 0, 0, 0,11,12, 0, 0, - 0,11,11, 0, 0, 0,14,14, 0, 0, 0,14,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, - 12,11, 0, 0, 0,12,12, 0, 0, 0,13,12, 0, 0, 0,13, - 13, 8, 8, 8,11,11, 0, 0, 0,11,11, 0, 0, 0,12,12, - 0, 0, 0,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, 8, 9, 8,12,11, 0, 0, 0,12,12, 0, - 0, 0,12,11, 0, 0, 0,13,13, 0, 0, 0,13,13, 8, 8, - 8,11,12, 0, 0, 0,11,12, 0, 0, 0,11,12, 0, 0, 0, - 13,14, 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,14, 0, 0, 0,13,13, 0, 0, 0,13, - 13, 0, 0, 0,13,12, 0, 0, 0,13,13, 8, 9, 9,14,14, - 0, 0, 0,13,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,14, 0, 0, 0,13,13, 0, 0, 0,13,13, 0, 0, - 0,13,13, 0, 0, 0,13,12, 8, 9, 9,14,14, 0, 0, 0, - 13,13, 0, 0, 0,13,13, 0, 0, 0,13,13, 0, 0, 0,12, - 12, -}; - -static const static_codebook _16c2_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__16c2_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16c2_s_p2_0, - 0 -}; - -static const long _vq_quantlist__16c2_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const long _vq_lengthlist__16c2_s_p3_0[] = { - 1, 3, 3, 5, 5, 7, 7, 8, 8, 0, 0, 0, 6, 6, 8, 8, - 9, 9, 0, 0, 0, 6, 6, 8, 8, 9, 9, 0, 0, 0, 7, 7, - 8, 9,10,10, 0, 0, 0, 7, 7, 9, 9,10,10, 0, 0, 0, - 8, 8, 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 const static_codebook _16c2_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__16c2_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16c2_s_p3_0, - 0 -}; - -static const 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 const long _vq_lengthlist__16c2_s_p4_0[] = { - 2, 3, 3, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, - 9, 0, 0, 0, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10, - 11,10, 0, 0, 0, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10, - 10,10,10, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10,10, - 11,11,11,11, 0, 0, 0, 7, 6, 8, 8, 9, 9, 9, 9,10, - 10,11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9,10,10, - 11,11,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10, - 10,11,11,11,11,12,12, 0, 0, 0, 7, 8, 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 const static_codebook _16c2_s_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__16c2_s_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__16c2_s_p4_0, - 0 -}; - -static const long _vq_quantlist__16c2_s_p5_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__16c2_s_p5_0[] = { - 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 6, 6,10,11,10,10, - 10,11, 4, 6, 6,10,10,11,10,11,10, 5,10,10, 9,12, - 11,10,12,12, 7,10,10,12,12,12,12,13,13, 7,11,10, - 11,12,12,12,13,13, 6,11,10,10,12,12,11,12,12, 7, - 11,10,12,13,13,12,12,12, 7,10,11,12,13,13,12,12, - 12, -}; - -static const static_codebook _16c2_s_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__16c2_s_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__16c2_s_p5_0, - 0 -}; - -static const long _vq_quantlist__16c2_s_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const long _vq_lengthlist__16c2_s_p5_1[] = { - 2, 3, 3, 6, 6, 6, 6, 7, 7, 7, 7,11,10,10, 6, 6, - 7, 7, 8, 8, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, - 8,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9,11,11,11, 6, - 7, 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, 9, 9,11,11,11, - 8, 8, 8, 8, 8, 8, 8, 8,11,11,11,11,11, 8, 8, 8, - 8, 8, 8,12,11,11,11,11, 8, 8, 8, 8, 8, 8,12,11, - 11,11,11, 7, 7, 8, 8, 8, 8, -}; - -static const static_codebook _16c2_s_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__16c2_s_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16c2_s_p5_1, - 0 -}; - -static const long _vq_quantlist__16c2_s_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__16c2_s_p6_0[] = { - 1, 4, 4, 6, 6, 8, 7, 8, 8, 9, 9,10,10, 5, 5, 5, - 7, 7, 9, 9, 9, 9,11,11,12,12, 6, 5, 5, 7, 7, 9, - 9,10, 9,11,11,12,12, 0, 7, 7, 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,13,13, 0,12, - 12, 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, -}; - -static const static_codebook _16c2_s_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__16c2_s_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__16c2_s_p6_0, - 0 -}; - -static const long _vq_quantlist__16c2_s_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16c2_s_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__16c2_s_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16c2_s_p6_1, - 0 -}; - -static const long _vq_quantlist__16c2_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__16c2_s_p7_0[] = { - 1, 4, 4, 7, 7, 8, 8, 8, 8,10, 9,10,10, 5, 5, 5, - 7, 7, 9, 9,10,10,11,10,12,11, 6, 5, 5, 7, 7, 9, - 9,10,10,11,11,12,12,20, 7, 7, 7, 7, 9, 9,10,10, - 11,11,12,12,20, 7, 7, 7, 7, 9, 9,11,10,12,11,12, - 12,20,11,11, 8, 8,10,10,11,11,12,12,13,13,20,12, - 12, 8, 8, 9, 9,11,11,12,12,13,13,20,20,21,10,10, - 10,10,11,11,12,12,13,13,21,21,21,10,10,10,10,11, - 11,12,12,13,13,21,21,21,14,14,11,11,12,12,13,13, - 13,14,21,21,21,16,15,11,11,12,11,13,13,14,14,21, - 21,21,21,21,13,13,12,12,13,13,14,14,21,21,21,21, - 21,13,13,12,12,13,13,14,14, -}; - -static const static_codebook _16c2_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__16c2_s_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__16c2_s_p7_0, - 0 -}; - -static const long _vq_quantlist__16c2_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const long _vq_lengthlist__16c2_s_p7_1[] = { - 2, 4, 4, 6, 6, 7, 7, 7, 7, 7, 7, 9, 9, 9, 6, 7, - 7, 7, 7, 7, 8, 8, 9, 9, 9, 6, 6, 7, 7, 7, 7, 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, 8, 8, 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 const static_codebook _16c2_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__16c2_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16c2_s_p7_1, - 0 -}; - -static const long _vq_quantlist__16c2_s_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const long _vq_lengthlist__16c2_s_p8_0[] = { - 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9,10,10, 6, - 6, 6, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11,11, 6, 5, - 5, 8, 7, 9, 9, 8, 8, 9, 9,10,10,11,11,20, 8, 8, - 8, 8, 9, 9, 9, 9,10,10,11,10,12,11,20, 8, 8, 8, - 8, 9, 9, 9, 9,10,10,11,11,12,12,20,12,12, 9, 9, - 10,10,10,10,11,11,12,12,13,12,20,13,13, 9, 9,10, - 10,10,10,11,11,12,12,13,13,20,20,20, 9, 9, 9, 9, - 10,10,11,11,12,12,13,12,20,20,20, 9, 9, 9, 8,10, - 10,12,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,10,12, - 11,13,13,14,14,20,20,20,20,20,11,11,11,11,12,12, - 13,13,14,14,20,20,20,20,20,11,10,11,11,13,11,13, - 13,14,14,20,20,21,21,21,14,14,11,12,13,13,13,13, - 14,14,21,21,21,21,21,15,15,12,11,13,12,14,13,15, - 14, -}; - -static const static_codebook _16c2_s_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__16c2_s_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__16c2_s_p8_0, - 0 -}; - -static const 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 const long _vq_lengthlist__16c2_s_p8_1[] = { - 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,11,10, 7, 7, 8, - 8, 8, 8, 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,10, 9,10,10,10,10,11,11,11, 8, 8, 9, 9, - 9, 9, 9, 9, 9, 9,10,10,10,10,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, 9, 9, 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, 9, 9,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,11,11,10, 9,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,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 const static_codebook _16c2_s_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__16c2_s_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__16c2_s_p8_1, - 0 -}; - -static const long _vq_quantlist__16c2_s_p9_0[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const long _vq_lengthlist__16c2_s_p9_0[] = { - 1, 4, 3,10, 8,10,10,10,10,10,10,10,10,10,10,10, - 10, 6,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 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,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,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 const static_codebook _16c2_s_p9_0 = { - 2, 289, - (long *)_vq_lengthlist__16c2_s_p9_0, - 1, -509798400, 1631393792, 5, 0, - (long *)_vq_quantlist__16c2_s_p9_0, - 0 -}; - -static const long _vq_quantlist__16c2_s_p9_1[] = { - 9, - 8, - 10, - 7, - 11, - 6, - 12, - 5, - 13, - 4, - 14, - 3, - 15, - 2, - 16, - 1, - 17, - 0, - 18, -}; - -static const long _vq_lengthlist__16c2_s_p9_1[] = { - 1, 4, 4, 7, 7, 7, 7, 7, 7, 8, 8,10, 9,11,10,13, - 11,14,13, 6, 6, 6, 8, 8, 8, 8, 8, 7, 9, 8,11, 9, - 13,11,14,12,14,13, 5, 6, 6, 8, 8, 8, 8, 8, 8, 9, - 9,11,11,13,11,14,13,15,15,17, 8, 8, 8, 8, 9, 9, - 9, 8,11, 9,12,10,13,11,14,12,14,13,17, 8, 8, 8, - 8, 9, 9, 9, 9,10,10,11,11,13,13,13,14,16,15,17, - 12,12, 8, 8, 9, 9,10,10,11,11,12,11,13,12,13,12, - 14,13,16,12,12, 8, 8, 9, 9,10,10,11,11,12,12,13, - 13,14,14,15,15,17,17,17, 9, 9, 9, 9,11,11,12,12, - 12,13,13,13,16,14,14,14,17,17,17, 9, 8, 9, 8,11, - 10,12,12,13,13,14,14,15,15,16,16,17,17,17,12,12, - 10,10,11,12,12,13,13,14,13,15,15,14,16,15,17,17, - 17,12,12,10, 8,12, 9,13,12,14,14,15,14,15,16,16, - 16,17,17,17,17,17,11,11,12,12,14,14,14,16,15,16, - 15,16,15,17,17,17,17,17,17,11, 9,12,10,13,11,15, - 14,16,16,17,16,16,15,17,17,17,17,17,15,15,12,12, - 14,14,15,16,16,15,16,16,17,17,17,17,17,17,17,14, - 14,12,10,14,11,15,12,17,16,15,16,17,16,17,17,17, - 17,17,17,17,13,13,14,14,14,16,17,17,16,17,17,17, - 17,17,17,17,17,17,17,13, 9,13,12,15,13,16,16,17, - 17,17,17,17,17,17,17,17,17,17,15,17,14,14,15,16, - 16,17,16,17,16,17,17,17,17,17,17,17,17,17,17,14, - 13,15,16,16,17,16,17,17,17, -}; - -static const static_codebook _16c2_s_p9_1 = { - 2, 361, - (long *)_vq_lengthlist__16c2_s_p9_1, - 1, -518287360, 1622704128, 5, 0, - (long *)_vq_quantlist__16c2_s_p9_1, - 0 -}; - -static const long _vq_quantlist__16c2_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 const long _vq_lengthlist__16c2_s_p9_2[] = { - 2, 4, 4, 4, 4, 5, 5, 5, 5, 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 const static_codebook _16c2_s_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__16c2_s_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__16c2_s_p9_2, - 0 -}; - -static const long _huff_lengthlist__16c2_s_short[] = { - 7,10,12,11,12,13,15,16,18,15,10, 8, 8, 8, 9,10, - 12,13,14,17,10, 7, 7, 7, 7, 8,10,12,15,18,10, 7, - 7, 5, 5, 6, 8,10,13,15,10, 7, 6, 5, 4, 4, 6, 9, - 12,15,11, 7, 7, 5, 4, 3, 4, 7,11,13,12, 9, 8, 7, - 5, 4, 4, 5,10,13,11,11,11, 9, 7, 5, 5, 5, 9,12, - 13,12,13,12,10, 8, 8, 7, 9,13,14,14,14,14,13,11, - 11,10,10,13, -}; - -static const static_codebook _huff_book__16c2_s_short = { - 2, 100, - (long *)_huff_lengthlist__16c2_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__8c0_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8c0_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__8c0_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__8c0_s_p1_0, - 0 -}; - -static const long _vq_quantlist__8c0_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8c0_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__8c0_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8c0_s_p3_0, - 0 -}; - -static const long _vq_quantlist__8c0_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _8c0_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__8c0_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__8c0_s_p4_0, - 0 -}; - -static const long _vq_quantlist__8c0_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _8c0_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__8c0_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__8c0_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _8c0_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__8c0_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__8c0_s_p6_0, - 0 -}; - -static const long _vq_quantlist__8c0_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8c0_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__8c0_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__8c0_s_p7_0, - 0 -}; - -static const long _vq_quantlist__8c0_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _8c0_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__8c0_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__8c0_s_p7_1, - 0 -}; - -static const long _vq_quantlist__8c0_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _8c0_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__8c0_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__8c0_s_p8_0, - 0 -}; - -static const long _vq_quantlist__8c0_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8c0_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__8c0_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8c0_s_p8_1, - 0 -}; - -static const long _vq_quantlist__8c0_s_p9_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8c0_s_p9_0 = { - 4, 81, - (long *)_vq_lengthlist__8c0_s_p9_0, - 1, -518803456, 1628680192, 2, 0, - (long *)_vq_quantlist__8c0_s_p9_0, - 0 -}; - -static const long _vq_quantlist__8c0_s_p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _8c0_s_p9_1 = { - 2, 225, - (long *)_vq_lengthlist__8c0_s_p9_1, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__8c0_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _8c0_s_p9_2 = { - 2, 441, - (long *)_vq_lengthlist__8c0_s_p9_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__8c0_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__8c0_s_single = { - 2, 100, - (long *)_huff_lengthlist__8c0_s_single, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__8c1_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8c1_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__8c1_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__8c1_s_p1_0, - 0 -}; - -static const long _vq_quantlist__8c1_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8c1_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__8c1_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8c1_s_p3_0, - 0 -}; - -static const long _vq_quantlist__8c1_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _8c1_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__8c1_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__8c1_s_p4_0, - 0 -}; - -static const long _vq_quantlist__8c1_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _8c1_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__8c1_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__8c1_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _8c1_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__8c1_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__8c1_s_p6_0, - 0 -}; - -static const long _vq_quantlist__8c1_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8c1_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__8c1_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__8c1_s_p7_0, - 0 -}; - -static const long _vq_quantlist__8c1_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _8c1_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__8c1_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__8c1_s_p7_1, - 0 -}; - -static const long _vq_quantlist__8c1_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _8c1_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__8c1_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__8c1_s_p8_0, - 0 -}; - -static const long _vq_quantlist__8c1_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8c1_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__8c1_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8c1_s_p8_1, - 0 -}; - -static const long _vq_quantlist__8c1_s_p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _8c1_s_p9_0 = { - 2, 169, - (long *)_vq_lengthlist__8c1_s_p9_0, - 1, -513964032, 1628680192, 4, 0, - (long *)_vq_quantlist__8c1_s_p9_0, - 0 -}; - -static const long _vq_quantlist__8c1_s_p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _8c1_s_p9_1 = { - 2, 225, - (long *)_vq_lengthlist__8c1_s_p9_1, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__8c1_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _8c1_s_p9_2 = { - 2, 441, - (long *)_vq_lengthlist__8c1_s_p9_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__8c1_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__8c1_s_single = { - 2, 100, - (long *)_huff_lengthlist__8c1_s_single, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c2_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c2_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c2_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c2_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c2_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c2_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c2_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c2_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c2_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c2_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44c2_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c2_s_p3_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c2_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c2_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c2_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c2_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44c2_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c2_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c2_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__44c2_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c2_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c2_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__44c2_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c2_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c2_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c2_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c2_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c2_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c2_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__44c2_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c2_s_p8_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c2_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__44c2_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c2_s_p8_1, - 0 -}; - -static const long _vq_quantlist__44c2_s_p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c2_s_p9_0 = { - 2, 169, - (long *)_vq_lengthlist__44c2_s_p9_0, - 1, -514541568, 1627103232, 4, 0, - (long *)_vq_quantlist__44c2_s_p9_0, - 0 -}; - -static const long _vq_quantlist__44c2_s_p9_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c2_s_p9_1 = { - 2, 169, - (long *)_vq_lengthlist__44c2_s_p9_1, - 1, -522616832, 1620115456, 4, 0, - (long *)_vq_quantlist__44c2_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c2_s_p9_2 = { - 2, 289, - (long *)_vq_lengthlist__44c2_s_p9_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c2_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c2_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c2_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c3_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c3_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c3_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c3_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c3_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c3_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c3_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c3_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c3_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c3_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44c3_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c3_s_p3_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c3_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c3_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c3_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c3_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44c3_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c3_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c3_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__44c3_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c3_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c3_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__44c3_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c3_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c3_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c3_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c3_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c3_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c3_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__44c3_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c3_s_p8_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c3_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__44c3_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c3_s_p8_1, - 0 -}; - -static const long _vq_quantlist__44c3_s_p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c3_s_p9_0 = { - 2, 169, - (long *)_vq_lengthlist__44c3_s_p9_0, - 1, -514332672, 1627381760, 4, 0, - (long *)_vq_quantlist__44c3_s_p9_0, - 0 -}; - -static const long _vq_quantlist__44c3_s_p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44c3_s_p9_1 = { - 2, 225, - (long *)_vq_lengthlist__44c3_s_p9_1, - 1, -522338304, 1620115456, 4, 0, - (long *)_vq_quantlist__44c3_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c3_s_p9_2 = { - 2, 289, - (long *)_vq_lengthlist__44c3_s_p9_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c3_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c3_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c3_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c4_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c4_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c4_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c4_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c4_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c4_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c4_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c4_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c4_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c4_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44c4_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c4_s_p3_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c4_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c4_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c4_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c4_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44c4_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c4_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c4_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__44c4_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c4_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c4_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__44c4_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c4_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c4_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c4_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c4_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c4_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c4_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__44c4_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c4_s_p8_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c4_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__44c4_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c4_s_p8_1, - 0 -}; - -static const long _vq_quantlist__44c4_s_p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c4_s_p9_0 = { - 2, 169, - (long *)_vq_lengthlist__44c4_s_p9_0, - 1, -513964032, 1628680192, 4, 0, - (long *)_vq_quantlist__44c4_s_p9_0, - 0 -}; - -static const long _vq_quantlist__44c4_s_p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44c4_s_p9_1 = { - 2, 225, - (long *)_vq_lengthlist__44c4_s_p9_1, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__44c4_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c4_s_p9_2 = { - 2, 441, - (long *)_vq_lengthlist__44c4_s_p9_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44c4_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c4_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c4_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c5_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c5_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c5_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c5_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c5_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c5_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c5_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c5_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c5_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c5_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c5_s_p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c5_s_p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44c5_s_p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c5_s_p3_0, - 0 -}; - -static const long _vq_quantlist__44c5_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c5_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c5_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c5_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c5_s_p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c5_s_p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44c5_s_p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c5_s_p5_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c5_s_p6_0 = { - 2, 289, - (long *)_vq_lengthlist__44c5_s_p6_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c5_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c5_s_p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c5_s_p7_0 = { - 4, 81, - (long *)_vq_lengthlist__44c5_s_p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c5_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c5_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c5_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c5_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c5_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c5_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c5_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__44c5_s_p8_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c5_s_p8_0, - 0 -}; - -static const long _vq_quantlist__44c5_s_p8_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c5_s_p8_1 = { - 2, 25, - (long *)_vq_lengthlist__44c5_s_p8_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c5_s_p8_1, - 0 -}; - -static const long _vq_quantlist__44c5_s_p9_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44c5_s_p9_0 = { - 2, 225, - (long *)_vq_lengthlist__44c5_s_p9_0, - 1, -512522752, 1628852224, 4, 0, - (long *)_vq_quantlist__44c5_s_p9_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c5_s_p9_1 = { - 2, 289, - (long *)_vq_lengthlist__44c5_s_p9_1, - 1, -520814592, 1620377600, 5, 0, - (long *)_vq_quantlist__44c5_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c5_s_p9_2 = { - 2, 441, - (long *)_vq_lengthlist__44c5_s_p9_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44c5_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c5_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c5_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c6_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c6_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c6_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c6_s_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44c6_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c6_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c6_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c6_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c6_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c6_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c6_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c6_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c6_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c6_s_p3_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c6_s_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__44c6_s_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c6_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c6_s_p5_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c6_s_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__44c6_s_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c6_s_p5_0, - 0 -}; - -static const long _vq_quantlist__44c6_s_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c6_s_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__44c6_s_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c6_s_p5_1, - 0 -}; - -static const long _vq_quantlist__44c6_s_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c6_s_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44c6_s_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c6_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c6_s_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c6_s_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44c6_s_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c6_s_p6_1, - 0 -}; - -static const long _vq_quantlist__44c6_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c6_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c6_s_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__44c6_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c6_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c6_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c6_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c6_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c6_s_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44c6_s_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__44c6_s_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__44c6_s_p8_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c6_s_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__44c6_s_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44c6_s_p8_1, - 0 -}; - -static const long _vq_quantlist__44c6_s_p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c6_s_p9_0 = { - 2, 169, - (long *)_vq_lengthlist__44c6_s_p9_0, - 1, -511845376, 1630791680, 4, 0, - (long *)_vq_quantlist__44c6_s_p9_0, - 0 -}; - -static const long _vq_quantlist__44c6_s_p9_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c6_s_p9_1 = { - 2, 169, - (long *)_vq_lengthlist__44c6_s_p9_1, - 1, -518889472, 1622704128, 4, 0, - (long *)_vq_quantlist__44c6_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c6_s_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__44c6_s_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__44c6_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c6_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c6_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c7_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c7_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c7_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c7_s_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44c7_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c7_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c7_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c7_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c7_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c7_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c7_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c7_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c7_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c7_s_p3_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c7_s_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__44c7_s_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c7_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c7_s_p5_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c7_s_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__44c7_s_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c7_s_p5_0, - 0 -}; - -static const long _vq_quantlist__44c7_s_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c7_s_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__44c7_s_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c7_s_p5_1, - 0 -}; - -static const long _vq_quantlist__44c7_s_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c7_s_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44c7_s_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c7_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c7_s_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c7_s_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44c7_s_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c7_s_p6_1, - 0 -}; - -static const long _vq_quantlist__44c7_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c7_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c7_s_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__44c7_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c7_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c7_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c7_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c7_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c7_s_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44c7_s_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__44c7_s_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__44c7_s_p8_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c7_s_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__44c7_s_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44c7_s_p8_1, - 0 -}; - -static const long _vq_quantlist__44c7_s_p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c7_s_p9_0 = { - 2, 169, - (long *)_vq_lengthlist__44c7_s_p9_0, - 1, -511845376, 1630791680, 4, 0, - (long *)_vq_quantlist__44c7_s_p9_0, - 0 -}; - -static const long _vq_quantlist__44c7_s_p9_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c7_s_p9_1 = { - 2, 169, - (long *)_vq_lengthlist__44c7_s_p9_1, - 1, -518889472, 1622704128, 4, 0, - (long *)_vq_quantlist__44c7_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c7_s_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__44c7_s_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__44c7_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c7_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c7_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c8_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c8_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c8_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c8_s_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44c8_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c8_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c8_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c8_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c8_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c8_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c8_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c8_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c8_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c8_s_p3_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c8_s_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__44c8_s_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c8_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c8_s_p5_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c8_s_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__44c8_s_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c8_s_p5_0, - 0 -}; - -static const long _vq_quantlist__44c8_s_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c8_s_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__44c8_s_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c8_s_p5_1, - 0 -}; - -static const long _vq_quantlist__44c8_s_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c8_s_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44c8_s_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c8_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c8_s_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c8_s_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44c8_s_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c8_s_p6_1, - 0 -}; - -static const long _vq_quantlist__44c8_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c8_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c8_s_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__44c8_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c8_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c8_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c8_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c8_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c8_s_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44c8_s_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__44c8_s_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__44c8_s_p8_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c8_s_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__44c8_s_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44c8_s_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c8_s_p9_0 = { - 2, 289, - (long *)_vq_lengthlist__44c8_s_p9_0, - 1, -509798400, 1631393792, 5, 0, - (long *)_vq_quantlist__44c8_s_p9_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c8_s_p9_1 = { - 2, 361, - (long *)_vq_lengthlist__44c8_s_p9_1, - 1, -518287360, 1622704128, 5, 0, - (long *)_vq_quantlist__44c8_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c8_s_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__44c8_s_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__44c8_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c8_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c8_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c9_s_long = { - 2, 100, - (long *)_huff_lengthlist__44c9_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c9_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c9_s_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44c9_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c9_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c9_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c9_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c9_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c9_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c9_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c9_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c9_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c9_s_p3_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c9_s_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__44c9_s_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c9_s_p4_0, - 0 -}; - -static const long _vq_quantlist__44c9_s_p5_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c9_s_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__44c9_s_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c9_s_p5_0, - 0 -}; - -static const long _vq_quantlist__44c9_s_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c9_s_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__44c9_s_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c9_s_p5_1, - 0 -}; - -static const long _vq_quantlist__44c9_s_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c9_s_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44c9_s_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c9_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c9_s_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c9_s_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44c9_s_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c9_s_p6_1, - 0 -}; - -static const long _vq_quantlist__44c9_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c9_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c9_s_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__44c9_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c9_s_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c9_s_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44c9_s_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c9_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c9_s_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44c9_s_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__44c9_s_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__44c9_s_p8_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c9_s_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__44c9_s_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44c9_s_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c9_s_p9_0 = { - 2, 361, - (long *)_vq_lengthlist__44c9_s_p9_0, - 1, -508535424, 1631393792, 5, 0, - (long *)_vq_quantlist__44c9_s_p9_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c9_s_p9_1 = { - 2, 361, - (long *)_vq_lengthlist__44c9_s_p9_1, - 1, -518287360, 1622704128, 5, 0, - (long *)_vq_quantlist__44c9_s_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c9_s_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__44c9_s_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__44c9_s_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c9_s_short = { - 2, 100, - (long *)_huff_lengthlist__44c9_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c0_s_long = { - 2, 81, - (long *)_huff_lengthlist__44c0_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c0_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c0_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c0_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c0_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c0_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c0_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c0_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c0_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c0_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c0_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c0_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c0_s_p3_0, - 0 -}; - -static const long _vq_quantlist__44c0_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c0_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c0_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c0_s_p4_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c0_s_p5_0 = { - 2, 289, - (long *)_vq_lengthlist__44c0_s_p5_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c0_s_p5_0, - 0 -}; - -static const long _vq_quantlist__44c0_s_p6_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c0_s_p6_0 = { - 4, 81, - (long *)_vq_lengthlist__44c0_s_p6_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c0_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c0_s_p6_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c0_s_p6_1 = { - 2, 121, - (long *)_vq_lengthlist__44c0_s_p6_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c0_s_p6_1, - 0 -}; - -static const long _vq_quantlist__44c0_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c0_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c0_s_p7_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c0_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c0_s_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c0_s_p7_1 = { - 2, 25, - (long *)_vq_lengthlist__44c0_s_p7_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c0_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c0_s_p8_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c0_s_p8_0 = { - 4, 625, - (long *)_vq_lengthlist__44c0_s_p8_0, - 1, -518283264, 1627103232, 3, 0, - (long *)_vq_quantlist__44c0_s_p8_0, - 0 -}; - -static const long _vq_quantlist__44c0_s_p8_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c0_s_p8_1 = { - 2, 169, - (long *)_vq_lengthlist__44c0_s_p8_1, - 1, -522616832, 1620115456, 4, 0, - (long *)_vq_quantlist__44c0_s_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c0_s_p8_2 = { - 2, 289, - (long *)_vq_lengthlist__44c0_s_p8_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c0_s_p8_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c0_s_short = { - 2, 81, - (long *)_huff_lengthlist__44c0_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c0_sm_long = { - 2, 81, - (long *)_huff_lengthlist__44c0_sm_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c0_sm_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c0_sm_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c0_sm_p1_0, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c0_sm_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c0_sm_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c0_sm_p2_0, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c0_sm_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c0_sm_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c0_sm_p3_0, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c0_sm_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c0_sm_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c0_sm_p4_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c0_sm_p5_0 = { - 2, 289, - (long *)_vq_lengthlist__44c0_sm_p5_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c0_sm_p5_0, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p6_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c0_sm_p6_0 = { - 4, 81, - (long *)_vq_lengthlist__44c0_sm_p6_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c0_sm_p6_0, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p6_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c0_sm_p6_1 = { - 2, 121, - (long *)_vq_lengthlist__44c0_sm_p6_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c0_sm_p6_1, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c0_sm_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c0_sm_p7_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c0_sm_p7_0, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c0_sm_p7_1 = { - 2, 25, - (long *)_vq_lengthlist__44c0_sm_p7_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c0_sm_p7_1, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p8_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c0_sm_p8_0 = { - 2, 81, - (long *)_vq_lengthlist__44c0_sm_p8_0, - 1, -516186112, 1627103232, 4, 0, - (long *)_vq_quantlist__44c0_sm_p8_0, - 0 -}; - -static const long _vq_quantlist__44c0_sm_p8_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c0_sm_p8_1 = { - 2, 169, - (long *)_vq_lengthlist__44c0_sm_p8_1, - 1, -522616832, 1620115456, 4, 0, - (long *)_vq_quantlist__44c0_sm_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c0_sm_p8_2 = { - 2, 289, - (long *)_vq_lengthlist__44c0_sm_p8_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c0_sm_p8_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c0_sm_short = { - 2, 81, - (long *)_huff_lengthlist__44c0_sm_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c1_s_long = { - 2, 81, - (long *)_huff_lengthlist__44c1_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c1_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c1_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c1_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c1_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44c1_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c1_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c1_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c1_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44c1_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c1_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c1_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c1_s_p3_0, - 0 -}; - -static const long _vq_quantlist__44c1_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c1_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c1_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c1_s_p4_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c1_s_p5_0 = { - 2, 289, - (long *)_vq_lengthlist__44c1_s_p5_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c1_s_p5_0, - 0 -}; - -static const long _vq_quantlist__44c1_s_p6_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c1_s_p6_0 = { - 4, 81, - (long *)_vq_lengthlist__44c1_s_p6_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c1_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44c1_s_p6_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c1_s_p6_1 = { - 2, 121, - (long *)_vq_lengthlist__44c1_s_p6_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c1_s_p6_1, - 0 -}; - -static const long _vq_quantlist__44c1_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c1_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c1_s_p7_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c1_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44c1_s_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c1_s_p7_1 = { - 2, 25, - (long *)_vq_lengthlist__44c1_s_p7_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c1_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44c1_s_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c1_s_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__44c1_s_p8_0, - 1, -514541568, 1627103232, 4, 0, - (long *)_vq_quantlist__44c1_s_p8_0, - 0 -}; - -static const long _vq_quantlist__44c1_s_p8_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c1_s_p8_1 = { - 2, 169, - (long *)_vq_lengthlist__44c1_s_p8_1, - 1, -522616832, 1620115456, 4, 0, - (long *)_vq_quantlist__44c1_s_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c1_s_p8_2 = { - 2, 289, - (long *)_vq_lengthlist__44c1_s_p8_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c1_s_p8_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c1_s_short = { - 2, 81, - (long *)_huff_lengthlist__44c1_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44c1_sm_long = { - 2, 81, - (long *)_huff_lengthlist__44c1_sm_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c1_sm_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44c1_sm_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44c1_sm_p1_0, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c1_sm_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44c1_sm_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c1_sm_p2_0, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c1_sm_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44c1_sm_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c1_sm_p3_0, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44c1_sm_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44c1_sm_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44c1_sm_p4_0, - 0 -}; - -static const 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 const 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 const static_codebook _44c1_sm_p5_0 = { - 2, 289, - (long *)_vq_lengthlist__44c1_sm_p5_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c1_sm_p5_0, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p6_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44c1_sm_p6_0 = { - 4, 81, - (long *)_vq_lengthlist__44c1_sm_p6_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44c1_sm_p6_0, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p6_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44c1_sm_p6_1 = { - 2, 121, - (long *)_vq_lengthlist__44c1_sm_p6_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44c1_sm_p6_1, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c1_sm_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44c1_sm_p7_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44c1_sm_p7_0, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44c1_sm_p7_1 = { - 2, 25, - (long *)_vq_lengthlist__44c1_sm_p7_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44c1_sm_p7_1, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p8_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c1_sm_p8_0 = { - 2, 169, - (long *)_vq_lengthlist__44c1_sm_p8_0, - 1, -514541568, 1627103232, 4, 0, - (long *)_vq_quantlist__44c1_sm_p8_0, - 0 -}; - -static const long _vq_quantlist__44c1_sm_p8_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44c1_sm_p8_1 = { - 2, 169, - (long *)_vq_lengthlist__44c1_sm_p8_1, - 1, -522616832, 1620115456, 4, 0, - (long *)_vq_quantlist__44c1_sm_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44c1_sm_p8_2 = { - 2, 289, - (long *)_vq_lengthlist__44c1_sm_p8_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44c1_sm_p8_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44c1_sm_short = { - 2, 81, - (long *)_huff_lengthlist__44c1_sm_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44cn1_s_long = { - 2, 81, - (long *)_huff_lengthlist__44cn1_s_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44cn1_s_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44cn1_s_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44cn1_s_p1_0, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44cn1_s_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44cn1_s_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44cn1_s_p2_0, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44cn1_s_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44cn1_s_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44cn1_s_p3_0, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44cn1_s_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44cn1_s_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44cn1_s_p4_0, - 0 -}; - -static const 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 const 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 const static_codebook _44cn1_s_p5_0 = { - 2, 289, - (long *)_vq_lengthlist__44cn1_s_p5_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44cn1_s_p5_0, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p6_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44cn1_s_p6_0 = { - 4, 81, - (long *)_vq_lengthlist__44cn1_s_p6_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44cn1_s_p6_0, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p6_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44cn1_s_p6_1 = { - 2, 121, - (long *)_vq_lengthlist__44cn1_s_p6_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44cn1_s_p6_1, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44cn1_s_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44cn1_s_p7_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44cn1_s_p7_0, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44cn1_s_p7_1 = { - 2, 25, - (long *)_vq_lengthlist__44cn1_s_p7_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44cn1_s_p7_1, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p8_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44cn1_s_p8_0 = { - 4, 625, - (long *)_vq_lengthlist__44cn1_s_p8_0, - 1, -518283264, 1627103232, 3, 0, - (long *)_vq_quantlist__44cn1_s_p8_0, - 0 -}; - -static const long _vq_quantlist__44cn1_s_p8_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44cn1_s_p8_1 = { - 2, 169, - (long *)_vq_lengthlist__44cn1_s_p8_1, - 1, -522616832, 1620115456, 4, 0, - (long *)_vq_quantlist__44cn1_s_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44cn1_s_p8_2 = { - 2, 289, - (long *)_vq_lengthlist__44cn1_s_p8_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44cn1_s_p8_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44cn1_s_short = { - 2, 81, - (long *)_huff_lengthlist__44cn1_s_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44cn1_sm_long = { - 2, 81, - (long *)_huff_lengthlist__44cn1_sm_long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44cn1_sm_p1_0 = { - 8, 6561, - (long *)_vq_lengthlist__44cn1_sm_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44cn1_sm_p1_0, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44cn1_sm_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44cn1_sm_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44cn1_sm_p2_0, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44cn1_sm_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44cn1_sm_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44cn1_sm_p3_0, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p4_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44cn1_sm_p4_0 = { - 2, 81, - (long *)_vq_lengthlist__44cn1_sm_p4_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44cn1_sm_p4_0, - 0 -}; - -static const 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 const 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 const static_codebook _44cn1_sm_p5_0 = { - 2, 289, - (long *)_vq_lengthlist__44cn1_sm_p5_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44cn1_sm_p5_0, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p6_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44cn1_sm_p6_0 = { - 4, 81, - (long *)_vq_lengthlist__44cn1_sm_p6_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44cn1_sm_p6_0, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p6_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44cn1_sm_p6_1 = { - 2, 121, - (long *)_vq_lengthlist__44cn1_sm_p6_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44cn1_sm_p6_1, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44cn1_sm_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44cn1_sm_p7_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44cn1_sm_p7_0, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p7_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44cn1_sm_p7_1 = { - 2, 25, - (long *)_vq_lengthlist__44cn1_sm_p7_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44cn1_sm_p7_1, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p8_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44cn1_sm_p8_0 = { - 2, 81, - (long *)_vq_lengthlist__44cn1_sm_p8_0, - 1, -516186112, 1627103232, 4, 0, - (long *)_vq_quantlist__44cn1_sm_p8_0, - 0 -}; - -static const long _vq_quantlist__44cn1_sm_p8_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44cn1_sm_p8_1 = { - 2, 169, - (long *)_vq_lengthlist__44cn1_sm_p8_1, - 1, -522616832, 1620115456, 4, 0, - (long *)_vq_quantlist__44cn1_sm_p8_1, - 0 -}; - -static const 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 const 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 const static_codebook _44cn1_sm_p8_2 = { - 2, 289, - (long *)_vq_lengthlist__44cn1_sm_p8_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44cn1_sm_p8_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44cn1_sm_short = { - 2, 81, - (long *)_huff_lengthlist__44cn1_sm_short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - diff --git a/src/lib/dl/ext/vorbis/books/floor/floor_books.h b/src/lib/dl/ext/vorbis/books/floor/floor_books.h deleted file mode 100755 index 14320cf6..00000000 --- a/src/lib/dl/ext/vorbis/books/floor/floor_books.h +++ /dev/null @@ -1,1547 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: floor_books.h 16939 2010-03-01 08:38:14Z xiphmont $ - - ********************************************************************/ - -#include "codebook.h" - -static const long _huff_lengthlist_line_256x7_0sub1[] = { - 0, 2, 3, 3, 3, 3, 4, 3, 4, -}; - -static const static_codebook _huff_book_line_256x7_0sub1 = { - 1, 9, - (long *)_huff_lengthlist_line_256x7_0sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x7_0sub2 = { - 1, 25, - (long *)_huff_lengthlist_line_256x7_0sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x7_0sub3 = { - 1, 64, - (long *)_huff_lengthlist_line_256x7_0sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_256x7_1sub1[] = { - 0, 3, 3, 3, 3, 2, 4, 3, 4, -}; - -static const static_codebook _huff_book_line_256x7_1sub1 = { - 1, 9, - (long *)_huff_lengthlist_line_256x7_1sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x7_1sub2 = { - 1, 25, - (long *)_huff_lengthlist_line_256x7_1sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x7_1sub3 = { - 1, 64, - (long *)_huff_lengthlist_line_256x7_1sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x7_class0 = { - 1, 64, - (long *)_huff_lengthlist_line_256x7_class0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x7_class1 = { - 1, 256, - (long *)_huff_lengthlist_line_256x7_class1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_0sub0 = { - 1, 128, - (long *)_huff_lengthlist_line_512x17_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_1sub0 = { - 1, 32, - (long *)_huff_lengthlist_line_512x17_1sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_1sub1 = { - 1, 128, - (long *)_huff_lengthlist_line_512x17_1sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_2sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_512x17_2sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_2sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_512x17_2sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_2sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_512x17_2sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_3sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_512x17_3sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_3sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_512x17_3sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_3sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_512x17_3sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_512x17_class1[] = { - 1, 2, 3, 6, 5, 4, 7, 7, -}; - -static const static_codebook _huff_book_line_512x17_class1 = { - 1, 8, - (long *)_huff_lengthlist_line_512x17_class1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_class2 = { - 1, 64, - (long *)_huff_lengthlist_line_512x17_class2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_512x17_class3 = { - 1, 64, - (long *)_huff_lengthlist_line_512x17_class3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x4_class0 = { - 1, 256, - (long *)_huff_lengthlist_line_128x4_class0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_128x4_0sub0[] = { - 2, 2, 2, 2, -}; - -static const static_codebook _huff_book_line_128x4_0sub0 = { - 1, 4, - (long *)_huff_lengthlist_line_128x4_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_128x4_0sub1[] = { - 0, 0, 0, 0, 3, 2, 3, 2, 3, 3, -}; - -static const static_codebook _huff_book_line_128x4_0sub1 = { - 1, 10, - (long *)_huff_lengthlist_line_128x4_0sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x4_0sub2 = { - 1, 25, - (long *)_huff_lengthlist_line_128x4_0sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x4_0sub3 = { - 1, 64, - (long *)_huff_lengthlist_line_128x4_0sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x4_class0 = { - 1, 256, - (long *)_huff_lengthlist_line_256x4_class0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_256x4_0sub0[] = { - 2, 2, 2, 2, -}; - -static const static_codebook _huff_book_line_256x4_0sub0 = { - 1, 4, - (long *)_huff_lengthlist_line_256x4_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_256x4_0sub1[] = { - 0, 0, 0, 0, 2, 2, 3, 3, 3, 3, -}; - -static const static_codebook _huff_book_line_256x4_0sub1 = { - 1, 10, - (long *)_huff_lengthlist_line_256x4_0sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x4_0sub2 = { - 1, 25, - (long *)_huff_lengthlist_line_256x4_0sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x4_0sub3 = { - 1, 64, - (long *)_huff_lengthlist_line_256x4_0sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x7_class0 = { - 1, 64, - (long *)_huff_lengthlist_line_128x7_class0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x7_class1 = { - 1, 256, - (long *)_huff_lengthlist_line_128x7_class1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_128x7_0sub1[] = { - 0, 3, 3, 3, 3, 3, 3, 3, 3, -}; - -static const static_codebook _huff_book_line_128x7_0sub1 = { - 1, 9, - (long *)_huff_lengthlist_line_128x7_0sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x7_0sub2 = { - 1, 25, - (long *)_huff_lengthlist_line_128x7_0sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x7_0sub3 = { - 1, 64, - (long *)_huff_lengthlist_line_128x7_0sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_128x7_1sub1[] = { - 0, 3, 3, 2, 3, 3, 4, 3, 4, -}; - -static const static_codebook _huff_book_line_128x7_1sub1 = { - 1, 9, - (long *)_huff_lengthlist_line_128x7_1sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x7_1sub2 = { - 1, 25, - (long *)_huff_lengthlist_line_128x7_1sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x7_1sub3 = { - 1, 64, - (long *)_huff_lengthlist_line_128x7_1sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_128x11_class1[] = { - 1, 6, 3, 7, 2, 4, 5, 7, -}; - -static const static_codebook _huff_book_line_128x11_class1 = { - 1, 8, - (long *)_huff_lengthlist_line_128x11_class1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_class2 = { - 1, 64, - (long *)_huff_lengthlist_line_128x11_class2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_class3 = { - 1, 64, - (long *)_huff_lengthlist_line_128x11_class3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_0sub0 = { - 1, 128, - (long *)_huff_lengthlist_line_128x11_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_1sub0 = { - 1, 32, - (long *)_huff_lengthlist_line_128x11_1sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_1sub1 = { - 1, 128, - (long *)_huff_lengthlist_line_128x11_1sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_2sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_128x11_2sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_2sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_128x11_2sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_2sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_128x11_2sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_3sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_128x11_3sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_3sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_128x11_3sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x11_3sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_128x11_3sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_128x17_class1[] = { - 1, 3, 4, 7, 2, 5, 6, 7, -}; - -static const static_codebook _huff_book_line_128x17_class1 = { - 1, 8, - (long *)_huff_lengthlist_line_128x17_class1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_class2 = { - 1, 64, - (long *)_huff_lengthlist_line_128x17_class2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_class3 = { - 1, 64, - (long *)_huff_lengthlist_line_128x17_class3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_0sub0 = { - 1, 128, - (long *)_huff_lengthlist_line_128x17_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_1sub0 = { - 1, 32, - (long *)_huff_lengthlist_line_128x17_1sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_1sub1 = { - 1, 128, - (long *)_huff_lengthlist_line_128x17_1sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_2sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_128x17_2sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_2sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_128x17_2sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_2sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_128x17_2sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_3sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_128x17_3sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_3sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_128x17_3sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_128x17_3sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_128x17_3sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_1024x27_class1[] = { - 2,10, 8,14, 7,12,11,14, 1, 5, 3, 7, 4, 9, 7,13, -}; - -static const static_codebook _huff_book_line_1024x27_class1 = { - 1, 16, - (long *)_huff_lengthlist_line_1024x27_class1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_1024x27_class2[] = { - 1, 4, 2, 6, 3, 7, 5, 7, -}; - -static const static_codebook _huff_book_line_1024x27_class2 = { - 1, 8, - (long *)_huff_lengthlist_line_1024x27_class2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_class3 = { - 1, 256, - (long *)_huff_lengthlist_line_1024x27_class3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_class4 = { - 1, 64, - (long *)_huff_lengthlist_line_1024x27_class4, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_0sub0 = { - 1, 128, - (long *)_huff_lengthlist_line_1024x27_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_1sub0 = { - 1, 32, - (long *)_huff_lengthlist_line_1024x27_1sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_1sub1 = { - 1, 128, - (long *)_huff_lengthlist_line_1024x27_1sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_2sub0 = { - 1, 32, - (long *)_huff_lengthlist_line_1024x27_2sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_2sub1 = { - 1, 128, - (long *)_huff_lengthlist_line_1024x27_2sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_3sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_1024x27_3sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_3sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_1024x27_3sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_3sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_1024x27_3sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_4sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_1024x27_4sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_4sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_1024x27_4sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_1024x27_4sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_1024x27_4sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_2048x27_class1[] = { - 2, 6, 8, 9, 7,11,13,13, 1, 3, 5, 5, 6, 6,12,10, -}; - -static const static_codebook _huff_book_line_2048x27_class1 = { - 1, 16, - (long *)_huff_lengthlist_line_2048x27_class1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_2048x27_class2[] = { - 1, 2, 3, 6, 4, 7, 5, 7, -}; - -static const static_codebook _huff_book_line_2048x27_class2 = { - 1, 8, - (long *)_huff_lengthlist_line_2048x27_class2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_class3 = { - 1, 256, - (long *)_huff_lengthlist_line_2048x27_class3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_class4 = { - 1, 64, - (long *)_huff_lengthlist_line_2048x27_class4, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_0sub0 = { - 1, 128, - (long *)_huff_lengthlist_line_2048x27_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_1sub0 = { - 1, 32, - (long *)_huff_lengthlist_line_2048x27_1sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_1sub1 = { - 1, 128, - (long *)_huff_lengthlist_line_2048x27_1sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_2sub0 = { - 1, 32, - (long *)_huff_lengthlist_line_2048x27_2sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_2sub1 = { - 1, 128, - (long *)_huff_lengthlist_line_2048x27_2sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_3sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_2048x27_3sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_3sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_2048x27_3sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_3sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_2048x27_3sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_4sub1 = { - 1, 18, - (long *)_huff_lengthlist_line_2048x27_4sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_4sub2 = { - 1, 50, - (long *)_huff_lengthlist_line_2048x27_4sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_2048x27_4sub3 = { - 1, 128, - (long *)_huff_lengthlist_line_2048x27_4sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x4low_class0 = { - 1, 256, - (long *)_huff_lengthlist_line_256x4low_class0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_256x4low_0sub0[] = { - 1, 3, 2, 3, -}; - -static const static_codebook _huff_book_line_256x4low_0sub0 = { - 1, 4, - (long *)_huff_lengthlist_line_256x4low_0sub0, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist_line_256x4low_0sub1[] = { - 0, 0, 0, 0, 2, 3, 2, 3, 3, 3, -}; - -static const static_codebook _huff_book_line_256x4low_0sub1 = { - 1, 10, - (long *)_huff_lengthlist_line_256x4low_0sub1, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x4low_0sub2 = { - 1, 25, - (long *)_huff_lengthlist_line_256x4low_0sub2, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book_line_256x4low_0sub3 = { - 1, 64, - (long *)_huff_lengthlist_line_256x4low_0sub3, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - diff --git a/src/lib/dl/ext/vorbis/books/uncoupled/res_books_uncoupled.h b/src/lib/dl/ext/vorbis/books/uncoupled/res_books_uncoupled.h deleted file mode 100755 index d2473635..00000000 --- a/src/lib/dl/ext/vorbis/books/uncoupled/res_books_uncoupled.h +++ /dev/null @@ -1,7758 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: res_books_uncoupled.h 17022 2010-03-25 03:45:42Z xiphmont $ - - ********************************************************************/ - -#include "codebook.h" - -static const long _vq_quantlist__16u0__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16u0__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__16u0__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16u0__p1_0, - 0 -}; - -static const long _vq_quantlist__16u0__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16u0__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__16u0__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16u0__p2_0, - 0 -}; - -static const long _vq_quantlist__16u0__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16u0__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__16u0__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16u0__p3_0, - 0 -}; - -static const long _vq_quantlist__16u0__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16u0__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__16u0__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16u0__p4_0, - 0 -}; - -static const long _vq_quantlist__16u0__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _16u0__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__16u0__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16u0__p5_0, - 0 -}; - -static const long _vq_quantlist__16u0__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _16u0__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__16u0__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__16u0__p6_0, - 0 -}; - -static const long _vq_quantlist__16u0__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16u0__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__16u0__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16u0__p6_1, - 0 -}; - -static const long _vq_quantlist__16u0__p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16u0__p7_0 = { - 4, 81, - (long *)_vq_lengthlist__16u0__p7_0, - 1, -518803456, 1628680192, 2, 0, - (long *)_vq_quantlist__16u0__p7_0, - 0 -}; - -static const long _vq_quantlist__16u0__p7_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _16u0__p7_1 = { - 2, 225, - (long *)_vq_lengthlist__16u0__p7_1, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__16u0__p7_1, - 0 -}; - -static const 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 const 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 const static_codebook _16u0__p7_2 = { - 2, 441, - (long *)_vq_lengthlist__16u0__p7_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__16u0__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__16u0__single = { - 2, 64, - (long *)_huff_lengthlist__16u0__single, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__16u1__long = { - 2, 100, - (long *)_huff_lengthlist__16u1__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__16u1__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16u1__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__16u1__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16u1__p1_0, - 0 -}; - -static const long _vq_quantlist__16u1__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16u1__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__16u1__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16u1__p2_0, - 0 -}; - -static const long _vq_quantlist__16u1__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16u1__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__16u1__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16u1__p3_0, - 0 -}; - -static const long _vq_quantlist__16u1__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _16u1__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__16u1__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16u1__p4_0, - 0 -}; - -static const long _vq_quantlist__16u1__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _16u1__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__16u1__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16u1__p5_0, - 0 -}; - -static const long _vq_quantlist__16u1__p6_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _16u1__p6_0 = { - 2, 81, - (long *)_vq_lengthlist__16u1__p6_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16u1__p6_0, - 0 -}; - -static const long _vq_quantlist__16u1__p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _16u1__p7_0 = { - 4, 81, - (long *)_vq_lengthlist__16u1__p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__16u1__p7_0, - 0 -}; - -static const long _vq_quantlist__16u1__p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _16u1__p7_1 = { - 2, 121, - (long *)_vq_lengthlist__16u1__p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16u1__p7_1, - 0 -}; - -static const long _vq_quantlist__16u1__p8_0[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _16u1__p8_0 = { - 2, 121, - (long *)_vq_lengthlist__16u1__p8_0, - 1, -524582912, 1618345984, 4, 0, - (long *)_vq_quantlist__16u1__p8_0, - 0 -}; - -static const long _vq_quantlist__16u1__p8_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _16u1__p8_1 = { - 2, 121, - (long *)_vq_lengthlist__16u1__p8_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16u1__p8_1, - 0 -}; - -static const long _vq_quantlist__16u1__p9_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _16u1__p9_0 = { - 2, 225, - (long *)_vq_lengthlist__16u1__p9_0, - 1, -514071552, 1627381760, 4, 0, - (long *)_vq_quantlist__16u1__p9_0, - 0 -}; - -static const long _vq_quantlist__16u1__p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _16u1__p9_1 = { - 2, 225, - (long *)_vq_lengthlist__16u1__p9_1, - 1, -522338304, 1620115456, 4, 0, - (long *)_vq_quantlist__16u1__p9_1, - 0 -}; - -static const long _vq_quantlist__16u1__p9_2[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _16u1__p9_2 = { - 2, 289, - (long *)_vq_lengthlist__16u1__p9_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__16u1__p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__16u1__short = { - 2, 100, - (long *)_huff_lengthlist__16u1__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _huff_lengthlist__16u2__long[] = { - 5, 8,10,10,10,11,11,12,14,18, 7, 5, 5, 6, 8, 9, - 10,12,14,17, 9, 5, 4, 5, 6, 8,10,11,13,19, 9, 5, - 4, 4, 5, 6, 9,10,12,17, 8, 6, 5, 4, 4, 5, 7,10, - 11,15, 8, 7, 7, 6, 5, 5, 6, 9,11,14, 8, 9, 8, 7, - 6, 5, 6, 7,11,14, 9,11,11, 9, 7, 6, 6, 6, 9,14, - 11,14,15,13, 9, 8, 7, 7, 9,14,13,15,19,17,12,11, - 10, 9,10,14, -}; - -static const static_codebook _huff_book__16u2__long = { - 2, 100, - (long *)_huff_lengthlist__16u2__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__16u2_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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, 8, 9, 9, 5, 7, 7, 8, 9, - 9, 7, 9, 9, 7, 9, 9, 9,10,11, 9,10,10, 7, 9, 9, - 9,10, 9, 9,10,11, 5, 8, 7, 7, 9, 9, 8, 9, 9, 7, - 9, 9, 9,11,10, 9, 9,10, 7, 9, 9, 9,10,10, 9,11, - 10, -}; - -static const static_codebook _16u2_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__16u2_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__16u2_p1_0, - 0 -}; - -static const long _vq_quantlist__16u2_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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,10,10,12,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,12,12,14,13, 5, 7, 7, - 9, 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, 9, 9,11,11, - 8, 9, 9,11,11,10,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,10,11,10,13,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, - 12,13,12,14,13,12,13,13,14,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, 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,12, - 10,11,11,13,12, 9,10,10,12,12,10,11,11,13,13,10, - 10,11,12,13,12,13,13,15,14,12,12,13,12,14, 9,10, - 11,12,13,10,11,11,13,13,10,11,11,13,13,12,13,13, - 14,14,12,13,12,14,13, 8,10,10,12,12, 9,11,10,13, - 12, 9,10,10,12,13,12,13,13,14,14,12,12,12,14,14, - 9,10,10,13,13,10,11,11,13,13,10,11,11,13,13,13, - 13,13,14,15,12,13,13,14,15, 9,10,10,12,13,10,11, - 10,13,13,10,11,11,12,13,12,13,12,15,14,12,13,13, - 14,15,11,12,12,15,14,12,12,13,14,15,12,13,13,15, - 14,13,13,15,14,16,14,14,14,16,15,11,12,12,14,14, - 11,12,12,14,14,12,13,13,14,15,13,14,13,15,13,14, - 14,14,15,16, 8, 9,10,12,12, 9,10,10,13,12, 9,10, - 11,12,13,12,12,12,14,14,12,13,13,14,14, 9,10,10, - 13,12,10,11,11,13,13,10,10,11,13,13,12,13,13,15, - 14,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,13,13,15,15,11, - 12,12,14,13,12,13,13,15,14,11,12,12,14,14,14,14, - 14,16,15,13,13,14,13,16,11,12,12,14,14,12,13,13, - 14,15,12,13,12,14,14,14,14,14,16,16,14,15,13,16, - 14, -}; - -static const static_codebook _16u2_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__16u2_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16u2_p2_0, - 0 -}; - -static const long _vq_quantlist__16u2_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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,10,10, 7, 8, 7, - 8, 8, 9, 9,11,10, 7, 7, 8, 8, 8, 9, 9,10,11, 9, - 9, 9,10,10,11,10,11,11, 9, 9, 9,10,10,10,11,11, - 11, -}; - -static const static_codebook _16u2_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__16u2_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__16u2_p3_0, - 0 -}; - -static const long _vq_quantlist__16u2_p4_0[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const long _vq_lengthlist__16u2_p4_0[] = { - 2, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11,11, - 11, 5, 5, 5, 7, 6, 8, 7, 9, 9, 9, 9,10,10,11,11, - 12,12, 5, 5, 5, 6, 6, 7, 8, 8, 9, 9, 9,10,10,11, - 11,12,12, 6, 7, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, - 11,11,12,12, 6, 6, 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,11,11,12,12, 7, 7, 8, 8, 8, 9, 9, 9, 9,10, - 10,11,11,11,11,12,12, 8, 9, 9, 9, 9, 9, 9,10,10, - 10,10,11,11,12,12,12,12, 8, 9, 9, 9, 9, 9, 9,10, - 10,10,10,11,11,12,12,12,12, 9, 9, 9, 9, 9,10,10, - 10,10,10,11,11,11,12,12,13,13, 9, 9, 9, 9, 9,10, - 10,10,10,11,10,11,11,12,12,13,13,10,10,10,10,10, - 11,11,11,11,11,11,11,12,12,12,13,13,10,10,10,10, - 10,11,11,11,11,11,11,12,11,12,12,13,13,11,11,11, - 11,11,11,11,12,12,12,12,12,12,13,13,13,13,11,11, - 11,11,11,11,11,12,12,12,12,13,12,13,13,13,13,11, - 12,12,12,12,12,12,12,12,13,13,13,13,13,13,14,14, - 11,12,12,12,12,12,12,12,13,13,13,13,13,13,13,14, - 14, -}; - -static const static_codebook _16u2_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__16u2_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__16u2_p4_0, - 0 -}; - -static const long _vq_quantlist__16u2_p5_0[] = { - 1, - 0, - 2, -}; - -static const long _vq_lengthlist__16u2_p5_0[] = { - 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 8, 7, 9, 9, 7, - 9,10, 5, 8, 8, 7,10, 9, 7,10, 9, 5, 8, 8, 8,11, - 10, 8,10,10, 7,10,10, 9, 9,12,10,12,12, 7,10,10, - 9,12,10,10,11,12, 5, 8, 8, 8,10,10, 8,11,11, 7, - 11,10,10,12,11, 9,10,12, 7,10,11,10,12,12, 9,12, - 9, -}; - -static const static_codebook _16u2_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__16u2_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__16u2_p5_0, - 0 -}; - -static const long _vq_quantlist__16u2_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const long _vq_lengthlist__16u2_p5_1[] = { - 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 5, 6, 6, 7, 7, - 7, 7, 8, 8, 8, 8, 5, 6, 6, 6, 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, 8, 8, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, - 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 const static_codebook _16u2_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__16u2_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16u2_p5_1, - 0 -}; - -static const long _vq_quantlist__16u2_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__16u2_p6_0[] = { - 1, 5, 4, 7, 7, 8, 8, 8, 8,10,10,11,11, 4, 6, 6, - 7, 7, 9, 9, 9, 9,10,10,11,11, 4, 6, 6, 7, 7, 9, - 9, 9, 9,10,10,11,11, 7, 8, 8, 9, 9, 9, 9,10,10, - 11,11,12,12, 7, 7, 7, 9, 8,10, 9,10,10,11,11,12, - 12, 8, 9, 9, 9,10,10,10,11,11,12,12,13,13, 8, 9, - 9,10, 9,10,10,11,11,12,12,13,13, 8, 9, 9,10,10, - 11,11,11,11,12,12,13,13, 8, 9, 9,10,10,11,11,12, - 11,12,12,13,13,10,10,10,11,11,12,12,12,12,13,13, - 14,14,10,10,10,11,11,12,12,12,12,13,13,14,14,11, - 11,11,12,12,13,13,13,13,14,14,14,14,11,11,11,12, - 12,13,13,13,13,14,14,14,14, -}; - -static const static_codebook _16u2_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__16u2_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__16u2_p6_0, - 0 -}; - -static const long _vq_quantlist__16u2_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const long _vq_lengthlist__16u2_p6_1[] = { - 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, -}; - -static const static_codebook _16u2_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__16u2_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__16u2_p6_1, - 0 -}; - -static const long _vq_quantlist__16u2_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const long _vq_lengthlist__16u2_p7_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,11,10, 4, 6, 6, 8, 8, 9, - 9, 9, 9,10,10,11,11, 7, 8, 8,10, 9,10,10,10,10, - 11,11,12,12, 7, 8, 8,10,10,10,10,10,10,11,11,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,12,13,13, 8, 9, 9,11,10, - 11,11,12,12,13,13,14,13, 8, 9, 9,10,10,11,11,12, - 12,13,13,13,13, 9,10,10,11,11,12,12,13,13,13,13, - 14,14, 9,10,10,11,11,12,12,13,13,13,13,14,14,10, - 11,11,12,12,13,13,14,13,14,14,15,14,10,11,11,12, - 12,13,13,14,13,14,14,15,14, -}; - -static const static_codebook _16u2_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__16u2_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__16u2_p7_0, - 0 -}; - -static const long _vq_quantlist__16u2_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const long _vq_lengthlist__16u2_p7_1[] = { - 2, 5, 5, 7, 7, 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, 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, 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 const static_codebook _16u2_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__16u2_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__16u2_p7_1, - 0 -}; - -static const long _vq_quantlist__16u2_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const long _vq_lengthlist__16u2_p8_0[] = { - 1, 4, 4, 7, 7, 8, 8, 7, 7, 9, 8,10, 9,11,11, 4, - 7, 6, 9, 8, 9, 9, 9, 9,10, 9,11, 9,12, 9, 4, 6, - 7, 8, 8, 9, 9, 9, 9,10,10,10,11,11,12, 7, 9, 8, - 10,10,11,11,10,10,11,11,12,12,13,12, 7, 8, 8,10, - 10,10,11,10,10,11,11,11,12,12,13, 8, 9, 9,11,11, - 11,11,11,11,12,12,13,13,13,13, 8, 9, 9,11,11,11, - 11,11,11,12,12,13,13,13,14, 8, 9, 9,10,10,11,11, - 12,11,13,13,14,13,14,14, 8, 9, 9,10,10,11,11,12, - 12,12,12,13,13,14,14, 9,10,10,11,11,12,12,13,12, - 13,13,14,14,15,15, 9,10,10,11,11,12,12,12,13,13, - 13,14,14,14,15,10,11,11,12,12,13,13,14,13,14,14, - 15,14,15,15,10,11,11,12,12,13,12,13,14,14,14,14, - 14,15,15,11,12,12,13,13,13,13,14,14,15,14,15,15, - 16,16,11,12,12,13,13,13,13,14,14,14,15,15,15,16, - 16, -}; - -static const static_codebook _16u2_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__16u2_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__16u2_p8_0, - 0 -}; - -static const 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 const long _vq_lengthlist__16u2_p8_1[] = { - 3, 5, 5, 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, 9, 9, 9, - 9, 9, 9, 9, 9, 9,10,10,10,10, 5, 6, 6, 7, 7, 8, - 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, - 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, - 10,10,10,10, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, - 9,10, 9,10,10,10, 9,10, 9, 8, 8, 8, 9, 8, 9, 9, - 9, 9,10, 9,10,10,10,10,10,10,10,10,10,10, 8, 8, - 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10, - 10,10,10, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, - 10,10,10,10,10,10,10,10, 8, 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,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, 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, 9, 9, 9,10,10,10,10,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,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, 9,10,10,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, 9, - 10,10,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, -}; - -static const static_codebook _16u2_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__16u2_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__16u2_p8_1, - 0 -}; - -static const long _vq_quantlist__16u2_p9_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const long _vq_lengthlist__16u2_p9_0[] = { - 1, 5, 3, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, - 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 7, - 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 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,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, - 10,10,10,10,10,10,10,10,10,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 const static_codebook _16u2_p9_0 = { - 2, 225, - (long *)_vq_lengthlist__16u2_p9_0, - 1, -510036736, 1631393792, 4, 0, - (long *)_vq_quantlist__16u2_p9_0, - 0 -}; - -static const long _vq_quantlist__16u2_p9_1[] = { - 9, - 8, - 10, - 7, - 11, - 6, - 12, - 5, - 13, - 4, - 14, - 3, - 15, - 2, - 16, - 1, - 17, - 0, - 18, -}; - -static const long _vq_lengthlist__16u2_p9_1[] = { - 1, 4, 4, 7, 7, 7, 7, 7, 6, 9, 7,10, 8,12,12,13, - 13,14,14, 4, 7, 7, 9, 9, 9, 8, 9, 8,10, 9,11, 9, - 14, 9,14,10,13,11, 4, 7, 7, 9, 9, 9, 9, 8, 9,10, - 10,11,11,12,13,12,13,14,15, 7, 9, 9,10,11,10,10, - 10,10,11,12,13,13,13,14,17,14,15,16, 7, 9, 9,10, - 10,10,10,10,10,11,12,13,13,14,14,15,15,18,18, 8, - 9, 9,11,10,11,11,11,12,13,12,14,14,16,15,15,17, - 18,15, 8, 9, 9,10,10,11,11,11,11,13,13,14,14,15, - 15,15,16,16,18, 7, 9, 8,10,10,11,11,12,12,14,14, - 15,15,16,16,15,17,16,18, 8, 9, 9,10,10,11,12,12, - 12,13,13,16,15,17,16,17,18,17,18, 9,10,10,12,11, - 13,13,14,13,14,14,15,17,16,18,17,18,17,18, 9,10, - 10,12,11,12,13,13,14,15,16,14,15,16,18,18,18,18, - 17,11,11,11,13,13,14,14,16,15,15,15,16,15,15,18, - 18,18,17,16,11,11,12,13,13,15,14,15,16,16,16,17, - 16,15,18,17,18,16,18,12,13,13,15,15,15,16,18,16, - 17,16,17,16,17,17,17,18,18,17,13,13,13,15,13,16, - 15,17,16,16,16,18,18,18,18,16,17,17,18,13,15,14, - 15,15,18,17,18,18,18,16,18,17,18,17,18,16,17,17, - 14,14,14,15,16,17,16,18,18,18,17,18,17,18,18,18, - 16,16,16,14,17,16,17,15,16,18,18,17,18,17,18,17, - 18,18,18,17,18,17,15,16,15,18,15,18,17,16,18,18, - 18,18,18,18,17,18,16,18,17, -}; - -static const static_codebook _16u2_p9_1 = { - 2, 361, - (long *)_vq_lengthlist__16u2_p9_1, - 1, -518287360, 1622704128, 5, 0, - (long *)_vq_quantlist__16u2_p9_1, - 0 -}; - -static const 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 const long _vq_lengthlist__16u2_p9_2[] = { - 2, 3, 4, 4, 4, 5, 5, 6, 5, 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, 8, 8, 7, 8, 8, 8, 8, 8, - 8, -}; - -static const static_codebook _16u2_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__16u2_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__16u2_p9_2, - 0 -}; - -static const long _huff_lengthlist__16u2__short[] = { - 8,11,13,13,15,16,19,19,19,19,11, 8, 8, 9, 9,11, - 13,15,19,20,14, 8, 7, 7, 8, 9,12,13,15,20,15, 9, - 6, 5, 5, 7,10,12,14,18,14, 9, 7, 5, 3, 4, 7,10, - 12,16,13,10, 8, 6, 3, 3, 5, 8,11,14,11,10, 9, 7, - 5, 4, 4, 6,11,14,10,10,10, 8, 6, 5, 5, 6,10,14, - 10,10,10, 9, 8, 7, 7, 7,10,14,11,12,12,12,11,10, - 10,10,12,16, -}; - -static const static_codebook _huff_book__16u2__short = { - 2, 100, - (long *)_huff_lengthlist__16u2__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__8u0__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8u0__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__8u0__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__8u0__p1_0, - 0 -}; - -static const long _vq_quantlist__8u0__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8u0__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__8u0__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__8u0__p2_0, - 0 -}; - -static const long _vq_quantlist__8u0__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8u0__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__8u0__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8u0__p3_0, - 0 -}; - -static const long _vq_quantlist__8u0__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8u0__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__8u0__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8u0__p4_0, - 0 -}; - -static const long _vq_quantlist__8u0__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _8u0__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__8u0__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__8u0__p5_0, - 0 -}; - -static const long _vq_quantlist__8u0__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _8u0__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__8u0__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__8u0__p6_0, - 0 -}; - -static const long _vq_quantlist__8u0__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8u0__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__8u0__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8u0__p6_1, - 0 -}; - -static const long _vq_quantlist__8u0__p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8u0__p7_0 = { - 4, 81, - (long *)_vq_lengthlist__8u0__p7_0, - 1, -518803456, 1628680192, 2, 0, - (long *)_vq_quantlist__8u0__p7_0, - 0 -}; - -static const long _vq_quantlist__8u0__p7_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _8u0__p7_1 = { - 2, 225, - (long *)_vq_lengthlist__8u0__p7_1, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__8u0__p7_1, - 0 -}; - -static const 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 const 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 const static_codebook _8u0__p7_2 = { - 2, 441, - (long *)_vq_lengthlist__8u0__p7_2, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__8u0__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__8u0__single = { - 2, 64, - (long *)_huff_lengthlist__8u0__single, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__8u1__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8u1__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__8u1__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__8u1__p1_0, - 0 -}; - -static const long _vq_quantlist__8u1__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8u1__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__8u1__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__8u1__p2_0, - 0 -}; - -static const long _vq_quantlist__8u1__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8u1__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__8u1__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8u1__p3_0, - 0 -}; - -static const long _vq_quantlist__8u1__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _8u1__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__8u1__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__8u1__p4_0, - 0 -}; - -static const long _vq_quantlist__8u1__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _8u1__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__8u1__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__8u1__p5_0, - 0 -}; - -static const long _vq_quantlist__8u1__p6_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _8u1__p6_0 = { - 2, 81, - (long *)_vq_lengthlist__8u1__p6_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__8u1__p6_0, - 0 -}; - -static const long _vq_quantlist__8u1__p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _8u1__p7_0 = { - 4, 81, - (long *)_vq_lengthlist__8u1__p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__8u1__p7_0, - 0 -}; - -static const long _vq_quantlist__8u1__p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _8u1__p7_1 = { - 2, 121, - (long *)_vq_lengthlist__8u1__p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__8u1__p7_1, - 0 -}; - -static const long _vq_quantlist__8u1__p8_0[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _8u1__p8_0 = { - 2, 121, - (long *)_vq_lengthlist__8u1__p8_0, - 1, -524582912, 1618345984, 4, 0, - (long *)_vq_quantlist__8u1__p8_0, - 0 -}; - -static const long _vq_quantlist__8u1__p8_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _8u1__p8_1 = { - 2, 121, - (long *)_vq_lengthlist__8u1__p8_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__8u1__p8_1, - 0 -}; - -static const long _vq_quantlist__8u1__p9_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _8u1__p9_0 = { - 2, 225, - (long *)_vq_lengthlist__8u1__p9_0, - 1, -514071552, 1627381760, 4, 0, - (long *)_vq_quantlist__8u1__p9_0, - 0 -}; - -static const long _vq_quantlist__8u1__p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _8u1__p9_1 = { - 2, 225, - (long *)_vq_lengthlist__8u1__p9_1, - 1, -522338304, 1620115456, 4, 0, - (long *)_vq_quantlist__8u1__p9_1, - 0 -}; - -static const long _vq_quantlist__8u1__p9_2[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _8u1__p9_2 = { - 2, 289, - (long *)_vq_lengthlist__8u1__p9_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__8u1__p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__8u1__single = { - 2, 100, - (long *)_huff_lengthlist__8u1__single, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u0__long = { - 2, 64, - (long *)_huff_lengthlist__44u0__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u0__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u0__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u0__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u0__p1_0, - 0 -}; - -static const long _vq_quantlist__44u0__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u0__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u0__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u0__p2_0, - 0 -}; - -static const long _vq_quantlist__44u0__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u0__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u0__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u0__p3_0, - 0 -}; - -static const long _vq_quantlist__44u0__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u0__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u0__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u0__p4_0, - 0 -}; - -static const long _vq_quantlist__44u0__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u0__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u0__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u0__p5_0, - 0 -}; - -static const long _vq_quantlist__44u0__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u0__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44u0__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44u0__p6_0, - 0 -}; - -static const long _vq_quantlist__44u0__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u0__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44u0__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u0__p6_1, - 0 -}; - -static const long _vq_quantlist__44u0__p7_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u0__p7_0 = { - 4, 625, - (long *)_vq_lengthlist__44u0__p7_0, - 1, -518709248, 1626677248, 3, 0, - (long *)_vq_quantlist__44u0__p7_0, - 0 -}; - -static const long _vq_quantlist__44u0__p7_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u0__p7_1 = { - 2, 169, - (long *)_vq_lengthlist__44u0__p7_1, - 1, -523010048, 1618608128, 4, 0, - (long *)_vq_quantlist__44u0__p7_1, - 0 -}; - -static const long _vq_quantlist__44u0__p7_2[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u0__p7_2 = { - 2, 169, - (long *)_vq_lengthlist__44u0__p7_2, - 1, -531103744, 1611661312, 4, 0, - (long *)_vq_quantlist__44u0__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u0__short = { - 2, 64, - (long *)_huff_lengthlist__44u0__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u1__long = { - 2, 64, - (long *)_huff_lengthlist__44u1__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u1__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u1__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u1__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u1__p1_0, - 0 -}; - -static const long _vq_quantlist__44u1__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u1__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u1__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u1__p2_0, - 0 -}; - -static const long _vq_quantlist__44u1__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u1__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u1__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u1__p3_0, - 0 -}; - -static const long _vq_quantlist__44u1__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u1__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u1__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u1__p4_0, - 0 -}; - -static const long _vq_quantlist__44u1__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u1__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u1__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u1__p5_0, - 0 -}; - -static const long _vq_quantlist__44u1__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u1__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44u1__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44u1__p6_0, - 0 -}; - -static const long _vq_quantlist__44u1__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u1__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44u1__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u1__p6_1, - 0 -}; - -static const long _vq_quantlist__44u1__p7_0[] = { - 3, - 2, - 4, - 1, - 5, - 0, - 6, -}; - -static const 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 const static_codebook _44u1__p7_0 = { - 2, 49, - (long *)_vq_lengthlist__44u1__p7_0, - 1, -518017024, 1626677248, 3, 0, - (long *)_vq_quantlist__44u1__p7_0, - 0 -}; - -static const long _vq_quantlist__44u1__p7_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u1__p7_1 = { - 2, 169, - (long *)_vq_lengthlist__44u1__p7_1, - 1, -523010048, 1618608128, 4, 0, - (long *)_vq_quantlist__44u1__p7_1, - 0 -}; - -static const long _vq_quantlist__44u1__p7_2[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u1__p7_2 = { - 2, 169, - (long *)_vq_lengthlist__44u1__p7_2, - 1, -531103744, 1611661312, 4, 0, - (long *)_vq_quantlist__44u1__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u1__short = { - 2, 64, - (long *)_huff_lengthlist__44u1__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u2__long = { - 2, 64, - (long *)_huff_lengthlist__44u2__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u2__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u2__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u2__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u2__p1_0, - 0 -}; - -static const long _vq_quantlist__44u2__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u2__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u2__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u2__p2_0, - 0 -}; - -static const long _vq_quantlist__44u2__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u2__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u2__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u2__p3_0, - 0 -}; - -static const long _vq_quantlist__44u2__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u2__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u2__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u2__p4_0, - 0 -}; - -static const long _vq_quantlist__44u2__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u2__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u2__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u2__p5_0, - 0 -}; - -static const long _vq_quantlist__44u2__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u2__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44u2__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44u2__p6_0, - 0 -}; - -static const long _vq_quantlist__44u2__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u2__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44u2__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u2__p6_1, - 0 -}; - -static const long _vq_quantlist__44u2__p7_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u2__p7_0 = { - 2, 81, - (long *)_vq_lengthlist__44u2__p7_0, - 1, -516612096, 1626677248, 4, 0, - (long *)_vq_quantlist__44u2__p7_0, - 0 -}; - -static const long _vq_quantlist__44u2__p7_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u2__p7_1 = { - 2, 169, - (long *)_vq_lengthlist__44u2__p7_1, - 1, -523010048, 1618608128, 4, 0, - (long *)_vq_quantlist__44u2__p7_1, - 0 -}; - -static const long _vq_quantlist__44u2__p7_2[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u2__p7_2 = { - 2, 169, - (long *)_vq_lengthlist__44u2__p7_2, - 1, -531103744, 1611661312, 4, 0, - (long *)_vq_quantlist__44u2__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u2__short = { - 2, 64, - (long *)_huff_lengthlist__44u2__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u3__long = { - 2, 64, - (long *)_huff_lengthlist__44u3__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u3__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u3__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u3__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u3__p1_0, - 0 -}; - -static const long _vq_quantlist__44u3__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u3__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u3__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u3__p2_0, - 0 -}; - -static const long _vq_quantlist__44u3__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u3__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u3__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u3__p3_0, - 0 -}; - -static const long _vq_quantlist__44u3__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u3__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u3__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u3__p4_0, - 0 -}; - -static const long _vq_quantlist__44u3__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u3__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u3__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u3__p5_0, - 0 -}; - -static const long _vq_quantlist__44u3__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u3__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44u3__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44u3__p6_0, - 0 -}; - -static const long _vq_quantlist__44u3__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u3__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44u3__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u3__p6_1, - 0 -}; - -static const long _vq_quantlist__44u3__p7_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u3__p7_0 = { - 2, 81, - (long *)_vq_lengthlist__44u3__p7_0, - 1, -515907584, 1627381760, 4, 0, - (long *)_vq_quantlist__44u3__p7_0, - 0 -}; - -static const long _vq_quantlist__44u3__p7_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u3__p7_1 = { - 2, 225, - (long *)_vq_lengthlist__44u3__p7_1, - 1, -522338304, 1620115456, 4, 0, - (long *)_vq_quantlist__44u3__p7_1, - 0 -}; - -static const long _vq_quantlist__44u3__p7_2[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _44u3__p7_2 = { - 2, 289, - (long *)_vq_lengthlist__44u3__p7_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44u3__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u3__short = { - 2, 64, - (long *)_huff_lengthlist__44u3__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u4__long = { - 2, 64, - (long *)_huff_lengthlist__44u4__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u4__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u4__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u4__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u4__p1_0, - 0 -}; - -static const long _vq_quantlist__44u4__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u4__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u4__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u4__p2_0, - 0 -}; - -static const long _vq_quantlist__44u4__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u4__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u4__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u4__p3_0, - 0 -}; - -static const long _vq_quantlist__44u4__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u4__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u4__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u4__p4_0, - 0 -}; - -static const long _vq_quantlist__44u4__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u4__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u4__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u4__p5_0, - 0 -}; - -static const long _vq_quantlist__44u4__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u4__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44u4__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44u4__p6_0, - 0 -}; - -static const long _vq_quantlist__44u4__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u4__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44u4__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u4__p6_1, - 0 -}; - -static const long _vq_quantlist__44u4__p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u4__p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44u4__p7_0, - 1, -514332672, 1627381760, 4, 0, - (long *)_vq_quantlist__44u4__p7_0, - 0 -}; - -static const long _vq_quantlist__44u4__p7_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u4__p7_1 = { - 2, 225, - (long *)_vq_lengthlist__44u4__p7_1, - 1, -522338304, 1620115456, 4, 0, - (long *)_vq_quantlist__44u4__p7_1, - 0 -}; - -static const long _vq_quantlist__44u4__p7_2[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _44u4__p7_2 = { - 2, 289, - (long *)_vq_lengthlist__44u4__p7_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44u4__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u4__short = { - 2, 64, - (long *)_huff_lengthlist__44u4__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u5__long = { - 2, 100, - (long *)_huff_lengthlist__44u5__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u5__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u5__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u5__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u5__p1_0, - 0 -}; - -static const long _vq_quantlist__44u5__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u5__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u5__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u5__p2_0, - 0 -}; - -static const long _vq_quantlist__44u5__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u5__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u5__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u5__p3_0, - 0 -}; - -static const long _vq_quantlist__44u5__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u5__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u5__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u5__p4_0, - 0 -}; - -static const long _vq_quantlist__44u5__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u5__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u5__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u5__p5_0, - 0 -}; - -static const long _vq_quantlist__44u5__p6_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u5__p6_0 = { - 2, 81, - (long *)_vq_lengthlist__44u5__p6_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u5__p6_0, - 0 -}; - -static const long _vq_quantlist__44u5__p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u5__p7_0 = { - 4, 81, - (long *)_vq_lengthlist__44u5__p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44u5__p7_0, - 0 -}; - -static const long _vq_quantlist__44u5__p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u5__p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44u5__p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u5__p7_1, - 0 -}; - -static const long _vq_quantlist__44u5__p8_0[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u5__p8_0 = { - 2, 121, - (long *)_vq_lengthlist__44u5__p8_0, - 1, -524582912, 1618345984, 4, 0, - (long *)_vq_quantlist__44u5__p8_0, - 0 -}; - -static const long _vq_quantlist__44u5__p8_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u5__p8_1 = { - 2, 121, - (long *)_vq_lengthlist__44u5__p8_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u5__p8_1, - 0 -}; - -static const long _vq_quantlist__44u5__p9_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u5__p9_0 = { - 2, 169, - (long *)_vq_lengthlist__44u5__p9_0, - 1, -514332672, 1627381760, 4, 0, - (long *)_vq_quantlist__44u5__p9_0, - 0 -}; - -static const long _vq_quantlist__44u5__p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u5__p9_1 = { - 2, 225, - (long *)_vq_lengthlist__44u5__p9_1, - 1, -522338304, 1620115456, 4, 0, - (long *)_vq_quantlist__44u5__p9_1, - 0 -}; - -static const long _vq_quantlist__44u5__p9_2[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _44u5__p9_2 = { - 2, 289, - (long *)_vq_lengthlist__44u5__p9_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44u5__p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u5__short = { - 2, 100, - (long *)_huff_lengthlist__44u5__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u6__long = { - 2, 100, - (long *)_huff_lengthlist__44u6__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u6__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u6__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u6__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u6__p1_0, - 0 -}; - -static const long _vq_quantlist__44u6__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u6__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u6__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u6__p2_0, - 0 -}; - -static const long _vq_quantlist__44u6__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u6__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u6__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u6__p3_0, - 0 -}; - -static const long _vq_quantlist__44u6__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u6__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u6__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u6__p4_0, - 0 -}; - -static const long _vq_quantlist__44u6__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u6__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u6__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u6__p5_0, - 0 -}; - -static const long _vq_quantlist__44u6__p6_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u6__p6_0 = { - 2, 81, - (long *)_vq_lengthlist__44u6__p6_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u6__p6_0, - 0 -}; - -static const long _vq_quantlist__44u6__p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u6__p7_0 = { - 4, 81, - (long *)_vq_lengthlist__44u6__p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44u6__p7_0, - 0 -}; - -static const long _vq_quantlist__44u6__p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u6__p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44u6__p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u6__p7_1, - 0 -}; - -static const long _vq_quantlist__44u6__p8_0[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u6__p8_0 = { - 2, 121, - (long *)_vq_lengthlist__44u6__p8_0, - 1, -524582912, 1618345984, 4, 0, - (long *)_vq_quantlist__44u6__p8_0, - 0 -}; - -static const long _vq_quantlist__44u6__p8_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u6__p8_1 = { - 2, 121, - (long *)_vq_lengthlist__44u6__p8_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u6__p8_1, - 0 -}; - -static const long _vq_quantlist__44u6__p9_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u6__p9_0 = { - 2, 225, - (long *)_vq_lengthlist__44u6__p9_0, - 1, -514071552, 1627381760, 4, 0, - (long *)_vq_quantlist__44u6__p9_0, - 0 -}; - -static const long _vq_quantlist__44u6__p9_1[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u6__p9_1 = { - 2, 225, - (long *)_vq_lengthlist__44u6__p9_1, - 1, -522338304, 1620115456, 4, 0, - (long *)_vq_quantlist__44u6__p9_1, - 0 -}; - -static const long _vq_quantlist__44u6__p9_2[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _44u6__p9_2 = { - 2, 289, - (long *)_vq_lengthlist__44u6__p9_2, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44u6__p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u6__short = { - 2, 100, - (long *)_huff_lengthlist__44u6__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u7__long = { - 2, 100, - (long *)_huff_lengthlist__44u7__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u7__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u7__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u7__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u7__p1_0, - 0 -}; - -static const long _vq_quantlist__44u7__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u7__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44u7__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u7__p2_0, - 0 -}; - -static const long _vq_quantlist__44u7__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u7__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44u7__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u7__p3_0, - 0 -}; - -static const long _vq_quantlist__44u7__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u7__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44u7__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u7__p4_0, - 0 -}; - -static const long _vq_quantlist__44u7__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u7__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44u7__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u7__p5_0, - 0 -}; - -static const long _vq_quantlist__44u7__p6_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u7__p6_0 = { - 2, 81, - (long *)_vq_lengthlist__44u7__p6_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u7__p6_0, - 0 -}; - -static const long _vq_quantlist__44u7__p7_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u7__p7_0 = { - 4, 81, - (long *)_vq_lengthlist__44u7__p7_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44u7__p7_0, - 0 -}; - -static const long _vq_quantlist__44u7__p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u7__p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44u7__p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u7__p7_1, - 0 -}; - -static const long _vq_quantlist__44u7__p8_0[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u7__p8_0 = { - 2, 121, - (long *)_vq_lengthlist__44u7__p8_0, - 1, -524582912, 1618345984, 4, 0, - (long *)_vq_quantlist__44u7__p8_0, - 0 -}; - -static const long _vq_quantlist__44u7__p8_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u7__p8_1 = { - 2, 121, - (long *)_vq_lengthlist__44u7__p8_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u7__p8_1, - 0 -}; - -static const long _vq_quantlist__44u7__p9_0[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u7__p9_0 = { - 2, 121, - (long *)_vq_lengthlist__44u7__p9_0, - 1, -512171520, 1630791680, 4, 0, - (long *)_vq_quantlist__44u7__p9_0, - 0 -}; - -static const long _vq_quantlist__44u7__p9_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u7__p9_1 = { - 2, 169, - (long *)_vq_lengthlist__44u7__p9_1, - 1, -518889472, 1622704128, 4, 0, - (long *)_vq_quantlist__44u7__p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44u7__p9_2 = { - 1, 49, - (long *)_vq_lengthlist__44u7__p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__44u7__p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u7__short = { - 2, 100, - (long *)_huff_lengthlist__44u7__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u8__long = { - 2, 100, - (long *)_huff_lengthlist__44u8__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u8__short = { - 2, 100, - (long *)_huff_lengthlist__44u8__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u8_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u8_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u8_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u8_p1_0, - 0 -}; - -static const long _vq_quantlist__44u8_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u8_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44u8_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u8_p2_0, - 0 -}; - -static const long _vq_quantlist__44u8_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u8_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44u8_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u8_p3_0, - 0 -}; - -static const long _vq_quantlist__44u8_p4_0[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _44u8_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__44u8_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44u8_p4_0, - 0 -}; - -static const long _vq_quantlist__44u8_p5_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u8_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__44u8_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44u8_p5_0, - 0 -}; - -static const long _vq_quantlist__44u8_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u8_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__44u8_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u8_p5_1, - 0 -}; - -static const long _vq_quantlist__44u8_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u8_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44u8_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44u8_p6_0, - 0 -}; - -static const long _vq_quantlist__44u8_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u8_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44u8_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u8_p6_1, - 0 -}; - -static const long _vq_quantlist__44u8_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u8_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44u8_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__44u8_p7_0, - 0 -}; - -static const long _vq_quantlist__44u8_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u8_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44u8_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u8_p7_1, - 0 -}; - -static const long _vq_quantlist__44u8_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u8_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__44u8_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__44u8_p8_0, - 0 -}; - -static const 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 const 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 const static_codebook _44u8_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__44u8_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44u8_p8_1, - 0 -}; - -static const long _vq_quantlist__44u8_p9_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u8_p9_0 = { - 2, 81, - (long *)_vq_lengthlist__44u8_p9_0, - 1, -511895552, 1631393792, 4, 0, - (long *)_vq_quantlist__44u8_p9_0, - 0 -}; - -static const 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 const 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 const static_codebook _44u8_p9_1 = { - 2, 361, - (long *)_vq_lengthlist__44u8_p9_1, - 1, -518287360, 1622704128, 5, 0, - (long *)_vq_quantlist__44u8_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44u8_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__44u8_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__44u8_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44u9__long = { - 2, 100, - (long *)_huff_lengthlist__44u9__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const 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 const static_codebook _huff_book__44u9__short = { - 2, 100, - (long *)_huff_lengthlist__44u9__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44u9_p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u9_p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44u9_p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44u9_p1_0, - 0 -}; - -static const long _vq_quantlist__44u9_p2_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u9_p2_0 = { - 4, 625, - (long *)_vq_lengthlist__44u9_p2_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u9_p2_0, - 0 -}; - -static const long _vq_quantlist__44u9_p3_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44u9_p3_0 = { - 2, 81, - (long *)_vq_lengthlist__44u9_p3_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44u9_p3_0, - 0 -}; - -static const long _vq_quantlist__44u9_p4_0[] = { - 8, - 7, - 9, - 6, - 10, - 5, - 11, - 4, - 12, - 3, - 13, - 2, - 14, - 1, - 15, - 0, - 16, -}; - -static const 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 const static_codebook _44u9_p4_0 = { - 2, 289, - (long *)_vq_lengthlist__44u9_p4_0, - 1, -529530880, 1611661312, 5, 0, - (long *)_vq_quantlist__44u9_p4_0, - 0 -}; - -static const long _vq_quantlist__44u9_p5_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44u9_p5_0 = { - 4, 81, - (long *)_vq_lengthlist__44u9_p5_0, - 1, -529137664, 1618345984, 2, 0, - (long *)_vq_quantlist__44u9_p5_0, - 0 -}; - -static const long _vq_quantlist__44u9_p5_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u9_p5_1 = { - 2, 121, - (long *)_vq_lengthlist__44u9_p5_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u9_p5_1, - 0 -}; - -static const long _vq_quantlist__44u9_p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u9_p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44u9_p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44u9_p6_0, - 0 -}; - -static const long _vq_quantlist__44u9_p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44u9_p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44u9_p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44u9_p6_1, - 0 -}; - -static const long _vq_quantlist__44u9_p7_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44u9_p7_0 = { - 2, 169, - (long *)_vq_lengthlist__44u9_p7_0, - 1, -523206656, 1618345984, 4, 0, - (long *)_vq_quantlist__44u9_p7_0, - 0 -}; - -static const long _vq_quantlist__44u9_p7_1[] = { - 5, - 4, - 6, - 3, - 7, - 2, - 8, - 1, - 9, - 0, - 10, -}; - -static const 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 const static_codebook _44u9_p7_1 = { - 2, 121, - (long *)_vq_lengthlist__44u9_p7_1, - 1, -531365888, 1611661312, 4, 0, - (long *)_vq_quantlist__44u9_p7_1, - 0 -}; - -static const long _vq_quantlist__44u9_p8_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u9_p8_0 = { - 2, 225, - (long *)_vq_lengthlist__44u9_p8_0, - 1, -520986624, 1620377600, 4, 0, - (long *)_vq_quantlist__44u9_p8_0, - 0 -}; - -static const 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 const 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 const static_codebook _44u9_p8_1 = { - 2, 441, - (long *)_vq_lengthlist__44u9_p8_1, - 1, -529268736, 1611661312, 5, 0, - (long *)_vq_quantlist__44u9_p8_1, - 0 -}; - -static const long _vq_quantlist__44u9_p9_0[] = { - 7, - 6, - 8, - 5, - 9, - 4, - 10, - 3, - 11, - 2, - 12, - 1, - 13, - 0, - 14, -}; - -static const 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 const static_codebook _44u9_p9_0 = { - 2, 225, - (long *)_vq_lengthlist__44u9_p9_0, - 1, -510036736, 1631393792, 4, 0, - (long *)_vq_quantlist__44u9_p9_0, - 0 -}; - -static const 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 const 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 const static_codebook _44u9_p9_1 = { - 2, 361, - (long *)_vq_lengthlist__44u9_p9_1, - 1, -518287360, 1622704128, 5, 0, - (long *)_vq_quantlist__44u9_p9_1, - 0 -}; - -static const 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 const 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 const static_codebook _44u9_p9_2 = { - 1, 49, - (long *)_vq_lengthlist__44u9_p9_2, - 1, -526909440, 1611661312, 6, 0, - (long *)_vq_quantlist__44u9_p9_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44un1__long = { - 2, 64, - (long *)_huff_lengthlist__44un1__long, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - -static const long _vq_quantlist__44un1__p1_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44un1__p1_0 = { - 4, 81, - (long *)_vq_lengthlist__44un1__p1_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44un1__p1_0, - 0 -}; - -static const long _vq_quantlist__44un1__p2_0[] = { - 1, - 0, - 2, -}; - -static const 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 const static_codebook _44un1__p2_0 = { - 4, 81, - (long *)_vq_lengthlist__44un1__p2_0, - 1, -535822336, 1611661312, 2, 0, - (long *)_vq_quantlist__44un1__p2_0, - 0 -}; - -static const long _vq_quantlist__44un1__p3_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44un1__p3_0 = { - 4, 625, - (long *)_vq_lengthlist__44un1__p3_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44un1__p3_0, - 0 -}; - -static const long _vq_quantlist__44un1__p4_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44un1__p4_0 = { - 4, 625, - (long *)_vq_lengthlist__44un1__p4_0, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44un1__p4_0, - 0 -}; - -static const long _vq_quantlist__44un1__p5_0[] = { - 4, - 3, - 5, - 2, - 6, - 1, - 7, - 0, - 8, -}; - -static const 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 const static_codebook _44un1__p5_0 = { - 2, 81, - (long *)_vq_lengthlist__44un1__p5_0, - 1, -531628032, 1611661312, 4, 0, - (long *)_vq_quantlist__44un1__p5_0, - 0 -}; - -static const long _vq_quantlist__44un1__p6_0[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44un1__p6_0 = { - 2, 169, - (long *)_vq_lengthlist__44un1__p6_0, - 1, -526516224, 1616117760, 4, 0, - (long *)_vq_quantlist__44un1__p6_0, - 0 -}; - -static const long _vq_quantlist__44un1__p6_1[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44un1__p6_1 = { - 2, 25, - (long *)_vq_lengthlist__44un1__p6_1, - 1, -533725184, 1611661312, 3, 0, - (long *)_vq_quantlist__44un1__p6_1, - 0 -}; - -static const long _vq_quantlist__44un1__p7_0[] = { - 2, - 1, - 3, - 0, - 4, -}; - -static const 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 const static_codebook _44un1__p7_0 = { - 4, 625, - (long *)_vq_lengthlist__44un1__p7_0, - 1, -518709248, 1626677248, 3, 0, - (long *)_vq_quantlist__44un1__p7_0, - 0 -}; - -static const long _vq_quantlist__44un1__p7_1[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44un1__p7_1 = { - 2, 169, - (long *)_vq_lengthlist__44un1__p7_1, - 1, -523010048, 1618608128, 4, 0, - (long *)_vq_quantlist__44un1__p7_1, - 0 -}; - -static const long _vq_quantlist__44un1__p7_2[] = { - 6, - 5, - 7, - 4, - 8, - 3, - 9, - 2, - 10, - 1, - 11, - 0, - 12, -}; - -static const 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 const static_codebook _44un1__p7_2 = { - 2, 169, - (long *)_vq_lengthlist__44un1__p7_2, - 1, -531103744, 1611661312, 4, 0, - (long *)_vq_quantlist__44un1__p7_2, - 0 -}; - -static const 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 const static_codebook _huff_book__44un1__short = { - 2, 64, - (long *)_huff_lengthlist__44un1__short, - 0, 0, 0, 0, 0, - NULL, - 0 -}; - diff --git a/src/lib/dl/ext/vorbis/codebook.c b/src/lib/dl/ext/vorbis/codebook.c deleted file mode 100755 index 8e30772b..00000000 --- a/src/lib/dl/ext/vorbis/codebook.c +++ /dev/null @@ -1,479 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: basic codebook pack/unpack/code/decode operations - last mod: $Id: codebook.c 17553 2010-10-21 17:54:26Z tterribe $ - - ********************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "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;i<c->entries;i++) - if(c->lengthlist[i-1]==0 || c->lengthlist[i]<c->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;i<c->entries;i++){ - long this=c->lengthlist[i]; - long last=c->lengthlist[i-1]; - if(this>last){ - for(j=last;j<this;j++){ - oggpack_write(opb,i-count,_ilog(c->entries-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;i<c->entries;i++) - if(c->lengthlist[i]==0)break; - - if(i==c->entries){ - oggpack_write(opb,0,1); /* no unused entries */ - for(i=0;i<c->entries;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;i<c->entries;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;i<quantvals;i++) - oggpack_write(opb,labs(c->quantlist[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 *************/ -static_codebook *vorbis_staticbook_unpack(oggpack_buffer *opb){ - long i,j; - static_codebook *s=_ogg_calloc(1,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; - - if(_ilog(s->dim)+_ilog(s->entries)>24)goto _eofout; - - /* codeword ordering.... length ordered or unordered? */ - switch((int)oggpack_read(opb,1)){ - case 0:{ - long unused; - /* allocated but unused entries? */ - unused=oggpack_read(opb,1); - if((s->entries*(unused?1:5)+7)>>3>opb->storage-oggpack_bytes(opb)) - goto _eofout; - /* unordered */ - s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); - - /* allocated but unused entries? */ - if(unused){ - /* yes, unused entries */ - - for(i=0;i<s->entries;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;i<s->entries;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; - if(length==0)goto _eofout; - s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); - - for(i=0;i<s->entries;){ - long num=oggpack_read(opb,_ilog(s->entries-i)); - if(num==-1)goto _eofout; - if(length>32 || num>s->entries-i || - (num>0 && (num-1)>>(length-1)>1)){ - goto _errout; - } - if(length>32)goto _errout; - for(j=0;j<num;j++,i++) - s->lengthlist[i]=length; - length++; - } - } - break; - default: - /* EOF */ - goto _eofout; - } - - /* 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); - if(s->q_sequencep==-1)goto _eofout; - - { - int quantvals=0; - switch(s->maptype){ - case 1: - quantvals=(s->dim==0?0:_book_maptype1_quantvals(s)); - break; - case 2: - quantvals=s->entries*s->dim; - break; - } - - /* quantized values */ - if((quantvals*s->q_quant+7>>3)>opb->storage-oggpack_bytes(opb)) - goto _eofout; - s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals); - for(i=0;i<quantvals;i++) - s->quantlist[i]=oggpack_read(opb,s->q_quant); - - if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout; - } - break; - default: - goto _errout; - } - - /* all set */ - return(s); - - _errout: - _eofout: - vorbis_staticbook_destroy(s); - return(NULL); -} - -/* returns the number of bits ************************************************/ -int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){ - if(a<0 || a>=book->c->entries)return(0); - oggpack_write(b,book->codelist[a],book->c->lengthlist[a]); - return(book->c->lengthlist[a]); -} - -/* 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){ - if(book->used_entries>0){ - 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(-1); -} - -/* returns 0 on OK or -1 on eof *************************************/ -long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){ - if(book->used_entries>0){ - 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;i<book->dim;i++,o+=step) - for (j=0;j<step;j++) - a[o+j]+=t[j][i]; - } - return(0); -} - -long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){ - if(book->used_entries>0){ - int i,j,entry; - float *t; - - if(book->dim>8){ - for(i=0;i<n;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - t = book->valuelist+entry*book->dim; - for (j=0;j<book->dim;) - a[i++]+=t[j++]; - } - }else{ - for(i=0;i<n;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - t = book->valuelist+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){ - if(book->used_entries>0){ - int i,j,entry; - float *t; - - for(i=0;i<n;){ - entry = decode_packed_entry_number(book,b); - if(entry==-1)return(-1); - t = book->valuelist+entry*book->dim; - for (j=0;j<book->dim;) - a[i++]=t[j++]; - } - }else{ - int i,j; - - for(i=0;i<n;){ - for (j=0;j<book->dim;) - a[i++]=0.f; - } - } - 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; - if(book->used_entries>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;j<book->dim;j++){ - a[chptr++][i]+=t[j]; - if(chptr==ch){ - chptr=0; - i++; - } - } - } - } - } - return(0); -} diff --git a/src/lib/dl/ext/vorbis/codebook.h b/src/lib/dl/ext/vorbis/codebook.h deleted file mode 100755 index c7263f81..00000000 --- a/src/lib/dl/ext/vorbis/codebook.h +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: basic shared codebook operations - last mod: $Id: codebook.h 17030 2010-03-25 06:52:55Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_CODEBOOK_H_ -#define _V_CODEBOOK_H_ - -#include <ext/libogg/ogg.h> - -/* 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 - */ - int allocedp; -} static_codebook; - -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; - - /* The current encoder uses only centered, integer-only lattice books. */ - int quantvals; - int minval; - int delta; -} codebook; - -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 static_codebook *vorbis_staticbook_unpack(oggpack_buffer *b); - -extern int vorbis_book_encode(codebook *book, int 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/src/lib/dl/ext/vorbis/codec.h b/src/lib/dl/ext/vorbis/codec.h deleted file mode 100755 index c556cfb6..00000000 --- a/src/lib/dl/ext/vorbis/codec.h +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************** - * * - * 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 Xiph.Org Foundation http://www.xiph.org/ * - - ******************************************************************** - - function: libvorbis codec headers - last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $ - - ********************************************************************/ - -#ifndef _vorbis_codec_h_ -#define _vorbis_codec_h_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include <ext/libogg/ogg.h> - -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 independent 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, const char *comment); -extern void vorbis_comment_add_tag(vorbis_comment *vc, - const char *tag, const char *contents); -extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count); -extern int vorbis_comment_query_count(vorbis_comment *vc, const 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); - -extern const char *vorbis_version_string(void); - -/* 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_idheader(ogg_packet *op); -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/src/lib/dl/ext/vorbis/codec_internal.h b/src/lib/dl/ext/vorbis/codec_internal.h deleted file mode 100755 index de1bccae..00000000 --- a/src/lib/dl/ext/vorbis/codec_internal.h +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: libvorbis codec headers - last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#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); - - - -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; - - - -extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, - const float *logmdct, /* in */ - const float *logmask); -extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look, - int *A,int *B, - int del); -extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, - vorbis_look_floor1 *look, - int *post,int *ilogmask); -#endif diff --git a/src/lib/dl/ext/vorbis/common.mak b/src/lib/dl/ext/vorbis/common.mak deleted file mode 100755 index 742dafab..00000000 --- a/src/lib/dl/ext/vorbis/common.mak +++ /dev/null @@ -1,40 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_VORBIS_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)analysis.obj $(SUBDIR)$(HPS)barkmel.obj $(SUBDIR)$(HPS)bitrate.obj $(SUBDIR)$(HPS)block.obj $(SUBDIR)$(HPS)codebook.obj $(SUBDIR)$(HPS)envelope.obj $(SUBDIR)$(HPS)floor0.obj $(SUBDIR)$(HPS)floor1.obj $(SUBDIR)$(HPS)info.obj $(SUBDIR)$(HPS)lookup.obj $(SUBDIR)$(HPS)lpc.obj $(SUBDIR)$(HPS)lsp.obj $(SUBDIR)$(HPS)mapping0.obj $(SUBDIR)$(HPS)mdct.obj $(SUBDIR)$(HPS)psy.obj $(SUBDIR)$(HPS)registry.obj $(SUBDIR)$(HPS)res0.obj $(SUBDIR)$(HPS)sharedbook.obj $(SUBDIR)$(HPS)smallft.obj $(SUBDIR)$(HPS)synthesis.obj $(SUBDIR)$(HPS)vorbisenc.obj $(SUBDIR)$(HPS)vorbisfile.obj $(SUBDIR)$(HPS)window.obj - -!ifdef EXT_VORBIS_LIB -$(EXT_VORBIS_LIB): $(OBJS) - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)analysis.obj -+$(SUBDIR)$(HPS)barkmel.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)bitrate.obj -+$(SUBDIR)$(HPS)block.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)codebook.obj -+$(SUBDIR)$(HPS)envelope.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)floor0.obj -+$(SUBDIR)$(HPS)floor1.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)info.obj -+$(SUBDIR)$(HPS)lookup.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)lpc.obj -+$(SUBDIR)$(HPS)lsp.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)mapping0.obj -+$(SUBDIR)$(HPS)mdct.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)psy.obj -+$(SUBDIR)$(HPS)synthesis.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)registry.obj -+$(SUBDIR)$(HPS)res0.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)sharedbook.obj -+$(SUBDIR)$(HPS)smallft.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)vorbisenc.obj -+$(SUBDIR)$(HPS)vorbisfile.obj - wlib -q -b -c $(EXT_VORBIS_LIB) -+$(SUBDIR)$(HPS)window.obj -!endif - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_VORBIS_LIB) .symbolic - -exe: .symbolic - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/vorbis/config.h b/src/lib/dl/ext/vorbis/config.h deleted file mode 100755 index d97174fb..00000000 --- a/src/lib/dl/ext/vorbis/config.h +++ /dev/null @@ -1,92 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -/* #undef CRAY_STACKSEG_END */ - -/* Define to 1 if using `alloca.c'. */ -/* #undef C_ALLOCA */ - -/* Define to 1 if you have `alloca', as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). - */ -#define HAVE_ALLOCA_H 1 - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - -/* Name of package */ -#define PACKAGE "libvorbis" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "vorbis-dev@xiph.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libvorbis" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libvorbis 1.3.2" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libvorbis" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.3.2" - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -/* #undef STACK_DIRECTION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.3.2" - -/* 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 diff --git a/src/lib/dl/ext/vorbis/envelope.c b/src/lib/dl/ext/vorbis/envelope.c deleted file mode 100755 index 8e0e714f..00000000 --- a/src/lib/dl/ext/vorbis/envelope.c +++ /dev/null @@ -1,375 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: PCM data envelope analysis - last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "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;i<n;i++){ - e->mdct_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;j<VE_BANDS;j++){ - n=e->band[j].end; - e->band[j].window=_ogg_malloc(n*sizeof(*e->band[0].window)); - for(i=0;i<n;i++){ - e->band[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;i<VE_BANDS;i++) - _ogg_free(e->band[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 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;i<n;i++) - vec[i]=data[i]*ve->mdct_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<n/2;i+=2){ - float val=vec[i]*vec[i]+vec[i+1]*vec[i+1]; - val=todB(&val)*.5f; - if(val<decay)val=decay; - if(val<minV)val=minV; - vec[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_BANDS;j++){ - float acc=0.; - float valmax,valmin; - - /* accumulate amplitude */ - for(i=0;i<bands[j].end;i++) - acc+=vec[i+bands[j].begin]*bands[j].window[i]; - - acc*=bands[j].total; - - /* convert amplitude to delta */ - { - int p,this=filters[j].ampptr; - float postmax,postmin,premax=-99999.f,premin=99999.f; - - p=this; - p--; - if(p<0)p+=VE_AMP; - postmax=max(acc,filters[j].ampbuf[p]); - postmin=min(acc,filters[j].ampbuf[p]); - - for(i=0;i<stretch;i++){ - p--; - if(p<0)p+=VE_AMP; - premax=max(premax,filters[j].ampbuf[p]); - premin=min(premin,filters[j].ampbuf[p]); - } - - valmin=postmin-premin; - valmax=postmax-premax; - - /*filters[j].markers[pos]=valmax;*/ - filters[j].ampbuf[this]=acc; - filters[j].ampptr++; - if(filters[j].ampptr>=VE_AMP)filters[j].ampptr=0; - } - - /* look at min/max, decide trigger */ - if(valmax>gi->preecho_thresh[j]+penalty){ - ret|=1; - ret|=4; - } - if(valmin<gi->postecho_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;j<last;j++){ - int ret=0; - - ve->stretch++; - if(ve->stretch>VE_MAXSTRETCH*2) - ve->stretch=VE_MAXSTRETCH*2; - - for(i=0;i<ve->ch;i++){ - float *pcm=v->pcm[i]+ve->searchstep*(j); - ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS); - } - - 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(j<ve->current-(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;m<VE_BANDS;m++){ - char buf[80]; - sprintf(buf,"delL%d",m); - for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m].markers[l]*.1; - _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift); - } - - for(m=0;m<VE_BANDS;m++){ - char buf[80]; - sprintf(buf,"delR%d",m); - for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m+VE_BANDS].markers[l]*.1; - _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift); - } - - for(l=0;l<last;l++)marker[l*ve->searchstep]=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->curmark<endW)return(1); - { - long first=beginW/ve->searchstep; - long last=endW/ve->searchstep; - long i; - for(i=first;i<last;i++) - if(ve->mark[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;i<VE_BANDS*e->ch;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/src/lib/dl/ext/vorbis/envelope.h b/src/lib/dl/ext/vorbis/envelope.h deleted file mode 100755 index fd15fb32..00000000 --- a/src/lib/dl/ext/vorbis/envelope.h +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: PCM data envelope analysis and manipulation - last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#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/src/lib/dl/ext/vorbis/floor0.c b/src/lib/dl/ext/vorbis/floor0.c deleted file mode 100755 index 292a104e..00000000 --- a/src/lib/dl/ext/vorbis/floor0.c +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: floor backend 0 implementation - last mod: $Id: floor0.c 17558 2010-10-22 00:24:41Z tterribe $ - - ********************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "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 <stdio.h> - -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;j<info->numbooks;j++){ - info->books[j]=oggpack_read(opb,8); - if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out; - if(ci->book_param[info->books[j]]->maptype==0)goto err_out; - if(ci->book_param[info->books[j]]->dim<1)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;j<n;j++){ - int val=floor( toBARK((info->rate/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<<info->ampbits)-1; - float amp=(float)ampraw/maxval*info->ampdB; - int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks)); - - if(booknum!=-1 && booknum<info->numbooks){ /* 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;j<look->m;j+=b->dim) - if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop; - for(j=0;j<look->m;){ - for(k=0;k<b->dim;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 */ -const vorbis_func_floor floor0_exportbundle={ - NULL,&floor0_unpack,&floor0_look,&floor0_free_info, - &floor0_free_look,&floor0_inverse1,&floor0_inverse2 -}; diff --git a/src/lib/dl/ext/vorbis/floor1.c b/src/lib/dl/ext/vorbis/floor1.c deleted file mode 100755 index 671327bc..00000000 --- a/src/lib/dl/ext/vorbis/floor1.c +++ /dev/null @@ -1,1099 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: floor backend 1 implementation - last mod: $Id: floor1.c 17555 2010-10-21 18:14:51Z tterribe $ - - ********************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "codec.h" -#include "codec_internal.h" -#include "registry.h" -#include "codebook.h" -#include "misc.h" -#include "scales.h" - -#include <stdio.h> - -#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */ - -typedef struct lsfit_acc{ - int x0; - int x1; - - int xa; - int ya; - int x2a; - int y2a; - int xya; - int an; - - int xb; - int yb; - int x2b; - int y2b; - int xyb; - int bn; -} 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;j<info->partitions;j++){ - oggpack_write(opb,info->partitionclass[j],4); /* only 0 to 15 legal */ - if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j]; - } - - /* save out partition classes */ - for(j=0;j<maxclass+1;j++){ - oggpack_write(opb,info->class_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<<info->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;j<info->partitions;j++){ - count+=info->class_dim[info->partitionclass[j]]; - for(;k<count;k++) - oggpack_write(opb,info->postlist[k+2],rangebits); - } -} - -static int icomp(const void *a,const void *b){ - return(**(int **)a-**(int **)b); -} - -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;j<info->partitions;j++){ - info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */ - if(info->partitionclass[j]<0)goto err_out; - if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j]; - } - - /* read partition classes */ - for(j=0;j<maxclass+1;j++){ - info->class_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<<info->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); - if(rangebits<0)goto err_out; - - for(j=0,k=0;j<info->partitions;j++){ - count+=info->class_dim[info->partitionclass[j]]; - for(;k<count;k++){ - int t=info->postlist[k+2]=oggpack_read(opb,rangebits); - if(t<0 || t>=(1<<rangebits)) - goto err_out; - } - } - info->postlist[0]=0; - info->postlist[1]=1<<rangebits; - - /* don't allow repeated values in post list as they'd result in - zero-length segments */ - { - int *sortpointer[VIF_POSIT+2]; - for(j=0;j<count+2;j++)sortpointer[j]=info->postlist+j; - qsort(sortpointer,count+2,sizeof(*sortpointer),icomp); - - for(j=1;j<count+2;j++) - if(*sortpointer[j-1]==*sortpointer[j])goto err_out; - } - - return(info); - - err_out: - floor1_free_info(info); - return(NULL); -} - -static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd, - vorbis_info_floor *in){ - - int *sortpointer[VIF_POSIT+2]; - vorbis_info_floor1 *info=(vorbis_info_floor1 *)in; - vorbis_look_floor1 *look=_ogg_calloc(1,sizeof(*look)); - int i,j,n=0; - - look->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;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]]; - n+=2; - look->posts=n; - - /* also store a sorted position index */ - for(i=0;i<n;i++)sortpointer[i]=info->postlist+i; - qsort(sortpointer,n,sizeof(*sortpointer),icomp); - - /* points from sort order back to range number */ - for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist; - /* points from range order to sorted position */ - for(i=0;i<n;i++)look->reverse_index[look->forward_index[i]]=i; - /* we actually need the post values too */ - for(i=0;i<n;i++)look->sorted_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;i<n-2;i++){ - int lo=0; - int hi=1; - int lx=0; - int hx=look->n; - int currentx=info->postlist[i+2]; - for(j=0;j<i+2;j++){ - int x=info->postlist[j]; - if(x>lx && x<currentx){ - lo=j; - lx=x; - } - if(x<hx && x>currentx){ - 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 const 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 n, 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); - - if(n>x1)n=x1; - - if(x<n) - d[x]*=FLOOR1_fromdB_LOOKUP[y]; - - while(++x<n){ - err=err+ady; - if(err>=adx){ - err-=adx; - y+=sy; - }else{ - y+=base; - } - d[x]*=FLOOR1_fromdB_LOOKUP[y]; - } -} - -static void render_line0(int n, 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); - - if(n>x1)n=x1; - - if(x<n) - d[x]=y; - - while(++x<n){ - err=err+ady; - if(err>=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 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++; - } - } - } - - a->xa=xa; - a->ya=ya; - a->x2a=x2a; - a->y2a=y2a; - a->xya=xya; - a->an=na; - - a->xb=xb; - a->yb=yb; - a->x2b=x2b; - a->y2b=y2b; - a->xyb=xyb; - a->bn=nb; - - return(na); -} - -static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1, - vorbis_info_floor1 *info){ - double xb=0,yb=0,x2b=0,y2b=0,xyb=0,bn=0; - int i; - int x0=a[0].x0; - int x1=a[fits-1].x1; - - for(i=0;i<fits;i++){ - double weight = (a[i].bn+a[i].an)*info->twofitweight/(a[i].an+1)+1.; - - xb+=a[i].xb + a[i].xa * weight; - yb+=a[i].yb + a[i].ya * weight; - x2b+=a[i].x2b + a[i].x2a * weight; - y2b+=a[i].y2b + a[i].y2a * weight; - xyb+=a[i].xyb + a[i].xya * weight; - bn+=a[i].bn + a[i].an * weight; - } - - if(*y0>=0){ - xb+= x0; - yb+= *y0; - x2b+= x0 * x0; - y2b+= *y0 * *y0; - xyb+= *y0 * x0; - bn++; - } - - if(*y1>=0){ - xb+= x1; - yb+= *y1; - x2b+= x1 * x1; - y2b+= *y1 * *y1; - xyb+= *y1 * x1; - bn++; - } - - { - double denom=(bn*x2b-xb*xb); - - if(denom>0.){ - double a=(yb*x2b-xyb*xb)/denom; - double b=(bn*xyb-xb*yb)/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; - - return 0; - }else{ - *y0=0; - *y1=0; - return 1; - } - } -} - -static int inspect_error(int x0,int x1,int y0,int y1,const float *mask, - const float *mdct, - vorbis_info_floor1 *info){ - 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; - int val=vorbis_dBquant(mask+x); - int mse=0; - int n=0; - - ady-=abs(base*adx); - - mse=(y-val); - mse*=mse; - n++; - if(mdct[x]+info->twofitatten>=mask[x]){ - if(y+info->maxover<val)return(1); - if(y-info->maxunder>val)return(1); - } - - while(++x<x1){ - err=err+ady; - if(err>=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->maxover<val)return(1); - if(y-info->maxunder>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; -} - -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;i<posts;i++)fit_valueA[i]=-200; /* mark all unused */ - for(i=0;i<posts;i++)fit_valueB[i]=-200; /* mark all unused */ - for(i=0;i<posts;i++)loneighbor[i]=0; /* 0 for the implicit 0 post */ - for(i=0;i<posts;i++)hineighbor[i]=1; /* 1 for the implicit post at n */ - for(i=0;i<posts;i++)memo[i]=-1; /* no neighbor yet */ - - /* quantize the relevant floor points and collect them into line fit - structures (one per minimal division) at the same time */ - if(posts==0){ - nonzero+=accumulate_fit(logmask,logmdct,0,n,fits,n,info); - }else{ - for(i=0;i<posts-1;i++) - nonzero+=accumulate_fit(logmask,logmdct,look->sorted_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,info); - - 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;i<posts;i++){ - int sortpos=look->reverse_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; - int ret0=fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1,info); - int ret1=fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1,info); - - if(ret0){ - ly0=ly; - ly1=hy0; - } - if(ret1){ - hy0=ly1; - hy1=hy; - } - - if(ret0 && ret1){ - fit_valueA[i]=-200; - fit_valueB[i]=-200; - }else{ - /* 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;j<posts;j++) - if(loneighbor[j]==ln) - loneighbor[j]=i; - else - break; - } - } - }else{ - fit_valueA[i]=-200; - fit_valueB[i]=-200; - } - } - } - } - - output=_vorbis_block_alloc(vb,sizeof(*output)*posts); - - output[0]=post_Y(fit_valueA,fit_valueB,0); - output[1]=post_Y(fit_valueA,fit_valueB,1); - - /* fill in posts marked as not using a fit; we will zero - back out to 'unused' when encoding them so long as curve - interpolation doesn't force them into use */ - for(i=2;i<posts;i++){ - int ln=look->loneighbor[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); - - /* overly simpleminded--- look again post 1.2 */ - for(i=0;i<posts;i++){ - output[i]=((65536-del)*(A[i]&0x7fff)+del*(B[i]&0x7fff)+32768)>>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 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; - - /* quantize values to multiplier spec */ - if(post){ - for(i=0;i<posts;i++){ - int val=post[i]&0x7fff; - switch(info->mult){ - 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;i<posts;i++){ - int ln=look->loneighbor[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-predicted<predicted? - look->quant_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;i<info->partitions;i++){ - int class=info->partitionclass[i]; - int cdim=info->class_dim[class]; - int csubbits=info->class_subs[class]; - int csub=1<<csubbits; - int bookas[8]={0,0,0,0,0,0,0,0}; - int cval=0; - int cshift=0; - int k,l; - - /* generate the partition's first stage cascade value */ - if(csubbits){ - int maxval[8]; - for(k=0;k<csub;k++){ - int booknum=info->class_subbook[class][k]; - if(booknum<0){ - maxval[k]=1; - }else{ - maxval[k]=sbooks[info->class_subbook[class][k]]->entries; - } - } - for(k=0;k<cdim;k++){ - for(l=0;l<csub;l++){ - int val=out[j+k]; - if(val<maxval[l]){ - bookas[k]=l; - break; - } - } - cval|= bookas[k]<<cshift; - cshift+=csubbits; - } - /* write it */ - look->phrasebits+= - 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;k<cdim;k++){ - int book=info->class_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; - int n=ci->blocksizes[vb->W]/2; - - for(j=1;j<look->posts;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(n,lx,hx,ly,hy,ilogmask); - - lx=hx; - ly=hy; - } - } - for(j=hx;j<vb->pcmend/2;j++)ilogmask[j]=ly; /* be certain */ - return(1); - } - }else{ - oggpack_write(opb,0,1); - memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask)); - 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;i<info->partitions;i++){ - int class=info->partitionclass[i]; - int cdim=info->class_dim[class]; - int csubbits=info->class_subs[class]; - int csub=1<<csubbits; - int cval=0; - - /* decode the partition's first stage cascade value */ - if(csubbits){ - cval=vorbis_book_decode(books+info->class_book[class],&vb->opb); - - if(cval==-1)goto eop; - } - - for(k=0;k<cdim;k++){ - int book=info->class_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;i<look->posts;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<loroom?hiroom:loroom)<<1; - int val=fit_value[i]; - - if(val){ - if(val>=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&0x7fff; - 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; - /* guard lookup against out-of-range values */ - ly=(ly<0?0:ly>255?255:ly); - - for(j=1;j<look->posts;j++){ - int current=look->forward_index[j]; - int hy=fit_value[current]&0x7fff; - if(hy==fit_value[current]){ - - hx=info->postlist[current]; - hy*=info->mult; - /* guard lookup against out-of-range values */ - hy=(hy<0?0:hy>255?255:hy); - - render_line(n,lx,hx,ly,hy,out); - - lx=hx; - ly=hy; - } - } - for(j=hx;j<n;j++)out[j]*=FLOOR1_fromdB_LOOKUP[ly]; /* be certain */ - return(1); - } - memset(out,0,sizeof(*out)*n); - return(0); -} - -/* export hooks */ -const vorbis_func_floor floor1_exportbundle={ - &floor1_pack,&floor1_unpack,&floor1_look,&floor1_free_info, - &floor1_free_look,&floor1_inverse1,&floor1_inverse2 -}; diff --git a/src/lib/dl/ext/vorbis/highlevel.h b/src/lib/dl/ext/vorbis/highlevel.h deleted file mode 100755 index e38f370f..00000000 --- a/src/lib/dl/ext/vorbis/highlevel.h +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: highlevel encoder setup struct separated out for vorbisenc clarity - last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $ - - ********************************************************************/ - -typedef struct highlevel_byblocktype { - double tone_mask_setting; - double tone_peaklimit_setting; - double noise_bias_setting; - double noise_compand_setting; -} highlevel_byblocktype; - -typedef struct highlevel_encode_setup { - int set_in_stone; - const void *setup; - double base_setting; - - double impulse_noisetune; - - /* bitrate management below all settable */ - float req; - int managed; - long bitrate_min; - long bitrate_av; - double bitrate_av_damp; - long bitrate_max; - long bitrate_reservoir; - double bitrate_reservoir_bias; - - int impulse_block_p; - int noise_normalize_p; - int coupling_p; - - double stereo_point_setting; - double lowpass_kHz; - int lowpass_altered; - - double ath_floating_dB; - double ath_absolute_dB; - - double amplitude_track_dBpersec; - double trigger_setting; - - highlevel_byblocktype block[4]; /* padding, impulse, transition, long */ - -} highlevel_encode_setup; diff --git a/src/lib/dl/ext/vorbis/info.c b/src/lib/dl/ext/vorbis/info.c deleted file mode 100755 index a14a7d4b..00000000 --- a/src/lib/dl/ext/vorbis/info.c +++ /dev/null @@ -1,664 +0,0 @@ -/******************************************************************** - * * - * 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-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: maintain the info structure, info <-> header packets - last mod: $Id: info.c 17584 2010-11-01 19:26:16Z xiphmont $ - - ********************************************************************/ - -/* general handling of the header and the vorbis_info structure (and - substructures) */ - -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <ext/libogg/ogg.h> -#include "codec.h" -#include "codec_internal.h" -#include "codebook.h" -#include "registry.h" -#include "window.h" -#include "psy.h" -#include "misc.h" -#include "os.h" - -#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.2" -#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20101101 (Schaufenugget)" - -/* 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,const 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,const 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, const char *tag, const 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, const 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;i<vc->comments;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, const 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;i<vc->comments;i++){ - if(!tagcompare(vc->user_comments[i], fulltag, taglen)) - count++; - } - - return count; -} - -void vorbis_comment_clear(vorbis_comment *vc){ - if(vc){ - long i; - if(vc->user_comments){ - for(i=0;i<vc->comments;i++) - if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); - _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 guaranteed 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;i<ci->modes;i++) - if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); - - for(i=0;i<ci->maps;i++) /* unpack does the range checking */ - if(ci->map_param[i]) /* this may be cleaning up an aborted - unpack, in which case the below type - cannot be trusted */ - _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); - - for(i=0;i<ci->floors;i++) /* unpack does the range checking */ - if(ci->floor_param[i]) /* this may be cleaning up an aborted - unpack, in which case the below type - cannot be trusted */ - _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); - - for(i=0;i<ci->residues;i++) /* unpack does the range checking */ - if(ci->residue_param[i]) /* this may be cleaning up an aborted - unpack, in which case the below type - cannot be trusted */ - _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); - - for(i=0;i<ci->books;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;i<ci->psys;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<<oggpack_read(opb,4); - ci->blocksizes[1]=1<<oggpack_read(opb,4); - - if(vi->rate<1)goto err_out; - if(vi->channels<1)goto err_out; - if(ci->blocksizes[0]<64)goto err_out; - if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out; - if(ci->blocksizes[1]>8192)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; - if(vendorlen>opb->storage-8)goto err_out; - vc->vendor=_ogg_calloc(vendorlen+1,1); - _v_readstring(opb,vc->vendor,vendorlen); - i=oggpack_read(opb,32); - if(i<0)goto err_out; - if(i>((opb->storage-oggpack_bytes(opb))>>2))goto err_out; - vc->comments=i; - 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;i<vc->comments;i++){ - int len=oggpack_read(opb,32); - if(len<0)goto err_out; - if(len>opb->storage-oggpack_bytes(opb))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; - if(ci->books<=0)goto err_out; - for(i=0;i<ci->books;i++){ - ci->book_param[i]=vorbis_staticbook_unpack(opb); - if(!ci->book_param[i])goto err_out; - } - - /* time backend settings; hooks are unused */ - { - int times=oggpack_read(opb,6)+1; - if(times<=0)goto err_out; - for(i=0;i<times;i++){ - int test=oggpack_read(opb,16); - if(test<0 || test>=VI_TIMEB)goto err_out; - } - } - - /* floor backend settings */ - ci->floors=oggpack_read(opb,6)+1; - if(ci->floors<=0)goto err_out; - for(i=0;i<ci->floors;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; - if(ci->residues<=0)goto err_out; - for(i=0;i<ci->residues;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; - if(ci->maps<=0)goto err_out; - for(i=0;i<ci->maps;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; - if(ci->modes<=0)goto err_out; - for(i=0;i<ci->modes;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(ci->mode_param[i]->mapping<0)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); -} - -/* Is this packet a vorbis ID header? */ -int vorbis_synthesis_idheader(ogg_packet *op){ - oggpack_buffer opb; - char buffer[6]; - - if(op){ - oggpack_readinit(&opb,op->packet,op->bytes); - - if(!op->b_o_s) - return(0); /* Not the initial packet */ - - if(oggpack_read(&opb,8) != 1) - return 0; /* not an ID header */ - - memset(buffer,0,6); - _v_readstring(&opb,buffer,6); - if(memcmp(buffer,"vorbis",6)) - return 0; /* not vorbis */ - - return 1; - } - - return 0; -} - -/* 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){ - int bytes = strlen(ENCODE_VENDOR_STRING); - - /* preamble */ - oggpack_write(opb,0x03,8); - _v_writestring(opb,"vorbis", 6); - - /* vendor */ - oggpack_write(opb,bytes,32); - _v_writestring(opb,ENCODE_VENDOR_STRING, bytes); - - /* comments */ - - oggpack_write(opb,vc->comments,32); - if(vc->comments){ - int i; - for(i=0;i<vc->comments;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;i<ci->books;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;i<ci->floors;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;i<ci->residues;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;i<ci->maps;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;i<ci->modes;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; - op->packetno=1; - - 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; - op->packetno=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; - op_comm->packetno=1; - - /* 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; - op_code->packetno=2; - - oggpack_writeclear(&opb); - return(0); - err_out: - memset(op,0,sizeof(*op)); - memset(op_comm,0,sizeof(*op_comm)); - memset(op_code,0,sizeof(*op_code)); - - if(b){ - oggpack_writeclear(&opb); - 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 == -1) return -1; - - /* We're not guaranteed a 64 bit unsigned type everywhere, so we - have to put the unsigned granpo in a signed type. */ - if(granulepos>=0){ - return((double)granulepos/v->vi->rate); - }else{ - ogg_int64_t granuleoff=0xffffffff; - granuleoff<<=31; - granuleoff|=0x7ffffffff; - return(((double)granulepos+2+granuleoff+granuleoff)/v->vi->rate); - } -} - -const char *vorbis_version_string(void){ - return GENERAL_VENDOR_STRING; -} diff --git a/src/lib/dl/ext/vorbis/lookup.c b/src/lib/dl/ext/vorbis/lookup.c deleted file mode 100755 index 3321ed3d..00000000 --- a/src/lib/dl/ext/vorbis/lookup.c +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: lookup based functions - last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#include <math.h> -#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 <stdio.h> -/* interpolated lookup based fromdB function, domain -140dB to 0dB only */ -float vorbis_fromdBlook(float a){ - int i=vorbis_ftoi(a*((float)(-(1<<FROMdB2_SHIFT)))-.5f); - return (i<0)?1.f: - ((i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))?0.f: - FROMdB_LOOKUP[i>>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))?0.f: - FROMdB_LOOKUP[i>>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/src/lib/dl/ext/vorbis/lookup.h b/src/lib/dl/ext/vorbis/lookup.h deleted file mode 100755 index f8b5b827..00000000 --- a/src/lib/dl/ext/vorbis/lookup.h +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: lookup based functions - last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#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/src/lib/dl/ext/vorbis/lookup_data.h b/src/lib/dl/ext/vorbis/lookup_data.h deleted file mode 100755 index 2424a1b3..00000000 --- a/src/lib/dl/ext/vorbis/lookup_data.h +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: lookup data; generated by lookups.pl; edit there - last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_LOOKUP_DATA_H_ - -#ifdef FLOAT_LOOKUP -#define COS_LOOKUP_SZ 128 -static const 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 const 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 const 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 - -#ifdef FLOAT_LOOKUP -static const 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 const 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, -}; -#endif - -#ifdef INT_LOOKUP - -#define INVSQ_LOOKUP_I_SHIFT 10 -#define INVSQ_LOOKUP_I_MASK 1023 -static const 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 const 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/src/lib/dl/ext/vorbis/lpc.c b/src/lib/dl/ext/vorbis/lpc.c deleted file mode 100755 index f5199ec2..00000000 --- a/src/lib/dl/ext/vorbis/lpc.c +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: LPC low level routines - last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -/* 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 <stdlib.h> -#include <string.h> -#include <math.h> -#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; - double epsilon; - 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<n;i++)d+=(double)data[i]*data[i-j]; - aut[j]=d; - } - - /* Generate lpc coefficients from autocorr values */ - - /* set our noise floor to about -100dB */ - error=aut[0] * (1. + 1e-10); - epsilon=1e-9*aut[0]+1e-10; - - for(i=0;i<m;i++){ - double r= -aut[i+1]; - - if(error<epsilon){ - memset(lpc+i,0,(m-i)*sizeof(*lpc)); - goto done; - } - - /* Sum up this iteration's reflection coefficient; note that in - Vorbis we don't save it. If anyone wants to recycle this code - and needs reflection coefficients, save the results of 'r' from - each iteration. */ - - for(j=0;j<i;j++)r-=lpc[j]*aut[i-j]; - r/=error; - - /* Update LPC coefficients and total error */ - - lpc[i]=r; - for(j=0;j<i/2;j++){ - 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; - - error*=1.-r*r; - - } - - done: - - /* slightly damp the filter */ - { - double g = .99; - double damp = g; - for(j=0;j<m;j++){ - lpc[j]*=damp; - damp*=g; - } - } - - for(j=0;j<m;j++)lpci[j]=(float)lpc[j]; - - /* we need the error value to know how big an impulse to hit the - filter with later */ - - return error; -} - -void vorbis_lpc_predict(float *coeff,float *prime,int m, - float *data,long n){ - - /* in: coeff[0...m-1] LPC coefficients - prime[0...m-1] initial values (allocated size of n+m-1) - out: data[0...n-1] data samples */ - - long i,j,o,p; - float y; - float *work=alloca(sizeof(*work)*(m+n)); - - if(!prime) - for(i=0;i<m;i++) - work[i]=0.f; - else - for(i=0;i<m;i++) - work[i]=prime[i]; - - for(i=0;i<n;i++){ - y=0; - o=i; - p=m; - for(j=0;j<m;j++) - y-=work[o++]*coeff[--p]; - - data[i]=work[o]=y; - } -} diff --git a/src/lib/dl/ext/vorbis/lpc.h b/src/lib/dl/ext/vorbis/lpc.h deleted file mode 100755 index 39d23760..00000000 --- a/src/lib/dl/ext/vorbis/lpc.h +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: LPC low level routines - last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_LPC_H_ -#define _V_LPC_H_ - -#include "vorbis/codec.h" - -/* simple linear scale LPC code */ -extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m); - -extern void vorbis_lpc_predict(float *coeff,float *prime,int m, - float *data,long n); - -#endif diff --git a/src/lib/dl/ext/vorbis/lsp.c b/src/lib/dl/ext/vorbis/lsp.c deleted file mode 100755 index 50031a7a..00000000 --- a/src/lib/dl/ext/vorbis/lsp.c +++ /dev/null @@ -1,456 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: LSP (also called LSF) conversion routines - last mod: $Id: lsp.c 17538 2010-10-15 02:52:29Z tterribe $ - - The LSP generation code is taken (with minimal modification and a - few bugfixes) from "On the Computation of the LSP Frequencies" by - Joseph Rothweiler (see http://www.rothweiler.us for contact info). - The paper is available at: - - http://www.myown1.com/joe/lsf - - ********************************************************************/ - -/* Note that the lpc-lsp conversion finds the roots of polynomial with - an iterative root polisher (CACM algorithm 283). It *is* possible - to confuse this algorithm into not converging; that should only - happen with absurdly closely spaced roots (very sharp peaks in the - LPC f response) which in turn should be impossible in our use of - the code. If this *does* happen anyway, it's a bug in the floor - finder; find the cause of the confusion (probably a single bin - spike or accidental near-float-limit resolution problems) and - correct it. */ - -#include <math.h> -#include <string.h> -#include <stdlib.h> -#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 - separately 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. */ - -/* define either of these (preferably FLOAT_LOOKUP) to have faster - but less precise implementation. */ -#undef 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<m;i++)lsp[i]=vorbis_coslook(lsp[i]); - - i=0; - while(i<n){ - int k=map[i]; - int qexp; - float p=.7071067812f; - float q=.7071067812f; - float w=vorbis_coslook(wdel*k); - float *ftmp=lsp; - int c=m>>1; - - while(c--){ - q*=ftmp[0]-w; - p*=ftmp[1]-w; - ftmp+=2; - } - - 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 const 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 const 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 const 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<m;i++)ilsp[i]=vorbis_coslook_i(lsp[i]/M_PI*65536.f+.5f); - - i=0; - while(i<n){ - int j,k=map[i]; - unsigned long pi=46341; /* 2**-.5 in 0.16 */ - unsigned long qi=46341; - int qexp=0,shift; - long wi=vorbis_coslook_i(k*65536/ln); - - qi*=labs(ilsp[0]-wi); - pi*=labs(ilsp[1]-wi); - - for(j=3;j<m;j+=2){ - if(!(shift=MLOOP_1[(pi|qi)>>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<m;i++)lsp[i]=2.f*cos(lsp[i]); - - i=0; - while(i<n){ - int j,k=map[i]; - float p=.5f; - float q=.5f; - float w=2.f*cos(wdel*k); - for(j=1;j<m;j+=2){ - q *= w-lsp[j-1]; - p *= w-lsp[j]; - } - if(j==m){ - /* odd order filter; slightly assymetric */ - /* the last coefficient */ - q*=w-lsp[j-1]; - p*=p*(4.f-w*w); - q*=q; - }else{ - /* even order filter; still symmetric */ - p*=p*(2.f-w); - q*=q*(2.f+w); - } - - q=fromdB(amp/sqrt(p+q)-ampoffset); - - curve[i]*=q; - while(map[++i]==k)curve[i]*=q; - } -} - -#endif -#endif - -static void cheby(float *g, int ord) { - int i, j; - - g[0] *= .5f; - for(i=2; i<= ord; i++) { - for(j=ord; j >= 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; - }else{ - 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; i<ord;i++) root[i] = r[i]; - - while(error>1e-20){ - error=0; - - for(i=0; i<ord; i++) { /* Update each point. */ - double pp=0.,delta; - double rooti=root[i]; - double p=a[ord]; - for(k=ord-1; k>= 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<ord;i++) r[i] = root[i]; - return(0); -} - - -/* Convert lpc coefficients to lsp coefficients */ -int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){ - int order2=(m+1)>>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<g1_order;i++) - lsp[i*2] = acos(g1r[i]); - - for(i=0;i<g2_order;i++) - lsp[i*2+1] = acos(g2r[i]); - return(0); -} diff --git a/src/lib/dl/ext/vorbis/lsp.h b/src/lib/dl/ext/vorbis/lsp.h deleted file mode 100755 index bacfb097..00000000 --- a/src/lib/dl/ext/vorbis/lsp.h +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: LSP (also called LSF) conversion routines - last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - - -#ifndef _V_LSP_H_ -#define _V_LSP_H_ - -extern int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m); - -extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln, - float *lsp,int m, - float amp,float ampoffset); - -#endif diff --git a/src/lib/dl/ext/vorbis/mapping0.c b/src/lib/dl/ext/vorbis/mapping0.c deleted file mode 100755 index 434d8dcb..00000000 --- a/src/lib/dl/ext/vorbis/mapping0.c +++ /dev/null @@ -1,816 +0,0 @@ -/******************************************************************** - * * - * 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-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: channel mapping 0 implementation - last mod: $Id: mapping0.c 17022 2010-03-25 03:45:42Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "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;i<info->coupling_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;i<vi->channels;i++) - oggpack_write(opb,info->chmuxlist[i],4); - } - for(i=0;i<info->submaps;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,b; - vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info)); - codec_setup_info *ci=vi->codec_setup; - memset(info,0,sizeof(*info)); - - b=oggpack_read(opb,1); - if(b<0)goto err_out; - if(b){ - info->submaps=oggpack_read(opb,4)+1; - if(info->submaps<=0)goto err_out; - }else - info->submaps=1; - - b=oggpack_read(opb,1); - if(b<0)goto err_out; - if(b){ - info->coupling_steps=oggpack_read(opb,8)+1; - if(info->coupling_steps<=0)goto err_out; - for(i=0;i<info->coupling_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;i<vi->channels;i++){ - info->chmuxlist[i]=oggpack_read(opb,4); - if(info->chmuxlist[i]>=info->submaps || info->chmuxlist[i]<0)goto err_out; - } - } - for(i=0;i<info->submaps;i++){ - oggpack_read(opb,8); /* time submap unused */ - info->floorsubmap[i]=oggpack_read(opb,8); - if(info->floorsubmap[i]>=ci->floors || info->floorsubmap[i]<0)goto err_out; - info->residuesubmap[i]=oggpack_read(opb,8); - if(info->residuesubmap[i]>=ci->residues || info->residuesubmap[i]<0)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 - - -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 **iwork = _vorbis_block_alloc(vb,vi->channels*sizeof(*iwork)); - 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;i<vi->channels;i++){ - float scale=4.f/n; - float scale_dB; - - float *pcm =vb->pcm[i]; - float *logfft =pcm; - - iwork[i]=_vorbis_block_alloc(vb,n/2*sizeof(**iwork)); - 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); - }else{ - _analysis_output("pcm",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); - }else{ - _analysis_output("windowed",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<n-1;j+=2){ - float temp=pcm[j]*pcm[j]+pcm[j+1]*pcm[j+1]; - temp=logfft[(j+1)>>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); - } - }else{ - _analysis_output("fft",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;i<vi->channels;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;j<n/2;j++) - logmdct[j]=todB(mdct+j) + .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("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); - }else{ - _analysis_output("noise",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); - }else{ - _analysis_output("tone",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); - }else{ - _analysis_output("aotuvM1",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); - }else{ - _analysis_output("mask1",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); - }else{ - _analysis_output("mask2",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); - }else{ - _analysis_output("mask0",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;k<PACKETBLOBS/2;k++) - floor_posts[i][k]= - floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]], - floor_posts[i][0], - floor_posts[i][PACKETBLOBS/2], - k*65536/(PACKETBLOBS/2)); - for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++) - floor_posts[i][k]= - floor1_interpolate_fit(vb,b->flr[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 */ - - { - int **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels); - int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); - - 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;i<vi->channels;i++){ - int submap=info->chmuxlist[i]; - int *ilogmask=iwork[i]; - - 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;j<n/2;j++) - work[j]=FLOOR1_fromdB_LOOKUP[iwork[i][j]]; - _analysis_output(buf,seq,work,n/2,1,1,0); - } -#endif - } - - /* our iteration is now based on masking curve, not prequant and - coupling. Only one prequant/coupling step */ - - /* quantize/couple */ - /* incomplete implementation that assumes the tree is all depth - one, or no tree at all */ - _vp_couple_quantize_normalize(k, - &ci->psy_g_param, - psy_look, - info, - gmdct, - iwork, - nonzero, - ci->psy_g_param.sliding_lowpass[vb->W][k], - vi->channels); - -#if 0 - for(i=0;i<vi->channels;i++){ - char buf[80]; - sprintf(buf,"res%c%d",i?'R':'L',k); - float work[n/2]; - for(j=0;j<n/2;j++) - work[j]=iwork[i][j]; - _analysis_output(buf,seq,work,n/2,1,0,0); - } -#endif - - /* classify and encode by submap */ - for(i=0;i<info->submaps;i++){ - int ch_in_bundle=0; - long **classifications; - int resnum=info->residuesubmap[i]; - - for(j=0;j<vi->channels;j++){ - if(info->chmuxlist[j]==i){ - zerobundle[ch_in_bundle]=0; - if(nonzero[j])zerobundle[ch_in_bundle]=1; - couple_bundle[ch_in_bundle++]=iwork[j]; - } - } - - classifications=_residue_P[ci->residue_type[resnum]]-> - class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle); - - ch_in_bundle=0; - for(j=0;j<vi->channels;j++) - if(info->chmuxlist[j]==i) - couple_bundle[ch_in_bundle++]=iwork[j]; - - _residue_P[ci->residue_type[resnum]]-> - forward(opb,vb,b->residue[resnum], - couple_bundle,zerobundle,ch_in_bundle,classifications,i); - } - - /* 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 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;i<vi->channels;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;i<info->coupling_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;i<info->submaps;i++){ - int ch_in_bundle=0; - for(j=0;j<vi->channels;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;j<n/2;j++){ - float mag=pcmM[j]; - float ang=pcmA[j]; - - if(mag>0) - 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;i<vi->channels;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;i<vi->channels;i++){ - float *pcm=vb->pcm[i]; - mdct_backward(b->transform[vb->W][0],pcm,pcm); - } - - /* all done! */ - return(0); -} - -/* export hooks */ -const vorbis_func_mapping mapping0_exportbundle={ - &mapping0_pack, - &mapping0_unpack, - &mapping0_free_info, - &mapping0_forward, - &mapping0_inverse -}; diff --git a/src/lib/dl/ext/vorbis/masking.h b/src/lib/dl/ext/vorbis/masking.h deleted file mode 100755 index 3576ab78..00000000 --- a/src/lib/dl/ext/vorbis/masking.h +++ /dev/null @@ -1,785 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: masking curve data for psychoacoustics - last mod: $Id: masking.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#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 const 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 const 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/src/lib/dl/ext/vorbis/mdct.c b/src/lib/dl/ext/vorbis/mdct.c deleted file mode 100755 index 08163318..00000000 --- a/src/lib/dl/ext/vorbis/mdct.c +++ /dev/null @@ -1,563 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: normalized modified discrete cosine transform - power of two length transform only [64 <= n ] - last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $ - - 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 <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#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<n/4;i++){ - T[i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i))); - T[i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i))); - T[n2+i*2]=FLOAT_CONV(cos((M_PI/(2*n))*(2*i+1))); - T[n2+i*2+1]=FLOAT_CONV(sin((M_PI/(2*n))*(2*i+1))); - } - for(i=0;i<n/8;i++){ - T[n+i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i+2))*.5); - T[n+i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i+2))*.5); - } - - /* bitreverse lookup... */ - - { - int mask=(1<<(log2n-1))-1,i,j; - int msb=1<<(log2n-2); - for(i=0;i<n/8;i++){ - int acc=0; - for(j=0;msb>>j;j++) - if((msb>>j)&i)acc|=1<<j; - bitrev[i*2]=((~acc)&mask)-1; - bitrev[i*2+1]=acc; - - } - } - lookup->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++) - mdct_butterfly_generic(T,x+(points>>i)*j,points>>i,4<<i); - } - - for(j=0;j<points;j+=32) - mdct_butterfly_32(x+j); - -} - -void mdct_clear(mdct_lookup *l){ - if(l){ - if(l->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(w0<w1); -} - -void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){ - int n=init->n; - 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(iX<oX1); - - iX=out+n2+n4; - oX1=out+n4; - oX2=oX1; - - do{ - oX1-=4; - iX-=4; - - oX2[0] = -(oX1[3] = iX[3]); - oX2[1] = -(oX1[2] = iX[2]); - oX2[2] = -(oX1[1] = iX[1]); - oX2[3] = -(oX1[0] = iX[0]); - - oX2+=4; - }while(oX2<iX); - - iX=out+n2+n4; - oX1=out+n2+n4; - oX2=out+n2; - do{ - oX1-=4; - oX1[0]= iX[3]; - oX1[1]= iX[2]; - oX1[2]= iX[1]; - oX1[3]= iX[0]; - iX+=4; - }while(oX1>oX2); - } -} - -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;i<n8;i+=2){ - x0 -=4; - T-=2; - r0= x0[2] + x1[0]; - r1= x0[0] + x1[2]; - w2[i]= MULT_NORM(r1*T[1] + r0*T[0]); - w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]); - x1 +=4; - } - - x1=in+1; - - for(;i<n2-n8;i+=2){ - T-=2; - x0 -=4; - r0= x0[2] - x1[0]; - r1= x0[0] - x1[2]; - w2[i]= MULT_NORM(r1*T[1] + r0*T[0]); - w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]); - x1 +=4; - } - - x0=in+n; - - for(;i<n2;i+=2){ - T-=2; - x0 -=4; - r0= -x0[2] - x1[0]; - r1= -x0[0] - x1[2]; - w2[i]= MULT_NORM(r1*T[1] + r0*T[0]); - w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]); - x1 +=4; - } - - - mdct_butterflies(init,w+n2,n2); - mdct_bitreverse(init,w); - - /* roatate + window */ - - T=init->trig+n2; - x0=out+n2; - - for(i=0;i<n4;i++){ - x0--; - out[i] =MULT_NORM((w[0]*T[0]+w[1]*T[1])*init->scale); - x0[0] =MULT_NORM((w[0]*T[1]-w[1]*T[0])*init->scale); - w+=2; - T+=2; - } -} diff --git a/src/lib/dl/ext/vorbis/mdct.h b/src/lib/dl/ext/vorbis/mdct.h deleted file mode 100755 index 3ed94333..00000000 --- a/src/lib/dl/ext/vorbis/mdct.h +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: modified discrete cosine transform prototypes - last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#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)+.5)) -#define MULT_NORM(x) ((x)>>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/src/lib/dl/ext/vorbis/misc.h b/src/lib/dl/ext/vorbis/misc.h deleted file mode 100755 index 85fe3074..00000000 --- a/src/lib/dl/ext/vorbis/misc.h +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: miscellaneous prototypes - last mod: $Id: misc.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_RANDOM_H_ -#define _V_RANDOM_H_ -#include "vorbis/codec.h" - -extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); -extern void _vorbis_block_ripcord(vorbis_block *vb); - -#ifdef ANALYSIS -extern int analysis_noisy; -extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB, - ogg_int64_t off); -extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB, - ogg_int64_t off); -#endif - -#ifdef DEBUG_MALLOC - -#define _VDBG_GRAPHFILE "malloc.m" -#undef _VDBG_GRAPHFILE -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/src/lib/dl/ext/vorbis/modes/floor_all.h b/src/lib/dl/ext/vorbis/modes/floor_all.h deleted file mode 100755 index 4292be32..00000000 --- a/src/lib/dl/ext/vorbis/modes/floor_all.h +++ /dev/null @@ -1,260 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: key floor settings - last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $ - - ********************************************************************/ - -#include "vorbis/codec.h" -#include "backends.h" -#include "books/floor/floor_books.h" - -static const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _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 const static_codebook*const _floor_Xx0_books[]={ - 0 -}; - -static const static_codebook*const *const _floor_books[11]={ - _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, - _floor_Xx0_books, -}; - -static const vorbis_info_floor1 _floor[11]={ - /* 0: 128 x 4 */ - { - 1,{0},{4},{2},{0}, - {{1,2,3,4}}, - 4,{0,128, 33,8,16,70}, - - 60,30,500, 1.,18., 128 - }, - /* 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., 256 - }, - /* 2: 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., 128 - }, - /* 3: 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., 256 - }, - /* 4: 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., 128 - }, - /* 5: 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., 128 - }, - /* 6: 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., 256 - }, - /* 7: 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., 1024 - }, - /* 8: 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., 2048 - }, - /* 9: 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., 512 - }, - - /* 10: X x 0 (LFE floor; edge posts only) */ - { - 0,{0}, {0},{0},{-1}, - {{-1}}, - 2,{0,12}, - 60,30,500, 1.,18., 10 - }, - -}; diff --git a/src/lib/dl/ext/vorbis/modes/psych_11.h b/src/lib/dl/ext/vorbis/modes/psych_11.h deleted file mode 100755 index 844a8ed3..00000000 --- a/src/lib/dl/ext/vorbis/modes/psych_11.h +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: 11kHz settings - last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -static const double _psy_lowpass_11[3]={4.5,5.5,30.,}; - -static const 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 const 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 const 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 const double _noise_thresh_11[3]={ .3,.5,.5 }; - diff --git a/src/lib/dl/ext/vorbis/modes/psych_16.h b/src/lib/dl/ext/vorbis/modes/psych_16.h deleted file mode 100755 index 1c10b395..00000000 --- a/src/lib/dl/ext/vorbis/modes/psych_16.h +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: 16kHz settings - last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -/* stereo mode by base quality level */ -static const 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 const double _psy_lowpass_16[4]={6.5,8,30.,99.}; - -static const 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 const 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 const 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 const 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 const 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 const noiseguard _psy_noiseguards_16[4]={ - {10,10,-1}, - {10,10,-1}, - {20,20,-1}, - {20,20,-1}, -}; - -static const double _noise_thresh_16[4]={ .3,.5,.5,.5 }; - -static const int _noise_start_16[3]={ 256,256,9999 }; -static const int _noise_part_16[4]={ 8,8,8,8 }; - -static const int _psy_ath_floater_16[4]={ - -100,-100,-100,-105, -}; - -static const int _psy_ath_abs_16[4]={ - -130,-130,-130,-140, -}; diff --git a/src/lib/dl/ext/vorbis/modes/psych_44.h b/src/lib/dl/ext/vorbis/modes/psych_44.h deleted file mode 100755 index f05c0326..00000000 --- a/src/lib/dl/ext/vorbis/modes/psych_44.h +++ /dev/null @@ -1,642 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: key psychoacoustic settings for 44.1/48kHz - last mod: $Id: psych_44.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - - -/* preecho trigger settings *****************************************/ - -static const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const noiseguard _psy_noiseguards_44[4]={ - {3,3,15}, - {3,3,15}, - {10,10,100}, - {10,10,100}, -}; - -static const int _psy_tone_suppress[12]={ - -20,-20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45, -}; -static const int _psy_tone_0dB[12]={ - 90,90,95,95,95,95,105,105,105,105,105,105, -}; -static const int _psy_noise_suppress[12]={ - -20,-20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45, -}; - -static const 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 - noise_p, start, partition, thresh. */ - 0,-1,-1,0., -}; - -/* ath ****************/ - -static const int _psy_ath_floater[12]={ - -100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120, -}; -static const 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 const 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, 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, 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, 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, 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, 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, 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 const 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 const 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 const 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 const 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 const int _noise_part_short_44[11]={ - 8,8,8,8,8,8,8,8,8,8,8 -}; -static const int _noise_part_long_44[11]={ - 32,32,32,32,32,32,32,32,32,32,32 -}; - -static const 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 const double _noise_thresh_5only[2]={ - .5,.5, -}; diff --git a/src/lib/dl/ext/vorbis/modes/psych_8.h b/src/lib/dl/ext/vorbis/modes/psych_8.h deleted file mode 100755 index 0e2dd573..00000000 --- a/src/lib/dl/ext/vorbis/modes/psych_8.h +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: 8kHz psychoacoustic settings - last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -static const 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 const 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 const 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 const 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 const noiseguard _psy_noiseguards_8[2]={ - {10,10,-1}, - {10,10,-1}, -}; - -static const 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 const double _psy_lowpass_8[3]={3.,4.,4.}; -static const int _noise_start_8[2]={ - 64,64, -}; -static const int _noise_part_8[2]={ - 8,8, -}; - -static const int _psy_ath_floater_8[3]={ - -100,-100,-105, -}; - -static const int _psy_ath_abs_8[3]={ - -130,-130,-140, -}; diff --git a/src/lib/dl/ext/vorbis/modes/residue_16.h b/src/lib/dl/ext/vorbis/modes/residue_16.h deleted file mode 100755 index dcaca545..00000000 --- a/src/lib/dl/ext/vorbis/modes/residue_16.h +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel residue templates 16/22kHz - last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - -/***** residue backends *********************************************/ - -static const static_bookblock _resbook_16s_0={ - { - {0}, - {0,0,&_16c0_s_p1_0}, - {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 const static_bookblock _resbook_16s_1={ - { - {0}, - {0,0,&_16c1_s_p1_0}, - {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 const 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 const vorbis_residue_template _res_16s_0[]={ - {2,0,32, &_residue_44_mid, - &_huff_book__16c0_s_single,&_huff_book__16c0_s_single, - &_resbook_16s_0,&_resbook_16s_0}, -}; -static const vorbis_residue_template _res_16s_1[]={ - {2,0,32, &_residue_44_mid, - &_huff_book__16c1_s_short,&_huff_book__16c1_s_short, - &_resbook_16s_1,&_resbook_16s_1}, - - {2,0,32, &_residue_44_mid, - &_huff_book__16c1_s_long,&_huff_book__16c1_s_long, - &_resbook_16s_1,&_resbook_16s_1} -}; -static const vorbis_residue_template _res_16s_2[]={ - {2,0,32, &_residue_44_high, - &_huff_book__16c2_s_short,&_huff_book__16c2_s_short, - &_resbook_16s_2,&_resbook_16s_2}, - - {2,0,32, &_residue_44_high, - &_huff_book__16c2_s_long,&_huff_book__16c2_s_long, - &_resbook_16s_2,&_resbook_16s_2} -}; - -static const 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 const 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 const 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 const 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 const vorbis_residue_template _res_16u_0[]={ - {1,0,32, &_residue_44_low_un, - &_huff_book__16u0__single,&_huff_book__16u0__single, - &_resbook_16u_0,&_resbook_16u_0}, -}; -static const vorbis_residue_template _res_16u_1[]={ - {1,0,32, &_residue_44_mid_un, - &_huff_book__16u1__short,&_huff_book__16u1__short, - &_resbook_16u_1,&_resbook_16u_1}, - - {1,0,32, &_residue_44_mid_un, - &_huff_book__16u1__long,&_huff_book__16u1__long, - &_resbook_16u_1,&_resbook_16u_1} -}; -static const vorbis_residue_template _res_16u_2[]={ - {1,0,32, &_residue_44_hi_un, - &_huff_book__16u2__short,&_huff_book__16u2__short, - &_resbook_16u_2,&_resbook_16u_2}, - - {1,0,32, &_residue_44_hi_un, - &_huff_book__16u2__long,&_huff_book__16u2__long, - &_resbook_16u_2,&_resbook_16u_2} -}; - - -static const 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/src/lib/dl/ext/vorbis/modes/residue_44.h b/src/lib/dl/ext/vorbis/modes/residue_44.h deleted file mode 100755 index 236c1834..00000000 --- a/src/lib/dl/ext/vorbis/modes/residue_44.h +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel residue templates for 32/44.1/48kHz - last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - -#include "vorbis/codec.h" -#include "backends.h" -#include "books/coupled/res_books_stereo.h" - -/***** residue backends *********************************************/ - -static const vorbis_info_residue0 _residue_44_low={ - 0,-1, -1, 9,-1,-1, - /* 0 1 2 3 4 5 6 7 */ - {0}, - {-1}, - { 0, 1, 2, 2, 4, 8, 16, 32}, - { 0, 0, 0,999, 4, 8, 16, 32}, -}; - -static const vorbis_info_residue0 _residue_44_mid={ - 0,-1, -1, 10,-1,-1, - /* 0 1 2 3 4 5 6 7 8 */ - {0}, - {-1}, - { 0, 1, 1, 2, 2, 4, 8, 16, 32}, - { 0, 0,999, 0,999, 4, 8, 16, 32}, -}; - -static const vorbis_info_residue0 _residue_44_high={ - 0,-1, -1, 10,-1,-1, - /* 0 1 2 3 4 5 6 7 8 */ - {0}, - {-1}, - { 0, 1, 2, 4, 8, 16, 32, 71,157}, - { 0, 1, 2, 3, 4, 8, 16, 71,157}, -}; - -static const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const vorbis_residue_template _res_44s_n1[]={ - {2,0,32, &_residue_44_low, - &_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short, - &_resbook_44s_n1,&_resbook_44sm_n1}, - - {2,0,32, &_residue_44_low, - &_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long, - &_resbook_44s_n1,&_resbook_44sm_n1} -}; -static const vorbis_residue_template _res_44s_0[]={ - {2,0,16, &_residue_44_low, - &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short, - &_resbook_44s_0,&_resbook_44sm_0}, - - {2,0,32, &_residue_44_low, - &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long, - &_resbook_44s_0,&_resbook_44sm_0} -}; -static const vorbis_residue_template _res_44s_1[]={ - {2,0,16, &_residue_44_low, - &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short, - &_resbook_44s_1,&_resbook_44sm_1}, - - {2,0,32, &_residue_44_low, - &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long, - &_resbook_44s_1,&_resbook_44sm_1} -}; - -static const vorbis_residue_template _res_44s_2[]={ - {2,0,16, &_residue_44_mid, - &_huff_book__44c2_s_short,&_huff_book__44c2_s_short, - &_resbook_44s_2,&_resbook_44s_2}, - - {2,0,32, &_residue_44_mid, - &_huff_book__44c2_s_long,&_huff_book__44c2_s_long, - &_resbook_44s_2,&_resbook_44s_2} -}; -static const vorbis_residue_template _res_44s_3[]={ - {2,0,16, &_residue_44_mid, - &_huff_book__44c3_s_short,&_huff_book__44c3_s_short, - &_resbook_44s_3,&_resbook_44s_3}, - - {2,0,32, &_residue_44_mid, - &_huff_book__44c3_s_long,&_huff_book__44c3_s_long, - &_resbook_44s_3,&_resbook_44s_3} -}; -static const vorbis_residue_template _res_44s_4[]={ - {2,0,16, &_residue_44_mid, - &_huff_book__44c4_s_short,&_huff_book__44c4_s_short, - &_resbook_44s_4,&_resbook_44s_4}, - - {2,0,32, &_residue_44_mid, - &_huff_book__44c4_s_long,&_huff_book__44c4_s_long, - &_resbook_44s_4,&_resbook_44s_4} -}; -static const vorbis_residue_template _res_44s_5[]={ - {2,0,16, &_residue_44_mid, - &_huff_book__44c5_s_short,&_huff_book__44c5_s_short, - &_resbook_44s_5,&_resbook_44s_5}, - - {2,0,32, &_residue_44_mid, - &_huff_book__44c5_s_long,&_huff_book__44c5_s_long, - &_resbook_44s_5,&_resbook_44s_5} -}; -static const vorbis_residue_template _res_44s_6[]={ - {2,0,16, &_residue_44_high, - &_huff_book__44c6_s_short,&_huff_book__44c6_s_short, - &_resbook_44s_6,&_resbook_44s_6}, - - {2,0,32, &_residue_44_high, - &_huff_book__44c6_s_long,&_huff_book__44c6_s_long, - &_resbook_44s_6,&_resbook_44s_6} -}; -static const vorbis_residue_template _res_44s_7[]={ - {2,0,16, &_residue_44_high, - &_huff_book__44c7_s_short,&_huff_book__44c7_s_short, - &_resbook_44s_7,&_resbook_44s_7}, - - {2,0,32, &_residue_44_high, - &_huff_book__44c7_s_long,&_huff_book__44c7_s_long, - &_resbook_44s_7,&_resbook_44s_7} -}; -static const vorbis_residue_template _res_44s_8[]={ - {2,0,16, &_residue_44_high, - &_huff_book__44c8_s_short,&_huff_book__44c8_s_short, - &_resbook_44s_8,&_resbook_44s_8}, - - {2,0,32, &_residue_44_high, - &_huff_book__44c8_s_long,&_huff_book__44c8_s_long, - &_resbook_44s_8,&_resbook_44s_8} -}; -static const vorbis_residue_template _res_44s_9[]={ - {2,0,16, &_residue_44_high, - &_huff_book__44c9_s_short,&_huff_book__44c9_s_short, - &_resbook_44s_9,&_resbook_44s_9}, - - {2,0,32, &_residue_44_high, - &_huff_book__44c9_s_long,&_huff_book__44c9_s_long, - &_resbook_44s_9,&_resbook_44s_9} -}; - -static const 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/src/lib/dl/ext/vorbis/modes/residue_44p51.h b/src/lib/dl/ext/vorbis/modes/residue_44p51.h deleted file mode 100755 index 103e960d..00000000 --- a/src/lib/dl/ext/vorbis/modes/residue_44p51.h +++ /dev/null @@ -1,451 +0,0 @@ -/******************************************************************** - * * - * 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-2010 * - * by the Xiph.Org Foundation 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/coupled/res_books_51.h" - -/***** residue backends *********************************************/ - -static const vorbis_info_residue0 _residue_44p_lo={ - 0,-1, -1, 7,-1,-1, - /* 0 1 2 3 4 5 6 7 8 */ - {0}, - {-1}, - { 0, 1, 2, 7, 17, 31}, - { 0, 0, 99, 7, 17, 31}, -}; - -static const vorbis_info_residue0 _residue_44p={ - 0,-1, -1, 8,-1,-1, - /* 0 1 2 3 4 5 6 7 8 */ - {0}, - {-1}, - { 0, 1, 1, 2, 7, 17, 31}, - { 0, 0, 99, 99, 7, 17, 31}, -}; - -static const vorbis_info_residue0 _residue_44p_hi={ - 0,-1, -1, 8,-1,-1, - /* 0 1 2 3 4 5 6 7 8 */ - {0}, - {-1}, - { 0, 1, 2, 4, 7, 17, 31}, - { 0, 1, 2, 4, 7, 17, 31}, -}; - -static const vorbis_info_residue0 _residue_44p_lfe={ - 0,-1, -1, 2,-1,-1, - /* 0 1 2 3 4 5 6 7 8 */ - {0}, - {-1}, - { 32}, - { -1} -}; - -static const static_bookblock _resbook_44p_n1={ - { - {0}, - {0,&_44pn1_p1_0}, - - {&_44pn1_p2_0,&_44pn1_p2_1,0}, - {&_44pn1_p3_0,&_44pn1_p3_1,0}, - {&_44pn1_p4_0,&_44pn1_p4_1,0}, - - {&_44pn1_p5_0,&_44pn1_p5_1,&_44pn1_p4_1}, - {&_44pn1_p6_0,&_44pn1_p6_1,&_44pn1_p6_2}, - } -}; - -static const static_bookblock _resbook_44p_0={ - { - {0}, - {0,&_44p0_p1_0}, - - {&_44p0_p2_0,&_44p0_p2_1,0}, - {&_44p0_p3_0,&_44p0_p3_1,0}, - {&_44p0_p4_0,&_44p0_p4_1,0}, - - {&_44p0_p5_0,&_44p0_p5_1,&_44p0_p4_1}, - {&_44p0_p6_0,&_44p0_p6_1,&_44p0_p6_2}, - } -}; - -static const static_bookblock _resbook_44p_1={ - { - {0}, - {0,&_44p1_p1_0}, - - {&_44p1_p2_0,&_44p1_p2_1,0}, - {&_44p1_p3_0,&_44p1_p3_1,0}, - {&_44p1_p4_0,&_44p1_p4_1,0}, - - {&_44p1_p5_0,&_44p1_p5_1,&_44p1_p4_1}, - {&_44p1_p6_0,&_44p1_p6_1,&_44p1_p6_2}, - } -}; - -static const static_bookblock _resbook_44p_2={ - { - {0}, - {0,0,&_44p2_p1_0}, - {0,&_44p2_p2_0,0}, - - {&_44p2_p3_0,&_44p2_p3_1,0}, - {&_44p2_p4_0,&_44p2_p4_1,0}, - {&_44p2_p5_0,&_44p2_p5_1,0}, - - {&_44p2_p6_0,&_44p2_p6_1,&_44p2_p5_1}, - {&_44p2_p7_0,&_44p2_p7_1,&_44p2_p7_2,&_44p2_p7_3} - } -}; -static const static_bookblock _resbook_44p_3={ - { - {0}, - {0,0,&_44p3_p1_0}, - {0,&_44p3_p2_0,0}, - - {&_44p3_p3_0,&_44p3_p3_1,0}, - {&_44p3_p4_0,&_44p3_p4_1,0}, - {&_44p3_p5_0,&_44p3_p5_1,0}, - - {&_44p3_p6_0,&_44p3_p6_1,&_44p3_p5_1}, - {&_44p3_p7_0,&_44p3_p7_1,&_44p3_p7_2,&_44p3_p7_3} - } -}; -static const static_bookblock _resbook_44p_4={ - { - {0}, - {0,0,&_44p4_p1_0}, - {0,&_44p4_p2_0,0}, - - {&_44p4_p3_0,&_44p4_p3_1,0}, - {&_44p4_p4_0,&_44p4_p4_1,0}, - {&_44p4_p5_0,&_44p4_p5_1,0}, - - {&_44p4_p6_0,&_44p4_p6_1,&_44p4_p5_1}, - {&_44p4_p7_0,&_44p4_p7_1,&_44p4_p7_2,&_44p4_p7_3} - } -}; -static const static_bookblock _resbook_44p_5={ - { - {0}, - {0,0,&_44p5_p1_0}, - {0,&_44p5_p2_0,0}, - - {&_44p5_p3_0,&_44p5_p3_1,0}, - {&_44p5_p4_0,&_44p5_p4_1,0}, - {&_44p5_p5_0,&_44p5_p5_1,0}, - - {&_44p5_p6_0,&_44p5_p6_1,&_44p5_p5_1}, - {&_44p5_p7_0,&_44p5_p7_1,&_44p5_p7_2,&_44p5_p7_3} - } -}; -static const static_bookblock _resbook_44p_6={ - { - {0}, - {0,0,&_44p6_p1_0}, - {0,&_44p6_p2_0,0}, - - {&_44p6_p3_0,&_44p6_p3_1,0}, - {&_44p6_p4_0,&_44p6_p4_1,0}, - {&_44p6_p5_0,&_44p6_p5_1,0}, - - {&_44p6_p6_0,&_44p6_p6_1,&_44p6_p5_1}, - {&_44p6_p7_0,&_44p6_p7_1,&_44p6_p7_2,&_44p6_p7_3} - } -}; -static const static_bookblock _resbook_44p_7={ - { - {0}, - {0,0,&_44p7_p1_0}, - {0,&_44p7_p2_0,0}, - - {&_44p7_p3_0,&_44p7_p3_1,0}, - {&_44p7_p4_0,&_44p7_p4_1,0}, - {&_44p7_p5_0,&_44p7_p5_1,0}, - - {&_44p7_p6_0,&_44p7_p6_1,&_44p7_p5_1}, - {&_44p7_p7_0,&_44p7_p7_1,&_44p7_p7_2,&_44p7_p7_3} - } -}; -static const static_bookblock _resbook_44p_8={ - { - {0}, - {0,0,&_44p8_p1_0}, - {0,&_44p8_p2_0,0}, - - {&_44p8_p3_0,&_44p8_p3_1,0}, - {&_44p8_p4_0,&_44p8_p4_1,0}, - {&_44p8_p5_0,&_44p8_p5_1,0}, - - {&_44p8_p6_0,&_44p8_p6_1,&_44p8_p5_1}, - {&_44p8_p7_0,&_44p8_p7_1,&_44p8_p7_2,&_44p8_p7_3} - } -}; -static const static_bookblock _resbook_44p_9={ - { - {0}, - {0,0,&_44p9_p1_0}, - {0,&_44p9_p2_0,0}, - - {&_44p9_p3_0,&_44p9_p3_1,0}, - {&_44p9_p4_0,&_44p9_p4_1,0}, - {&_44p9_p5_0,&_44p9_p5_1,0}, - - {&_44p9_p6_0,&_44p9_p6_1,&_44p9_p5_1}, - {&_44p9_p7_0,&_44p9_p7_1,&_44p9_p7_2,&_44p9_p7_3} - } -}; - -static const static_bookblock _resbook_44p_ln1={ - { - {&_44pn1_l0_0,&_44pn1_l0_1,0}, - {&_44pn1_l1_0,&_44pn1_p6_1,&_44pn1_p6_2}, - } -}; -static const static_bookblock _resbook_44p_l0={ - { - {&_44p0_l0_0,&_44p0_l0_1,0}, - {&_44p0_l1_0,&_44p0_p6_1,&_44p0_p6_2}, - } -}; -static const static_bookblock _resbook_44p_l1={ - { - {&_44p1_l0_0,&_44p1_l0_1,0}, - {&_44p1_l1_0,&_44p1_p6_1,&_44p1_p6_2}, - } -}; -static const static_bookblock _resbook_44p_l2={ - { - {&_44p2_l0_0,&_44p2_l0_1,0}, - {&_44p2_l1_0,&_44p2_p7_2,&_44p2_p7_3}, - } -}; -static const static_bookblock _resbook_44p_l3={ - { - {&_44p3_l0_0,&_44p3_l0_1,0}, - {&_44p3_l1_0,&_44p3_p7_2,&_44p3_p7_3}, - } -}; -static const static_bookblock _resbook_44p_l4={ - { - {&_44p4_l0_0,&_44p4_l0_1,0}, - {&_44p4_l1_0,&_44p4_p7_2,&_44p4_p7_3}, - } -}; -static const static_bookblock _resbook_44p_l5={ - { - {&_44p5_l0_0,&_44p5_l0_1,0}, - {&_44p5_l1_0,&_44p5_p7_2,&_44p5_p7_3}, - } -}; -static const static_bookblock _resbook_44p_l6={ - { - {&_44p6_l0_0,&_44p6_l0_1,0}, - {&_44p6_l1_0,&_44p6_p7_2,&_44p6_p7_3}, - } -}; -static const static_bookblock _resbook_44p_l7={ - { - {&_44p7_l0_0,&_44p7_l0_1,0}, - {&_44p7_l1_0,&_44p7_p7_2,&_44p7_p7_3}, - } -}; -static const static_bookblock _resbook_44p_l8={ - { - {&_44p8_l0_0,&_44p8_l0_1,0}, - {&_44p8_l1_0,&_44p8_p7_2,&_44p8_p7_3}, - } -}; -static const static_bookblock _resbook_44p_l9={ - { - {&_44p9_l0_0,&_44p9_l0_1,0}, - {&_44p9_l1_0,&_44p9_p7_2,&_44p9_p7_3}, - } -}; - - -static const vorbis_info_mapping0 _map_nominal_51[2]={ - {2, {0,0,0,0,0,1}, {0,2}, {0,2}, 4,{0,3,0,0},{2,4,1,3}}, - {2, {0,0,0,0,0,1}, {1,2}, {1,2}, 4,{0,3,0,0},{2,4,1,3}} -}; -static const vorbis_info_mapping0 _map_nominal_51u[2]={ - {2, {0,0,0,0,0,1}, {0,2}, {0,2}, 0,{0},{0}}, - {2, {0,0,0,0,0,1}, {1,2}, {1,2}, 0,{0},{0}} -}; - -static const vorbis_residue_template _res_44p51_n1[]={ - {2,0,30, &_residue_44p_lo, - &_huff_book__44pn1_short,&_huff_book__44pn1_short, - &_resbook_44p_n1,&_resbook_44p_n1}, - - {2,0,30, &_residue_44p_lo, - &_huff_book__44pn1_long,&_huff_book__44pn1_long, - &_resbook_44p_n1,&_resbook_44p_n1}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44pn1_lfe,&_huff_book__44pn1_lfe, - &_resbook_44p_ln1,&_resbook_44p_ln1} -}; -static const vorbis_residue_template _res_44p51_0[]={ - {2,0,15, &_residue_44p_lo, - &_huff_book__44p0_short,&_huff_book__44p0_short, - &_resbook_44p_0,&_resbook_44p_0}, - - {2,0,30, &_residue_44p_lo, - &_huff_book__44p0_long,&_huff_book__44p0_long, - &_resbook_44p_0,&_resbook_44p_0}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p0_lfe,&_huff_book__44p0_lfe, - &_resbook_44p_l0,&_resbook_44p_l0} -}; -static const vorbis_residue_template _res_44p51_1[]={ - {2,0,15, &_residue_44p_lo, - &_huff_book__44p1_short,&_huff_book__44p1_short, - &_resbook_44p_1,&_resbook_44p_1}, - - {2,0,30, &_residue_44p_lo, - &_huff_book__44p1_long,&_huff_book__44p1_long, - &_resbook_44p_1,&_resbook_44p_1}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p1_lfe,&_huff_book__44p1_lfe, - &_resbook_44p_l1,&_resbook_44p_l1} -}; -static const vorbis_residue_template _res_44p51_2[]={ - {2,0,15, &_residue_44p, - &_huff_book__44p2_short,&_huff_book__44p2_short, - &_resbook_44p_2,&_resbook_44p_2}, - - {2,0,30, &_residue_44p, - &_huff_book__44p2_long,&_huff_book__44p2_long, - &_resbook_44p_2,&_resbook_44p_2}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p2_lfe,&_huff_book__44p2_lfe, - &_resbook_44p_l2,&_resbook_44p_l2} -}; -static const vorbis_residue_template _res_44p51_3[]={ - {2,0,15, &_residue_44p, - &_huff_book__44p3_short,&_huff_book__44p3_short, - &_resbook_44p_3,&_resbook_44p_3}, - - {2,0,30, &_residue_44p, - &_huff_book__44p3_long,&_huff_book__44p3_long, - &_resbook_44p_3,&_resbook_44p_3}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p3_lfe,&_huff_book__44p3_lfe, - &_resbook_44p_l3,&_resbook_44p_l3} -}; -static const vorbis_residue_template _res_44p51_4[]={ - {2,0,15, &_residue_44p, - &_huff_book__44p4_short,&_huff_book__44p4_short, - &_resbook_44p_4,&_resbook_44p_4}, - - {2,0,30, &_residue_44p, - &_huff_book__44p4_long,&_huff_book__44p4_long, - &_resbook_44p_4,&_resbook_44p_4}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p4_lfe,&_huff_book__44p4_lfe, - &_resbook_44p_l4,&_resbook_44p_l4} -}; -static const vorbis_residue_template _res_44p51_5[]={ - {2,0,15, &_residue_44p_hi, - &_huff_book__44p5_short,&_huff_book__44p5_short, - &_resbook_44p_5,&_resbook_44p_5}, - - {2,0,30, &_residue_44p_hi, - &_huff_book__44p5_long,&_huff_book__44p5_long, - &_resbook_44p_5,&_resbook_44p_5}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p5_lfe,&_huff_book__44p5_lfe, - &_resbook_44p_l5,&_resbook_44p_l5} -}; -static const vorbis_residue_template _res_44p51_6[]={ - {2,0,15, &_residue_44p_hi, - &_huff_book__44p6_short,&_huff_book__44p6_short, - &_resbook_44p_6,&_resbook_44p_6}, - - {2,0,30, &_residue_44p_hi, - &_huff_book__44p6_long,&_huff_book__44p6_long, - &_resbook_44p_6,&_resbook_44p_6}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p6_lfe,&_huff_book__44p6_lfe, - &_resbook_44p_l6,&_resbook_44p_l6} -}; - - -static const vorbis_residue_template _res_44p51_7[]={ - {2,0,15, &_residue_44p_hi, - &_huff_book__44p7_short,&_huff_book__44p7_short, - &_resbook_44p_7,&_resbook_44p_7}, - - {2,0,30, &_residue_44p_hi, - &_huff_book__44p7_long,&_huff_book__44p7_long, - &_resbook_44p_7,&_resbook_44p_7}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p6_lfe,&_huff_book__44p6_lfe, - &_resbook_44p_l6,&_resbook_44p_l6} -}; -static const vorbis_residue_template _res_44p51_8[]={ - {2,0,15, &_residue_44p_hi, - &_huff_book__44p8_short,&_huff_book__44p8_short, - &_resbook_44p_8,&_resbook_44p_8}, - - {2,0,30, &_residue_44p_hi, - &_huff_book__44p8_long,&_huff_book__44p8_long, - &_resbook_44p_8,&_resbook_44p_8}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p6_lfe,&_huff_book__44p6_lfe, - &_resbook_44p_l6,&_resbook_44p_l6} -}; -static const vorbis_residue_template _res_44p51_9[]={ - {2,0,15, &_residue_44p_hi, - &_huff_book__44p9_short,&_huff_book__44p9_short, - &_resbook_44p_9,&_resbook_44p_9}, - - {2,0,30, &_residue_44p_hi, - &_huff_book__44p9_long,&_huff_book__44p9_long, - &_resbook_44p_9,&_resbook_44p_9}, - - {1,2,6, &_residue_44p_lfe, - &_huff_book__44p6_lfe,&_huff_book__44p6_lfe, - &_resbook_44p_l6,&_resbook_44p_l6} -}; - -static const vorbis_mapping_template _mapres_template_44_51[]={ - { _map_nominal_51, _res_44p51_n1 }, /* -1 */ - { _map_nominal_51, _res_44p51_0 }, /* 0 */ - { _map_nominal_51, _res_44p51_1 }, /* 1 */ - { _map_nominal_51, _res_44p51_2 }, /* 2 */ - { _map_nominal_51, _res_44p51_3 }, /* 3 */ - { _map_nominal_51, _res_44p51_4 }, /* 4 */ - { _map_nominal_51u, _res_44p51_5 }, /* 5 */ - { _map_nominal_51u, _res_44p51_6 }, /* 6 */ - { _map_nominal_51u, _res_44p51_7 }, /* 7 */ - { _map_nominal_51u, _res_44p51_8 }, /* 8 */ - { _map_nominal_51u, _res_44p51_9 }, /* 9 */ -}; diff --git a/src/lib/dl/ext/vorbis/modes/residue_44u.h b/src/lib/dl/ext/vorbis/modes/residue_44u.h deleted file mode 100755 index 92c4a09c..00000000 --- a/src/lib/dl/ext/vorbis/modes/residue_44u.h +++ /dev/null @@ -1,318 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel residue templates for 32/44.1/48kHz uncoupled - last mod: $Id: residue_44u.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - -#include "vorbis/codec.h" -#include "backends.h" -#include "books/uncoupled/res_books_uncoupled.h" - -/***** residue backends *********************************************/ - - -static const vorbis_info_residue0 _residue_44_low_un={ - 0,-1, -1, 8,-1,-1, - {0}, - {-1}, - { 0, 1, 1, 2, 2, 4, 28}, - { -1, 25, -1, 45, -1, -1, -1} -}; - -static const vorbis_info_residue0 _residue_44_mid_un={ - 0,-1, -1, 10,-1,-1, - /* 0 1 2 3 4 5 6 7 8 9 */ - {0}, - {-1}, - { 0, 1, 1, 2, 2, 4, 4, 16, 60}, - { -1, 30, -1, 50, -1, 80, -1, -1, -1} -}; - -static const vorbis_info_residue0 _residue_44_hi_un={ - 0,-1, -1, 10,-1,-1, - /* 0 1 2 3 4 5 6 7 8 9 */ - {0}, - {-1}, - { 0, 1, 2, 4, 8, 16, 32, 71,157}, - { -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 const vorbis_info_mapping0 _map_nominal_u[2]={ - {1, {0,0,0,0,0,0}, {0}, {0}, 0,{0},{0}}, - {1, {0,0,0,0,0,0}, {1}, {1}, 0,{0},{0}} -}; - -static const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const vorbis_residue_template _res_44u_n1[]={ - {1,0,32, &_residue_44_low_un, - &_huff_book__44un1__short,&_huff_book__44un1__short, - &_resbook_44u_n1,&_resbook_44u_n1}, - - {1,0,32, &_residue_44_low_un, - &_huff_book__44un1__long,&_huff_book__44un1__long, - &_resbook_44u_n1,&_resbook_44u_n1} -}; -static const vorbis_residue_template _res_44u_0[]={ - {1,0,16, &_residue_44_low_un, - &_huff_book__44u0__short,&_huff_book__44u0__short, - &_resbook_44u_0,&_resbook_44u_0}, - - {1,0,32, &_residue_44_low_un, - &_huff_book__44u0__long,&_huff_book__44u0__long, - &_resbook_44u_0,&_resbook_44u_0} -}; -static const vorbis_residue_template _res_44u_1[]={ - {1,0,16, &_residue_44_low_un, - &_huff_book__44u1__short,&_huff_book__44u1__short, - &_resbook_44u_1,&_resbook_44u_1}, - - {1,0,32, &_residue_44_low_un, - &_huff_book__44u1__long,&_huff_book__44u1__long, - &_resbook_44u_1,&_resbook_44u_1} -}; -static const vorbis_residue_template _res_44u_2[]={ - {1,0,16, &_residue_44_low_un, - &_huff_book__44u2__short,&_huff_book__44u2__short, - &_resbook_44u_2,&_resbook_44u_2}, - - {1,0,32, &_residue_44_low_un, - &_huff_book__44u2__long,&_huff_book__44u2__long, - &_resbook_44u_2,&_resbook_44u_2} -}; -static const vorbis_residue_template _res_44u_3[]={ - {1,0,16, &_residue_44_low_un, - &_huff_book__44u3__short,&_huff_book__44u3__short, - &_resbook_44u_3,&_resbook_44u_3}, - - {1,0,32, &_residue_44_low_un, - &_huff_book__44u3__long,&_huff_book__44u3__long, - &_resbook_44u_3,&_resbook_44u_3} -}; -static const vorbis_residue_template _res_44u_4[]={ - {1,0,16, &_residue_44_low_un, - &_huff_book__44u4__short,&_huff_book__44u4__short, - &_resbook_44u_4,&_resbook_44u_4}, - - {1,0,32, &_residue_44_low_un, - &_huff_book__44u4__long,&_huff_book__44u4__long, - &_resbook_44u_4,&_resbook_44u_4} -}; - -static const vorbis_residue_template _res_44u_5[]={ - {1,0,16, &_residue_44_mid_un, - &_huff_book__44u5__short,&_huff_book__44u5__short, - &_resbook_44u_5,&_resbook_44u_5}, - - {1,0,32, &_residue_44_mid_un, - &_huff_book__44u5__long,&_huff_book__44u5__long, - &_resbook_44u_5,&_resbook_44u_5} -}; - -static const vorbis_residue_template _res_44u_6[]={ - {1,0,16, &_residue_44_mid_un, - &_huff_book__44u6__short,&_huff_book__44u6__short, - &_resbook_44u_6,&_resbook_44u_6}, - - {1,0,32, &_residue_44_mid_un, - &_huff_book__44u6__long,&_huff_book__44u6__long, - &_resbook_44u_6,&_resbook_44u_6} -}; - -static const vorbis_residue_template _res_44u_7[]={ - {1,0,16, &_residue_44_mid_un, - &_huff_book__44u7__short,&_huff_book__44u7__short, - &_resbook_44u_7,&_resbook_44u_7}, - - {1,0,32, &_residue_44_mid_un, - &_huff_book__44u7__long,&_huff_book__44u7__long, - &_resbook_44u_7,&_resbook_44u_7} -}; - -static const vorbis_residue_template _res_44u_8[]={ - {1,0,16, &_residue_44_hi_un, - &_huff_book__44u8__short,&_huff_book__44u8__short, - &_resbook_44u_8,&_resbook_44u_8}, - - {1,0,32, &_residue_44_hi_un, - &_huff_book__44u8__long,&_huff_book__44u8__long, - &_resbook_44u_8,&_resbook_44u_8} -}; -static const vorbis_residue_template _res_44u_9[]={ - {1,0,16, &_residue_44_hi_un, - &_huff_book__44u9__short,&_huff_book__44u9__short, - &_resbook_44u_9,&_resbook_44u_9}, - - {1,0,32, &_residue_44_hi_un, - &_huff_book__44u9__long,&_huff_book__44u9__long, - &_resbook_44u_9,&_resbook_44u_9} -}; - -static const 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/src/lib/dl/ext/vorbis/modes/residue_8.h b/src/lib/dl/ext/vorbis/modes/residue_8.h deleted file mode 100755 index 94c6d84c..00000000 --- a/src/lib/dl/ext/vorbis/modes/residue_8.h +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel residue templates 8/11kHz - last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - -#include "vorbis/codec.h" -#include "backends.h" - -/***** residue backends *********************************************/ - -static const static_bookblock _resbook_8s_0={ - { - {0}, - {0,0,&_8c0_s_p1_0}, - {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 const static_bookblock _resbook_8s_1={ - { - {0}, - {0,0,&_8c1_s_p1_0}, - {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 const vorbis_residue_template _res_8s_0[]={ - {2,0,32, &_residue_44_mid, - &_huff_book__8c0_s_single,&_huff_book__8c0_s_single, - &_resbook_8s_0,&_resbook_8s_0}, -}; -static const vorbis_residue_template _res_8s_1[]={ - {2,0,32, &_residue_44_mid, - &_huff_book__8c1_s_single,&_huff_book__8c1_s_single, - &_resbook_8s_1,&_resbook_8s_1}, -}; - -static const vorbis_mapping_template _mapres_template_8_stereo[2]={ - { _map_nominal, _res_8s_0 }, /* 0 */ - { _map_nominal, _res_8s_1 }, /* 1 */ -}; - -static const 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 const 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 const vorbis_residue_template _res_8u_0[]={ - {1,0,32, &_residue_44_low_un, - &_huff_book__8u0__single,&_huff_book__8u0__single, - &_resbook_8u_0,&_resbook_8u_0}, -}; -static const vorbis_residue_template _res_8u_1[]={ - {1,0,32, &_residue_44_mid_un, - &_huff_book__8u1__single,&_huff_book__8u1__single, - &_resbook_8u_1,&_resbook_8u_1}, -}; - -static const 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/src/lib/dl/ext/vorbis/modes/setup_11.h b/src/lib/dl/ext/vorbis/modes/setup_11.h deleted file mode 100755 index 4c2d619c..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_11.h +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: 11kHz settings - last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $ - - ********************************************************************/ - -#include "psych_11.h" - -static const int blocksize_11[2]={ - 512,512 -}; - -static const int _floor_mapping_11a[]={ - 6,6 -}; -static const int *_floor_mapping_11[]={ - _floor_mapping_11a -}; - -static const double rate_mapping_11[3]={ - 8000.,13000.,44000., -}; - -static const double rate_mapping_11_uncoupled[3]={ - 12000.,20000.,50000., -}; - -static const double quality_mapping_11[3]={ - -.1,.0,1. -}; - -static const 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, - 1, - _floor_mapping_11, - - _mapres_template_8_stereo -}; - -static const 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, - 1, - _floor_mapping_11, - - _mapres_template_8_uncoupled -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_16.h b/src/lib/dl/ext/vorbis/modes/setup_16.h deleted file mode 100755 index 336007f9..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_16.h +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: 16kHz settings - last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $ - - ********************************************************************/ - -#include "psych_16.h" -#include "residue_16.h" - -static const int blocksize_16_short[3]={ - 1024,512,512 -}; -static const int blocksize_16_long[3]={ - 1024,1024,1024 -}; - -static const int _floor_mapping_16a[]={ - 9,3,3 -}; -static const int _floor_mapping_16b[]={ - 9,9,9 -}; -static const int *_floor_mapping_16[]={ - _floor_mapping_16a, - _floor_mapping_16b -}; - -static const double rate_mapping_16[4]={ - 12000.,20000.,44000.,86000. -}; - -static const double rate_mapping_16_uncoupled[4]={ - 16000.,28000.,64000.,100000. -}; - -static const double _global_mapping_16[4]={ 1., 2., 3., 4. }; - -static const double quality_mapping_16[4]={ -.1,.05,.5,1. }; - -static const double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.}; - -static const 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_16, - _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, - 2, - _floor_mapping_16, - - _mapres_template_16_stereo -}; - -static const 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_16, - _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, - 2, - _floor_mapping_16, - - _mapres_template_16_uncoupled -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_22.h b/src/lib/dl/ext/vorbis/modes/setup_22.h deleted file mode 100755 index 4fd5e571..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_22.h +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: 22kHz settings - last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $ - - ********************************************************************/ - -static const double rate_mapping_22[4]={ - 15000.,20000.,44000.,86000. -}; - -static const double rate_mapping_22_uncoupled[4]={ - 16000.,28000.,50000.,90000. -}; - -static const double _psy_lowpass_22[4]={9.5,11.,30.,99.}; - -static const 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_16, - _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_22, - - _psy_global_44, - _global_mapping_16, - _psy_stereo_modes_16, - - _floor_books, - _floor, - 2, - _floor_mapping_16, - - _mapres_template_16_stereo -}; - -static const 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_16, - _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_22, - - _psy_global_44, - _global_mapping_16, - _psy_stereo_modes_16, - - _floor_books, - _floor, - 2, - _floor_mapping_16, - - _mapres_template_16_uncoupled -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_32.h b/src/lib/dl/ext/vorbis/modes/setup_32.h deleted file mode 100755 index 2275ac96..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_32.h +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel settings for 32kHz - last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $ - - ********************************************************************/ - -static const double rate_mapping_32[12]={ - 18000.,28000.,35000.,45000.,56000.,60000., - 75000.,90000.,100000.,115000.,150000.,190000., -}; - -static const double rate_mapping_32_un[12]={ - 30000.,42000.,52000.,64000.,72000.,78000., - 86000.,92000.,110000.,120000.,140000.,190000., -}; - -static const double _psy_lowpass_32[12]={ - 12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99. -}; - -static const 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, - 2, - _floor_mapping_44, - - _mapres_template_44_stereo -}; - -static const 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, - 2, - _floor_mapping_44, - - _mapres_template_44_uncoupled -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_44.h b/src/lib/dl/ext/vorbis/modes/setup_44.h deleted file mode 100755 index 3b88a89a..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_44.h +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel settings for 44.1/48kHz - last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - -#include "modes/floor_all.h" -#include "modes/residue_44.h" -#include "modes/psych_44.h" - -static const double rate_mapping_44_stereo[12]={ - 22500.,32000.,40000.,48000.,56000.,64000., - 80000.,96000.,112000.,128000.,160000.,250001. -}; - -static const double quality_mapping_44[12]={ - -.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0 -}; - -static const int blocksize_short_44[11]={ - 512,256,256,256,256,256,256,256,256,256,256 -}; -static const int blocksize_long_44[11]={ - 4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048 -}; - -static const double _psy_compand_short_mapping[12]={ - 0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2. -}; -static const double _psy_compand_long_mapping[12]={ - 3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5. -}; - -static const 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 const int _floor_mapping_44a[11]={ - 1,0,0,2,2,4,5,5,5,5,5 -}; - -static const int _floor_mapping_44b[11]={ - 8,7,7,7,7,7,7,7,7,7,7 -}; - -static const int _floor_mapping_44c[11]={ - 10,10,10,10,10,10,10,10,10,10,10 -}; - -static const int *_floor_mapping_44[]={ - _floor_mapping_44a, - _floor_mapping_44b, - _floor_mapping_44c, -}; - -static const 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, - 2, - _floor_mapping_44, - - _mapres_template_44_stereo -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_44p51.h b/src/lib/dl/ext/vorbis/modes/setup_44p51.h deleted file mode 100755 index e46468a1..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_44p51.h +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************** - * * - * 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-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel settings for 44.1/48kHz 5.1 surround modes - last mod: $Id$ - - ********************************************************************/ - -#include "modes/residue_44p51.h" - -static const double rate_mapping_44p51[12]={ - 14000.,20000.,28000.,38000.,46000.,54000., - 75000.,96000.,120000.,140000.,180000.,240001. -}; - -static const ve_setup_data_template ve_setup_44_51={ - 11, - rate_mapping_44p51, - quality_mapping_44, - 6, - 40000, - 70000, - - 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, - 3, - _floor_mapping_44, - - _mapres_template_44_51 -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_44u.h b/src/lib/dl/ext/vorbis/modes/setup_44u.h deleted file mode 100755 index 568b5f89..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_44u.h +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: toplevel settings for 44.1/48kHz uncoupled modes - last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $ - - ********************************************************************/ - -#include "modes/residue_44u.h" - -static const double rate_mapping_44_un[12]={ - 32000.,48000.,60000.,70000.,80000.,86000., - 96000.,110000.,120000.,140000.,160000.,240001. -}; - -static const 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, - _psy_stereo_modes_44, - - _floor_books, - _floor, - 2, - _floor_mapping_44, - - _mapres_template_44_uncoupled -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_8.h b/src/lib/dl/ext/vorbis/modes/setup_8.h deleted file mode 100755 index 14c48374..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_8.h +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: 8kHz settings - last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $ - - ********************************************************************/ - -#include "psych_8.h" -#include "residue_8.h" - -static const int blocksize_8[2]={ - 512,512 -}; - -static const int _floor_mapping_8a[]={ - 6,6 -}; - -static const int *_floor_mapping_8[]={ - _floor_mapping_8a -}; - -static const double rate_mapping_8[3]={ - 6000.,9000.,32000., -}; - -static const double rate_mapping_8_uncoupled[3]={ - 8000.,14000.,42000., -}; - -static const double quality_mapping_8[3]={ - -.1,.0,1. -}; - -static const double _psy_compand_8_mapping[3]={ 0., 1., 1.}; - -static const double _global_mapping_8[3]={ 1., 2., 3. }; - -static const 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, - 1, - _floor_mapping_8, - - _mapres_template_8_stereo -}; - -static const 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, - 1, - _floor_mapping_8, - - _mapres_template_8_uncoupled -}; diff --git a/src/lib/dl/ext/vorbis/modes/setup_x.h b/src/lib/dl/ext/vorbis/modes/setup_x.h deleted file mode 100755 index a69f5d40..00000000 --- a/src/lib/dl/ext/vorbis/modes/setup_x.h +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: catch-all toplevel settings for q modes only - last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $ - - ********************************************************************/ - -static const double rate_mapping_X[12]={ - -1.,-1.,-1.,-1.,-1.,-1., - -1.,-1.,-1.,-1.,-1.,-1. -}; - -static const 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, - 2, - _floor_mapping_44, - - _mapres_template_44_stereo -}; - -static const 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, - 2, - _floor_mapping_44, - - _mapres_template_44_uncoupled -}; - -static const 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, - 1, - _floor_mapping_8, - - _mapres_template_8_stereo -}; - -static const 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, - 1, - _floor_mapping_8, - - _mapres_template_8_uncoupled -}; diff --git a/src/lib/dl/ext/vorbis/os.h b/src/lib/dl/ext/vorbis/os.h deleted file mode 100755 index 13a92fbe..00000000 --- a/src/lib/dl/ext/vorbis/os.h +++ /dev/null @@ -1,186 +0,0 @@ -#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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include <ext/libogg/os_types.h> - -#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 - -#if defined(DJGPP) || defined(__WATCOMC__) -# define rint(x) (floor((x)+0.5f)) -#endif - -#ifndef M_PI -# define M_PI (3.1415926536f) -#endif - -#if defined(_WIN32) && !defined(__SYMBIAN32__) -# include <malloc.h> -# 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 <alloca.h> -#endif - -#ifdef USE_MEMORY_H -# include <memory.h> -#endif - -#ifndef min -# define min(x,y) ((x)>(y)?(y):(x)) -#endif - -#ifndef max -# define max(x,y) ((x)<(y)?(y):(x)) -#endif - - -/* Special i386 GCC implementation */ -#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" - "andw $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 /* Special i386 GCC implementation */ - - -/* MSVC inline assembly. 32 bit only; inline ASM isn't implemented in the - * 64 bit compiler */ -#if defined(_MSC_VER) && !defined(_WIN64) && !defined(_WIN32_WCE) -# 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 /* Special MSVC 32 bit implementation */ - - -/* Optimized code path for x86_64 builds. Uses SSE2 intrinsics. This can be - done safely because all x86_64 CPUs supports SSE2. */ -#if (defined(_MSC_VER) && defined(_WIN64)) || (defined(__GNUC__) && defined (__x86_64__)) -# define VORBIS_FPU_CONTROL - -typedef ogg_int16_t vorbis_fpu_control; - -#include <emmintrin.h> -static __inline int vorbis_ftoi(double f){ - return _mm_cvtsd_si32(_mm_load_sd(&f)); -} - -static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){ -} - -static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ -} - -#endif /* Special MSVC x64 implementation */ - - -/* If no special implementation was found for the current compiler / platform, - use the default implementation here: */ -#ifndef VORBIS_FPU_CONTROL - -typedef int vorbis_fpu_control; - -static int vorbis_ftoi(double f){ - /* Note: MSVC and GCC (at least on some systems) round towards zero, thus, - the floor() call is required to ensure correct roudning of - negative numbers */ - return (int)floor(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 /* default implementation */ - -#endif /* _OS_H */ diff --git a/src/lib/dl/ext/vorbis/psy.c b/src/lib/dl/ext/vorbis/psy.c deleted file mode 100755 index 3c0f6d09..00000000 --- a/src/lib/dl/ext/vorbis/psy.c +++ /dev/null @@ -1,1203 +0,0 @@ -/******************************************************************** - * * - * 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-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: psychoacoustics not including preecho - last mod: $Id: psy.c 17569 2010-10-26 17:09:47Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <math.h> -#include <string.h> -#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 const double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10}; -static const 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;i<EHMER_MAX;i++)if(c2[i]<c[i])c[i]=c2[i]; -} -static void max_curve(float *c, - float *c2){ - int i; - for(i=0;i<EHMER_MAX;i++)if(c2[i]>c[i])c[i]=c2[i]; -} - -static void attenuate_curve(float *c,float att){ - int i; - for(i=0;i<EHMER_MAX;i++) - c[i]+=att; -} - -static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n, - float center_boost, float center_decay_rate){ - int i,j,k,m; - float ath[EHMER_MAX]; - float workc[P_BANDS][P_LEVELS][EHMER_MAX]; - float athc[P_LEVELS][EHMER_MAX]; - float *brute_buffer=alloca(n*sizeof(*brute_buffer)); - - float ***ret=_ogg_malloc(sizeof(*ret)*P_BANDS); - - memset(workc,0,sizeof(workc)); - - for(i=0;i<P_BANDS;i++){ - /* we add back in the ATH to avoid low level curves falling off to - -infinity and unnecessarily cutting off high level curves in the - curve limiting (last step). */ - - /* A half-band's settings must be valid over the whole band, and - it's better to mask too little than too much */ - int ath_offset=i*4; - for(j=0;j<EHMER_MAX;j++){ - float min=999.; - for(k=0;k<4;k++) - if(j+k+ath_offset<MAX_ATH){ - if(min>ATH[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;j<P_LEVELS;j++){ - for(k=0;k<EHMER_MAX;k++){ - float adj=center_boost+abs(EHMER_OFFSET-k)*center_decay_rate; - if(adj<0. && center_boost>0)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<P_LEVELS;j++){ - attenuate_curve(workc[i][j],curveatt_dB[i]+100.-(j<2?2:j)*10.-P_LEVEL_0); - memcpy(athc[j],ath,EHMER_MAX*sizeof(**athc)); - attenuate_curve(athc[j],+100.-j*10.f-P_LEVEL_0); - max_curve(athc[j],workc[i][j]); - } - - /* Now limit the louder curves. - - the idea is this: We don't know what the playback attenuation - will be; 0dB SL moves every time the user twiddles the volume - knob. So that means we have to use a single 'most pessimal' curve - for all masking amplitudes, right? Wrong. The *loudest* sound - can be in (we assume) a range of ...+100dB] SL. However, sounds - 20dB down will be in a range ...+80], 40dB down is from ...+60], - etc... */ - - for(j=1;j<P_LEVELS;j++){ - min_curve(athc[j],athc[j-1]); - min_curve(workc[i][j],athc[j]); - } - } - - for(i=0;i<P_BANDS;i++){ - int hi_curve,lo_curve,bin; - ret[i]=_ogg_malloc(sizeof(**ret)*P_LEVELS); - - /* low frequency curves are measured with greater resolution than - the MDCT/FFT will actually give us; we want the curve applied - to the tone data to be pessimistic and thus apply the minimum - masking possible for a given bin. That means that a single bin - could span more than one octave and that the curve will be a - composite of multiple octaves. It also may mean that a single - bin may span > 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;m<P_LEVELS;m++){ - ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2)); - - for(j=0;j<n;j++)brute_buffer[j]=999.; - - /* render the curve into bins, then pull values back into curve. - The point is that any inherent subsampling aliasing results in - a safe minimum */ - for(k=lo_curve;k<=hi_curve;k++){ - int l=0; - - for(j=0;j<EHMER_MAX;j++){ - int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz; - int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1; - - if(lo_bin<0)lo_bin=0; - if(lo_bin>n)lo_bin=n; - if(lo_bin<l)l=lo_bin; - if(hi_bin<0)hi_bin=0; - if(hi_bin>n)hi_bin=n; - - for(;l<hi_bin && l<n;l++) - if(brute_buffer[l]>workc[k][m][j]) - brute_buffer[l]=workc[k][m][j]; - } - - for(;l<n;l++) - if(brute_buffer[l]>workc[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+1<P_BANDS){ - int l=0; - k=i+1; - for(j=0;j<EHMER_MAX;j++){ - int lo_bin= fromOC(j*.125+i*.5-2.0625)/binHz; - int hi_bin= fromOC(j*.125+i*.5-1.9375)/binHz+1; - - if(lo_bin<0)lo_bin=0; - if(lo_bin>n)lo_bin=n; - if(lo_bin<l)l=lo_bin; - if(hi_bin<0)hi_bin=0; - if(hi_bin>n)hi_bin=n; - - for(;l<hi_bin && l<n;l++) - if(brute_buffer[l]>workc[k][m][j]) - brute_buffer[l]=workc[k][m][j]; - } - - for(;l<n;l++) - if(brute_buffer[l]>workc[k][m][EHMER_MAX-1]) - brute_buffer[l]=workc[k][m][EHMER_MAX-1]; - - } - - - for(j=0;j<EHMER_MAX;j++){ - int bin=fromOC(j*.125+i*.5-2.)/binHz; - if(bin<0){ - ret[i][m][j+2]=-999.; - }else{ - if(bin>=n){ - ret[i][m][j+2]=-999.; - }else{ - ret[i][m][j+2]=brute_buffer[bin]; - } - } - } - - /* add fenceposts */ - for(j=0;j<EHMER_OFFSET;j++) - if(ret[i][m][j+2]>-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;i<MAX_ATH-1;i++){ - int endpos=rint(fromOC((i+1)*.125-2.)*2*n/rate); - float base=ATH[i]; - if(j<endpos){ - float delta=(ATH[i+1]-base)/(endpos-j); - for(;j<endpos && j<n;j++){ - p->ath[j]=base+100.; - base+=delta; - } - } - } - - for(;j<n;j++){ - p->ath[j]=p->ath[j-1]; - } - - for(i=0;i<n;i++){ - float bark=toBARK(rate/(2*n)*i); - - for(;lo+vi->noisewindowlomin<i && - toBARK(rate/(2*n)*lo)<(bark-vi->noisewindowlo);lo++); - - for(;hi<=n && (hi<i+vi->noisewindowhimin || - toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++); - - p->bark[i]=((lo-1)<<16)+(hi-1); - - } - - for(i=0;i<n;i++) - p->octave[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;i<P_NOISECURVES;i++) - p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset)); - - for(i=0;i<n;i++){ - float halfoc=toOC((i+.5)*rate/(2.*n))*2.; - int inthalfoc; - float del; - - if(halfoc<0)halfoc=0; - if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1; - inthalfoc=(int)halfoc; - del=halfoc-inthalfoc; - - for(j=0;j<P_NOISECURVES;j++) - p->noiseoffset[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;i<P_BANDS;i++){ - for(j=0;j<P_LEVELS;j++){ - _ogg_free(p->tonecurves[i][j]); - } - _ogg_free(p->tonecurves[i]); - } - _ogg_free(p->tonecurves); - } - if(p->noiseoffset){ - for(i=0;i<P_NOISECURVES;i++){ - _ogg_free(p->noiseoffset[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];i<post1;i++){ - if(seedptr>0){ - float lin=amp+curve[i]; - if(seed[seedptr]<lin)seed[seedptr]=lin; - } - seedptr+=linesper; - if(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;i<n;i++){ - float max=f[i]; - long oc=p->octave[i]; - while(i+1<n && p->octave[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;i<n;i++){ - if(stack<2){ - posstack[stack]=i; - ampstack[stack++]=seeds[i]; - }else{ - while(1){ - if(seeds[i]<ampstack[stack-1]){ - posstack[stack]=i; - ampstack[stack++]=seeds[i]; - break; - }else{ - if(i<posstack[stack-1]+linesper){ - if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] && - i<posstack[stack-2]+linesper){ - /* we completely overlap, making stack-1 irrelevant. pop it */ - stack--; - continue; - } - } - posstack[stack]=i; - ampstack[stack++]=seeds[i]; - break; - - } - } - } - } - - /* the stack now contains only the positions that are relevant. Scan - 'em straight through */ - - for(i=0;i<stack;i++){ - long endpos; - if(i<stack-1 && ampstack[i+1]>ampstack[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<endpos;pos++) - seeds[pos]=ampstack[i]; - } - - /* there. Linear time. I now remember this was on a problem set I - had in Grad Skool... I didn't solve it at the time ;-) */ - -} - -/* bleaugh, this is more complicated than it needs to be */ -#include<stdio.h> -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+1<p->n){ - 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]<minV) || minV==NEGINF) - minV=seed[pos]; - } - - end=pos+p->firstoc; - for(;linpos<p->n && p->octave[linpos]<=end;linpos++) - if(flr[linpos]<minV)flr[linpos]=minV; - } - - { - float minV=seed[p->total_octave_lines-1]; - for(;linpos<p->n;linpos++) - if(flr[linpos]<minV)flr[linpos]=minV; - } - -} - -static void bark_noise_hybridmp(int n,const long *b, - const float *f, - float *noise, - const float offset, - const int fixed){ - - float *N=alloca(n*sizeof(*N)); - float *X=alloca(n*sizeof(*N)); - float *XX=alloca(n*sizeof(*N)); - float *Y=alloca(n*sizeof(*N)); - float *XY=alloca(n*sizeof(*N)); - - float tN, tX, tXX, tY, tXY; - int i; - - int lo, hi; - float R=0.f; - float A=0.f; - float B=0.f; - float D=1.f; - float w, x, y; - - tN = tX = tXX = tY = tXY = 0.f; - - y = f[0] + offset; - if (y < 1.f) y = 1.f; - - w = y * y * .5; - - tN += w; - tX += w; - tY += w * y; - - N[0] = tN; - X[0] = tX; - XX[0] = tXX; - Y[0] = tY; - XY[0] = tXY; - - for (i = 1, x = 1.f; i < n; i++, x += 1.f) { - - y = f[i] + offset; - if (y < 1.f) y = 1.f; - - w = y * y; - - tN += w; - tX += w * x; - tXX += w * x * x; - tY += w * y; - tXY += w * x * y; - - N[i] = tN; - X[i] = tX; - XX[i] = tXX; - Y[i] = tY; - XY[i] = tXY; - } - - for (i = 0, x = 0.f;; i++, x += 1.f) { - - lo = b[i] >> 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; - } -} - -void _vp_noisemask(vorbis_look_psy *p, - float *logmdct, - float *logmask){ - - int i,n=p->n; - float *work=alloca(n*sizeof(*work)); - - bark_noise_hybridmp(n,p->bark,logmdct,logmask, - 140.,-1); - - for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i]; - - bark_noise_hybridmp(n,p->bark,work,logmask,0., - p->vi->noisewindowfixed); - - for(i=0;i<n;i++)work[i]=logmdct[i]-work[i]; - -#if 0 - { - static int seq=0; - - float work2[n]; - for(i=0;i<n;i++){ - work2[i]=logmask[i]+work[i]; - } - - if(seq&1) - _analysis_output("median2R",seq/2,work,n,1,0,0); - else - _analysis_output("median2L",seq/2,work,n,1,0,0); - - if(seq&1) - _analysis_output("envelope2R",seq/2,work2,n,1,0,0); - else - _analysis_output("envelope2L",seq/2,work2,n,1,0,0); - seq++; - } -#endif - - for(i=0;i<n;i++){ - int dB=logmask[i]+.5; - if(dB>=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;i<p->total_octave_lines;i++)seed[i]=NEGINF; - - /* set the ATH (floating below localmax, not global max by a - specified att) */ - if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt; - - for(i=0;i<n;i++) - logmask[i]=p->ath[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;i<n;i++){ - float val= noise[i]+p->noiseoffset[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 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, -}; - -/* this is for per-channel noise normalization */ -static int apsort(const void *a, const void *b){ - float f1=**(float**)a; - float f2=**(float**)b; - return (f1<f2)-(f1>f2); -} - -static void flag_lossless(int limit, float prepoint, float postpoint, float *mdct, - float *floor, int *flag, int i, int jn){ - int j; - for(j=0;j<jn;j++){ - float point = j>=limit-i ? postpoint : prepoint; - float r = fabs(mdct[j])/floor[j]; - if(r<point) - flag[j]=0; - else - flag[j]=1; - } -} - -/* Overload/Side effect: On input, the *q vector holds either the - quantized energy (for elements with the flag set) or the absolute - values of the *r vector (for elements with flag unset). On output, - *q holds the quantized energy for all elements */ -static float noise_normalize(vorbis_look_psy *p, int limit, float *r, float *q, float *f, int *flags, float acc, int i, int n, int *out){ - - vorbis_info_psy *vi=p->vi; - float **sort = alloca(n*sizeof(*sort)); - int j,count=0; - int start = (vi->normal_p ? vi->normal_start-i : n); - if(start>n)start=n; - - /* force classic behavior where only energy in the current band is considered */ - acc=0.f; - - /* still responsible for populating *out where noise norm not in - effect. There's no need to [re]populate *q in these areas */ - for(j=0;j<start;j++){ - if(!flags || !flags[j]){ /* lossless coupling already quantized. - Don't touch; requantizing based on - energy would be incorrect. */ - float ve = q[j]/f[j]; - if(r[j]<0) - out[j] = -rint(sqrt(ve)); - else - out[j] = rint(sqrt(ve)); - } - } - - /* sort magnitudes for noise norm portion of partition */ - for(;j<n;j++){ - if(!flags || !flags[j]){ /* can't noise norm elements that have - already been loslessly coupled; we can - only account for their energy error */ - float ve = q[j]/f[j]; - /* Despite all the new, more capable coupling code, for now we - implement noise norm as it has been up to this point. Only - consider promotions to unit magnitude from 0. In addition - the only energy error counted is quantizations to zero. */ - /* also-- the original point code only applied noise norm at > pointlimit */ - if(ve<.25f && (!flags || j>=limit-i)){ - acc += ve; - sort[count++]=q+j; /* q is fabs(r) for unflagged element */ - }else{ - /* For now: no acc adjustment for nonzero quantization. populate *out and q as this value is final. */ - if(r[j]<0) - out[j] = -rint(sqrt(ve)); - else - out[j] = rint(sqrt(ve)); - q[j] = out[j]*out[j]*f[j]; - } - }/* else{ - again, no energy adjustment for error in nonzero quant-- for now - }*/ - } - - if(count){ - /* noise norm to do */ - qsort(sort,count,sizeof(*sort),apsort); - for(j=0;j<count;j++){ - int k=sort[j]-q; - if(acc>=vi->normal_thresh){ - out[k]=unitnorm(r[k]); - acc-=1.f; - q[k]=f[k]; - }else{ - out[k]=0; - q[k]=0.f; - } - } - } - - return acc; -} - -/* Noise normalization, quantization and coupling are not wholly - seperable processes in depth>1 coupling. */ -void _vp_couple_quantize_normalize(int blobno, - vorbis_info_psy_global *g, - vorbis_look_psy *p, - vorbis_info_mapping0 *vi, - float **mdct, - int **iwork, - int *nonzero, - int sliding_lowpass, - int ch){ - - int i; - int n = p->n; - int partition=(p->vi->normal_p ? p->vi->normal_partition : 16); - int limit = g->coupling_pointlimit[p->vi->blockflag][blobno]; - float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]]; - float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]]; - float de=0.1*p->m_val; /* a blend of the AoTuV M2 and M3 code here and below */ - - /* mdct is our raw mdct output, floor not removed. */ - /* inout passes in the ifloor, passes back quantized result */ - - /* unquantized energy (negative indicates amplitude has negative sign) */ - float **raw = alloca(ch*sizeof(*raw)); - - /* dual pupose; quantized energy (if flag set), othersize fabs(raw) */ - float **quant = alloca(ch*sizeof(*quant)); - - /* floor energy */ - float **floor = alloca(ch*sizeof(*floor)); - - /* flags indicating raw/quantized status of elements in raw vector */ - int **flag = alloca(ch*sizeof(*flag)); - - /* non-zero flag working vector */ - int *nz = alloca(ch*sizeof(*nz)); - - /* energy surplus/defecit tracking */ - float *acc = alloca((ch+vi->coupling_steps)*sizeof(*acc)); - - /* The threshold of a stereo is changed with the size of n */ - if(n > 1000) - postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]]; - - raw[0] = alloca(ch*partition*sizeof(**raw)); - quant[0] = alloca(ch*partition*sizeof(**quant)); - floor[0] = alloca(ch*partition*sizeof(**floor)); - flag[0] = alloca(ch*partition*sizeof(**flag)); - - for(i=1;i<ch;i++){ - raw[i] = &raw[0][partition*i]; - quant[i] = &quant[0][partition*i]; - floor[i] = &floor[0][partition*i]; - flag[i] = &flag[0][partition*i]; - } - for(i=0;i<ch+vi->coupling_steps;i++) - acc[i]=0.f; - - for(i=0;i<n;i+=partition){ - int k,j,jn = partition > n-i ? n-i : partition; - int step,track = 0; - - memcpy(nz,nonzero,sizeof(*nz)*ch); - - /* prefill */ - memset(flag[0],0,ch*partition*sizeof(**flag)); - for(k=0;k<ch;k++){ - int *iout = &iwork[k][i]; - if(nz[k]){ - - for(j=0;j<jn;j++) - floor[k][j] = FLOOR1_fromdB_LOOKUP[iout[j]]; - - flag_lossless(limit,prepoint,postpoint,&mdct[k][i],floor[k],flag[k],i,jn); - - for(j=0;j<jn;j++){ - quant[k][j] = raw[k][j] = mdct[k][i+j]*mdct[k][i+j]; - if(mdct[k][i+j]<0.f) raw[k][j]*=-1.f; - floor[k][j]*=floor[k][j]; - } - - acc[track]=noise_normalize(p,limit,raw[k],quant[k],floor[k],NULL,acc[track],i,jn,iout); - - }else{ - for(j=0;j<jn;j++){ - floor[k][j] = 1e-10f; - raw[k][j] = 0.f; - quant[k][j] = 0.f; - flag[k][j] = 0; - iout[j]=0; - } - acc[track]=0.f; - } - track++; - } - - /* coupling */ - for(step=0;step<vi->coupling_steps;step++){ - int Mi = vi->coupling_mag[step]; - int Ai = vi->coupling_ang[step]; - int *iM = &iwork[Mi][i]; - int *iA = &iwork[Ai][i]; - float *reM = raw[Mi]; - float *reA = raw[Ai]; - float *qeM = quant[Mi]; - float *qeA = quant[Ai]; - float *floorM = floor[Mi]; - float *floorA = floor[Ai]; - int *fM = flag[Mi]; - int *fA = flag[Ai]; - - if(nz[Mi] || nz[Ai]){ - nz[Mi] = nz[Ai] = 1; - - for(j=0;j<jn;j++){ - - if(j<sliding_lowpass-i){ - if(fM[j] || fA[j]){ - /* lossless coupling */ - - reM[j] = fabs(reM[j])+fabs(reA[j]); - qeM[j] = qeM[j]+qeA[j]; - fM[j]=fA[j]=1; - - /* couple iM/iA */ - { - int A = iM[j]; - int B = iA[j]; - - if(abs(A)>abs(B)){ - iA[j]=(A>0?A-B:B-A); - }else{ - iA[j]=(B>0?A-B:B-A); - iM[j]=B; - } - - /* collapse two equivalent tuples to one */ - if(iA[j]>=abs(iM[j])*2){ - iA[j]= -iA[j]; - iM[j]= -iM[j]; - } - - } - - }else{ - /* lossy (point) coupling */ - if(j<limit-i){ - /* dipole */ - reM[j] += reA[j]; - qeM[j] = fabs(reM[j]); - }else{ - /* 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 - */ - /*float derate = (1.0 - de*((float)(j-limit+i) / (float)(n-limit))); - elliptical - if(reM[j]+reA[j]<0){ - reM[j] = - (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate); - }else{ - reM[j] = (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate); - }*/ - - /* elliptical */ - if(reM[j]+reA[j]<0){ - reM[j] = - (qeM[j] = fabs(reM[j])+fabs(reA[j])); - }else{ - reM[j] = (qeM[j] = fabs(reM[j])+fabs(reA[j])); - } - - - } - reA[j]=qeA[j]=0.f; - fA[j]=1; - iA[j]=0; - } - } - floorM[j]=floorA[j]=floorM[j]+floorA[j]; - } - /* normalize the resulting mag vector */ - acc[track]=noise_normalize(p,limit,raw[Mi],quant[Mi],floor[Mi],flag[Mi],acc[track],i,jn,iM); - track++; - } - } - } - - for(i=0;i<vi->coupling_steps;i++){ - /* 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]]){ - nonzero[vi->coupling_mag[i]]=1; - nonzero[vi->coupling_ang[i]]=1; - } - } -} diff --git a/src/lib/dl/ext/vorbis/psy.h b/src/lib/dl/ext/vorbis/psy.h deleted file mode 100755 index c1ea8244..00000000 --- a/src/lib/dl/ext/vorbis/psy.h +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_PSY_H_ -#define _V_PSY_H_ -#include "smallft.h" - -#include "backends.h" -#include "envelope.h" - -#ifndef EHMER_MAX -#define EHMER_MAX 56 -#endif - -/* psychoacoustic setup ********************************************/ -#define P_BANDS 17 /* 62Hz to 16kHz */ -#define P_LEVELS 8 /* 30dB to 100dB */ -#define P_LEVEL_0 30. /* 30 dB */ -#define P_NOISECURVES 3 - -#define NOISE_COMPAND_LEVELS 40 -typedef struct vorbis_info_psy{ - int blockflag; - - float ath_adjatt; - float ath_maxatt; - - float tone_masteratt[P_NOISECURVES]; - float tone_centerboost; - float tone_decay; - float tone_abs_limit; - float toneatt[P_BANDS]; - - int noisemaskp; - float noisemaxsupp; - float noisewindowlo; - float noisewindowhi; - int noisewindowlomin; - int noisewindowhimin; - int noisewindowfixed; - float noiseoff[P_NOISECURVES][P_BANDS]; - float noisecompand[NOISE_COMPAND_LEVELS]; - - float max_curve_dB; - - int normal_p; - int normal_start; - int normal_partition; - double normal_thresh; -} vorbis_info_psy; - -typedef struct{ - int eighth_octave_lines; - - /* for block long/short tuning; encode only */ - float preecho_thresh[VE_BANDS]; - float postecho_thresh[VE_BANDS]; - float stretch_penalty; - float preecho_minenergy; - - float ampmax_att_per_sec; - - /* channel coupling config */ - int coupling_pkHz[PACKETBLOBS]; - int coupling_pointlimit[2][PACKETBLOBS]; - int coupling_prepointamp[PACKETBLOBS]; - int coupling_postpointamp[PACKETBLOBS]; - int sliding_lowpass[2][PACKETBLOBS]; - -} vorbis_info_psy_global; - -typedef struct { - float ampmax; - int channels; - - vorbis_info_psy_global *gi; - int coupling_pointlimit[2][P_NOISECURVES]; -} vorbis_look_psy_global; - - -typedef struct { - int n; - struct vorbis_info_psy *vi; - - float ***tonecurves; - float **noiseoffset; - - float *ath; - long *octave; /* in n.ocshift format */ - long *bark; - - long firstoc; - long shiftoc; - int eighth_octave_lines; /* power of two, please */ - int total_octave_lines; - long rate; /* cache it */ - - float m_val; /* Masking compensation value */ - -} vorbis_look_psy; - -extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, - vorbis_info_psy_global *gi,int n,long rate); -extern void _vp_psy_clear(vorbis_look_psy *p); -extern void *_vi_psy_dup(void *source); - -extern void _vi_psy_free(vorbis_info_psy *i); -extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i); - -extern void _vp_noisemask(vorbis_look_psy *p, - float *logmdct, - float *logmask); - -extern void _vp_tonemask(vorbis_look_psy *p, - float *logfft, - float *logmask, - float global_specmax, - float local_specmax); - -extern void _vp_offset_and_mix(vorbis_look_psy *p, - float *noise, - float *tone, - int offset_select, - float *logmask, - float *mdct, - float *logmdct); - -extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd); - -extern void _vp_couple_quantize_normalize(int blobno, - vorbis_info_psy_global *g, - vorbis_look_psy *p, - vorbis_info_mapping0 *vi, - float **mdct, - int **iwork, - int *nonzero, - int sliding_lowpass, - int ch); - -#endif diff --git a/src/lib/dl/ext/vorbis/registry.c b/src/lib/dl/ext/vorbis/registry.c deleted file mode 100755 index 3961ed14..00000000 --- a/src/lib/dl/ext/vorbis/registry.c +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: registry for time, floor, res backends and channel mappings - last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#include "vorbis/codec.h" -#include "codec_internal.h" -#include "registry.h" -#include "misc.h" -/* seems like major overkill now; the backend numbers will grow into - the infrastructure soon enough */ - -extern const vorbis_func_floor floor0_exportbundle; -extern const vorbis_func_floor floor1_exportbundle; -extern const vorbis_func_residue residue0_exportbundle; -extern const vorbis_func_residue residue1_exportbundle; -extern const vorbis_func_residue residue2_exportbundle; -extern const vorbis_func_mapping mapping0_exportbundle; - -const vorbis_func_floor *const _floor_P[]={ - &floor0_exportbundle, - &floor1_exportbundle, -}; - -const vorbis_func_residue *const _residue_P[]={ - &residue0_exportbundle, - &residue1_exportbundle, - &residue2_exportbundle, -}; - -const vorbis_func_mapping *const _mapping_P[]={ - &mapping0_exportbundle, -}; diff --git a/src/lib/dl/ext/vorbis/registry.h b/src/lib/dl/ext/vorbis/registry.h deleted file mode 100755 index 3ae04776..00000000 --- a/src/lib/dl/ext/vorbis/registry.h +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: registry for time, floor, res backends and channel mappings - last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_REG_H_ -#define _V_REG_H_ - -#define VI_TRANSFORMB 1 -#define VI_WINDOWB 1 -#define VI_TIMEB 1 -#define VI_FLOORB 2 -#define VI_RESB 3 -#define VI_MAPB 1 - -extern const vorbis_func_floor *const _floor_P[]; -extern const vorbis_func_residue *const _residue_P[]; -extern const vorbis_func_mapping *const _mapping_P[]; - -#endif diff --git a/src/lib/dl/ext/vorbis/res0.c b/src/lib/dl/ext/vorbis/res0.c deleted file mode 100755 index 4ea05500..00000000 --- a/src/lib/dl/ext/vorbis/res0.c +++ /dev/null @@ -1,889 +0,0 @@ -/******************************************************************** - * * - * 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-2010 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: residue backend 0, 1 and 2 implementation - last mod: $Id: res0.c 17556 2010-10-21 18:25:19Z tterribe $ - - ********************************************************************/ - -/* Slow, slow, slow, simpleminded and did I mention it was slow? The - encode/decode loops are coded for clarity and performance is not - yet even a nagging little idea lurking in the shadows. Oh and BTW, - it's slow. */ - -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <ext/libogg/ogg.h> -#include "codec.h" -#include "codec_internal.h" -#include "registry.h" -#include "codebook.h" -#include "misc.h" -#include "os.h" - -//#define TRAIN_RES 1 -//#define TRAIN_RESAUX 1 - -#if defined(TRAIN_RES) || defined (TRAIN_RESAUX) -#include <stdio.h> -#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; - int submap; -#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;j<look->parts;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_sub%d_part%d_pass%d.vqd",look->submap,j,k); - of=fopen(buffer,"a"); - - for(l=0;l<statebook->entries;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;j<look->parts;j++){ - long acc=0; - fprintf(stderr,"\t[%d] == ",j); - for(k=0;k<look->stages;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;j<look->parts;j++) - if(look->partbooks[j])_ogg_free(look->partbooks[j]); - _ogg_free(look->partbooks); - for(j=0;j<look->partvals;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;j<info->partitions;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;j<acc;j++) - oggpack_write(opb,info->booklist[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); - - /* check for premature EOP */ - if(info->groupbook<0)goto errout; - - for(j=0;j<info->partitions;j++){ - int cascade=oggpack_read(opb,3); - int cflag=oggpack_read(opb,1); - if(cflag<0) goto errout; - if(cflag){ - int c=oggpack_read(opb,5); - if(c<0) goto errout; - cascade|=(c<<3); - } - info->secondstages[j]=cascade; - - acc+=icount(cascade); - } - for(j=0;j<acc;j++){ - int book=oggpack_read(opb,8); - if(book<0) goto errout; - info->booklist[j]=book; - } - - if(info->groupbook>=ci->books)goto errout; - for(j=0;j<acc;j++){ - if(info->booklist[j]>=ci->books)goto errout; - if(ci->book_param[info->booklist[j]]->maptype==0)goto errout; - } - - /* verify the phrasebook is not specifying an impossible or - inconsistent partitioning scheme. */ - /* modify the phrasebook ranging check from r16327; an early beta - encoder had a bug where it used an oversized phrasebook by - accident. These files should continue to be playable, but don't - allow an exploit */ - { - int entries = ci->book_param[info->groupbook]->entries; - int dim = ci->book_param[info->groupbook]->dim; - int partvals = 1; - if (dim<1) goto errout; - while(dim>0){ - partvals *= info->partitions; - if(partvals > entries) goto errout; - dim--; - } - info->partvals = partvals; - } - - 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;j<look->parts;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;k<stages;k++) - if(info->secondstages[j]&(1<<k)){ - look->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=1; - for(j=0;j<dim;j++) - look->partvals*=look->parts; - - look->stages=maxstage; - look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap)); - for(j=0;j<look->partvals;j++){ - long val=j; - long mult=look->partvals/look->parts; - look->decodemap[j]=_ogg_malloc(dim*sizeof(*look->decodemap[j])); - for(k=0;k<dim;k++){ - long deco=val/mult; - val-=deco*mult; - mult/=look->parts; - 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,int *a){ - int dim=book->dim; - int i,j,o; - int minval=book->minval; - int del=book->delta; - int qv=book->quantvals; - int ze=(qv>>1); - int index=0; - /* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */ - int p[8]={0,0,0,0,0,0,0,0}; - - if(del!=1){ - for(i=0,o=dim;i<dim;i++){ - int v = (a[--o]-minval+(del>>1))/del; - int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1)); - index = index*qv+ (m<0?0:(m>=qv?qv-1:m)); - p[o]=v*del+minval; - } - }else{ - for(i=0,o=dim;i<dim;i++){ - int v = a[--o]-minval; - int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1)); - index = index*qv+ (m<0?0:(m>=qv?qv-1:m)); - p[o]=v*del+minval; - } - } - - if(book->c->lengthlist[index]<=0){ - const static_codebook *c=book->c; - int best=-1; - /* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */ - int e[8]={0,0,0,0,0,0,0,0}; - int maxval = book->minval + book->delta*(book->quantvals-1); - for(i=0;i<book->entries;i++){ - if(c->lengthlist[i]>0){ - int this=0; - for(j=0;j<dim;j++){ - int val=(e[j]-a[j]); - this+=val*val; - } - if(best==-1 || this<best){ - memcpy(p,e,sizeof(p)); - best=this; - index=i; - } - } - /* assumes the value patterning created by the tools in vq/ */ - j=0; - while(e[j]>=maxval) - e[j++]=0; - if(e[j]>=0) - e[j]+=book->delta; - e[j]= -e[j]; - } - } - - if(index>-1){ - for(i=0;i<dim;i++) - *a++ -= p[i]; - } - - return(index); -} - -static int _encodepart(oggpack_buffer *opb,int *vec, int n, - codebook *book,long *acc){ - int i,bits=0; - int dim=book->dim; - int step=n/dim; - - for(i=0;i<step;i++){ - int entry=local_book_besterror(book,vec+i*dim); - -#ifdef TRAIN_RES - if(entry>=0) - acc[entry]++; -#endif - - bits+=vorbis_book_encode(book,entry,opb); - - } - - return(bits); -} - -static long **_01class(vorbis_block *vb,vorbis_look_residue *vl, - int **in,int ch){ - long i,j,k; - 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,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;i<ch;i++){ - partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i])); - memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i])); - } - - for(i=0;i<partvals;i++){ - int offset=i*samples_per_partition+info->begin; - for(j=0;j<ch;j++){ - int max=0; - int ent=0; - for(k=0;k<samples_per_partition;k++){ - if(abs(in[j][offset+k])>max)max=abs(in[j][offset+k]); - ent+=abs(in[j][offset+k]); - } - ent*=scale; - - for(k=0;k<possible_partitions-1;k++) - if(max<=info->classmetric1[k] && - (info->classmetric2[k]<0 || ent<info->classmetric2[k])) - break; - - partword[j][i]=k; - } - } - -#ifdef TRAIN_RESAUX - { - FILE *of; - char buffer[80]; - - for(i=0;i<ch;i++){ - sprintf(buffer,"resaux_%d.vqd",look->train_seq); - of=fopen(buffer,"a"); - for(j=0;j<partvals;j++) - fprintf(of,"%ld, ",partword[i][j]); - fprintf(of,"\n"); - fclose(of); - } - } -#endif - look->frames++; - - 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,int **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,partvals*sizeof(*partword[0])); - memset(partword[0],0,partvals*sizeof(*partword[0])); - - for(i=0,l=info->begin/ch;i<partvals;i++){ - int magmax=0; - int angmax=0; - for(j=0;j<samples_per_partition;j+=ch){ - if(abs(in[0][l])>magmax)magmax=abs(in[0][l]); - for(k=1;k<ch;k++) - if(abs(in[k][l])>angmax)angmax=abs(in[k][l]); - l++; - } - - for(j=0;j<possible_partitions-1;j++) - if(magmax<=info->classmetric1[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;i<partvals;i++) - fprintf(of,"%ld, ",partword[0][i]); - fprintf(of,"\n"); - fclose(of); -#endif - - look->frames++; - - return(partword); -} - -static int _01forward(oggpack_buffer *opb, - vorbis_block *vb,vorbis_look_residue *vl, - int **in,int ch, - long **partword, - int (*encode)(oggpack_buffer *,int *,int, - codebook *,long *), - int submap){ - long i,j,k,s; - vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; - vorbis_info_residue0 *info=look->info; - -#ifdef TRAIN_RES - look->submap=submap; -#endif - - /* 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;i<ch;i++) - for(j=info->begin;j<info->end;j++){ - if(in[i][j]>look->tmax)look->tmax=in[i][j]; - if(in[i][j]<look->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;s<look->stages;s++){ - - for(i=0;i<partvals;){ - - /* first we encode a partition codeword for each channel */ - if(s==0){ - for(j=0;j<ch;j++){ - long val=partword[j][i]; - for(k=1;k<partitions_per_word;k++){ - val*=possible_partitions; - if(i+k<partvals) - val+=partword[j][i+k]; - } - - /* training hack */ - if(val<look->phrasebook->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;k<partitions_per_word && i<partvals;k++,i++){ - long offset=i*samples_per_partition+info->begin; - - for(j=0;j<ch;j++){ - if(s==0)resvals[partword[j][i]]+=samples_per_partition; - if(info->secondstages[partword[j][i]]&(1<<s)){ - codebook *statebook=look->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; - int *samples=in[j]+offset; - for(l=0;l<samples_per_partition;l++){ - if(samples[l]<look->training_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;k<possible_partitions;k++){ - fprintf(stderr,"%ld/%1.2g, ",resvals[k],(float)resbits[k]/resvals[k]); - total+=resvals[k]; - totalbits+=resbits[k]; - } - - fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total); - }*/ - - return(0); -} - -/* a truncated packet here just means 'stop working'; it's not an error */ -static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl, - float **in,int ch, - long (*decodepart)(codebook *, float *, - oggpack_buffer *,int)){ - - long i,j,k,l,s; - 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 partitions_per_word=look->phrasebook->dim; - int max=vb->pcmend>>1; - int end=(info->end<max?info->end:max); - int n=end-info->begin; - - if(n>0){ - 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;j<ch;j++) - partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j])); - - for(s=0;s<look->stages;s++){ - - /* each loop decodes on partition codeword containing - partitions_per_word partitions */ - for(i=0,l=0;i<partvals;l++){ - if(s==0){ - /* fetch the partition word for each channel */ - for(j=0;j<ch;j++){ - int temp=vorbis_book_decode(look->phrasebook,&vb->opb); - - if(temp==-1 || temp>=info->partvals)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;k<partitions_per_word && i<partvals;k++,i++) - for(j=0;j<ch;j++){ - long offset=info->begin+i*samples_per_partition; - if(info->secondstages[partword[j][l][k]]&(1<<s)){ - codebook *stagebook=look->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); -} - -int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl, - float **in,int *nonzero,int ch){ - int i,used=0; - for(i=0;i<ch;i++) - if(nonzero[i]) - in[used++]=in[i]; - if(used) - return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add)); - else - return(0); -} - -int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl, - int **in,int *nonzero,int ch, long **partword, int submap){ - int i,used=0; - for(i=0;i<ch;i++) - if(nonzero[i]) - in[used++]=in[i]; - - if(used){ - return _01forward(opb,vb,vl,in,used,partword,_encodepart,submap); - }else{ - return(0); - } -} - -long **res1_class(vorbis_block *vb,vorbis_look_residue *vl, - int **in,int *nonzero,int ch){ - int i,used=0; - for(i=0;i<ch;i++) - if(nonzero[i]) - in[used++]=in[i]; - if(used) - return(_01class(vb,vl,in,used)); - else - return(0); -} - -int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl, - float **in,int *nonzero,int ch){ - int i,used=0; - for(i=0;i<ch;i++) - if(nonzero[i]) - in[used++]=in[i]; - if(used) - return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add)); - else - return(0); -} - -long **res2_class(vorbis_block *vb,vorbis_look_residue *vl, - int **in,int *nonzero,int ch){ - int i,used=0; - for(i=0;i<ch;i++) - if(nonzero[i])used++; - if(used) - return(_2class(vb,vl,in,ch)); - else - return(0); -} - -/* res2 is slightly more different; all the channels are interleaved - into a single vector and encoded. */ - -int res2_forward(oggpack_buffer *opb, - vorbis_block *vb,vorbis_look_residue *vl, - int **in,int *nonzero,int ch, long **partword,int submap){ - long i,j,k,n=vb->pcmend/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 :-( */ - int *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work)); - for(i=0;i<ch;i++){ - int *pcm=in[i]; - if(nonzero[i])used++; - for(j=0,k=i;j<n;j++,k+=ch) - work[k]=pcm[j]; - } - - if(used){ - return _01forward(opb,vb,vl,&work,1,partword,_encodepart,submap); - }else{ - return(0); - } -} - -/* duplicate code here as speed is somewhat more important */ -int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl, - float **in,int *nonzero,int ch){ - long i,k,l,s; - 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 partitions_per_word=look->phrasebook->dim; - int max=(vb->pcmend*ch)>>1; - int end=(info->end<max?info->end:max); - int n=end-info->begin; - - if(n>0){ - 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;i<ch;i++)if(nonzero[i])break; - if(i==ch)return(0); /* no nonzero vectors */ - - for(s=0;s<look->stages;s++){ - for(i=0,l=0;i<partvals;l++){ - - if(s==0){ - /* fetch the partition word */ - int temp=vorbis_book_decode(look->phrasebook,&vb->opb); - if(temp==-1 || temp>=info->partvals)goto eopbreak; - partword[l]=look->decodemap[temp]; - if(partword[l]==NULL)goto errout; - } - - /* now we decode residual values for the partitions */ - for(k=0;k<partitions_per_word && i<partvals;k++,i++) - if(info->secondstages[partword[l][k]]&(1<<s)){ - codebook *stagebook=look->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); -} - - -const vorbis_func_residue residue0_exportbundle={ - NULL, - &res0_unpack, - &res0_look, - &res0_free_info, - &res0_free_look, - NULL, - NULL, - &res0_inverse -}; - -const vorbis_func_residue residue1_exportbundle={ - &res0_pack, - &res0_unpack, - &res0_look, - &res0_free_info, - &res0_free_look, - &res1_class, - &res1_forward, - &res1_inverse -}; - -const 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/src/lib/dl/ext/vorbis/scales.h b/src/lib/dl/ext/vorbis/scales.h deleted file mode 100755 index 613f796e..00000000 --- a/src/lib/dl/ext/vorbis/scales.h +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: linear scale -> dB, Bark and Mel scales - last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_SCALES_H_ -#define _V_SCALES_H_ - -#include <math.h> -#include "os.h" - -#ifdef _MSC_VER -/* MS Visual Studio doesn't have C99 inline keyword. */ -#define inline __inline -#endif - -/* 20log10(x) */ -#define VORBIS_IEEE_FLOAT32 1 -#ifdef VORBIS_IEEE_FLOAT32 - -static inline float unitnorm(float x){ - union { - ogg_uint32_t i; - float f; - } ix; - ix.f = x; - ix.i = (ix.i & 0x80000000U) | (0x3f800000U); - return ix.f; -} - -/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */ -static inline float todB(const float *x){ - union { - ogg_uint32_t i; - float f; - } ix; - ix.f = *x; - ix.i = ix.i&0x7fffffff; - return (float)(ix.i * 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 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/src/lib/dl/ext/vorbis/sharedbook.c b/src/lib/dl/ext/vorbis/sharedbook.c deleted file mode 100755 index f40aed55..00000000 --- a/src/lib/dl/ext/vorbis/sharedbook.c +++ /dev/null @@ -1,579 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: basic shared codebook operations - last mod: $Id: sharedbook.c 17030 2010-03-25 06:52:55Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <math.h> -#include <string.h> -#include <ext/libogg/ogg.h> -#include "os.h" -#include "misc.h" -#include "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)+.001); //+epsilon - mant=rint(ldexp(val,(VQ_FMAN-1)-exp)); - exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN; - - return(sign|exp|mant); -} - -float _float32_unpack(long val){ - double mant=val&0x1fffff; - int sign=val&0x80000000; - long exp =(val&0x7fe00000L)>>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;i<n;i++){ - long length=l[i]; - if(length>0){ - 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++; - } - - /* sanity check the huffman tree; an underpopulated tree must be - rejected. The only exception is the one-node pseudo-nil tree, - which appears to be underpopulated because the tree doesn't - really exist; there's only one possible 'codeword' or zero bits, - but the above tree-gen code doesn't mark that. */ - if(sparsecount != 1){ - for(i=1;i<33;i++) - if(marker[i] & (0xffffffffUL>>(32-i))){ - _ogg_free(r); - return(NULL); - } - } - - /* bitreverse the words because our bitwise packer/unpacker is LSb - endian */ - for(i=0,count=0;i<n;i++){ - ogg_uint32_t temp=0; - for(j=0;j<l[i];j++){ - temp<<=1; - temp|=(r[count]>>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;i<b->dim;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*dim<entries), which means that - we'll have 'left over' entries; left over entries use zeroed - values (and are wasted). So don't generate codebooks like - that */ - quantvals=_book_maptype1_quantvals(b); - for(j=0;j<b->entries;j++){ - if((sparsemap && b->lengthlist[j]) || !sparsemap){ - float last=0.f; - int indexdiv=1; - for(k=0;k<b->dim;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;j<b->entries;j++){ - if((sparsemap && b->lengthlist[j]) || !sparsemap){ - float last=0.f; - - for(k=0;k<b->dim;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_destroy(static_codebook *b){ - if(b->allocedp){ - if(b->quantlist)_ogg_free(b->quantlist); - if(b->lengthlist)_ogg_free(b->lengthlist); - memset(b,0,sizeof(*b)); - _ogg_free(b); - } /* otherwise, it is in static memory */ -} - -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); - c->quantvals=_book_maptype1_quantvals(s); - c->minval=(int)rint(_float32_unpack(s->q_min)); - c->delta=(int)rint(_float32_unpack(s->q_delta)); - - 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;i<s->entries;i++) - if(s->lengthlist[i]>0) - n++; - - c->entries=s->entries; - c->used_entries=n; - c->dim=s->dim; - - if(n>0){ - - /* 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;i<n;i++){ - codes[i]=bitreverse(codes[i]); - codep[i]=codes+i; - } - - qsort(codep,n,sizeof(*codep),sort32a); - - sortindex=alloca(n*sizeof(*sortindex)); - c->codelist=_ogg_malloc(n*sizeof(*c->codelist)); - /* the index is a reverse index */ - for(i=0;i<n;i++){ - int position=codep[i]-codes; - sortindex[position]=i; - } - - for(i=0;i<n;i++) - c->codelist[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;i<s->entries;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;i<s->entries;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<<c->dec_firsttablen; - c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable)); - c->dec_maxlength=0; - - for(i=0;i<n;i++){ - if(c->dec_maxlength<c->dec_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<<c->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;i<tabn;i++){ - ogg_uint32_t word=i<<(32-c->dec_firsttablen); - if(c->dec_firsttable[bitreverse(word)]==0){ - while((lo+1)<n && c->codelist[lo+1]<=word)lo++; - while( hi<n && word>=(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); -} - -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 <stdio.h> - -/* 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, - 0 -}; -static float *test1_result=NULL; - -/* linear, full mapping, nonsequential */ -static_codebook test2={ - 4,3, - NULL, - 2, - -533200896,1611661312,4,0, - full_quantlist1, - 0 -}; -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, - 0 -}; -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, - 0 -}; -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, - 0 -}; -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;i<b->entries*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/src/lib/dl/ext/vorbis/smallft.c b/src/lib/dl/ext/vorbis/smallft.c deleted file mode 100755 index ae2bc41b..00000000 --- a/src/lib/dl/ext/vorbis/smallft.c +++ /dev/null @@ -1,1255 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: *unnormalized* fft transform - last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -/* 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 <stdlib.h> -#include <string.h> -#include <math.h> -#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<nf;i++){ - ib=nf-i+1; - ifac[ib+1]=ifac[ib]; - } - ifac[2] = 2; - - L107: - if(nl!=1)goto L104; - ifac[0]=n; - ifac[1]=nf; - argh=tpi/n; - is=0; - nfm1=nf-1; - l1=1; - - if(nfm1==0)return; - - for (k1=0;k1<nfm1;k1++){ - ip=ifac[k1+2]; - ld=0; - l2=l1*ip; - ido=n/l2; - ipm=ip-1; - - for (j=0;j<ipm;j++){ - ld+=l1; - i=is; - argld=(float)ld*argh; - fi=0.f; - for (ii=2;ii<ido;ii+=2){ - fi+=1.f; - arg=fi*argld; - wa[i++]=cos(arg); - wa[i++]=sin(arg); - } - is+=ido; - } - l1=l2; - } -} - -static void fdrffti(int n, float *wsave, int *ifac){ - - if (n == 1) return; - drfti1(n, wsave+n, ifac); -} - -static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){ - int i,k; - float ti2,tr2; - int t0,t1,t2,t3,t4,t5,t6; - - t1=0; - t0=(t2=l1*ido); - t3=ido<<1; - for(k=0;k<l1;k++){ - ch[t1<<1]=cc[t1]+cc[t2]; - ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; - t1+=ido; - t2+=ido; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - t2=t0; - for(k=0;k<l1;k++){ - t3=t2; - t4=(t1<<1)+(ido<<1); - t5=t1; - t6=t1+t1; - for(i=2;i<ido;i+=2){ - t3+=2; - t4-=2; - t5+=2; - t6+=2; - tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; - ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; - ch[t6]=cc[t5]+ti2; - ch[t4]=ti2-cc[t5]; - ch[t6-1]=cc[t5-1]+tr2; - ch[t4-1]=cc[t5-1]-tr2; - } - t1+=ido; - t2+=ido; - } - - if(ido%2==1)return; - - L105: - t3=(t2=(t1=ido)-1); - t2+=t0; - for(k=0;k<l1;k++){ - ch[t1]=-cc[t2]; - ch[t1-1]=cc[t3]; - t1+=ido<<1; - t2+=ido; - t3+=ido; - } -} - -static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2,float *wa3){ - static float hsqt2 = .70710678118654752f; - int i,k,t0,t1,t2,t3,t4,t5,t6; - float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; - t0=l1*ido; - - t1=t0; - t4=t1<<1; - t2=t1+(t1<<1); - t3=0; - - for(k=0;k<l1;k++){ - tr1=cc[t1]+cc[t2]; - tr2=cc[t3]+cc[t4]; - - ch[t5=t3<<2]=tr1+tr2; - ch[(ido<<2)+t5-1]=tr2-tr1; - ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4]; - ch[t5]=cc[t2]-cc[t1]; - - t1+=ido; - t2+=ido; - t3+=ido; - t4+=ido; - } - - if(ido<2)return; - if(ido==2)goto L105; - - - t1=0; - for(k=0;k<l1;k++){ - t2=t1; - t4=t1<<2; - t5=(t6=ido<<1)+t4; - for(i=2;i<ido;i+=2){ - t3=(t2+=2); - t4+=2; - t5-=2; - - t3+=t0; - cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; - ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; - t3+=t0; - cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3]; - ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1]; - t3+=t0; - cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3]; - ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1]; - - tr1=cr2+cr4; - tr4=cr4-cr2; - ti1=ci2+ci4; - ti4=ci2-ci4; - - ti2=cc[t2]+ci3; - ti3=cc[t2]-ci3; - tr2=cc[t2-1]+cr3; - tr3=cc[t2-1]-cr3; - - ch[t4-1]=tr1+tr2; - ch[t4]=ti1+ti2; - - ch[t5-1]=tr3-ti4; - ch[t5]=tr4-ti3; - - ch[t4+t6-1]=ti4+tr3; - ch[t4+t6]=tr4+ti3; - - ch[t5+t6-1]=tr2-tr1; - ch[t5+t6]=ti1-ti2; - } - t1+=ido; - } - if(ido&1)return; - - L105: - - t2=(t1=t0+ido-1)+(t0<<1); - t3=ido<<2; - t4=ido; - t5=ido<<1; - t6=ido; - - for(k=0;k<l1;k++){ - ti1=-hsqt2*(cc[t1]+cc[t2]); - tr1=hsqt2*(cc[t1]-cc[t2]); - - ch[t4-1]=tr1+cc[t6-1]; - ch[t4+t5-1]=cc[t6-1]-tr1; - - ch[t4]=ti1-cc[t1+t0]; - ch[t4+t5]=ti1+cc[t1+t0]; - - t1+=ido; - t2+=ido; - t4+=t3; - t6+=ido; - } -} - -static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1, - float *c2,float *ch,float *ch2,float *wa){ - - static float tpi=6.283185307179586f; - int idij,ipph,i,j,k,l,ic,ik,is; - int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; - float dc2,ai1,ai2,ar1,ar2,ds2; - int nbd; - float dcp,arg,dsp,ar1h,ar2h; - int idp2,ipp2; - - arg=tpi/(float)ip; - dcp=cos(arg); - dsp=sin(arg); - ipph=(ip+1)>>1; - ipp2=ip; - idp2=ido; - nbd=(ido-1)>>1; - t0=l1*ido; - t10=ip*ido; - - if(ido==1)goto L119; - for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik]; - - t1=0; - for(j=1;j<ip;j++){ - t1+=t0; - t2=t1; - for(k=0;k<l1;k++){ - ch[t2]=c1[t2]; - t2+=ido; - } - } - - is=-ido; - t1=0; - if(nbd>l1){ - for(j=1;j<ip;j++){ - t1+=t0; - is+=ido; - t2= -ido+t1; - for(k=0;k<l1;k++){ - idij=is-1; - t2+=ido; - t3=t2; - for(i=2;i<ido;i+=2){ - idij+=2; - t3+=2; - ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; - ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; - } - } - } - }else{ - - for(j=1;j<ip;j++){ - is+=ido; - idij=is-1; - t1+=t0; - t2=t1; - for(i=2;i<ido;i+=2){ - idij+=2; - t2+=2; - t3=t2; - for(k=0;k<l1;k++){ - ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; - ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; - t3+=ido; - } - } - } - } - - t1=0; - t2=ipp2*t0; - if(nbd<l1){ - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5=t3-ido; - t6=t4-ido; - for(k=0;k<l1;k++){ - t5+=ido; - t6+=ido; - c1[t5-1]=ch[t5-1]+ch[t6-1]; - c1[t6-1]=ch[t5]-ch[t6]; - c1[t5]=ch[t5]+ch[t6]; - c1[t6]=ch[t6-1]-ch[t5-1]; - } - } - } - }else{ - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - c1[t5-1]=ch[t5-1]+ch[t6-1]; - c1[t6-1]=ch[t5]-ch[t6]; - c1[t5]=ch[t5]+ch[t6]; - c1[t6]=ch[t6-1]-ch[t5-1]; - } - t3+=ido; - t4+=ido; - } - } - } - -L119: - for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; - - t1=0; - t2=ipp2*idl1; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1-ido; - t4=t2-ido; - for(k=0;k<l1;k++){ - t3+=ido; - t4+=ido; - c1[t3]=ch[t3]+ch[t4]; - c1[t4]=ch[t4]-ch[t3]; - } - } - - ar1=1.f; - ai1=0.f; - t1=0; - t2=ipp2*idl1; - t3=(ip-1)*idl1; - for(l=1;l<ipph;l++){ - t1+=idl1; - t2-=idl1; - ar1h=dcp*ar1-dsp*ai1; - ai1=dcp*ai1+dsp*ar1; - ar1=ar1h; - t4=t1; - t5=t2; - t6=t3; - t7=idl1; - - for(ik=0;ik<idl1;ik++){ - ch2[t4++]=c2[ik]+ar1*c2[t7++]; - ch2[t5++]=ai1*c2[t6++]; - } - - dc2=ar1; - ds2=ai1; - ar2=ar1; - ai2=ai1; - - t4=idl1; - t5=(ipp2-1)*idl1; - for(j=2;j<ipph;j++){ - t4+=idl1; - t5-=idl1; - - ar2h=dc2*ar2-ds2*ai2; - ai2=dc2*ai2+ds2*ar2; - ar2=ar2h; - - t6=t1; - t7=t2; - t8=t4; - t9=t5; - for(ik=0;ik<idl1;ik++){ - ch2[t6++]+=ar2*c2[t8++]; - ch2[t7++]+=ai2*c2[t9++]; - } - } - } - - t1=0; - for(j=1;j<ipph;j++){ - t1+=idl1; - t2=t1; - for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++]; - } - - if(ido<l1)goto L132; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t4=t2; - for(i=0;i<ido;i++)cc[t4++]=ch[t3++]; - t1+=ido; - t2+=t10; - } - - goto L135; - - L132: - for(i=0;i<ido;i++){ - t1=i; - t2=i; - for(k=0;k<l1;k++){ - cc[t2]=ch[t1]; - t1+=ido; - t2+=t10; - } - } - - L135: - t1=0; - t2=ido<<1; - t3=0; - t4=ipp2*t0; - for(j=1;j<ipph;j++){ - - t1+=t2; - t3+=t0; - t4-=t0; - - t5=t1; - t6=t3; - t7=t4; - - for(k=0;k<l1;k++){ - cc[t5-1]=ch[t6]; - cc[t5]=ch[t7]; - t5+=t10; - t6+=ido; - t7+=ido; - } - } - - if(ido==1)return; - if(nbd<l1)goto L141; - - t1=-ido; - t3=0; - t4=0; - t5=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t2; - t3+=t2; - t4+=t0; - t5-=t0; - t6=t1; - t7=t3; - t8=t4; - t9=t5; - for(k=0;k<l1;k++){ - for(i=2;i<ido;i+=2){ - ic=idp2-i; - cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1]; - cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1]; - cc[i+t7]=ch[i+t8]+ch[i+t9]; - cc[ic+t6]=ch[i+t9]-ch[i+t8]; - } - t6+=t10; - t7+=t10; - t8+=ido; - t9+=ido; - } - } - return; - - L141: - - t1=-ido; - t3=0; - t4=0; - t5=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t2; - t3+=t2; - t4+=t0; - t5-=t0; - for(i=2;i<ido;i+=2){ - t6=idp2+t1-i; - t7=i+t3; - t8=i+t4; - t9=i+t5; - for(k=0;k<l1;k++){ - cc[t7-1]=ch[t8-1]+ch[t9-1]; - cc[t6-1]=ch[t8-1]-ch[t9-1]; - cc[t7]=ch[t8]+ch[t9]; - cc[t6]=ch[t9]-ch[t8]; - t6+=t10; - t7+=t10; - t8+=ido; - t9+=ido; - } - } - } -} - -static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){ - int i,k1,l1,l2; - int na,kh,nf; - int ip,iw,ido,idl1,ix2,ix3; - - nf=ifac[1]; - na=1; - l2=n; - iw=n; - - for(k1=0;k1<nf;k1++){ - kh=nf-k1; - ip=ifac[kh+1]; - l1=l2/ip; - ido=n/l2; - idl1=ido*l1; - iw-=(ip-1)*ido; - na=1-na; - - if(ip!=4)goto L102; - - ix2=iw+ido; - ix3=ix2+ido; - if(na!=0) - dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); - else - dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); - goto L110; - - L102: - if(ip!=2)goto L104; - if(na!=0)goto L103; - - dradf2(ido,l1,c,ch,wa+iw-1); - goto L110; - - L103: - dradf2(ido,l1,ch,c,wa+iw-1); - goto L110; - - L104: - if(ido==1)na=1-na; - if(na!=0)goto L109; - - dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); - na=1; - goto L110; - - L109: - dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); - na=0; - - L110: - l2=l1; - } - - if(na==1)return; - - for(i=0;i<n;i++)c[i]=ch[i]; -} - -static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){ - int i,k,t0,t1,t2,t3,t4,t5,t6; - float ti2,tr2; - - t0=l1*ido; - - t1=0; - t2=0; - t3=(ido<<1)-1; - for(k=0;k<l1;k++){ - ch[t1]=cc[t2]+cc[t3+t2]; - ch[t1+t0]=cc[t2]-cc[t3+t2]; - t2=(t1+=ido)<<1; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t5=(t4=t2)+(ido<<1); - t6=t0+t1; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5-=2; - t6+=2; - ch[t3-1]=cc[t4-1]+cc[t5-1]; - tr2=cc[t4-1]-cc[t5-1]; - ch[t3]=cc[t4]-cc[t5]; - ti2=cc[t4]+cc[t5]; - ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2; - ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2; - } - t2=(t1+=ido)<<1; - } - - if(ido%2==1)return; - -L105: - t1=ido-1; - t2=ido-1; - for(k=0;k<l1;k++){ - ch[t1]=cc[t2]+cc[t2]; - ch[t1+t0]=-(cc[t2+1]+cc[t2+1]); - t1+=ido; - t2+=ido<<1; - } -} - -static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2){ - static float taur = -.5f; - static float taui = .8660254037844386f; - int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; - float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2; - t0=l1*ido; - - t1=0; - t2=t0<<1; - t3=ido<<1; - t4=ido+(ido<<1); - t5=0; - for(k=0;k<l1;k++){ - tr2=cc[t3-1]+cc[t3-1]; - cr2=cc[t5]+(taur*tr2); - ch[t1]=cc[t5]+tr2; - ci3=taui*(cc[t3]+cc[t3]); - ch[t1+t0]=cr2-ci3; - ch[t1+t2]=cr2+ci3; - t1+=ido; - t3+=t4; - t5+=t4; - } - - if(ido==1)return; - - t1=0; - t3=ido<<1; - for(k=0;k<l1;k++){ - t7=t1+(t1<<1); - t6=(t5=t7+t3); - t8=t1; - t10=(t9=t1+t0)+t0; - - for(i=2;i<ido;i+=2){ - t5+=2; - t6-=2; - t7+=2; - t8+=2; - t9+=2; - t10+=2; - tr2=cc[t5-1]+cc[t6-1]; - cr2=cc[t7-1]+(taur*tr2); - ch[t8-1]=cc[t7-1]+tr2; - ti2=cc[t5]-cc[t6]; - ci2=cc[t7]+(taur*ti2); - ch[t8]=cc[t7]+ti2; - cr3=taui*(cc[t5-1]-cc[t6-1]); - ci3=taui*(cc[t5]+cc[t6]); - dr2=cr2-ci3; - dr3=cr2+ci3; - di2=ci2+cr3; - di3=ci2-cr3; - ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2; - ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2; - ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3; - ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3; - } - t1+=ido; - } -} - -static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2,float *wa3){ - static float sqrt2=1.414213562373095f; - int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; - float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; - t0=l1*ido; - - t1=0; - t2=ido<<2; - t3=0; - t6=ido<<1; - for(k=0;k<l1;k++){ - t4=t3+t6; - t5=t1; - tr3=cc[t4-1]+cc[t4-1]; - tr4=cc[t4]+cc[t4]; - tr1=cc[t3]-cc[(t4+=t6)-1]; - tr2=cc[t3]+cc[t4-1]; - ch[t5]=tr2+tr3; - ch[t5+=t0]=tr1-tr4; - ch[t5+=t0]=tr2-tr3; - ch[t5+=t0]=tr1+tr4; - t1+=ido; - t3+=t2; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - for(k=0;k<l1;k++){ - t5=(t4=(t3=(t2=t1<<2)+t6))+t6; - t7=t1; - for(i=2;i<ido;i+=2){ - t2+=2; - t3+=2; - t4-=2; - t5-=2; - t7+=2; - ti1=cc[t2]+cc[t5]; - ti2=cc[t2]-cc[t5]; - ti3=cc[t3]-cc[t4]; - tr4=cc[t3]+cc[t4]; - tr1=cc[t2-1]-cc[t5-1]; - tr2=cc[t2-1]+cc[t5-1]; - ti4=cc[t3-1]-cc[t4-1]; - tr3=cc[t3-1]+cc[t4-1]; - ch[t7-1]=tr2+tr3; - cr3=tr2-tr3; - ch[t7]=ti2+ti3; - ci3=ti2-ti3; - cr2=tr1-tr4; - cr4=tr1+tr4; - ci2=ti1+ti4; - ci4=ti1-ti4; - - ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2; - ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2; - ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3; - ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3; - ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4; - ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4; - } - t1+=ido; - } - - if(ido%2 == 1)return; - - L105: - - t1=ido; - t2=ido<<2; - t3=ido-1; - t4=ido+(ido<<1); - for(k=0;k<l1;k++){ - t5=t3; - ti1=cc[t1]+cc[t4]; - ti2=cc[t4]-cc[t1]; - tr1=cc[t1-1]-cc[t4-1]; - tr2=cc[t1-1]+cc[t4-1]; - ch[t5]=tr2+tr2; - ch[t5+=t0]=sqrt2*(tr1-ti1); - ch[t5+=t0]=ti2+ti2; - ch[t5+=t0]=-sqrt2*(tr1+ti1); - - t3+=ido; - t1+=t2; - t4+=t2; - } -} - -static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1, - float *c2,float *ch,float *ch2,float *wa){ - static float tpi=6.283185307179586f; - int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10, - t11,t12; - float dc2,ai1,ai2,ar1,ar2,ds2; - int nbd; - float dcp,arg,dsp,ar1h,ar2h; - int ipp2; - - t10=ip*ido; - t0=l1*ido; - arg=tpi/(float)ip; - dcp=cos(arg); - dsp=sin(arg); - nbd=(ido-1)>>1; - ipp2=ip; - ipph=(ip+1)>>1; - if(ido<l1)goto L103; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t4=t2; - for(i=0;i<ido;i++){ - ch[t3]=cc[t4]; - t3++; - t4++; - } - t1+=ido; - t2+=t10; - } - goto L106; - - L103: - t1=0; - for(i=0;i<ido;i++){ - t2=t1; - t3=t1; - for(k=0;k<l1;k++){ - ch[t2]=cc[t3]; - t2+=ido; - t3+=t10; - } - t1++; - } - - L106: - t1=0; - t2=ipp2*t0; - t7=(t5=ido<<1); - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - t6=t5; - for(k=0;k<l1;k++){ - ch[t3]=cc[t6-1]+cc[t6-1]; - ch[t4]=cc[t6]+cc[t6]; - t3+=ido; - t4+=ido; - t6+=t10; - } - t5+=t7; - } - - if (ido == 1)goto L116; - if(nbd<l1)goto L112; - - t1=0; - t2=ipp2*t0; - t7=0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - - t7+=(ido<<1); - t8=t7; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - t9=t8; - t11=t8; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - t9+=2; - t11-=2; - ch[t5-1]=cc[t9-1]+cc[t11-1]; - ch[t6-1]=cc[t9-1]-cc[t11-1]; - ch[t5]=cc[t9]-cc[t11]; - ch[t6]=cc[t9]+cc[t11]; - } - t3+=ido; - t4+=ido; - t8+=t10; - } - } - goto L116; - - L112: - t1=0; - t2=ipp2*t0; - t7=0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - t7+=(ido<<1); - t8=t7; - t9=t7; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t8+=2; - t9-=2; - t5=t3; - t6=t4; - t11=t8; - t12=t9; - for(k=0;k<l1;k++){ - ch[t5-1]=cc[t11-1]+cc[t12-1]; - ch[t6-1]=cc[t11-1]-cc[t12-1]; - ch[t5]=cc[t11]-cc[t12]; - ch[t6]=cc[t11]+cc[t12]; - t5+=ido; - t6+=ido; - t11+=t10; - t12+=t10; - } - } - } - -L116: - ar1=1.f; - ai1=0.f; - t1=0; - t9=(t2=ipp2*idl1); - t3=(ip-1)*idl1; - for(l=1;l<ipph;l++){ - t1+=idl1; - t2-=idl1; - - ar1h=dcp*ar1-dsp*ai1; - ai1=dcp*ai1+dsp*ar1; - ar1=ar1h; - t4=t1; - t5=t2; - t6=0; - t7=idl1; - t8=t3; - for(ik=0;ik<idl1;ik++){ - c2[t4++]=ch2[t6++]+ar1*ch2[t7++]; - c2[t5++]=ai1*ch2[t8++]; - } - dc2=ar1; - ds2=ai1; - ar2=ar1; - ai2=ai1; - - t6=idl1; - t7=t9-idl1; - for(j=2;j<ipph;j++){ - t6+=idl1; - t7-=idl1; - ar2h=dc2*ar2-ds2*ai2; - ai2=dc2*ai2+ds2*ar2; - ar2=ar2h; - t4=t1; - t5=t2; - t11=t6; - t12=t7; - for(ik=0;ik<idl1;ik++){ - c2[t4++]+=ar2*ch2[t11++]; - c2[t5++]+=ai2*ch2[t12++]; - } - } - } - - t1=0; - for(j=1;j<ipph;j++){ - t1+=idl1; - t2=t1; - for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++]; - } - - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - ch[t3]=c1[t3]-c1[t4]; - ch[t4]=c1[t3]+c1[t4]; - t3+=ido; - t4+=ido; - } - } - - if(ido==1)goto L132; - if(nbd<l1)goto L128; - - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - ch[t5-1]=c1[t5-1]-c1[t6]; - ch[t6-1]=c1[t5-1]+c1[t6]; - ch[t5]=c1[t5]+c1[t6-1]; - ch[t6]=c1[t5]-c1[t6-1]; - } - t3+=ido; - t4+=ido; - } - } - goto L132; - - L128: - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5=t3; - t6=t4; - for(k=0;k<l1;k++){ - ch[t5-1]=c1[t5-1]-c1[t6]; - ch[t6-1]=c1[t5-1]+c1[t6]; - ch[t5]=c1[t5]+c1[t6-1]; - ch[t6]=c1[t5]-c1[t6-1]; - t5+=ido; - t6+=ido; - } - } - } - -L132: - if(ido==1)return; - - for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; - - t1=0; - for(j=1;j<ip;j++){ - t2=(t1+=t0); - for(k=0;k<l1;k++){ - c1[t2]=ch[t2]; - t2+=ido; - } - } - - if(nbd>l1)goto L139; - - is= -ido-1; - t1=0; - for(j=1;j<ip;j++){ - is+=ido; - t1+=t0; - idij=is; - t2=t1; - for(i=2;i<ido;i+=2){ - t2+=2; - idij+=2; - t3=t2; - for(k=0;k<l1;k++){ - c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; - c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; - t3+=ido; - } - } - } - return; - - L139: - is= -ido-1; - t1=0; - for(j=1;j<ip;j++){ - is+=ido; - t1+=t0; - t2=t1; - for(k=0;k<l1;k++){ - idij=is; - t3=t2; - for(i=2;i<ido;i+=2){ - idij+=2; - t3+=2; - c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; - c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; - } - t2+=ido; - } - } -} - -static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){ - int i,k1,l1,l2; - int na; - int nf,ip,iw,ix2,ix3,ido,idl1; - - nf=ifac[1]; - na=0; - l1=1; - iw=1; - - for(k1=0;k1<nf;k1++){ - ip=ifac[k1 + 2]; - l2=ip*l1; - ido=n/l2; - idl1=ido*l1; - if(ip!=4)goto L103; - ix2=iw+ido; - ix3=ix2+ido; - - if(na!=0) - dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); - else - dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); - na=1-na; - goto L115; - - L103: - if(ip!=2)goto L106; - - if(na!=0) - dradb2(ido,l1,ch,c,wa+iw-1); - else - dradb2(ido,l1,c,ch,wa+iw-1); - na=1-na; - goto L115; - - L106: - if(ip!=3)goto L109; - - ix2=iw+ido; - if(na!=0) - dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1); - else - dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1); - na=1-na; - goto L115; - - L109: -/* The radix five case can be translated later..... */ -/* if(ip!=5)goto L112; - - ix2=iw+ido; - ix3=ix2+ido; - ix4=ix3+ido; - if(na!=0) - dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); - else - dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); - na=1-na; - goto L115; - - L112:*/ - if(na!=0) - dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); - else - dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); - if(ido==1)na=1-na; - - L115: - l1=l2; - iw+=(ip-1)*ido; - } - - if(na==0)return; - - for(i=0;i<n;i++)c[i]=ch[i]; -} - -void drft_forward(drft_lookup *l,float *data){ - if(l->n==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/src/lib/dl/ext/vorbis/smallft.h b/src/lib/dl/ext/vorbis/smallft.h deleted file mode 100755 index 45649732..00000000 --- a/src/lib/dl/ext/vorbis/smallft.h +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: fft transform - last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $ - - ********************************************************************/ - -#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/src/lib/dl/ext/vorbis/synthesis.c b/src/lib/dl/ext/vorbis/synthesis.c deleted file mode 100755 index 06ae7b1b..00000000 --- a/src/lib/dl/ext/vorbis/synthesis.c +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: single-block PCM synthesis - last mod: $Id: synthesis.c 17474 2010-09-30 03:41:41Z gmaxwell $ - - ********************************************************************/ - -#include <stdio.h> -#include <ext/libogg/ogg.h> -#include "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 ? vb->vd : 0; - private_state *b= vd ? vd->backend_state : 0; - vorbis_info *vi= vd ? vd->vi : 0; - codec_setup_info *ci= vi ? vi->codec_setup : 0; - oggpack_buffer *opb=vb ? &vb->opb : 0; - int type,mode,i; - - if (!vd || !b || !vi || !ci || !opb) { - return OV_EBADPACKET; - } - - /* 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; - if(!ci->mode_param[mode]){ - return(OV_EBADPACKET); - } - - 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;i<vi->channels;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; - if(!ci->mode_param[mode]){ - return(OV_EBADPACKET); - } - - 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/src/lib/dl/ext/vorbis/vorbisenc.c b/src/lib/dl/ext/vorbis/vorbisenc.c deleted file mode 100755 index fdc39cb3..00000000 --- a/src/lib/dl/ext/vorbis/vorbisenc.c +++ /dev/null @@ -1,1215 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: simple programmatic interface for encoder mode setup - last mod: $Id: vorbisenc.c 17028 2010-03-25 05:22:15Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <math.h> - -#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 { - const static_codebook *books[12][4]; -} static_bookblock; - -typedef struct { - int res_type; - int limit_type; /* 0 lowpass limited, 1 point stereo limited */ - int grouping; - const vorbis_info_residue0 *res; - const static_codebook *book_aux; - const static_codebook *book_aux_managed; - const static_bookblock *books_base; - const static_bookblock *books_base_managed; -} vorbis_residue_template; - -typedef struct { - const vorbis_info_mapping0 *map; - const 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; - const double *rate_mapping; - const double *quality_mapping; - int coupling_restriction; - long samplerate_min_restriction; - long samplerate_max_restriction; - - - const int *blocksize_short; - const int *blocksize_long; - - const att3 *psy_tone_masteratt; - const int *psy_tone_0dB; - const int *psy_tone_dBsuppress; - - const vp_adjblock *psy_tone_adj_impulse; - const vp_adjblock *psy_tone_adj_long; - const vp_adjblock *psy_tone_adj_other; - - const noiseguard *psy_noiseguards; - const noise3 *psy_noise_bias_impulse; - const noise3 *psy_noise_bias_padding; - const noise3 *psy_noise_bias_trans; - const noise3 *psy_noise_bias_long; - const int *psy_noise_dBsuppress; - - const compandblock *psy_noise_compand; - const double *psy_noise_compand_short_mapping; - const double *psy_noise_compand_long_mapping; - - const int *psy_noise_normal_start[2]; - const int *psy_noise_normal_partition[2]; - const double *psy_noise_normal_thresh; - - const int *psy_ath_float; - const int *psy_ath_abs; - - const double *psy_lowpass; - - const vorbis_info_psy_global *global_params; - const double *global_mapping; - const adj_stereo *stereo_modes; - - const static_codebook *const *const *const floor_books; - const vorbis_info_floor1 *floor_params; - const int floor_mappings; - const int **floor_mapping_list; - - const vorbis_mapping_template *maps; -} ve_setup_data_template; - -/* a few static coder conventions */ -static const vorbis_info_mode _mode_template[2]={ - {0,0,0,0}, - {1,0,0,1} -}; - -static const 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_44p51.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 const ve_setup_data_template *const setup_list[]={ - &ve_setup_44_stereo, - &ve_setup_44_51, - &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 void vorbis_encode_floor_setup(vorbis_info *vi,int s, - const static_codebook *const *const *const books, - const vorbis_info_floor1 *in, - const 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)); - - /* books */ - { - int partitions=f->partitions; - int maxclass=-1; - int maxbook=-1; - for(i=0;i<partitions;i++) - if(f->partitionclass[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<<f->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++]=(static_codebook *)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, - const vorbis_info_psy_global *in, - const 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, - const highlevel_encode_setup *const hi, - const 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;i<PACKETBLOBS;i++){ - float kHz=p[is].kHz[i]*(1.-ds)+p[is+1].kHz[i]*ds; - g->coupling_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;i<PACKETBLOBS;i++){ - g->coupling_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;i<PACKETBLOBS;i++){ - 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{ - for(i=0;i<PACKETBLOBS;i++){ - g->sliding_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, - const int *nn_start, - const int *nn_partition, - const 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_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, - const att3 *att, - const int *max, - const 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;i<P_BANDS;i++) - p->toneatt[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, - const compandblock *in, - const 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;i<NOISE_COMPAND_LEVELS;i++) - p->noisecompand[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, - const 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, - const int *suppress, - const noise3 *in, - const 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;j<P_NOISECURVES;j++) - for(i=0;i<P_BANDS;i++) - p->noiseoff[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;j<P_NOISECURVES;j++){ - float min=p->noiseoff[j][0]+6; /* the lowest it can go */ - for(i=0;i<P_BANDS;i++){ - p->noiseoff[j][i]+=userbias; - if(p->noiseoff[j][i]<min)p->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,const static_codebook *book){ - int i; - for(i=0;i<ci->books;i++) - if(ci->book_param[i]==book)return(i); - - return(ci->books++); -} - -static void vorbis_encode_blocksize_setup(vorbis_info *vi,double s, - const int *shortb,const 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, - const vorbis_residue_template *res){ - - codec_setup_info *ci=vi->codec_setup; - int i; - - 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; - - r->grouping=res->grouping; - ci->residue_type[number]=res->res_type; - - /* fill in all the books */ - { - int booklist=0,k; - - if(ci->hi.managed){ - for(i=0;i<r->partitions;i++) - for(k=0;k<4;k++) - if(res->books_base_managed->books[i][k]) - r->secondstages[i]|=(1<<k); - - r->groupbook=book_dup_or_new(ci,res->book_aux_managed); - ci->book_param[r->groupbook]=(static_codebook *)res->book_aux_managed; - - for(i=0;i<r->partitions;i++){ - for(k=0;k<4;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]=(static_codebook *)res->books_base_managed->books[i][k]; - } - } - } - - }else{ - - for(i=0;i<r->partitions;i++) - for(k=0;k<4;k++) - if(res->books_base->books[i][k]) - r->secondstages[i]|=(1<<k); - - r->groupbook=book_dup_or_new(ci,res->book_aux); - ci->book_param[r->groupbook]=(static_codebook *)res->book_aux; - - for(i=0;i<r->partitions;i++){ - for(k=0;k<4;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]=(static_codebook *)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. */ - switch(res->limit_type){ - case 1: /* point stereo limited */ - 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; - break; - case 2: /* LFE channel; lowpass at ~ 250Hz */ - freq=250; - break; - default: - /* already set */ - break; - } - - /* 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[number]==2){ - /* residue 2 bundles together multiple channels; used by stereo - and surround. Count the channels in use */ - /* Multiple maps/submaps can point to the same residue. In the case - of residue 2, they all better have the same number of - channels/samples. */ - int j,k,ch=0; - for(i=0;i<ci->maps&&ch==0;i++){ - vorbis_info_mapping0 *mi=(vorbis_info_mapping0 *)ci->map_param[i]; - for(j=0;j<mi->submaps && ch==0;j++) - if(mi->residuesubmap[j]==number) /* we found a submap referencing theis residue backend */ - for(k=0;k<vi->channels;k++) - if(mi->chmuxlist[k]==j) /* this channel belongs to the submap */ - ch++; - } - - r->end=(int)((freq/nyq*blocksize*ch)/r->grouping+.9)* /* round up only if we're well past */ - r->grouping; - /* the blocksize and grouping may disagree at the end */ - if(r->end>blocksize*ch)r->end=blocksize*ch/r->grouping*r->grouping; - - }else{ - - r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */ - r->grouping; - /* the blocksize and grouping may disagree at the end */ - if(r->end>blocksize)r->end=blocksize/r->grouping*r->grouping; - - } - - if(r->end==0)r->end=r->grouping; /* LFE channel */ - - } -} - -/* we assume two maps in this encoder */ -static void vorbis_encode_map_n_res_setup(vorbis_info *vi,double s, - const vorbis_mapping_template *maps){ - - codec_setup_info *ci=vi->codec_setup; - int i,j,is=s,modes=2; - const vorbis_info_mapping0 *map=maps[is].map; - const vorbis_info_mode *mode=_mode_template; - const vorbis_residue_template *res=maps[is].res; - - if(ci->blocksizes[0]==ci->blocksizes[1])modes=1; - - for(i=0;i<modes;i++){ - - ci->map_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;j<map[i].submaps;j++) - vorbis_encode_residue_setup(vi,map[i].residuesubmap[j],i - ,res+map[i].residuesubmap[j]); - } -} - -static double setting_to_approx_bitrate(vorbis_info *vi){ - codec_setup_info *ci=vi->codec_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; - const double *r=setup->rate_mapping; - - if(r==NULL) - return(-1); - - return((r[is]*(1.-ds)+r[is+1]*ds)*ch); -} - -static const void *get_setup_template(long ch,long srate, - double req,int q_or_bitrate, - double *base_setting){ - int i=0,j; - 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; - const 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(req<map[0]){++i;continue;} - if(req>map[setup_list[i]->mappings]){++i;continue;} - for(j=0;j<mappings;j++) - if(req>=map[j] && req<map[j+1])break; - /* an all-points match */ - if(j==mappings) - *base_setting=j-.001; - else{ - float low=map[j]; - float high=map[j+1]; - float del=(req-low)/(high-low); - *base_setting=j+del; - } - - return(setup_list[i]); - } - } - i++; - } - - return 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 i,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 a single long floor, it's 0 */ - for(i=0;i<setup->floor_mappings;i++) - vorbis_encode_floor_setup(vi,hi->base_setting, - setup->floor_books, - setup->floor_params, - setup->floor_mapping_list[i]); - - /* 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->base_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->base_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->base_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->base_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 void vorbis_encode_setup_setting(vorbis_info *vi, - long channels, - long rate){ - int i,is; - codec_setup_info *ci=vi->codec_setup; - highlevel_encode_setup *hi=&ci->hi; - const ve_setup_data_template *setup=hi->setup; - double ds; - - vi->version=0; - vi->channels=channels; - vi->rate=rate; - - hi->impulse_block_p=1; - hi->noise_normalize_p=1; - - is=hi->base_setting; - ds=hi->base_setting-is; - - hi->stereo_point_setting=hi->base_setting; - - if(!hi->lowpass_altered) - 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; - } -} - -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; - - hi->req=quality; - hi->setup=get_setup_template(channels,rate,quality,0,&hi->base_setting); - if(!hi->setup)return OV_EIMPL; - - vorbis_encode_setup_setting(vi,channels,rate); - hi->managed=0; - hi->coupling_p=1; - - return 0; -} - -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; - - 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); - } - } - } - - hi->req=nominal_bitrate; - hi->setup=get_setup_template(channels,rate,nominal_bitrate,1,&hi->base_setting); - if(!hi->setup)return OV_EIMPL; - - vorbis_encode_setup_setting(vi,channels,rate); - - /* initialize management with sane defaults */ - hi->coupling_p=1; - 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(0); - -} - -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_kbps<ai->bitrate_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.; - hi->lowpass_altered=1; - } - 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); - case OV_ECTL_COUPLING_GET: - { - int *iarg=(int *)arg; - *iarg=hi->coupling_p; - } - return(0); - case OV_ECTL_COUPLING_SET: - { - const void *new_template; - double new_base=0.; - int *iarg=(int *)arg; - hi->coupling_p=((*iarg)!=0); - - /* Fetching a new template can alter the base_setting, which - many other parameters are based on. Right now, the only - parameter drawn from the base_setting that can be altered - by an encctl is the lowpass, so that is explictly flagged - to not be overwritten when we fetch a new template and - recompute the dependant settings */ - new_template = get_setup_template(hi->coupling_p?vi->channels:-1, - vi->rate, - hi->req, - hi->managed, - &new_base); - if(!hi->setup)return OV_EIMPL; - hi->setup=new_template; - hi->base_setting=new_base; - vorbis_encode_setup_setting(vi,vi->channels,vi->rate); - } - return(0); - } - return(OV_EIMPL); - } - return(OV_EINVAL); -} diff --git a/src/lib/dl/ext/vorbis/vorbisenc.h b/src/lib/dl/ext/vorbis/vorbisenc.h deleted file mode 100755 index 02332b50..00000000 --- a/src/lib/dl/ext/vorbis/vorbisenc.h +++ /dev/null @@ -1,436 +0,0 @@ -/******************************************************************** - * * - * 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 Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: vorbis encode-engine setup - last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $ - - ********************************************************************/ - -/** \file - * Libvorbisenc is a convenient API for setting up an encoding - * environment using libvorbis. Libvorbisenc encapsulates the - * actions needed to set up the encoder properly. - */ - -#ifndef _OV_ENC_H_ -#define _OV_ENC_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "codec.h" - -/** - * This is the primary function within libvorbisenc for setting up managed - * bitrate modes. - * - * Before this function is called, the \ref vorbis_info - * struct should be initialized by using vorbis_info_init() from the libvorbis - * API. After encoding, vorbis_info_clear() should be called. - * - * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set - * constraints for the encoded file. This function uses these settings to - * select the appropriate encoding mode and set it up. - * - * \param vi Pointer to an initialized \ref vorbis_info struct. - * \param channels The number of channels to be encoded. - * \param rate The sampling rate of the source audio. - * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset. - * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset. - * \param min_bitrate Desired minimum bitrate. -1 indicates unset. - * - * \return Zero for success, and negative values for failure. - * - * \retval 0 Success. - * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption. - * \retval OV_EINVAL Invalid setup request, eg, out of range argument. - * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request. - */ -extern int vorbis_encode_init(vorbis_info *vi, - long channels, - long rate, - - long max_bitrate, - long nominal_bitrate, - long min_bitrate); - -/** - * This function performs step-one of a three-step bitrate-managed encode - * setup. It functions similarly to the one-step setup performed by \ref - * vorbis_encode_init but allows an application to make further encode setup - * tweaks using \ref vorbis_encode_ctl before finally calling \ref - * vorbis_encode_setup_init to complete the setup process. - * - * Before this function is called, the \ref vorbis_info struct should be - * initialized by using vorbis_info_init() from the libvorbis API. After - * encoding, vorbis_info_clear() should be called. - * - * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set - * constraints for the encoded file. This function uses these settings to - * select the appropriate encoding mode and set it up. - * - * \param vi Pointer to an initialized vorbis_info struct. - * \param channels The number of channels to be encoded. - * \param rate The sampling rate of the source audio. - * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset. - * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset. - * \param min_bitrate Desired minimum bitrate. -1 indicates unset. - * - * \return Zero for success, and negative for failure. - * - * \retval 0 Success - * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption. - * \retval OV_EINVAL Invalid setup request, eg, out of range argument. - * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request. - */ -extern int vorbis_encode_setup_managed(vorbis_info *vi, - long channels, - long rate, - - long max_bitrate, - long nominal_bitrate, - long min_bitrate); - -/** - * This function performs step-one of a three-step variable bitrate - * (quality-based) encode setup. It functions similarly to the one-step setup - * performed by \ref vorbis_encode_init_vbr() but allows an application to - * make further encode setup tweaks using \ref vorbis_encode_ctl() before - * finally calling \ref vorbis_encode_setup_init to complete the setup - * process. - * - * Before this function is called, the \ref vorbis_info struct should be - * initialized by using \ref vorbis_info_init() from the libvorbis API. After - * encoding, vorbis_info_clear() should be called. - * - * \param vi Pointer to an initialized vorbis_info struct. - * \param channels The number of channels to be encoded. - * \param rate The sampling rate of the source audio. - * \param quality Desired quality level, currently from -0.1 to 1.0 (lo to hi). - * - * \return Zero for success, and negative values for failure. - * - * \retval 0 Success - * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption. - * \retval OV_EINVAL Invalid setup request, eg, out of range argument. - * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request. - */ -extern int vorbis_encode_setup_vbr(vorbis_info *vi, - long channels, - long rate, - - float quality - ); - -/** - * This is the primary function within libvorbisenc for setting up variable - * bitrate ("quality" based) modes. - * - * - * Before this function is called, the vorbis_info struct should be - * initialized by using vorbis_info_init() from the libvorbis API. After - * encoding, vorbis_info_clear() should be called. - * - * \param vi Pointer to an initialized vorbis_info struct. - * \param channels The number of channels to be encoded. - * \param rate The sampling rate of the source audio. - * \param base_quality Desired quality level, currently from -0.1 to 1.0 (lo to hi). - * - * - * \return Zero for success, or a negative number for failure. - * - * \retval 0 Success - * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption. - * \retval OV_EINVAL Invalid setup request, eg, out of range argument. - * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request. - */ -extern int vorbis_encode_init_vbr(vorbis_info *vi, - long channels, - long rate, - - float base_quality - ); - -/** - * This function performs the last stage of three-step encoding setup, as - * described in the API overview under managed bitrate modes. - * - * Before this function is called, the \ref vorbis_info struct should be - * initialized by using vorbis_info_init() from the libvorbis API, one of - * \ref vorbis_encode_setup_managed() or \ref vorbis_encode_setup_vbr() called to - * initialize the high-level encoding setup, and \ref vorbis_encode_ctl() - * called if necessary to make encoding setup changes. - * vorbis_encode_setup_init() finalizes the highlevel encoding structure into - * a complete encoding setup after which the application may make no further - * setup changes. - * - * After encoding, vorbis_info_clear() should be called. - * - * \param vi Pointer to an initialized \ref vorbis_info struct. - * - * \return Zero for success, and negative values for failure. - * - * \retval 0 Success. - * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption. - * - * \retval OV_EINVAL Attempt to use vorbis_encode_setup_init() without first - * calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to - * initialize the high-level encoding setup - * - */ -extern int vorbis_encode_setup_init(vorbis_info *vi); - -/** - * This function implements a generic interface to miscellaneous encoder - * settings similar to the classic UNIX 'ioctl()' system call. Applications - * may use vorbis_encode_ctl() to query or set bitrate management or quality - * mode details by using one of several \e request arguments detailed below. - * vorbis_encode_ctl() must be called after one of - * vorbis_encode_setup_managed() or vorbis_encode_setup_vbr(). When used - * to modify settings, \ref vorbis_encode_ctl() must be called before \ref - * vorbis_encode_setup_init(). - * - * \param vi Pointer to an initialized vorbis_info struct. - * - * \param number Specifies the desired action; See \ref encctlcodes "the list - * of available requests". - * - * \param arg void * pointing to a data structure matching the request - * argument. - * - * \retval 0 Success. Any further return information (such as the result of a - * query) is placed into the storage pointed to by *arg. - * - * \retval OV_EINVAL Invalid argument, or an attempt to modify a setting after - * calling vorbis_encode_setup_init(). - * - * \retval OV_EIMPL Unimplemented or unknown request - */ -extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); - -/** - * \deprecated This is a deprecated interface. Please use vorbis_encode_ctl() - * with the \ref ovectl_ratemanage2_arg struct and \ref - * OV_ECTL_RATEMANAGE2_GET and \ref OV_ECTL_RATEMANAGE2_SET calls in new code. - * - * The \ref ovectl_ratemanage_arg structure is used with vorbis_encode_ctl() - * and the \ref OV_ECTL_RATEMANAGE_GET, \ref OV_ECTL_RATEMANAGE_SET, \ref - * OV_ECTL_RATEMANAGE_AVG, \ref OV_ECTL_RATEMANAGE_HARD calls in order to - * query and modify specifics of the encoder's bitrate management - * configuration. -*/ -struct ovectl_ratemanage_arg { - int management_active; /**< nonzero if bitrate management is active*/ -/** hard lower limit (in kilobits per second) below which the stream bitrate - will never be allowed for any given bitrate_hard_window seconds of time.*/ - long bitrate_hard_min; -/** hard upper limit (in kilobits per second) above which the stream bitrate - will never be allowed for any given bitrate_hard_window seconds of time.*/ - long bitrate_hard_max; -/** the window period (in seconds) used to regulate the hard bitrate minimum - and maximum*/ - double bitrate_hard_window; -/** soft lower limit (in kilobits per second) below which the average bitrate - tracker will start nudging the bitrate higher.*/ - long bitrate_av_lo; -/** soft upper limit (in kilobits per second) above which the average bitrate - tracker will start nudging the bitrate lower.*/ - long bitrate_av_hi; -/** the window period (in seconds) used to regulate the average bitrate - minimum and maximum.*/ - double bitrate_av_window; -/** Regulates the relative centering of the average and hard windows; in - libvorbis 1.0 and 1.0.1, the hard window regulation overlapped but - followed the average window regulation. In libvorbis 1.1 a bit-reservoir - interface replaces the old windowing interface; the older windowing - interface is simulated and this field has no effect.*/ - double bitrate_av_window_center; -}; - -/** - * \name struct ovectl_ratemanage2_arg - * - * The ovectl_ratemanage2_arg structure is used with vorbis_encode_ctl() and - * the OV_ECTL_RATEMANAGE2_GET and OV_ECTL_RATEMANAGE2_SET calls in order to - * query and modify specifics of the encoder's bitrate management - * configuration. - * -*/ -struct ovectl_ratemanage2_arg { - int management_active; /**< nonzero if bitrate management is active */ -/** Lower allowed bitrate limit in kilobits per second */ - long bitrate_limit_min_kbps; -/** Upper allowed bitrate limit in kilobits per second */ - long bitrate_limit_max_kbps; - long bitrate_limit_reservoir_bits; /**<Size of the bitrate reservoir in bits */ -/** Regulates the bitrate reservoir's preferred fill level in a range from 0.0 - * to 1.0; 0.0 tries to bank bits to buffer against future bitrate spikes, 1.0 - * buffers against future sudden drops in instantaneous bitrate. Default is - * 0.1 - */ - double bitrate_limit_reservoir_bias; -/** Average bitrate setting in kilobits per second */ - long bitrate_average_kbps; -/** Slew rate limit setting for average bitrate adjustment; sets the minimum - * time in seconds the bitrate tracker may swing from one extreme to the - * other when boosting or damping average bitrate. - */ - double bitrate_average_damping; -}; - - -/** - * \name vorbis_encode_ctl() codes - * - * \anchor encctlcodes - * - * These values are passed as the \c number parameter of vorbis_encode_ctl(). - * The type of the referent of that function's \c arg pointer depends on these - * codes. - */ -/*@{*/ - -/** - * Query the current encoder bitrate management setting. - * - *Argument: <tt>struct ovectl_ratemanage2_arg *</tt> - * - * Used to query the current encoder bitrate management setting. Also used to - * initialize fields of an ovectl_ratemanage2_arg structure for use with - * \ref OV_ECTL_RATEMANAGE2_SET. - */ -#define OV_ECTL_RATEMANAGE2_GET 0x14 - -/** - * Set the current encoder bitrate management settings. - * - * Argument: <tt>struct ovectl_ratemanage2_arg *</tt> - * - * Used to set the current encoder bitrate management settings to the values - * listed in the ovectl_ratemanage2_arg. Passing a NULL pointer will disable - * bitrate management. -*/ -#define OV_ECTL_RATEMANAGE2_SET 0x15 - -/** - * Returns the current encoder hard-lowpass setting (kHz) in the double - * pointed to by arg. - * - * Argument: <tt>double *</tt> -*/ -#define OV_ECTL_LOWPASS_GET 0x20 - -/** - * Sets the encoder hard-lowpass to the value (kHz) pointed to by arg. Valid - * lowpass settings range from 2 to 99. - * - * Argument: <tt>double *</tt> -*/ -#define OV_ECTL_LOWPASS_SET 0x21 - -/** - * Returns the current encoder impulse block setting in the double pointed - * to by arg. - * - * Argument: <tt>double *</tt> -*/ -#define OV_ECTL_IBLOCK_GET 0x30 - -/** - * Sets the impulse block bias to the the value pointed to by arg. - * - * Argument: <tt>double *</tt> - * - * Valid range is -15.0 to 0.0 [default]. A negative impulse block bias will - * direct to encoder to use more bits when incoding short blocks that contain - * strong impulses, thus improving the accuracy of impulse encoding. - */ -#define OV_ECTL_IBLOCK_SET 0x31 - -/** - * Returns the current encoder coupling setting in the int pointed - * to by arg. - * - * Argument: <tt>int *</tt> -*/ -#define OV_ECTL_COUPLING_GET 0x40 - -/** - * Enables/disables channel coupling in multichannel encoding according to arg. - * - * Argument: <tt>int *</tt> - * - * Zero disables channel coupling for multichannel inputs, nonzer enables - * channel coupling. Setting has no effect on monophonic encoding or - * multichannel counts that do not offer coupling. At present, coupling is - * available for stereo and 5.1 encoding. - */ -#define OV_ECTL_COUPLING_SET 0x41 - - /* deprecated rate management supported only for compatibility */ - -/** - * Old interface to querying bitrate management settings. - * - * Deprecated after move to bit-reservoir style management in 1.1 rendered - * this interface partially obsolete. - - * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_GET instead. - * - * Argument: <tt>struct ovectl_ratemanage_arg *</tt> - */ -#define OV_ECTL_RATEMANAGE_GET 0x10 -/** - * Old interface to modifying bitrate management settings. - * - * deprecated after move to bit-reservoir style management in 1.1 rendered - * this interface partially obsolete. - * - * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead. - * - * Argument: <tt>struct ovectl_ratemanage_arg *</tt> - */ -#define OV_ECTL_RATEMANAGE_SET 0x11 -/** - * Old interface to setting average-bitrate encoding mode. - * - * Deprecated after move to bit-reservoir style management in 1.1 rendered - * this interface partially obsolete. - * - * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead. - * - * Argument: <tt>struct ovectl_ratemanage_arg *</tt> - */ -#define OV_ECTL_RATEMANAGE_AVG 0x12 -/** - * Old interface to setting bounded-bitrate encoding modes. - * - * deprecated after move to bit-reservoir style management in 1.1 rendered - * this interface partially obsolete. - * - * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead. - * - * Argument: <tt>struct ovectl_ratemanage_arg *</tt> - */ -#define OV_ECTL_RATEMANAGE_HARD 0x13 - -/*@}*/ - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/src/lib/dl/ext/vorbis/vorbisfile.c b/src/lib/dl/ext/vorbis/vorbisfile.c deleted file mode 100755 index 3afbd9d0..00000000 --- a/src/lib/dl/ext/vorbis/vorbisfile.c +++ /dev/null @@ -1,2337 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.c 17573 2010-10-27 14:53:59Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> -#include <string.h> -#include <math.h> - -#include "vorbis/codec.h" - -/* we don't need or want the static callback symbols here */ -#define OV_EXCLUDE_STATIC_CALLBACKS -#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 65536 /* greater-than-page-size granularity seeking */ -#define READSIZE 2048 /* a smaller read size is needed for low-rate streaming. */ - -static long _get_data(OggVorbis_File *vf){ - errno=0; - if(!(vf->callbacks.read_func))return(-1); - if(vf->datasource){ - char *buffer=ogg_sync_buffer(&vf->oy,READSIZE); - long bytes=(vf->callbacks.read_func)(buffer,1,READSIZE,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 int _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){ - if(vf->datasource){ - if(!(vf->callbacks.seek_func)|| - (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET) == -1) - return OV_EREAD; - vf->offset=offset; - ogg_sync_reset(&vf->oy); - }else{ - /* shouldn't happen unless someone writes a broken callback */ - return OV_EFAULT; - } - return 0; -} - -/* 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; - - ret=_seek_helper(vf,begin); - if(ret)return(ret); - - while(vf->offset<end){ - memset(og,0,sizeof(*og)); - ret=_get_next_page(vf,og,end-vf->offset); - if(ret==OV_EREAD)return(OV_EREAD); - if(ret<0){ - break; - }else{ - offset=ret; - } - } - } - - /* In a fully compliant, non-multiplexed stream, we'll still be - holding the last page. In multiplexed (or noncompliant streams), - we will probably have to re-read the last page we saw */ - if(og->header_len==0){ - ret=_seek_helper(vf,offset); - if(ret)return(ret); - - ret=_get_next_page(vf,og,CHUNKSIZE); - if(ret<0) - /* this shouldn't be possible */ - return(OV_EFAULT); - } - - return(offset); -} - -static void _add_serialno(ogg_page *og,long **serialno_list, int *n){ - long s = ogg_page_serialno(og); - (*n)++; - - if(*serialno_list){ - *serialno_list = _ogg_realloc(*serialno_list, sizeof(**serialno_list)*(*n)); - }else{ - *serialno_list = _ogg_malloc(sizeof(**serialno_list)); - } - - (*serialno_list)[(*n)-1] = s; -} - -/* returns nonzero if found */ -static int _lookup_serialno(long s, long *serialno_list, int n){ - if(serialno_list){ - while(n--){ - if(*serialno_list == s) return 1; - serialno_list++; - } - } - return 0; -} - -static int _lookup_page_serialno(ogg_page *og, long *serialno_list, int n){ - long s = ogg_page_serialno(og); - return _lookup_serialno(s,serialno_list,n); -} - -/* performs the same search as _get_prev_page, but prefers pages of - the specified serial number. If a page of the specified serialno is - spotted during the seek-back-and-read-forward, it will return the - info of last page of the matching serial number instead of the very - last page. If no page of the specified serialno is seen, it will - return the info of last page and alter *serialno. */ -static ogg_int64_t _get_prev_page_serial(OggVorbis_File *vf, - long *serial_list, int serial_n, - int *serialno, ogg_int64_t *granpos){ - ogg_page og; - ogg_int64_t begin=vf->offset; - ogg_int64_t end=begin; - ogg_int64_t ret; - - ogg_int64_t prefoffset=-1; - ogg_int64_t offset=-1; - ogg_int64_t ret_serialno=-1; - ogg_int64_t ret_gran=-1; - - while(offset==-1){ - begin-=CHUNKSIZE; - if(begin<0) - begin=0; - - ret=_seek_helper(vf,begin); - if(ret)return(ret); - - while(vf->offset<end){ - ret=_get_next_page(vf,&og,end-vf->offset); - if(ret==OV_EREAD)return(OV_EREAD); - if(ret<0){ - break; - }else{ - ret_serialno=ogg_page_serialno(&og); - ret_gran=ogg_page_granulepos(&og); - offset=ret; - - if(ret_serialno == *serialno){ - prefoffset=ret; - *granpos=ret_gran; - } - - if(!_lookup_serialno(ret_serialno,serial_list,serial_n)){ - /* we fell off the end of the link, which means we seeked - back too far and shouldn't have been looking in that link - to begin with. If we found the preferred serial number, - forget that we saw it. */ - prefoffset=-1; - } - } - } - } - - /* we're not interested in the page... just the serialno and granpos. */ - if(prefoffset>=0)return(prefoffset); - - *serialno = ret_serialno; - *granpos = ret_gran; - return(offset); - -} - -/* 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_list, int *serialno_n, - ogg_page *og_ptr){ - ogg_page og; - ogg_packet op; - int i,ret; - int allbos=0; - - 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; - } - - vorbis_info_init(vi); - vorbis_comment_init(vc); - vf->ready_state=OPENED; - - /* extract the serialnos of all BOS pages + the first set of vorbis - headers we see in the link */ - - while(ogg_page_bos(og_ptr)){ - if(serialno_list){ - if(_lookup_page_serialno(og_ptr,*serialno_list,*serialno_n)){ - /* a dupe serialnumber in an initial header packet set == invalid stream */ - if(*serialno_list)_ogg_free(*serialno_list); - *serialno_list=0; - *serialno_n=0; - ret=OV_EBADHEADER; - goto bail_header; - } - - _add_serialno(og_ptr,serialno_list,serialno_n); - } - - if(vf->ready_state<STREAMSET){ - /* we don't have a vorbis stream in this link yet, so begin - prospective stream setup. We need a stream to get packets */ - ogg_stream_reset_serialno(&vf->os,ogg_page_serialno(og_ptr)); - ogg_stream_pagein(&vf->os,og_ptr); - - if(ogg_stream_packetout(&vf->os,&op) > 0 && - vorbis_synthesis_idheader(&op)){ - /* vorbis header; continue setup */ - vf->ready_state=STREAMSET; - if((ret=vorbis_synthesis_headerin(vi,vc,&op))){ - ret=OV_EBADHEADER; - goto bail_header; - } - } - } - - /* get next page */ - { - ogg_int64_t llret=_get_next_page(vf,og_ptr,CHUNKSIZE); - if(llret==OV_EREAD){ - ret=OV_EREAD; - goto bail_header; - } - if(llret<0){ - ret=OV_ENOTVORBIS; - goto bail_header; - } - - /* if this page also belongs to our vorbis stream, submit it and break */ - if(vf->ready_state==STREAMSET && - vf->os.serialno == ogg_page_serialno(og_ptr)){ - ogg_stream_pagein(&vf->os,og_ptr); - break; - } - } - } - - if(vf->ready_state!=STREAMSET){ - ret = OV_ENOTVORBIS; - goto bail_header; - } - - while(1){ - - i=0; - while(i<2){ /* get a page loop */ - - while(i<2){ /* get a packet loop */ - - 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++; - } - - while(i<2){ - if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){ - ret=OV_EBADHEADER; - goto bail_header; - } - - /* if this page belongs to the correct stream, go parse it */ - if(vf->os.serialno == ogg_page_serialno(og_ptr)){ - ogg_stream_pagein(&vf->os,og_ptr); - break; - } - - /* if we never see the final vorbis headers before the link - ends, abort */ - if(ogg_page_bos(og_ptr)){ - if(allbos){ - ret = OV_EBADHEADER; - goto bail_header; - }else - allbos=1; - } - - /* otherwise, keep looking */ - } - } - - return 0; - } - - bail_header: - vorbis_info_clear(vi); - vorbis_comment_clear(vc); - vf->ready_state=OPENED; - - return ret; -} - -/* Starting from current cursor position, get initial PCM offset of - next page. Consumes the page in the process without decoding - audio, however this is only called during stream parsing upon - seekable open. */ -static ogg_int64_t _initial_pcmoffset(OggVorbis_File *vf, vorbis_info *vi){ - ogg_page og; - ogg_int64_t accumulated=0; - long lastblock=-1; - int result; - int serialno = vf->os.serialno; - - while(1){ - ogg_packet op; - if(_get_next_page(vf,&og,-1)<0) - break; /* should not be possible unless the file is truncated/mangled */ - - if(ogg_page_bos(&og)) break; - if(ogg_page_serialno(&og)!=serialno) continue; - - /* 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(vi,&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? Either a corrupt file or a stream with samples - trimmed off the beginning, a normal occurrence; in both cases set - the offset to zero */ - if(accumulated<0)accumulated=0; - - return accumulated; -} - -/* 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, - ogg_int64_t endgran, - int endserial, - long *currentno_list, - int currentnos, - long m){ - ogg_int64_t pcmoffset; - ogg_int64_t dataoffset=searched; - ogg_int64_t endsearched=end; - ogg_int64_t next=end; - ogg_int64_t searchgran=-1; - ogg_page og; - ogg_int64_t ret,last; - int serialno = vf->os.serialno; - - /* invariants: - we have the headers and serialnos for the link beginning at 'begin' - we have the offset and granpos of the last page in the file (potentially - not a page we care about) - */ - - /* Is the last page in our list of current serialnumbers? */ - if(_lookup_serialno(endserial,currentno_list,currentnos)){ - - /* last page is in the starting serialno list, so we've bisected - down to (or just started with) a single link. Now we need to - find the last vorbis page belonging to the first vorbis stream - for this link. */ - - while(endserial != serialno){ - endserial = serialno; - vf->offset=_get_prev_page_serial(vf,currentno_list,currentnos,&endserial,&endgran); - } - - vf->links=m+1; - if(vf->offsets)_ogg_free(vf->offsets); - if(vf->serialnos)_ogg_free(vf->serialnos); - if(vf->dataoffsets)_ogg_free(vf->dataoffsets); - - vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets)); - vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi)); - vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc)); - vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos)); - vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets)); - vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths)); - - vf->offsets[m+1]=end; - vf->offsets[m]=begin; - vf->pcmlengths[m*2+1]=(endgran<0?0:endgran); - - }else{ - - long *next_serialno_list=NULL; - int next_serialnos=0; - vorbis_info vi; - vorbis_comment vc; - - /* the below guards against garbage seperating the last and - first pages of two links. */ - while(searched<endsearched){ - ogg_int64_t bisect; - - if(endsearched-searched<CHUNKSIZE){ - bisect=searched; - }else{ - bisect=(searched+endsearched)/2; - } - - if(bisect != vf->offset){ - ret=_seek_helper(vf,bisect); - if(ret)return(ret); - } - - last=_get_next_page(vf,&og,-1); - if(last==OV_EREAD)return(OV_EREAD); - if(last<0 || !_lookup_page_serialno(&og,currentno_list,currentnos)){ - endsearched=bisect; - if(last>=0)next=last; - }else{ - searched=vf->offset; - } - } - - /* Bisection point found */ - - /* for the time being, fetch end PCM offset the simple way */ - { - int testserial = serialno+1; - vf->offset = next; - while(testserial != serialno){ - testserial = serialno; - vf->offset=_get_prev_page_serial(vf,currentno_list,currentnos,&testserial,&searchgran); - } - } - - if(vf->offset!=next){ - ret=_seek_helper(vf,next); - if(ret)return(ret); - } - - ret=_fetch_headers(vf,&vi,&vc,&next_serialno_list,&next_serialnos,NULL); - if(ret)return(ret); - serialno = vf->os.serialno; - dataoffset = vf->offset; - - /* this will consume a page, however the next bistection always - starts with a raw seek */ - pcmoffset = _initial_pcmoffset(vf,&vi); - - ret=_bisect_forward_serialno(vf,next,vf->offset,end,endgran,endserial, - next_serialno_list,next_serialnos,m+1); - if(ret)return(ret); - - if(next_serialno_list)_ogg_free(next_serialno_list); - - vf->offsets[m+1]=next; - vf->serialnos[m+1]=serialno; - vf->dataoffsets[m+1]=dataoffset; - - vf->vi[m+1]=vi; - vf->vc[m+1]=vc; - - vf->pcmlengths[m*2+1]=searchgran; - vf->pcmlengths[m*2+2]=pcmoffset; - vf->pcmlengths[m*2+3]-=pcmoffset; - if(vf->pcmlengths[m*2+3]<0)vf->pcmlengths[m*2+3]=0; - } - return(0); -} - -static int _make_decode_ready(OggVorbis_File *vf){ - if(vf->ready_state>STREAMSET)return 0; - if(vf->ready_state<STREAMSET)return OV_EFAULT; - if(vf->seekable){ - 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){ - ogg_int64_t dataoffset=vf->dataoffsets[0],end,endgran=-1; - int endserial=vf->os.serialno; - int serialno=vf->os.serialno; - - /* we're partially open and have a first link header state in - storage in vf */ - - /* fetch initial PCM offset */ - ogg_int64_t pcmoffset = _initial_pcmoffset(vf,vf->vi); - - /* we can seek, so set out learning all about this file */ - if(vf->callbacks.seek_func && vf->callbacks.tell_func){ - (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END); - vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource); - }else{ - vf->offset=vf->end=-1; - } - - /* If seek_func is implemented, tell_func must also be implemented */ - if(vf->end==-1) return(OV_EINVAL); - - /* Get the offset of the last page of the physical bitstream, or, if - we're lucky the last vorbis page of this link as most OggVorbis - files will contain a single logical bitstream */ - end=_get_prev_page_serial(vf,vf->serialnos+2,vf->serialnos[1],&endserial,&endgran); - if(end<0)return(end); - - /* now determine bitstream structure recursively */ - if(_bisect_forward_serialno(vf,0,dataoffset,vf->offset,endgran,endserial, - vf->serialnos+2,vf->serialnos[1],0)<0)return(OV_EREAD); - - vf->offsets[0]=0; - vf->serialnos[0]=serialno; - vf->dataoffsets[0]=dataoffset; - vf->pcmlengths[0]=pcmoffset; - vf->pcmlengths[1]-=pcmoffset; - if(vf->pcmlengths[1]<0)vf->pcmlengths[1]=0; - - return(ov_raw_seek(vf,dataoffset)); -} - -/* 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){ - - if(vf->ready_state==STREAMSET){ - int ret=_make_decode_ready(vf); - if(ret<0)return ret; - } - - /* process a packet if we can. */ - - if(vf->ready_state==INITSET){ - int hs=vorbis_synthesis_halfrate_p(vf->vi); - - 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)<<hs); - 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)<<hs); - - granulepos-=samples; - for(i=0;i<link;i++) - granulepos+=vf->pcmlengths[i*2+1]; - vf->pcm_offset=granulepos; - } - return(1); - } - } - else - break; - } - } - - if(vf->ready_state>=OPENED){ - ogg_int64_t ret; - - while(1){ - /* the loop is not strictly necessary, but there's no sense in - doing the extra checks of the larger loop for the common - case in a multiplexed bistream where the page is simply - part of a different logical bitstream; keep reading until - we get one with the correct serialno */ - - 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; - - if(vf->ready_state==INITSET){ - if(vf->current_serialno!=ogg_page_serialno(&og)){ - - /* two possibilities: - 1) our decoding just traversed a bitstream boundary - 2) another stream is multiplexed into this logical section */ - - if(ogg_page_bos(&og)){ - /* boundary case */ - if(!spanp) - return(OV_EOF); - - _decode_clear(vf); - - if(!vf->seekable){ - vorbis_info_clear(vf->vi); - vorbis_comment_clear(vf->vc); - } - break; - - }else - continue; /* possibility #2 */ - } - } - - break; - } - } - - /* 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_state<STREAMSET){ - if(vf->seekable){ - long 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;link<vf->links;link++) - if(vf->serialnos[link]==serialno)break; - - if(link==vf->links) continue; /* not the desired Vorbis - bitstream section; keep - trying */ - - vf->current_serialno=serialno; - 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,NULL,NULL,&og); - if(ret)return(ret); - vf->current_serialno=vf->os.serialno; - vf->current_link++; - link=0; - } - } - } - - /* the buffered page is the data we want, and we're ready for it; - add it to the stream state */ - 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,const char *initial, - long ibytes, ov_callbacks callbacks){ - int offsettest=((f && callbacks.seek_func)?callbacks.seek_func(f,0,SEEK_CUR):-1); - long *serialno_list=NULL; - int serialno_list_size=0; - 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 (especially 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 */ - - /* Fetch all BOS pages, store the vorbis header and all seen serial - numbers, load subsequent vorbis setup headers */ - if((ret=_fetch_headers(vf,vf->vi,vf->vc,&serialno_list,&serialno_list_size,NULL))<0){ - vf->datasource=NULL; - ov_clear(vf); - }else{ - /* serial number list for first link needs to be held somewhere - for second stage of seekable stream open; this saves having to - seek/reread first link's serialnumber data then. */ - vf->serialnos=_ogg_calloc(serialno_list_size+2,sizeof(*vf->serialnos)); - vf->serialnos[0]=vf->current_serialno=vf->os.serialno; - vf->serialnos[1]=serialno_list_size; - memcpy(vf->serialnos+2,serialno_list,serialno_list_size*sizeof(*vf->serialnos)); - - vf->offsets=_ogg_calloc(1,sizeof(*vf->offsets)); - vf->dataoffsets=_ogg_calloc(1,sizeof(*vf->dataoffsets)); - vf->offsets[0]=0; - vf->dataoffsets[0]=vf->offset; - - vf->ready_state=PARTOPEN; - } - if(serialno_list)_ogg_free(serialno_list); - 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;i<vf->links;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->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, - const 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,const 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); -} - -int ov_fopen(const char *path,OggVorbis_File *vf){ - int ret; - FILE *f = fopen(path,"rb"); - if(!f) return -1; - - ret = ov_open(f,vf,NULL,0); - if(ret) fclose(f); - return ret; -} - - -/* 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->ready_state>STREAMSET){ - /* clear out stream state; dumping the decode machine is needed to - reinit the MDCT lookups. */ - vorbis_dsp_clear(&vf->vd); - vorbis_block_clear(&vf->vb); - vf->ready_state=STREAMSET; - if(vf->pcm_offset>=0){ - ogg_int64_t pos=vf->pcm_offset; - vf->pcm_offset=-1; /* make sure the pos is dumped if unseekable */ - ov_pcm_seek(vf,pos); - } - } - - for(i=0;i<vf->links;i++){ - if(vorbis_synthesis_halfrate(vf->vi+i,flag)){ - if(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, - const char *initial,long ibytes,ov_callbacks callbacks) -{ - return _ov_open1(f,vf,initial,ibytes,callbacks); -} - -int ov_test(FILE *f,OggVorbis_File *vf,const 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<OPENED)return(OV_EINVAL); - if(i>=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;i<vf->links;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_state<OPENED)return(OV_EINVAL); - if(vf->samptrack==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_state<OPENED)return(OV_EINVAL); - if(!vf->seekable || i>=vf->links)return(OV_EINVAL); - if(i<0){ - ogg_int64_t acc=0; - int i; - for(i=0;i<vf->links;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_state<OPENED)return(OV_EINVAL); - if(!vf->seekable || i>=vf->links)return(OV_EINVAL); - if(i<0){ - ogg_int64_t acc=0; - int i; - for(i=0;i<vf->links;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_state<OPENED)return(OV_EINVAL); - if(!vf->seekable || i>=vf->links)return(OV_EINVAL); - if(i<0){ - double acc=0; - int i; - for(i=0;i<vf->links;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; - int ret; - - if(vf->ready_state<OPENED)return(OV_EINVAL); - if(!vf->seekable) - return(OV_ENOSEEK); /* don't dump machine if we can't seek */ - - if(pos<0 || pos>vf->end)return(OV_EINVAL); - - /* is the seek position outside our current link [if any]? */ - if(vf->ready_state>=STREAMSET){ - if(pos<vf->offsets[vf->current_link] || pos>=vf->offsets[vf->current_link+1]) - _decode_clear(vf); /* clear out stream state */ - } - - /* 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); - - ret=_seek_helper(vf,pos); - if(ret)goto seek_error; - - /* 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=0; - int lastflag=0; - int firstflag=0; - ogg_int64_t pagepos=-1; - - 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{ - - /* We can't get a guaranteed correct pcm position out of the - last page in a stream because it might have a 'short' - granpos, which can only be detected in the presence of a - preceding page. However, if the last page is also the first - page, the granpos rules of a first page take precedence. Not - only that, but for first==last, the EOS page must be treated - as if its a normal first page for the stream to open/play. */ - if(lastflag && !firstflag) - 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;i<link;i++) - granulepos+=vf->pcmlengths[i*2+1]; - vf->pcm_offset=granulepos-accblock; - if(vf->pcm_offset<0)vf->pcm_offset=0; - break; - } - lastblock=thisblock; - continue; - }else - ogg_stream_packetout(&vf->os,NULL); - } - } - - if(!lastblock){ - pagepos=_get_next_page(vf,&og,-1); - if(pagepos<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)){ - - /* two possibilities: - 1) our decoding just traversed a bitstream boundary - 2) another stream is multiplexed into this logical section? */ - - if(ogg_page_bos(&og)){ - /* we traversed */ - _decode_clear(vf); /* clear out stream state */ - ogg_stream_clear(&work_os); - } /* else, do nothing; next loop will scoop another page */ - } - } - - if(vf->ready_state<STREAMSET){ - int link; - long serialno = ogg_page_serialno(&og); - - for(link=0;link<vf->links;link++) - if(vf->serialnos[link]==serialno)break; - - if(link==vf->links) continue; /* not the desired Vorbis - bitstream section; keep - trying */ - vf->current_link=link; - vf->current_serialno=serialno; - ogg_stream_reset_serialno(&vf->os,serialno); - ogg_stream_reset_serialno(&work_os,serialno); - vf->ready_state=STREAMSET; - firstflag=(pagepos<=vf->dataoffsets[link]); - } - - ogg_stream_pagein(&vf->os,&og); - ogg_stream_pagein(&work_os,&og); - lastflag=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 preceding 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_state<OPENED)return(OV_EINVAL); - if(!vf->seekable)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 preceding (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(begin<end){ - ogg_int64_t bisect; - - if(end-begin<CHUNKSIZE){ - bisect=begin; - }else{ - /* take a (pretty decent) guess. */ - bisect=begin + - (ogg_int64_t)((double)(target-begintime)*(end-begin)/(endtime-begintime)) - - CHUNKSIZE; - if(bisect<begin+CHUNKSIZE) - bisect=begin; - } - - if(bisect!=vf->offset){ - result=_seek_helper(vf,bisect); - if(result) goto seek_error; - } - - while(begin<end){ - result=_get_next_page(vf,&og,end-vf->offset); - 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; - result=_seek_helper(vf,bisect); - if(result) goto seek_error; - } - }else{ - ogg_int64_t granulepos; - - if(ogg_page_serialno(&og)!=vf->serialnos[link]) - continue; - - granulepos=ogg_page_granulepos(&og); - if(granulepos==-1)continue; - - if(granulepos<target){ - best=result; /* raw offset of packet with granulepos */ - begin=vf->offset; /* 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; - result=_seek_helper(vf,bisect); - if(result) goto seek_error; - }else{ - end=bisect; - endtime=granulepos; - break; - } - } - } - } - } - } - - /* found our page. seek to it, update pcm offset. Easier case than - raw_seek, don't keep packets preceding granulepos. */ - { - ogg_page og; - ogg_packet op; - - /* seek */ - result=_seek_helper(vf,best); - vf->pcm_offset=-1; - if(result) goto seek_error; - result=_get_next_page(vf,&og,-1); - if(result<0) goto seek_error; - - if(link!=vf->current_link){ - /* Different link; dump entire decode machine */ - _decode_clear(vf); - - vf->current_link=link; - vf->current_serialno=vf->serialnos[link]; - 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 - preceding 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. */ - - result=_seek_helper(vf,best); - if(result<0) goto seek_error; - - while(1){ - result=_get_prev_page(vf,&og); - if(result<0) goto seek_error; - if(ogg_page_serialno(&og)==vf->current_serialno && - (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;i<vf->current_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(ogg_page_bos(&og))_decode_clear(vf); - - if(vf->ready_state<STREAMSET){ - long serialno=ogg_page_serialno(&og); - int link; - - for(link=0;link<vf->links;link++) - if(vf->serialnos[link]==serialno)break; - if(link==vf->links) continue; - vf->current_link=link; - - vf->ready_state=STREAMSET; - vf->current_serialno=ogg_page_serialno(&og); - ogg_stream_reset_serialno(&vf->os,serialno); - 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. */ - { - /* note that halfrate could be set differently in each link, but - vorbisfile encoforces all links are set or unset */ - int hs=vorbis_synthesis_halfrate_p(vf->vi); - while(vf->pcm_offset<((pos>>hs)<<hs)){ - ogg_int64_t target=(pos-vf->pcm_offset)>>hs; - long samples=vorbis_synthesis_pcmout(&vf->vd,NULL); - - if(samples>target)samples=target; - vorbis_synthesis_read(&vf->vd,samples); - vf->pcm_offset+=samples<<hs; - - if(samples<target) - if(_fetch_and_process_packet(vf,NULL,1,1)<=0) - vf->pcm_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=0; - double time_total=0.; - - if(vf->ready_state<OPENED)return(OV_EINVAL); - if(!vf->seekable)return(OV_ENOSEEK); - if(seconds<0)return(OV_EINVAL); - - /* which bitstream section does this time offset occur in? */ - for(link=0;link<vf->links;link++){ - double addsec = ov_time_total(vf,link); - if(seconds<time_total+addsec)break; - time_total+=addsec; - pcm_total+=vf->pcmlengths[link*2+1]; - } - - if(link==vf->links)return(OV_EINVAL); - - /* 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=0; - double time_total=0.; - - if(vf->ready_state<OPENED)return(OV_EINVAL); - if(!vf->seekable)return(OV_ENOSEEK); - if(seconds<0)return(OV_EINVAL); - - /* which bitstream section does this time offset occur in? */ - for(link=0;link<vf->links;link++){ - double addsec = ov_time_total(vf,link); - if(seconds<time_total+addsec)break; - time_total+=addsec; - pcm_total+=vf->pcmlengths[link*2+1]; - } - - if(link==vf->links)return(OV_EINVAL); - - /* 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_state<OPENED)return(OV_EINVAL); - return(vf->offset); -} - -/* return PCM offset (sample) of next PCM sample to be read */ -ogg_int64_t ov_pcm_tell(OggVorbis_File *vf){ - if(vf->ready_state<OPENED)return(OV_EINVAL); - return(vf->pcm_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_state<OPENED)return(OV_EINVAL); - if(vf->seekable){ - 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). - - ov_read_filter is exactly the same as ov_read except that it processes - the decoded audio data through a filter before packing it into the - requested format. This gives greater accuracy than applying a filter - after the audio has been converted into integral PCM. - - 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_filter(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream, - void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param){ - int i,j; - int host_endian = host_is_big_endian(); - int hs; - - float **pcm; - long samples; - - if(vf->ready_state<OPENED)return(OV_EINVAL); - - while(1){ - if(vf->ready_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; - - /* Here. */ - if(filter) - filter(pcm,channels,samples,filter_param); - - /* a tight loop to pack each size */ - { - int val; - if(word==1){ - int off=(sgned?0:128); - vorbis_fpu_setround(&fpu); - for(j=0;j<samples;j++) - for(i=0;i<channels;i++){ - val=vorbis_ftoi(pcm[i][j]*128.f); - if(val>127)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;i<channels;i++) { /* It's faster in this order */ - float *src=pcm[i]; - short *dest=((short *)buffer)+i; - for(j=0;j<samples;j++) { - val=vorbis_ftoi(src[j]*32768.f); - if(val>32767)val=32767; - else if(val<-32768)val=-32768; - *dest=val; - dest+=channels; - } - } - vorbis_fpu_restore(fpu); - - }else{ - - vorbis_fpu_setround(&fpu); - for(i=0;i<channels;i++) { - float *src=pcm[i]; - short *dest=((short *)buffer)+i; - for(j=0;j<samples;j++) { - val=vorbis_ftoi(src[j]*32768.f); - if(val>32767)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;j<samples;j++) - for(i=0;i<channels;i++){ - val=vorbis_ftoi(pcm[i][j]*32768.f); - if(val>32767)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;j<samples;j++) - for(i=0;i<channels;i++){ - val=vorbis_ftoi(pcm[i][j]*32768.f); - if(val>32767)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); - hs=vorbis_synthesis_halfrate_p(vf->vi); - vf->pcm_offset+=(samples<<hs); - if(bitstream)*bitstream=vf->current_link; - return(samples*bytespersample); - }else{ - return(samples); - } -} - -long ov_read(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream){ - return ov_read_filter(vf, buffer, length, bigendianp, word, sgned, bitstream, NULL, NULL); -} - -/* 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_state<OPENED)return(OV_EINVAL); - - while(1){ - if(vf->ready_state==INITSET){ - float **pcm; - long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm); - if(samples){ - int hs=vorbis_synthesis_halfrate_p(vf->vi); - if(pcm_channels)*pcm_channels=pcm; - if(samples>length)samples=length; - vorbis_synthesis_read(&vf->vd,samples); - vf->pcm_offset+=samples<<hs; - 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); - -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;j<ch1 && j<ch2;j++){ - float *s=lappcm[j]; - float *d=pcm[j]; - - for(i=0;i<n;i++){ - float wd=w[i]*w[i]; - float ws=1.-wd; - d[i]=d[i]*wd + s[i]*ws; - } - } - /* window from zero */ - for(;j<ch2;j++){ - float *d=pcm[j]; - for(i=0;i<n;i++){ - float wd=w[i]*w[i]; - d[i]=d[i]*wd; - } - } - -} - -/* make sure vf is INITSET */ -static int _ov_initset(OggVorbis_File *vf){ - while(1){ - if(vf->ready_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(lapcount<lapsize){ - int samples=vorbis_synthesis_pcmout(vd,&pcm); - if(samples){ - if(samples>lapsize-lapcount)samples=lapsize-lapcount; - for(i=0;i<vi->channels;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(lapcount<lapsize){ - /* failed to get lapping data from normal decode; pry it from the - postextrapolation buffering, or the second half of the MDCT - from the last packet */ - int samples=vorbis_synthesis_lapout(&vf->vd,&pcm); - if(samples==0){ - for(i=0;i<vi->channels;i++) - memset(lappcm[i]+lapcount,0,sizeof(**pcm)*lapsize-lapcount); - lapcount=lapsize; - }else{ - if(samples>lapsize-lapcount)samples=lapsize-lapcount; - for(i=0;i<vi->channels;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_state<OPENED)return(OV_EINVAL); - if(vf2->ready_state<OPENED)return(OV_EINVAL); - - /* the relevant overlap buffers must be pre-checked and pre-primed - before looking at settings in the event that priming would cross - a bitstream boundary. So, do it now */ - - ret=_ov_initset(vf1); - if(ret)return(ret); - ret=_ov_initprime(vf2); - if(ret)return(ret); - - vi1=ov_info(vf1,-1); - vi2=ov_info(vf2,-1); - hs1=ov_halfrate_p(vf1); - hs2=ov_halfrate_p(vf2); - - lappcm=alloca(sizeof(*lappcm)*vi1->channels); - 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;i<vi1->channels;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); - -#if 0 - _analysis_output_always("pcmL",0,pcm[0],n1*2,0,0,0); - _analysis_output_always("pcmR",0,pcm[1],n1*2,0,0,0); -#endif - - /* 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_state<OPENED)return(OV_EINVAL); - ret=_ov_initset(vf); - if(ret)return(ret); - vi=ov_info(vf,-1); - hs=ov_halfrate_p(vf); - - ch1=vi->channels; - 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;i<ch1;i++) - lappcm[i]=alloca(sizeof(**lappcm)*n1); - _ov_getlap(vf,vi,&vf->vd,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_state<OPENED)return(OV_EINVAL); - ret=_ov_initset(vf); - if(ret)return(ret); - vi=ov_info(vf,-1); - hs=ov_halfrate_p(vf); - - ch1=vi->channels; - 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;i<ch1;i++) - lappcm[i]=alloca(sizeof(**lappcm)*n1); - _ov_getlap(vf,vi,&vf->vd,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/src/lib/dl/ext/vorbis/vorbisfile.h b/src/lib/dl/ext/vorbis/vorbisfile.h deleted file mode 100755 index 9271331e..00000000 --- a/src/lib/dl/ext/vorbis/vorbisfile.h +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $ - - ********************************************************************/ - -#ifndef _OV_FILE_H_ -#define _OV_FILE_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include <stdio.h> -#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; - -#ifndef OV_EXCLUDE_STATIC_CALLBACKS - -/* a few sets of convenient callbacks, especially for use under - * Windows where ov_open_callbacks() should always be used instead of - * ov_open() to avoid problems with incompatible crt.o version linking - * issues. */ - -static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){ - if(f==NULL)return(-1); - -#ifdef __MINGW32__ - return fseeko64(f,off,whence); -#elif defined (_WIN32) - return _fseeki64(f,off,whence); -#else - return fseek(f,off,whence); -#endif -} - -/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as - * static data. That means that every file which includes this header - * will get its own copy of these structs whether it uses them or - * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS. - * These static symbols are essential on platforms such as Windows on - * which several different versions of stdio support may be linked to - * by different DLLs, and we need to be certain we know which one - * we're using (the same one as the main application). - */ - -static ov_callbacks OV_CALLBACKS_DEFAULT = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap, - (int (*)(void *)) fclose, - (long (*)(void *)) ftell -}; - -static ov_callbacks OV_CALLBACKS_NOCLOSE = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap, - (int (*)(void *)) NULL, - (long (*)(void *)) ftell -}; - -static ov_callbacks OV_CALLBACKS_STREAMONLY = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) NULL, - (int (*)(void *)) fclose, - (long (*)(void *)) NULL -}; - -static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = { - (size_t (*)(void *, size_t, size_t, void *)) fread, - (int (*)(void *, ogg_int64_t, int)) NULL, - (int (*)(void *)) NULL, - (long (*)(void *)) NULL -}; - -#endif - -#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 - compatibility; 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_fopen(const char *path,OggVorbis_File *vf); -extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes); -extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, - const char *initial, long ibytes, ov_callbacks callbacks); - -extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes); -extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, - const 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_filter(OggVorbis_File *vf,char *buffer,int length, - int bigendianp,int word,int sgned,int *bitstream, - void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param); -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/src/lib/dl/ext/vorbis/window.c b/src/lib/dl/ext/vorbis/window.c deleted file mode 100755 index efebbfa8..00000000 --- a/src/lib/dl/ext/vorbis/window.c +++ /dev/null @@ -1,2135 +0,0 @@ -/******************************************************************** - * * - * 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-2009 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: window functions - last mod: $Id: window.c 16227 2009-07-08 06:58:46Z xiphmont $ - - ********************************************************************/ - -#include <stdlib.h> -#include <math.h> -#include "os.h" -#include "misc.h" - -static const 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 const 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 const 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 const 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 const 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 const 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 const 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 const 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 const float *const vwin[8] = { - vwin64, - vwin128, - vwin256, - vwin512, - vwin1024, - vwin2048, - vwin4096, - vwin8192, -}; - -const 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); - - { - const float *windowLW=vwin[winno[lW]]; - const 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<leftbegin;i++) - d[i]=0.f; - - for(p=0;i<leftend;i++,p++) - d[i]*=windowLW[p]; - - for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--) - d[i]*=windowNW[p]; - - for(;i<n;i++) - d[i]=0.f; - } -} diff --git a/src/lib/dl/ext/vorbis/window.h b/src/lib/dl/ext/vorbis/window.h deleted file mode 100755 index 192bd9cf..00000000 --- a/src/lib/dl/ext/vorbis/window.h +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************** - * * - * 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-2007 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: window functions - last mod: $Id: window.h 13293 2007-07-24 00:09:47Z xiphmont $ - - ********************************************************************/ - -#ifndef _V_WINDOW_ -#define _V_WINDOW_ - -extern float *_vorbis_window_get(int n); -extern void _vorbis_apply_window(float *d,int *winno,long *blocksizes, - int lW,int W,int nW); - - -#endif diff --git a/src/lib/dl/ext/vorbtool/CLEAN.BAT b/src/lib/dl/ext/vorbtool/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/vorbtool/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/vorbtool/MAKE.BAT b/src/lib/dl/ext/vorbtool/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/vorbtool/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/vorbtool/audio.c b/src/lib/dl/ext/vorbtool/audio.c deleted file mode 100755 index d447c06a..00000000 --- a/src/lib/dl/ext/vorbtool/audio.c +++ /dev/null @@ -1,917 +0,0 @@ -/* OggEnc - ** - ** This program is distributed under the GNU General Public License, version 2. - ** A copy of this license is included with this source. - ** - ** Copyright 2000-2002, Michael Smith <msmith@xiph.org> - ** 2010, Monty <monty@xiph.org> - ** - ** AIFF/AIFC support from OggSquish, (c) 1994-1996 Monty <xiphmont@xiph.org> - **/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <math.h> - -#include "audio.h" -#include "platform.h" -#include "i18n.h" -#include "resample.h" - -#ifdef HAVE_LIBFLAC -#include "flac.h" -#endif - -/* Macros to read header data */ -#define READ_U32_LE(buf) \ - (((buf)[3]<<24)|((buf)[2]<<16)|((buf)[1]<<8)|((buf)[0]&0xff)) - -#define READ_U16_LE(buf) \ - (((buf)[1]<<8)|((buf)[0]&0xff)) - -#define READ_U32_BE(buf) \ - (((buf)[0]<<24)|((buf)[1]<<16)|((buf)[2]<<8)|((buf)[3]&0xff)) - -#define READ_U16_BE(buf) \ - (((buf)[0]<<8)|((buf)[1]&0xff)) - -/* Define the supported formats here */ -input_format formats[] = { - {wav_id, 12, wav_open, wav_close, "wav", N_("WAV file reader")}, - {aiff_id, 12, aiff_open, wav_close, "aiff", N_("AIFF/AIFC file reader")}, -#ifdef HAVE_LIBFLAC - {flac_id, 4, flac_open, flac_close, "flac", N_("FLAC file reader")}, - {oggflac_id, 32, flac_open, flac_close, "ogg", N_("Ogg FLAC file reader")}, -#endif - {NULL, 0, NULL, NULL, NULL, NULL} -}; - -input_format *open_audio_file(FILE *in, oe_enc_opt *opt) -{ - int j=0; - unsigned char *buf=NULL; - int buf_size=0, buf_filled=0; - int size,ret; - - while(formats[j].id_func) - { - size = formats[j].id_data_len; - if(size >= buf_size) - { - buf = realloc(buf, size); - buf_size = size; - } - - if(size > buf_filled) - { - ret = fread(buf+buf_filled, 1, buf_size-buf_filled, in); - buf_filled += ret; - - if(buf_filled < size) - { /* File truncated */ - j++; - continue; - } - } - - if(formats[j].id_func(buf, buf_filled)) - { - /* ok, we now have something that can handle the file */ - if(formats[j].open_func(in, opt, buf, buf_filled)) { - free(buf); - return &formats[j]; - } - } - j++; - } - - free(buf); - - return NULL; -} - -static int seek_forward(FILE *in, unsigned int length) -{ - if(fseek(in, length, SEEK_CUR)) - { - /* Failed. Do it the hard way. */ - unsigned char buf[1024]; - unsigned int seek_needed = length; - int seeked; - while(seek_needed > 0) - { - seeked = fread(buf, 1, seek_needed>1024?1024:seek_needed, in); - if(!seeked) - return 0; /* Couldn't read more, can't read file */ - else - seek_needed -= seeked; - } - } - return 1; -} - - -static int find_wav_chunk(FILE *in, char *type, unsigned int *len) -{ - unsigned char buf[8]; - - while(1) - { - if(fread(buf,1,8,in) < 8) /* Suck down a chunk specifier */ - { - fprintf(stderr, _("Warning: Unexpected EOF in reading WAV header\n")); - return 0; /* EOF before reaching the appropriate chunk */ - } - - if(memcmp(buf, type, 4)) - { - *len = READ_U32_LE(buf+4); - if(!seek_forward(in, *len)) - return 0; - - buf[4] = 0; - fprintf(stderr, _("Skipping chunk of type \"%s\", length %d\n"), buf, *len); - } - else - { - *len = READ_U32_LE(buf+4); - return 1; - } - } -} - -static int find_aiff_chunk(FILE *in, char *type, unsigned int *len) -{ - unsigned char buf[8]; - int restarted = 0; - - while(1) - { - if(fread(buf,1,8,in) <8) - { - if(!restarted) { - /* Handle out of order chunks by seeking back to the start - * to retry */ - restarted = 1; - fseek(in, 12, SEEK_SET); - continue; - } - fprintf(stderr, _("Warning: Unexpected EOF in AIFF chunk\n")); - return 0; - } - - *len = READ_U32_BE(buf+4); - - if(memcmp(buf,type,4)) - { - if((*len) & 0x1) - (*len)++; - - if(!seek_forward(in, *len)) - return 0; - } - else - return 1; - } -} - - - -double read_IEEE80(unsigned char *buf) -{ - int s=buf[0]&0xff; - int e=((buf[0]&0x7f)<<8)|(buf[1]&0xff); - double f=((unsigned long)(buf[2]&0xff)<<24)| - ((buf[3]&0xff)<<16)| - ((buf[4]&0xff)<<8) | - (buf[5]&0xff); - - if(e==32767) - { - if(buf[2]&0x80) - return HUGE_VAL; /* Really NaN, but this won't happen in reality */ - else - { - if(s) - return -HUGE_VAL; - else - return HUGE_VAL; - } - } - - f=ldexp(f,32); - f+= ((buf[6]&0xff)<<24)| - ((buf[7]&0xff)<<16)| - ((buf[8]&0xff)<<8) | - (buf[9]&0xff); - - return ldexp(f, e-16446); -} - -/* AIFF/AIFC support adapted from the old OggSQUISH application */ -int aiff_id(unsigned char *buf, int len) -{ - if(len<12) return 0; /* Truncated file, probably */ - - if(memcmp(buf, "FORM", 4)) - return 0; - - if(memcmp(buf+8, "AIF",3)) - return 0; - - if(buf[11]!='C' && buf[11]!='F') - return 0; - - return 1; -} - -static int aiff_permute_matrix[6][6] = -{ - {0}, /* 1.0 mono */ - {0,1}, /* 2.0 stereo */ - {0,2,1}, /* 3.0 channel ('wide') stereo */ - {0,1,2,3}, /* 4.0 discrete quadraphonic (WARN) */ - {0,2,1,3,4}, /* 5.0 surround (WARN) */ - {0,1,2,3,4,5}, /* 5.1 surround (WARN)*/ -}; - - -int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen) -{ - int aifc; /* AIFC or AIFF? */ - unsigned int len; - unsigned char *buffer; - unsigned char buf2[8]; - aiff_fmt format; - aifffile *aiff = malloc(sizeof(aifffile)); - int i; - - if(buf[11]=='C') - aifc=1; - else - aifc=0; - - if(!find_aiff_chunk(in, "COMM", &len)) - { - fprintf(stderr, _("Warning: No common chunk found in AIFF file\n")); - return 0; /* EOF before COMM chunk */ - } - - if(len < 18) - { - fprintf(stderr, _("Warning: Truncated common chunk in AIFF header\n")); - return 0; /* Weird common chunk */ - } - - buffer = alloca(len); - - if(fread(buffer,1,len,in) < len) - { - fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n")); - return 0; - } - - format.channels = READ_U16_BE(buffer); - format.totalframes = READ_U32_BE(buffer+2); - format.samplesize = READ_U16_BE(buffer+6); - format.rate = (int)read_IEEE80(buffer+8); - - aiff->bigendian = 1; - - if(aifc) - { - if(len < 22) - { - fprintf(stderr, _("Warning: AIFF-C header truncated.\n")); - return 0; - } - - if(!memcmp(buffer+18, "NONE", 4)) - { - aiff->bigendian = 1; - } - else if(!memcmp(buffer+18, "sowt", 4)) - { - aiff->bigendian = 0; - } - else - { - fprintf(stderr, _("Warning: Can't handle compressed AIFF-C (%c%c%c%c)\n"), *(buffer+18), *(buffer+19), *(buffer+20), *(buffer+21)); - return 0; /* Compressed. Can't handle */ - } - } - - if(!find_aiff_chunk(in, "SSND", &len)) - { - fprintf(stderr, _("Warning: No SSND chunk found in AIFF file\n")); - return 0; /* No SSND chunk -> no actual audio */ - } - - if(len < 8) - { - fprintf(stderr, _("Warning: Corrupted SSND chunk in AIFF header\n")); - return 0; - } - - if(fread(buf2,1,8, in) < 8) - { - fprintf(stderr, _("Warning: Unexpected EOF reading AIFF header\n")); - return 0; - } - - format.offset = READ_U32_BE(buf2); - format.blocksize = READ_U32_BE(buf2+4); - - if( format.blocksize == 0 && - (format.samplesize == 16 || format.samplesize == 8)) - { - /* From here on, this is very similar to the wav code. Oh well. */ - - opt->rate = format.rate; - opt->channels = format.channels; - opt->read_samples = wav_read; /* Similar enough, so we use the same */ - opt->total_samples_per_channel = format.totalframes; - - aiff->f = in; - aiff->samplesread = 0; - aiff->channels = format.channels; - aiff->samplesize = format.samplesize; - aiff->totalsamples = format.totalframes; - - if(aiff->channels>3) - fprintf(stderr,"WARNING: AIFF[-C] files with greater than three channels use\n" - "speaker locations incompatable with Vorbis suppound definitions.\n" - "Not performaing channel location mapping.\n"); - - opt->readdata = (void *)aiff; - - aiff->channel_permute = malloc(aiff->channels * sizeof(int)); - if (aiff->channels <= 6) - /* Where we know the mappings, use them. */ - memcpy(aiff->channel_permute, aiff_permute_matrix[aiff->channels-1], - sizeof(int) * aiff->channels); - else - /* Use a default 1-1 mapping */ - for (i=0; i < aiff->channels; i++) - aiff->channel_permute[i] = i; - - seek_forward(in, format.offset); /* Swallow some data */ - return 1; - } - else - { - fprintf(stderr, - _("Warning: OggEnc does not support this type of AIFF/AIFC file\n" - " Must be 8 or 16 bit PCM.\n")); - return 0; - } -} - - -int wav_id(unsigned char *buf, int len) -{ - unsigned int flen; - - if(len<12) return 0; /* Something screwed up */ - - if(memcmp(buf, "RIFF", 4)) - return 0; /* Not wave */ - - flen = READ_U32_LE(buf+4); /* We don't use this */ - - if(memcmp(buf+8, "WAVE",4)) - return 0; /* RIFF, but not wave */ - - return 1; -} - -static int wav_permute_matrix[8][8] = -{ - {0}, /* 1.0 mono */ - {0,1}, /* 2.0 stereo */ - {0,2,1}, /* 3.0 channel ('wide') stereo */ - {0,1,2,3}, /* 4.0 discrete quadraphonic */ - {0,2,1,3,4}, /* 5.0 surround */ - {0,2,1,4,5,3}, /* 5.1 surround */ - {0,2,1,4,5,6,3}, /* 6.1 surround */ - {0,2,1,6,7,4,5,3} /* 7.1 surround (classic theater 8-track) */ -}; - - -int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen) -{ - unsigned char buf[40]; - unsigned int len; - int samplesize; - wav_fmt format; - wavfile *wav = malloc(sizeof(wavfile)); - int i; - - /* Ok. At this point, we know we have a WAV file. Now we have to detect - * whether we support the subtype, and we have to find the actual data - * We don't (for the wav reader) need to use the buffer we used to id this - * as a wav file (oldbuf) - */ - - if(!find_wav_chunk(in, "fmt ", &len)) - return 0; /* EOF */ - - if(len < 16) - { - fprintf(stderr, _("Warning: Unrecognised format chunk in WAV header\n")); - return 0; /* Weird format chunk */ - } - - /* A common error is to have a format chunk that is not 16, 18 or - * 40 bytes in size. This is incorrect, but not fatal, so we only - * warn about it instead of refusing to work with the file. - * Please, if you have a program that's creating format chunks of - * sizes other than 16 or 18 bytes in size, report a bug to the - * author. - */ - if(len!=16 && len!=18 && len!=40) - fprintf(stderr, - _("Warning: INVALID format chunk in wav header.\n" - " Trying to read anyway (may not work)...\n")); - - if(len>40)len=40; - - if(fread(buf,1,len,in) < len) - { - fprintf(stderr, _("Warning: Unexpected EOF in reading WAV header\n")); - return 0; - } - - format.format = READ_U16_LE(buf); - format.channels = READ_U16_LE(buf+2); - format.samplerate = READ_U32_LE(buf+4); - format.bytespersec = READ_U32_LE(buf+8); - format.align = READ_U16_LE(buf+12); - format.samplesize = READ_U16_LE(buf+14); - - if(format.format == -2) /* WAVE_FORMAT_EXTENSIBLE */ - { - if(len<40) - { - fprintf(stderr,"ERROR: Extended WAV format header invalid (too small)\n"); - return 0; - } - - format.mask = READ_U32_LE(buf+20); - /* warn the user if the format mask is not a supported/expected type */ - switch(format.mask){ - case 1539: /* 4.0 using side surround instead of back */ - fprintf(stderr,"WARNING: WAV file uses side surround instead of rear for quadraphonic;\n" - "remapping side speakers to rear in encoding.\n"); - break; - case 1551: /* 5.1 using side instead of rear */ - fprintf(stderr,"WARNING: WAV file uses side surround instead of rear for 5.1;\n" - "remapping side speakers to rear in encoding.\n"); - break; - case 319: /* 6.1 using rear instead of side */ - fprintf(stderr,"WARNING: WAV file uses rear surround instead of side for 6.1;\n" - "remapping rear speakers to side in encoding.\n"); - break; - case 255: /* 7.1 'Widescreen' */ - fprintf(stderr,"WARNING: WAV file is a 7.1 'Widescreen' channel mapping;\n" - "remapping speakers to Vorbis 7.1 format.\n"); - break; - case 0: /* default/undeclared */ - case 1: /* mono */ - case 3: /* stereo */ - case 51: /* quad */ - case 55: /* 5.0 */ - case 63: /* 5.1 */ - case 1807: /* 6.1 */ - case 1599: /* 7.1 */ - break; - default: - fprintf(stderr,"WARNING: Unknown WAV surround channel mask: %d\n" - "blindly mapping speakers using default SMPTE/ITU ordering.\n", - format.mask); - break; - } - format.format = READ_U16_LE(buf+24); - } - - if(!find_wav_chunk(in, "data", &len)) - return 0; /* EOF */ - - if(format.format == 1) - { - samplesize = format.samplesize/8; - opt->read_samples = wav_read; - } - else if(format.format == 3) - { - samplesize = 4; - opt->read_samples = wav_ieee_read; - } - else - { - fprintf(stderr, - _("ERROR: Wav file is unsupported type (must be standard PCM\n" - " or type 3 floating point PCM\n")); - return 0; - } - - if(format.align != format.channels * samplesize) { - /* This is incorrect according to the spec. Warn loudly, then ignore - * this value. - */ - fprintf(stderr, _("Warning: WAV 'block alignment' value is incorrect, " - "ignoring.\n" - "The software that created this file is incorrect.\n")); - } - - if(format.samplesize == samplesize*8 && - (format.samplesize == 24 || format.samplesize == 16 || - format.samplesize == 8 || - (format.samplesize == 32 && format.format == 3))) - { - /* OK, good - we have the one supported format, - now we want to find the size of the file */ - opt->rate = format.samplerate; - opt->channels = format.channels; - - wav->f = in; - wav->samplesread = 0; - wav->bigendian = 0; - wav->channels = format.channels; /* This is in several places. The price - of trying to abstract stuff. */ - wav->samplesize = format.samplesize; - - if(len) - { - opt->total_samples_per_channel = len/(format.channels*samplesize); - } - else - { - long pos; - pos = ftell(in); - if(fseek(in, 0, SEEK_END) == -1) - { - opt->total_samples_per_channel = 0; /* Give up */ - } - else - { - opt->total_samples_per_channel = (ftell(in) - pos)/ - (format.channels*samplesize); - fseek(in,pos, SEEK_SET); - } - } - wav->totalsamples = opt->total_samples_per_channel; - - opt->readdata = (void *)wav; - - wav->channel_permute = malloc(wav->channels * sizeof(int)); - if (wav->channels <= 8) - /* Where we know the mappings, use them. */ - memcpy(wav->channel_permute, wav_permute_matrix[wav->channels-1], - sizeof(int) * wav->channels); - else - /* Use a default 1-1 mapping */ - for (i=0; i < wav->channels; i++) - wav->channel_permute[i] = i; - - return 1; - } - else - { - fprintf(stderr, - _("ERROR: Wav file is unsupported subformat (must be 8,16, or 24 bit PCM\n" - "or floating point PCM\n")); - return 0; - } -} - -long wav_read(void *in, float **buffer, int samples) -{ - wavfile *f = (wavfile *)in; - int sampbyte = f->samplesize / 8; - signed char *buf = alloca(samples*sampbyte*f->channels); - long bytes_read = fread(buf, 1, samples*sampbyte*f->channels, f->f); - int i,j; - long realsamples; - int *ch_permute = f->channel_permute; - - if(f->totalsamples && f->samplesread + - bytes_read/(sampbyte*f->channels) > f->totalsamples) { - bytes_read = sampbyte*f->channels*(f->totalsamples - f->samplesread); - } - - realsamples = bytes_read/(sampbyte*f->channels); - f->samplesread += realsamples; - - if(f->samplesize==8) - { - unsigned char *bufu = (unsigned char *)buf; - for(i = 0; i < realsamples; i++) - { - for(j=0; j < f->channels; j++) - { - buffer[j][i]=((int)(bufu[i*f->channels + ch_permute[j]])-128)/128.0f; - } - } - } - else if(f->samplesize==16) - { - if(!f->bigendian) - { - for(i = 0; i < realsamples; i++) - { - for(j=0; j < f->channels; j++) - { - buffer[j][i] = ((buf[i*2*f->channels + 2*ch_permute[j] + 1]<<8) | - (buf[i*2*f->channels + 2*ch_permute[j]] & 0xff))/32768.0f; - } - } - } - else - { - for(i = 0; i < realsamples; i++) - { - for(j=0; j < f->channels; j++) - { - buffer[j][i]=((buf[i*2*f->channels + 2*ch_permute[j]]<<8) | - (buf[i*2*f->channels + 2*ch_permute[j] + 1] & 0xff))/32768.0f; - } - } - } - } - else if(f->samplesize==24) - { - if(!f->bigendian) { - for(i = 0; i < realsamples; i++) - { - for(j=0; j < f->channels; j++) - { - buffer[j][i] = ((buf[i*3*f->channels + 3*ch_permute[j] + 2] << 16) | - (((unsigned char *)buf)[i*3*f->channels + 3*ch_permute[j] + 1] << 8) | - (((unsigned char *)buf)[i*3*f->channels + 3*ch_permute[j]] & 0xff)) - / 8388608.0f; - - } - } - } - else { - fprintf(stderr, _("Big endian 24 bit PCM data is not currently " - "supported, aborting.\n")); - return 0; - } - } - else { - fprintf(stderr, _("Internal error: attempt to read unsupported " - "bitdepth %d\n"), f->samplesize); - return 0; - } - - return realsamples; -} - -long wav_ieee_read(void *in, float **buffer, int samples) -{ - wavfile *f = (wavfile *)in; - float *buf = alloca(samples*4*f->channels); /* de-interleave buffer */ - long bytes_read = fread(buf,1,samples*4*f->channels, f->f); - int i,j; - long realsamples; - - - if(f->totalsamples && f->samplesread + - bytes_read/(4*f->channels) > f->totalsamples) - bytes_read = 4*f->channels*(f->totalsamples - f->samplesread); - realsamples = bytes_read/(4*f->channels); - f->samplesread += realsamples; - - for(i=0; i < realsamples; i++) - for(j=0; j < f->channels; j++) - buffer[j][i] = buf[i*f->channels + f->channel_permute[j]]; - - return realsamples; -} - - -void wav_close(void *info) -{ - wavfile *f = (wavfile *)info; - free(f->channel_permute); - - free(f); -} - -int raw_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen) -{ - wav_fmt format; /* fake wave header ;) */ - wavfile *wav = malloc(sizeof(wavfile)); - int i; - - /* construct fake wav header ;) */ - format.format = 2; - format.channels = opt->channels; - format.samplerate = opt->rate; - format.samplesize = opt->samplesize; - format.bytespersec = opt->channels * opt->rate * opt->samplesize / 8; - format.align = format.bytespersec; - wav->f = in; - wav->samplesread = 0; - wav->bigendian = opt->endianness; - wav->channels = format.channels; - wav->samplesize = opt->samplesize; - wav->totalsamples = 0; - wav->channel_permute = malloc(wav->channels * sizeof(int)); - for (i=0; i < wav->channels; i++) - wav->channel_permute[i] = i; - - opt->read_samples = wav_read; - opt->readdata = (void *)wav; - opt->total_samples_per_channel = 0; /* raw mode, don't bother */ - return 1; -} - -typedef struct { - res_state resampler; - audio_read_func real_reader; - void *real_readdata; - float **bufs; - int channels; - int bufsize; - int done; -} resampler; - -static long read_resampled(void *d, float **buffer, int samples) -{ - resampler *rs = d; - long in_samples; - int out_samples; - - in_samples = res_push_max_input(&rs->resampler, samples); - if(in_samples > rs->bufsize) - in_samples = rs->bufsize; - - in_samples = rs->real_reader(rs->real_readdata, rs->bufs, in_samples); - - if(in_samples <= 0) { - if(!rs->done) { - rs->done = 1; - out_samples = res_drain(&rs->resampler, buffer); - return out_samples; - } - return 0; - } - - out_samples = res_push(&rs->resampler, buffer, (float const **)rs->bufs, in_samples); - - if(out_samples <= 0) { - fprintf(stderr, _("BUG: Got zero samples from resampler: your file will be truncated. Please report this.\n")); - } - - return out_samples; -} - -int setup_resample(oe_enc_opt *opt) { - resampler *rs = calloc(1, sizeof(resampler)); - int c; - - rs->bufsize = 4096; /* Shrug */ - rs->real_reader = opt->read_samples; - rs->real_readdata = opt->readdata; - rs->bufs = malloc(sizeof(float *) * opt->channels); - rs->channels = opt->channels; - rs->done = 0; - if(res_init(&rs->resampler, rs->channels, opt->resamplefreq, opt->rate, RES_END)) - { - fprintf(stderr, _("Couldn't initialise resampler\n")); - return -1; - } - - for(c=0; c < opt->channels; c++) - rs->bufs[c] = malloc(sizeof(float) * rs->bufsize); - - opt->read_samples = read_resampled; - opt->readdata = rs; - if(opt->total_samples_per_channel) - opt->total_samples_per_channel = (int)((float)opt->total_samples_per_channel * - ((float)opt->resamplefreq/(float)opt->rate)); - opt->rate = opt->resamplefreq; - - return 0; -} - -void clear_resample(oe_enc_opt *opt) { - resampler *rs = opt->readdata; - int i; - - opt->read_samples = rs->real_reader; - opt->readdata = rs->real_readdata; - res_clear(&rs->resampler); - - for(i = 0; i < rs->channels; i++) - free(rs->bufs[i]); - - free(rs->bufs); - - free(rs); -} - -typedef struct { - audio_read_func real_reader; - void *real_readdata; - int channels; - float scale_factor; -} scaler; - -static long read_scaler(void *data, float **buffer, int samples) { - scaler *d = data; - long in_samples = d->real_reader(d->real_readdata, buffer, samples); - int i,j; - - for(i=0; i < d->channels; i++) { - for(j=0; j < in_samples; j++) { - buffer[i][j] *= d->scale_factor; - } - } - - return in_samples; -} - - -void setup_scaler(oe_enc_opt *opt, float scale) { - scaler *d = calloc(1, sizeof(scaler)); - - d->real_reader = opt->read_samples; - d->real_readdata = opt->readdata; - - opt->read_samples = read_scaler; - opt->readdata = d; - d->channels = opt->channels; - d->scale_factor = scale; -} - -void clear_scaler(oe_enc_opt *opt) { - scaler *d = opt->readdata; - - opt->read_samples = d->real_reader; - opt->readdata = d->real_readdata; - - free(d); -} - -typedef struct { - audio_read_func real_reader; - void *real_readdata; - float **bufs; -} downmix; - -static long read_downmix(void *data, float **buffer, int samples) -{ - downmix *d = data; - long in_samples = d->real_reader(d->real_readdata, d->bufs, samples); - int i; - - for(i=0; i < in_samples; i++) { - buffer[0][i] = (d->bufs[0][i] + d->bufs[1][i])*0.5f; - } - - return in_samples; -} - -void setup_downmix(oe_enc_opt *opt) { - downmix *d = calloc(1, sizeof(downmix)); - - if(opt->channels != 2) { - fprintf(stderr, "Internal error! Please report this bug.\n"); - return; - } - - d->bufs = malloc(2 * sizeof(float *)); - d->bufs[0] = malloc(4096 * sizeof(float)); - d->bufs[1] = malloc(4096 * sizeof(float)); - d->real_reader = opt->read_samples; - - d->real_readdata = opt->readdata; - - opt->read_samples = read_downmix; - opt->readdata = d; - - opt->channels = 1; -} -void clear_downmix(oe_enc_opt *opt) { - downmix *d = opt->readdata; - - opt->read_samples = d->real_reader; - opt->readdata = d->real_readdata; - opt->channels = 2; /* other things in cleanup rely on this */ - - free(d->bufs[0]); - free(d->bufs[1]); - free(d->bufs); - free(d); -} - diff --git a/src/lib/dl/ext/vorbtool/audio.h b/src/lib/dl/ext/vorbtool/audio.h deleted file mode 100755 index 82448a47..00000000 --- a/src/lib/dl/ext/vorbtool/audio.h +++ /dev/null @@ -1,72 +0,0 @@ - -#ifndef __AUDIO_H -#define __AUDIO_H - -#include "encode.h" -#include <stdio.h> - -int setup_resample(oe_enc_opt *opt); -void clear_resample(oe_enc_opt *opt); -void setup_downmix(oe_enc_opt *opt); -void clear_downmix(oe_enc_opt *opt); -void setup_scaler(oe_enc_opt *opt, float scale); -void clear_scaler(oe_enc_opt *opt); - -typedef struct -{ - int (*id_func)(unsigned char *buf, int len); /* Returns true if can load file */ - int id_data_len; /* Amount of data needed to id whether this can load the file */ - int (*open_func)(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen); - void (*close_func)(void *); - char *format; - char *description; -} input_format; - - -typedef struct { - short format; - short channels; - int samplerate; - int bytespersec; - short align; - short samplesize; - unsigned int mask; -} wav_fmt; - -typedef struct { - short channels; - short samplesize; - long totalsamples; - long samplesread; - FILE *f; - short bigendian; - int *channel_permute; -} wavfile; - -typedef struct { - short channels; - int totalframes; - short samplesize; - int rate; - int offset; - int blocksize; -} aiff_fmt; - -typedef wavfile aifffile; /* They're the same */ - -input_format *open_audio_file(FILE *in, oe_enc_opt *opt); - -int raw_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen); -int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen); -int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen); -int wav_id(unsigned char *buf, int len); -int aiff_id(unsigned char *buf, int len); -void wav_close(void *); -void raw_close(void *); - -long wav_read(void *, float **buffer, int samples); -long wav_ieee_read(void *, float **buffer, int samples); -long raw_read_stereo(void *, float **buffer, int samples); - -#endif /* __AUDIO_H */ - diff --git a/src/lib/dl/ext/vorbtool/charmaps.h b/src/lib/dl/ext/vorbtool/charmaps.h deleted file mode 100755 index 690d8906..00000000 --- a/src/lib/dl/ext/vorbtool/charmaps.h +++ /dev/null @@ -1,57 +0,0 @@ - -/* - * 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/src/lib/dl/ext/vorbtool/charset.c b/src/lib/dl/ext/vorbtool/charset.c deleted file mode 100755 index 43f543ac..00000000 --- a/src/lib/dl/ext/vorbtool/charset.c +++ /dev/null @@ -1,525 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * - * 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 <config.h> -#endif - -#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */ - -#include <stdlib.h> - -#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 < 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 < (1 << 7)) { - *s++ = wc; - return 1; - } - else if (wc < (1 << 11)) { - *s++ = 0xc0 | (wc >> 6); - *s++ = 0x80 | (wc & 0x3f); - return 2; - } - else if (wc < (1 << 16)) { - *s++ = 0xe0 | (wc >> 12); - *s++ = 0x80 | ((wc >> 6) & 0x3f); - *s++ = 0x80 | (wc & 0x3f); - return 3; - } - else if (wc < (1 << 21)) { - *s++ = 0xf0 | (wc >> 18); - *s++ = 0x80 | ((wc >> 12) & 0x3f); - *s++ = 0x80 | ((wc >> 6) & 0x3f); - *s++ = 0x80 | (wc & 0x3f); - return 4; - } - else if (wc < (1 << 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 < (1 << 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) -{ - return utf8_mbtowc(pwc, s, n); -} - -static int wctomb_utf8(void *map, char *s, int wc) -{ - 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; - - 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) -{ - 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; - - 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) -{ - 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/src/lib/dl/ext/vorbtool/charset.h b/src/lib/dl/ext/vorbtool/charset.h deleted file mode 100755 index b5e2fb73..00000000 --- a/src/lib/dl/ext/vorbtool/charset.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * - * 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 <stdlib.h> - -/* - * 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/src/lib/dl/ext/vorbtool/charset_test.c b/src/lib/dl/ext/vorbtool/charset_test.c deleted file mode 100755 index 7af1b124..00000000 --- a/src/lib/dl/ext/vorbtool/charset_test.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * - * 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 <config.h> -#endif - -#include <assert.h> -#include <string.h> - -#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/src/lib/dl/ext/vorbtool/charsetmap.h b/src/lib/dl/ext/vorbtool/charsetmap.h deleted file mode 100755 index b8125905..00000000 --- a/src/lib/dl/ext/vorbtool/charsetmap.h +++ /dev/null @@ -1,79 +0,0 @@ -/* This file was automatically generated by make_code_map.pl - please don't edit directly - Daniel Resare <noa@metamatrix.se> -*/ -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/src/lib/dl/ext/vorbtool/common.mak b/src/lib/dl/ext/vorbtool/common.mak deleted file mode 100755 index 532e6b37..00000000 --- a/src/lib/dl/ext/vorbtool/common.mak +++ /dev/null @@ -1,56 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -!ifeq TARGET_MSDOS 16 -NO_LIB = 1 -NO_EXE = 1 -!endif -!ifndef NO_EXE -OGGINFO_EXE = $(SUBDIR)$(HPS)ogginfo.exe -OGGDEC_EXE = $(SUBDIR)$(HPS)oggdec.exe -OGGENC_EXE = $(SUBDIR)$(HPS)oggenc.exe -!endif - -NOW_BUILDING = EXT_VORBTOOL_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H - -OBJS = $(SUBDIR)$(HPS)audio.obj $(SUBDIR)$(HPS)easyflac.obj $(SUBDIR)$(HPS)encode.obj $(SUBDIR)$(HPS)flac.obj $(SUBDIR)$(HPS)lyrics.obj $(SUBDIR)$(HPS)oggdec.obj $(SUBDIR)$(HPS)oggenc.obj $(SUBDIR)$(HPS)ogginfo2.obj $(SUBDIR)$(HPS)platform.obj $(SUBDIR)$(HPS)resample.obj $(SUBDIR)$(HPS)skeleton.obj $(SUBDIR)$(HPS)theora.obj $(SUBDIR)$(HPS)charset.obj $(SUBDIR)$(HPS)charset_test.obj $(SUBDIR)$(HPS)getopt1.obj $(SUBDIR)$(HPS)getopt.obj $(SUBDIR)$(HPS)iconvert.obj $(SUBDIR)$(HPS)makemap.obj $(SUBDIR)$(HPS)utf8.obj - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: .symbolic - -exe: $(OGGINFO_EXE) $(OGGDEC_EXE) $(OGGENC_EXE) .symbolic - -!ifdef OGGINFO_EXE -$(OGGINFO_EXE): $(EXT_LIBOGG_LIB) $(EXT_VORBIS_LIB) $(EXT_FLAC_LIB) $(SUBDIR)$(HPS)ogginfo2.obj $(SUBDIR)$(HPS)theora.obj $(SUBDIR)$(HPS)getopt.obj $(SUBDIR)$(HPS)getopt1.obj $(SUBDIR)$(HPS)utf8.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)ogginfo2.obj file $(SUBDIR)$(HPS)theora.obj file $(SUBDIR)$(HPS)getopt.obj file $(SUBDIR)$(HPS)getopt1.obj file $(SUBDIR)$(HPS)utf8.obj $(EXT_LIBOGG_LIB_WLINK_LIBRARIES) $(EXT_VORBIS_LIB_WLINK_LIBRARIES) $(EXT_FLAC_LIB_WLINK_LIBRARIES) name $(OGGINFO_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifdef OGGDEC_EXE -$(OGGDEC_EXE): $(EXT_LIBOGG_LIB) $(EXT_VORBIS_LIB) $(EXT_FLAC_LIB) $(SUBDIR)$(HPS)oggdec.obj $(SUBDIR)$(HPS)getopt.obj $(SUBDIR)$(HPS)getopt1.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)oggdec.obj file $(SUBDIR)$(HPS)getopt.obj file $(SUBDIR)$(HPS)getopt1.obj $(EXT_LIBOGG_LIB_WLINK_LIBRARIES) $(EXT_VORBIS_LIB_WLINK_LIBRARIES) $(EXT_FLAC_LIB_WLINK_LIBRARIES) name $(OGGDEC_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifdef OGGENC_EXE -$(OGGENC_EXE): $(EXT_LIBOGG_LIB) $(EXT_VORBIS_LIB) $(EXT_FLAC_LIB) $(SUBDIR)$(HPS)oggenc.obj $(SUBDIR)$(HPS)getopt.obj $(SUBDIR)$(HPS)getopt1.obj $(SUBDIR)$(HPS)audio.obj $(SUBDIR)$(HPS)easyflac.obj $(SUBDIR)$(HPS)flac.obj $(SUBDIR)$(HPS)lyrics.obj $(SUBDIR)$(HPS)platform.obj $(SUBDIR)$(HPS)resample.obj $(SUBDIR)$(HPS)skeleton.obj $(SUBDIR)$(HPS)encode.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)oggenc.obj file $(SUBDIR)$(HPS)getopt.obj file $(SUBDIR)$(HPS)getopt1.obj file $(SUBDIR)$(HPS)audio.obj file $(SUBDIR)$(HPS)easyflac.obj file $(SUBDIR)$(HPS)flac.obj file $(SUBDIR)$(HPS)lyrics.obj file $(SUBDIR)$(HPS)platform.obj file $(SUBDIR)$(HPS)resample.obj file $(SUBDIR)$(HPS)skeleton.obj file $(SUBDIR)$(HPS)encode.obj $(EXT_LIBOGG_LIB_WLINK_LIBRARIES) $(EXT_VORBIS_LIB_WLINK_LIBRARIES) $(EXT_FLAC_LIB_WLINK_LIBRARIES) name $(OGGENC_EXE) - @wlink @tmp.cmd - upx --best $(OGGENC_EXE) # Whew! OGGENC.EXE comes out as a 1.7MB EXE file! - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/vorbtool/config.h b/src/lib/dl/ext/vorbtool/config.h deleted file mode 100755 index 02e72a1b..00000000 --- a/src/lib/dl/ext/vorbtool/config.h +++ /dev/null @@ -1,445 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -/* #undef CRAY_STACKSEG_END */ - -/* Define to 1 if using `alloca.c'. */ -/* #undef C_ALLOCA */ - -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -#undef ENABLE_NLS - -/* Define to 1 if you have `alloca', as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). - */ -#define HAVE_ALLOCA_H 1 - -/* Define to 1 if you have the `alphasort' function. */ -#define HAVE_ALPHASORT 1 - -/* Define to 1 if you have the `argz_count' function. */ -#define HAVE_ARGZ_COUNT 1 - -/* Define to 1 if you have the <argz.h> header file. */ -#define HAVE_ARGZ_H 1 - -/* Define to 1 if you have the `argz_next' function. */ -#define HAVE_ARGZ_NEXT 1 - -/* Define to 1 if you have the `argz_stringify' function. */ -#define HAVE_ARGZ_STRINGIFY 1 - -/* Define to 1 if you have the `asprintf' function. */ -#define HAVE_ASPRINTF 1 - -/* Define to 1 if you have the `atexit' function. */ -#define HAVE_ATEXIT 1 - -/* Define to 1 if the compiler understands __builtin_expect. */ -#define HAVE_BUILTIN_EXPECT 1 - -/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the - CoreFoundation framework. */ -/* #undef HAVE_CFLOCALECOPYCURRENT */ - -/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in - the CoreFoundation framework. */ -/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ - -/* Define to 1 if you have the `chmod' function. */ -#define HAVE_CHMOD 1 - -/* Defined if we have libcurl */ -#define HAVE_CURL 1 - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#define HAVE_DCGETTEXT 1 - -/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you - don't. */ -#define HAVE_DECL_FEOF_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if - you don't. */ -#define HAVE_DECL_FGETS_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you - don't. */ -#define HAVE_DECL_GETC_UNLOCKED 1 - -/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you - don't. */ -#define HAVE_DECL__SNPRINTF 0 - -/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you - don't. */ -#define HAVE_DECL__SNWPRINTF 0 - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the `fcntl' function. */ -#define HAVE_FCNTL 1 - -/* Define to 1 if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `fwprintf' function. */ -#define HAVE_FWPRINTF 1 - -/* Define to 1 if you have the `getcwd' function. */ -#define HAVE_GETCWD 1 - -/* Define to 1 if you have the `getegid' function. */ -#define HAVE_GETEGID 1 - -/* Define to 1 if you have the `geteuid' function. */ -#define HAVE_GETEUID 1 - -/* Define to 1 if you have the `getgid' function. */ -#define HAVE_GETGID 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#define HAVE_GETTEXT 1 - -/* Define to 1 if you have the `getuid' function. */ -#define HAVE_GETUID 1 - -/* Define if you have the iconv() function. */ -#define HAVE_ICONV 1 - -/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ -#define HAVE_INTMAX_T 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and - declares uintmax_t. */ -#define HAVE_INTTYPES_H_WITH_UINTMAX 1 - -/* Defined if we have libkate */ -/* #undef HAVE_KATE */ - -/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET - -/* Define if your <locale.h> file defines LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Defined if we have libFLAC */ /* TODO! */ -#define HAVE_LIBFLAC 1 - -/* Defined if we have libspeex */ /* TODO! */ -#define HAVE_LIBSPEEX 1 - -/* Define to 1 if you have the <limits.h> header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if the system has the type `long long int'. */ -#define HAVE_LONG_LONG_INT 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mempcpy' function. */ -#define HAVE_MEMPCPY 1 - -/* Define to 1 if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the `munmap' function. */ -#define HAVE_MUNMAP 1 - -/* Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if - _GNU_SOURCE is defined. */ -#define HAVE_NL_LOCALE_NAME 1 - -/* Define to 1 if you have the `on_exit' function. */ -#define HAVE_ON_EXIT 1 - -/* Defined if we have ov_read_filter() */ -#define HAVE_OV_READ_FILTER 1 - -/* Define if your printf() function supports format strings with positions. */ -#define HAVE_POSIX_PRINTF 1 - -/* Define if you have POSIX threads libraries and header files. */ -#define HAVE_PTHREAD 1 - -/* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */ -#define HAVE_PTHREAD_MUTEX_RECURSIVE 1 - -/* Define if the POSIX multithreading library has read/write locks. */ -#define HAVE_PTHREAD_RWLOCK 1 - -/* Define to 1 if you have the `putenv' function. */ -#define HAVE_PUTENV 1 - -/* Define to 1 if you have the `scandir' function. */ -#define HAVE_SCANDIR 1 - -/* Define to 1 if you have the `select' function. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the `setenv' function. */ -#define HAVE_SETENV 1 - -/* Define to 1 if you have the `setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define to 1 if you have the `stat' function. */ -#define HAVE_STAT 1 - -/* Define to 1 if you have the <stddef.h> header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares - uintmax_t. */ -#define HAVE_STDINT_H_WITH_UINTMAX 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `stpcpy' function. */ -#define HAVE_STPCPY 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strtoul' function. */ -#define HAVE_STRTOUL 1 - -/* Define to 1 if you have the <sys/param.h> header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the `tsearch' function. */ -#define HAVE_TSEARCH 1 - -/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */ -#define HAVE_UINTMAX_T 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#define HAVE_UNSIGNED_LONG_LONG_INT 1 - -/* Define to 1 or 0, depending whether the compiler supports simple visibility - declarations. */ -#define HAVE_VISIBILITY 1 - -/* Define if you have the 'wchar_t' type. */ -#define HAVE_WCHAR_T 1 - -/* Define to 1 if you have the `wcslen' function. */ -#define HAVE_WCSLEN 1 - -/* Define if you have the 'wint_t' type. */ -#define HAVE_WINT_T 1 - -/* Define to 1 if you have the `__fsetlocking' function. */ -#define HAVE___FSETLOCKING 1 - -/* Define as const if the declaration of iconv() needs const. */ -#define ICONV_CONST - -/* Define if integer division by zero raises signal SIGFPE. */ -#define INTDIV0_RAISES_SIGFPE 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -#define PACKAGE "vorbis-tools" - -/* 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 if <inttypes.h> exists and defines unusable PRI* macros. */ -/* #undef PRI_MACROS_BROKEN */ - -/* Define to the necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define if the pthread_in_use() detection is hard. */ -/* #undef PTHREAD_IN_USE_DETECTION_HARD */ - -/* Define as the maximum value of type 'size_t', if the system doesn't define - it. */ -/* #undef SIZE_MAX */ - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -/* #undef STACK_DIRECTION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if the POSIX multithreading library can be used. */ -#define USE_POSIX_THREADS 1 - -/* Define if references to the POSIX multithreading library should be made - weak. */ -#define USE_POSIX_THREADS_WEAK 1 - -/* Define if the GNU Pth multithreading library can be used. */ -/* #undef USE_PTH_THREADS */ - -/* Define if references to the GNU Pth multithreading library should be made - weak. */ -/* #undef USE_PTH_THREADS_WEAK */ - -/* Define if the old Solaris multithreading library can be used. */ -/* #undef USE_SOLARIS_THREADS */ - -/* Define if references to the old Solaris multithreading library should be - made weak. */ -/* #undef USE_SOLARIS_THREADS_WEAK */ - -/* Define if the Win32 multithreading API can be used. */ -/* #undef USE_WIN32_THREADS */ - -/* Version number of package */ -#define VERSION "1.4.0" - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -/* # undef _ALL_SOURCE */ -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to 1 if on MINIX. */ -/* #undef _MINIX */ - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -/* #undef _POSIX_1_SOURCE */ - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -/* #undef _POSIX_SOURCE */ - -/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 1 -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS 1 -#endif -#ifndef _TANDEM_SOURCE -# define _TANDEM_SOURCE 1 -#endif - -/* 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 as the type of the result of subtracting two pointers, if the system - doesn't define it. */ -/* #undef ptrdiff_t */ - -/* Define to `unsigned int' if <sys/types.h> does not define. */ -/* #undef size_t */ - -/* Define to unsigned long or unsigned long long if <stdint.h> and - <inttypes.h> don't define. */ -/* #undef uintmax_t */ - - -#define __libc_lock_t gl_lock_t -#define __libc_lock_define gl_lock_define -#define __libc_lock_define_initialized gl_lock_define_initialized -#define __libc_lock_init gl_lock_init -#define __libc_lock_lock gl_lock_lock -#define __libc_lock_unlock gl_lock_unlock -#define __libc_lock_recursive_t gl_recursive_lock_t -#define __libc_lock_define_recursive gl_recursive_lock_define -#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized -#define __libc_lock_init_recursive gl_recursive_lock_init -#define __libc_lock_lock_recursive gl_recursive_lock_lock -#define __libc_lock_unlock_recursive gl_recursive_lock_unlock -#define glthread_in_use libintl_thread_in_use -#define glthread_lock_init libintl_lock_init -#define glthread_lock_lock libintl_lock_lock -#define glthread_lock_unlock libintl_lock_unlock -#define glthread_lock_destroy libintl_lock_destroy -#define glthread_rwlock_init libintl_rwlock_init -#define glthread_rwlock_rdlock libintl_rwlock_rdlock -#define glthread_rwlock_wrlock libintl_rwlock_wrlock -#define glthread_rwlock_unlock libintl_rwlock_unlock -#define glthread_rwlock_destroy libintl_rwlock_destroy -#define glthread_recursive_lock_init libintl_recursive_lock_init -#define glthread_recursive_lock_lock libintl_recursive_lock_lock -#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock -#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy -#define glthread_once libintl_once -#define glthread_once_call libintl_once_call -#define glthread_once_singlethreaded libintl_once_singlethreaded - diff --git a/src/lib/dl/ext/vorbtool/easyflac.c b/src/lib/dl/ext/vorbtool/easyflac.c deleted file mode 100755 index a860f5d6..00000000 --- a/src/lib/dl/ext/vorbtool/easyflac.c +++ /dev/null @@ -1,384 +0,0 @@ -/* EasyFLAC - A thin decoding wrapper around libFLAC and libOggFLAC to - * make your code less ugly. See easyflac.h for explanation. - * - * Copyright 2003 - Stan Seibert <volsung@xiph.org> - * This code is licensed under a BSD style license: - * - * 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. - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <flac/export.h> -#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8) - -#include <stdlib.h> -#include "easyflac.h" - - -FLAC__bool EasyFLAC__is_oggflac(EasyFLAC__StreamDecoder *decoder) -{ - return decoder->is_oggflac; -} - - -EasyFLAC__StreamDecoder *EasyFLAC__stream_decoder_new(FLAC__bool is_oggflac) -{ - EasyFLAC__StreamDecoder *decoder = malloc(sizeof(EasyFLAC__StreamDecoder)); - - if (decoder != NULL) - { - decoder->is_oggflac = is_oggflac; - - if (decoder->is_oggflac) - decoder->oggflac = OggFLAC__stream_decoder_new(); - else - decoder->flac = FLAC__stream_decoder_new(); - - if ( (decoder->is_oggflac && decoder->oggflac == NULL) - ||(!decoder->is_oggflac && decoder->flac == NULL) ) - { - free(decoder); - decoder = NULL; - } - } - - return decoder; -} - - -void EasyFLAC__stream_decoder_delete(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - OggFLAC__stream_decoder_delete(decoder->oggflac); - else - FLAC__stream_decoder_delete(decoder->flac); - - free(decoder); -} - - -/* Wrappers around the callbacks for OggFLAC */ - -FLAC__StreamDecoderReadStatus oggflac_read_callback(const OggFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - return (*e_decoder->callbacks.read)(e_decoder, buffer, bytes, e_decoder->callbacks.client_data); -} - - -FLAC__StreamDecoderWriteStatus oggflac_write_callback(const OggFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - return (*(e_decoder->callbacks.write))(e_decoder, frame, buffer, e_decoder->callbacks.client_data); -} - - -void oggflac_metadata_callback(const OggFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - (*e_decoder->callbacks.metadata)(e_decoder, metadata, e_decoder->callbacks.client_data); -} - - -void oggflac_error_callback(const OggFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - (*e_decoder->callbacks.error)(e_decoder, status, e_decoder->callbacks.client_data); -} - - -/* Wrappers around the callbacks for FLAC */ - -FLAC__StreamDecoderReadStatus flac_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - return (*e_decoder->callbacks.read)(e_decoder, buffer, bytes, e_decoder->callbacks.client_data); -} - - -FLAC__StreamDecoderWriteStatus flac_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - return (*e_decoder->callbacks.write)(e_decoder, frame, buffer, e_decoder->callbacks.client_data); -} - - -void flac_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - (*e_decoder->callbacks.metadata)(e_decoder, metadata, e_decoder->callbacks.client_data); -} - - -void flac_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - EasyFLAC__StreamDecoder *e_decoder = (EasyFLAC__StreamDecoder *) client_data; - - (*e_decoder->callbacks.error)(e_decoder, status, e_decoder->callbacks.client_data); -} - - -FLAC__bool EasyFLAC__set_read_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderReadCallback value) -{ - decoder->callbacks.read = value; - - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_read_callback(decoder->oggflac, &oggflac_read_callback); - else - return FLAC__stream_decoder_set_read_callback(decoder->flac, &flac_read_callback); -} - - -FLAC__bool EasyFLAC__set_write_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderWriteCallback value) -{ - decoder->callbacks.write = value; - - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_write_callback(decoder->oggflac, &oggflac_write_callback); - else - return FLAC__stream_decoder_set_write_callback(decoder->flac, &flac_write_callback); -} - - -FLAC__bool EasyFLAC__set_metadata_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderMetadataCallback value) -{ - decoder->callbacks.metadata = value; - - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_metadata_callback(decoder->oggflac, &oggflac_metadata_callback); - else - return FLAC__stream_decoder_set_metadata_callback(decoder->flac, &flac_metadata_callback); -} - - -FLAC__bool EasyFLAC__set_error_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderErrorCallback value) -{ - decoder->callbacks.error = value; - - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_error_callback(decoder->oggflac, &oggflac_error_callback); - else - return FLAC__stream_decoder_set_error_callback(decoder->flac, &flac_error_callback); -} - - -FLAC__bool EasyFLAC__set_client_data(EasyFLAC__StreamDecoder *decoder, void *value) -{ - decoder->callbacks.client_data = value; - - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_client_data(decoder->oggflac, decoder); - else - return FLAC__stream_decoder_set_client_data(decoder->flac, decoder); -} - - -FLAC__bool EasyFLAC__set_metadata_respond(EasyFLAC__StreamDecoder *decoder, FLAC__MetadataType type) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_metadata_respond(decoder->oggflac, type); - else - return FLAC__stream_decoder_set_metadata_respond(decoder->flac, type); -} - - -FLAC__bool EasyFLAC__set_metadata_respond_application(EasyFLAC__StreamDecoder *decoder, const FLAC__byte id[4]) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_metadata_respond_application(decoder->oggflac, id); - else - return FLAC__stream_decoder_set_metadata_respond_application(decoder->flac, id); -} - - -FLAC__bool EasyFLAC__set_metadata_respond_all(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_metadata_respond_all(decoder->oggflac); - else - return FLAC__stream_decoder_set_metadata_respond_all(decoder->flac); -} - - -FLAC__bool EasyFLAC__set_metadata_ignore(EasyFLAC__StreamDecoder *decoder, FLAC__MetadataType type) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_metadata_ignore(decoder->oggflac, type); - else - return FLAC__stream_decoder_set_metadata_ignore(decoder->flac, type); -} - - -FLAC__bool EasyFLAC__set_metadata_ignore_application(EasyFLAC__StreamDecoder *decoder, const FLAC__byte id[4]) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_metadata_ignore_application(decoder->oggflac, id); - else - return FLAC__stream_decoder_set_metadata_ignore_application(decoder->flac, id); -} - -FLAC__bool EasyFLAC__set_metadata_ignore_all(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_set_metadata_ignore_all(decoder->oggflac); - else - return FLAC__stream_decoder_set_metadata_ignore_all(decoder->flac); -} - - -FLAC__StreamDecoderState EasyFLAC__get_state(const EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(decoder->oggflac); - else - return FLAC__stream_decoder_get_state(decoder->flac); -} - - -unsigned EasyFLAC__get_channels(const EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_get_channels(decoder->oggflac); - else - return FLAC__stream_decoder_get_channels(decoder->flac); -} - - -FLAC__ChannelAssignment EasyFLAC__get_channel_assignment(const EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_get_channel_assignment(decoder->oggflac); - else - return FLAC__stream_decoder_get_channel_assignment(decoder->flac); -} - - -unsigned EasyFLAC__get_bits_per_sample(const EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_get_bits_per_sample(decoder->oggflac); - else - return FLAC__stream_decoder_get_bits_per_sample(decoder->flac); -} - - -unsigned EasyFLAC__get_sample_rate(const EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_get_sample_rate(decoder->oggflac); - else - return FLAC__stream_decoder_get_sample_rate(decoder->flac); -} - - -unsigned EasyFLAC__get_blocksize(const EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_get_blocksize(decoder->oggflac); - else - return FLAC__stream_decoder_get_blocksize(decoder->flac); -} - - -FLAC__StreamDecoderState EasyFLAC__init(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - { - OggFLAC__stream_decoder_init(decoder->oggflac); - return OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(decoder->oggflac); - } - else - return FLAC__stream_decoder_init(decoder->flac); -} - - -void EasyFLAC__finish(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - OggFLAC__stream_decoder_finish(decoder->oggflac); - else - FLAC__stream_decoder_finish(decoder->flac); -} - - -FLAC__bool EasyFLAC__flush(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_flush(decoder->oggflac); - else - return FLAC__stream_decoder_flush(decoder->flac); -} - - -FLAC__bool EasyFLAC__reset(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_reset(decoder->oggflac); - else - return FLAC__stream_decoder_reset(decoder->flac); -} - - -FLAC__bool EasyFLAC__process_single(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_process_single(decoder->oggflac); - else - return FLAC__stream_decoder_process_single(decoder->flac); -} - - -FLAC__bool EasyFLAC__process_until_end_of_metadata(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_process_until_end_of_metadata(decoder->oggflac); - else - return FLAC__stream_decoder_process_until_end_of_metadata(decoder->flac); -} - - -FLAC__bool EasyFLAC__process_until_end_of_stream(EasyFLAC__StreamDecoder *decoder) -{ - if (decoder->is_oggflac) - return OggFLAC__stream_decoder_process_until_end_of_stream(decoder->oggflac); - else - return FLAC__stream_decoder_process_until_end_of_stream(decoder->flac); -} - -#endif diff --git a/src/lib/dl/ext/vorbtool/easyflac.h b/src/lib/dl/ext/vorbtool/easyflac.h deleted file mode 100755 index 33da0f3d..00000000 --- a/src/lib/dl/ext/vorbtool/easyflac.h +++ /dev/null @@ -1,141 +0,0 @@ -/* EasyFLAC - A thin decoding wrapper around libFLAC and libOggFLAC to - * make your code less ugly. - * - * Copyright 2003 - Stan Seibert <volsung@xiph.org> - * This code is licensed under a BSD style license: - * - * 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. - * - ************************************************************************ - * - * The motivation for this wrapper is to avoid issues where you need to - * decode both FLAC and Ogg FLAC but don't want to enclose all of your code - * in enormous if blocks where the body of the two branches is essentially - * the same. For example, you don't want to do something like this: - * - * if (is_ogg_flac) - * { - * OggFLAC__blah_blah(); - * OggFLAC__more_stuff(); - * } - * else - * { - * FLAC__blah_blah(); - * FLAC__more_stuff(); - * } - * - * when you really just want this: - * - * EasyFLAC__blah_blah(); - * EasyFLAC__more_stuff(); - * - * This is even more cumbersome when you have to deal with constants. - * - * EasyFLAC uses essentially the same API as - * FLAC__stream_decoder with two additions: - * - * - EasyFLAC__is_oggflac() for those rare occassions when you might - * need to distiguish the difference cases. - * - * - EasyFLAC__stream_decoder_new() takes a parameter to select when - * you are reading FLAC or Ogg FLAC. - * - * The constants are all FLAC__stream_decoder_*. - * - * WARNING: Always call EasyFLAC__set_client_data() even if all you - * want to do is set the client data to NULL. - */ - -#ifndef __EASYFLAC_H -#define __EASYFLAC_H - -#include <FLAC/stream_decoder.h> -#include <OggFLAC/stream_decoder.h> - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct EasyFLAC__StreamDecoder EasyFLAC__StreamDecoder; - - -typedef FLAC__StreamDecoderReadStatus (*EasyFLAC__StreamDecoderReadCallback)(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); -typedef FLAC__StreamDecoderWriteStatus (*EasyFLAC__StreamDecoderWriteCallback)(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); -typedef void (*EasyFLAC__StreamDecoderMetadataCallback)(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); -typedef void (*EasyFLAC__StreamDecoderErrorCallback)(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); - -struct EasyFLAC__StreamDecoder { - FLAC__bool is_oggflac; - FLAC__StreamDecoder *flac; - OggFLAC__StreamDecoder *oggflac; - struct { - EasyFLAC__StreamDecoderReadCallback read; - EasyFLAC__StreamDecoderWriteCallback write; - EasyFLAC__StreamDecoderMetadataCallback metadata; - EasyFLAC__StreamDecoderErrorCallback error; - void *client_data; - } callbacks; -}; - - - -FLAC__bool EasyFLAC__is_oggflac(EasyFLAC__StreamDecoder *decoder); - -EasyFLAC__StreamDecoder *EasyFLAC__stream_decoder_new(FLAC__bool is_oggflac); -void EasyFLAC__stream_decoder_delete(EasyFLAC__StreamDecoder *decoder); -FLAC__bool EasyFLAC__set_read_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderReadCallback value); -FLAC__bool EasyFLAC__set_write_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderWriteCallback value); -FLAC__bool EasyFLAC__set_metadata_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderMetadataCallback value); -FLAC__bool EasyFLAC__set_error_callback(EasyFLAC__StreamDecoder *decoder, EasyFLAC__StreamDecoderErrorCallback value); -FLAC__bool EasyFLAC__set_client_data(EasyFLAC__StreamDecoder *decoder, void *value); -FLAC__bool EasyFLAC__set_metadata_respond(EasyFLAC__StreamDecoder *decoder, FLAC__MetadataType type); -FLAC__bool EasyFLAC__set_metadata_respond_application(EasyFLAC__StreamDecoder *decoder, const FLAC__byte id[4]); -FLAC__bool EasyFLAC__set_metadata_respond_all(EasyFLAC__StreamDecoder *decoder); -FLAC__bool EasyFLAC__set_metadata_ignore(EasyFLAC__StreamDecoder *decoder, FLAC__MetadataType type); -FLAC__bool EasyFLAC__set_metadata_ignore_application(EasyFLAC__StreamDecoder *decoder, const FLAC__byte id[4]); -FLAC__bool EasyFLAC__set_metadata_ignore_all(EasyFLAC__StreamDecoder *decoder); -FLAC__StreamDecoderState EasyFLAC__get_state(const EasyFLAC__StreamDecoder *decoder); -unsigned EasyFLAC__get_channels(const EasyFLAC__StreamDecoder *decoder); -FLAC__ChannelAssignment EasyFLAC__get_channel_assignment(const EasyFLAC__StreamDecoder *decoder); -unsigned EasyFLAC__get_bits_per_sample(const EasyFLAC__StreamDecoder *decoder); -unsigned EasyFLAC__get_sample_rate(const EasyFLAC__StreamDecoder *decoder); -unsigned EasyFLAC__get_blocksize(const EasyFLAC__StreamDecoder *decoder); -FLAC__StreamDecoderState EasyFLAC__init(EasyFLAC__StreamDecoder *decoder); -void EasyFLAC__finish(EasyFLAC__StreamDecoder *decoder); -FLAC__bool EasyFLAC__flush(EasyFLAC__StreamDecoder *decoder); -FLAC__bool EasyFLAC__reset(EasyFLAC__StreamDecoder *decoder); -FLAC__bool EasyFLAC__process_single(EasyFLAC__StreamDecoder *decoder); -FLAC__bool EasyFLAC__process_until_end_of_metadata(EasyFLAC__StreamDecoder *decoder); -FLAC__bool EasyFLAC__process_until_end_of_stream(EasyFLAC__StreamDecoder *decoder); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/dl/ext/vorbtool/encode.c b/src/lib/dl/ext/vorbtool/encode.c deleted file mode 100755 index 3968f624..00000000 --- a/src/lib/dl/ext/vorbtool/encode.c +++ /dev/null @@ -1,836 +0,0 @@ -/* OggEnc - ** - ** This program is distributed under the GNU General Public License, version 2. - ** A copy of this license is included with this source. - ** - ** Copyright 2000-2002, Michael Smith <msmith@xiph.org> - ** - ** Portions from Vorbize, (c) Kenneth Arnold <kcarnold-xiph@arnoldnet.net> - ** and libvorbis examples, (c) Monty <monty@xiph.org> - **/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include <string.h> -#include <time.h> - -#include "platform.h" -#include <ext/vorbis/vorbisenc.h> -#include "encode.h" -#include "i18n.h" -#include "skeleton.h" - -#ifdef HAVE_KATE -#include "lyrics.h" -#include <kate/oggkate.h> -#endif - -#define READSIZE 1024 - - -int oe_write_page(ogg_page *page, FILE *fp); - -#define SETD(toset) \ - do {\ - if(sscanf(opts[i].val, "%lf", &dval) != 1)\ - fprintf(stderr, "For option %s, couldn't read value %s as double\n",\ - opts[i].arg, opts[i].val);\ - else\ - toset = dval;\ - } while(0) - -#define SETL(toset) \ - do {\ - if(sscanf(opts[i].val, "%ld", &lval) != 1)\ - fprintf(stderr, "For option %s, couldn't read value %s as integer\n",\ - opts[i].arg, opts[i].val);\ - else\ - toset = lval;\ - } while(0) - -static void set_advanced_encoder_options(adv_opt *opts, int count, - vorbis_info *vi) -{ -#ifdef OV_ECTL_RATEMANAGE2_GET - int manage = 0; - struct ovectl_ratemanage2_arg ai; - int i; - double dval; - long lval; - - vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_GET, &ai); - - for(i=0; i < count; i++) { - if(opts[i].val) - fprintf(stderr, _("Setting advanced encoder option \"%s\" to %s\n"), - opts[i].arg, opts[i].val); - else - fprintf(stderr, _("Setting advanced encoder option \"%s\"\n"), - opts[i].arg); - - if(!strcmp(opts[i].arg, "bitrate_average_damping")) { - SETD(ai.bitrate_average_damping); - manage = 1; - } - else if(!strcmp(opts[i].arg, "bitrate_average")) { - SETL(ai.bitrate_average_kbps); - manage = 1; - } - else if(!strcmp(opts[i].arg, "bit_reservoir_bias")) { - SETD(ai.bitrate_limit_reservoir_bias); - manage = 1; - } - else if(!strcmp(opts[i].arg, "bit_reservoir_bits")) { - SETL(ai.bitrate_limit_reservoir_bits); - manage = 1; - } - else if(!strcmp(opts[i].arg, "bitrate_hard_min")) { - SETL(ai.bitrate_limit_min_kbps); - manage = 1; - } - else if(!strcmp(opts[i].arg, "bitrate_hard_max")) { - SETL(ai.bitrate_limit_max_kbps); - manage = 1; - } - else if(!strcmp(opts[i].arg, "disable_coupling")) { - int val=0; - vorbis_encode_ctl(vi, OV_ECTL_COUPLING_SET, &val); - } - else if(!strcmp(opts[i].arg, "impulse_noisetune")) { - double val; - SETD(val); - vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &val); - } - else if(!strcmp(opts[i].arg, "lowpass_frequency")) { - double prev, new; - SETD(new); - vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_GET, &prev); - vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &new); - fprintf(stderr, _("Changed lowpass frequency from %f kHz to %f kHz\n"), prev, new); - } - else { - fprintf(stderr, _("Unrecognised advanced option \"%s\"\n"), - opts[i].arg); - } - } - - if(manage) { - if(vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, &ai)) { - fprintf(stderr, _("Failed to set advanced rate management parameters\n")); - } - } -#else - fprintf(stderr,_( "This version of libvorbisenc cannot set advanced rate management parameters\n")); -#endif -} - -static void add_fishead_packet (ogg_stream_state *os) { - - fishead_packet fp; - - memset(&fp, 0, sizeof(fp)); - fp.ptime_n = 0; - fp.ptime_d = 1000; - fp.btime_n = 0; - fp.btime_d = 1000; - - add_fishead_to_stream(os, &fp); -} - -/* - * Adds the fishead packets in the skeleton output stream - */ -static void add_vorbis_fisbone_packet (ogg_stream_state *os, oe_enc_opt *opt) { - - fisbone_packet fp; - - memset(&fp, 0, sizeof(fp)); - fp.serial_no = opt->serialno; - fp.nr_header_packet = 3; - fp.granule_rate_n = opt->rate; - fp.granule_rate_d = 1; - fp.start_granule = 0; - fp.preroll = 2; - fp.granule_shift = 0; - - add_message_header_field(&fp, "Content-Type", "audio/vorbis"); - - add_fisbone_to_stream(os, &fp); -} - -#ifdef HAVE_KATE -static void add_kate_fisbone_packet (ogg_stream_state *os, oe_enc_opt *opt, kate_info *ki) { - - fisbone_packet fp; - - memset(&fp, 0, sizeof(fp)); - fp.serial_no = opt->kate_serialno; - fp.nr_header_packet = ki->num_headers; - fp.granule_rate_n = ki->gps_numerator; - fp.granule_rate_d = ki->gps_denominator; - fp.start_granule = 0; - fp.preroll = 0; - fp.granule_shift = ki->granule_shift; - - add_message_header_field(&fp, "Content-Type", "application/x-kate"); - - add_fisbone_to_stream(os, &fp); -} -#endif - -#ifdef HAVE_KATE -static void add_kate_karaoke_style(kate_info *ki,unsigned char r,unsigned char g,unsigned char b,unsigned char a) -{ - kate_style *ks; - int ret; - - if (!ki) return; - - ks=(kate_style*)malloc(sizeof(kate_style)); - kate_style_init(ks); - ks->text_color.r = r; - ks->text_color.g = g; - ks->text_color.b = b; - ks->text_color.a = a; - ret=kate_info_add_style(ki,ks); - if (ret<0) { - fprintf(stderr, _("WARNING: failed to add Kate karaoke style\n")); - } -} -#endif - -int oe_encode(oe_enc_opt *opt) -{ - - ogg_stream_state os; - ogg_stream_state so; /* stream for skeleton bitstream */ - ogg_stream_state ko; /* stream for kate bitstream */ - ogg_page og; - ogg_packet op; - - vorbis_dsp_state vd; - vorbis_block vb; - vorbis_info vi; - -#ifdef HAVE_KATE - kate_info ki; - kate_comment kc; - kate_state k; - oe_lyrics *lyrics=NULL; - size_t lyrics_index=0; - double vorbis_time = 0.0; -#endif - - long samplesdone=0; - int eos; - long bytes_written = 0, packetsdone=0; - double time_elapsed; - int ret=0; - TIMER *timer; - int result; - - if(opt->channels > 255) { - fprintf(stderr, _("255 channels should be enough for anyone. (Sorry, but Vorbis doesn't support more)\n")); - return 1; - } - - /* get start time. */ - timer = timer_start(); - - if(!opt->managed && (opt->min_bitrate>=0 || opt->max_bitrate>=0)){ - fprintf(stderr, _("Requesting a minimum or maximum bitrate requires --managed\n")); - return 1; - } - - /* if we had no quality or bitrate spec at all from the user, use - the default quality with no management --Monty 20020711 */ - if(opt->bitrate < 0 && opt->min_bitrate < 0 && opt->max_bitrate < 0){ - opt->quality_set=1; - } - - opt->start_encode(opt->infilename, opt->filename, opt->bitrate, opt->quality, - opt->quality_set, opt->managed, opt->min_bitrate, opt->max_bitrate); - - /* Have vorbisenc choose a mode for us */ - vorbis_info_init(&vi); - - if(opt->quality_set > 0){ - if(vorbis_encode_setup_vbr(&vi, opt->channels, opt->rate, opt->quality)){ - fprintf(stderr, _("Mode initialisation failed: invalid parameters for quality\n")); - vorbis_info_clear(&vi); - return 1; - } - - /* do we have optional hard bitrate restrictions? */ - if(opt->max_bitrate > 0 || opt->min_bitrate > 0){ -#ifdef OV_ECTL_RATEMANAGE2_GET - long bitrate; - struct ovectl_ratemanage2_arg ai; - - vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_GET, &ai); - - /* libvorbis 1.1 (and current svn) doesn't actually fill this in, - which looks like a bug. It'll then reject it when we call the - SET version below. So, fill it in with the values that libvorbis - would have used to fill in this structure if we were using the - bitrate-oriented setup functions. Unfortunately, some of those - values are dependent on the bitrate, and libvorbis has no way to - get a nominal bitrate from a quality value. Well, except by doing - a full setup... So, we do that. - Also, note that this won't work correctly unless you have - version 1.1.1 or later of libvorbis. - */ - - { - vorbis_info vi2; - vorbis_info_init(&vi2); - vorbis_encode_setup_vbr(&vi2, opt->channels, opt->rate, opt->quality); - vorbis_encode_setup_init(&vi2); - bitrate = vi2.bitrate_nominal; - vorbis_info_clear(&vi2); - } - - ai.bitrate_average_kbps = bitrate/1000; - ai.bitrate_average_damping = 1.5; - ai.bitrate_limit_reservoir_bits = bitrate * 2; - ai.bitrate_limit_reservoir_bias = .1; - - /* And now the ones we actually wanted to set */ - ai.bitrate_limit_min_kbps=opt->min_bitrate; - ai.bitrate_limit_max_kbps=opt->max_bitrate; - ai.management_active=1; - - if(vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, &ai) == 0) - fprintf(stderr, _("Set optional hard quality restrictions\n")); - else { - fprintf(stderr, _("Failed to set bitrate min/max in quality mode\n")); - vorbis_info_clear(&vi); - return 1; - } -#else - fprintf(stderr, _("This version of libvorbisenc cannot set advanced rate management parameters\n")); - return 1; -#endif - } - - - }else { - if(vorbis_encode_setup_managed(&vi, opt->channels, opt->rate, - opt->max_bitrate>0?opt->max_bitrate*1000:-1, - opt->bitrate*1000, - opt->min_bitrate>0?opt->min_bitrate*1000:-1)){ - fprintf(stderr, _("Mode initialisation failed: invalid parameters for bitrate\n")); - vorbis_info_clear(&vi); - return 1; - } - } - -#ifdef OV_ECTL_RATEMANAGE2_SET - if(opt->managed && opt->bitrate < 0) - { - struct ovectl_ratemanage2_arg ai; - vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_GET, &ai); - ai.bitrate_average_kbps=-1; - vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, &ai); - } - else if(!opt->managed) - { - /* Turn off management entirely (if it was turned on). */ - vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, NULL); - } -#endif - - set_advanced_encoder_options(opt->advopt, opt->advopt_count, &vi); - - vorbis_encode_setup_init(&vi); - - - /* Now, set up the analysis engine, stream encoder, and other - preparation before the encoding begins. - */ - - vorbis_analysis_init(&vd,&vi); - vorbis_block_init(&vd,&vb); - -#ifdef HAVE_KATE - if (opt->lyrics) { - /* load lyrics */ - lyrics=load_lyrics(opt->lyrics); - /* if it fails, don't do anything else for lyrics */ - if (!lyrics) { - opt->lyrics = NULL; - } else { - /* init kate for encoding */ - kate_info_init(&ki); - kate_info_set_category(&ki, "LRC"); - if (opt->lyrics_language) - kate_info_set_language(&ki, opt->lyrics_language); - else - fprintf(stderr, _("WARNING: no language specified for %s\n"), opt->lyrics); - kate_comment_init(&kc); - kate_encode_init(&k,&ki); - - /* if we're in karaoke mode (we have syllable level timing info), - add style info in case some graphical player is used */ - add_kate_karaoke_style(&ki, 255, 255, 255, 255); - add_kate_karaoke_style(&ki, 255, 128, 128, 255); - } - } -#endif - - ogg_stream_init(&os, opt->serialno); - if (opt->with_skeleton) - ogg_stream_init(&so, opt->skeleton_serialno); - if (opt->lyrics) - ogg_stream_init(&ko, opt->kate_serialno); - - /* create the skeleton fishead packet and output it */ - if (opt->with_skeleton) { - add_fishead_packet(&so); - if ((ret = flush_ogg_stream_to_file(&so, opt->out))) { - opt->error(_("Failed writing fishead packet to output stream\n")); - goto cleanup; - } - } - - /* Now, build the three header packets and send through to the stream - output stage (but defer actual file output until the main encode loop) */ - - { - ogg_packet header_main; - ogg_packet header_comments; - ogg_packet header_codebooks; - - /* Build the packets */ - vorbis_analysis_headerout(&vd,opt->comments, - &header_main,&header_comments,&header_codebooks); - - /* And stream them out */ - /* output the vorbis bos first, then the kate bos, then the fisbone packets */ - ogg_stream_packetin(&os,&header_main); - while((result = ogg_stream_flush(&os, &og))) - { - if(!result) break; - ret = oe_write_page(&og, opt->out); - if(ret != og.header_len + og.body_len) - { - opt->error(_("Failed writing header to output stream\n")); - ret = 1; - goto cleanup; /* Bail and try to clean up stuff */ - } - } - -#ifdef HAVE_KATE - if (opt->lyrics) { - ogg_packet kate_op; - ret = kate_ogg_encode_headers(&k, &kc, &kate_op); - if (ret < 0) { - opt->error(_("Failed encoding Kate header\n")); - goto cleanup; - } - ogg_stream_packetin(&ko,&kate_op); - while((result = ogg_stream_flush(&ko, &og))) - { - if(!result) break; - ret = oe_write_page(&og, opt->out); - if(ret != og.header_len + og.body_len) - { - opt->error(_("Failed writing header to output stream\n")); - ret = 1; - goto cleanup; /* Bail and try to clean up stuff */ - } - } - ogg_packet_clear(&kate_op); - } -#endif - - if (opt->with_skeleton) { - add_vorbis_fisbone_packet(&so, opt); - if ((ret = flush_ogg_stream_to_file(&so, opt->out))) { - opt->error(_("Failed writing fisbone header packet to output stream\n")); - goto cleanup; - } -#ifdef HAVE_KATE - if (opt->lyrics) { - add_kate_fisbone_packet(&so, opt, &ki); - if ((ret = flush_ogg_stream_to_file(&so, opt->out))) { - opt->error(_("Failed writing fisbone header packet to output stream\n")); - goto cleanup; - } - } -#endif - } - - /* write the next Vorbis headers */ - ogg_stream_packetin(&os,&header_comments); - ogg_stream_packetin(&os,&header_codebooks); - - while((result = ogg_stream_flush(&os, &og))) - { - if(!result) break; - ret = oe_write_page(&og, opt->out); - if(ret != og.header_len + og.body_len) - { - opt->error(_("Failed writing header to output stream\n")); - ret = 1; - goto cleanup; /* Bail and try to clean up stuff */ - } - } - } - - /* build kate headers if requested */ -#ifdef HAVE_KATE - if (opt->lyrics) { - while (kate_ogg_encode_headers(&k,&kc,&op)==0) { - ogg_stream_packetin(&ko,&op); - ogg_packet_clear(&op); - } - while((result = ogg_stream_flush(&ko, &og))) - { - if(!result) break; - ret = oe_write_page(&og, opt->out); - if(ret != og.header_len + og.body_len) - { - opt->error(_("Failed writing header to output stream\n")); - ret = 1; - goto cleanup; /* Bail and try to clean up stuff */ - } - } - } -#endif - - if (opt->with_skeleton) { - add_eos_packet_to_stream(&so); - if ((ret = flush_ogg_stream_to_file(&so, opt->out))) { - opt->error(_("Failed writing skeleton eos packet to output stream\n")); - goto cleanup; - } - } - - eos = 0; - - /* Main encode loop - continue until end of file */ - while(!eos) - { - float **buffer = vorbis_analysis_buffer(&vd, READSIZE); - long samples_read = opt->read_samples(opt->readdata, - buffer, READSIZE); - - if(samples_read ==0) - /* Tell the library that we wrote 0 bytes - signalling the end */ - vorbis_analysis_wrote(&vd,0); - else - { - samplesdone += samples_read; - - /* Call progress update every 40 pages */ - if(packetsdone>=40) - { - double time; - - packetsdone = 0; - time = timer_time(timer); - - opt->progress_update(opt->filename, opt->total_samples_per_channel, - samplesdone, time); - } - - /* Tell the library how many samples (per channel) we wrote - into the supplied buffer */ - vorbis_analysis_wrote(&vd, samples_read); - } - - /* While we can get enough data from the library to analyse, one - block at a time... */ - while(vorbis_analysis_blockout(&vd,&vb)==1) - { - - /* Do the main analysis, creating a packet */ - vorbis_analysis(&vb, NULL); - vorbis_bitrate_addblock(&vb); - - while(vorbis_bitrate_flushpacket(&vd, &op)) - { - /* Add packet to bitstream */ - ogg_stream_packetin(&os,&op); - packetsdone++; - - /* If we've gone over a page boundary, we can do actual output, - so do so (for however many pages are available) */ - - while(!eos) - { - int result = ogg_stream_pageout(&os,&og); - if(!result) break; - - /* now that we have a new Vorbis page, we scan lyrics for any that is due */ -#ifdef HAVE_KATE - if (opt->lyrics && ogg_page_granulepos(&og)>=0) { - vorbis_time = vorbis_granule_time(&vd, ogg_page_granulepos(&og)); - const oe_lyrics_item *item; - while ((item = get_lyrics(lyrics, vorbis_time, &lyrics_index))) { - ogg_packet kate_op; - if (item->km) { - ret = kate_encode_set_style_index(&k, 0); - if (ret < 0) { - opt->error(_("Failed encoding karaoke style - continuing anyway\n")); - } - ret = kate_encode_set_secondary_style_index(&k, 1); - if (ret < 0) { - opt->error(_("Failed encoding karaoke style - continuing anyway\n")); - } - ret = kate_encode_add_motion(&k, item->km, 0); - if (ret < 0) { - opt->error(_("Failed encoding karaoke motion - continuing anyway\n")); - } - } - ret = kate_ogg_encode_text(&k, item->t0, item->t1, item->text, strlen(item->text)+1, &kate_op); - if (ret < 0) { - opt->error(_("Failed encoding lyrics - continuing anyway\n")); - } - else { - ogg_stream_packetin(&ko, &kate_op); - ogg_packet_clear(&kate_op); - while (1) { - ogg_page ogk; - int result=ogg_stream_flush(&ko,&ogk); - if (!result) break; - ret = oe_write_page(&ogk, opt->out); - if(ret != ogk.header_len + ogk.body_len) - { - opt->error(_("Failed writing data to output stream\n")); - ret = 1; - goto cleanup; /* Bail */ - } - else - bytes_written += ret; - } - } - } - } -#endif - - ret = oe_write_page(&og, opt->out); - if(ret != og.header_len + og.body_len) - { - opt->error(_("Failed writing data to output stream\n")); - ret = 1; - goto cleanup; /* Bail */ - } - else - bytes_written += ret; - - if(ogg_page_eos(&og)) - eos = 1; - } - } - } - } - - /* if encoding lyrics, signal EOS and cleanup the kate state */ -#ifdef HAVE_KATE - if (opt->lyrics) { - ogg_packet kate_op; - ret = kate_ogg_encode_finish(&k, vorbis_time, &kate_op); - if (ret < 0) { - opt->error(_("Failed encoding Kate EOS packet\n")); - } - else { - ogg_stream_packetin(&ko,&kate_op); - packetsdone++; - ogg_packet_clear(&kate_op); - - eos = 0; - while(!eos) - { - int result = ogg_stream_pageout(&ko,&og); - if(!result) break; - - ret = oe_write_page(&og, opt->out); - if(ret != og.header_len + og.body_len) - { - opt->error(_("Failed writing data to output stream\n")); - ret = 1; - goto cleanup; /* Bail */ - } - else - bytes_written += ret; - - if(ogg_page_eos(&og)) - eos = 1; - } - } - } -#endif - - ret = 0; /* Success. Set return value to 0 since other things reuse it - * for nefarious purposes. */ - - /* Cleanup time */ -cleanup: - -#ifdef HAVE_KATE - if (opt->lyrics) { - ogg_stream_clear(&ko); - kate_clear(&k); - kate_info_clear(&ki); - kate_comment_clear(&kc); - free_lyrics(lyrics); - } -#endif - - if (opt->with_skeleton) - ogg_stream_clear(&so); - - ogg_stream_clear(&os); - - vorbis_block_clear(&vb); - vorbis_dsp_clear(&vd); - vorbis_info_clear(&vi); - - time_elapsed = timer_time(timer); - opt->end_encode(opt->filename, time_elapsed, opt->rate, samplesdone, bytes_written); - - timer_clear(timer); - - return ret; -} - -void update_statistics_full(char *fn, long total, long done, double time) -{ - static char *spinner="|/-\\"; - static int spinpoint = 0; - double remain_time; - int minutes=0,seconds=0; - - remain_time = time/((double)done/(double)total) - time; - minutes = ((int)remain_time)/60; - seconds = (int)(remain_time - (double)((int)remain_time/60)*60); - - fprintf(stderr, "\r"); - fprintf(stderr, _("\t[%5.1f%%] [%2dm%.2ds remaining] %c "), - done*100.0/total, minutes, seconds, spinner[spinpoint++%4]); -} - -void update_statistics_notime(char *fn, long total, long done, double time) -{ - static char *spinner="|/-\\"; - static int spinpoint =0; - - fprintf(stderr, "\r"); - fprintf(stderr, _("\tEncoding [%2dm%.2ds so far] %c "), - ((int)time)/60, (int)(time - (double)((int)time/60)*60), - spinner[spinpoint++%4]); -} - -int oe_write_page(ogg_page *page, FILE *fp) -{ - int written; - written = fwrite(page->header,1,page->header_len, fp); - written += fwrite(page->body,1,page->body_len, fp); - - return written; -} - -void final_statistics(char *fn, double time, int rate, long samples, long bytes) -{ - double speed_ratio; - if(fn) - fprintf(stderr, _("\n\nDone encoding file \"%s\"\n"), fn); - else - fprintf(stderr, _("\n\nDone encoding.\n")); - - speed_ratio = (double)samples / (double)rate / time; - - fprintf(stderr, _("\n\tFile length: %dm %04.1fs\n"), - (int)(samples/rate/60), - samples/rate - - floor(samples/rate/60)*60); - fprintf(stderr, _("\tElapsed time: %dm %04.1fs\n"), - (int)(time/60), - time - floor(time/60)*60); - fprintf(stderr, _("\tRate: %.4f\n"), speed_ratio); - fprintf(stderr, _("\tAverage bitrate: %.1f kb/s\n\n"), - 8./1000.*((double)bytes/((double)samples/(double)rate))); -} - -void final_statistics_null(char *fn, double time, int rate, long samples, - long bytes) -{ - /* Don't do anything, this is just a placeholder function for quiet mode */ -} - -void update_statistics_null(char *fn, long total, long done, double time) -{ - /* So is this */ -} - -void encode_error(char *errmsg) -{ - fprintf(stderr, "\n%s\n", errmsg); -} - -static void print_brconstraints(int min, int max) -{ - if(min > 0 && max > 0) - fprintf(stderr, _("(min %d kbps, max %d kbps)"), min,max); - else if(min > 0) - fprintf(stderr, _("(min %d kbps, no max)"), min); - else if(max > 0) - fprintf(stderr, _("(no min, max %d kbps)"), max); - else - fprintf(stderr, _("(no min or max)")); -} - -void start_encode_full(char *fn, char *outfn, int bitrate, float quality, int qset, - int managed, int min, int max) -{ - if(bitrate>0){ - if(managed>0){ - fprintf(stderr, _("Encoding %s%s%s to \n " - "%s%s%s \nat average bitrate %d kbps "), - fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"", - outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"", - bitrate); - print_brconstraints(min,max); - fprintf(stderr, ", \nusing full bitrate management engine\n"); - } else { - fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nat approximate bitrate %d kbps (VBR encoding enabled)\n"), - fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"", - outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"", - bitrate); - } - }else{ - if(qset>0){ - if(managed>0){ - fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nat quality level %2.2f using constrained VBR "), - fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"", - outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"", - quality * 10); - print_brconstraints(min,max); - fprintf(stderr, "\n"); - }else{ - fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nat quality %2.2f\n"), - fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"", - outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"", - quality * 10); - } - }else{ - fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nusing bitrate management "), - fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"", - outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":""); - print_brconstraints(min,max); - fprintf(stderr, "\n"); - } - } -} - -void start_encode_null(char *fn, char *outfn, int bitrate, float quality, int qset, - int managed, int min, int max) -{ -} diff --git a/src/lib/dl/ext/vorbtool/encode.h b/src/lib/dl/ext/vorbtool/encode.h deleted file mode 100755 index e3dd33bb..00000000 --- a/src/lib/dl/ext/vorbtool/encode.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef __ENCODE_H -#define __ENCODE_H - -#include <stdio.h> -#include <vorbis/codec.h> - -typedef void TIMER; -typedef long (*audio_read_func)(void *src, float **buffer, int samples); -typedef void (*progress_func)(char *fn, long totalsamples, - long samples, double time); -typedef void (*enc_end_func)(char *fn, double time, int rate, - long samples, long bytes); -typedef void (*enc_start_func)(char *fn, char *outfn, int bitrate, - float quality, int qset, int managed, int min_br, int max_br); -typedef void (*error_func)(char *errormessage); - - -void *timer_start(void); -double timer_time(void *); -void timer_clear(void *); -int create_directories(char *, int); - -void update_statistics_full(char *fn, long total, long done, double time); -void update_statistics_notime(char *fn, long total, long done, double time); -void update_statistics_null(char *fn, long total, long done, double time); -void start_encode_full(char *fn, char *outfn, int bitrate, float quality, int qset, - int managed, int min, int max); -void start_encode_null(char *fn, char *outfn, int bitrate, float quality, int qset, - int managed, int min, int max); -void final_statistics(char *fn, double time, int rate, long total_samples, - long bytes); -void final_statistics_null(char *fn, double time, int rate, long total_samples, - long bytes); -void encode_error(char *errmsg); - -typedef struct { - char *arg; - char *val; -} adv_opt; - -typedef struct -{ - char **title; - int title_count; - char **artist; - int artist_count; - char **album; - int album_count; - char **comments; - int comment_count; - char **tracknum; - int track_count; - char **dates; - int date_count; - char **genre; - int genre_count; - char **lyrics; - int lyrics_count; - char **lyrics_language; - int lyrics_language_count; - adv_opt *advopt; - int advopt_count; - - int copy_comments; - int with_skeleton; - int quiet; - int rawmode; - - int raw_samplesize; - int raw_samplerate; - int raw_channels; - int raw_endianness; - - char *namefmt; - char *namefmt_remove; - char *namefmt_replace; - - char *outfile; - - /* All 3 in kbps */ - int managed; - int min_bitrate; - int nominal_bitrate; - int max_bitrate; - - /* Float from 0 to 1 (low->high) */ - float quality; - int quality_set; - - int resamplefreq; - int downmix; - float scale; - - unsigned int serial; - unsigned int skeleton_serial; - unsigned int kate_serial; - int fixedserial; - int ignorelength; - - int isutf8; -} oe_options; - -typedef struct -{ - vorbis_comment *comments; - unsigned int serialno; - unsigned int skeleton_serialno; - unsigned int kate_serialno; - - audio_read_func read_samples; - progress_func progress_update; - enc_end_func end_encode; - enc_start_func start_encode; - error_func error; - - void *readdata; - - long total_samples_per_channel; - int channels; - long rate; - int samplesize; - int endianness; - int resamplefreq; - int copy_comments; - int with_skeleton; - - /* Various bitrate/quality options */ - int managed; - int bitrate; - int min_bitrate; - int max_bitrate; - float quality; - int quality_set; - adv_opt *advopt; - int advopt_count; - - FILE *out; - char *filename; - char *infilename; - int ignorelength; - - char *lyrics; - char *lyrics_language; -} oe_enc_opt; - - -int oe_encode(oe_enc_opt *opt); - -#endif /* __ENCODE_H */ diff --git a/src/lib/dl/ext/vorbtool/flac.c b/src/lib/dl/ext/vorbtool/flac.c deleted file mode 100755 index fa6ef49b..00000000 --- a/src/lib/dl/ext/vorbtool/flac.c +++ /dev/null @@ -1,377 +0,0 @@ -/* OggEnc - ** - ** This program is distributed under the GNU General Public License, version 2. - ** A copy of this license is included with this source. - ** - ** Copyright 2002, Stan Seibert <volsung@xiph.org> - ** - **/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <math.h> -#include <flac/metadata.h> -#include "audio.h" -#include "flac.h" -#include "i18n.h" -#include "platform.h" -#include "resample.h" - -#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8) -#define NEED_EASYFLAC 1 -#endif - -#if NEED_EASYFLAC -static FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); -static FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); -static void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); -static void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); -#else -static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *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 eof_callback(const FLAC__StreamDecoder *decoder, void *client_data); -#endif - -static void resize_buffer(flacfile *flac, int newchannels, int newsamples); -static void copy_comments (vorbis_comment *v_comments, FLAC__StreamMetadata_VorbisComment *f_comments); - - -int flac_id(unsigned char *buf, int len) -{ - if (len < 4) return 0; - - return memcmp(buf, "fLaC", 4) == 0; -} - - -int oggflac_id(unsigned char *buf, int len) -{ - if (len < 33) return 0; - - return memcmp(buf, "OggS", 4) == 0 && - (memcmp (buf+28, "\177FLAC", 5) == 0 || flac_id(buf+28, len - 28)); -} - - -int flac_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen) -{ - flacfile *flac = malloc(sizeof(flacfile)); - - flac->decoder = NULL; - flac->channels = 0; - flac->rate = 0; - flac->totalsamples = 0; - flac->comments = NULL; - flac->in = NULL; - flac->eos = 0; - - /* Setup empty audio buffer that will be resized on first frame - callback */ - flac->buf = NULL; - flac->buf_len = 0; - flac->buf_start = 0; - flac->buf_fill = 0; - - /* Copy old input data over */ - flac->oldbuf = malloc(buflen); - flac->oldbuf_len = buflen; - memcpy(flac->oldbuf, oldbuf, buflen); - flac->oldbuf_start = 0; - - /* Need to save FILE pointer for read callback */ - flac->in = in; - - /* Setup FLAC decoder */ -#if NEED_EASYFLAC - flac->decoder = EasyFLAC__stream_decoder_new(oggflac_id(oldbuf, buflen)); - EasyFLAC__set_client_data(flac->decoder, flac); - EasyFLAC__set_read_callback(flac->decoder, &easyflac_read_callback); - EasyFLAC__set_write_callback(flac->decoder, &easyflac_write_callback); - EasyFLAC__set_metadata_callback(flac->decoder, &easyflac_metadata_callback); - EasyFLAC__set_error_callback(flac->decoder, &easyflac_error_callback); - EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_STREAMINFO); - EasyFLAC__set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); - EasyFLAC__init(flac->decoder); -#else - flac->decoder = FLAC__stream_decoder_new(); - FLAC__stream_decoder_set_md5_checking(flac->decoder, false); - FLAC__stream_decoder_set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_STREAMINFO); - FLAC__stream_decoder_set_metadata_respond(flac->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(oggflac_id(oldbuf, buflen)) - FLAC__stream_decoder_init_ogg_stream(flac->decoder, read_callback, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, eof_callback, write_callback, metadata_callback, error_callback, flac); - else - FLAC__stream_decoder_init_stream(flac->decoder, read_callback, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, eof_callback, write_callback, metadata_callback, error_callback, flac); -#endif - - /* Callback will set the total samples and sample rate */ -#if NEED_EASYFLAC - EasyFLAC__process_until_end_of_metadata(flac->decoder); -#else - FLAC__stream_decoder_process_until_end_of_metadata(flac->decoder); -#endif - - /* Callback will set the number of channels and resize the - audio buffer */ -#if NEED_EASYFLAC - EasyFLAC__process_single(flac->decoder); -#else - FLAC__stream_decoder_process_single(flac->decoder); -#endif - - /* Copy format info for caller */ - opt->rate = flac->rate; - opt->channels = flac->channels; - /* flac->total_samples_per_channel was already set by metadata - callback when metadata was processed. */ - opt->total_samples_per_channel = flac->totalsamples; - /* Copy Vorbis-style comments from FLAC file (read in metadata - callback)*/ - if (flac->comments != NULL && opt->copy_comments) - copy_comments(opt->comments, &flac->comments->data.vorbis_comment); - opt->read_samples = flac_read; - opt->readdata = (void *)flac; - - return 1; -} - -/* FLAC follows the WAV channel ordering pattern; we must permute to - put things in Vorbis channel order */ -static int wav_permute_matrix[8][8] = -{ - {0}, /* 1.0 mono */ - {0,1}, /* 2.0 stereo */ - {0,2,1}, /* 3.0 channel ('wide') stereo */ - {0,1,2,3}, /* 4.0 discrete quadraphonic */ - {0,2,1,3,4}, /* 5.0 surround */ - {0,2,1,4,5,3}, /* 5.1 surround */ - {0,2,1,4,5,6,3}, /* 6.1 surround */ - {0,2,1,6,7,4,5,3} /* 7.1 surround (classic theater 8-track) */ -}; - -long flac_read(void *in, float **buffer, int samples) -{ - flacfile *flac = (flacfile *)in; - long realsamples = 0; - FLAC__bool ret; - int i,j; - while (realsamples < samples) - { - if (flac->buf_fill > 0) - { - int copy = flac->buf_fill < (samples - realsamples) ? - flac->buf_fill : (samples - realsamples); - - for (i = 0; i < flac->channels; i++){ - int permute = wav_permute_matrix[flac->channels-1][i]; - for (j = 0; j < copy; j++) - buffer[i][j+realsamples] = - flac->buf[permute][j+flac->buf_start]; - } - flac->buf_start += copy; - flac->buf_fill -= copy; - realsamples += copy; - } - else if (!flac->eos) - { -#if NEED_EASYFLAC - ret = EasyFLAC__process_single(flac->decoder); - if (!ret || - EasyFLAC__get_state(flac->decoder) - == FLAC__STREAM_DECODER_END_OF_STREAM) - flac->eos = 1; /* Bail out! */ -#else - ret = FLAC__stream_decoder_process_single(flac->decoder); - if (!ret || - FLAC__stream_decoder_get_state(flac->decoder) - == FLAC__STREAM_DECODER_END_OF_STREAM) - flac->eos = 1; /* Bail out! */ -#endif - } else - break; - } - - return realsamples; -} - -void flac_close(void *info) -{ - int i; - flacfile *flac = (flacfile *) info; - - for (i = 0; i < flac->channels; i++) - free(flac->buf[i]); - - free(flac->buf); - free(flac->oldbuf); - free(flac->comments); -#if NEED_EASYFLAC - EasyFLAC__finish(flac->decoder); - EasyFLAC__stream_decoder_delete(flac->decoder); -#else - FLAC__stream_decoder_finish(flac->decoder); - FLAC__stream_decoder_delete(flac->decoder); -#endif - free(flac); -} - -#if NEED_EASYFLAC -FLAC__StreamDecoderReadStatus easyflac_read_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) -#else -FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -#endif -{ - flacfile *flac = (flacfile *) client_data; - int i = 0; - int oldbuf_fill = flac->oldbuf_len - flac->oldbuf_start; - - /* Immediately return if errors occured */ - if(feof(flac->in)) - { - *bytes = 0; - return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - } - else if(ferror(flac->in)) - { - *bytes = 0; - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - } - - - if(oldbuf_fill > 0) - { - int copy; - - copy = oldbuf_fill < (*bytes - i) ? oldbuf_fill : (*bytes - i); - memcpy(buffer + i, flac->oldbuf, copy); - i += copy; - flac->oldbuf_start += copy; - } - - if(i < *bytes) - i += fread(buffer+i, sizeof(FLAC__byte), *bytes - i, flac->in); - - *bytes = i; - - return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; -} - -#if NEED_EASYFLAC -FLAC__StreamDecoderWriteStatus easyflac_write_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -#else -FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -#endif -{ - flacfile *flac = (flacfile *) client_data; - int samples = frame->header.blocksize; - int channels = frame->header.channels; - int bits_per_sample = frame->header.bits_per_sample; - int i, j; - - resize_buffer(flac, channels, samples); - - for (i = 0; i < channels; i++) - for (j = 0; j < samples; j++) - flac->buf[i][j] = buffer[i][j] / - (float) (1 << (bits_per_sample - 1)); - - flac->buf_start = 0; - flac->buf_fill = samples; - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -#if NEED_EASYFLAC -void easyflac_metadata_callback(const EasyFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -#else -void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -#endif -{ - flacfile *flac = (flacfile *) client_data; - - switch (metadata->type) - { - case FLAC__METADATA_TYPE_STREAMINFO: - flac->totalsamples = metadata->data.stream_info.total_samples; - flac->rate = metadata->data.stream_info.sample_rate; - break; - - case FLAC__METADATA_TYPE_VORBIS_COMMENT: - flac->comments = FLAC__metadata_object_clone(metadata); - break; - default: - break; - } -} - -#if NEED_EASYFLAC -void easyflac_error_callback(const EasyFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -#else -void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -#endif -{ - flacfile *flac = (flacfile *) client_data; - -} - -#if !NEED_EASYFLAC -FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *client_data) -{ - flacfile *flac = (flacfile *) client_data; - - return feof(flac->in)? true : false; -} -#endif - -void resize_buffer(flacfile *flac, int newchannels, int newsamples) -{ - int i; - - if (newchannels == flac->channels && newsamples == flac->buf_len) - { - flac->buf_start = 0; - flac->buf_fill = 0; - return; - } - - - /* Not the most efficient approach, but it is easy to follow */ - if(newchannels != flac->channels) - { - /* Deallocate all of the sample vectors */ - for (i = 0; i < flac->channels; i++) - free(flac->buf[i]); - - flac->buf = realloc(flac->buf, sizeof(float*) * newchannels); - flac->channels = newchannels; - - } - - for (i = 0; i < newchannels; i++) - flac->buf[i] = malloc(sizeof(float) * newsamples); - - flac->buf_len = newsamples; - flac->buf_start = 0; - flac->buf_fill = 0; -} - -void copy_comments (vorbis_comment *v_comments, FLAC__StreamMetadata_VorbisComment *f_comments) -{ - int i; - - for (i = 0; i < f_comments->num_comments; i++) - { - char *comment = malloc(f_comments->comments[i].length + 1); - memset(comment, '\0', f_comments->comments[i].length + 1); - strncpy(comment, f_comments->comments[i].entry, f_comments->comments[i].length); - vorbis_comment_add(v_comments, comment); - free(comment); - } -} diff --git a/src/lib/dl/ext/vorbtool/flac.h b/src/lib/dl/ext/vorbtool/flac.h deleted file mode 100755 index 75be681c..00000000 --- a/src/lib/dl/ext/vorbtool/flac.h +++ /dev/null @@ -1,54 +0,0 @@ - -#ifndef __FLAC_H -#define __FLAC_H - -#include "encode.h" -#include "audio.h" -#include <stdio.h> -#include <flac/stream_decoder.h> -#if !defined(FLAC_API_VERSION_CURRENT) || (FLAC_API_VERSION_CURRENT < 8) -#define NEED_EASYFLAC 1 -#endif -#if NEED_EASYFLAC -#include <OggFLAC/stream_decoder.h> -#include "easyflac.h" -#endif - -typedef struct { -#if NEED_EASYFLAC - EasyFLAC__StreamDecoder *decoder; -#else - FLAC__StreamDecoder *decoder; -#endif - short channels; - int rate; - long totalsamples; /* per channel, of course */ - - FLAC__StreamMetadata *comments; - - FILE *in; /* Cache the FILE pointer so the FLAC read callback can use it */ - int eos; /* End of stream read */ - - - /* Buffer for decoded audio */ - float **buf; /* channels by buf_len array */ - int buf_len; - int buf_start; /* Offset to start of audio data */ - int buf_fill; /* Number of bytes of audio data in buffer */ - - /* Buffer for input data we already read in the id phase */ - unsigned char *oldbuf; - int oldbuf_len; - int oldbuf_start; -} flacfile; - - -int flac_id(unsigned char *buf, int len); -int oggflac_id(unsigned char *buf, int len); -int flac_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen); -void flac_close(void *); - -long flac_read(void *, float **buffer, int samples); - -#endif /* __FLAC_H */ - diff --git a/src/lib/dl/ext/vorbtool/getopt.c b/src/lib/dl/ext/vorbtool/getopt.c deleted file mode 100755 index 6ab474b4..00000000 --- a/src/lib/dl/ext/vorbtool/getopt.c +++ /dev/null @@ -1,1047 +0,0 @@ -/* 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 <stdio.h>. - Ditto for AIX 3.2 and <stdlib.h>. */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include <stdio.h> - -/* 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 <gnu-versions.h> -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#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 <stdlib.h> -# include <unistd.h> -#endif /* GNU C library. */ - -#ifdef VMS -# include <unixlib.h> -# if HAVE_STRING_H - 0 -# include <string.h> -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include <libintl.h> -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `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 `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 "getopt.h" - -/* For communication from `getopt' to the caller. - When `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 *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 `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `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 optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* 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 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 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 `getopt' to return -1 with `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 <string.h> -# define my_index strchr -#else - -#include <string.h> - -/* 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,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 = 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 += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_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 = 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; -#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 `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `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 `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 `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `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 `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 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 -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[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[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[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 > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = 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 != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = 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 (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - 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 (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) - 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; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[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[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct 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 (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - 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) - optarg = nameend + 1; - else - { - if (opterr) - { - if (argv[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[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - 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 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[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[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[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (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); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct 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') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = 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 (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - 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) - optarg = nameend + 1; - else - { - if (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 (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[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') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct 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 `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = 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", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/lib/dl/ext/vorbtool/getopt.h b/src/lib/dl/ext/vorbtool/getopt.h deleted file mode 100755 index 49c94f4b..00000000 --- a/src/lib/dl/ext/vorbtool/getopt.h +++ /dev/null @@ -1,171 +0,0 @@ -/* 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 _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef DONT_DEFINE_GETOPT_VARS -/* For communication from `getopt' to the caller. - When `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 *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 `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; -#endif - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - 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 `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, `getopt' - returns the contents of the `val' field. */ - -struct 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 option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#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, `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 `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `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 - `getopt'. */ - -#if defined __STDC__ && __STDC__ -# 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 getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/src/lib/dl/ext/vorbtool/getopt1.c b/src/lib/dl/ext/vorbtool/getopt1.c deleted file mode 100755 index 8c1a78f3..00000000 --- a/src/lib/dl/ext/vorbtool/getopt1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* 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 "config.h" -#endif - -#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 <stdio.h> - -/* 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 <gnu-versions.h> -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include <stdlib.h> -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like 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 -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include <stdio.h> - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct 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 = 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 (optarg) - printf (" with arg %s", 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", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/lib/dl/ext/vorbtool/i18n.h b/src/lib/dl/ext/vorbtool/i18n.h deleted file mode 100755 index f15b645b..00000000 --- a/src/lib/dl/ext/vorbtool/i18n.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef VORBIS_TOOLS_I18N_H -#define VORBIS_TOOLS_I18N_H - -#ifdef ENABLE_NLS -# error NO -#define _(X) gettext(X) -#else -#define _(X) (X) -#define textdomain(X) -#define bindtextdomain(X, Y) -#endif -#ifdef gettext_noop -#define N_(X) gettext_noop(X) -#else -#define N_(X) (X) -#endif - -#endif diff --git a/src/lib/dl/ext/vorbtool/iconvert.c b/src/lib/dl/ext/vorbtool/iconvert.c deleted file mode 100755 index 09e5bd17..00000000 --- a/src/lib/dl/ext/vorbtool/iconvert.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * - * 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 <config.h> -#endif - -#ifdef HAVE_ICONV - -#include <assert.h> -#include <errno.h> -#include <iconv.h> -#include <stdlib.h> -#include <string.h> - -/* - * 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 != (size_t)(-1) && !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); # in theory commenting this line prevents a segfault - } - } - - 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 != (size_t)(-1) && !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 != (size_t)(-1)); - 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 != (size_t)(-1) && !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 != (size_t)(-1)); - 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: - free(utfbuf); - iconv_close(cd1); - if (cd2 != (iconv_t)(-1)) - iconv_close(cd2); - return -2; -} - -#endif /* HAVE_ICONV */ diff --git a/src/lib/dl/ext/vorbtool/lyrics.c b/src/lib/dl/ext/vorbtool/lyrics.c deleted file mode 100755 index 73b8afe0..00000000 --- a/src/lib/dl/ext/vorbtool/lyrics.c +++ /dev/null @@ -1,59 +0,0 @@ -/* OggEnc - ** - ** This program is distributed under the GNU General Public License, version 2. - ** A copy of this license is included with this source. - ** - ** This particular file may also be distributed under (at your option) any - ** later version of the GNU General Public License. - ** - ** Copyright 2008, ogg.k.ogg.k <ogg.k.ogg.k@googlemail.com> - ** - ** Portions from ffmpeg2theora, (c) j <j@v2v.cc> - **/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <malloc.h> -#include <string.h> -#include <errno.h> - -#ifdef HAVE_KATE -#endif - -#include "lyrics.h" -#include "utf8.h" -#include "i18n.h" - -typedef enum { - lf_unknown, - lf_srt, - lf_lrc, -} lyrics_format; - -#ifdef HAVE_KATE -#endif - -oe_lyrics *load_lyrics(const char *filename) -{ -#ifdef HAVE_KATE -#else - return NULL; -#endif -} - -void free_lyrics(oe_lyrics *lyrics) -{ -#ifdef HAVE_KATE -#endif -} - -const oe_lyrics_item *get_lyrics(const oe_lyrics *lyrics, double t, size_t *idx) -{ -#ifdef HAVE_KATE -#else - return NULL; -#endif -} diff --git a/src/lib/dl/ext/vorbtool/lyrics.h b/src/lib/dl/ext/vorbtool/lyrics.h deleted file mode 100755 index 7e949bc8..00000000 --- a/src/lib/dl/ext/vorbtool/lyrics.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __LYRICS_H -#define __LYRICS_H - -#include <stddef.h> -#ifdef HAVE_KATE -#include <kate/kate.h> -#endif - -typedef struct oe_lyrics_item { - char *text; - size_t len; - double t0; - double t1; -#ifdef HAVE_KATE - kate_motion *km; -#endif -} oe_lyrics_item; - -typedef struct oe_lyrics { - size_t count; - oe_lyrics_item *lyrics; - int karaoke; -} oe_lyrics; - -extern oe_lyrics *load_lyrics(const char *filename); -extern void free_lyrics(oe_lyrics *lyrics); -extern const oe_lyrics_item *get_lyrics(const oe_lyrics *lyrics, double t, size_t *idx); - -#endif diff --git a/src/lib/dl/ext/vorbtool/makemap.c b/src/lib/dl/ext/vorbtool/makemap.c deleted file mode 100755 index ebd2b0bf..00000000 --- a/src/lib/dl/ext/vorbtool/makemap.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * - * 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 <config.h> -#endif - -#include <errno.h> -#include <iconv.h> -#include <stdio.h> - -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/src/lib/dl/ext/vorbtool/oggdec.c b/src/lib/dl/ext/vorbtool/oggdec.c deleted file mode 100755 index 05f398a0..00000000 --- a/src/lib/dl/ext/vorbtool/oggdec.c +++ /dev/null @@ -1,471 +0,0 @@ -/* OggDec - * - * This program is distributed under the GNU General Public License, version 2. - * A copy of this license is included with this source. - * - * Copyright 2002, Michael Smith <msmith@xiph.org> - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <stdio.h> -#include "getopt.h" -#include <errno.h> -#include <string.h> - -#if defined(_WIN32) || defined(__EMX__) || defined(__WATCOMC__) -#include <fcntl.h> -#include <io.h> -#endif - -#include <ext/vorbis/vorbisfile.h> - -#include "i18n.h" - -struct option long_options[] = { - {"quiet", 0,0,'Q'}, - {"help",0,0,'h'}, - {"version", 0, 0, 'V'}, - {"bits", 1, 0, 'b'}, - {"endianness", 1, 0, 'e'}, - {"raw", 0, 0, 'R'}, - {"sign", 1, 0, 's'}, - {"output", 1, 0, 'o'}, - {NULL,0,0,0} -}; - -static int quiet = 0; -static int bits = 16; -static int endian = 0; -static int raw = 0; -static int sign = 1; -unsigned char headbuf[44]; /* The whole buffer */ -char *outfilename = NULL; - -static void version (void) { - fprintf(stdout, _("oggdec from %s %s\n"), PACKAGE, VERSION); -} - -static void usage(void) -{ - version (); - fprintf(stdout, _(" by the Xiph.Org Foundation (http://www.xiph.org/)\n\n")); - fprintf(stdout, _("Usage: oggdec [options] file1.ogg [file2.ogg ... fileN.ogg]\n\n")); - fprintf(stdout, _("Supported options:\n")); - fprintf(stdout, _(" --quiet, -Q Quiet mode. No console output.\n")); - fprintf(stdout, _(" --help, -h Produce this help message.\n")); - fprintf(stdout, _(" --version, -V Print out version number.\n")); - fprintf(stdout, _(" --bits, -b Bit depth for output (8 and 16 supported)\n")); - fprintf(stdout, _(" --endianness, -e Output endianness for 16-bit output; 0 for\n" - " little endian (default), 1 for big endian.\n")); - fprintf(stdout, _(" --sign, -s Sign for output PCM; 0 for unsigned, 1 for\n" - " signed (default 1).\n")); - fprintf(stdout, _(" --raw, -R Raw (headerless) output.\n")); - fprintf(stdout, _(" --output, -o Output to given filename. May only be used\n" - " if there is only one input file, except in\n" - " raw mode.\n")); -} - -static void parse_options(int argc, char **argv) -{ - int option_index = 1; - int ret; - - while((ret = getopt_long(argc, argv, "QhVb:e:Rs:o:", - long_options, &option_index)) != -1) - { - switch(ret) - { - case 'Q': - quiet = 1; - break; - case 'h': - usage(); - exit(0); - break; - case 'V': - version(); - exit(0); - break; - case 's': - sign = atoi(optarg); - break; - case 'b': - bits = atoi(optarg); - if(bits <= 8) - bits = 8; - else - bits = 16; - break; - case 'e': - endian = atoi(optarg); - break; - case 'o': - outfilename = strdup(optarg); - break; - case 'R': - raw = 1; - break; - default: - fprintf(stderr, _("Internal error: Unrecognised argument\n")); - break; - } - } -} - -#define WRITE_U32(buf, x) *(buf) = (unsigned char)((x)&0xff);\ - *((buf)+1) = (unsigned char)(((x)>>8)&0xff);\ - *((buf)+2) = (unsigned char)(((x)>>16)&0xff);\ - *((buf)+3) = (unsigned char)(((x)>>24)&0xff); - -#define WRITE_U16(buf, x) *(buf) = (unsigned char)((x)&0xff);\ - *((buf)+1) = (unsigned char)(((x)>>8)&0xff); - -/* Some of this based on ao/src/ao_wav.c */ -int write_prelim_header(OggVorbis_File *vf, FILE *out, ogg_int64_t knownlength) { - unsigned int size = 0x7fffffff; - int channels = ov_info(vf,0)->channels; - int samplerate = ov_info(vf,0)->rate; - int bytespersec = channels*samplerate*bits/8; - int align = channels*bits/8; - int samplesize = bits; - - if(knownlength && knownlength*bits/8*channels < size) - size = (unsigned int)(knownlength*bits/8*channels+44) ; - - memcpy(headbuf, "RIFF", 4); - WRITE_U32(headbuf+4, size-8); - memcpy(headbuf+8, "WAVE", 4); - memcpy(headbuf+12, "fmt ", 4); - WRITE_U32(headbuf+16, 16); - WRITE_U16(headbuf+20, 1); /* format */ - WRITE_U16(headbuf+22, channels); - WRITE_U32(headbuf+24, samplerate); - WRITE_U32(headbuf+28, bytespersec); - WRITE_U16(headbuf+32, align); - WRITE_U16(headbuf+34, samplesize); - memcpy(headbuf+36, "data", 4); - WRITE_U32(headbuf+40, size - 44); - - if(fwrite(headbuf, 1, 44, out) != 44) { - fprintf(stderr, _("ERROR: Failed to write Wave header: %s\n"), strerror(errno)); - return 1; - } - - return 0; -} - -int rewrite_header(FILE *out, unsigned int written) -{ - unsigned int length = written; - - length += 44; - - WRITE_U32(headbuf+4, length-8); - WRITE_U32(headbuf+40, length-44); - if(fseek(out, 0, SEEK_SET) != 0) - return 1; - - if(fwrite(headbuf, 1, 44, out) != 44) { - fprintf(stderr, _("ERROR: Failed to write Wave header: %s\n"), strerror(errno)); - return 1; - } - return 0; -} - -static FILE *open_input(char *infile) -{ - FILE *in; - - if(!infile) { -#ifdef __BORLANDC__ - setmode(fileno(stdin), O_BINARY); -#elif _WIN32 - _setmode(_fileno(stdin), _O_BINARY); -#endif - in = stdin; - } - else { - in = fopen(infile, "rb"); - if(!in) { - fprintf(stderr, _("ERROR: Failed to open input file: %s\n"), strerror(errno)); - return NULL; - } - } - - return in; -} - -static FILE *open_output(char *outfile) -{ - FILE *out; - if(!outfile) { -#ifdef __BORLANDC__ - setmode(fileno(stdout), O_BINARY); -#elif _WIN32 - _setmode(_fileno(stdout), _O_BINARY); -#endif - out = stdout; - } - else { - out = fopen(outfile, "wb"); - if(!out) { - fprintf(stderr, _("ERROR: Failed to open output file: %s\n"), strerror(errno)); - return NULL; - } - } - - return out; -} - -static void -permute_channels(char *in, char *out, int len, int channels, int bytespersample) -{ - int permute[6][6] = {{0}, {0,1}, {0,2,1}, {0,1,2,3}, {0,1,2,3,4}, - {0,2,1,5,3,4}}; - int i,j,k; - int samples = len/channels/bytespersample; - - /* Can't handle, don't try */ - if (channels > 6) - return; - - for (i=0; i < samples; i++) { - for (j=0; j < channels; j++) { - for (k=0; k < bytespersample; k++) { - out[i*bytespersample*channels + - bytespersample*permute[channels-1][j] + k] = - in[i*bytespersample*channels + bytespersample*j + k]; - } - } - } -} - -static int decode_file(FILE *in, FILE *out, char *infile, char *outfile) -{ - OggVorbis_File vf; - int bs = 0; - char buf[8192], outbuf[8192]; - char *p_outbuf; - int buflen = 8192; - unsigned int written = 0; - int ret; - ogg_int64_t length = 0; - ogg_int64_t done = 0; - int size = 0; - int seekable = 0; - int percent = 0; - int channels; - int samplerate; - - if (ov_open_callbacks(in, &vf, NULL, 0, OV_CALLBACKS_DEFAULT) < 0) { - fprintf(stderr, _("ERROR: Failed to open input as Vorbis\n")); - fclose(in); - return 1; - } - - channels = ov_info(&vf,0)->channels; - samplerate = ov_info(&vf,0)->rate; - - if(ov_seekable(&vf)) { - int link; - int chainsallowed = 0; - for(link = 0; link < ov_streams(&vf); link++) { - if(ov_info(&vf, link)->channels == channels && - ov_info(&vf, link)->rate == samplerate) - { - chainsallowed = 1; - } - } - - seekable = 1; - if(chainsallowed) - length = ov_pcm_total(&vf, -1); - else - length = ov_pcm_total(&vf, 0); - size = bits/8 * channels; - if(!quiet) - fprintf(stderr, _("Decoding \"%s\" to \"%s\"\n"), - infile?infile:_("standard input"), - outfile?outfile:_("standard output")); - } - - if(!raw) { - if(write_prelim_header(&vf, out, length)) { - ov_clear(&vf); - return 1; - } - } - - while((ret = ov_read(&vf, buf, buflen, endian, bits/8, sign, &bs)) != 0) { - if(bs != 0) { - vorbis_info *vi = ov_info(&vf, -1); - if(channels != vi->channels || samplerate != vi->rate) { - fprintf(stderr, _("Logical bitstreams with changing parameters are not supported\n")); - break; - } - } - - if(ret < 0 ) { - if( !quiet ) { - fprintf(stderr, _("WARNING: hole in data (%d)\n"), ret); - } - continue; - } - - if(channels > 2 && !raw) { - /* Then permute! */ - permute_channels(buf, outbuf, ret, channels, bits/8); - p_outbuf = outbuf; - } - else { - p_outbuf = buf; - } - - if(fwrite(p_outbuf, 1, ret, out) != ret) { - fprintf(stderr, _("Error writing to file: %s\n"), strerror(errno)); - ov_clear(&vf); - return 1; - } - - written += ret; - if(!quiet && seekable) { - done += ret/size; - if((double)done/(double)length * 200. > (double)percent) { - percent = (int)((double)done/(double)length *200); - fprintf(stderr, "\r\t[%5.1f%%]", (double)percent/2.); - } - } - } - - if(seekable && !quiet) - fprintf(stderr, "\n"); - - if(!raw) - rewrite_header(out, written); /* We don't care if it fails, too late */ - - ov_clear(&vf); - - return 0; -} - -int main(int argc, char **argv) -{ - int i; - - if(argc == 1) { - usage(); - return 1; - } - - parse_options(argc,argv); - - if(!quiet) - version(); - - if(optind >= argc) { - fprintf(stderr, _("ERROR: No input files specified. Use -h for help\n")); - return 1; - } - - if(argc - optind > 1 && outfilename && !raw) { - fprintf(stderr, _("ERROR: Can only specify one input file if output filename is specified\n")); - return 1; - } - - if(outfilename && raw) { - FILE *infile, *outfile; - char *infilename; - - if(!strcmp(outfilename, "-")) { - outfilename = NULL; - outfile = open_output(NULL); - } - else - outfile = open_output(outfilename); - - if(!outfile) - return 1; - - for(i=optind; i < argc; i++) { - if(!strcmp(argv[i], "-")) { - infilename = NULL; - infile = open_input(NULL); - } - else { - infilename = argv[i]; - infile = open_input(argv[i]); - } - - if(!infile) { - fclose(outfile); - return 1; - } - if(decode_file(infile, outfile, infilename, outfilename)) { - fclose(outfile); - return 1; - } - - } - - fclose(outfile); - } - else { - for(i=optind; i < argc; i++) { - char *in, *out; - FILE *infile, *outfile; - - if(!strcmp(argv[i], "-")) - in = NULL; - else - in = argv[i]; - - if(outfilename) { - if(!strcmp(outfilename, "-")) - out = NULL; - else - out = outfilename; - } - else { - char *end = strrchr(argv[i], '.'); - end = end?end:(argv[i] + strlen(argv[i]) + 1); - - out = malloc(strlen(argv[i]) + 10); - strncpy(out, argv[i], end-argv[i]); - out[end-argv[i]] = 0; - if(raw) - strcat(out, ".raw"); - else - strcat(out, ".wav"); - } - - infile = open_input(in); - if(!infile) - return 1; - outfile = open_output(out); - if(!outfile) { - fclose(infile); - return 1; - } - - if(decode_file(infile, outfile, in, out)) { - fclose(outfile); - return 1; - } - - if(!outfilename) - free(out); - - fclose(outfile); - } - } - - if(outfilename) - free(outfilename); - - return 0; -} diff --git a/src/lib/dl/ext/vorbtool/oggenc.c b/src/lib/dl/ext/vorbtool/oggenc.c deleted file mode 100755 index 801d3515..00000000 --- a/src/lib/dl/ext/vorbtool/oggenc.c +++ /dev/null @@ -1,1090 +0,0 @@ -/* OggEnc - * - * This program is distributed under the GNU General Public License, version 2. - * A copy of this license is included with this source. - * - * Copyright 2000-2005, Michael Smith <msmith@xiph.org> - * - * Portions from Vorbize, (c) Kenneth Arnold <kcarnold-xiph@arnoldnet.net> - * and libvorbis examples, (c) Monty <monty@xiph.org> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/* Watcom C unistd.h defines the vars? */ -#define DONT_DEFINE_GETOPT_VARS - -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include "getopt.h" -#include <string.h> -#include <time.h> -#include <locale.h> -#include <errno.h> -#include <sys/types.h> -#include <unistd.h> -#if defined WIN32 || defined _WIN32 -#include <process.h> -#endif - -#include "platform.h" -#include "encode.h" -#include "audio.h" -#include "utf8.h" -#include "i18n.h" - -#define CHUNK 4096 /* We do reads, etc. in multiples of this */ - -struct option long_options[] = { - {"quiet",0,0,'Q'}, - {"help",0,0,'h'}, - {"skeleton",no_argument,NULL, 'k'}, - {"comment",1,0,'c'}, - {"artist",1,0,'a'}, - {"album",1,0,'l'}, - {"title",1,0,'t'}, - {"genre",1,0,'G'}, - {"names",1,0,'n'}, - {"name-remove",1,0,'X'}, - {"name-replace",1,0,'P'}, - {"output",1,0,'o'}, - {"version",0,0,'V'}, - {"raw",0,0,'r'}, - {"raw-bits",1,0,'B'}, - {"raw-chan",1,0,'C'}, - {"raw-rate",1,0,'R'}, - {"raw-endianness",1,0, 0}, - {"bitrate",1,0,'b'}, - {"min-bitrate",1,0,'m'}, - {"max-bitrate",1,0,'M'}, - {"quality",1,0,'q'}, - {"date",1,0,'d'}, - {"tracknum",1,0,'N'}, - {"serial",1,0,'s'}, - {"managed", 0, 0, 0}, - {"resample",1,0,0}, - {"downmix", 0,0,0}, - {"scale", 1, 0, 0}, - {"advanced-encode-option", 1, 0, 0}, - {"discard-comments", 0, 0, 0}, - {"utf8", 0,0,0}, - {"ignorelength", 0, 0, 0}, - {"lyrics",1,0,'L'}, - {"lyrics-language",1,0,'Y'}, - {NULL,0,0,0} -}; - -static char *generate_name_string(char *format, char *remove_list, - char *replace_list, char *artist, char *title, char *album, - char *track, char *date, char *genre); -static void parse_options(int argc, char **argv, oe_options *opt); -static void build_comments(vorbis_comment *vc, oe_options *opt, int filenum, - char **artist,char **album, char **title, char **tracknum, char **date, - char **genre); -static void usage(void); - -int main(int argc, char **argv) -{ - /* Default values */ - oe_options opt = { - NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, - NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, - 1, 0, 0, 0, - 16,44100,2, 0, - NULL, DEFAULT_NAMEFMT_REMOVE, DEFAULT_NAMEFMT_REPLACE, - NULL, - 0, -1,-1,-1, - .3,-1, - 0,0,0.f, - 0, 0, 0, 0, 0}; - - int i; - - char **infiles; - int numfiles; - int errors=0; - - get_args_from_ucs16(&argc, &argv); - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - parse_options(argc, argv, &opt); - - if(optind >= argc) - { - fprintf(stderr, _("ERROR: No input files specified. Use -h for help.\n")); - return 1; - } - else - { - infiles = argv + optind; - numfiles = argc - optind; - } - - /* Now, do some checking for illegal argument combinations */ - - for(i = 0; i < numfiles; i++) - { - if(!strcmp(infiles[i], "-") && numfiles > 1) - { - fprintf(stderr, _("ERROR: Multiple files specified when using stdin\n")); - exit(1); - } - } - - if(numfiles > 1 && opt.outfile) - { - fprintf(stderr, _("ERROR: Multiple input files with specified output filename: suggest using -n\n")); - exit(1); - } - - if(!opt.fixedserial) - { - /* We randomly pick a serial number. This is then incremented for each - file. The random seed includes the PID so two copies of oggenc that - start in the same second will generate different serial numbers. */ - /* Jonathan C: MS-DOS does not have getpid() nor can it run multiple instances concurrently */ - srand(time(NULL)); - opt.serial = rand(); - } - opt.skeleton_serial = opt.serial + numfiles; - opt.kate_serial = opt.skeleton_serial + numfiles; - - for(i = 0; i < numfiles; i++) - { - /* Once through the loop for each file */ - - oe_enc_opt enc_opts; - vorbis_comment vc; - char *out_fn = NULL; - FILE *in, *out = NULL; - int foundformat = 0; - int closeout = 0, closein = 0; - char *artist=NULL, *album=NULL, *title=NULL, *track=NULL; - char *date=NULL, *genre=NULL; - char *lyrics=NULL, *lyrics_language=NULL; - input_format *format; - int resampled = 0; - - /* Set various encoding defaults */ - - enc_opts.serialno = opt.serial++; - enc_opts.skeleton_serialno = opt.skeleton_serial++; - enc_opts.kate_serialno = opt.kate_serial++; - enc_opts.progress_update = update_statistics_full; - enc_opts.start_encode = start_encode_full; - enc_opts.end_encode = final_statistics; - enc_opts.error = encode_error; - enc_opts.comments = &vc; - enc_opts.copy_comments = opt.copy_comments; - enc_opts.with_skeleton = opt.with_skeleton; - enc_opts.ignorelength = opt.ignorelength; - - /* OK, let's build the vorbis_comments structure */ - build_comments(&vc, &opt, i, &artist, &album, &title, &track, - &date, &genre); - - if(opt.lyrics_count) - { - if(i >= opt.lyrics_count) - { - lyrics = NULL; - } - else - lyrics = opt.lyrics[i]; - } - - if(opt.lyrics_language_count) - { - if(i >= opt.lyrics_language_count) - { - if(!opt.quiet) - fprintf(stderr, _("WARNING: Insufficient lyrics languages specified, defaulting to final lyrics language.\n")); - lyrics_language = opt.lyrics_language[opt.lyrics_language_count-1]; - } - else - lyrics_language = opt.lyrics_language[i]; - } - - if(!strcmp(infiles[i], "-")) - { - setbinmode(stdin); - in = stdin; - infiles[i] = NULL; - if(!opt.outfile) - { - setbinmode(stdout); - out = stdout; - } - } - else - { - in = oggenc_fopen(infiles[i], "rb", opt.isutf8); - - if(in == NULL) - { - fprintf(stderr, _("ERROR: Cannot open input file \"%s\": %s\n"), infiles[i], strerror(errno)); - free(out_fn); - errors++; - continue; - } - - closein = 1; - } - - /* Now, we need to select an input audio format - we do this before opening - the output file so that we don't end up with a 0-byte file if the input - file can't be read */ - - if(opt.rawmode) - { - input_format raw_format = {NULL, 0, raw_open, wav_close, "raw", - N_("RAW file reader")}; - - enc_opts.rate=opt.raw_samplerate; - enc_opts.channels=opt.raw_channels; - enc_opts.samplesize=opt.raw_samplesize; - enc_opts.endianness=opt.raw_endianness; - - format = &raw_format; - format->open_func(in, &enc_opts, NULL, 0); - foundformat=1; - } - else - { - format = open_audio_file(in, &enc_opts); - if(format) - { - if(!opt.quiet) - fprintf(stderr, _("Opening with %s module: %s\n"), - format->format, format->description); - foundformat=1; - } - - } - - if(!foundformat) - { - fprintf(stderr, _("ERROR: Input file \"%s\" is not a supported format\n"), infiles[i]?infiles[i]:"(stdin)"); - if(closein) - fclose(in); - errors++; - continue; - } - - /* Ok. We can read the file - so now open the output file */ - - if(opt.outfile && !strcmp(opt.outfile, "-")) - { - setbinmode(stdout); - out = stdout; - } - else if(out == NULL) - { - if(opt.outfile) - { - out_fn = strdup(opt.outfile); - } - else if(opt.namefmt) - { - out_fn = generate_name_string(opt.namefmt, opt.namefmt_remove, - opt.namefmt_replace, artist, title, album, track,date, - genre); - } - /* This bit was widely derided in mid-2002, so it's been removed */ - /* - else if(opt.title) - { - out_fn = malloc(strlen(title) + 5); - strcpy(out_fn, title); - strcat(out_fn, ".ogg"); - } - */ - else if(infiles[i]) - { - /* Create a filename from existing filename, replacing extension with .ogg or .oga */ - char *start, *end; - char *extension; - - /* if adding Skeleton or Kate, we're not Vorbis I anymore */ - extension = (opt.with_skeleton || opt.lyrics_count>0) ? ".oga" : ".ogg"; - - start = infiles[i]; - end = strrchr(infiles[i], '.'); - end = end?end:(start + strlen(infiles[i])+1); - - /* NTS: Looking over this code carefully, it either appends ".ogg" or replaces the extension with ".ogg" - * which is perfectly fine for this MS-DOS port knowing that DOS 8.3 limitations would not like - * ".wav.ogg". If the user is running us under FreeDOS with the LFN driver enabled, or in a Windows 9x - * DOS Box, then the limit does not apply. ---Jonathan C */ - out_fn = malloc(end - start + 5); - strncpy(out_fn, start, end-start); - out_fn[end-start] = 0; - strcat(out_fn, extension); - } - else { - /* if adding skeleton or kate, we're not Vorbis I anymore */ - if (opt.with_skeleton || opt.lyrics_count>0) - out_fn = strdup("default.oga"); - else - out_fn = strdup("default.ogg"); - fprintf(stderr, _("WARNING: No filename, defaulting to \"%s\"\n"), out_fn); - } - - /* Create any missing subdirectories, if possible */ - if(create_directories(out_fn, opt.isutf8)) { - if(closein) - fclose(in); - fprintf(stderr, _("ERROR: Could not create required subdirectories for output filename \"%s\"\n"), out_fn); - errors++; - free(out_fn); - continue; - } - - if(infiles[i] && !strcmp(infiles[i], out_fn)) { - fprintf(stderr, _("ERROR: Input filename is the same as output filename \"%s\"\n"), out_fn); - errors++; - free(out_fn); - continue; - } - - out = oggenc_fopen(out_fn, "wb", opt.isutf8); - if(out == NULL) - { - if(closein) - fclose(in); - fprintf(stderr, _("ERROR: Cannot open output file \"%s\": %s\n"), out_fn, strerror(errno)); - errors++; - free(out_fn); - continue; - } - closeout = 1; - } - - /* Now, set the rest of the options */ - enc_opts.out = out; - enc_opts.comments = &vc; -#ifdef _WIN32 - if (opt.isutf8) { - enc_opts.filename = NULL; - enc_opts.infilename = NULL; - utf8_decode(out_fn, &enc_opts.filename); - utf8_decode(infiles[i], &enc_opts.infilename); - } else { - enc_opts.filename = strdup(out_fn); - enc_opts.infilename = strdup(infiles[i]); - } -#else - enc_opts.filename = out_fn; - enc_opts.infilename = infiles[i]; -#endif - enc_opts.managed = opt.managed; - enc_opts.bitrate = opt.nominal_bitrate; - enc_opts.min_bitrate = opt.min_bitrate; - enc_opts.max_bitrate = opt.max_bitrate; - enc_opts.quality = opt.quality; - enc_opts.quality_set = opt.quality_set; - enc_opts.advopt = opt.advopt; - enc_opts.advopt_count = opt.advopt_count; - enc_opts.lyrics = lyrics; - enc_opts.lyrics_language = lyrics_language; - - if(opt.resamplefreq && opt.resamplefreq != enc_opts.rate) { - int fromrate = enc_opts.rate; - - resampled = 1; - enc_opts.resamplefreq = opt.resamplefreq; - if(setup_resample(&enc_opts)) { - errors++; - goto clear_all; - } - else if(!opt.quiet) - fprintf(stderr, _("Resampling input from %d Hz to %d Hz\n"), fromrate, opt.resamplefreq); - } - - if(opt.downmix) { - if(enc_opts.channels == 2) { - setup_downmix(&enc_opts); - if(!opt.quiet) - fprintf(stderr, _("Downmixing stereo to mono\n")); - } - else { - fprintf(stderr, _("WARNING: Can't downmix except from stereo to mono\n")); - opt.downmix = 0; - } - } - - if(opt.scale > 0.f) { - setup_scaler(&enc_opts, opt.scale); - if(!opt.quiet) - fprintf(stderr, _("Scaling input to %f\n"), opt.scale); - } - - - if(!enc_opts.total_samples_per_channel) - enc_opts.progress_update = update_statistics_notime; - - if(opt.quiet) - { - enc_opts.start_encode = start_encode_null; - enc_opts.progress_update = update_statistics_null; - enc_opts.end_encode = final_statistics_null; - } - - if(oe_encode(&enc_opts)) - errors++; - - if(opt.scale > 0) - clear_scaler(&enc_opts); - if(opt.downmix) - clear_downmix(&enc_opts); - if(resampled) - clear_resample(&enc_opts); -clear_all: - - if(out_fn) free(out_fn); - if(opt.outfile) free(opt.outfile); -#ifdef _WIN32 - if(enc_opts.filename) free(enc_opts.filename); - if(enc_opts.infilename) free(enc_opts.infilename); -#endif - vorbis_comment_clear(&vc); - format->close_func(enc_opts.readdata); - - if(closein) - fclose(in); - if(closeout) - fclose(out); - }/* Finished this file, loop around to next... */ - - return errors?1:0; - -} - -static void usage(void) -{ - fprintf(stdout, _("oggenc from %s %s"), PACKAGE, VERSION); - fprintf(stdout, _(" by the Xiph.Org Foundation (http://www.xiph.org/)\n\n")); - fprintf(stdout, _("Usage: oggenc [options] inputfile [...]\n\n")); - fprintf(stdout, _("OPTIONS:\n" - " General:\n" - " -Q, --quiet Produce no output to stderr\n" - " -h, --help Print this help text\n" - " -V, --version Print the version number\n")); - fprintf(stdout, _( - " -k, --skeleton Adds an Ogg Skeleton bitstream\n" - " -r, --raw Raw mode. Input files are read directly as PCM data\n" - " -B, --raw-bits=n Set bits/sample for raw input; default is 16\n" - " -C, --raw-chan=n Set number of channels for raw input; default is 2\n" - " -R, --raw-rate=n Set samples/sec for raw input; default is 44100\n" - " --raw-endianness 1 for bigendian, 0 for little (defaults to 0)\n")); - fprintf(stdout, _( - " -b, --bitrate Choose a nominal bitrate to encode at. Attempt\n" - " to encode at a bitrate averaging this. Takes an\n" - " argument in kbps. By default, this produces a VBR\n" - " encoding, equivalent to using -q or --quality.\n" - " See the --managed option to use a managed bitrate\n" - " targetting the selected bitrate.\n")); - fprintf(stdout, _( - " --managed Enable the bitrate management engine. This will allow\n" - " much greater control over the precise bitrate(s) used,\n" - " but encoding will be much slower. Don't use it unless\n" - " you have a strong need for detailed control over\n" - " bitrate, such as for streaming.\n")); - fprintf(stdout, _( - " -m, --min-bitrate Specify a minimum bitrate (in kbps). Useful for\n" - " encoding for a fixed-size channel. Using this will\n" - " automatically enable managed bitrate mode (see\n" - " --managed).\n" - " -M, --max-bitrate Specify a maximum bitrate in kbps. Useful for\n" - " streaming applications. Using this will automatically\n" - " enable managed bitrate mode (see --managed).\n")); - fprintf(stdout, _( - " --advanced-encode-option option=value\n" - " Sets an advanced encoder option to the given value.\n" - " The valid options (and their values) are documented\n" - " in the man page supplied with this program. They are\n" - " for advanced users only, and should be used with\n" - " caution.\n")); - fprintf(stdout, _( - " -q, --quality Specify quality, between -1 (very low) and 10 (very\n" - " high), instead of specifying a particular bitrate.\n" - " This is the normal mode of operation.\n" - " Fractional qualities (e.g. 2.75) are permitted\n" - " The default quality level is 3.\n")); - fprintf(stdout, _( - " --resample n Resample input data to sampling rate n (Hz)\n" - " --downmix Downmix stereo to mono. Only allowed on stereo\n" - " input.\n" - " -s, --serial Specify a serial number for the stream. If encoding\n" - " multiple files, this will be incremented for each\n" - " stream after the first.\n")); - fprintf(stdout, _( - " --discard-comments Prevents comments in FLAC and Ogg FLAC files from\n" - " being copied to the output Ogg Vorbis file.\n" - " --ignorelength Ignore the datalength in Wave headers. This allows\n" - " support for files > 4GB and STDIN data streams. \n" - "\n")); - fprintf(stdout, _( - " Naming:\n" - " -o, --output=fn Write file to fn (only valid in single-file mode)\n" - " -n, --names=string Produce filenames as this string, with %%a, %%t, %%l,\n" - " %%n, %%d replaced by artist, title, album, track number,\n" - " and date, respectively (see below for specifying these).\n" - " %%%% gives a literal %%.\n")); - fprintf(stdout, _( - " -X, --name-remove=s Remove the specified characters from parameters to the\n" - " -n format string. Useful to ensure legal filenames.\n" - " -P, --name-replace=s Replace characters removed by --name-remove with the\n" - " characters specified. If this string is shorter than the\n" - " --name-remove list or is not specified, the extra\n" - " characters are just removed.\n" - " Default settings for the above two arguments are platform\n" - " specific.\n")); - fprintf(stdout, _( - " --utf8 Tells oggenc that the command line parameters date, title,\n" - " album, artist, genre, and comment are already in UTF-8.\n" - " On Windows, this switch applies to file names too.\n" - " -c, --comment=c Add the given string as an extra comment. This may be\n" - " used multiple times. The argument should be in the\n" - " format \"tag=value\".\n" - " -d, --date Date for track (usually date of performance)\n")); - fprintf(stdout, _( - " -N, --tracknum Track number for this track\n" - " -t, --title Title for this track\n" - " -l, --album Name of album\n" - " -a, --artist Name of artist\n" - " -G, --genre Genre of track\n")); - fprintf(stdout, _( - " -L, --lyrics Include lyrics from given file (.srt or .lrc format)\n" - " -Y, --lyrics-language Sets the language for the lyrics\n")); - fprintf(stdout, _( - " If multiple input files are given, then multiple\n" - " instances of the previous eight arguments will be used,\n" - " in the order they are given. If fewer titles are\n" - " specified than files, OggEnc will print a warning, and\n" - " reuse the final one for the remaining files. If fewer\n" - " track numbers are given, the remaining files will be\n" - " unnumbered. If fewer lyrics are given, the remaining\n" - " files will not have lyrics added. For the others, the\n" - " final tag will be reused for all others without warning\n" - " (so you can specify a date once, for example, and have\n" - " it used for all the files)\n" - "\n")); - fprintf(stdout, _( - "INPUT FILES:\n" - " OggEnc input files must currently be 24, 16, or 8 bit PCM Wave, AIFF, or AIFF/C\n" - " files, 32 bit IEEE floating point Wave, and optionally FLAC or Ogg FLAC. Files\n" - " may be mono or stereo (or more channels) and any sample rate.\n" - " Alternatively, the --raw option may be used to use a raw PCM data file, which\n" - " must be 16 bit stereo little-endian PCM ('headerless Wave'), unless additional\n" - " parameters for raw mode are specified.\n" - " You can specify taking the file from stdin by using - as the input filename.\n" - " In this mode, output is to stdout unless an output filename is specified\n" - " with -o\n" - " Lyrics files may be in SubRip (.srt) or LRC (.lrc) format\n" - "\n")); -} - -static int strncpy_filtered(char *dst, char *src, int len, char *remove_list, - char *replace_list) -{ - char *hit, *drop_margin; - int used=0; - - if(remove_list == NULL || *remove_list == 0) - { - strncpy(dst, src, len-1); - dst[len-1] = 0; - return strlen(dst); - } - - drop_margin = remove_list + (replace_list == NULL?0:strlen(replace_list)); - - while(*src && used < len-1) - { - if((hit = strchr(remove_list, *src)) != NULL) - { - if(hit < drop_margin) - { - *dst++ = replace_list[hit - remove_list]; - used++; - } - } - else - { - *dst++ = *src; - used++; - } - src++; - } - *dst = 0; - - return used; -} - -static char *generate_name_string(char *format, char *remove_list, - char *replace_list, char *artist, char *title, char *album, - char *track, char *date, char *genre) -{ - char *buffer; - char next; - char *string; - int used=0; - int buflen; - - buffer = calloc(CHUNK+1,1); - buflen = CHUNK; - - while(*format && used < buflen) - { - next = *format++; - - if(next == '%') - { - switch(*format++) - { - case '%': - *(buffer+(used++)) = '%'; - break; - case 'a': - string = artist?artist:_("(none)"); - used += strncpy_filtered(buffer+used, string, buflen-used, - remove_list, replace_list); - break; - case 'd': - string = date?date:_("(none)"); - used += strncpy_filtered(buffer+used, string, buflen-used, - remove_list, replace_list); - break; - case 'g': - string = genre?genre:_("(none)"); - used += strncpy_filtered(buffer+used, string, buflen-used, - remove_list, replace_list); - break; - case 't': - string = title?title:_("(none)"); - used += strncpy_filtered(buffer+used, string, buflen-used, - remove_list, replace_list); - break; - case 'l': - string = album?album:_("(none)"); - used += strncpy_filtered(buffer+used, string, buflen-used, - remove_list, replace_list); - break; - case 'n': - string = track?track:_("(none)"); - used += strncpy_filtered(buffer+used, string, buflen-used, - remove_list, replace_list); - break; - default: - fprintf(stderr, _("WARNING: Ignoring illegal escape character '%c' in name format\n"), *(format - 1)); - break; - } - } - else - *(buffer + (used++)) = next; - } - - return buffer; -} - -static void parse_options(int argc, char **argv, oe_options *opt) -{ - int ret; - int option_index = 1; - - while((ret = getopt_long(argc, argv, "a:b:B:c:C:d:G:hkl:L:m:M:n:N:o:P:q:QrR:s:t:VX:Y:", - long_options, &option_index)) != -1) - { - switch(ret) - { - case 0: - if(!strcmp(long_options[option_index].name, "skeleton")) { - opt->with_skeleton = 1; - } - else if(!strcmp(long_options[option_index].name, "managed")) { - if(!opt->managed){ - if(!opt->quiet) - fprintf(stderr, - _("Enabling bitrate management engine\n")); - opt->managed = 1; - } - } - else if(!strcmp(long_options[option_index].name, - "raw-endianness")) { - if (opt->rawmode != 1) - { - opt->rawmode = 1; - fprintf(stderr, _("WARNING: Raw endianness specified for non-raw data. Assuming input is raw.\n")); - } - if(sscanf(optarg, "%d", &opt->raw_endianness) != 1) { - fprintf(stderr, _("WARNING: Couldn't read endianness argument \"%s\"\n"), optarg); - opt->raw_endianness = 0; - } - } - else if(!strcmp(long_options[option_index].name, - "resample")) { - if(sscanf(optarg, "%d", &opt->resamplefreq) != 1) { - fprintf(stderr, _("WARNING: Couldn't read resampling frequency \"%s\"\n"), optarg); - opt->resamplefreq = 0; - } - if(opt->resamplefreq < 100) /* User probably specified it - in kHz accidently */ - fprintf(stderr, - _("WARNING: Resample rate specified as %d Hz. Did you mean %d Hz?\n"), - opt->resamplefreq, opt->resamplefreq*1000); - } - else if(!strcmp(long_options[option_index].name, "downmix")) { - opt->downmix = 1; - } - else if(!strcmp(long_options[option_index].name, "scale")) { - opt->scale = atof(optarg); - if(sscanf(optarg, "%f", &opt->scale) != 1) { - opt->scale = 0; - fprintf(stderr, _("WARNING: Couldn't parse scaling factor \"%s\"\n"), - optarg); - } - } - else if(!strcmp(long_options[option_index].name, "utf8")) { - opt->isutf8 = 1; - } - else if(!strcmp(long_options[option_index].name, "advanced-encode-option")) { - char *arg = strdup(optarg); - char *val; - - if(strcmp("disable_coupling",arg)){ - val = strchr(arg, '='); - if(val == NULL) { - fprintf(stderr, _("No value for advanced encoder option found\n")); - continue; - } - else - *val++=0; - }else - val=0; - - opt->advopt = realloc(opt->advopt, (++opt->advopt_count)*sizeof(adv_opt)); - opt->advopt[opt->advopt_count - 1].arg = arg; - opt->advopt[opt->advopt_count - 1].val = val; - } - else if(!strcmp(long_options[option_index].name, "discard-comments")) { - opt->copy_comments = 0; - } - else if(!strcmp(long_options[option_index].name, "ignorelength")) { - opt->ignorelength = 1; - } - - else { - fprintf(stderr, _("Internal error parsing command line options\n")); - exit(1); - } - - break; - case 'a': - opt->artist = realloc(opt->artist, (++opt->artist_count)*sizeof(char *)); - opt->artist[opt->artist_count - 1] = strdup(optarg); - break; - case 'c': - if(strchr(optarg, '=') == NULL) { - fprintf(stderr, _("WARNING: Illegal comment used (\"%s\"), ignoring.\n"), optarg); - break; - } - opt->comments = realloc(opt->comments, (++opt->comment_count)*sizeof(char *)); - opt->comments[opt->comment_count - 1] = strdup(optarg); - break; - case 'd': - opt->dates = realloc(opt->dates, (++opt->date_count)*sizeof(char *)); - opt->dates[opt->date_count - 1] = strdup(optarg); - break; - case 'G': - opt->genre = realloc(opt->genre, (++opt->genre_count)*sizeof(char *)); - opt->genre[opt->genre_count - 1] = strdup(optarg); - break; - case 'h': - usage(); - exit(0); - break; - case 'l': - opt->album = realloc(opt->album, (++opt->album_count)*sizeof(char *)); - opt->album[opt->album_count - 1] = strdup(optarg); - break; - case 's': - /* Would just use atoi(), but that doesn't deal with unsigned - * ints. Damn */ - if(sscanf(optarg, "%u", &opt->serial) != 1) - opt->serial = 0; /* Failed, so just set to zero */ - else - opt->fixedserial = 1; - break; - case 't': - opt->title = realloc(opt->title, (++opt->title_count)*sizeof(char *)); - opt->title[opt->title_count - 1] = strdup(optarg); - break; - case 'b': - if(sscanf(optarg, "%d", &opt->nominal_bitrate) - != 1) { - fprintf(stderr, _("WARNING: nominal bitrate \"%s\" not recognised\n"), optarg); - opt->nominal_bitrate = -1; - } - - break; - case 'm': - if(sscanf(optarg, "%d", &opt->min_bitrate) - != 1) { - fprintf(stderr, _("WARNING: minimum bitrate \"%s\" not recognised\n"), optarg); - opt->min_bitrate = -1; - } - if(!opt->managed){ - if(!opt->quiet) - fprintf(stderr, - _("Enabling bitrate management engine\n")); - opt->managed = 1; - } - break; - case 'M': - if(sscanf(optarg, "%d", &opt->max_bitrate) - != 1) { - fprintf(stderr, _("WARNING: maximum bitrate \"%s\" not recognised\n"), optarg); - opt->max_bitrate = -1; - } - if(!opt->managed){ - if(!opt->quiet) - fprintf(stderr, - _("Enabling bitrate management engine\n")); - opt->managed = 1; - } - break; - case 'q': - if(sscanf(optarg, "%f", &opt->quality) != 1) { - fprintf(stderr, _("Quality option \"%s\" not recognised, ignoring\n"), optarg); - break; - } - opt->quality_set=1; - opt->quality *= 0.1; - if(opt->quality > 1.0f) - { - opt->quality = 1.0f; - fprintf(stderr, _("WARNING: quality setting too high, setting to maximum quality.\n")); - } - break; - case 'n': - if(opt->namefmt) - { - fprintf(stderr, _("WARNING: Multiple name formats specified, using final\n")); - free(opt->namefmt); - } - opt->namefmt = strdup(optarg); - break; - case 'X': - if(opt->namefmt_remove && - strcmp(opt->namefmt_remove, DEFAULT_NAMEFMT_REMOVE)) - { - fprintf(stderr, _("WARNING: Multiple name format filters specified, using final\n")); - free(opt->namefmt_remove); - } - opt->namefmt_remove = strdup(optarg); - break; - case 'P': - if(opt->namefmt_replace && - strcmp(opt->namefmt_replace, DEFAULT_NAMEFMT_REPLACE)) - { - fprintf(stderr, _("WARNING: Multiple name format filter replacements specified, using final\n")); - free(opt->namefmt_replace); - } - opt->namefmt_replace = strdup(optarg); - break; - case 'o': - if(opt->outfile) - { - fprintf(stderr, _("WARNING: Multiple output files specified, suggest using -n\n")); - free(opt->outfile); - } - opt->outfile = strdup(optarg); - break; - case 'Q': - opt->quiet = 1; - break; - case 'r': - opt->rawmode = 1; - break; - case 'V': - fprintf(stdout, _("oggenc from %s %s\n"), PACKAGE, VERSION); - exit(0); - break; - case 'B': - if (opt->rawmode != 1) - { - opt->rawmode = 1; - fprintf(stderr, _("WARNING: Raw bits/sample specified for non-raw data. Assuming input is raw.\n")); - } - if(sscanf(optarg, "%u", &opt->raw_samplesize) != 1) - { - opt->raw_samplesize = 16; /* Failed, so just set to 16 */ - fprintf(stderr, _("WARNING: Invalid bits/sample specified, assuming 16.\n")); - } - if((opt->raw_samplesize != 8) && (opt->raw_samplesize != 16)) - { - fprintf(stderr, _("WARNING: Invalid bits/sample specified, assuming 16.\n")); - } - break; - case 'C': - if (opt->rawmode != 1) - { - opt->rawmode = 1; - fprintf(stderr, _("WARNING: Raw channel count specified for non-raw data. Assuming input is raw.\n")); - } - if(sscanf(optarg, "%u", &opt->raw_channels) != 1) - { - opt->raw_channels = 2; /* Failed, so just set to 2 */ - fprintf(stderr, _("WARNING: Invalid channel count specified, assuming 2.\n")); - } - break; - case 'N': - opt->tracknum = realloc(opt->tracknum, (++opt->track_count)*sizeof(char *)); - opt->tracknum[opt->track_count - 1] = strdup(optarg); - break; - case 'R': - if (opt->rawmode != 1) - { - opt->rawmode = 1; - fprintf(stderr, _("WARNING: Raw sample rate specified for non-raw data. Assuming input is raw.\n")); - } - if(sscanf(optarg, "%u", &opt->raw_samplerate) != 1) - { - opt->raw_samplerate = 44100; /* Failed, so just set to 44100 */ - fprintf(stderr, _("WARNING: Invalid sample rate specified, assuming 44100.\n")); - } - break; - case 'k': - opt->with_skeleton = 1; - break; - case 'L': -#ifdef HAVE_KATE - opt->lyrics = realloc(opt->lyrics, (++opt->lyrics_count)*sizeof(char *)); - opt->lyrics[opt->lyrics_count - 1] = strdup(optarg); - opt->with_skeleton = 1; -#else - fprintf(stderr, _("WARNING: Kate support not compiled in; lyrics will not be included.\n")); -#endif - break; - case 'Y': -#ifdef HAVE_KATE - opt->lyrics_language = realloc(opt->lyrics_language, (++opt->lyrics_language_count)*sizeof(char *)); - opt->lyrics_language[opt->lyrics_language_count - 1] = strdup(optarg); - if (strlen(opt->lyrics_language[opt->lyrics_language_count - 1]) > 15) { - fprintf(stderr, _("WARNING: language can not be longer than 15 characters; truncated.\n")); - opt->lyrics_language[opt->lyrics_language_count - 1][15] = 0; - } -#else - fprintf(stderr, _("WARNING: Kate support not compiled in; lyrics will not be included.\n")); -#endif - break; - case '?': - fprintf(stderr, _("WARNING: Unknown option specified, ignoring->\n")); - break; - default: - usage(); - exit(0); - } - } - -} - -static void add_tag(vorbis_comment *vc, oe_options *opt,char *name, char *value) -{ - if (opt->isutf8) { - fprintf(stderr,"WARNING: This build does not accept UTF-8 tags\n"); - } - else { - if(name == NULL) - vorbis_comment_add(vc, value); - else - vorbis_comment_add_tag(vc, name, value); - } -} - -static void build_comments(vorbis_comment *vc, oe_options *opt, int filenum, - char **artist, char **album, char **title, char **tracknum, - char **date, char **genre) -{ - int i; - - vorbis_comment_init(vc); - - for(i = 0; i < opt->comment_count; i++) - add_tag(vc, opt, NULL, opt->comments[i]); - - if(opt->title_count) - { - if(filenum >= opt->title_count) - { - if(!opt->quiet) - fprintf(stderr, _("WARNING: Insufficient titles specified, defaulting to final title.\n")); - i = opt->title_count-1; - } - else - i = filenum; - - *title = opt->title[i]; - add_tag(vc, opt, "title", opt->title[i]); - } - - if(opt->artist_count) - { - if(filenum >= opt->artist_count) - i = opt->artist_count-1; - else - i = filenum; - - *artist = opt->artist[i]; - add_tag(vc, opt, "artist", opt->artist[i]); - } - - if(opt->genre_count) - { - if(filenum >= opt->genre_count) - i = opt->genre_count-1; - else - i = filenum; - - *genre = opt->genre[i]; - add_tag(vc, opt, "genre", opt->genre[i]); - } - - if(opt->date_count) - { - if(filenum >= opt->date_count) - i = opt->date_count-1; - else - i = filenum; - - *date = opt->dates[i]; - add_tag(vc, opt, "date", opt->dates[i]); - } - - if(opt->album_count) - { - if(filenum >= opt->album_count) - { - i = opt->album_count-1; - } - else - i = filenum; - - *album = opt->album[i]; - add_tag(vc, opt, "album", opt->album[i]); - } - - if(filenum < opt->track_count) - { - i = filenum; - *tracknum = opt->tracknum[i]; - add_tag(vc, opt, "tracknumber", opt->tracknum[i]); - } -} diff --git a/src/lib/dl/ext/vorbtool/ogginfo2.c b/src/lib/dl/ext/vorbtool/ogginfo2.c deleted file mode 100755 index f1152a4e..00000000 --- a/src/lib/dl/ext/vorbtool/ogginfo2.c +++ /dev/null @@ -1,1193 +0,0 @@ -/* Ogginfo - * - * A tool to describe ogg file contents and metadata. - * - * Copyright 2002-2005 Michael Smith <msmith@xiph.org> - * Licensed under the GNU GPL, distributed with this program. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <string.h> -#include <stdarg.h> -#include "getopt.h" /* TODO: eventually getopt.h and this getopt.c implementation should be it's own library */ -#include <math.h> - -#include <ext/libogg/ogg.h> -#include <ext/vorbis/codec.h> - -#ifdef HAVE_KATE -#endif - -#include <locale.h> -#include "utf8.h" -#include "i18n.h" - -#include "theora.h" - -#define CHUNK 4500 - -#ifdef _WIN32 -#define I64FORMAT "I64d" -#else -#define I64FORMAT "lld" -#endif - -struct vorbis_release { - char *vendor_string; - char *desc; -} releases[] = { - {"Xiphophorus libVorbis I 20000508", "1.0 beta 1 or beta 2"}, - {"Xiphophorus libVorbis I 20001031", "1.0 beta 3"}, - {"Xiphophorus libVorbis I 20010225", "1.0 beta 4"}, - {"Xiphophorus libVorbis I 20010615", "1.0 rc1"}, - {"Xiphophorus libVorbis I 20010813", "1.0 rc2"}, - {"Xiphophorus libVorbis I 20011217", "1.0 rc3"}, - {"Xiphophorus libVorbis I 20011231", "1.0 rc3"}, - {"Xiph.Org libVorbis I 20020717", "1.0"}, - {"Xiph.Org libVorbis I 20030909", "1.0.1"}, - {"Xiph.Org libVorbis I 20040629", "1.1.0"}, - {"Xiph.Org libVorbis I 20050304", "1.1.1"}, - {"Xiph.Org libVorbis I 20050304", "1.1.2"}, - {"Xiph.Org libVorbis I 20070622", "1.2.0"}, - {"Xiph.Org libVorbis I 20080501", "1.2.1"}, - {NULL, NULL}, - }; - - -/* TODO: - * - * - detect violations of muxing constraints - * - detect granulepos 'gaps' (possibly vorbis-specific). (seperate from - * serial-number gaps) - */ - -typedef struct _stream_processor { - void (*process_page)(struct _stream_processor *, ogg_page *); - void (*process_end)(struct _stream_processor *); - int isillegal; - int constraint_violated; - int shownillegal; - int isnew; - long seqno; - int lostseq; - - int start; - int end; - - int num; - char *type; - - ogg_uint32_t serial; /* must be 32 bit unsigned */ - ogg_stream_state os; - void *data; -} stream_processor; - -typedef struct { - stream_processor *streams; - int allocated; - int used; - - int in_headers; -} stream_set; - -typedef struct { - vorbis_info vi; - vorbis_comment vc; - - ogg_int64_t bytes; - ogg_int64_t lastgranulepos; - ogg_int64_t firstgranulepos; - - int doneheaders; -} misc_vorbis_info; - -typedef struct { - theora_info ti; - theora_comment tc; - - ogg_int64_t bytes; - ogg_int64_t lastgranulepos; - ogg_int64_t firstgranulepos; - - int doneheaders; - - ogg_int64_t framenum_expected; -} misc_theora_info; - -typedef struct { -#ifdef HAVE_KATE - kate_info ki; - kate_comment kc; -#else - int num_headers; -#endif - - int major; - int minor; - char language[16]; - char category[16]; - - ogg_int64_t bytes; - ogg_int64_t lastgranulepos; - ogg_int64_t firstgranulepos; - - int doneheaders; -} misc_kate_info; - -static int printlots = 0; -static int printinfo = 1; -static int printwarn = 1; -static int verbose = 1; - -static int flawed; - -#define CONSTRAINT_PAGE_AFTER_EOS 1 -#define CONSTRAINT_MUXING_VIOLATED 2 - -static stream_set *create_stream_set(void) { - stream_set *set = calloc(1, sizeof(stream_set)); - - set->streams = calloc(5, sizeof(stream_processor)); - set->allocated = 5; - set->used = 0; - - return set; -} - -static void info(char *format, ...) -{ - va_list ap; - - if(!printinfo) - return; - - va_start(ap, format); - vfprintf(stdout, format, ap); - va_end(ap); -} - -static void warn(char *format, ...) -{ - va_list ap; - - flawed = 1; - if(!printwarn) - return; - - va_start(ap, format); - vfprintf(stdout, format, ap); - va_end(ap); -} - -static void error(char *format, ...) -{ - va_list ap; - - flawed = 1; - - va_start(ap, format); - vfprintf(stdout, format, ap); - va_end(ap); -} - -static void check_xiph_comment(stream_processor *stream, int i, const char *comment, - int comment_length) -{ - char *sep = strchr(comment, '='); - int j; - int broken = 0; - unsigned char *val; - int bytes; - int remaining; - - if(sep == NULL) { - warn(_("WARNING: Comment %d in stream %d has invalid " - "format, does not contain '=': \"%s\"\n"), - i, stream->num, comment); - return; - } - - for(j=0; j < sep-comment; j++) { - if(comment[j] < 0x20 || comment[j] > 0x7D) { - warn(_("WARNING: Invalid comment fieldname in " - "comment %d (stream %d): \"%s\"\n"), - i, stream->num, comment); - broken = 1; - break; - } - } - - if(broken) - return; - - val = (unsigned char *)comment; - - j = sep-comment+1; - while(j < comment_length) - { - remaining = comment_length - j; - if((val[j] & 0x80) == 0) - bytes = 1; - else if((val[j] & 0x40) == 0x40) { - if((val[j] & 0x20) == 0) - bytes = 2; - else if((val[j] & 0x10) == 0) - bytes = 3; - else if((val[j] & 0x08) == 0) - bytes = 4; - else if((val[j] & 0x04) == 0) - bytes = 5; - else if((val[j] & 0x02) == 0) - bytes = 6; - else { - warn(_("WARNING: Illegal UTF-8 sequence in " - "comment %d (stream %d): length marker wrong\n"), - i, stream->num); - broken = 1; - break; - } - } - else { - warn(_("WARNING: Illegal UTF-8 sequence in comment " - "%d (stream %d): length marker wrong\n"), i, stream->num); - broken = 1; - break; - } - - if(bytes > remaining) { - warn(_("WARNING: Illegal UTF-8 sequence in comment " - "%d (stream %d): too few bytes\n"), i, stream->num); - broken = 1; - break; - } - - switch(bytes) { - case 1: - /* No more checks needed */ - break; - case 2: - if((val[j+1] & 0xC0) != 0x80) - broken = 1; - if((val[j] & 0xFE) == 0xC0) - broken = 1; - break; - case 3: - if(!((val[j] == 0xE0 && val[j+1] >= 0xA0 && val[j+1] <= 0xBF && - (val[j+2] & 0xC0) == 0x80) || - (val[j] >= 0xE1 && val[j] <= 0xEC && - (val[j+1] & 0xC0) == 0x80 && - (val[j+2] & 0xC0) == 0x80) || - (val[j] == 0xED && val[j+1] >= 0x80 && - val[j+1] <= 0x9F && - (val[j+2] & 0xC0) == 0x80) || - (val[j] >= 0xEE && val[j] <= 0xEF && - (val[j+1] & 0xC0) == 0x80 && - (val[j+2] & 0xC0) == 0x80))) - broken = 1; - if(val[j] == 0xE0 && (val[j+1] & 0xE0) == 0x80) - broken = 1; - break; - case 4: - if(!((val[j] == 0xF0 && val[j+1] >= 0x90 && - val[j+1] <= 0xBF && - (val[j+2] & 0xC0) == 0x80 && - (val[j+3] & 0xC0) == 0x80) || - (val[j] >= 0xF1 && val[j] <= 0xF3 && - (val[j+1] & 0xC0) == 0x80 && - (val[j+2] & 0xC0) == 0x80 && - (val[j+3] & 0xC0) == 0x80) || - (val[j] == 0xF4 && val[j+1] >= 0x80 && - val[j+1] <= 0x8F && - (val[j+2] & 0xC0) == 0x80 && - (val[j+3] & 0xC0) == 0x80))) - broken = 1; - if(val[j] == 0xF0 && (val[j+1] & 0xF0) == 0x80) - broken = 1; - break; - /* 5 and 6 aren't actually allowed at this point */ - case 5: - broken = 1; - break; - case 6: - broken = 1; - break; - } - - if(broken) { - char *simple = malloc (comment_length + 1); - char *seq = malloc (comment_length * 3 + 1); - static char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - int i, c1 = 0, c2 = 0; - for (i = 0; i < comment_length; i++) { - seq[c1++] = hex[((unsigned char)comment[i]) >> 4]; - seq[c1++] = hex[((unsigned char)comment[i]) & 0xf]; - seq[c1++] = ' '; - - if(comment[i] < 0x20 || comment[i] > 0x7D) - simple[c2++] = '?'; - else - simple[c2++] = comment[i]; - } - seq[c1] = 0; - simple[c2] = 0; - warn(_("WARNING: Illegal UTF-8 sequence in comment " - "%d (stream %d): invalid sequence \"%s\": %s\n"), i, - stream->num, simple, seq); - broken = 1; - free (simple); - free (seq); - break; - } - - j += bytes; - } - - if(!broken) { - *sep = 0; - info("\t%s=%s\n", comment, sep+1); - } -} - -static void theora_process(stream_processor *stream, ogg_page *page) -{ - ogg_packet packet; - misc_theora_info *inf = stream->data; - int i, header=0; - int res; - - ogg_stream_pagein(&stream->os, page); - if(inf->doneheaders < 3) - header = 1; - - while(1) { - res = ogg_stream_packetout(&stream->os, &packet); - if(res < 0) { - warn(_("WARNING: discontinuity in stream (%d)\n"), stream->num); - continue; - } - else if (res == 0) - break; - - if(inf->doneheaders < 3) { - if(theora_decode_header(&inf->ti, &inf->tc, &packet) < 0) { - warn(_("WARNING: Could not decode Theora header " - "packet - invalid Theora stream (%d)\n"), stream->num); - continue; - } - inf->doneheaders++; - if(inf->doneheaders == 3) { - if(ogg_page_granulepos(page) != 0 || ogg_stream_packetpeek(&stream->os, NULL) == 1) - warn(_("WARNING: Theora stream %d does not have headers " - "correctly framed. Terminal header page contains " - "additional packets or has non-zero granulepos\n"), - stream->num); - info(_("Theora headers parsed for stream %d, " - "information follows...\n"), stream->num); - - info(_("Version: %d.%d.%d\n"), inf->ti.version_major, inf->ti.version_minor, inf->ti.version_subminor); - - info(_("Vendor: %s\n"), inf->tc.vendor); - info(_("Width: %d\n"), inf->ti.frame_width); - info(_("Height: %d\n"), inf->ti.frame_height); - info(_("Total image: %d by %d, crop offset (%d, %d)\n"), - inf->ti.width, inf->ti.height, inf->ti.offset_x, inf->ti.offset_y); - if(inf->ti.offset_x + inf->ti.frame_width > inf->ti.width) - warn(_("Frame offset/size invalid: width incorrect\n")); - if(inf->ti.offset_y + inf->ti.frame_height > inf->ti.height) - warn(_("Frame offset/size invalid: height incorrect\n")); - - if(inf->ti.fps_numerator == 0 || inf->ti.fps_denominator == 0) - warn(_("Invalid zero framerate\n")); - else - info(_("Framerate %d/%d (%.02f fps)\n"), inf->ti.fps_numerator, inf->ti.fps_denominator, (float)inf->ti.fps_numerator/(float)inf->ti.fps_denominator); - - if(inf->ti.aspect_numerator == 0 || inf->ti.aspect_denominator == 0) - { - info(_("Aspect ratio undefined\n")); - } - else - { - float frameaspect = (float)inf->ti.frame_width/(float)inf->ti.frame_height * (float)inf->ti.aspect_numerator/(float)inf->ti.aspect_denominator; - info(_("Pixel aspect ratio %d:%d (%f:1)\n"), inf->ti.aspect_numerator, inf->ti.aspect_denominator, (float)inf->ti.aspect_numerator/(float)inf->ti.aspect_denominator); - if(fabs(frameaspect - 4.0/3.0) < 0.02) - info(_("Frame aspect 4:3\n")); - else if(fabs(frameaspect - 16.0/9.0) < 0.02) - info(_("Frame aspect 16:9\n")); - else - info(_("Frame aspect %f:1\n"), frameaspect); - } - - if(inf->ti.colorspace == OC_CS_ITU_REC_470M) - info(_("Colourspace: Rec. ITU-R BT.470-6 System M (NTSC)\n")); - else if(inf->ti.colorspace == OC_CS_ITU_REC_470BG) - info(_("Colourspace: Rec. ITU-R BT.470-6 Systems B and G (PAL)\n")); - else - info(_("Colourspace unspecified\n")); - - if(inf->ti.pixelformat == OC_PF_420) - info(_("Pixel format 4:2:0\n")); - else if(inf->ti.pixelformat == OC_PF_422) - info(_("Pixel format 4:2:2\n")); - else if(inf->ti.pixelformat == OC_PF_444) - info(_("Pixel format 4:4:4\n")); - else - warn(_("Pixel format invalid\n")); - - info(_("Target bitrate: %d kbps\n"), inf->ti.target_bitrate/1000); - info(_("Nominal quality setting (0-63): %d\n"), inf->ti.quality); - - if(inf->tc.comments > 0) - info(_("User comments section follows...\n")); - - for(i=0; i < inf->tc.comments; i++) { - char *comment = inf->tc.user_comments[i]; - check_xiph_comment(stream, i, comment, - inf->tc.comment_lengths[i]); - } - } - } - else { - ogg_int64_t framenum; - ogg_int64_t iframe,pframe; - ogg_int64_t gp = packet.granulepos; - - if(gp > 0) { - iframe=gp>>inf->ti.granule_shift; - pframe=gp-(iframe<<inf->ti.granule_shift); - framenum = iframe+pframe; - if(inf->framenum_expected >= 0 && - inf->framenum_expected != framenum) - { - warn(_("WARNING: Expected frame %" I64FORMAT - ", got %" I64FORMAT "\n"), - inf->framenum_expected, framenum); - } - inf->framenum_expected = framenum + 1; - } - else if (inf->framenum_expected >= 0) { - inf->framenum_expected++; - } - } - } - - if(!header) { - ogg_int64_t gp = ogg_page_granulepos(page); - if(gp > 0) { - if(gp < inf->lastgranulepos) - warn(_("WARNING: granulepos in stream %d decreases from %" - I64FORMAT " to %" I64FORMAT "\n"), - stream->num, inf->lastgranulepos, gp); - inf->lastgranulepos = gp; - } - if(inf->firstgranulepos < 0) { /* Not set yet */ - } - inf->bytes += page->header_len + page->body_len; - } -} - -static void theora_end(stream_processor *stream) -{ - misc_theora_info *inf = stream->data; - long minutes, seconds, milliseconds; - double bitrate, time; - - /* This should be lastgranulepos - startgranulepos, or something like that*/ - ogg_int64_t iframe=inf->lastgranulepos>>inf->ti.granule_shift; - ogg_int64_t pframe=inf->lastgranulepos-(iframe<<inf->ti.granule_shift); - time = (double)(iframe+pframe) / - ((float)inf->ti.fps_numerator/(float)inf->ti.fps_denominator); - minutes = (long)time / 60; - seconds = (long)time - minutes*60; - milliseconds = (long)((time - minutes*60 - seconds)*1000); - bitrate = inf->bytes*8 / time / 1000.0; - - info(_("Theora stream %d:\n" - "\tTotal data length: %" I64FORMAT " bytes\n" - "\tPlayback length: %ldm:%02ld.%03lds\n" - "\tAverage bitrate: %f kb/s\n"), - stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate); - - theora_comment_clear(&inf->tc); - theora_info_clear(&inf->ti); - - free(stream->data); -} - - -static void vorbis_process(stream_processor *stream, ogg_page *page ) -{ - ogg_packet packet; - misc_vorbis_info *inf = stream->data; - int i, header=0, packets=0; - int k; - int res; - - ogg_stream_pagein(&stream->os, page); - if(inf->doneheaders < 3) - header = 1; - - while(1) { - res = ogg_stream_packetout(&stream->os, &packet); - if(res < 0) { - warn(_("WARNING: discontinuity in stream (%d)\n"), stream->num); - continue; - } - else if (res == 0) - break; - - packets++; - if(inf->doneheaders < 3) { - if(vorbis_synthesis_headerin(&inf->vi, &inf->vc, &packet) < 0) { - warn(_("WARNING: Could not decode Vorbis header " - "packet %d - invalid Vorbis stream (%d)\n"), - inf->doneheaders, stream->num); - continue; - } - inf->doneheaders++; - if(inf->doneheaders == 3) { - if(ogg_page_granulepos(page) != 0 || ogg_stream_packetpeek(&stream->os, NULL) == 1) - warn(_("WARNING: Vorbis stream %d does not have headers " - "correctly framed. Terminal header page contains " - "additional packets or has non-zero granulepos\n"), - stream->num); - info(_("Vorbis headers parsed for stream %d, " - "information follows...\n"), stream->num); - - info(_("Version: %d\n"), inf->vi.version); - k = 0; - while(releases[k].vendor_string) { - if(!strcmp(inf->vc.vendor, releases[k].vendor_string)) { - info(_("Vendor: %s (%s)\n"), inf->vc.vendor, - releases[k].desc); - break; - } - k++; - } - if(!releases[k].vendor_string) - info(_("Vendor: %s\n"), inf->vc.vendor); - info(_("Channels: %d\n"), inf->vi.channels); - info(_("Rate: %ld\n\n"), inf->vi.rate); - - if(inf->vi.bitrate_nominal > 0) - info(_("Nominal bitrate: %f kb/s\n"), - (double)inf->vi.bitrate_nominal / 1000.0); - else - info(_("Nominal bitrate not set\n")); - - if(inf->vi.bitrate_upper > 0) - info(_("Upper bitrate: %f kb/s\n"), - (double)inf->vi.bitrate_upper / 1000.0); - else - info(_("Upper bitrate not set\n")); - - if(inf->vi.bitrate_lower > 0) - info(_("Lower bitrate: %f kb/s\n"), - (double)inf->vi.bitrate_lower / 1000.0); - else - info(_("Lower bitrate not set\n")); - - if(inf->vc.comments > 0) - info(_("User comments section follows...\n")); - - for(i=0; i < inf->vc.comments; i++) { - char *comment = inf->vc.user_comments[i]; - check_xiph_comment(stream, i, comment, - inf->vc.comment_lengths[i]); - } - } - } - } - - if(!header) { - ogg_int64_t gp = ogg_page_granulepos(page); - if(gp > 0) { - if(gp < inf->lastgranulepos) - warn(_("WARNING: granulepos in stream %d decreases from %" - I64FORMAT " to %" I64FORMAT "\n" ), - stream->num, inf->lastgranulepos, gp); - inf->lastgranulepos = gp; - } - else if(packets) { - /* Only do this if we saw at least one packet ending on this page. - * It's legal (though very unusual) to have no packets in a page at - * all - this is occasionally used to have an empty EOS page */ - warn(_("Negative or zero granulepos (%" I64FORMAT ") on Vorbis stream outside of headers. This file was created by a buggy encoder\n"), gp); - } - if(inf->firstgranulepos < 0) { /* Not set yet */ - } - inf->bytes += page->header_len + page->body_len; - } -} - -static void vorbis_end(stream_processor *stream) -{ - misc_vorbis_info *inf = stream->data; - long minutes, seconds, milliseconds; - double bitrate, time; - - /* This should be lastgranulepos - startgranulepos, or something like that*/ - time = (double)inf->lastgranulepos / inf->vi.rate; - minutes = (long)time / 60; - seconds = (long)time - minutes*60; - milliseconds = (long)((time - minutes*60 - seconds)*1000); - bitrate = inf->bytes*8 / time / 1000.0; - - info(_("Vorbis stream %d:\n" - "\tTotal data length: %" I64FORMAT " bytes\n" - "\tPlayback length: %ldm:%02ld.%03lds\n" - "\tAverage bitrate: %f kb/s\n"), - stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate); - - vorbis_comment_clear(&inf->vc); - vorbis_info_clear(&inf->vi); - - free(stream->data); -} - -static void kate_process(stream_processor *stream, ogg_page *page ) -{ - ogg_packet packet; - misc_kate_info *inf = stream->data; - int header=0, packets=0; - int res; -#ifdef HAVE_KATE -#endif - - ogg_stream_pagein(&stream->os, page); - if(!inf->doneheaders) - header = 1; - - while(1) { - res = ogg_stream_packetout(&stream->os, &packet); - if(res < 0) { - warn(_("WARNING: discontinuity in stream (%d)\n"), stream->num); - continue; - } - else if (res == 0) - break; - - packets++; - if(!inf->doneheaders) { -#ifdef HAVE_KATE -#else - /* if we're not building against libkate, do some limited checks */ - if (packet.bytes<64 || memcmp(packet.packet+1, "kate\0\0\0", 7)) { - warn(_("WARNING: packet %d does not seem to be a Kate header - " - "invalid Kate stream (%d)\n"), - packet.packetno, stream->num); - continue; - } - if (packet.packetno==inf->num_headers) { - inf->doneheaders=1; - } -#endif - - if (packet.packetno==0) { -#ifdef HAVE_KATE -#else - inf->major = packet.packet[9]; - inf->minor = packet.packet[10]; - inf->num_headers = packet.packet[11]; - memcpy(inf->language, packet.packet+32, 16); - inf->language[15] = 0; - memcpy(inf->category, packet.packet+48, 16); - inf->category[15] = 0; -#endif - } - - if(inf->doneheaders) { - if(ogg_page_granulepos(page) != 0 || ogg_stream_packetpeek(&stream->os, NULL) == 1) - warn(_("WARNING: Kate stream %d does not have headers " - "correctly framed. Terminal header page contains " - "additional packets or has non-zero granulepos\n"), - stream->num); - info(_("Kate headers parsed for stream %d, " - "information follows...\n"), stream->num); - - info(_("Version: %d.%d\n"), inf->major, inf->minor); -#ifdef HAVE_KATE -#endif - - if (*inf->language) { - info(_("Language: %s\n"), inf->language); - } - else { - info(_("No language set\n")); - } - if (*inf->category) { - info(_("Category: %s\n"), inf->category); - } - else { - info(_("No category set\n")); - } - -#ifdef HAVE_KATE -#endif - info(_("\n")); - } - } - } - - if(!header) { - ogg_int64_t gp = ogg_page_granulepos(page); - if(gp > 0) { - if(gp < inf->lastgranulepos) - warn(_("WARNING: granulepos in stream %d decreases from %" - I64FORMAT " to %" I64FORMAT "\n" ), - stream->num, inf->lastgranulepos, gp); - inf->lastgranulepos = gp; - } - else if(packets && gp<0) { /* zero granpos on data is valid for kate */ - /* Only do this if we saw at least one packet ending on this page. - * It's legal (though very unusual) to have no packets in a page at - * all - this is occasionally used to have an empty EOS page */ - warn(_("Negative granulepos (%" I64FORMAT ") on Kate stream outside of headers. This file was created by a buggy encoder\n"), gp); - } - if(inf->firstgranulepos < 0) { /* Not set yet */ - } - inf->bytes += page->header_len + page->body_len; - } -} - -#ifdef HAVE_KATE -#else -static void kate_end(stream_processor *stream) -{ -} -#endif - - -static void process_null(stream_processor *stream, ogg_page *page) -{ - /* This is for invalid streams. */ -} - -static void process_other(stream_processor *stream, ogg_page *page ) -{ - ogg_packet packet; - - ogg_stream_pagein(&stream->os, page); - - while(ogg_stream_packetout(&stream->os, &packet) > 0) { - /* Should we do anything here? Currently, we don't */ - } -} - - -static void free_stream_set(stream_set *set) -{ - int i; - for(i=0; i < set->used; i++) { - if(!set->streams[i].end) { - warn(_("WARNING: EOS not set on stream %d\n"), - set->streams[i].num); - if(set->streams[i].process_end) - set->streams[i].process_end(&set->streams[i]); - } - ogg_stream_clear(&set->streams[i].os); - } - - free(set->streams); - free(set); -} - -static int streams_open(stream_set *set) -{ - int i; - int res=0; - for(i=0; i < set->used; i++) { - if(!set->streams[i].end) - res++; - } - - return res; -} - -static void null_start(stream_processor *stream) -{ - stream->process_end = NULL; - stream->type = "invalid"; - stream->process_page = process_null; -} - -static void other_start(stream_processor *stream, char *type) -{ - if(type) - stream->type = type; - else - stream->type = "unknown"; - stream->process_page = process_other; - stream->process_end = NULL; -} - -static void theora_start(stream_processor *stream) -{ - misc_theora_info *info; - - stream->type = "theora"; - stream->process_page = theora_process; - stream->process_end = theora_end; - - stream->data = calloc(1, sizeof(misc_theora_info)); - info = stream->data; - info->framenum_expected = -1; -} - -static void vorbis_start(stream_processor *stream) -{ - misc_vorbis_info *info; - - stream->type = "vorbis"; - stream->process_page = vorbis_process; - stream->process_end = vorbis_end; - - stream->data = calloc(1, sizeof(misc_vorbis_info)); - - info = stream->data; - - vorbis_comment_init(&info->vc); - vorbis_info_init(&info->vi); - -} - -static void kate_start(stream_processor *stream) -{ - misc_kate_info *info; - - stream->type = "kate"; - stream->process_page = kate_process; - stream->process_end = kate_end; - - stream->data = calloc(1, sizeof(misc_kate_info)); - - info = stream->data; - -#ifdef HAVE_KATE -#endif -} - -static stream_processor *find_stream_processor(stream_set *set, ogg_page *page) -{ - ogg_uint32_t serial = ogg_page_serialno(page); - int i; - int invalid = 0; - int constraint = 0; - stream_processor *stream; - - for(i=0; i < set->used; i++) { - if(serial == set->streams[i].serial) { - /* We have a match! */ - stream = &(set->streams[i]); - - set->in_headers = 0; - /* if we have detected EOS, then this can't occur here. */ - if(stream->end) { - stream->isillegal = 1; - stream->constraint_violated = CONSTRAINT_PAGE_AFTER_EOS; - return stream; - } - - stream->isnew = 0; - stream->start = ogg_page_bos(page); - stream->end = ogg_page_eos(page); - stream->serial = serial; - return stream; - } - } - - /* If there are streams open, and we've reached the end of the - * headers, then we can't be starting a new stream. - * XXX: might this sometimes catch ok streams if EOS flag is missing, - * but the stream is otherwise ok? - */ - if(streams_open(set) && !set->in_headers) { - constraint = CONSTRAINT_MUXING_VIOLATED; - invalid = 1; - } - - set->in_headers = 1; - - if(set->allocated < set->used) - stream = &set->streams[set->used]; - else { - set->allocated += 5; - set->streams = realloc(set->streams, sizeof(stream_processor)* - set->allocated); - stream = &set->streams[set->used]; - } - set->used++; - stream->num = set->used; /* We count from 1 */ - - stream->isnew = 1; - stream->isillegal = invalid; - stream->constraint_violated = constraint; - - { - int res; - ogg_packet packet; - - /* We end up processing the header page twice, but that's ok. */ - ogg_stream_init(&stream->os, serial); - ogg_stream_pagein(&stream->os, page); - res = ogg_stream_packetout(&stream->os, &packet); - if(res <= 0) { - warn(_("WARNING: Invalid header page, no packet found\n")); - null_start(stream); - } - else if(packet.bytes >= 7 && memcmp(packet.packet, "\x01vorbis", 7)==0) - vorbis_start(stream); - else if(packet.bytes >= 7 && memcmp(packet.packet, "\x80theora", 7)==0) - theora_start(stream); - else if(packet.bytes >= 8 && memcmp(packet.packet, "OggMIDI\0", 8)==0) - other_start(stream, "MIDI"); - else if(packet.bytes >= 5 && memcmp(packet.packet, "\177FLAC", 5)==0) - other_start(stream, "FLAC"); - else if(packet.bytes == 4 && memcmp(packet.packet, "fLaC", 4)==0) - other_start(stream, "FLAC (legacy)"); - else if(packet.bytes >= 8 && memcmp(packet.packet, "Speex ", 8)==0) - other_start(stream, "speex"); - else if(packet.bytes >= 8 && memcmp(packet.packet, "fishead\0", 8)==0) - other_start(stream, "skeleton"); - else if(packet.bytes >= 5 && memcmp(packet.packet, "BBCD\0", 5)==0) - other_start(stream, "dirac"); - else if(packet.bytes >= 8 && memcmp(packet.packet, "KW-DIRAC", 8)==0) - other_start(stream, "dirac (legacy)"); - else if(packet.bytes >= 8 && memcmp(packet.packet, "\x80kate\0\0\0", 8)==0) - kate_start(stream); - else - other_start(stream, NULL); - - res = ogg_stream_packetout(&stream->os, &packet); - if(res > 0) { - warn(_("WARNING: Invalid header page in stream %d, " - "contains multiple packets\n"), stream->num); - } - - /* re-init, ready for processing */ - ogg_stream_clear(&stream->os); - ogg_stream_init(&stream->os, serial); - } - - stream->start = ogg_page_bos(page); - stream->end = ogg_page_eos(page); - stream->serial = serial; - - if(stream->serial == 0 || stream->serial == -1) { - info(_("Note: Stream %d has serial number %d, which is legal but may " - "cause problems with some tools.\n"), stream->num, - stream->serial); - } - - return stream; -} - -static int get_next_page(FILE *f, ogg_sync_state *sync, ogg_page *page, - ogg_int64_t *written) -{ - int ret; - char *buffer; - int bytes; - - while((ret = ogg_sync_pageseek(sync, page)) <= 0) { - if(ret < 0) { - /* unsynced, we jump over bytes to a possible capture - we don't need to read more just yet */ - warn(_("WARNING: Hole in data (%d bytes) found at approximate offset %" I64FORMAT " bytes. Corrupted Ogg.\n"), -ret, *written); - continue; - } - - /* zero return, we didn't have enough data to find a whole page, read */ - buffer = ogg_sync_buffer(sync, CHUNK); - bytes = fread(buffer, 1, CHUNK, f); - if(bytes <= 0) { - ogg_sync_wrote(sync, 0); - return 0; - } - ogg_sync_wrote(sync, bytes); - *written += bytes; - } - - return 1; -} - -static void process_file(char *filename) { - FILE *file = fopen(filename, "rb"); - ogg_sync_state sync; - ogg_page page; - stream_set *processors = create_stream_set(); - int gotpage = 0; - ogg_int64_t written = 0; - - if(!file) { - error(_("Error opening input file \"%s\": %s\n"), filename, - strerror(errno)); - return; - } - - printf(_("Processing file \"%s\"...\n\n"), filename); - - ogg_sync_init(&sync); - - while(get_next_page(file, &sync, &page, &written)) { - stream_processor *p = find_stream_processor(processors, &page); - gotpage = 1; - - if(!p) { - error(_("Could not find a processor for stream, bailing\n")); - return; - } - - if(p->isillegal && !p->shownillegal) { - char *constraint; - switch(p->constraint_violated) { - case CONSTRAINT_PAGE_AFTER_EOS: - constraint = _("Page found for stream after EOS flag"); - break; - case CONSTRAINT_MUXING_VIOLATED: - constraint = _("Ogg muxing constraints violated, new " - "stream before EOS of all previous streams"); - break; - default: - constraint = _("Error unknown."); - } - - warn(_("WARNING: illegally placed page(s) for logical stream %d\n" - "This indicates a corrupt Ogg file: %s.\n"), - p->num, constraint); - p->shownillegal = 1; - /* If it's a new stream, we want to continue processing this page - * anyway to suppress additional spurious errors - */ - if(!p->isnew) - continue; - } - - if(p->isnew) { - info(_("New logical stream (#%d, serial: %08x): type %s\n"), - p->num, p->serial, p->type); - if(!p->start) - warn(_("WARNING: stream start flag not set on stream %d\n"), - p->num); - } - else if(p->start) - warn(_("WARNING: stream start flag found in mid-stream " - "on stream %d\n"), p->num); - - if(p->seqno++ != ogg_page_pageno(&page)) { - if(!p->lostseq) - warn(_("WARNING: sequence number gap in stream %d. Got page " - "%ld when expecting page %ld. Indicates missing data.\n" - ), p->num, ogg_page_pageno(&page), p->seqno - 1); - p->seqno = ogg_page_pageno(&page); - p->lostseq = 1; - } - else - p->lostseq = 0; - - if(!p->isillegal) { - p->process_page(p, &page); - - if(p->end) { - if(p->process_end) - p->process_end(p); - info(_("Logical stream %d ended\n"), p->num); - p->isillegal = 1; - p->constraint_violated = CONSTRAINT_PAGE_AFTER_EOS; - } - } - } - - if(!gotpage) - error(_("ERROR: No Ogg data found in file \"%s\".\n" - "Input probably not Ogg.\n"), filename); - - free_stream_set(processors); - - ogg_sync_clear(&sync); - - fclose(file); -} - -static void version (void) { - printf (_("ogginfo from %s %s\n"), PACKAGE, VERSION); -} - -static void usage(void) { - version (); - printf (_(" by the Xiph.Org Foundation (http://www.xiph.org/)\n\n")); - printf(_("(c) 2003-2005 Michael Smith <msmith@xiph.org>\n" - "\n" - "Usage: ogginfo [flags] file1.ogg [file2.ogx ... fileN.ogv]\n" - "Flags supported:\n" - "\t-h Show this help message\n" - "\t-q Make less verbose. Once will remove detailed informative\n" - "\t messages, two will remove warnings\n" - "\t-v Make more verbose. This may enable more detailed checks\n" - "\t for some stream types.\n")); - printf (_("\t-V Output version information and exit\n")); -} - -int main(int argc, char **argv) { - int f, ret; - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - if(argc < 2) { - fprintf(stdout, - _("Usage: ogginfo [flags] file1.ogg [file2.ogx ... fileN.ogv]\n" - "\n" - "ogginfo is a tool for printing information about Ogg files\n" - "and for diagnosing problems with them.\n" - "Full help shown with \"ogginfo -h\".\n")); - exit(1); - } - - while((ret = getopt(argc, argv, "hqvV")) >= 0) { - switch(ret) { - case 'h': - usage(); - return 0; - case 'V': - version(); - return 0; - case 'v': - verbose++; - break; - case 'q': - verbose--; - break; - } - } - - if(verbose > 1) - printlots = 0; - if(verbose < 1) - printinfo = 0; - if(verbose < 0) - printwarn = 0; - - if(optind >= argc) { - fprintf(stderr, - _("No input files specified. \"ogginfo -h\" for help\n")); - return 1; - } - - ret = 0; - - for(f=optind; f < argc; f++) { - flawed = 0; - process_file(argv[f]); - if(flawed != 0) - ret = flawed; - } - - return ret; -} diff --git a/src/lib/dl/ext/vorbtool/platform.c b/src/lib/dl/ext/vorbtool/platform.c deleted file mode 100755 index 618f0caa..00000000 --- a/src/lib/dl/ext/vorbtool/platform.c +++ /dev/null @@ -1,336 +0,0 @@ -/* OggEnc - ** - ** This program is distributed under the GNU General Public License, version 2. - ** A copy of this license is included with this source. - ** - ** Copyright 2000, Michael Smith <msmith@xiph.org> - ** - ** Portions from Vorbize, (c) Kenneth Arnold <kcarnold-xiph@arnoldnet.net> - ** and libvorbis examples, (c) Monty <monty@xiph.org> - **/ - -/* Platform support routines - win32, OS/2, unix */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "platform.h" -#include "encode.h" -#include "i18n.h" -#include <stdlib.h> -#include <direct.h> -#include <ctype.h> -#include <stdio.h> -#include <dos.h> -#if defined(_WIN32) || defined(__EMX__) || defined(__WATCOMC__) -#include "getopt.h" -#include <fcntl.h> -#include <io.h> -#include <time.h> -#endif - -#ifdef _WIN32 -#include <windows.h> -#endif - -#if defined(_WIN32) && defined(_MSC_VER) - -void setbinmode(FILE *f) -{ - _setmode( _fileno(f), _O_BINARY ); -} -#endif /* win32 */ - -#ifdef __EMX__ -void setbinmode(FILE *f) -{ - _fsetmode( f, "b"); -} -#endif - -#if defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__) -#if 0 /* FIXME: Apparently, Watcom C defines this? */ -void setbinmode(FILE *f) -{ - setmode(fileno(f), O_BINARY); -} -#endif -#endif - - -#if defined(_WIN32) || defined(__EMX__) || defined(__WATCOMC__) -void *timer_start(void) -{ - time_t *start = malloc(sizeof(time_t)); - time(start); - return (void *)start; -} - -double timer_time(void *timer) -{ - time_t now = time(NULL); - time_t start = *((time_t *)timer); - - if(now-start) - return (double)(now-start); - else - return 1; /* To avoid division by zero later, for very short inputs */ -} - - -void timer_clear(void *timer) -{ - free((time_t *)timer); -} - -#else /* unix. Or at least win32 */ - -#include <sys/time.h> -#include <unistd.h> - -void *timer_start(void) -{ - struct timeval *start = malloc(sizeof(struct timeval)); - gettimeofday(start, NULL); - return (void *)start; -} - -double timer_time(void *timer) -{ - struct timeval now; - struct timeval start = *((struct timeval *)timer); - - gettimeofday(&now, NULL); - - return (double)now.tv_sec - (double)start.tv_sec + - ((double)now.tv_usec - (double)start.tv_usec)/1000000.0; -} - -void timer_clear(void *timer) -{ - free((time_t *)timer); -} - -#endif - -#include <errno.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> - -#ifdef _WIN32 - -#include <direct.h> - -#define PATH_SEPS "/\\" -#define mkdir(x,y) _mkdir((x)) - -/* MSVC does this, borland doesn't? */ -#ifndef __BORLANDC__ -#define stat _stat -#endif - -#else - -#define PATH_SEPS "/" - -#endif - -int create_directories(char *fn, int isutf8) -{ - char *end, *start; - struct stat statbuf; - char *segment = malloc(strlen(fn)+1); -#ifdef _WIN32 - wchar_t seg[MAX_PATH+1]; -#endif - - start = fn; -#ifdef _WIN32 - if(strlen(fn) >= 3 && isalpha(fn[0]) && fn[1]==':') - start = start+2; -#endif - - while((end = strpbrk(start+1, PATH_SEPS)) != NULL) - { - int rv; - memcpy(segment, fn, end-fn); - segment[end-fn] = 0; - -#ifdef _WIN32 - if (isutf8) { - MultiByteToWideChar(CP_UTF8, 0, segment, -1, seg, MAX_PATH+1); - rv = _wstat(seg,&statbuf); - } else -#endif - rv = stat(segment,&statbuf); - if(rv) { - if(errno == ENOENT) { -#ifdef _WIN32 - if (isutf8) - rv = _wmkdir(seg); - else -#endif - rv = mkdir(segment/*, 0777*/); /* Watcom C: mkdir() has just one param */ - if(rv) { - fprintf(stderr, _("Couldn't create directory \"%s\": %s\n"), - segment, strerror(errno)); - free(segment); - return -1; - } - } - else { - fprintf(stderr, _("Error checking for existence of directory %s: %s\n"), - segment, strerror(errno)); - free(segment); - return -1; - } - } -#if defined(_WIN32) && !defined(__BORLANDC__) - else if(!(_S_IFDIR & statbuf.st_mode)) { -#elif defined(__BORLANDC__) - else if(!(S_IFDIR & statbuf.st_mode)) { -#else - else if(!S_ISDIR(statbuf.st_mode)) { -#endif - fprintf(stderr, _("Error: path segment \"%s\" is not a directory\n"), - segment); - free(segment); - return -1; - } - - start = end+1; - } - - free(segment); - return 0; - -} - -#ifdef _WIN32 - -FILE *oggenc_fopen(char *fn, char *mode, int isutf8) -{ - if (isutf8) { - wchar_t wfn[MAX_PATH+1]; - wchar_t wmode[32]; - MultiByteToWideChar(CP_UTF8, 0, fn, -1, wfn, MAX_PATH+1); - MultiByteToWideChar(CP_ACP, 0, mode, -1, wmode, 32); - return _wfopen(wfn, wmode); - } else - return fopen(fn, mode); -} - -static int -parse_for_utf8(int argc, char **argv) -{ - extern struct option long_options[]; - int ret; - int option_index = 1; - - while((ret = getopt_long(argc, argv, "A:a:b:B:c:C:d:G:hkl:m:M:n:N:o:P:q:QrR:s:t:vX:", - long_options, &option_index)) != -1) - { - switch(ret) - { - case 0: - if(!strcmp(long_options[option_index].name, "utf8")) { - return 1; - } - break; - default: - break; - } - } - - return 0; -} - -typedef WINSHELLAPI LPWSTR * (APIENTRY *tCommandLineToArgvW)(LPCWSTR lpCmdLine, int*pNumArgs); - -void get_args_from_ucs16(int *argc, char ***argv) -{ - OSVERSIONINFO vi; - int utf8; - - utf8 = parse_for_utf8(*argc, *argv); - optind = 1; /* Reset getopt_long */ - - /* If command line is already UTF-8, don't convert */ - if (utf8) - return; - - vi.dwOSVersionInfoSize = sizeof(vi); - GetVersionEx(&vi); - - /* We only do NT4 and more recent.*/ - /* It would be relatively easy to add NT3.5 support. Is anyone still using NT3? */ - /* It would be relatively hard to add 9x support. Fortunately, 9x is - a lost cause for unicode support anyway. */ - if (vi.dwPlatformId == VER_PLATFORM_WIN32_NT && vi.dwMajorVersion >= 4) { - const char utf8flag[] = "--utf8"; - int newargc; - int sizeofargs = 0; - int a, count; - char *argptr; - char **newargv = NULL; - LPWSTR *ucs16argv = NULL; - tCommandLineToArgvW pCommandLineToArgvW = NULL; - HMODULE hLib = NULL; - - hLib = LoadLibrary("shell32.dll"); - if (!hLib) - goto bail; - pCommandLineToArgvW = (tCommandLineToArgvW)GetProcAddress(hLib, "CommandLineToArgvW"); - if (!pCommandLineToArgvW) - goto bail; - - ucs16argv = pCommandLineToArgvW(GetCommandLineW(), &newargc); - if (!ucs16argv) - goto bail; - - for (a=0; a<newargc; a++) { - count = WideCharToMultiByte(CP_UTF8, 0, ucs16argv[a], -1, - NULL, 0, NULL, NULL); - if (count == 0) - goto bail; - sizeofargs += count; - } - - sizeofargs += strlen(utf8flag) + 1; - - newargv = malloc(((newargc + 2) * sizeof(char *)) + sizeofargs); - argptr = (char *)(&newargv[newargc+2]); - - for (a=0; a<newargc; a++) { - count = WideCharToMultiByte(CP_UTF8, 0, ucs16argv[a], -1, - argptr, sizeofargs, NULL, NULL); - if (count == 0) - goto bail; - - newargv[a] = argptr; - argptr += count; - sizeofargs -= count; - } - - count = strlen(utf8flag) + 1; - strcpy(argptr, utf8flag); - newargv[a] = argptr; - argptr += count; - sizeofargs -= count; - - newargv[a+1] = NULL; - - *argc = newargc + 1; - *argv = newargv; - -bail: - if (hLib != NULL) - FreeLibrary(hLib); - if (ucs16argv != NULL) - GlobalFree(ucs16argv); - } -} - -#endif diff --git a/src/lib/dl/ext/vorbtool/platform.h b/src/lib/dl/ext/vorbtool/platform.h deleted file mode 100755 index c2ab8190..00000000 --- a/src/lib/dl/ext/vorbtool/platform.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __PLATFORM_H -#define __PLATFORM_H - -#include <stdio.h> - -#ifdef HAVE_ALLOCA_H -#include <alloca.h> -#endif - -#ifdef __OS2__ -#define INCL_DOS -#define INCL_NOPMAPI -#include <os2.h> -#endif - -#if defined(_WIN32) || defined(__OS2__) -#include <malloc.h> - -void setbinmode(FILE *); - -#define DEFAULT_NAMEFMT_REMOVE "/\\:<>|" -#define DEFAULT_NAMEFMT_REPLACE "" - -#else /* Unix, mostly */ - -#define setbinmode(x) {} -#define DEFAULT_NAMEFMT_REMOVE "/" -#define DEFAULT_NAMEFMT_REPLACE "" - -#endif - -#ifdef _WIN32 - -extern FILE *oggenc_fopen(char *fn, char *mode, int isutf8); -extern void get_args_from_ucs16(int *argc, char ***argv); - -#else - -#define oggenc_fopen(x,y,z) fopen(x,y) -#define get_args_from_ucs16(x,y) { } - -#endif - -#endif /* __PLATFORM_H */ diff --git a/src/lib/dl/ext/vorbtool/resample.c b/src/lib/dl/ext/vorbtool/resample.c deleted file mode 100755 index 1a49b12b..00000000 --- a/src/lib/dl/ext/vorbtool/resample.c +++ /dev/null @@ -1,444 +0,0 @@ -/* resample.c: see resample.h for interesting stuff */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <math.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <assert.h> - -#include "resample.h" - -/* Some systems don't define this */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -static int hcf(int arg1, int arg2) -{ - int mult = 1; - - while (~(arg1 | arg2) & 1) - arg1 >>= 1, arg2 >>= 1, mult <<= 1; - - while (arg1 > 0) - { - if (~(arg1 & arg2) & 1) - { - arg1 >>= (~arg1 & 1); - arg2 >>= (~arg2 & 1); - } - else if (arg1 < arg2) - arg2 = (arg2 - arg1) >> 1; - else - arg1 = (arg1 - arg2) >> 1; - } - - return arg2 * mult; -} - - -static void filt_sinc(float *dest, int N, int step, double fc, double gain, int width) -{ - double s = fc / step; - int mid, x; - float *endpoint = dest + N, - *base = dest, - *origdest = dest; - - assert(width <= N); - - if ((N & 1) == 0) - { - *dest = 0.0; - dest += width; - if (dest >= endpoint) - dest = ++base; - N--; - } - - mid = N / 2; - x = -mid; - - while (N--) - { - *dest = (x ? sin(x * M_PI * s) / (x * M_PI) * step : fc) * gain; - x++; - dest += width; - if (dest >= endpoint) - dest = ++base; - } - assert(dest == origdest + width); -} - - -static double I_zero(double x) -{ - int n = 0; - double u = 1.0, - s = 1.0, - t; - - do - { - n += 2; - t = x / n; - u *= t * t; - s += u; - } while (u > 1e-21 * s); - - return s; -} - - -static void win_kaiser(float *dest, int N, double alpha, int width) -{ - double I_alpha, midsq; - int x; - float *endpoint = dest + N, - *base = dest, - *origdest = dest; - - assert(width <= N); - - if ((N & 1) == 0) - { - *dest = 0.0; - dest += width; - if (dest >= endpoint) - dest = ++base; - N--; - } - - x = -(N / 2); - midsq = (double)(x - 1) * (double)(x - 1); - I_alpha = I_zero(alpha); - - while (N--) - { - *dest *= I_zero(alpha * sqrt(1.0 - ((double)x * (double)x) / midsq)) / I_alpha; - x++; - dest += width; - if (dest >= endpoint) - dest = ++base; - } - assert(dest == origdest + width); -} - - -int res_init(res_state *state, int channels, int outfreq, int infreq, res_parameter op1, ...) -{ - double beta = 16.0, - cutoff = 0.80, - gain = 1.0; - int taps = 45; - - int factor; - - assert(state); - assert(channels > 0); - assert(outfreq > 0); - assert(infreq > 0); - assert(taps > 0); - - if (state == NULL || channels <= 0 || outfreq <= 0 || infreq <= 0 || taps <= 0) - return -1; - - if (op1 != RES_END) - { - va_list argp; - va_start(argp, op1); - do - { - switch (op1) - { - case RES_GAIN: - gain = va_arg(argp, double); - break; - - case RES_CUTOFF: - cutoff = va_arg(argp, double); - assert(cutoff > 0.01 && cutoff <= 1.0); - break; - - case RES_TAPS: - taps = va_arg(argp, int); - assert(taps > 2 && taps < 1000); - break; - - case RES_BETA: - beta = va_arg(argp, double); - assert(beta > 2.0); - break; - default: - assert("arglist" == "valid"); - return -1; - } - op1 = va_arg(argp, res_parameter); - } while (op1 != RES_END); - va_end(argp); - } - - factor = hcf(infreq, outfreq); - outfreq /= factor; - infreq /= factor; - - /* adjust to rational values for downsampling */ - if (outfreq < infreq) - { - /* push the cutoff frequency down to the output frequency */ - cutoff = cutoff * outfreq / infreq; - - /* compensate for the sharper roll-off requirement - * by using a bigger hammer */ - taps = taps * infreq/outfreq; - } - - assert(taps >= (infreq + outfreq - 1) / outfreq); - - if ((state->table = calloc(outfreq * taps, sizeof(float))) == NULL) - return -1; - if ((state->pool = calloc(channels * taps, sizeof(SAMPLE))) == NULL) - { - free(state->table); - state->table = NULL; - return -1; - } - - state->poolfill = taps / 2 + 1; - state->channels = channels; - state->outfreq = outfreq; - state->infreq = infreq; - state->taps = taps; - state->offset = 0; - - filt_sinc(state->table, outfreq * taps, outfreq, cutoff, gain, taps); - win_kaiser(state->table, outfreq * taps, beta, taps); - - return 0; -} - - -static SAMPLE sum(float const *scale, int count, SAMPLE const *source, SAMPLE const *trigger, SAMPLE const *reset, int srcstep) -{ - float total = 0.0; - - while (count--) - { - total += *source * *scale; - - if (source == trigger) - source = reset, srcstep = 1; - source -= srcstep; - scale++; - } - - return total; -} - - -static int push(res_state const * const state, SAMPLE *pool, int * const poolfill, int * const offset, SAMPLE *dest, int dststep, SAMPLE const *source, int srcstep, size_t srclen) -{ - SAMPLE * const destbase = dest, - *poolhead = pool + *poolfill, - *poolend = pool + state->taps, - *newpool = pool; - SAMPLE const *refill, *base, *endpoint; - int lencheck; - - - assert(state); - assert(pool); - assert(poolfill); - assert(dest); - assert(source); - - assert(state->poolfill != -1); - - lencheck = res_push_check(state, srclen); - - /* fill the pool before diving in */ - while (poolhead < poolend && srclen > 0) - { - *poolhead++ = *source; - source += srcstep; - srclen--; - } - - if ((long)srclen <= 0) - return 0; - - base = source; - endpoint = source + srclen * srcstep; - - while (source < endpoint) - { - *dest = sum(state->table + *offset * state->taps, state->taps, source, base, poolend, srcstep); - dest += dststep; - *offset += state->infreq; - while (*offset >= state->outfreq) - { - *offset -= state->outfreq; - source += srcstep; - } - } - - assert(dest == destbase + lencheck * dststep); - - /* pretend that source has that underrun data we're not going to get */ - srclen += (source - endpoint) / srcstep; - - /* if we didn't get enough to completely replace the pool, then shift things about a bit */ - if (srclen < state->taps) - { - refill = pool + srclen; - while (refill < poolend) - *newpool++ = *refill++; - - refill = source - srclen * srcstep; - } - else - refill = source - state->taps * srcstep; - - /* pull in fresh pool data */ - while (refill < endpoint) - { - *newpool++ = *refill; - refill += srcstep; - } - - assert(newpool > pool); - assert(newpool <= poolend); - - *poolfill = newpool - pool; - - return (dest - destbase) / dststep; -} - - -int res_push_max_input(res_state const * const state, size_t maxoutput) -{ - return maxoutput * state->infreq / state->outfreq; -} - - -int res_push_check(res_state const * const state, size_t srclen) -{ - if (state->poolfill < state->taps) - srclen -= state->taps - state->poolfill; - - return (srclen * state->outfreq - state->offset + state->infreq - 1) / state->infreq; -} - - -int res_push(res_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen) -{ - int result = -1, poolfill = -1, offset = -1, i; - - assert(state); - assert(dstlist); - assert(srclist); - assert(state->poolfill >= 0); - - for (i = 0; i < state->channels; i++) - { - poolfill = state->poolfill; - offset = state->offset; - result = push(state, state->pool + i * state->taps, &poolfill, &offset, dstlist[i], 1, srclist[i], 1, srclen); - } - state->poolfill = poolfill; - state->offset = offset; - - return result; -} - - -int res_push_interleaved(res_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen) -{ - int result = -1, poolfill = -1, offset = -1, i; - - assert(state); - assert(dest); - assert(source); - assert(state->poolfill >= 0); - - for (i = 0; i < state->channels; i++) - { - poolfill = state->poolfill; - offset = state->offset; - result = push(state, state->pool + i * state->taps, &poolfill, &offset, dest + i, state->channels, source + i, state->channels, srclen); - } - state->poolfill = poolfill; - state->offset = offset; - - return result; -} - - -int res_drain(res_state *state, SAMPLE **dstlist) -{ - SAMPLE *tail; - int result = -1, poolfill = -1, offset = -1, i; - - assert(state); - assert(dstlist); - assert(state->poolfill >= 0); - - if ((tail = calloc(state->taps, sizeof(SAMPLE))) == NULL) - return -1; - - for (i = 0; i < state->channels; i++) - { - poolfill = state->poolfill; - offset = state->offset; - result = push(state, state->pool + i * state->taps, &poolfill, &offset, dstlist[i], 1, tail, 1, state->taps / 2 - 1); - } - - free(tail); - - state->poolfill = -1; - - return result; -} - - -int res_drain_interleaved(res_state *state, SAMPLE *dest) -{ - SAMPLE *tail; - int result = -1, poolfill = -1, offset = -1, i; - - assert(state); - assert(dest); - assert(state->poolfill >= 0); - - if ((tail = calloc(state->taps, sizeof(SAMPLE))) == NULL) - return -1; - - for (i = 0; i < state->channels; i++) - { - poolfill = state->poolfill; - offset = state->offset; - result = push(state, state->pool + i * state->taps, &poolfill, &offset, dest + i, state->channels, tail, 1, state->taps / 2 - 1); - } - - free(tail); - - state->poolfill = -1; - - return result; -} - - -void res_clear(res_state *state) -{ - assert(state); - assert(state->table); - assert(state->pool); - - free(state->table); - free(state->pool); - memset(state, 0, sizeof(*state)); -} diff --git a/src/lib/dl/ext/vorbtool/resample.h b/src/lib/dl/ext/vorbtool/resample.h deleted file mode 100755 index 98881130..00000000 --- a/src/lib/dl/ext/vorbtool/resample.h +++ /dev/null @@ -1,107 +0,0 @@ -/* This program is licensed under the GNU Library General Public License, - * version 2, a copy of which is included with this program (LICENCE.LGPL). - * - * (c) 2002 Simon Hosie <gumboot@clear.net.nz> - * - * - * A resampler - * - * reference: - * 'Digital Filters', third edition, by R. W. Hamming ISBN 0-486-65088-X - * - * history: - * 2002-05-31 ready for the world (or some small section thereof) - * - * - * TOOD: - * zero-crossing clipping in coefficient table - */ - -#ifndef _RESAMPLE_H_INCLUDED -#define _RESAMPLE_H_INCLUDED - -typedef float SAMPLE; - -typedef struct -{ - unsigned int channels, infreq, outfreq, taps; - float *table; - SAMPLE *pool; - - /* dynamic bits */ - int poolfill; - int offset; -} res_state; - -typedef enum -{ - RES_END, - RES_GAIN, /* (double)1.0 */ - RES_CUTOFF, /* (double)0.80 */ - RES_TAPS, /* (int)45 */ - RES_BETA /* (double)16.0 */ -} res_parameter; - -int res_init(res_state *state, int channels, int outfreq, int infreq, res_parameter op1, ...); -/* - * Configure *state to manage a data stream with the specified parameters. The - * string 'params' is currently unspecified, but will configure the parameters - * of the filter. - * - * This function allocates memory, and requires that res_clear() be called when - * the buffer is no longer needed. - * - * - * All counts/lengths used in the following functions consider only the data in - * a single channel, and in numbers of samples rather than bytes, even though - * functionality will be mirrored across as many channels as specified here. - */ - - -int res_push_max_input(res_state const *state, size_t maxoutput); -/* - * Returns the maximum number of input elements that may be provided without - * risk of flooding an output buffer of size maxoutput. maxoutput is - * specified in counts of elements, NOT in bytes. - */ - - -int res_push_check(res_state const *state, size_t srclen); -/* - * Returns the number of elements that will be returned if the given srclen - * is used in the next call to res_push(). - */ - - -int res_push(res_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen); -int res_push_interleaved(res_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen); -/* - * Pushes srclen samples into the front end of the filter, and returns the - * number of resulting samples. - * - * res_push(): srclist and dstlist point to lists of pointers, each of which - * indicates the beginning of a list of samples. - * - * res_push_interleaved(): source and dest point to the beginning of a list of - * interleaved samples. - */ - - -int res_drain(res_state *state, SAMPLE **dstlist); -int res_drain_interleaved(res_state *state, SAMPLE *dest); -/* - * Recover the remaining elements by flushing the internal pool with 0 values, - * and storing the resulting samples. - * - * After either of these functions are called, *state should only re-used in a - * final call to res_clear(). - */ - - -void res_clear(res_state *state); -/* - * Free allocated buffers, etc. - */ - -#endif - diff --git a/src/lib/dl/ext/vorbtool/skeleton.c b/src/lib/dl/ext/vorbtool/skeleton.c deleted file mode 100755 index dd176803..00000000 --- a/src/lib/dl/ext/vorbtool/skeleton.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * skeleton.c - * author: Tahseen Mohammad - */ - -/* This file depends on WORDS_BIGENDIAN being defined to 1 if the host - * processor stores words with the most significant byte first (like Motorola - * and SPARC, unlike Intel and VAX). - * On little endian systems, WORDS_BIGENDIAN should be undefined. - * - * When using GNU Autotools, the correct value will be written into config.h - * if the autoconf macro AC_C_BIGENDIAN is called in configure.ac. - */ -#include "config.h" - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -#include <ext/libogg/ogg.h> - -#include "skeleton.h" - -#ifdef WIN32 -#define snprintf _snprintf -#endif - -extern int oe_write_page(ogg_page *page, FILE *fp); - -static unsigned short -_le_16 (unsigned short s) -{ - unsigned short ret=s; -#ifdef WORDS_BIGENDIAN - ret = (s>>8) & 0x00ffU; - ret += (s<<8) & 0xff00U; -#endif - return ret; -} - -static ogg_uint32_t -_le_32 (ogg_uint32_t i) -{ - ogg_uint32_t ret=i; -#ifdef WORDS_BIGENDIAN - ret = (i>>24); - ret += (i>>8) & 0x0000ff00; - ret += (i<<8) & 0x00ff0000; - ret += (i<<24); -#endif - return ret; -} - -static ogg_int64_t -_le_64 (ogg_int64_t l) -{ - ogg_int64_t ret=l; - unsigned char *ucptr = (unsigned char *)&ret; -#ifdef WORDS_BIGENDIAN - unsigned char temp; - - 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 ; - -#endif - return (*(ogg_int64_t *)ucptr); -} - -int add_message_header_field(fisbone_packet *fp, - char *header_key, - char *header_value) { - - /* size of both key and value + ': ' + CRLF */ - int this_message_size = strlen(header_key) + strlen(header_value) + 4; - if (fp->message_header_fields == NULL) { - fp->message_header_fields = _ogg_calloc(this_message_size+1, sizeof(char)); - } else { - int new_size = (fp->current_header_size + this_message_size+1) * sizeof(char); - fp->message_header_fields = _ogg_realloc(fp->message_header_fields, new_size); - } - snprintf(fp->message_header_fields + fp->current_header_size, - this_message_size+1, - "%s: %s\r\n", - header_key, - header_value); - fp->current_header_size += this_message_size; - - return 0; -} - -/* create a ogg_packet from a fishead_packet structure */ -int ogg_from_fishead(fishead_packet *fp,ogg_packet *op) { - - if (!fp || !op) return -1; - - memset(op, 0, sizeof(*op)); - op->packet = _ogg_calloc(FISHEAD_SIZE, sizeof(unsigned char)); - if (!op->packet) return -1; - - memset(op->packet, 0, FISHEAD_SIZE); - - memcpy (op->packet, FISHEAD_IDENTIFIER, 8); /* identifier */ - *((ogg_uint16_t*)(op->packet+8)) = _le_16 (SKELETON_VERSION_MAJOR); /* version major */ - *((ogg_uint16_t*)(op->packet+10)) = _le_16 (SKELETON_VERSION_MINOR); /* version minor */ - *((ogg_int64_t*)(op->packet+12)) = _le_64 (fp->ptime_n); /* presentationtime numerator */ - *((ogg_int64_t*)(op->packet+20)) = _le_64 (fp->ptime_d); /* presentationtime denominator */ - *((ogg_int64_t*)(op->packet+28)) = _le_64 (fp->btime_n); /* basetime numerator */ - *((ogg_int64_t*)(op->packet+36)) = _le_64 (fp->btime_d); /* basetime denominator */ - /* TODO: UTC time, set to zero for now */ - - op->b_o_s = 1; /* its the first packet of the stream */ - op->e_o_s = 0; /* its not the last packet of the stream */ - op->bytes = FISHEAD_SIZE; /* length of the packet in bytes */ - - return 0; -} - -/* create a ogg_packet from a fisbone_packet structure. - * call this method after the fisbone_packet is filled and all message header fields are added - * by calling add_message_header_field method. - */ -int ogg_from_fisbone(fisbone_packet *fp,ogg_packet *op) { - - int packet_size; - - if (!fp || !op) return -1; - - packet_size = FISBONE_SIZE + fp->current_header_size; - - memset (op, 0, sizeof (*op)); - op->packet = _ogg_calloc (packet_size, sizeof(unsigned char)); - if (!op->packet) return -1; - - memset (op->packet, 0, packet_size); - memcpy (op->packet, FISBONE_IDENTIFIER, 8); /* identifier */ - *((ogg_uint32_t*)(op->packet+8)) = _le_32 (FISBONE_MESSAGE_HEADER_OFFSET); /* offset of the message header fields */ - *((ogg_uint32_t*)(op->packet+12)) = _le_32 (fp->serial_no); /* serialno of the respective stream */ - *((ogg_uint32_t*)(op->packet+16)) = _le_32 (fp->nr_header_packet); /* number of header packets */ - *((ogg_int64_t*)(op->packet+20)) = _le_64 (fp->granule_rate_n); /* granulrate numerator */ - *((ogg_int64_t*)(op->packet+28)) = _le_64 (fp->granule_rate_d); /* granulrate denominator */ - *((ogg_int64_t*)(op->packet+36)) = _le_64 (fp->start_granule); /* start granule */ - *((ogg_uint32_t*)(op->packet+44)) = _le_32 (fp->preroll); /* preroll, for theora its 0 */ - *(op->packet+48) = fp->granule_shift; /* granule shift */ - memcpy((op->packet+FISBONE_SIZE), fp->message_header_fields, fp->current_header_size); - - op->b_o_s = 0; - op->e_o_s = 0; - op->bytes = packet_size; /* size of the packet in bytes */ - - return 0; -} - -int add_fishead_to_stream(ogg_stream_state *os, fishead_packet *fp) { - - ogg_packet op; - int ret; - - ret = ogg_from_fishead(fp, &op); - if (ret<0) return ret; - ogg_stream_packetin(os, &op); - _ogg_free(op.packet); - - return 0; -} - -int add_fisbone_to_stream(ogg_stream_state *os, fisbone_packet *fp) { - - ogg_packet op; - int ret; - - ret = ogg_from_fisbone(fp, &op); - if (ret<0) return ret; - ogg_stream_packetin(os, &op); - _ogg_free(op.packet); - - return 0; -} - -int add_eos_packet_to_stream(ogg_stream_state *os) { - - ogg_packet op; - - memset (&op, 0, sizeof(op)); - op.e_o_s = 1; - - return ogg_stream_packetin(os, &op); -} - -int flush_ogg_stream_to_file(ogg_stream_state *os, FILE *out) { - - ogg_page og; - int result; - - while((result = ogg_stream_flush(os, &og))) { - if(!result) break; - result = oe_write_page(&og, out); - if(result != og.header_len + og.body_len) - return 1; - } - - return 0; -} diff --git a/src/lib/dl/ext/vorbtool/skeleton.h b/src/lib/dl/ext/vorbtool/skeleton.h deleted file mode 100755 index ac4c0149..00000000 --- a/src/lib/dl/ext/vorbtool/skeleton.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * skeleton.h - * author: Tahseen Mohammad - */ - -#ifndef _SKELETON_H -#define _SKELETON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <ext/libogg/ogg.h> - -#define SKELETON_VERSION_MAJOR 3 -#define SKELETON_VERSION_MINOR 0 -#define FISHEAD_IDENTIFIER "fishead\0" -#define FISBONE_IDENTIFIER "fisbone\0" -#define FISHEAD_SIZE 64 -#define FISBONE_SIZE 52 -#define FISBONE_MESSAGE_HEADER_OFFSET 44 - -/* fishead_packet holds a fishead header packet. */ -typedef struct { - /* Start time of the presentation. - * For a new stream presentationtime & basetime is same. */ - ogg_int64_t ptime_n; /* presentation time numerator */ - ogg_int64_t ptime_d; /* presentation time denominator */ - ogg_int64_t btime_n; /* basetime numerator */ - ogg_int64_t btime_d; /* basetime denominator */ - /* will holds the time of origin of the stream, a 20 bit field. */ - unsigned char UTC[20]; -} fishead_packet; - -/* fisbone_packet holds a fisbone header packet. */ -typedef struct { - ogg_uint32_t serial_no; /* serial no of the corresponding stream */ - ogg_uint32_t nr_header_packet; /* number of header packets */ - /* granule rate is the temporal resolution of the logical bitstream */ - ogg_int64_t granule_rate_n; /* granule rate numerator */ - ogg_int64_t granule_rate_d; /* granule rate denominator */ - ogg_int64_t start_granule; /* start granule value */ - ogg_uint32_t preroll; /* preroll */ - unsigned char granule_shift; // a 8-bit field /* 1 byte value holding the granule shift */ - char *message_header_fields; /* holds all the message header fields */ - /* current total size of the message header fields, for realloc purpose, initially zero */ - ogg_uint32_t current_header_size; -} fisbone_packet; - -extern int add_message_header_field(fisbone_packet *fp, char *header_key, char *header_value); -/* remember to deallocate the returned ogg_packet properly */ -extern int ogg_from_fishead(fishead_packet *fp,ogg_packet *op); -extern int ogg_from_fisbone(fisbone_packet *fp,ogg_packet *op); -extern int add_fishead_to_stream(ogg_stream_state *os, fishead_packet *fp); -extern int add_fisbone_to_stream(ogg_stream_state *os, fisbone_packet *fp); -extern int add_eos_packet_to_stream(ogg_stream_state *os); -extern int flush_ogg_stream_to_file(ogg_stream_state *os, FILE *out); - -#ifdef __cplusplus -} -#endif - -#endif /* _SKELETON_H */ diff --git a/src/lib/dl/ext/vorbtool/theora.c b/src/lib/dl/ext/vorbtool/theora.c deleted file mode 100755 index c2369d36..00000000 --- a/src/lib/dl/ext/vorbtool/theora.c +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggTheora 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 Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: - last mod: $Id: theora.c 17072 2010-03-26 05:07:26Z giles $ - - ********************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <string.h> -#include "theora.h" - -#define theora_read(x,y,z) ( *z = oggpackB_read(x,y) ) - -static void _tp_readbuffer(oggpack_buffer *opb, char *buf, const long len) -{ - long i; - long ret; - - for (i = 0; i < len; i++) { - theora_read(opb, 8, &ret); - *buf++=(char)ret; - } -} - -static void _tp_readlsbint(oggpack_buffer *opb, long *value) -{ - int i; - long ret[4]; - - for (i = 0; i < 4; i++) { - theora_read(opb,8,&ret[i]); - } - *value = ret[0]|ret[1]<<8|ret[2]<<16|ret[3]<<24; -} - -void theora_info_clear(theora_info *c) { - memset(c,0,sizeof(*c)); -} - -static int _theora_unpack_info(theora_info *ci, oggpack_buffer *opb){ - long ret; - - theora_read(opb,8,&ret); - ci->version_major=(unsigned char)ret; - theora_read(opb,8,&ret); - ci->version_minor=(unsigned char)ret; - theora_read(opb,8,&ret); - ci->version_subminor=(unsigned char)ret; - - theora_read(opb,16,&ret); - ci->width=ret<<4; - theora_read(opb,16,&ret); - ci->height=ret<<4; - theora_read(opb,24,&ret); - ci->frame_width=ret; - theora_read(opb,24,&ret); - ci->frame_height=ret; - theora_read(opb,8,&ret); - ci->offset_x=ret; - theora_read(opb,8,&ret); - ci->offset_y=ret; - - theora_read(opb,32,&ret); - ci->fps_numerator=ret; - theora_read(opb,32,&ret); - ci->fps_denominator=ret; - theora_read(opb,24,&ret); - ci->aspect_numerator=ret; - theora_read(opb,24,&ret); - ci->aspect_denominator=ret; - - theora_read(opb,8,&ret); - ci->colorspace=ret; - theora_read(opb,24,&ret); - ci->target_bitrate=ret; - theora_read(opb,6,&ret); - ci->quality=ret; - - theora_read(opb,5,&ret); - ci->granule_shift = ret; - - theora_read(opb,2,&ret); - ci->pixelformat=ret; - - /* spare configuration bits */ - if ( theora_read(opb,3,&ret) == -1 ) - return (OC_BADHEADER); - - return(0); -} - -void theora_comment_clear(theora_comment *tc){ - if(tc){ - long i; - for(i=0;i<tc->comments;i++) - if(tc->user_comments[i])_ogg_free(tc->user_comments[i]); - if(tc->user_comments)_ogg_free(tc->user_comments); - if(tc->comment_lengths)_ogg_free(tc->comment_lengths); - if(tc->vendor)_ogg_free(tc->vendor); - memset(tc,0,sizeof(*tc)); - } -} - -static int _theora_unpack_comment(theora_comment *tc, oggpack_buffer *opb){ - int i; - long len; - - _tp_readlsbint(opb,&len); - if(len<0)return(OC_BADHEADER); - tc->vendor=_ogg_calloc(1,len+1); - _tp_readbuffer(opb,tc->vendor, len); - tc->vendor[len]='\0'; - - _tp_readlsbint(opb,(long *) &tc->comments); - if(tc->comments<0)goto parse_err; - tc->user_comments=_ogg_calloc(tc->comments,sizeof(*tc->user_comments)); - tc->comment_lengths=_ogg_calloc(tc->comments,sizeof(*tc->comment_lengths)); - for(i=0;i<tc->comments;i++){ - _tp_readlsbint(opb,&len); - if(len<0)goto parse_err; - tc->user_comments[i]=_ogg_calloc(1,len+1); - _tp_readbuffer(opb,tc->user_comments[i],len); - tc->user_comments[i][len]='\0'; - tc->comment_lengths[i]=len; - } - return(0); - -parse_err: - theora_comment_clear(tc); - return(OC_BADHEADER); -} - -static int _theora_unpack_tables(theora_info *c, oggpack_buffer *opb){ - /* NOP: ogginfo doesn't use this information */ - return 0; -} - -int theora_decode_header(theora_info *ci, theora_comment *cc, ogg_packet *op){ - long ret; - oggpack_buffer *opb; - - if(!op)return OC_BADHEADER; - - opb = _ogg_malloc(sizeof(oggpack_buffer)); - oggpackB_readinit(opb,op->packet,op->bytes); - { - char id[6]; - int typeflag; - - theora_read(opb,8,&ret); - typeflag = ret; - if(!(typeflag&0x80)) { - free(opb); - return(OC_NOTFORMAT); - } - - _tp_readbuffer(opb,id,6); - if(memcmp(id,"theora",6)) { - free(opb); - return(OC_NOTFORMAT); - } - - switch(typeflag){ - case 0x80: - if(!op->b_o_s){ - /* Not the initial packet */ - free(opb); - return(OC_BADHEADER); - } - if(ci->version_major!=0){ - /* previously initialized info header */ - free(opb); - return OC_BADHEADER; - } - - ret = _theora_unpack_info(ci,opb); - free(opb); - return(ret); - - case 0x81: - if(ci->version_major==0){ - /* um... we didn't get the initial header */ - free(opb); - return(OC_BADHEADER); - } - - ret = _theora_unpack_comment(cc,opb); - free(opb); - return(ret); - - case 0x82: - if(ci->version_major==0 || cc->vendor==NULL){ - /* um... we didn't get the initial header or comments yet */ - free(opb); - return(OC_BADHEADER); - } - - ret = _theora_unpack_tables(ci,opb); - free(opb); - return(ret); - - default: - free(opb); - /* ignore any trailing header packets for forward compatibility */ - return(OC_NEWPACKET); - } - } - /* I don't think it's possible to get this far, but better safe.. */ - free(opb); - return(OC_BADHEADER); -} diff --git a/src/lib/dl/ext/vorbtool/theora.h b/src/lib/dl/ext/vorbtool/theora.h deleted file mode 100755 index 96cd8c5c..00000000 --- a/src/lib/dl/ext/vorbtool/theora.h +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggTheora 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 Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: - last mod: $Id: theora.h 16826 2010-01-27 04:16:24Z xiphmont $ - - ********************************************************************/ - -#include <ext/libogg/ogg.h> - -/** - * A Colorspace. - */ -typedef enum { - OC_CS_UNSPECIFIED, /**< the colorspace is unknown or unspecified */ - OC_CS_ITU_REC_470M, /**< best option for 'NTSC' content */ - OC_CS_ITU_REC_470BG, /**< best option for 'PAL' content */ - OC_CS_NSPACES /* mark the end of the defined colorspaces */ -} theora_colorspace; - -/** - * A Chroma subsampling - * - * These enumerate the available chroma subsampling options supported - * by the theora format. See Section 4.4 of the specification for - * exact definitions. - */ -typedef enum { - OC_PF_420, /**< Chroma subsampling by 2 in each direction (4:2:0) */ - OC_PF_RSVD, /**< reserved value */ - OC_PF_422, /**< Horizonatal chroma subsampling by 2 (4:2:2) */ - OC_PF_444, /**< No chroma subsampling at all (4:4:4) */ -} theora_pixelformat; - -/** - * Theora bitstream info. - * Contains the basic playback parameters for a stream, - * corresponds to the initial 'info' header packet. - * - * Encoded theora frames must be a multiple of 16 is size; - * this is what the width and height members represent. To - * handle other sizes, a crop rectangle is specified in - * frame_height and frame_width, offset_x and offset_y. The - * offset and size should still be a power of 2 to avoid - * chroma sampling shifts. - * - * Frame rate, in frames per second is stored as a rational - * fraction. So is the aspect ratio. Note that this refers - * to the aspect ratio of the frame pixels, not of the - * overall frame itself. - * - * see the example code for use of the other parameters and - * good default settings for the encoder parameters. - */ -typedef struct { - ogg_uint32_t width; - ogg_uint32_t height; - ogg_uint32_t frame_width; - ogg_uint32_t frame_height; - ogg_uint32_t offset_x; - ogg_uint32_t offset_y; - ogg_uint32_t fps_numerator; - ogg_uint32_t fps_denominator; - ogg_uint32_t aspect_numerator; - ogg_uint32_t aspect_denominator; - theora_colorspace colorspace; - int target_bitrate; - int quality; /**< nominal quality setting, 0-63 */ - int quick_p; /**< quick encode/decode */ - - /* decode only */ - unsigned char version_major; - unsigned char version_minor; - unsigned char version_subminor; - - int granule_shift; - - void *codec_setup; - - /* encode only */ - int dropframes_p; - int keyframe_auto_p; - ogg_uint32_t keyframe_frequency; - ogg_uint32_t keyframe_data_target_bitrate; - ogg_int32_t keyframe_auto_threshold; - ogg_uint32_t keyframe_mindistance; - ogg_int32_t noise_sensitivity; - ogg_int32_t sharpness; - - theora_pixelformat pixelformat; - -} theora_info; - -/** - * Comment header metadata. - * - * This structure holds the in-stream metadata corresponding to - * the 'comment' header packet. - * - * Meta data is stored as a series of (tag, value) pairs, in - * length-encoded string vectors. The first occurence of the - * '=' character delimits the tag and value. A particular tag - * may occur more than once. The character set encoding for - * the strings is always utf-8, but the tag names are limited - * to case-insensitive ascii. See the spec for details. - * - * In filling in this structure, theora_decode_header() will - * null-terminate the user_comment strings for safety. However, - * the bitstream format itself treats them as 8-bit clean, - * and so the length array should be treated as authoritative - * for their length. - */ -typedef struct theora_comment{ - char **user_comments; /**< an array of comment string vectors */ - int *comment_lengths; /**< an array of corresponding string vector lengths in bytes */ - int comments; /**< the total number of comment string vectors */ - char *vendor; /**< the vendor string identifying the encoder, null terminated */ - -} theora_comment; - -#define OC_FAULT -1 /**< general failure */ -#define OC_EINVAL -10 /**< library encountered invalid internal data */ -#define OC_DISABLED -11 /**< requested action is disabled */ -#define OC_BADHEADER -20 /**< header packet was corrupt/invalid */ -#define OC_NOTFORMAT -21 /**< packet is not a theora packet */ -#define OC_VERSION -22 /**< bitstream version is not handled */ -#define OC_IMPL -23 /**< feature or action not implemented */ -#define OC_BADPACKET -24 /**< packet is corrupt */ -#define OC_NEWPACKET -25 /**< packet is an (ignorable) unhandled extension */ - -/** - * Decode an Ogg packet, with the expectation that the packet contains - * an initial header, comment data or codebook tables. - * - * \param ci A theora_info structure to fill. This must have been previously - * initialized with theora_info_init(). If \a op contains an initial - * header, theora_decode_header() will fill \a ci with the - * parsed header values. If \a op contains codebook tables, - * theora_decode_header() will parse these and attach an internal - * representation to \a ci->codec_setup. - * \param cc A theora_comment structure to fill. If \a op contains comment - * data, theora_decode_header() will fill \a cc with the parsed - * comments. - * \param op An ogg_packet structure which you expect contains an initial - * header, comment data or codebook tables. - * - * \retval OC_BADHEADER \a op is NULL; OR the first byte of \a op->packet - * has the signature of an initial packet, but op is - * not a b_o_s packet; OR this packet has the signature - * of an initial header packet, but an initial header - * packet has already been seen; OR this packet has the - * signature of a comment packet, but the initial header - * has not yet been seen; OR this packet has the signature - * of a comment packet, but contains invalid data; OR - * this packet has the signature of codebook tables, - * but the initial header or comments have not yet - * been seen; OR this packet has the signature of codebook - * tables, but contains invalid data; - * OR the stream being decoded has a compatible version - * but this packet does not have the signature of a - * theora initial header, comments, or codebook packet - * \retval OC_VERSION The packet data of \a op is an initial header with - * a version which is incompatible with this version of - * libtheora. - * \retval OC_NEWPACKET the stream being decoded has an incompatible (future) - * version and contains an unknown signature. - * \retval 0 Success - * - * \note The normal usage is that theora_decode_header() be called on the - * first three packets of a theora logical bitstream in succession. - */ -extern int theora_decode_header(theora_info *ci, theora_comment *cc, - ogg_packet *op); - -void theora_info_clear(theora_info *c); -void theora_comment_clear(theora_comment *tc); diff --git a/src/lib/dl/ext/vorbtool/utf8.c b/src/lib/dl/ext/vorbtool/utf8.c deleted file mode 100755 index e69de29b..00000000 diff --git a/src/lib/dl/ext/vorbtool/utf8.h b/src/lib/dl/ext/vorbtool/utf8.h deleted file mode 100755 index e69de29b..00000000 diff --git a/src/lib/dl/ext/zlib/CLEAN.BAT b/src/lib/dl/ext/zlib/CLEAN.BAT deleted file mode 100755 index 1641b5bd..00000000 --- a/src/lib/dl/ext/zlib/CLEAN.BAT +++ /dev/null @@ -1,17 +0,0 @@ -@echo off - -deltree /Y -del /s /q dos86c\*.* -deltree /Y -del /s /q dos86l\*.* -deltree /Y -del /s /q dos86m\*.* -deltree /Y -del /s /q dos86s\*.* -deltree /Y -del /s /q dos386f\*.* -del *.obj -del *.exe -del *.lib -del *.com -del foo.gz diff --git a/src/lib/dl/ext/zlib/MAKE.BAT b/src/lib/dl/ext/zlib/MAKE.BAT deleted file mode 100755 index 87e50625..00000000 --- a/src/lib/dl/ext/zlib/MAKE.BAT +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem ----- Auto-generated by make.sh and Linux make system do not modify - -rem ----- shut up DOS4G/W -set DOS4G=quiet - -if "%1" == "clean" call clean.bat -if "%1" == "clean" goto end - -mkdir dos86c -wmake -f ..\..\mak\dos86c.mak HPS=\ all REL=..\.. - -mkdir dos86l -wmake -f ..\..\mak\dos86l.mak HPS=\ all REL=..\.. - -mkdir dos86m -wmake -f ..\..\mak\dos86m.mak HPS=\ all REL=..\.. - -mkdir dos86s -wmake -f ..\..\mak\dos86s.mak HPS=\ all REL=..\.. - -mkdir dos386f -wmake -f ..\..\mak\dos386f.mak HPS=\ all REL=..\.. - - -:end diff --git a/src/lib/dl/ext/zlib/adler32.c b/src/lib/dl/ext/zlib/adler32.c deleted file mode 100755 index 65ad6a5a..00000000 --- a/src/lib/dl/ext/zlib/adler32.c +++ /dev/null @@ -1,169 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2007 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" - -#define local static - -local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); - -#define BASE 65521UL /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -/* use NO_DIVIDE if your processor does not do division in hardware */ -#ifdef NO_DIVIDE -# define MOD(a) \ - do { \ - if (a >= (BASE << 16)) a -= (BASE << 16); \ - if (a >= (BASE << 15)) a -= (BASE << 15); \ - if (a >= (BASE << 14)) a -= (BASE << 14); \ - if (a >= (BASE << 13)) a -= (BASE << 13); \ - if (a >= (BASE << 12)) a -= (BASE << 12); \ - if (a >= (BASE << 11)) a -= (BASE << 11); \ - if (a >= (BASE << 10)) a -= (BASE << 10); \ - if (a >= (BASE << 9)) a -= (BASE << 9); \ - if (a >= (BASE << 8)) a -= (BASE << 8); \ - if (a >= (BASE << 7)) a -= (BASE << 7); \ - if (a >= (BASE << 6)) a -= (BASE << 6); \ - if (a >= (BASE << 5)) a -= (BASE << 5); \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -# define MOD4(a) \ - do { \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -#else -# define MOD(a) a %= BASE -# define MOD4(a) a %= BASE -#endif - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - unsigned long sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) { - adler += buf[0]; - if (adler >= BASE) - adler -= BASE; - sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; - return adler | (sum2 << 16); - } - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == Z_NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) { - while (len--) { - adler += *buf++; - sum2 += adler; - } - if (adler >= BASE) - adler -= BASE; - MOD4(sum2); /* only added so many BASE's */ - return adler | (sum2 << 16); - } - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; - n = NMAX / 16; /* NMAX is divisible by 16 */ - do { - DO16(buf); /* 16 sums unrolled */ - buf += 16; - } while (--n); - MOD(adler); - MOD(sum2); - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ - while (len >= 16) { - len -= 16; - DO16(buf); - buf += 16; - } - while (len--) { - adler += *buf++; - sum2 += adler; - } - MOD(adler); - MOD(sum2); - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -/* ========================================================================= */ -local uLong adler32_combine_(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ - unsigned long sum1; - unsigned long sum2; - unsigned rem; - - /* the derivation of this formula is left as an exercise for the reader */ - rem = (unsigned)(len2 % BASE); - sum1 = adler1 & 0xffff; - sum2 = rem * sum1; - MOD(sum2); - sum1 += (adler2 & 0xffff) + BASE - 1; - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; - if (sum1 >= BASE) sum1 -= BASE; - if (sum1 >= BASE) sum1 -= BASE; - if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); - if (sum2 >= BASE) sum2 -= BASE; - return sum1 | (sum2 << 16); -} - -/* ========================================================================= */ -uLong ZEXPORT adler32_combine(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off_t len2; -{ - return adler32_combine_(adler1, adler2, len2); -} - -uLong ZEXPORT adler32_combine64(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ - return adler32_combine_(adler1, adler2, len2); -} diff --git a/src/lib/dl/ext/zlib/common.mak b/src/lib/dl/ext/zlib/common.mak deleted file mode 100755 index d1a12f22..00000000 --- a/src/lib/dl/ext/zlib/common.mak +++ /dev/null @@ -1,43 +0,0 @@ -# this makefile is included from all the dos*.mak files, do not use directly -# NTS: HPS is either \ (DOS) or / (Linux) -NOW_BUILDING = EXT_ZLIB_LIB -CFLAGS_THIS = -fr=nul -fo=$(SUBDIR)$(HPS).obj -i=.. -i..$(HPS).. -dHAVE_CONFIG_H -dSTDC - -OBJS = $(SUBDIR)$(HPS)adler32.obj $(SUBDIR)$(HPS)compress.obj $(SUBDIR)$(HPS)crc32.obj $(SUBDIR)$(HPS)deflate.obj $(SUBDIR)$(HPS)gzclose.obj $(SUBDIR)$(HPS)gzlib.obj $(SUBDIR)$(HPS)gzread.obj $(SUBDIR)$(HPS)gzwrite.obj $(SUBDIR)$(HPS)infback.obj $(SUBDIR)$(HPS)inffast.obj $(SUBDIR)$(HPS)inflate.obj $(SUBDIR)$(HPS)inftrees.obj $(SUBDIR)$(HPS)trees.obj $(SUBDIR)$(HPS)uncompr.obj $(SUBDIR)$(HPS)zutil.obj - -!ifdef EXT_ZLIB_MINIGZIP_EXE -$(EXT_ZLIB_MINIGZIP_EXE): $(EXT_ZLIB_LIB) $(SUBDIR)$(HPS)minigzip.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)minigzip.obj library $(EXT_ZLIB_LIB) name $(EXT_ZLIB_MINIGZIP_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifdef EXT_ZLIB_EXAMPLE_EXE -$(EXT_ZLIB_EXAMPLE_EXE): $(EXT_ZLIB_LIB) $(SUBDIR)$(HPS)example.obj - %write tmp.cmd option quiet system $(WLINK_SYSTEM) file $(SUBDIR)$(HPS)example.obj library $(EXT_ZLIB_LIB) name $(EXT_ZLIB_EXAMPLE_EXE) - @wlink @tmp.cmd - @$(COPY) ..$(HPS)..$(HPS)dos32a.dat $(SUBDIR)$(HPS)dos4gw.exe -!endif - -!ifndef EXT_ZLIB_LIB_NO_LIB -$(EXT_ZLIB_LIB): $(OBJS) - wlib -q -b -c $(EXT_ZLIB_LIB) -+$(SUBDIR)$(HPS)adler32.obj -+$(SUBDIR)$(HPS)compress.obj -+$(SUBDIR)$(HPS)crc32.obj -+$(SUBDIR)$(HPS)deflate.obj -+$(SUBDIR)$(HPS)gzclose.obj -+$(SUBDIR)$(HPS)gzlib.obj -+$(SUBDIR)$(HPS)gzread.obj -+$(SUBDIR)$(HPS)gzwrite.obj -+$(SUBDIR)$(HPS)infback.obj -+$(SUBDIR)$(HPS)inffast.obj -+$(SUBDIR)$(HPS)inflate.obj -+$(SUBDIR)$(HPS)inftrees.obj -+$(SUBDIR)$(HPS)trees.obj -+$(SUBDIR)$(HPS)uncompr.obj -+$(SUBDIR)$(HPS)zutil.obj -!endif - -# NTS we have to construct the command line into tmp.cmd because for MS-DOS -# systems all arguments would exceed the pitiful 128 char command line limit -.C.OBJ: - %write tmp.cmd $(CFLAGS_THIS) $(CFLAGS) $[@ - @$(CC) @tmp.cmd - -all: lib exe .symbolic - -lib: $(EXT_ZLIB_LIB) .symbolic - -exe: $(EXT_ZLIB_MINIGZIP_EXE) $(EXT_ZLIB_EXAMPLE_EXE) .symbolic - -clean: .SYMBOLIC - del $(SUBDIR)$(HPS)*.obj - del tmp.cmd - @echo Cleaning done - diff --git a/src/lib/dl/ext/zlib/compress.c b/src/lib/dl/ext/zlib/compress.c deleted file mode 100755 index ea4dfbe9..00000000 --- a/src/lib/dl/ext/zlib/compress.c +++ /dev/null @@ -1,80 +0,0 @@ -/* compress.c -- compress a memory buffer - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; - int level; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = deflateInit(&stream, level); - if (err != Z_OK) return err; - - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; - - err = deflateEnd(&stream); - return err; -} - -/* =========================================================================== - */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + - (sourceLen >> 25) + 13; -} diff --git a/src/lib/dl/ext/zlib/crc32.c b/src/lib/dl/ext/zlib/crc32.c deleted file mode 100755 index 91be372d..00000000 --- a/src/lib/dl/ext/zlib/crc32.c +++ /dev/null @@ -1,442 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -/* @(#) $Id$ */ - -/* - Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore - protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should - first call get_crc_table() to initialize the tables before allowing more than - one thread to use crc32(). - */ - -#ifdef MAKECRCH -# include <stdio.h> -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif /* !DYNAMIC_CRC_TABLE */ -#endif /* MAKECRCH */ - -#include "zutil.h" /* for STDC and FAR definitions */ - -#define local static - -/* Find a four-byte integer type for crc32_little() and crc32_big(). */ -#ifndef NOBYFOUR -# ifdef STDC /* need ANSI C limits.h to determine sizes */ -# include <limits.h> -# define BYFOUR -# if (UINT_MAX == 0xffffffffUL) - typedef unsigned int u4; -# else -# if (ULONG_MAX == 0xffffffffUL) - typedef unsigned long u4; -# else -# if (USHRT_MAX == 0xffffffffUL) - typedef unsigned short u4; -# else -# undef BYFOUR /* can't find a four-byte integer type! */ -# endif -# endif -# endif -# endif /* STDC */ -#endif /* !NOBYFOUR */ - -/* Definitions for doing the crc four data bytes at a time. */ -#ifdef BYFOUR -# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ - (((w)&0xff00)<<8)+(((w)&0xff)<<24)) - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, unsigned)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, unsigned)); -# define TBLS 8 -#else -# define TBLS 1 -#endif /* BYFOUR */ - -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); - - -#ifdef DYNAMIC_CRC_TABLE - -local volatile int crc_table_empty = 1; -local unsigned long FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); -#ifdef MAKECRCH - local void write_table OF((FILE *, const unsigned long FAR *)); -#endif /* MAKECRCH */ -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - unsigned long c; - int n, k; - unsigned long poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) - poly |= 1UL << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (unsigned long)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = REV(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = REV(c); - } - } -#endif /* BYFOUR */ - - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other guy to finish (not efficient, but rare) */ - while (crc_table_empty) - ; - } - -#ifdef MAKECRCH - /* write out CRC tables to crc32.h */ - { - FILE *out; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const unsigned long FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); - } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const unsigned long FAR *table; -{ - int n; - - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} -#endif /* MAKECRCH */ - -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). - */ -#include "crc32.h" -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const unsigned long FAR * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; -} - -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - uInt len; -{ - if (buf == Z_NULL) return 0UL; - -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - u4 endian; - - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); - } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; - } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} - -#ifdef BYFOUR - -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = (u4)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const u4 FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} - -/* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = REV((u4)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const u4 FAR *)(const void FAR *)buf; - buf4--; - while (len >= 32) { - DOBIG32; - len -= 32; - } - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf4++; - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(REV(c)); -} - -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - -/* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; -{ - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - -/* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; -{ - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= */ -local uLong crc32_combine_(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case (also disallow negative lengths) */ - if (len2 <= 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } - - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} - -uLong ZEXPORT crc32_combine64(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} diff --git a/src/lib/dl/ext/zlib/crc32.h b/src/lib/dl/ext/zlib/crc32.h deleted file mode 100755 index 8053b611..00000000 --- a/src/lib/dl/ext/zlib/crc32.h +++ /dev/null @@ -1,441 +0,0 @@ -/* crc32.h -- tables for rapid CRC calculation - * Generated automatically by crc32.c - */ - -local const unsigned long FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL -#endif - } -}; diff --git a/src/lib/dl/ext/zlib/deflate.c b/src/lib/dl/ext/zlib/deflate.c deleted file mode 100755 index 5c4022f3..00000000 --- a/src/lib/dl/ext/zlib/deflate.c +++ /dev/null @@ -1,1834 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://www.ietf.org/rfc/rfc1951.txt - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -/* @(#) $Id$ */ - -#include "deflate.h" - -const char deflate_copyright[] = - " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Function prototypes. - */ -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); -/* Compression function. Returns the block state after the call. */ - -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); -#ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local block_state deflate_rle OF((deflate_state *s, int flush)); -local block_state deflate_huff OF((deflate_state *s, int flush)); -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif - -#ifdef DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); -#endif - -/* =========================================================================== - * Local data - */ - -#define NIL 0 -/* Tail of hash chains */ - -#ifndef TOO_FAR -# define TOO_FAR 4096 -#endif -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - ush good_length; /* reduce lazy search above this match length */ - ush max_lazy; /* do not perform lazy search above this match length */ - ush nice_length; /* quit search above this match length */ - ush max_chain; - compress_func func; -} config; - -#ifdef FASTEST -local const config configuration_table[2] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ -#else -local const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ -#endif - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask) - - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * If this file is compiled with -DFASTEST, the compression level is forced - * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -#ifdef FASTEST -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#else -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#endif - -/* =========================================================================== - * Initialize the hash table (avoiding 64K overflow for 16 bit systems). - * prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); - -/* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ - return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ - deflate_state *s; - int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } - if (strm == Z_NULL) return Z_STREAM_ERROR; - - strm->msg = Z_NULL; - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } -#ifdef GZIP - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } -#endif - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); - if (s == Z_NULL) return Z_MEM_ERROR; - strm->state = (struct internal_state FAR *)s; - s->strm = strm; - - s->wrap = wrap; - s->gzhead = Z_NULL; - s->w_bits = windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - - s->hash_bits = memLevel + 7; - s->hash_size = 1 << s->hash_bits; - s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); - - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); - s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); - - s->high_water = 0; /* nothing written to s->window yet */ - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); - - if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || - s->pending_buf == Z_NULL) { - s->status = FINISH_STATE; - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); - deflateEnd (strm); - return Z_MEM_ERROR; - } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - - s->level = level; - s->strategy = strategy; - s->method = (Byte)method; - - return deflateReset(strm); -} - -/* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ - deflate_state *s; - uInt length = dictLength; - uInt n; - IPos hash_head = 0; - - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->wrap == 2 || - (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) - return Z_STREAM_ERROR; - - s = strm->state; - if (s->wrap) - strm->adler = adler32(strm->adler, dictionary, dictLength); - - if (length < MIN_MATCH) return Z_OK; - if (length > s->w_size) { - length = s->w_size; - dictionary += dictLength - length; /* use the tail of the dictionary */ - } - zmemcpy(s->window, dictionary, length); - s->strstart = length; - s->block_start = (long)length; - - /* Insert all strings in the hash table (except for the last two bytes). - * s->lookahead stays null, so s->ins_h will be recomputed at the next - * call of fill_window. - */ - s->ins_h = s->window[0]; - UPDATE_HASH(s, s->ins_h, s->window[1]); - for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); - } - if (hash_head) hash_head = 0; /* to make compiler happy */ - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { - return Z_STREAM_ERROR; - } - - strm->total_in = strm->total_out = 0; - strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) { - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; - strm->adler = -#ifdef GZIP - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : -#endif - adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; - - _tr_init(s); - lm_init(s); - - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) - z_streamp strm; - gz_headerp head; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (strm->state->wrap != 2) return Z_STREAM_ERROR; - strm->state->gzhead = head; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - strm->state->bi_valid = bits; - strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ - deflate_state *s; - compress_func func; - int err = Z_OK; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - func = configuration_table[s->level].func; - - if ((strategy != s->strategy || func != configuration_table[level].func) && - strm->total_in != 0) { - /* Flush the last buffer: */ - err = deflate(strm, Z_BLOCK); - } - if (s->level != level) { - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return err; -} - -/* ========================================================================= */ -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) - z_streamp strm; - int good_length; - int max_lazy; - int nice_length; - int max_chain; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - s->good_match = good_length; - s->max_lazy_match = max_lazy; - s->nice_match = nice_length; - s->max_chain_length = max_chain; - return Z_OK; -} - -/* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. - * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. - * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. - */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ - deflate_state *s; - uLong complen, wraplen; - Bytef *str; - - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; - - /* if can't get parameters, return conservative bound plus zlib wrapper */ - if (strm == Z_NULL || strm->state == Z_NULL) - return complen + 6; - - /* compute wrapper length */ - s = strm->state; - switch (s->wrap) { - case 0: /* raw deflate */ - wraplen = 0; - break; - case 1: /* zlib wrapper */ - wraplen = 6 + (s->strstart ? 4 : 0); - break; - case 2: /* gzip wrapper */ - wraplen = 18; - if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ - if (s->gzhead->extra != Z_NULL) - wraplen += 2 + s->gzhead->extra_len; - str = s->gzhead->name; - if (str != Z_NULL) - do { - wraplen++; - } while (*str++); - str = s->gzhead->comment; - if (str != Z_NULL) - do { - wraplen++; - } while (*str++); - if (s->gzhead->hcrc) - wraplen += 2; - } - break; - default: /* for compiler happiness */ - wraplen = 6; - } - - /* if not default parameters, return conservative bound */ - if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; - - /* default settings: return tight bound for that case */ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + - (sourceLen >> 25) + 13 - 6 + wraplen; -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ - put_byte(s, (Byte)(b >> 8)); - put_byte(s, (Byte)(b & 0xff)); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). - */ -local void flush_pending(strm) - z_streamp strm; -{ - unsigned len = strm->state->pending; - - if (len > strm->avail_out) len = strm->avail_out; - if (len == 0) return; - - zmemcpy(strm->next_out, strm->state->pending_out, len); - strm->next_out += len; - strm->state->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - strm->state->pending -= len; - if (strm->state->pending == 0) { - strm->state->pending_out = strm->state->pending_buf; - } -} - -/* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ - int old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_BLOCK || flush < 0) { - return Z_STREAM_ERROR; - } - s = strm->state; - - if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - - s->strm = strm; /* just in case */ - old_flush = s->last_flush; - s->last_flush = flush; - - /* Write the header */ - if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == Z_NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != Z_NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } - else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s->status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = adler32(0L, Z_NULL, 0); - } - } -#ifdef GZIP - if (s->status == EXTRA_STATE) { - if (s->gzhead->extra != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - - while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) - break; - } - put_byte(s, s->gzhead->extra[s->gzindex]); - s->gzindex++; - } - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (s->gzindex == s->gzhead->extra_len) { - s->gzindex = 0; - s->status = NAME_STATE; - } - } - else - s->status = NAME_STATE; - } - if (s->status == NAME_STATE) { - if (s->gzhead->name != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->name[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) { - s->gzindex = 0; - s->status = COMMENT_STATE; - } - } - else - s->status = COMMENT_STATE; - } - if (s->status == COMMENT_STATE) { - if (s->gzhead->comment != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->comment[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) - s->status = HCRC_STATE; - } - else - s->status = HCRC_STATE; - } - if (s->status == HCRC_STATE) { - if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) - flush_pending(strm); - if (s->pending + 2 <= s->pending_buf_size) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - strm->adler = crc32(0L, Z_NULL, 0); - s->status = BUSY_STATE; - } - } - else - s->status = BUSY_STATE; - } -#endif - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && flush <= old_flush && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || - (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : - (s->strategy == Z_RLE ? deflate_rle(s, flush) : - (*(configuration_table[s->level].func))(s, flush)); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(s); - } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - _tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - if (s->lookahead == 0) { - s->strstart = 0; - s->block_start = 0L; - } - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - Assert(strm->avail_out > 0, "bug2"); - - if (flush != Z_FINISH) return Z_OK; - if (s->wrap <= 0) return Z_STREAM_END; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); - put_byte(s, (Byte)(strm->total_in & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); - } - else -#endif - { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; -} - -/* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ - int status; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - - status = strm->state->status; - if (status != INIT_STATE && - status != EXTRA_STATE && - status != NAME_STATE && - status != COMMENT_STATE && - status != HCRC_STATE && - status != BUSY_STATE && - status != FINISH_STATE) { - return Z_STREAM_ERROR; - } - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE(strm, strm->state->window); - - ZFREE(strm, strm->state); - strm->state = Z_NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - * To simplify the source, this is not supported for 16-bit MSDOS (which - * doesn't have enough memory anyway to duplicate compression states). - */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ -#ifdef MAXSEG_64K - return Z_STREAM_ERROR; -#else - deflate_state *ds; - deflate_state *ss; - ushf *overlay; - - - if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { - return Z_STREAM_ERROR; - } - - ss = source->state; - - zmemcpy(dest, source, sizeof(z_stream)); - - ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); - if (ds == Z_NULL) return Z_MEM_ERROR; - dest->state = (struct internal_state FAR *) ds; - zmemcpy(ds, ss, sizeof(deflate_state)); - ds->strm = dest; - - ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); - ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; - - if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || - ds->pending_buf == Z_NULL) { - deflateEnd (dest); - return Z_MEM_ERROR; - } - /* following zmemcpy do not work for 16-bit MSDOS */ - zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; - - ds->l_desc.dyn_tree = ds->dyn_ltree; - ds->d_desc.dyn_tree = ds->dyn_dtree; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -#endif /* MAXSEG_64K */ -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local int read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, strm->next_in, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, strm->next_in, len); - } -#endif - zmemcpy(buf, strm->next_in, len); - strm->next_in += len; - strm->total_in += len; - - return (int)len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif -} - -#ifndef FASTEST -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - unsigned chain_length = s->max_chain_length;/* max hash chain length */ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - int best_len = s->prev_length; /* best match length so far */ - int nice_match = s->nice_match; /* stop if match long enough */ - IPos limit = s->strstart > (IPos)MAX_DIST(s) ? - s->strstart - (IPos)MAX_DIST(s) : NIL; - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - Posf *prev = s->prev; - uInt wmask = s->w_mask; - -#ifdef UNALIGNED_OK - /* Compare two bytes at a time. Note: this is not always beneficial. - * Try with and without -DUNALIGNED_OK to check. - */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); -#else - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end = scan[best_len]; -#endif - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s->prev_length >= s->good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - Assert(cur_match < s->strstart, "no future"); - match = s->window + cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use - * UNALIGNED_OK if your compiler uses a different size. - */ - if (*(ushf*)(match+best_len-1) != scan_end || - *(ushf*)match != scan_start) continue; - - /* It is not necessary to compare scan[2] and match[2] since they are - * always equal when the other bytes match, given that the hash keys - * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient - * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is - * necessary to put more guard bytes at the end of the window, or - * to check more often for insufficient lookahead. - */ - Assert(scan[2] == match[2], "scan[2]?"); - scan++, match++; - do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - scan < strend); - /* The funny "do {}" generates better code on most compilers */ - - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - if (*scan == *match) scan++; - - len = (MAX_MATCH - 1) - (int)(strend-scan); - scan = strend - (MAX_MATCH-1); - -#else /* UNALIGNED_OK */ - - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match++; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - scan = strend - MAX_MATCH; - -#endif /* UNALIGNED_OK */ - - if (len > best_len) { - s->match_start = cur_match; - best_len = len; - if (len >= nice_match) break; -#ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); -#else - scan_end1 = scan[best_len-1]; - scan_end = scan[best_len]; -#endif - } - } while ((cur_match = prev[cur_match & wmask]) > limit - && --chain_length != 0); - - if ((uInt)best_len <= s->lookahead) return (uInt)best_len; - return s->lookahead; -} -#endif /* ASMV */ - -#else /* FASTEST */ - -/* --------------------------------------------------------------------------- - * Optimized version for FASTEST only - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - Assert(cur_match < s->strstart, "no future"); - - match = s->window + cur_match; - - /* Return failure if the match length is less than 2: - */ - if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match += 2; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - - if (len < MIN_MATCH) return MIN_MATCH - 1; - - s->match_start = cur_match; - return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; -} - -#endif /* FASTEST */ - -#ifdef DEBUG -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ - /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); - do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - register unsigned n, m; - register Posf *p; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); - - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif - more += wsize; - } - if (s->strm->avail_in == 0) return; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead >= MIN_MATCH) { - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ - if (s->high_water < s->window_size) { - ulg curr = s->strstart + (ulg)(s->lookahead); - ulg init; - - if (s->high_water < curr) { - /* Previous high water mark below current data -- zero WIN_INIT - * bytes or up to end of window, whichever is less. - */ - init = s->window_size - curr; - if (init > WIN_INIT) - init = WIN_INIT; - zmemzero(s->window + curr, (unsigned)init); - s->high_water = curr + init; - } - else if (s->high_water < (ulg)curr + WIN_INIT) { - /* High water mark at or above current data, but below current data - * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up - * to end of window, whichever is less. - */ - init = (ulg)curr + WIN_INIT - s->high_water; - if (init > s->window_size - s->high_water) - init = s->window_size - s->high_water; - zmemzero(s->window + s->high_water, (unsigned)init); - s->high_water += init; - } - } -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, last) { \ - _tr_flush_block(s, (s->block_start >= 0L ? \ - (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (last)); \ - s->block_start = s->strstart; \ - flush_pending(s->strm); \ - Tracev((stderr,"[FLUSH]")); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, last) { \ - FLUSH_BLOCK_ONLY(s, last); \ - if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - ulg max_block_size = 0xffff; - ulg max_start; - - if (max_block_size > s->pending_buf_size - 5) { - max_block_size = s->pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s->lookahead <= 1) { - - Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); - - fill_window(s); - if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; - - if (s->lookahead == 0) break; /* flush the current block */ - } - Assert(s->block_start >= 0L, "block gone"); - - s->strstart += s->lookahead; - s->lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; - if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; - FLUSH_BLOCK(s, 0); - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { - FLUSH_BLOCK(s, 0); - } - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head; /* head of the hash chain */ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = NIL; - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s->match_length = longest_match (s, hash_head); - /* longest_match() sets match_start */ - } - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, s->match_length); - - _tr_tally_dist(s, s->strstart - s->match_start, - s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ -#ifndef FASTEST - if (s->match_length <= s->max_insert_length && - s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in table */ - do { - s->strstart++; - INSERT_STRING(s, s->strstart, hash_head); - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s->match_length != 0); - s->strstart++; - } else -#endif - { - s->strstart += s->match_length; - s->match_length = 0; - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -#ifndef FASTEST -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = NIL; - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_length = s->match_length, s->prev_match = s->match_start; - s->match_length = MIN_MATCH-1; - - if (hash_head != NIL && s->prev_length < s->max_lazy_match && - s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s->match_length = longest_match (s, hash_head); - /* longest_match() sets match_start */ - - if (s->match_length <= 5 && (s->strategy == Z_FILTERED -#if TOO_FAR <= 32767 - || (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR) -#endif - )) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s->match_length = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { - uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - check_match(s, s->strstart-1, s->prev_match, s->prev_length); - - _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); - - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s->lookahead -= s->prev_length-1; - s->prev_length -= 2; - do { - if (++s->strstart <= max_insert) { - INSERT_STRING(s, s->strstart, hash_head); - } - } while (--s->prev_length != 0); - s->match_available = 0; - s->match_length = MIN_MATCH-1; - s->strstart++; - - if (bflush) FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { - FLUSH_BLOCK_ONLY(s, 0); - } - s->strstart++; - s->lookahead--; - if (s->strm->avail_out == 0) return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - s->match_available = 0; - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif /* FASTEST */ - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -local block_state deflate_rle(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - uInt prev; /* byte at distance one to match */ - Bytef *scan, *strend; /* scan goes up to strend for length of run */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest encodable run. - */ - if (s->lookahead < MAX_MATCH) { - fill_window(s); - if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s->match_length = 0; - if (s->lookahead >= MIN_MATCH && s->strstart > 0) { - scan = s->window + s->strstart - 1; - prev = *scan; - if (prev == *++scan && prev == *++scan && prev == *++scan) { - strend = s->window + s->strstart + MAX_MATCH; - do { - } while (prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - scan < strend); - s->match_length = MAX_MATCH - (int)(strend - scan); - if (s->match_length > s->lookahead) - s->match_length = s->lookahead; - } - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, s->match_length); - - _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - s->strstart += s->match_length; - s->match_length = 0; - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -local block_state deflate_huff(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s->lookahead == 0) { - fill_window(s); - if (s->lookahead == 0) { - if (flush == Z_NO_FLUSH) - return need_more; - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s->match_length = 0; - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} diff --git a/src/lib/dl/ext/zlib/deflate.h b/src/lib/dl/ext/zlib/deflate.h deleted file mode 100755 index cbf0d1ea..00000000 --- a/src/lib/dl/ext/zlib/deflate.h +++ /dev/null @@ -1,342 +0,0 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2010 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define INIT_STATE 42 -#define EXTRA_STATE 69 -#define NAME_STATE 73 -#define COMMENT_STATE 91 -#define HCRC_STATE 103 -#define BUSY_STATE 113 -#define FINISH_STATE 666 -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - uInt pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - gz_headerp gzhead; /* gzip header information to write */ - uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* STORED (for zip only) or DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to supress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - int last_eob_len; /* bit length of EOB code for last block */ - -#ifdef DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - ulg high_water; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - -#define WIN_INIT MAX_MATCH -/* Number of bytes after end of data in window to initialize in order to avoid - memory checker errors from longest match routines */ - - /* in trees.c */ -void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); -int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); -void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); -void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch ZLIB_INTERNAL _length_code[]; - extern uch ZLIB_INTERNAL _dist_code[]; -#else - extern const uch ZLIB_INTERNAL _length_code[]; - extern const uch ZLIB_INTERNAL _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ diff --git a/src/lib/dl/ext/zlib/example.c b/src/lib/dl/ext/zlib/example.c deleted file mode 100755 index 89da2cc7..00000000 --- a/src/lib/dl/ext/zlib/example.c +++ /dev/null @@ -1,571 +0,0 @@ -/* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2006 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zlib.h" -#include <stdio.h> - -#ifdef STDC -# include <string.h> -# include <stdlib.h> -#endif - -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) -# include <dos.h> -# include <i86.h> -#endif - -#if defined(VMS) || defined(RISCOS) -# define TESTFILE "foo-gz" -#else -# define TESTFILE "foo.gz" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -const char hello[] = "hello, hello!"; -/* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - */ - -const char dictionary[] = "hello"; -uLong dictId; /* Adler32 value of the dictionary */ - -void test_compress OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *fname, - Byte *uncompr, uLong uncomprLen)); -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Test compress() and uncompress() - */ -void test_compress(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - uLong len = (uLong)strlen(hello)+1; - - err = compress(compr, &comprLen, (const Bytef*)hello, len); - CHECK_ERR(err, "compress"); - - strcpy((char*)uncompr, "garbage"); - - err = uncompress(uncompr, &uncomprLen, compr, comprLen); - CHECK_ERR(err, "uncompress"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad uncompress\n"); - exit(1); - } else { - printf("uncompress(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test read/write of .gz files - */ -void test_gzio(fname, uncompr, uncomprLen) - const char *fname; /* compressed file name */ - Byte *uncompr; - uLong uncomprLen; -{ -#ifdef NO_GZCOMPRESS - fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); -#else - int err; - int len = (int)strlen(hello)+1; - gzFile file; - z_off_t pos; - - file = gzopen(fname, "wb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - gzputc(file, 'h'); - if (gzputs(file, "ello") != 4) { - fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); - exit(1); - } - if (gzprintf(file, ", %s!", "hello") != 8) { - fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); - exit(1); - } - gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ - gzclose(file); - - file = gzopen(fname, "rb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - strcpy((char*)uncompr, "garbage"); - - if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { - fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); - } else { - printf("gzread(): %s\n", (char*)uncompr); - } - - pos = gzseek(file, -8L, SEEK_CUR); - if (pos != 6 || gztell(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)gztell(file)); - exit(1); - } - - if (gzgetc(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); - } - - if (gzungetc(' ', file) != ' ') { - fprintf(stderr, "gzungetc error\n"); - exit(1); - } - - gzgets(file, (char*)uncompr, (int)uncomprLen); - if (strlen((char*)uncompr) != 7) { /* " hello!" */ - fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello + 6)) { - fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); - } else { - printf("gzgets() after gzseek: %s\n", (char*)uncompr); - } - - gzclose(file); -#endif -} - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uLong len = (uLong)strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = deflate(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } else { - printf("inflate(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_SPEED); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in = compr; - c_stream.avail_in = (uInt)comprLen/2; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - /* Switch back to compressing mode: */ - deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (uInt)uncomprLen; - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "large inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2*uncomprLen + comprLen/2) { - fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); - exit(1); - } else { - printf("large_inflate(): OK\n"); - } -} - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(compr, comprLen) - Byte *compr; - uLong *comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uInt len = (uInt)strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (uInt)*comprLen; - err = deflate(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate"); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - inflate(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ - err = inflateSync(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = inflate(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ - exit(1); - } - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - printf("after inflateSync(): hel%s\n", (char *)uncompr); -} - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = deflateSetDictionary(&c_stream, - (const Bytef*)dictionary, sizeof(dictionary)); - CHECK_ERR(err, "deflateSetDictionary"); - - dictId = c_stream.adler; - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - c_stream.next_in = (Bytef*)hello; - c_stream.avail_in = (uInt)strlen(hello)+1; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - for (;;) { - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, - sizeof(dictionary)); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } else { - printf("inflate with dictionary: %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Usage: example [output.gz [input.gz]] - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - Byte *compr, *uncompr; - uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ - uLong uncomprLen = comprLen; - static const char* myVersion = ZLIB_VERSION; - - if (zlibVersion()[0] != myVersion[0]) { - fprintf(stderr, "incompatible zlib version\n"); - exit(1); - - } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { - fprintf(stderr, "warning: different zlib version\n"); - } - - printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", - ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); - - compr = (Byte*)calloc((uInt)comprLen, 1); - uncompr = (Byte*)calloc((uInt)uncomprLen, 1); - /* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - */ - if (compr == Z_NULL || uncompr == Z_NULL) { - printf("out of memory\n"); - exit(1); - } - - test_compress(compr, comprLen, uncompr, uncomprLen); - - test_gzio((argc > 1 ? argv[1] : TESTFILE), - uncompr, uncomprLen); - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - comprLen = uncomprLen; - - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - return 0; -} diff --git a/src/lib/dl/ext/zlib/gzclose.c b/src/lib/dl/ext/zlib/gzclose.c deleted file mode 100755 index caeb99a3..00000000 --- a/src/lib/dl/ext/zlib/gzclose.c +++ /dev/null @@ -1,25 +0,0 @@ -/* gzclose.c -- zlib gzclose() function - * Copyright (C) 2004, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -/* gzclose() is in a separate file so that it is linked in only if it is used. - That way the other gzclose functions can be used instead to avoid linking in - unneeded compression or decompression routines. */ -int ZEXPORT gzclose(file) - gzFile file; -{ -#ifndef NO_GZCOMPRESS - gz_statep state; - - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); -#else - return gzclose_r(file); -#endif -} diff --git a/src/lib/dl/ext/zlib/gzguts.h b/src/lib/dl/ext/zlib/gzguts.h deleted file mode 100755 index 7b7959b2..00000000 --- a/src/lib/dl/ext/zlib/gzguts.h +++ /dev/null @@ -1,132 +0,0 @@ -/* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef _LARGEFILE64_SOURCE -# ifndef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE 1 -# endif -# ifdef _FILE_OFFSET_BITS -# undef _FILE_OFFSET_BITS -# endif -#endif - -#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include <stdio.h> -#include "zlib.h" -#ifdef STDC -# include <string.h> -# include <stdlib.h> -# include <limits.h> -#endif -#include <fcntl.h> - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#ifdef _MSC_VER -# include <io.h> -# define vsnprintf _vsnprintf -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -/* gz* functions always use library allocation functions */ -#ifndef STDC - extern voidp malloc OF((uInt size)); - extern void free OF((voidpf ptr)); -#endif - -/* get errno and strerror definition */ -#if defined UNDER_CE -# include <windows.h> -# define zstrerror() gz_strwinerror((DWORD)GetLastError()) -#else -# ifdef STDC -# include <errno.h> -# define zstrerror() strerror(errno) -# else -# define zstrerror() "stdio error (consult errno)" -# endif -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); -#endif - -/* default i/o buffer size -- double this for output when reading */ -#define GZBUFSIZE 8192 - -/* gzip modes, also provide a little integrity check on the passed structure */ -#define GZ_NONE 0 -#define GZ_READ 7247 -#define GZ_WRITE 31153 -#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ - -/* values for gz_state how */ -#define LOOK 0 /* look for a gzip header */ -#define COPY 1 /* copy input directly */ -#define GZIP 2 /* decompress a gzip stream */ - -/* internal gzip file state data structure */ -typedef struct { - /* used for both reading and writing */ - int mode; /* see gzip modes above */ - int fd; /* file descriptor */ - char *path; /* path or fd for error messages */ - z_off64_t pos; /* current position in uncompressed data */ - unsigned size; /* buffer size, zero if not allocated yet */ - unsigned want; /* requested buffer size, default is GZBUFSIZE */ - Bytef *in; /* input buffer */ - Bytef *out; /* output buffer (double-sized when reading) */ - Bytef *next; /* next output data to deliver or write */ - /* just for reading */ - unsigned have; /* amount of output data unused at next */ - int eof; /* true if end of input file reached */ - z_off64_t start; /* where the gzip data started, for rewinding */ - z_off64_t raw; /* where the raw data started, for seeking */ - int how; /* 0: get header, 1: copy, 2: decompress */ - int direct; /* true if last read direct, false if gzip */ - /* just for writing */ - int level; /* compression level */ - int strategy; /* compression strategy */ - /* seek request */ - z_off64_t skip; /* amount to skip (already rewound if backwards) */ - int seek; /* true if seek request pending */ - /* error information */ - int err; /* error code */ - char *msg; /* error message */ - /* zlib inflate or deflate stream */ - z_stream strm; /* stream structure in-place (not a pointer) */ -} gz_state; -typedef gz_state *gz_statep; /* FAR */ - -/* shared functions */ -void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); -#if defined UNDER_CE -char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); -#endif - -/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t - value -- needed when comparing unsigned to z_off64_t, which is signed - (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else -unsigned ZLIB_INTERNAL gz_intmax OF((void)); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif diff --git a/src/lib/dl/ext/zlib/gzlib.c b/src/lib/dl/ext/zlib/gzlib.c deleted file mode 100755 index 603e60ed..00000000 --- a/src/lib/dl/ext/zlib/gzlib.c +++ /dev/null @@ -1,537 +0,0 @@ -/* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 -# define LSEEK lseek64 -#else -# define LSEEK lseek -#endif - -/* Local functions */ -local void gz_reset OF((gz_statep)); -local gzFile gz_open OF((const char *, int, const char *)); - -#if defined UNDER_CE - -/* Map the Windows error number in ERROR to a locale-dependent error message - string and return a pointer to it. Typically, the values for ERROR come - from GetLastError. - - The string pointed to shall not be modified by the application, but may be - overwritten by a subsequent call to gz_strwinerror - - The gz_strwinerror function does not change the current setting of - GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) - DWORD error; -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -#endif /* UNDER_CE */ - -/* Reset gzip file state */ -local void gz_reset(state) - gz_statep state; -{ - if (state->mode == GZ_READ) { /* for reading ... */ - state->have = 0; /* no output data available */ - state->eof = 0; /* not at end of file */ - state->how = LOOK; /* look for gzip header */ - state->direct = 1; /* default for empty file */ - } - state->seek = 0; /* no seek request pending */ - gz_error(state, Z_OK, NULL); /* clear error */ - state->pos = 0; /* no uncompressed data yet */ - state->strm.avail_in = 0; /* no input data yet */ -} - -/* Open a gzip file either by name or file descriptor. */ -local gzFile gz_open(path, fd, mode) - const char *path; - int fd; - const char *mode; -{ - gz_statep state; - - /* allocate gzFile structure to return */ - state = malloc(sizeof(gz_state)); - if (state == NULL) - return NULL; - state->size = 0; /* no buffers allocated yet */ - state->want = GZBUFSIZE; /* requested buffer size */ - state->msg = NULL; /* no error message yet */ - - /* interpret mode */ - state->mode = GZ_NONE; - state->level = Z_DEFAULT_COMPRESSION; - state->strategy = Z_DEFAULT_STRATEGY; - while (*mode) { - if (*mode >= '0' && *mode <= '9') - state->level = *mode - '0'; - else - switch (*mode) { - case 'r': - state->mode = GZ_READ; - break; -#ifndef NO_GZCOMPRESS - case 'w': - state->mode = GZ_WRITE; - break; - case 'a': - state->mode = GZ_APPEND; - break; -#endif - case '+': /* can't read and write at the same time */ - free(state); - return NULL; - case 'b': /* ignore -- will request binary anyway */ - break; - case 'f': - state->strategy = Z_FILTERED; - break; - case 'h': - state->strategy = Z_HUFFMAN_ONLY; - break; - case 'R': - state->strategy = Z_RLE; - break; - case 'F': - state->strategy = Z_FIXED; - default: /* could consider as an error, but just ignore */ - ; - } - mode++; - } - - /* must provide an "r", "w", or "a" */ - if (state->mode == GZ_NONE) { - free(state); - return NULL; - } - - /* save the path name for error messages */ - state->path = malloc(strlen(path) + 1); - if (state->path == NULL) { - free(state); - return NULL; - } - strcpy(state->path, path); - - /* open the file with the appropriate mode (or just use fd) */ - state->fd = fd != -1 ? fd : - open(path, -#ifdef O_LARGEFILE - O_LARGEFILE | -#endif -#ifdef O_BINARY - O_BINARY | -#endif - (state->mode == GZ_READ ? - O_RDONLY : - (O_WRONLY | O_CREAT | ( - state->mode == GZ_WRITE ? - O_TRUNC : - O_APPEND))), - 0666); - if (state->fd == -1) { - free(state->path); - free(state); - return NULL; - } - if (state->mode == GZ_APPEND) - state->mode = GZ_WRITE; /* simplify later checks */ - - /* save the current position for rewinding (only if reading) */ - if (state->mode == GZ_READ) { - state->start = LSEEK(state->fd, 0, SEEK_CUR); - if (state->start == -1) state->start = 0; - } - - /* initialize stream */ - gz_reset(state); - - /* return stream */ - return (gzFile)state; -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzopen(path, mode) - const char *path; - const char *mode; -{ - return gz_open(path, -1, mode); -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzopen64(path, mode) - const char *path; - const char *mode; -{ - return gz_open(path, -1, mode); -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzdopen(fd, mode) - int fd; - const char *mode; -{ - char *path; /* identifier for error messages */ - gzFile gz; - - if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) - return NULL; - sprintf(path, "<fd:%d>", fd); /* for debugging */ - gz = gz_open(path, fd, mode); - free(path); - return gz; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzbuffer(file, size) - gzFile file; - unsigned size; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* make sure we haven't already allocated memory */ - if (state->size != 0) - return -1; - - /* check and set requested size */ - if (size == 0) - return -1; - state->want = size; - return 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzrewind(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) - return -1; - - /* back up and start over */ - if (LSEEK(state->fd, state->start, SEEK_SET) == -1) - return -1; - gz_reset(state); - return 0; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gzseek64(file, offset, whence) - gzFile file; - z_off64_t offset; - int whence; -{ - unsigned n; - z_off64_t ret; - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* check that there's no error */ - if (state->err != Z_OK) - return -1; - - /* can only seek from start or relative to current position */ - if (whence != SEEK_SET && whence != SEEK_CUR) - return -1; - - /* normalize offset to a SEEK_CUR specification */ - if (whence == SEEK_SET) - offset -= state->pos; - else if (state->seek) - offset += state->skip; - state->seek = 0; - - /* if within raw area while reading, just go there */ - if (state->mode == GZ_READ && state->how == COPY && - state->pos + offset >= state->raw) { - ret = LSEEK(state->fd, offset - state->have, SEEK_CUR); - if (ret == -1) - return -1; - state->have = 0; - state->eof = 0; - state->seek = 0; - gz_error(state, Z_OK, NULL); - state->strm.avail_in = 0; - state->pos += offset; - return state->pos; - } - - /* calculate skip amount, rewinding if needed for back seek when reading */ - if (offset < 0) { - if (state->mode != GZ_READ) /* writing -- can't go backwards */ - return -1; - offset += state->pos; - if (offset < 0) /* before start of file! */ - return -1; - if (gzrewind(file) == -1) /* rewind, then skip to offset */ - return -1; - } - - /* if reading, skip what's in output buffer (one less gzgetc() check) */ - if (state->mode == GZ_READ) { - n = GT_OFF(state->have) || (z_off64_t)state->have > offset ? - (unsigned)offset : state->have; - state->have -= n; - state->next += n; - state->pos += n; - offset -= n; - } - - /* request skip (if not zero) */ - if (offset) { - state->seek = 1; - state->skip = offset; - } - return state->pos + offset; -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gzseek(file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - z_off64_t ret; - - ret = gzseek64(file, (z_off64_t)offset, whence); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gztell64(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* return position */ - return state->pos + (state->seek ? state->skip : 0); -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gztell(file) - gzFile file; -{ - z_off64_t ret; - - ret = gztell64(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gzoffset64(file) - gzFile file; -{ - z_off64_t offset; - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* compute and return effective offset in file */ - offset = LSEEK(state->fd, 0, SEEK_CUR); - if (offset == -1) - return -1; - if (state->mode == GZ_READ) /* reading */ - offset -= state->strm.avail_in; /* don't count buffered input */ - return offset; -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gzoffset(file) - gzFile file; -{ - z_off64_t ret; - - ret = gzoffset64(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzeof(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return 0; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return 0; - - /* return end-of-file state */ - return state->mode == GZ_READ ? - (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0; -} - -/* -- see zlib.h -- */ -const char * ZEXPORT gzerror(file, errnum) - gzFile file; - int *errnum; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return NULL; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return NULL; - - /* return error information */ - if (errnum != NULL) - *errnum = state->err; - return state->msg == NULL ? "" : state->msg; -} - -/* -- see zlib.h -- */ -void ZEXPORT gzclearerr(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return; - - /* clear error and end-of-file */ - if (state->mode == GZ_READ) - state->eof = 0; - gz_error(state, Z_OK, NULL); -} - -/* Create an error message in allocated memory and set state->err and - state->msg accordingly. Free any previous error message already there. Do - not try to free or allocate space if the error is Z_MEM_ERROR (out of - memory). Simply save the error message as a static string. If there is an - allocation failure constructing the error message, then convert the error to - out of memory. */ -void ZLIB_INTERNAL gz_error(state, err, msg) - gz_statep state; - int err; - const char *msg; -{ - /* free previously allocated message and clear */ - if (state->msg != NULL) { - if (state->err != Z_MEM_ERROR) - free(state->msg); - state->msg = NULL; - } - - /* set error code, and if no message, then done */ - state->err = err; - if (msg == NULL) - return; - - /* for an out of memory error, save as static string */ - if (err == Z_MEM_ERROR) { - state->msg = (char *)msg; - return; - } - - /* construct error message with path */ - if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { - state->err = Z_MEM_ERROR; - state->msg = (char *)"out of memory"; - return; - } - strcpy(state->msg, state->path); - strcat(state->msg, ": "); - strcat(state->msg, msg); - return; -} - -#ifndef INT_MAX -/* portably return maximum value for an int (when limits.h presumed not - available) -- we need to do this to cover cases where 2's complement not - used, since C standard permits 1's complement and sign-bit representations, - otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned ZLIB_INTERNAL gz_intmax() -{ - unsigned p, q; - - p = 1; - do { - q = p; - p <<= 1; - p++; - } while (p > q); - return q >> 1; -} -#endif diff --git a/src/lib/dl/ext/zlib/gzread.c b/src/lib/dl/ext/zlib/gzread.c deleted file mode 100755 index 4cf8877f..00000000 --- a/src/lib/dl/ext/zlib/gzread.c +++ /dev/null @@ -1,688 +0,0 @@ -/* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" -#include "zutil.h" - -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) -#include <dos.h> -#include <i86.h> -#endif - -/* Local functions */ -local int gz_load OF((gz_statep, voidpf, unsigned, unsigned *)); -local int gz_avail OF((gz_statep)); -local int gz_next4 OF((gz_statep, unsigned long *)); -local int gz_head OF((gz_statep)); -local int gz_decomp OF((gz_statep)); -local int gz_make OF((gz_statep)); -local int gz_skip OF((gz_statep, z_off64_t)); - -/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from - state->fd, and update state->eof, state->err, and state->msg as appropriate. - This function needs to loop on read(), since read() is not guaranteed to - read the number of bytes requested, depending on the type of descriptor. */ -local int gz_load(state, buf, len, have) - gz_statep state; - voidpf buf; - unsigned len; - unsigned *have; -{ - int ret; - - *have = 0; - do { -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - ret = -1; - if (_dos_read(state->fd, (unsigned char FAR*)buf + *have, len - *have, (unsigned*)(&ret)) != 0 || ret == 0) - break; -#else - ret = read(state->fd, (unsigned char*)buf + *have, len - *have); -#endif - if (ret <= 0) - break; - *have += ret; - } while (*have < len); - if (ret < 0) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - if (ret == 0) - state->eof = 1; - - return 0; -} - -/* Load up input buffer and set eof flag if last data loaded -- return -1 on - error, 0 otherwise. Note that the eof flag is set when the end of the input - file is reached, even though there may be unused data in the buffer. Once - that data has been used, no more attempts will be made to read the file. - gz_avail() assumes that strm->avail_in == 0. */ -local int gz_avail(state) - gz_statep state; -{ - z_streamp strm = &(state->strm); - - if (state->err != Z_OK) - return -1; - if (state->eof == 0) { - if (gz_load(state, state->in, state->size, - (unsigned *)&(strm->avail_in)) == -1) - return -1; - strm->next_in = state->in; - } - return 0; -} - -/* Get next byte from input, or -1 if end or error. */ -#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \ - (strm->avail_in == 0 ? -1 : \ - (strm->avail_in--, *(strm->next_in)++))) - -/* Get a four-byte little-endian integer and return 0 on success and the value - in *ret. Otherwise -1 is returned and *ret is not modified. */ -local int gz_next4(state, ret) - gz_statep state; - unsigned long *ret; -{ - int ch; - unsigned long val; - z_streamp strm = &(state->strm); - - val = NEXT(); - val += (unsigned)NEXT() << 8; - val += (unsigned long)NEXT() << 16; - ch = NEXT(); - if (ch == -1) - return -1; - val += (unsigned long)ch << 24; - *ret = val; - return 0; -} - -/* Look for gzip header, set up for inflate or copy. state->have must be zero. - If this is the first time in, allocate required memory. state->how will be - left unchanged if there is no more input data available, will be set to COPY - if there is no gzip header and direct copying will be performed, or it will - be set to GZIP for decompression, and the gzip header will be skipped so - that the next available input data is the raw deflate stream. If direct - copying, then leftover input data from the input buffer will be copied to - the output buffer. In that case, all further file reads will be directly to - either the output buffer or a user buffer. If decompressing, the inflate - state and the check value will be initialized. gz_head() will return 0 on - success or -1 on failure. Failures may include read errors or gzip header - errors. */ -local int gz_head(state) - gz_statep state; -{ - z_streamp strm = &(state->strm); - int flags; - unsigned len; - - /* allocate read buffers and inflate memory */ - if (state->size == 0) { - /* allocate buffers */ -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - state->in = _fmalloc(state->want); - state->out = _fmalloc(state->want << 1); -#else - state->in = malloc(state->want); - state->out = malloc(state->want << 1); -#endif - if (state->in == NULL || state->out == NULL) { -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - if (state->out != NULL) - _ffree(state->out); - if (state->in != NULL) - _ffree(state->in); -#else - if (state->out != NULL) - free(state->out); - if (state->in != NULL) - free(state->in); -#endif - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - state->size = state->want; - - /* allocate inflate memory */ - state->strm.zalloc = Z_NULL; - state->strm.zfree = Z_NULL; - state->strm.opaque = Z_NULL; - state->strm.avail_in = 0; - state->strm.next_in = Z_NULL; - if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */ -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - _ffree(state->out); - _ffree(state->in); -#else - free(state->out); - free(state->in); -#endif - state->size = 0; - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - } - - /* get some data in the input buffer */ - if (strm->avail_in == 0) { - if (gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) - return 0; - } - - /* look for the gzip magic header bytes 31 and 139 */ - if (strm->next_in[0] == 31) { - strm->avail_in--; - strm->next_in++; - if (strm->avail_in == 0 && gz_avail(state) == -1) - return -1; - if (strm->avail_in && strm->next_in[0] == 139) { - /* we have a gzip header, woo hoo! */ - strm->avail_in--; - strm->next_in++; - - /* skip rest of header */ - if (NEXT() != 8) { /* compression method */ - gz_error(state, Z_DATA_ERROR, "unknown compression method"); - return -1; - } - flags = NEXT(); - if (flags & 0xe0) { /* reserved flag bits */ - gz_error(state, Z_DATA_ERROR, "unknown header flags set"); - return -1; - } - NEXT(); /* modification time */ - NEXT(); - NEXT(); - NEXT(); - NEXT(); /* extra flags */ - NEXT(); /* operating system */ - if (flags & 4) { /* extra field */ - len = (unsigned)NEXT(); - len += (unsigned)NEXT() << 8; - while (len--) - if (NEXT() < 0) - break; - } - if (flags & 8) /* file name */ - while (NEXT() > 0) - ; - if (flags & 16) /* comment */ - while (NEXT() > 0) - ; - if (flags & 2) { /* header crc */ - NEXT(); - NEXT(); - } - /* an unexpected end of file is not checked for here -- it will be - noticed on the first request for uncompressed data */ - - /* set up for decompression */ - inflateReset(strm); - strm->adler = crc32(0L, Z_NULL, 0); - state->how = GZIP; - state->direct = 0; - return 0; - } - else { - /* not a gzip file -- save first byte (31) and fall to raw i/o */ - state->out[0] = 31; - state->have = 1; - } - } - - /* doing raw i/o, save start of raw data for seeking, copy any leftover - input to output -- this assumes that the output buffer is larger than - the input buffer, which also assures space for gzungetc() */ - state->raw = state->pos; - state->next = state->out; - if (strm->avail_in) { - zmemcpy(state->next + state->have, strm->next_in, strm->avail_in); - state->have += strm->avail_in; - strm->avail_in = 0; - } - state->how = COPY; - state->direct = 1; - return 0; -} - -/* Decompress from input to the provided next_out and avail_out in the state. - If the end of the compressed data is reached, then verify the gzip trailer - check value and length (modulo 2^32). state->have and state->next are set - to point to the just decompressed data, and the crc is updated. If the - trailer is verified, state->how is reset to LOOK to look for the next gzip - stream or raw data, once state->have is depleted. Returns 0 on success, -1 - on failure. Failures may include invalid compressed data or a failed gzip - trailer verification. */ -local int gz_decomp(state) - gz_statep state; -{ - int ret; - unsigned had; - unsigned long crc, len; - z_streamp strm = &(state->strm); - - /* fill output buffer up to end of deflate stream */ - had = strm->avail_out; - do { - /* get more input for inflate() */ - if (strm->avail_in == 0 && gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) { - gz_error(state, Z_DATA_ERROR, "unexpected end of file"); - return -1; - } - - /* decompress and handle errors */ - ret = inflate(strm, Z_NO_FLUSH); - if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { - gz_error(state, Z_STREAM_ERROR, - "internal error: inflate stream corrupt"); - return -1; - } - if (ret == Z_MEM_ERROR) { - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ - gz_error(state, Z_DATA_ERROR, - strm->msg == NULL ? "compressed data error" : strm->msg); - return -1; - } - } while (strm->avail_out && ret != Z_STREAM_END); - - /* update available output and crc check value */ - state->have = had - strm->avail_out; - state->next = strm->next_out - state->have; - strm->adler = crc32(strm->adler, state->next, state->have); - - /* check gzip trailer if at end of deflate stream */ - if (ret == Z_STREAM_END) { - if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) { - gz_error(state, Z_DATA_ERROR, "unexpected end of file"); - return -1; - } - if (crc != strm->adler) { - gz_error(state, Z_DATA_ERROR, "incorrect data check"); - return -1; - } - if (len != (strm->total_out & 0xffffffffL)) { - gz_error(state, Z_DATA_ERROR, "incorrect length check"); - return -1; - } - state->how = LOOK; /* ready for next stream, once have is 0 (leave - state->direct unchanged to remember how) */ - } - - /* good decompression */ - return 0; -} - -/* Make data and put in the output buffer. Assumes that state->have == 0. - Data is either copied from the input file or decompressed from the input - file depending on state->how. If state->how is LOOK, then a gzip header is - looked for (and skipped if found) to determine wither to copy or decompress. - Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY - or GZIP unless the end of the input file has been reached and all data has - been processed. */ -local int gz_make(state) - gz_statep state; -{ - z_streamp strm = &(state->strm); - - if (state->how == LOOK) { /* look for gzip header */ - if (gz_head(state) == -1) - return -1; - if (state->have) /* got some data from gz_head() */ - return 0; - } - if (state->how == COPY) { /* straight copy */ - if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1) - return -1; - state->next = state->out; - } - else if (state->how == GZIP) { /* decompress */ - strm->avail_out = state->size << 1; - strm->next_out = state->out; - if (gz_decomp(state) == -1) - return -1; - } - return 0; -} - -/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ -local int gz_skip(state, len) - gz_statep state; - z_off64_t len; -{ - unsigned n; - - /* skip over len bytes or reach end-of-file, whichever comes first */ - while (len) - /* skip over whatever is in output buffer */ - if (state->have) { - n = GT_OFF(state->have) || (z_off64_t)state->have > len ? - (unsigned)len : state->have; - state->have -= n; - state->next += n; - state->pos += n; - len -= n; - } - - /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && state->strm.avail_in == 0) - break; - - /* need more data to skip -- load up output buffer */ - else { - /* get more output, looking for header if required */ - if (gz_make(state) == -1) - return -1; - } - return 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzread(file, buf, len) - gzFile file; - voidpf buf; - unsigned len; -{ - unsigned got, n; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) - return -1; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids the flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); - return -1; - } - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return -1; - } - - /* get len bytes to buf, or less than len if at the end */ - got = 0; - do { - /* first just try copying data from the output buffer */ - if (state->have) { - n = state->have > len ? len : state->have; - zmemcpy(buf, state->next, n); - state->next += n; - state->have -= n; - } - - /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && strm->avail_in == 0) - break; - - /* need output data -- for small len or new stream load up our output - buffer */ - else if (state->how == LOOK || len < (state->size << 1)) { - /* get more output, looking for header if required */ - if (gz_make(state) == -1) - return -1; - continue; /* no progress yet -- go back to memcpy() above */ - /* the copy above assures that we will leave with space in the - output buffer, allowing at least one gzungetc() to succeed */ - } - - /* large len -- read directly into user buffer */ - else if (state->how == COPY) { /* read directly */ - if (gz_load(state, buf, len, &n) == -1) - return -1; - } - - /* large len -- decompress directly into user buffer */ - else { /* state->how == GZIP */ - strm->avail_out = len; - strm->next_out = buf; - if (gz_decomp(state) == -1) - return -1; - n = state->have; - state->have = 0; - } - - /* update progress */ - len -= n; - buf = (char FAR *)buf + n; - got += n; - state->pos += n; - } while (len); - - /* return number of bytes read into user buffer (will fit in int) */ - return (int)got; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzgetc(file) - gzFile file; -{ - int ret; - unsigned char buf[1]; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) - return -1; - - /* try output buffer (no need to check for skip request) */ - if (state->have) { - state->have--; - state->pos++; - return *(state->next)++; - } - - /* nothing there -- try gzread() */ - ret = gzread(file, buf, 1); - return ret < 1 ? -1 : buf[0]; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) - return -1; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return -1; - } - - /* can't push EOF */ - if (c < 0) - return -1; - - /* if output buffer empty, put byte at end (allows more pushing) */ - if (state->have == 0) { - state->have = 1; - state->next = state->out + (state->size << 1) - 1; - state->next[0] = c; - state->pos--; - return c; - } - - /* if no room, give up (must have already done a gzungetc()) */ - if (state->have == (state->size << 1)) { - gz_error(state, Z_BUF_ERROR, "out of room to push characters"); - return -1; - } - - /* slide output data if needed and insert byte before existing data */ - if (state->next == state->out) { - unsigned char FAR *src = state->out + state->have; - unsigned char FAR *dest = state->out + (state->size << 1); - while (src > state->out) - *--dest = *--src; - state->next = dest; - } - state->have++; - state->next--; - state->next[0] = c; - state->pos--; - return c; -} - -/* -- see zlib.h -- */ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - unsigned left, n; - char *str; - unsigned char FAR *eol; - gz_statep state; - - /* check parameters and get internal structure */ - if (file == NULL || buf == NULL || len < 1) - return NULL; - state = (gz_statep)file; - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) - return NULL; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return NULL; - } - - /* copy output bytes up to new line or len - 1, whichever comes first -- - append a terminating zero to the string (we don't check for a zero in - the contents, let the user worry about that) */ - str = buf; - left = (unsigned)len - 1; - if (left) do { - /* assure that something is in the output buffer */ - if (state->have == 0) { - if (gz_make(state) == -1) - return NULL; /* error */ - if (state->have == 0) { /* end of file */ - if (buf == str) /* got bupkus */ - return NULL; - break; /* got something -- return it */ - } - } - - /* look for end-of-line in current output buffer */ - n = state->have > left ? left : state->have; - eol = zmemchr(state->next, '\n', n); - if (eol != NULL) - n = (unsigned)(eol - state->next) + 1; - - /* copy through end-of-line, or remainder if not found */ - zmemcpy(buf, state->next, n); - state->have -= n; - state->next += n; - state->pos += n; - left -= n; - buf += n; - } while (left && eol == NULL); - - /* found end-of-line or out of space -- terminate string and return it */ - buf[0] = 0; - return str; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzdirect(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - - /* check that we're reading */ - if (state->mode != GZ_READ) - return 0; - - /* if the state is not known, but we can find out, then do so (this is - mainly for right after a gzopen() or gzdopen()) */ - if (state->how == LOOK && state->have == 0) - (void)gz_head(state); - - /* return 1 if reading direct, 0 if decompressing a gzip stream */ - return state->direct; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzclose_r(file) - gzFile file; -{ - int ret; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - /* check that we're reading */ - if (state->mode != GZ_READ) - return Z_STREAM_ERROR; - - /* free memory and close file */ - if (state->size) { - inflateEnd(&(state->strm)); -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - _ffree(state->out); - _ffree(state->in); -#else - free(state->out); - free(state->in); -#endif - } - gz_error(state, Z_OK, NULL); - free(state->path); - ret = close(state->fd); - free(state); - return ret ? Z_ERRNO : Z_OK; -} diff --git a/src/lib/dl/ext/zlib/gzwrite.c b/src/lib/dl/ext/zlib/gzwrite.c deleted file mode 100755 index f2529db2..00000000 --- a/src/lib/dl/ext/zlib/gzwrite.c +++ /dev/null @@ -1,577 +0,0 @@ -/* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004, 2005, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" -#include "zutil.h" - -#if TARGET_MSDOS == 16 && defined(SMALL_MEDIUM) && defined(__WATCOMC__) -# include <dos.h> -#endif - -/* Local functions */ -local int gz_init OF((gz_statep)); -local int gz_comp OF((gz_statep, int)); -local int gz_zero OF((gz_statep, z_off64_t)); - -/* Initialize state for writing a gzip file. Mark initialization by setting - state->size to non-zero. Return -1 on failure or 0 on success. */ -local int gz_init(state) - gz_statep state; -{ - int ret; - z_streamp strm = &(state->strm); - - /* allocate input and output buffers */ -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - state->in = _fmalloc(state->want); - state->out = _fmalloc(state->want); -#else - state->in = malloc(state->want); - state->out = malloc(state->want); -#endif - if (state->in == NULL || state->out == NULL) { - fprintf(stderr,"Unable to malloc(%u x 2 = %lu)\n", - state->want, - (unsigned long)state->want * 2UL); -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - if (state->out != NULL) - _ffree(state->out); - if (state->in != NULL) - _ffree(state->in); -#else - if (state->out != NULL) - free(state->out); - if (state->in != NULL) - free(state->in); -#endif - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - - /* allocate deflate memory, set up for gzip compression */ - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; - ret = deflateInit2(strm, state->level, Z_DEFLATED, - 15 + 16, 8, state->strategy); - if (ret != Z_OK) { -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - _ffree(state->in); -#else - free(state->in); -#endif - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - - /* mark state as initialized */ - state->size = state->want; - - /* initialize write buffer */ - strm->avail_out = state->size; - strm->next_out = state->out; - state->next = strm->next_out; - return 0; -} - -/* Compress whatever is at avail_in and next_in and write to the output file. - Return -1 if there is an error writing to the output file, otherwise 0. - flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, - then the deflate() state is reset to start a new gzip stream. */ -local int gz_comp(state, flush) - gz_statep state; - int flush; -{ - int ret, got; - unsigned have; - z_streamp strm = &(state->strm); - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return -1; - - /* run deflate() on provided input until it produces no more output */ - ret = Z_OK; - do { - /* write out current buffer contents if full, or if flushing, but if - doing Z_FINISH then don't write until we get to Z_STREAM_END */ - if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && - (flush != Z_FINISH || ret == Z_STREAM_END))) { - have = (unsigned)(strm->next_out - state->next); -#if TARGET_MSDOS == 16 && defined(SMALL_MEDIUM) && defined(__WATCOMC__) - got = 0; - if (have && (_dos_write(state->fd, state->next, have, (unsigned*)(&got)) != 0 || - (unsigned)got != have)) { -#else - if (have && ((got = write(state->fd, state->next, have)) < 0 || - (unsigned)got != have)) { -#endif - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - if (strm->avail_out == 0) { - strm->avail_out = state->size; - strm->next_out = state->out; - } - state->next = strm->next_out; - } - - /* compress */ - have = strm->avail_out; - ret = deflate(strm, flush); - if (ret == Z_STREAM_ERROR) { - gz_error(state, Z_STREAM_ERROR, - "internal error: deflate stream corrupt"); - return -1; - } - have -= strm->avail_out; - } while (have); - - /* if that completed a deflate stream, allow another to start */ - if (flush == Z_FINISH) - deflateReset(strm); - - /* all done, no errors */ - return 0; -} - -/* Compress len zeros to output. Return -1 on error, 0 on success. */ -local int gz_zero(state, len) - gz_statep state; - z_off64_t len; -{ - int first; - unsigned n; - z_streamp strm = &(state->strm); - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - - /* compress len zeros (len guaranteed > 0) */ - first = 1; - while (len) { - n = GT_OFF(state->size) || (z_off64_t)state->size > len ? - (unsigned)len : state->size; - if (first) { - zmemzero(state->in, n); - first = 0; - } - strm->avail_in = n; - strm->next_in = state->in; - state->pos += n; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - len -= n; - } - return 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzwrite(file, buf, len) - gzFile file; - voidpcf buf; - unsigned len; -{ - unsigned put = len; - unsigned n; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids the flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); - return 0; - } - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* for small len, copy to input buffer, otherwise compress directly */ - if (len < state->size) { - /* copy to input buffer, compress when full */ - do { - if (strm->avail_in == 0) - strm->next_in = state->in; - n = state->size - strm->avail_in; - if (n > len) - n = len; - zmemcpy(strm->next_in + strm->avail_in, buf, n); - strm->avail_in += n; - state->pos += n; - buf = (char *)buf + n; - len -= n; - if (len && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - } while (len); - } - else { - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* directly compress user buffer to file */ - strm->avail_in = len; - strm->next_in = (voidp)buf; - state->pos += len; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - } - - /* input was all buffered or compressed (put will fit in int) */ - return (int)put; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned char buf[1]; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return -1; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* try writing to input buffer for speed (state->size == 0 if buffer not - initialized) */ - if (strm->avail_in < state->size) { - if (strm->avail_in == 0) - strm->next_in = state->in; - strm->next_in[strm->avail_in++] = c; - state->pos++; - return c; - } - - /* no room in buffer or not initialized, use gz_write() */ - buf[0] = c; - if (gzwrite(file, buf, 1) != 1) - return -1; - return c; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzputs(file, str) - gzFile file; - const char *str; -{ - int ret; - unsigned len; - - /* write string */ - len = (unsigned)strlen(str); - ret = gzwrite(file, str, len); - return ret == 0 && len != 0 ? -1 : ret; -} - -#ifdef STDC -#include <stdarg.h> - -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) -static unsigned char __gzprintf_buffer[1024]; -#endif - -/* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) -{ - int size, len; - gz_statep state; - z_streamp strm; - va_list va; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* make sure we have some buffer space */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* do the printf() into the input buffer, put length in len */ - size = (int)(state->size); - state->in[size - 1] = 0; - va_start(va, format); -#if TARGET_MSDOS == 16 && (defined(__SMALL__) || defined(__MEDIUM__)) - /* there is no vsprintf() that writes to a FAR pointer, so we have to vsprintf to a temp buffer */ - len = vsnprintf((char*)__gzprintf_buffer,sizeof(__gzprintf_buffer),format,va); - if (len != 0) _fmemcpy(state->in,__gzprintf_buffer,len); - va_end(va); -#else -# ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf(state->in, format, va); - va_end(va); - for (len = 0; len < size; len++) - if (state->in[len] == 0) break; -# else - len = vsprintf(state->in, format, va); - va_end(va); -# endif -# else -# ifdef HAS_vsnprintf_void - (void)vsnprintf(state->in, size, format, va); - va_end(va); - len = strlen(state->in); -# else - len = vsnprintf((char *)(state->in), size, format, va); - va_end(va); -# endif -# endif -#endif - - /* check that printf() results fit in buffer */ - if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) - return 0; - - /* update buffer and position, defer compression until needed */ - strm->avail_in = (unsigned)len; - strm->next_in = state->in; - state->pos += len; - return len; -} - -#else /* !STDC */ - -/* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - int size, len; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* make sure we have some buffer space */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* do the printf() into the input buffer, put length in len */ - size = (int)(state->size); - state->in[size - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < size; len++) - if (state->in[len] == 0) break; -# else - len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(state->in); -# else - len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#endif - - /* check that printf() results fit in buffer */ - if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) - return 0; - - /* update buffer and position, defer compression until needed */ - strm->avail_in = (unsigned)len; - strm->next_in = state->in; - state->pos += len; - return len; -} - -#endif - -/* -- see zlib.h -- */ -int ZEXPORT gzflush(file, flush) - gzFile file; - int flush; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* check flush parameter */ - if (flush < 0 || flush > Z_FINISH) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* compress remaining data with requested flush */ - gz_comp(state, flush); - return state->err; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzsetparams(file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* if no change is requested, then do nothing */ - if (level == state->level && strategy == state->strategy) - return Z_OK; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* change compression parameters for subsequent input */ - if (state->size) { - /* flush previous input with previous parameters before changing */ - if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) - return state->err; - deflateParams(strm, level, strategy); - } - state->level = level; - state->strategy = strategy; - return Z_OK; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzclose_w(file) - gzFile file; -{ - int ret = 0; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - /* check that we're writing */ - if (state->mode != GZ_WRITE) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - ret += gz_zero(state, state->skip); - } - - /* flush, free memory, and close file */ - ret += gz_comp(state, Z_FINISH); - (void)deflateEnd(&(state->strm)); -#if TARGET_MSDOS == 16 && defined(SMALL_MEDIUM) && defined(__WATCOMC__) - _ffree(state->out); - _ffree(state->in); -#else - free(state->out); - free(state->in); -#endif - gz_error(state, Z_OK, NULL); - free(state->path); - ret += close(state->fd); - free(state); - return ret ? Z_ERRNO : Z_OK; -} diff --git a/src/lib/dl/ext/zlib/infback.c b/src/lib/dl/ext/zlib/infback.c deleted file mode 100755 index af3a8c96..00000000 --- a/src/lib/dl/ext/zlib/infback.c +++ /dev/null @@ -1,632 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2009 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_streamp strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->dmax = 32768U; - state->wbits = windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->wnext = 0; - state->whave = 0; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_streamp strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - NEEDBITS(here.bits); - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - state->length = (unsigned)here.val; - - /* process literal */ - if (here.op == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)here.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd(strm) -z_streamp strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/src/lib/dl/ext/zlib/inffast.c b/src/lib/dl/ext/zlib/inffast.c deleted file mode 100755 index 2f1d60b4..00000000 --- a/src/lib/dl/ext/zlib/inffast.c +++ /dev/null @@ -1,340 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2008, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifndef ASMINF - -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ -#else -# define OFF 1 -# define PUP(a) *++(a) -#endif - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void ZLIB_INTERNAL inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ - unsigned char FAR *out; /* local strm->next_out */ - unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ - unsigned char FAR *end; /* while out < end, enough space available */ -#ifdef INFLATE_STRICT - unsigned dmax; /* maximum distance from zlib header */ -#endif - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned wnext; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ - unsigned long hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const FAR *lcode; /* local strm->lencode */ - code const FAR *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - code here; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char FAR *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; - last = in + (strm->avail_in - 5); - out = strm->next_out - OFF; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - 257); -#ifdef INFLATE_STRICT - dmax = state->dmax; -#endif - wsize = state->wsize; - whave = state->whave; - wnext = state->wnext; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - here = lcode[hold & lmask]; - dolen: - op = (unsigned)(here.bits); - hold >>= op; - bits -= op; - op = (unsigned)(here.op); - if (op == 0) { /* literal */ - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - PUP(out) = (unsigned char)(here.val); - } - else if (op & 16) { /* length base */ - len = (unsigned)(here.val); - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - len += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - } - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - here = dcode[hold & dmask]; - dodist: - op = (unsigned)(here.bits); - hold >>= op; - bits -= op; - op = (unsigned)(here.op); - if (op & 16) { /* distance base */ - dist = (unsigned)(here.val); - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - } - dist += (unsigned)hold & ((1U << op) - 1); -#ifdef INFLATE_STRICT - if (dist > dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - hold >>= op; - bits -= op; - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state->sane) { - strm->msg = - (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - if (len <= op - whave) { - do { - PUP(out) = 0; - } while (--len); - continue; - } - len -= op - whave; - do { - PUP(out) = 0; - } while (--op > whave); - if (op == 0) { - from = out - dist; - do { - PUP(out) = PUP(from); - } while (--len); - continue; - } -#endif - } - from = window - OFF; - if (wnext == 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = window - OFF; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - else { - from = out - dist; /* copy direct from output */ - do { /* minimum length is three */ - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } while (len > 2); - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - } - else if ((op & 64) == 0) { /* 2nd level distance code */ - here = dcode[here.val + (hold & ((1U << op) - 1))]; - goto dodist; - } - else { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - } - else if ((op & 64) == 0) { /* 2nd level length code */ - here = lcode[here.val + (hold & ((1U << op) - 1))]; - goto dolen; - } - else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - else { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (1U << bits) - 1; - - /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; - strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); - strm->avail_out = (unsigned)(out < end ? - 257 + (end - out) : 257 - (out - end)); - state->hold = hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and wnext == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ - -#endif /* !ASMINF */ diff --git a/src/lib/dl/ext/zlib/inffast.h b/src/lib/dl/ext/zlib/inffast.h deleted file mode 100755 index e5c1aa4c..00000000 --- a/src/lib/dl/ext/zlib/inffast.h +++ /dev/null @@ -1,11 +0,0 @@ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/src/lib/dl/ext/zlib/inffixed.h b/src/lib/dl/ext/zlib/inffixed.h deleted file mode 100755 index 75ed4b59..00000000 --- a/src/lib/dl/ext/zlib/inffixed.h +++ /dev/null @@ -1,94 +0,0 @@ - /* inffixed.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - - /* WARNING: this file should *not* be used by applications. It - is part of the implementation of the compression library and - is subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} - }; - - static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} - }; diff --git a/src/lib/dl/ext/zlib/inflate.c b/src/lib/dl/ext/zlib/inflate.c deleted file mode 100755 index 9208cef3..00000000 --- a/src/lib/dl/ext/zlib/inflate.c +++ /dev/null @@ -1,1480 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * Change history: - * - * 1.2.beta0 24 Nov 2002 - * - First version -- complete rewrite of inflate to simplify code, avoid - * creation of window when not needed, minimize use of window when it is - * needed, make inffast.c even faster, implement gzip decoding, and to - * improve code readability and style over the previous zlib inflate code - * - * 1.2.beta1 25 Nov 2002 - * - Use pointers for available input and output checking in inffast.c - * - Remove input and output counters in inffast.c - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 - * - Remove unnecessary second byte pull from length extra in inffast.c - * - Unroll direct copy to three copies per loop in inffast.c - * - * 1.2.beta2 4 Dec 2002 - * - Change external routine names to reduce potential conflicts - * - Correct filename to inffixed.h for fixed tables in inflate.c - * - Make hbuf[] unsigned char to match parameter type in inflate.c - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) - * to avoid negation problem on Alphas (64 bit) in inflate.c - * - * 1.2.beta3 22 Dec 2002 - * - Add comments on state->bits assertion in inffast.c - * - Add comments on op field in inftrees.h - * - Fix bug in reuse of allocated window after inflateReset() - * - Remove bit fields--back to byte structure for speed - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths - * - Change post-increments to pre-increments in inflate_fast(), PPC biased? - * - Add compile time option, POSTINC, to use post-increments instead (Intel?) - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used - * - Use local copies of stream next and avail values, as well as local bit - * buffer and bit count in inflate()--for speed when inflate_fast() not used - * - * 1.2.beta4 1 Jan 2003 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings - * - Move a comment on output buffer sizes from inffast.c to inflate.c - * - Add comments in inffast.c to introduce the inflate_fast() routine - * - Rearrange window copies in inflate_fast() for speed and simplification - * - Unroll last copy for window match in inflate_fast() - * - Use local copies of window variables in inflate_fast() for speed - * - Pull out common wnext == 0 case for speed in inflate_fast() - * - Make op and len in inflate_fast() unsigned for consistency - * - Add FAR to lcode and dcode declarations in inflate_fast() - * - Simplified bad distance check in inflate_fast() - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new - * source file infback.c to provide a call-back interface to inflate for - * programs like gzip and unzip -- uses window as output buffer to avoid - * window copying - * - * 1.2.beta5 1 Jan 2003 - * - Improved inflateBack() interface to allow the caller to provide initial - * input in strm. - * - Fixed stored blocks bug in inflateBack() - * - * 1.2.beta6 4 Jan 2003 - * - Added comments in inffast.c on effectiveness of POSTINC - * - Typecasting all around to reduce compiler warnings - * - Changed loops from while (1) or do {} while (1) to for (;;), again to - * make compilers happy - * - Changed type of window in inflateBackInit() to unsigned char * - * - * 1.2.beta7 27 Jan 2003 - * - Changed many types to unsigned or unsigned short to avoid warnings - * - Added inflateCopy() function - * - * 1.2.0 9 Mar 2003 - * - Changed inflateBack() interface to provide separate opaque descriptors - * for the in() and out() functions - * - Changed inflateBack() argument and in_func typedef to swap the length - * and buffer address return values for the input function - * - Check next_in and next_out for Z_NULL on entry to inflate() - * - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef MAKEFIXED -# ifndef BUILDFIXED -# define BUILDFIXED -# endif -#endif - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, unsigned out)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, - unsigned len)); - -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = Z_NULL; - strm->adler = 1; /* to support ill-conceived Java test suite */ - state->mode = HEAD; - state->last = 0; - state->havedict = 0; - state->dmax = 32768U; - state->head = Z_NULL; - state->wsize = 0; - state->whave = 0; - state->wnext = 0; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - state->sane = 1; - state->back = -1; - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int ZEXPORT inflateReset2(strm, windowBits) -z_streamp strm; -int windowBits; -{ - int wrap; - struct inflate_state FAR *state; - - /* get the state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 1; -#ifdef GUNZIP - if (windowBits < 48) - windowBits &= 15; -#endif - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) - return Z_STREAM_ERROR; - if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { - ZFREE(strm, state->window); - state->window = Z_NULL; - } - - /* update state and reset the rest of it */ - state->wrap = wrap; - state->wbits = (unsigned)windowBits; - return inflateReset(strm); -} - -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ - int ret; - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL) return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *) - ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->window = Z_NULL; - ret = inflateReset2(strm, windowBits); - if (ret != Z_OK) { - ZFREE(strm, state); - strm->state = Z_NULL; - } - return ret; -} - -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ - return inflateInit2_(strm, DEF_WBITS, version, stream_size); -} - -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (bits < 0) { - state->hold = 0; - state->bits = 0; - return Z_OK; - } - if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; - value &= (1L << bits) - 1; - state->hold += value << state->bits; - state->bits += bits; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -#ifdef MAKEFIXED -#include <stdio.h> - -/* - Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also - defines BUILDFIXED, so the tables are built on the fly. makefixed() writes - those tables to stdout, which would be piped to inffixed.h. A small program - can simply call makefixed to do this: - - void makefixed(void); - - int main(void) - { - makefixed(); - return 0; - } - - Then that can be linked with zlib built with MAKEFIXED defined and run: - - a.out > inffixed.h - */ -void makefixed() -{ - unsigned low, size; - struct inflate_state state; - - fixedtables(&state); - puts(" /* inffixed.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, - state.lencode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, - state.distcode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -local int updatewindow(strm, out) -z_streamp strm; -unsigned out; -{ - struct inflate_state FAR *state; - unsigned copy, dist; - - state = (struct inflate_state FAR *)strm->state; - - /* if it hasn't been done already, allocate space for the window */ - if (state->window == Z_NULL) { - state->window = (unsigned char FAR *) - ZALLOC(strm, 1U << state->wbits, - sizeof(unsigned char)); - if (state->window == Z_NULL) return 1; - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->wnext = 0; - state->whave = 0; - } - - /* copy state->wsize or less output bytes into the circular window */ - copy = out - strm->avail_out; - if (copy >= state->wsize) { - zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); - state->wnext = 0; - state->whave = state->wsize; - } - else { - dist = state->wsize - state->wnext; - if (dist > copy) dist = copy; - zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); - copy -= dist; - if (copy) { - zmemcpy(state->window, strm->next_out - copy, copy); - state->wnext = copy; - state->whave = state->wsize; - } - else { - state->wnext += dist; - if (state->wnext == state->wsize) state->wnext = 0; - if (state->whave < state->wsize) state->whave += dist; - } - } - return 0; -} - -/* Macros for inflate(): */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = crc32(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = crc32(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflate() - if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Reverse the bytes in a 32-bit value */ -#define REVERSE(q) \ - ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state FAR *)strm->state; - if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - state->check = crc32(0L, Z_NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - state->flags = 0; /* expect zlib header */ - if (state->head != Z_NULL) - state->head->done = -1; - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - strm->msg = (char *)"incorrect header check"; - state->mode = BAD; - break; - } - if (BITS(4) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - DROPBITS(4); - len = BITS(4) + 8; - if (state->wbits == 0) - state->wbits = len; - else if (len > state->wbits) { - strm->msg = (char *)"invalid window size"; - state->mode = BAD; - break; - } - state->dmax = 1U << len; - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - if (state->flags & 0xe000) { - strm->msg = (char *)"unknown header flags set"; - state->mode = BAD; - break; - } - if (state->head != Z_NULL) - state->head->text = (int)((hold >> 8) & 1); - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - case TIME: - NEEDBITS(32); - if (state->head != Z_NULL) - state->head->time = hold; - if (state->flags & 0x0200) CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - case OS: - NEEDBITS(16); - if (state->head != Z_NULL) { - state->head->xflags = (int)(hold & 0xff); - state->head->os = (int)(hold >> 8); - } - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (unsigned)(hold); - if (state->head != Z_NULL) - state->head->extra_len = (unsigned)hold; - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - } - else if (state->head != Z_NULL) - state->head->extra = Z_NULL; - state->mode = EXTRA; - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) copy = have; - if (copy) { - if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; - zmemcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); - } - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) goto inf_leave; - } - state->length = 0; - state->mode = NAME; - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->name != Z_NULL && - state->length < state->head->name_max) - state->head->name[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->name = Z_NULL; - state->length = 0; - state->mode = COMMENT; - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->comment != Z_NULL && - state->length < state->head->comm_max) - state->head->comment[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->comment = Z_NULL; - state->mode = HCRC; - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if (hold != (state->check & 0xffff)) { - strm->msg = (char *)"header crc mismatch"; - state->mode = BAD; - break; - } - INITBITS(); - } - if (state->head != Z_NULL) { - state->head->hcrc = (int)((state->flags >> 9) & 1); - state->head->done = 1; - } - strm->adler = state->check = crc32(0L, Z_NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = REVERSE(hold); - INITBITS(); - state->mode = DICT; - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = TYPE; - case TYPE: - if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; - case TYPEDO: - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN_; /* decode codes */ - if (flush == Z_TREES) { - DROPBITS(2); - goto inf_leave; - } - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - case STORED: - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - state->mode = COPY_; - if (flush == Z_TREES) goto inf_leave; - case COPY_: - state->mode = COPY; - case COPY: - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - case TABLE: - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - case LENLENS: - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - case CODELENS: - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - NEEDBITS(here.bits); - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN_; - if (flush == Z_TREES) goto inf_leave; - case LEN_: - state->mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); - if (state->mode == TYPE) - state->back = -1; - break; - } - state->back = 0; - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - state->length = (unsigned)here.val; - if ((int)(here.op) == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - state->mode = LIT; - break; - } - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->back = -1; - state->mode = TYPE; - break; - } - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - state->extra = (unsigned)(here.op) & 15; - state->mode = LENEXT; - case LENEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->was = state->length; - state->mode = DIST; - case DIST: - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)here.val; - state->extra = (unsigned)(here.op) & 15; - state->mode = DISTEXT; - case DISTEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } -#ifdef INFLATE_STRICT - if (state->offset > state->dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - case MATCH: - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->whave) { - if (state->sane) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - Trace((stderr, "inflate.c too far\n")); - copy -= state->whave; - if (copy > state->length) copy = state->length; - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = 0; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; -#endif - } - if (copy > state->wnext) { - copy -= state->wnext; - from = state->window + (state->wsize - copy); - } - else - from = state->window + (state->wnext - copy); - if (copy > state->length) copy = state->length; - } - else { /* copy from output */ - from = put - state->offset; - copy = state->length; - } - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = *from++; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; - case LIT: - if (left == 0) goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if (out) - strm->adler = state->check = - UPDATE(state->check, put - out, out); - out = left; - if (( -#ifdef GUNZIP - state->flags ? hold : -#endif - REVERSE(hold)) != state->check) { - strm->msg = (char *)"incorrect data check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { - strm->msg = (char *)"incorrect length check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - case DONE: - ret = Z_STREAM_END; - goto inf_leave; - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) - if (updatewindow(strm, out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if (state->wrap && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + - (state->mode == TYPE ? 128 : 0) + - (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->window != Z_NULL) ZFREE(strm, state->window); - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ - struct inflate_state FAR *state; - unsigned long id; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->wrap != 0 && state->mode != DICT) - return Z_STREAM_ERROR; - - /* check for correct dictionary id */ - if (state->mode == DICT) { - id = adler32(0L, Z_NULL, 0); - id = adler32(id, dictionary, dictLength); - if (id != state->check) - return Z_DATA_ERROR; - } - - /* copy dictionary to window */ - if (updatewindow(strm, strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - if (dictLength > state->wsize) { - zmemcpy(state->window, dictionary + dictLength - state->wsize, - state->wsize); - state->whave = state->wsize; - } - else { - zmemcpy(state->window + state->wsize - dictLength, dictionary, - dictLength); - state->whave = dictLength; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; -{ - struct inflate_state FAR *state; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; - - /* save header structure */ - state->head = head; - head->done = 0; - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -unsigned char FAR *buf; -unsigned len; -{ - unsigned got; - unsigned next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ - unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state FAR *state; - - /* check parameters */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* return no joy or set up to restart inflate() on a new block */ - if (state->have != 4) return Z_DATA_ERROR; - in = strm->total_in; out = strm->total_out; - inflateReset(strm); - strm->total_in = in; strm->total_out = out; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ - struct inflate_state FAR *state; - struct inflate_state FAR *copy; - unsigned char FAR *window; - unsigned wsize; - - /* check input */ - if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)source->state; - - /* allocate space */ - copy = (struct inflate_state FAR *) - ZALLOC(source, 1, sizeof(struct inflate_state)); - if (copy == Z_NULL) return Z_MEM_ERROR; - window = Z_NULL; - if (state->window != Z_NULL) { - window = (unsigned char FAR *) - ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == Z_NULL) { - ZFREE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - zmemcpy((unsigned char FAR*)dest,(const unsigned char FAR*)source, sizeof(z_stream)); - zmemcpy((unsigned char FAR*)copy,(const unsigned char FAR*)state, sizeof(struct inflate_state)); - if (state->lencode >= state->codes && - state->lencode <= state->codes + ENOUGH - 1) { - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - } - copy->next = copy->codes + (state->next - state->codes); - if (window != Z_NULL) { - wsize = 1U << state->wbits; - zmemcpy(window, state->window, wsize); - } - copy->window = window; - dest->state = (struct internal_state FAR *)copy; - return Z_OK; -} - -int ZEXPORT inflateUndermine(strm, subvert) -z_streamp strm; -int subvert; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - state->sane = !subvert; -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - return Z_OK; -#else - state->sane = 1; - return Z_DATA_ERROR; -#endif -} - -long ZEXPORT inflateMark(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; - state = (struct inflate_state FAR *)strm->state; - return ((long)(state->back) << 16) + - (state->mode == COPY ? state->length : - (state->mode == MATCH ? state->was - state->length : 0)); -} diff --git a/src/lib/dl/ext/zlib/inflate.h b/src/lib/dl/ext/zlib/inflate.h deleted file mode 100755 index 95f4986d..00000000 --- a/src/lib/dl/ext/zlib/inflate.h +++ /dev/null @@ -1,122 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2009 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY_, /* i/o: same as COPY below, but only first time in */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN_, /* i: same as LEN below, but only first time in */ - LEN, /* i: waiting for length/lit/eob code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to BAD or MEM on error -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) or (raw) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> - HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - (raw) -> TYPEDO - Read deflate blocks: - TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK - STORED -> COPY_ -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN_ - LEN_ -> LEN - Read deflate codes in fixed or dynamic block: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* state maintained between inflate() calls. Approximately 10K bytes. */ -struct inflate_state { - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - gz_headerp head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned wnext; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ - int sane; /* if false, allow invalid distance too far */ - int back; /* bits back of last unprocessed length/lit */ - unsigned was; /* initial length of match */ -}; diff --git a/src/lib/dl/ext/zlib/inftrees.c b/src/lib/dl/ext/zlib/inftrees.c deleted file mode 100755 index 11e9c52a..00000000 --- a/src/lib/dl/ext/zlib/inftrees.c +++ /dev/null @@ -1,330 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char inflate_copyright[] = - " inflate 1.2.5 Copyright 1995-2010 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code here; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195}; - static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0}; - static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) { /* no symbols to code at all */ - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)1; - here.val = (unsigned short)0; - *(*table)++ = here; /* make a table to force an error */ - *(*table)++ = here; - *bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - end = 19; - break; - case LENS: - base = lbase; - base -= 257; - extra = lext; - extra -= 257; - end = 256; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - here.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { - here.op = (unsigned char)0; - here.val = work[sym]; - } - else if ((int)(work[sym]) > end) { - here.op = (unsigned char)(extra[work[sym]]); - here.val = base[work[sym]]; - } - else { - here.op = (unsigned char)(32 + 64); /* end of block */ - here.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - next[(huff >> drop) + fill] = here; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* - Fill in rest of table for incomplete codes. This loop is similar to the - loop above in incrementing huff for table indices. It is assumed that - len is equal to curr + drop, so there is no loop needed to increment - through high index bits. When the current sub-table is filled, the loop - drops back to the root table to fill in any remaining entries there. - */ - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)(len - drop); - here.val = (unsigned short)0; - while (huff != 0) { - /* when done with sub-table, drop back to root table */ - if (drop != 0 && (huff & mask) != low) { - drop = 0; - len = root; - next = *table; - here.bits = (unsigned char)len; - } - - /* put invalid code marker in table */ - next[huff >> drop] = here; - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/src/lib/dl/ext/zlib/inftrees.h b/src/lib/dl/ext/zlib/inftrees.h deleted file mode 100755 index baa53a0b..00000000 --- a/src/lib/dl/ext/zlib/inftrees.h +++ /dev/null @@ -1,62 +0,0 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of the dynamic table. The maximum number of code structures is - 1444, which is the sum of 852 for literal/length codes and 592 for distance - codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that - program are the number of symbols, the initial root table size, and the - maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the - inflate_table() calls in inflate.c and infback.c. If the root table size is - changed, then these maximum sizes would be need to be recalculated and - updated. */ -#define ENOUGH_LENS 852 -#define ENOUGH_DISTS 592 -#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) - -/* Type of code to build for inflate_table() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/src/lib/dl/ext/zlib/minigzip.c b/src/lib/dl/ext/zlib/minigzip.c deleted file mode 100755 index 99161fb5..00000000 --- a/src/lib/dl/ext/zlib/minigzip.c +++ /dev/null @@ -1,440 +0,0 @@ -/* minigzip.c -- simulate gzip using the zlib compression library - * Copyright (C) 1995-2006, 2010 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * minigzip is a minimal implementation of the gzip utility. This is - * only an example of using zlib and isn't meant to replace the - * full-featured gzip. No attempt is made to deal with file systems - * limiting names to 14 or 8+3 characters, etc... Error checking is - * very limited. So use minigzip only for testing; use gzip for the - * real thing. On MSDOS, use only on file names without extension - * or in pipe mode. - */ - -/* @(#) $Id$ */ - -#include "zlib.h" -#include <stdio.h> - -#ifdef STDC -# include <string.h> -# include <stdlib.h> -#endif - -#ifdef USE_MMAP -# include <sys/types.h> -# include <sys/mman.h> -# include <sys/stat.h> -#endif - -#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) || defined(TARGET_MSDOS) -# include <fcntl.h> -# include <io.h> -# ifdef UNDER_CE -# include <stdlib.h> -# endif -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#ifdef VMS -# define unlink delete -# define GZ_SUFFIX "-gz" -#endif -#ifdef RISCOS -# define unlink remove -# define GZ_SUFFIX "-gz" -# define fileno(file) file->__file -#endif -#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fileno */ -#endif - -#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) -#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ - extern int unlink OF((const char *)); -#endif -#endif - -#if defined(UNDER_CE) -# include <windows.h> -# define perror(s) pwinerror(s) - -/* Map the Windows error number in ERROR to a locale-dependent error - message string and return a pointer to it. Typically, the values - for ERROR come from GetLastError. - - The string pointed to shall not be modified by the application, - but may be overwritten by a subsequent call to strwinerror - - The strwinerror function does not change the current setting - of GetLastError. */ - -static char *strwinerror (error) - DWORD error; -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -static void pwinerror (s) - const char *s; -{ - if (s && *s) - fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ())); - else - fprintf(stderr, "%s\n", strwinerror(GetLastError ())); -} - -#endif /* UNDER_CE */ - -#ifndef GZ_SUFFIX -# define GZ_SUFFIX ".gz" -#endif -#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) - -#define BUFLEN 16384 -#define MAX_NAME_LEN 1024 - -#ifdef MAXSEG_64K -# define local static - /* Needed for systems with limitation on stack size. */ -#else -# define local -#endif - -char *prog; - -void error OF((const char *msg)); -void gz_compress OF((FILE *in, gzFile out)); -#ifdef USE_MMAP -int gz_compress_mmap OF((FILE *in, gzFile out)); -#endif -void gz_uncompress OF((gzFile in, FILE *out)); -void file_compress OF((char *file, char *mode)); -void file_uncompress OF((char *file)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Display error message and exit - */ -void error(msg) - const char *msg; -{ - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - -/* =========================================================================== - * Compress input to output then close both files. - */ - -void gz_compress(in, out) - FILE *in; - gzFile out; -{ - local char buf[BUFLEN]; - int len; - int err; - -#ifdef USE_MMAP - /* Try first compressing with mmap. If mmap fails (minigzip used in a - * pipe), use the normal fread loop. - */ - if (gz_compress_mmap(in, out) == Z_OK) return; -#endif - for (;;) { - len = (int)fread(buf, 1, sizeof(buf), in); - if (ferror(in)) { - perror("fread"); - exit(1); - } - if (len == 0) break; - - if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); - } - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); -} - -#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */ - -/* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. - */ -int gz_compress_mmap(in, out) - FILE *in; - gzFile out; -{ - int len; - int err; - int ifd = fileno(in); - caddr_t buf; /* mmap'ed buffer for the entire input file */ - off_t buf_len; /* length of the input file */ - struct stat sb; - - /* Determine the size of the file, needed for mmap: */ - if (fstat(ifd, &sb) < 0) return Z_ERRNO; - buf_len = sb.st_size; - if (buf_len <= 0) return Z_ERRNO; - - /* Now do the actual mmap: */ - buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); - if (buf == (caddr_t)(-1)) return Z_ERRNO; - - /* Compress the whole file at once: */ - len = gzwrite(out, (char *)buf, (unsigned)buf_len); - - if (len != (int)buf_len) error(gzerror(out, &err)); - - munmap(buf, buf_len); - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); - return Z_OK; -} -#endif /* USE_MMAP */ - -/* =========================================================================== - * Uncompress input to output then close both files. - */ -void gz_uncompress(in, out) - gzFile in; - FILE *out; -{ - local char buf[BUFLEN]; - int len; - int err; - - for (;;) { - len = gzread(in, buf, sizeof(buf)); - if (len < 0) error (gzerror(in, &err)); - if (len == 0) break; - - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); - } - } - if (fclose(out)) error("failed fclose"); - - if (gzclose(in) != Z_OK) error("failed gzclose"); -} - - -/* =========================================================================== - * Compress the given file: create a corresponding .gz file and remove the - * original. - */ -void file_compress(file, mode) - char *file; - char *mode; -{ - local char outfile[MAX_NAME_LEN]; - FILE *in; - gzFile out; - - if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - - strcpy(outfile, file); - strcat(outfile, GZ_SUFFIX); - - in = fopen(file, "rb"); - if (in == NULL) { - perror(file); - exit(1); - } - out = gzopen(outfile, mode); - if (out == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); - } - gz_compress(in, out); - - unlink(file); -} - - -/* =========================================================================== - * Uncompress the given file and remove the original. - */ -void file_uncompress(file) - char *file; -{ - local char buf[MAX_NAME_LEN]; - char *infile, *outfile; - FILE *out; - gzFile in; - size_t len = strlen(file); - - if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - - strcpy(buf, file); - - if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { - infile = file; - outfile = buf; - outfile[len-3] = '\0'; - } else { - outfile = file; - infile = buf; - strcat(infile, GZ_SUFFIX); - } - in = gzopen(infile, "rb"); - if (in == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); - } - out = fopen(outfile, "wb"); - if (out == NULL) { - perror(file); - exit(1); - } - - gz_uncompress(in, out); - - unlink(infile); -} - - -/* =========================================================================== - * Usage: minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...] - * -c : write to standard output - * -d : decompress - * -f : compress with Z_FILTERED - * -h : compress with Z_HUFFMAN_ONLY - * -r : compress with Z_RLE - * -1 to -9 : compression level - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - int copyout = 0; - int uncompr = 0; - gzFile file; - char *bname, outmode[20]; - - strcpy(outmode, "wb6 "); - - prog = argv[0]; - bname = strrchr(argv[0], '/'); - if (bname) - bname++; - else - bname = argv[0]; - argc--, argv++; - - if (!strcmp(bname, "gunzip")) - uncompr = 1; - else if (!strcmp(bname, "zcat")) - copyout = uncompr = 1; - - while (argc > 0) { - if (strcmp(*argv, "-c") == 0) - copyout = 1; - else if (strcmp(*argv, "-d") == 0) - uncompr = 1; - else if (strcmp(*argv, "-f") == 0) - outmode[3] = 'f'; - else if (strcmp(*argv, "-h") == 0) - outmode[3] = 'h'; - else if (strcmp(*argv, "-r") == 0) - outmode[3] = 'R'; - else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && - (*argv)[2] == 0) - outmode[2] = (*argv)[1]; - else - break; - argc--, argv++; - } - if (outmode[3] == ' ') - outmode[3] = 0; - if (argc == 0) { - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - if (uncompr) { - file = gzdopen(fileno(stdin), "rb"); - if (file == NULL) error("can't gzdopen stdin"); - gz_uncompress(file, stdout); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - gz_compress(stdin, file); - } - } else { - if (copyout) { - SET_BINARY_MODE(stdout); - } - do { - if (uncompr) { - if (copyout) { - file = gzopen(*argv, "rb"); - if (file == NULL) - fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); - else - gz_uncompress(file, stdout); - } else { - file_uncompress(*argv); - } - } else { - if (copyout) { - FILE * in = fopen(*argv, "rb"); - - if (in == NULL) { - perror(*argv); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - - gz_compress(in, file); - } - - } else { - file_compress(*argv, outmode); - } - } - } while (argv++, --argc); - } - return 0; -} diff --git a/src/lib/dl/ext/zlib/trees.c b/src/lib/dl/ext/zlib/trees.c deleted file mode 100755 index 56e9bb1c..00000000 --- a/src/lib/dl/ext/zlib/trees.c +++ /dev/null @@ -1,1244 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2010 Jean-loup Gailly - * detect_data_type() function provided freely by Cosmin Truta, 2006 - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id$ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef DEBUG -# include <ctype.h> -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -#define Buf_size (8 * 2*sizeof(char)) -/* Number of bits used within bi_buf. (bi_buf might be implemented on - * more than 16 bits on some systems.) - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* GEN_TREES_H */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -local static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, ct_data *ltree, - ct_data *dtree)); -local int detect_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); -local void copy_block OF((deflate_state *s, charf *buf, unsigned len, - int header)); - -#ifdef GEN_TREES_H -local void gen_trees_header OF((void)); -#endif - -#ifndef DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (ush)value << s->bi_valid; - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= (ush)value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = value;\ - s->bi_buf |= (ush)val << s->bi_valid;\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (ush)(value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init() -{ -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ -#ifdef NO_INIT_GLOBAL_POINTERS - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; -#endif - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1<<extra_lbits[code]); n++) { - _length_code[length++] = (uch)code; - } - } - Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length-1] = (uch)code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1<<extra_dbits[code]); n++) { - _dist_code[dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Genererate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef DEBUG -# include <stdio.h> -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -void gen_trees_header() -{ - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, - "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void ZLIB_INTERNAL _tr_init(s) - deflate_state *s; -{ - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; - s->last_eob_len = 8; /* enough lookahead for inflate */ -#ifdef DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (bits + xbits); - if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); - } - if (overflow == 0) return; - - Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length-1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if ((unsigned) tree[m].Len != (unsigned) bits) { - Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - ush code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits-1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, - "inconsistent bit counts"); - Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); - - for (n = 0; n <= max_code; n++) { - int len = tree[n].Len; - if (len == 0) continue; - /* Now reverse the bits */ - tree[n].Code = bi_reverse(next_code[len]++, len); - - Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", - n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); - } -} - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -local void build_tree(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(s) - deflate_state *s; -{ - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*(max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ -#ifdef DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; -#endif - copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - * The current inflate code requires 9 bits of lookahead. If the - * last two codes for the previous block (real code plus EOB) were coded - * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - * the last real code. In this case we send two empty static blocks instead - * of one. (There are no problems if the previous block is stored or fixed.) - * To simplify the code, we assume the worst case of last real code encoded - * on one bit only. - */ -void ZLIB_INTERNAL _tr_align(s) - deflate_state *s; -{ - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); - /* Of the 10 bits for the empty block, we have already sent - * (10 - bi_valid) bits. The lookahead for the last real code (before - * the EOB of the previous block) was thus at least one plus the length - * of the EOB plus what we have just sent of the empty static block. - */ - if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; -#endif - bi_flush(s); - } - s->last_eob_len = 7; -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is binary or text */ - if (s->strm->data_type == Z_UNKNOWN) - s->strm->data_type = detect_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+last, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1)+last, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); -#ifdef DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); - s->last_eob_len = ltree[END_BLOCK].Len; -} - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local int detect_data_type(s) - deflate_state *s; -{ - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - unsigned long black_mask = 0xf3ffc07fUL; - int n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>= 1) - if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) - return Z_BINARY; - - /* Check for textual ("white-listed") bytes. */ - if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 - || s->dyn_ltree[13].Freq != 0) - return Z_TEXT; - for (n = 32; n < LITERALS; n++) - if (s->dyn_ltree[n].Freq != 0) - return Z_TEXT; - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -local void copy_block(s, buf, len, header) - deflate_state *s; - charf *buf; /* the input data */ - unsigned len; /* its length */ - int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - s->last_eob_len = 8; /* enough lookahead for inflate */ - - if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); -#ifdef DEBUG - s->bits_sent += 2*16; -#endif - } -#ifdef DEBUG - s->bits_sent += (ulg)len<<3; -#endif - while (len--) { - put_byte(s, *buf++); - } -} diff --git a/src/lib/dl/ext/zlib/trees.h b/src/lib/dl/ext/zlib/trees.h deleted file mode 100755 index d35639d8..00000000 --- a/src/lib/dl/ext/zlib/trees.h +++ /dev/null @@ -1,128 +0,0 @@ -/* header created automatically with -DGEN_TREES_H */ - -local const ct_data static_ltree[L_CODES+2] = { -{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, -{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, -{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, -{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, -{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, -{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, -{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, -{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, -{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, -{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, -{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, -{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, -{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, -{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, -{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, -{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, -{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, -{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, -{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, -{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, -{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, -{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, -{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, -{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, -{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, -{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, -{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, -{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, -{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, -{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, -{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, -{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, -{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, -{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, -{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, -{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, -{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, -{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, -{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, -{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, -{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, -{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, -{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, -{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, -{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, -{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, -{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, -{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, -{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, -{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, -{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, -{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, -{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, -{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, -{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, -{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, -{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, -{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} -}; - -local const ct_data static_dtree[D_CODES] = { -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} -}; - -const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 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, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 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, 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, 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, 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, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -local const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -local const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - diff --git a/src/lib/dl/ext/zlib/uncompr.c b/src/lib/dl/ext/zlib/uncompr.c deleted file mode 100755 index ad98be3a..00000000 --- a/src/lib/dl/ext/zlib/uncompr.c +++ /dev/null @@ -1,59 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} diff --git a/src/lib/dl/ext/zlib/zconf.h b/src/lib/dl/ext/zlib/zconf.h deleted file mode 100755 index c122cdd4..00000000 --- a/src/lib/dl/ext/zlib/zconf.h +++ /dev/null @@ -1,435 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2010 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - * Even better than compiling with -DZ_PREFIX would be to use configure to set - * this permanently in zconf.h using "./configure --zprefix". - */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ - -/* all linked symbols */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzgetc z_gzgetc -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# define gzprintf z_gzprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzwrite z_gzwrite -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetHeader z_inflateGetHeader -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# define uncompress z_uncompress -# define zError z_zError -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion - -/* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# define gzFile z_gzFile -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf - -/* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state - -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include <windows.h> - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#if defined(SMALL_MEDIUM) && defined(_MSC_VER) - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const FAR *voidpcf; - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const FAR *voidpcf; - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 1 /* was set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef STDC -# include <sys/types.h> /* for off_t */ -#endif - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include <unistd.h> /* for SEEK_* and off_t */ -# ifdef VMS -# include <unixio.h> /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -#endif - -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 -# define z_off64_t off64_t -#else -# define z_off64_t z_off_t -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") -#endif - -#if defined(__WATCOMC__) && TARGET_MSDOS == 16 && defined(__COMPACT__) -# define NO_GZCOMPRESS -# define NO_GZIP -#endif - -#endif /* ZCONF_H */ diff --git a/src/lib/dl/ext/zlib/zlib.h b/src/lib/dl/ext/zlib/zlib.h deleted file mode 100755 index 36aefb02..00000000 --- a/src/lib/dl/ext/zlib/zlib.h +++ /dev/null @@ -1,1613 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.5, April 19th, 2010 - - Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.5" -#define ZLIB_VERNUM 0x1250 -#define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 5 -#define ZLIB_VER_SUBREVISION 0 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed data. - This version of the library supports only one compression method (deflation) - but other algorithms will be added later and will have the same stream - interface. - - Compression can be done in a single step if the buffers are large enough, - or can be done by repeated calls of the compression function. In the latter - case, the application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip streams in memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never crash - even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has dropped - to zero. It must update next_out and avail_out when avail_out has dropped - to zero. The application must initialize zalloc, zfree and opaque before - calling the init function. All other fields are set by the compression - library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this if - the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers - returned by zalloc for objects of exactly 65536 bytes *must* have their - offset normalized to zero. The default allocation function provided by this - library ensures this (see zutil.c). To reduce memory requirements and avoid - any allocation of 64K objects, at the expense of compression ratio, compile - the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or progress - reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use in the decompressor (particularly - if the decompressor wants to decompress everything in a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -#define Z_TREES 6 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is not - compatible with the zlib.h header file used by the application. This check - is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). Some - output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 0), or after each call of deflate(). If deflate returns Z_OK and with - zero avail_out, it must be called again after making room in the output - buffer because there might be more output pending. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed code - block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the stream - are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least the - value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect the - compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, msg - may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the - exact value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit() does not process any header information -- that is deferred - until inflate() is called. -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing will - resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate returns Z_OK and with zero avail_out, it must be - called again after making room in the output buffer because there might be - more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all the uncompressed data. (The size - of the uncompressed data may have been saved by the compressor for this - purpose.) The next operation on this stream must be inflateEnd to deallocate - the decompression state. The use of Z_FINISH is never required, but can be - used to inform inflate that a faster approach may be used for the single - inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK or Z_TREES is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained, so applications that need that information should - instead use raw inflate, see inflateInit2() below, or inflateBack() and - perform their own processing of the gzip header and trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is - incompatible with the version assumed by the caller (ZLIB_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any call - of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. The - stream will keep the same compression level and any other attributes that - may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different strategy. - If the compression level is changed, the input available so far is - compressed with the old level (and may be flushed); the new level will take - effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to be - compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if - strm->avail_out was zero. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a - crc32 instead of an adler32. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called - immediately after inflateInit2() or inflateReset() and before any call of - inflate() to set the dictionary. The application must insure that the - dictionary that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been - found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the - success case, the application may save the current current value of total_in - which indicates where valid compressed data was found. In the error case, - the application may repeatedly call inflateSync, providing more input each - time, until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, - int windowBits)); -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL), or if - the windowBits parameter is invalid. -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above or -1 << 16 if the provided - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be - used to force inflate() to return immediately after header processing is - complete and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When any - of extra, name, or comment are not Z_NULL and the respective field is not - present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not be - allocated, or Z_VERSION_ERROR if the version of the library does not match - the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the normal - behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be Z_NULL only if in() returned an error. If - strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed buffer. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - - /* gzip file access functions */ - -/* - This library supports reading and writing files in gzip (.gz) format with - an interface similar to that of stdio, using the functions that start with - "gz". The gzip format is different from the zlib format. gzip is a gzip - wrapper, documented in RFC 1952, wrapped around a deflate stream. -*/ - -typedef voidp gzFile; /* opaque gzip file descriptor */ - -/* -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); - - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) Also "a" - can be used instead of "w" to request that the gzip stream that will be - written be appended to the file. "+" will result in an error, since reading - and writing to the same gzip file is not supported. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. -*/ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. - - The next call of gzclose on the returned gzFile will also close the file - descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ - -ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); -/* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Two buffers are allocated, either both of the specified size when - writing, or one of the specified size and the other twice that size when - reading. A larger buffer size of, for example, 64K or 128K bytes will - noticeably increase the speed of decompression (reading). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidpf buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. If - the input file was not in gzip format, gzread copies the given number of - bytes into the buffer. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream, or failing that, reading the rest - of the input file directly without decompression. The entire input file - will be read if gzread is called until it returns less than the requested - len. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. -*/ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpcf buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written, or 0 in case of error. The number of - uncompressed bytes written is limited to 8191, or one less than the buffer - size given to gzbuffer(). The caller should assure that this limit is not - exceeded. If it is exceeded, then gzprintf() will return an error (0) with - nothing written. In this case, there may also be a buffer overflow with - unpredictable consequences, which is possible only if zlib was compiled with - the insecure functions sprintf() or vsprintf() because the secure snprintf() - or vsnprintf() functions were not available. This can be determined using - zlibCompileFlags(). -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. - - gzgets returns buf which is a null-terminated string, or it returns NULL - for end-of-file or in case of error. If there was an error, the contents at - buf are indeterminate. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. gzputc - returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte or -1 - in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. - gzungetc() returns the character pushed, or -1 on failure. gzungetc() will - fail if c is -1, and may fail if a character has been pushed but not read - yet. If gzungetc is used immediately after gzopen or gzdopen, at least the - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. - - If the flush parameter is Z_FINISH, the remaining data is written and the - gzip stream is completed in the output. If gzwrite() is called again, a new - gzip stream will be started in the output. gzread() is able to read such - concatented gzip streams. - - gzflush should be called only when strictly necessary because it will - degrade compression if called too often. -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); - - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); - - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); - - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. - - If gzeof() returns true, then the read functions will return no more data, - unless the end-of-file indicator is reset by gzclearerr() and the input file - has grown since the previous end of file was detected. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns true (1) if file is being copied directly while reading, or false - (0) if file is a gzip stream being decompressed. This state can change from - false to true while reading the input file if the end of a gzip stream is - reached, but is followed by data that is not another gzip stream. - - If the input file is empty, gzdirect() will return true, since the input - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you - cannot call gzerror with file, since its structures have been deallocated. - gzclose must not be called more than once on the same file, just as free - must not be called more than once on the same allocation. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, or Z_OK on success. -*/ - -ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); -ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. - - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. - - Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -/* -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); - - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the for the crc. Pre- and post-conditioning (one's - complement) is performed within this function so it shouldn't be done by the - application. - - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -/* -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - -/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or - * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if - * both are true, the application gets the *64 functions, and the regular - * functions are changed to 64 bits) -- in case these are set on systems - * without large file support, _LFS64_LARGEFILE must also be true - */ -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); -#endif - -#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 -# define adler32_combine adler32_combine64 -# define crc32_combine crc32_combine64 -# ifdef _LARGEFILE64_SOURCE - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -# endif -#else - ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); -#endif - -/* hack for buggy compilers */ -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; -#endif - -/* undocumented functions */ -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); -ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/src/lib/dl/ext/zlib/zutil.c b/src/lib/dl/ext/zlib/zutil.c deleted file mode 100755 index d3971fc3..00000000 --- a/src/lib/dl/ext/zlib/zutil.c +++ /dev/null @@ -1,327 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -const char * const z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags() -{ - uLong flags; - - flags = 0; - switch ((int)(sizeof(uInt))) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch ((int)(sizeof(uLong))) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch ((int)(sizeof(voidpf))) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch ((int)(sizeof(z_off_t))) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef DEBUG - flags += 1 << 8; -#endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif -#ifdef FASTEST - flags += 1L << 21; -#endif -#ifdef STDC -# ifdef NO_vsnprintf - flags += 1L << 25; -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf - flags += 1L << 25; -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef DEBUG - -# ifndef verbose -# define verbose 0 -# endif -int ZLIB_INTERNAL z_verbose = verbose; - -void ZLIB_INTERNAL z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. - */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -Bytef* ZLIB_INTERNAL zmemchr OF((const Bytef* source, int c, uInt len)) { - while (len-- != 0UL) { - if (*source == (unsigned char)c) return (Bytef*)source; - source++; - } - - return NULL; -} - -void ZLIB_INTERNAL zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = *source++; /* ??? to be unrolled */ - } while (--len != 0); -} - -int ZLIB_INTERNAL zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ - uInt j; - - for (j = 0; j < len; j++) { - if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; - } - return 0; -} - -void ZLIB_INTERNAL zmemzero(dest, len) - Bytef* dest; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = 0; /* ??? to be unrolled */ - } while (--len != 0); -} -#endif - - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - voidpf buf = opaque; /* just to make some compilers happy */ - ulg bsize = (ulg)items*size; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ - int n; - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - ptr = opaque; /* just to make some compilers happy */ - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - return _halloc((long)items, size); -} - -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif - -voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - if (opaque) items += size - size; /* make compiler happy */ - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void ZLIB_INTERNAL zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - free(ptr); - if (opaque) return; /* make compiler happy */ -} - -#endif /* MY_ZCALLOC */ diff --git a/src/lib/dl/ext/zlib/zutil.h b/src/lib/dl/ext/zlib/zutil.h deleted file mode 100755 index 5c4ce231..00000000 --- a/src/lib/dl/ext/zlib/zutil.h +++ /dev/null @@ -1,277 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2010 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include "zlib.h" - -#ifdef STDC -# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) -# include <stddef.h> -# endif -# include <string.h> -# include <stdlib.h> -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include <alloc.h> -# endif -# else /* MSC or DJGPP */ -# include <malloc.h> -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -# ifdef M_I86 -# include <malloc.h> -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - -#if defined(__BORLANDC__) - #pragma warn -8004 - #pragma warn -8008 - #pragma warn -8066 -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS - /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 - /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) -# define vsnprintf _vsnprintf -# endif -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -#endif -#ifdef VMS -# define NO_vsnprintf -#endif - -#if defined(pyr) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemchr _fmemchr -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemchr memchr -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - Bytef* ZLIB_INTERNAL zmemchr OF((const Bytef* source, int c, uInt len)); - void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include <stdio.h> - extern int ZLIB_INTERNAL z_verbose; - extern void ZLIB_INTERNAL z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - -voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, - unsigned size)); -void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -#endif /* ZUTIL_H */ diff --git a/src/lib/dl/himemsys.c b/src/lib/dl/himemsys.c deleted file mode 100755 index 378e7617..00000000 --- a/src/lib/dl/himemsys.c +++ /dev/null @@ -1,672 +0,0 @@ -/* himemsys.c - * - * Support calls to use HIMEM.SYS - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * <insert LGPL legal text here> - */ - -/* HIMEM.SYS api for DOS programs library - * - * - * - * - * Testing: - * - * System/configuration Works? Supports >= 64MB? - * DOSBox 0.74 YES NO, BUGS - * DOSBox 0.74 + - * Microsoft Windows 3.0 - * Real mode YES -- - * Standard mode NO -- Reports 0KB free memory (why?) - * 386 Enhanced mode YES -- - * Microsoft Windows 3.1 - * Standard mode NO -- Reports 0KB free memory (why?) - * 386 Enhanced mode YES -- - * Microsoft Windows 3.11 - * Standard mode NO -- Reports 0KB free memory (why?) - * 386 Enhanced mode YES -- - * QEMU + - * Microsoft Windows 95 (4.00.950) - * Normal mode YES YES Allows my program to request more memory than available, then triggers the "needs MS-DOS mode" warning (PIF: XMS memory setting on "auto") - * Normal mode (PIF: XMS=2MB) YES YES This program's attempts to alloc > 1MB fail (correctly). It still triggers the "needs MS-DOS mode" dialog - * Safe mode YES YES Allows my program to request more memory than available, then triggers the "needs MS-DOS mode" warning (PIF: XMS memory setting on "auto") - * MS-DOS mode (official) YES YES - * MS-DOS mode (gui=0) YES YES - * * NOTE: I also noticed that within the DOS box the Windows kernel denies all requests to lock a handle - * Microsoft Windows 98 (4.10.1998) - * Normal mode YES YES Same problem as Windows 95 - * MS-DOS mode (gui=0) YES YES - * Microsoft Windows ME (4.90.3000) - * Normal mode YES YES Same problem as Windows 95, triggers "needs MS-DOS mode" warning----Hey wait, Windows ME doesn't have a "DOS mode". A hilarious oversight by Microsoft. - * Microsoft Windows 2000 Professional - * Normal mode YES NO NTVDM is very conservative about HIMEM.SYS allocation, listing the largest block size as 919KB. So apparently the default is that MS-DOS - * applications are allowed up to 1MB of extended memory? The usual MS-DOS configuration options are there, suggesting that in reality the - * program should have NO extended memory (?). Apparently when you say "none" what it really means is "1MB". Locking the handle is permitted though. - * The highest value you can enter in the PIF through the GUI is 65534. Setting to 65535 somehow triggers internally the "auto" setting, and is - * the highest value the editor will let you type in. - * Microsoft Windows XP Professional - * Normal mode YES NO Same problems as Windows 2000 - */ - -#include "src/lib/doslib/himemsys.h" - -#if !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) -/*===================================== MS-DOS only ===================================*/ - -unsigned long himem_sys_largest_free = 0; -unsigned long himem_sys_total_free = 0; -unsigned char himem_sys_present = 0; -unsigned int himem_sys_version = 0; -unsigned long himem_sys_entry = 0; -unsigned char himem_sys_flags = 0; - -#if TARGET_MSDOS == 32 -static void himem_sys_realmode_2F_call(struct dpmi_realmode_call *rc) { - __asm { - mov ax,0x0300 - mov bx,0x002F - xor cx,cx - mov edi,rc ; we trust Watcom has left ES == DS - int 0x31 ; call DPMI - } -} - -/* WARNING: If this code is run under DOS4/GW it will silently fail. - If the HIMEM.SYS test program spouts nonsense about a - HIMEM.SYS that is v0.00 and has some random amount of memory - open, that's why. Make sure you link with dos32a. If that's - not possible, then run your program with dos32 like this: - - dos32a <program> */ -static void himem_sys_realmode_entry_call(struct dpmi_realmode_call *rc) { - rc->ip = himem_sys_entry & 0xFFFF; - rc->cs = (himem_sys_entry >> 16UL); - - if (dpmi_no_0301h > 0) { - /* Fuck you DOS4/GW! */ - dpmi_alternate_rm_call(rc); - } - else { - __asm { - mov ax,0x0301 - xor bx,bx - xor cx,cx - mov edi,rc ; we trust Watcom has left ES == DS - int 0x31 ; call DPMI - } - } -} - -int probe_himem_sys() { - struct dpmi_realmode_call rc={0}; - union REGS regs; - - himem_sys_present = 0; - -#if TARGET_MSDOS == 32 - /* WAIT!!! We might be running under DOS4/GW. Make sure we can - call real-mode subroutines with the DPMI server. */ - if (dpmi_no_0301h < 0) probe_dpmi(); -#endif - - regs.w.ax = 0x4300; - int386(0x2F,®s,®s); - if (regs.h.al != 0x80) return 0; - himem_sys_present = 1; - - /* use the realmode DPMI call to ensure the DPMI server does not screw up (translate) the segment register */ - rc.eax = 0x4310; - himem_sys_realmode_2F_call(&rc); - himem_sys_entry = - ((unsigned long)rc.es << 16UL) | - ((unsigned long)rc.ebx & 0xFFFFUL); - - /* get version info, and autodetect whether it supports extended functions */ - rc.eax = 0; - himem_sys_realmode_entry_call(&rc); - himem_sys_version = rc.eax & 0xFFFF; - himem_sys_flags = (rc.edx & 1) ? HIMEM_F_HMA : 0; /* FIXME: Am I crazy, or does HIMEM.SYS suddenly stop mentioning HMA when we call from protected mode? */ - - rc.ebx = 0; - rc.eax = 0x8800; - himem_sys_realmode_entry_call(&rc); - himem_sys_flags = (rc.ebx & 0xFF == 0x80) ? 0 : HIMEM_F_4GB; - - return 1; -} - -int himem_sys_global_a20(int enable) { - struct dpmi_realmode_call rc={0}; - if (!himem_sys_present) return 0; - rc.eax = ((enable > 0) ? 3 : 4) << 8; - himem_sys_realmode_entry_call(&rc); - return rc.eax; -} - -int himem_sys_local_a20(int enable) { - struct dpmi_realmode_call rc={0}; - if (!himem_sys_present) return 0; - rc.eax = ((enable > 0) ? 5 : 6) << 8; - himem_sys_realmode_entry_call(&rc); - return rc.eax; -} - -int himem_sys_query_a20() { - struct dpmi_realmode_call rc={0}; - if (!himem_sys_present) return 0; - rc.eax = 7 << 8; - himem_sys_realmode_entry_call(&rc); - return rc.eax; -} - -/* NTS: This function will likely set largest & free variables to zero, - * because most 32-bit DOS extenders take up all extended memory to do their work */ -void himem_sys_update_free_memory_status() { - struct dpmi_realmode_call rc={0}; - if (!himem_sys_present) return; - - if (himem_sys_flags & HIMEM_F_4GB) { - rc.eax = 0x88 << 8; - himem_sys_realmode_entry_call(&rc); - himem_sys_largest_free = rc.eax; - himem_sys_total_free = rc.edx; - } - else { - rc.eax = 8 << 8; - himem_sys_realmode_entry_call(&rc); - himem_sys_largest_free = rc.eax & 0xFFFF; - himem_sys_total_free = rc.edx & 0xFFFF; - } -} - -int __cdecl himem_sys_alloc(unsigned long size/* in KB---not bytes*/) { - struct dpmi_realmode_call rc={0}; - int handle = -1; - - if (himem_sys_present) { - if (himem_sys_flags & HIMEM_F_4GB) { - rc.eax = 0x89 << 8; - rc.edx = size; - himem_sys_realmode_entry_call(&rc); - if ((rc.eax & 0xFFFF) == 1) handle = rc.edx & 0xFFFF; - } - else { - if (size >= 65535UL) return -1; - rc.eax = 9 << 8; - rc.edx = size & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - if ((rc.eax & 0xFFFF) == 1) handle = rc.edx & 0xFFFF; - } - } - - return handle; -} - -int himem_sys_free(int handle) { - struct dpmi_realmode_call rc={0}; - rc.eax = 10 << 8; - rc.edx = handle & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - return (int)(rc.eax & 0xFFFF); -} - -int himem_sys_move(unsigned int dst_handle,uint32_t dst_offset,unsigned int src_handle,uint32_t src_offset,uint32_t length) { - struct dpmi_realmode_call rc={0}; - unsigned char *tmp; - uint16_t tmpsel=0; - int retv = 0; - - if ((tmp = (unsigned char*)dpmi_alloc_dos(16,&tmpsel)) == NULL) - return 0; - - if (himem_sys_present) { - /* for src or dest references with handle == 0 the HIMEM.SYS driver actually - * takes SEG:OFFSET but we allow the caller to give us a physical memory addr. */ - if (src_handle == 0) - src_offset = ((src_offset << 12) & 0xFFFF0000UL) | (src_offset & 0xFUL); - if (dst_handle == 0) - dst_offset = ((dst_offset << 12) & 0xFFFF0000UL) | (dst_offset & 0xFUL); - - *((uint32_t*)(tmp+0x0)) = length; - *((uint16_t*)(tmp+0x4)) = src_handle; - *((uint32_t*)(tmp+0x6)) = src_offset; - *((uint16_t*)(tmp+0xA)) = dst_handle; - *((uint32_t*)(tmp+0xC)) = dst_offset; - { - const uint16_t ofsv = (uint16_t)tmp & 0xFUL; - const uint16_t segv = (uint16_t)((size_t)tmp >> 4UL); - rc.eax = 0x0B << 8; - rc.esi = ofsv; - rc.ds = segv; - rc.es = segv; - himem_sys_realmode_entry_call(&rc); - retv = rc.eax & 0xFFFF; - } - } - - dpmi_free_dos(tmpsel); - return retv; -} - -uint32_t himem_sys_lock(unsigned int handle) { - struct dpmi_realmode_call rc={0}; - uint32_t o = 0UL; - - if (himem_sys_present) { - rc.eax = 0x0C << 8; - rc.edx = handle & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - if (rc.eax & 1) o = ((rc.edx & 0xFFFF) << 16) | (rc.ebx & 0xFFFF); - } - - return o; -} - -int himem_sys_unlock(unsigned int handle) { - struct dpmi_realmode_call rc={0}; - int retv = 0; - - if (himem_sys_present) { - rc.eax = 0x0D << 8; - rc.edx = handle & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - retv = rc.eax & 0xFFFF; - } - - return retv; -} - -int himem_sys_realloc(unsigned int handle,unsigned long size/* in KB---not bytes*/) { - struct dpmi_realmode_call rc={0}; - int retv = 0; - - if (himem_sys_present) { - if (himem_sys_flags & HIMEM_F_4GB) { - rc.eax = 0x8F << 8; - rc.ebx = size; - rc.edx = handle & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - retv = rc.eax & 0xFFFF; - } - if (retv == 0) { - if (size >= 65535UL) return 0; - rc.eax = 0x0F << 8; - rc.ebx = size; - rc.edx = handle & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - retv = rc.eax & 0xFFFF; - } - } - - return retv; -} - -int himem_sys_get_handle_info(unsigned int handle,struct himem_block_info *b) { - struct dpmi_realmode_call rc={0}; - int retv = 0; - - if (himem_sys_present) { - if (himem_sys_flags & HIMEM_F_4GB) { - rc.eax = 0x8E << 8; - rc.edx = handle & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - b->block_length_kb = rc.edx; - b->lock_count = (rc.ebx >> 8) & 0xFF; - b->free_handles = rc.ebx & 0xFF; - retv = rc.eax & 0xFFFF; - } - if (retv == 0) { - rc.eax = 0x0E << 8; - rc.edx = handle & 0xFFFF; - himem_sys_realmode_entry_call(&rc); - b->block_length_kb = rc.edx & 0xFFFF; - b->lock_count = (rc.ebx >> 8) & 0xFF; - b->free_handles = rc.ebx & 0xFF; - retv = rc.eax & 0xFFFF; - } - } - - return retv; -} -#else /* 16-bit real mode */ -int probe_himem_sys() { - struct SREGS sregs; - union REGS regs; - - himem_sys_present = 0; - /* NTS: If this is an 8086, then there is no extended memory, and therefore no reason to call HIMEM.SYS */ - if (cpu_basic_level < 0) cpu_probe(); - if (cpu_basic_level < 2) return 0; - - regs.w.ax = 0x4300; - int86(0x2F,®s,®s); - if (regs.h.al != 0x80) return 0; - himem_sys_present = 1; - - regs.w.ax = 0x4310; - int86x(0x2F,®s,®s,&sregs); - himem_sys_entry = - ((unsigned long)sregs.es << 16UL) | - ((unsigned long)regs.w.bx); - - __asm { - xor ah,ah ; function 0x00 - call [himem_sys_entry] - mov himem_sys_version,ax - and dl,1 ; DX=1 if HMA present, else 0 if not. Your HIMEM.SYS is noncompliant if any other values were put here - mov himem_sys_flags,dl ; this maps to HIMEM_F_HMA - } - - /* does this HIMEM.SYS support the extended functions to address more than 64MB of memory? */ - __asm { - mov ah,0x88 ; function 0x88: query any free memory - mov bl,0x80 - call [himem_sys_entry] - cmp bl,0x80 ; BL=0x80 if error (unsupported) - jz label1 - or himem_sys_flags,2 ; <- HIMEM_F_4GB -label1: - } - - /* Unfortunately, there are HIMEM.SYS implementations that will respond to the extended commands, but fail - to read or make use of the upper 16 bits of the registers. These broken implementations are easy to check - for: just allocate a block that is 64MB in size (DX == 0 but EDX == 0x00010000) and if the allocation - succeeds, use the Get Block Info command to verify that it is in fact 64MB in size. The broken implementation - will create a zero-length block (which is legal in the HIMEM.SYS standard) and will say so when we ask. - - Known HIMEM.SYS broken emulation: - DOSBox 0.74: - - Responds to extended commands as if newer HIMEM.SYS but ignores upper 16 bits. You might as well - just call the original API functions you'll get just as far. DOSBox doesn't emulate more than 64MB - anyway. */ - if (himem_sys_flags & HIMEM_F_4GB) { - int h = himem_sys_alloc(0x10000UL); - if (h != -1) { - struct himem_block_info binf; - if (himem_sys_get_handle_info(h,&binf)) { - if (binf.block_length_kb == 0 || binf.block_length_kb == 1) { - /* Nope. Our 64MB allocation was mis-interpreted as a zero-length allocation request */ - himem_sys_flags &= ~HIMEM_F_4GB; - } - } - himem_sys_free(h); - } - } - - return 1; -} - -int himem_sys_global_a20(int enable) { - int retv=0; - - if (!himem_sys_present) return 0; - enable = (enable > 0) ? 3 : 4; - - __asm { - mov ah,byte ptr enable - call [himem_sys_entry] - mov retv,ax - } - - return retv; -} - -int himem_sys_local_a20(int enable) { - int retv=0; - - if (!himem_sys_present) return 0; - enable = (enable > 0) ? 5 : 6; - - __asm { - mov ah,byte ptr enable - call [himem_sys_entry] - mov retv,ax - } - - return retv; -} - -int himem_sys_query_a20() { - int retv=0; - - if (!himem_sys_present) return 0; - - __asm { - mov ah,7 - call [himem_sys_entry] - mov retv,ax - } - - return retv; -} - -void himem_sys_update_free_memory_status() { - if (!himem_sys_present) return; - - if (himem_sys_flags & HIMEM_F_4GB) { - __asm { - mov ah,0x88 - call [himem_sys_entry] - - mov word ptr himem_sys_largest_free,ax - db 0x66,0xC1,0xE8,0x10 ; shr eax,16 - mov word ptr himem_sys_largest_free+2,ax - - mov word ptr himem_sys_total_free,dx - db 0x66,0xC1,0xEA,0x10 ; shr edx,16 - mov word ptr himem_sys_total_free+2,dx - } - } - else { - __asm { - mov ah,8 - call [himem_sys_entry] - - mov word ptr himem_sys_largest_free,ax - mov word ptr himem_sys_largest_free+2,0 - - mov word ptr himem_sys_total_free,dx - mov word ptr himem_sys_total_free+2,0 - } - } -} - -/* WARNING: do not remove the __cdecl declaration, the hack below relies on it. - * Watcom's native register protocol will copy the long value to a 16-bit - * word on stack and then we won't get the full value. */ -int __cdecl himem_sys_alloc(unsigned long size/* in KB---not bytes*/) { - int handle = -1; - - if (himem_sys_present) { - if (himem_sys_flags & HIMEM_F_4GB) { - __asm { - mov ah,0x89 - db 0x66 - mov dx,word ptr size ; the 0x66 makes it 'mov edx,size' - call [himem_sys_entry] - test al,1 - jnz alloc_ok - xor dx,dx - dec dx -alloc_ok: mov handle,dx - } - } - if (handle == -1) { - if (size >= 65535UL) return -1; - - __asm { - mov ah,9 - mov dx,word ptr size - call [himem_sys_entry] - test al,1 - jnz alloc_ok - xor dx,dx - dec dx -alloc_ok: mov handle,dx - } - } - } - - return handle; -} - -int himem_sys_free(int handle) { - int retv = 0; - - if (himem_sys_present) { - __asm { - mov ah,10 - mov dx,handle - call [himem_sys_entry] - mov retv,ax - } - } - - return retv; -} - -int himem_sys_move(unsigned int dst_handle,uint32_t dst_offset,unsigned int src_handle,uint32_t src_offset,uint32_t length) { - unsigned char tmp[16]; /* struct */ - int retv = 0; - - if (himem_sys_present) { - /* for src or dest references with handle == 0 the HIMEM.SYS driver actually - * takes SEG:OFFSET but we allow the caller to give us a physical memory addr. */ - if (src_handle == 0) - src_offset = ((src_offset << 12) & 0xFFFF0000UL) | (src_offset & 0xFUL); - if (dst_handle == 0) - dst_offset = ((dst_offset << 12) & 0xFFFF0000UL) | (dst_offset & 0xFUL); - - *((uint32_t*)(tmp+0x0)) = length; - *((uint16_t*)(tmp+0x4)) = src_handle; - *((uint32_t*)(tmp+0x6)) = src_offset; - *((uint16_t*)(tmp+0xA)) = dst_handle; - *((uint32_t*)(tmp+0xC)) = dst_offset; - { - const void far *x = (void far*)tmp; - const uint16_t ofsv = FP_OFF(x); - const uint16_t segv = FP_SEG(x); - const uint16_t dsseg = 0; - __asm { - mov ax,ds - mov dsseg,ax - } - assert(segv == dsseg); - __asm { - mov ah,11 - mov si,ofsv - call [himem_sys_entry] - mov retv,ax - } - } - } - - return retv; -} - -uint32_t himem_sys_lock(unsigned int handle) { - uint32_t o = 0UL; - - if (himem_sys_present) { - __asm { - mov ah,12 - mov dx,handle - call [himem_sys_entry] - test al,1 - jnz lockend - xor bx,bx - mov dx,bx -lockend: mov word ptr o,bx - mov word ptr o+2,dx - } - } - - return o; -} - -int himem_sys_unlock(unsigned int handle) { - int retv = 0; - - if (himem_sys_present) { - __asm { - mov ah,13 - mov dx,handle - call [himem_sys_entry] - mov retv,ax - } - } - - return retv; -} - -int __cdecl himem_sys_realloc(unsigned int handle,unsigned long size/* in KB---not bytes*/) { - int retv = 0; - - if (himem_sys_present) { - if (himem_sys_flags & HIMEM_F_4GB) { - __asm { - mov ah,0x8F - db 0x66 - mov bx,word ptr size ; the 0x66 makes it 'mov ebx,size' - mov dx,handle - call [himem_sys_entry] - mov retv,ax - } - } - if (retv == 0) { - if (size >= 65535UL) return 0; - - __asm { - mov ah,15 - mov bx,word ptr size - mov dx,handle - call [himem_sys_entry] - mov retv,ax - } - } - } - - return retv; -} - -int himem_sys_get_handle_info(unsigned int handle,struct himem_block_info *b) { - int retv = 0; - - if (himem_sys_present) { - if (himem_sys_flags & HIMEM_F_4GB) { - __asm { - mov ah,0x8E - mov dx,handle - call [himem_sys_entry] - mov si,word ptr b - db 0x66 - mov word ptr [si],dx ; becomes dword ptr [esi] - mov byte ptr [si+4],bh ; lock count - mov byte ptr [si+5],bl ; free handles - mov retv,ax - } - } - if (retv == 0) { - __asm { - mov ah,14 - mov dx,handle - call [himem_sys_entry] - mov si,word ptr b - mov word ptr [si],dx - mov word ptr [si+2],0 - mov byte ptr [si+4],bh ; lock count - mov byte ptr [si+5],bl ; free handles - mov retv,ax - } - } - } - - return retv; -} -#endif - -#endif /* !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) */ - diff --git a/src/lib/dl/himemsys.h b/src/lib/dl/himemsys.h deleted file mode 100755 index 8053eacb..00000000 --- a/src/lib/dl/himemsys.h +++ /dev/null @@ -1,62 +0,0 @@ -/* himemsys.h - * - * Support calls to use HIMEM.SYS - * (C) 2009-2012 Jonathan Campbell. - * Hackipedia DOS library. - * - * This code is licensed under the LGPL. - * <insert LGPL legal text here> - */ - -#ifndef __HW_DOS_XMM_H -#define __HW_DOS_XMM_H - -#if !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) - -#include <stdlib.h> -#include <string.h> -#include <stdint.h> -#include <assert.h> -#include <stdio.h> -#include <conio.h> -#include <dos.h> - -//#include "src/lib/doslib/cpu.h" -#include "src/lib/doslib/dos.h" - -/* HMA memory is present */ -#define HIMEM_F_HMA (1 << 0) -/* HIMEM.SYS supports extended functions to address up to 4GB of RAM (surpassing the older API's 64MB limit) */ -#define HIMEM_F_4GB (1 << 1) - -extern unsigned char himem_sys_present; -extern unsigned int himem_sys_version; -extern unsigned long himem_sys_entry; -extern unsigned char himem_sys_flags; -extern unsigned long himem_sys_total_free; -extern unsigned long himem_sys_largest_free; - -#pragma pack(push,1) -struct himem_block_info { - uint32_t block_length_kb; - unsigned char lock_count; - unsigned char free_handles; -}; -#pragma pack(pop) - -int probe_himem_sys(); -int himem_sys_query_a20(); -int himem_sys_local_a20(int enable); -int himem_sys_global_a20(int enable); -void himem_sys_update_free_memory_status(); -int __cdecl himem_sys_alloc(unsigned long size/* in KB---not bytes*/); -int himem_sys_move(unsigned int dst_handle,uint32_t dst_offset,unsigned int src_handle,uint32_t src_offset,uint32_t length); -int __cdecl himem_sys_realloc(unsigned int handle,unsigned long size/* in KB---not bytes*/); -int himem_sys_get_handle_info(unsigned int handle,struct himem_block_info *b); -uint32_t himem_sys_lock(unsigned int handle); -int himem_sys_unlock(unsigned int handle); -int himem_sys_free(int handle); - -#endif /* !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) */ - -#endif /* __HW_DOS_EMM_H */ diff --git a/src/lib/mapread.c b/src/lib/mapread.c index 8d98c766..8a8d5d87 100755 --- a/src/lib/mapread.c +++ b/src/lib/mapread.c @@ -98,7 +98,7 @@ word dump(const char *js, jsmntok_t *t, size_t count, word indent, char *js_sv, bp = bitmapLoadPcx("data/ed.pcx"); // bp = bitmapLoadPcx("data/koishi^^.pcx"); map->tiles->btdata = &bp; - map->tiles->data = planar_buf_from_bitmap(&bp); +//---- map->tiles->data = planar_buf_from_bitmap(&bp); //map->tiles->data->data = malloc((16/**2*/)*16); //map->tiles->data->width = (16/**2*/); //map->tiles->data->height= 16; diff --git a/src/lib/modex16.h b/src/lib/modex16.h index e74aa483..a07121ab 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -27,7 +27,7 @@ #include "src/lib/16_head.h" #include "src/lib/bitmap.h" -#include "src/lib/planar.h" +//#include "src/lib/planar.h" //#include "src/lib/modex16/16planar.h" #include "src/lib/16text.h" #include "src/lib/modex16/16render.h" diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index 2b7b5232..a3402a02 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -28,7 +28,6 @@ #include "src/lib/modex16.h" #include "src/lib/16_in.h" #include "src/lib/bitmap.h" -#include "src/lib/planar.h" #include "src/lib/mapread.h" //map is loaded here www #include "src/lib/16_timer.h" #include "src/lib/wcpu/wcpu.h" diff --git a/src/pcxtest.c b/src/pcxtest.c index d73171e7..2f61443d 100755 --- a/src/pcxtest.c +++ b/src/pcxtest.c @@ -25,13 +25,13 @@ #include <string.h> #include "src/lib/modex16.h" #include "src/lib/bitmap.h" -#include "src/lib/planar.h" +//----#include "src/lib/planar.h" global_game_variables_t gvar; void main() { bitmap_t bmp; - planar_buf_t *p; +//---- planar_buf_t *p; int i; word start; int plane; @@ -62,7 +62,7 @@ void main() { bmp = bitmapLoadPcx("data/chikyuu.pcx"); // bmp = bitmapLoadPcx("data/koishi^^.pcx"); // bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); - p = planar_buf_from_bitmap(&bmp); +//---- p = planar_buf_from_bitmap(&bmp); VGAmodeX(1, 1, &gvar); gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); diff --git a/src/pcxtest2.c b/src/pcxtest2.c index c6706448..167e1f6a 100755 --- a/src/pcxtest2.c +++ b/src/pcxtest2.c @@ -25,7 +25,7 @@ #include <string.h> #include "src/lib/modex16.h" #include "src/lib/bitmap.h" -#include "src/lib/planar.h" +//----#include "src/lib/planar.h" global_game_variables_t gvar; @@ -56,7 +56,7 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) void main() { bitmap_t bmp; - planar_buf_t *p; +//---- planar_buf_t *p; int i; word start; int plane; @@ -87,7 +87,7 @@ void main() { bmp = bitmapLoadPcx("data/chikyuu.pcx"); // bmp = bitmapLoadPcx("data/koishi^^.pcx"); // bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); - p = planar_buf_from_bitmap(&bmp); +//---- p = planar_buf_from_bitmap(&bmp); VGAmodeX(1, 1, &gvar); gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); gvar.video.page[0].sw+=32; diff --git a/src/test2.c b/src/test2.c index 4fb6f173..722678a6 100755 --- a/src/test2.c +++ b/src/test2.c @@ -29,7 +29,7 @@ void main() { FILE *file; bitmap_t bmp; - planar_buf_t *p; +//---- planar_buf_t *p; word size; int i; int plane; diff --git a/test.smp b/test.smp deleted file mode 100755 index 7ac5708d447abc2a9ae3af33827a3093fe952728..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1841 zcmZvcQ7c4I6ot=B8IsA1Cr>x?Dn*S4@}MatVQ8YpNa~JKq!^-<c+eyb$sh3MQC`$Y zegq-OKky&iv%gWRj;Yyq&pvCfwa%Hl&*FHgFgqO;x3|{TH>%rFyjok0d>Snb4Gd*F zdtG<Rx!5^(^Ogkv=}HQ%kI&-F->>lL*L#w$f96`x<niw(=Q6IoJG#hXVWd*73=UUn z)t%Zvb-!xW9@i$VFa7>UoJl40*SF3!^2^EZMt;g7Ik9XNFnfkPvp8q<lEoQ|$5vmm zoCw2()lV!^nKX>%V^3ZkPIyqPTi2y9pjb2pcu=Q)YRIj7&qmjQRSqrU9B=Fk5A+gQ zT@ijTxPk#rDih|M`nhP~e8G6wi=GJ;+$tv(BIkw*{<EgVe*`m5IE~LcziZ;N<?j~1 zB)(eyA*<lQu&Q0k35HdT&43>s@XGKYNUbZLTqACY>Ou36?a{R0!7aJ6k>d&m#nXif zNHA1D>T1ZWy5P}Lwh)5~b#(<pSiu8P*}`0V)ooMW2f9=pr0x_RRSb7TMbDF*{{;qh z2pbrB%ks7}<J=Ft|3@}!%&E>YcN7?AhiPJ7m{59Q)2P#@_Z3sd>b$vvjT__2oG|aq zG9H*&FsN_?uopa#;}$$QvtP8^gD!F+ig@6b<0eEGEp+vkfRnS*Ghui5#}BLIFte}l ad^k^3KyKRkppw{k9j@K|e5ccWN&XAkehqv8 diff --git a/vrl2vrs b/vrl2vrs index acdd4bda2f0dd8772cdce97a19b6c906e4e09f8e..b67956b7baa37941b88ad79da1a2ff49c0c435a0 100755 GIT binary patch literal 17088 zcmeHPe{@vUoxhVz*f9;6fT*abuShB?34x*&1<kJq0TG6ffWL=HGVu*2nRMn2BwbnY z3;}0{>}FeR>DIP%wU%w&E^S?)UA89@1lncW)U_>VS1Z-jooUiG)u`;2I{W$D``+Zu z0M<Qc&+b2coSXZ;_xtmHzu$Y`y>H&-QGL}im&+yWt3VVALgPE#o<*q3ZdaH^LK7Y_ zS6nTw6jRVd+@fuuL6Hn#DngqZrI0wliyi|W<zm1r#8EbjyvU0(I8O)`@{2MHUxoYq zz@zk#;j130m-qsJCBT;e$C3ifLc6Ggr2#w*(9Kd0n8n8Veqpxly+Me*Uv+y}+JIxR z@oRwxc+N%nP%q|pgj(izv{iJ3x?(+*(QxHL#Y-GbUB0>*f0do&(NHLR1`2&cd_|(- zrY~%G=ZkkWJuzHc@||yfYR2!}?AI(5%8<U$3TES0w%zh(a@OD7`T8JX=XJmVOvn8_ zdGMw@_*5RuINBHaKW+o42|FD@crS{55x&9(P!s;AJor@ytl=JR&t9aTpM?~EPagc0 zJowf;_*fqN^*s1XdGNM8`1(A!CJ%1NgCER;Kb!|g^5A41{8_-;zTx&TAEt@R#fMO@ z`mzmsg+Ok#GN*19{uOKdQL`=7<&Q;!Z6az$TDyBiv^x^>TLaxI5S-+Jj--J`^;g z#CM>jGuRmon!@i7Mj~Bde@D1AV1~k7A`%R=iT3W8*(y4s!QjIrq`dalj&L+cZZjO~ zkXi!KU~6YLM6{Z{-9di~g#gh8iK2Z=BxFkRRs)b_3~d7kD$s-@U}ZO8eIR1`I|Csa zY9Su#40l-wzgWI%MQxpbVdY1&cMGz27~mM`_P@gHowM~^Yyn1E0Y;F^n#VXMd0iX| zP30*3HSXCqO~QrZj0KlT81gvya7|!dnS$UjRz(<;Zq$DQoQE|AY6)u$<}%g@<_y*t zv@=;_(9dH1Cm8#zJwnW3eUT7zSr-d2k2U01u`a<}$r={k!n#z5C9IJS)vRG~J?m+h z(^zBRtYVEx)yEnWOB3r$gt(jar9#}#`Z6IlvYv@?%=&U64AvO59jvbuVqJX9le!EY zdTi)77@NuX*-R$WH)s~6j=&4?qn`VQq(AIGnVZhSGnsM$ezs-G=^2B!>C<4%l+!~7 zap_?R(^Cdro*tAiJ!Zfnk=`$1dd|=Y@0Bn;Xv`%%AYppas3N>g!t|(d3*l}F)3Zi3 z;f)fehm8ipJ_*y)hL3Qygz0hPZo*X(rss`~gf$5>0tP#jE|V}LVRRD~5@tk<9>U}A zp`o0SF}4vtEn!B;c%1OCgc&JgfbgJ%88KrI;r$Y3<cz(9_ez)%H1-i5kT4@@>?gcU z!i=bKh;X-r8CheH@J0zU!o~^0J_$3@#xUV(zzcr$VB+WTk#S#Bqfv!<#~6It?OD6t z_-+Ev(fR1lMEijAUvk!*At!w3Pa&?N2Y=#crfj}~b_k@)wC2Pw;$t%mA~M7Aqh;TF zYiOX~{D?Tj7D@m7nS#WT=YM&PYxqZJ%qzbm8DBJ~OU5#v;(SqYlCl5rbtKugbUOry z*u|30lX?Uu9xGy-3o6<N4tbD{$+Er|V@0E%>fbDExo;|id>JV+9Rr(^@TG0w^=(?b z$z}M^|J2uhpUFV0)w~SNyV$%tr+E&VUt;rCM>9r_Z&Pt<6TCVpU^*!Ola%Wml)g=M zXfAmM%}a8cbu|0fT%OZR>OE{O&1s&G=9k(0E(R$*HPpXqjvK+ueEcjrw{GoYV~lg+ zpO5Pk^xbiNTvcPLN~!8)PI2iZ{wDR8`+crN^UM7+`iM)`xn09ak<d>i^;6yhVo8O! zuNri5{glgYG2cYLjgqe*&aqRe-~Ucpf(*Ef&81fJ8+LQdo9csq4oQ{wV%{Uw#TM0I zmg<@dS~8Y?4Th2HQj6=)KLFQw`dN$Xa*L}e%QfqQx>BRPRCJ}q^5GA_GBLVLW=?#} z4R;tCSbeE8icxhsh)Lf`QX@%z>?ElL35>d}(7Q_})7A-LPKj?#33zWgGC&EM1*-U1 zNhUUt^5Ox3`1cLQK5XUfRY;9>keqt?zhpoZOWFgvt>ePGy$3Tq`}T3!xA9b;(x1>z z#<!jnSuryqCQ30+IK})8#AIS8H!THr7qMFumThjdeV=Wus!cj#!uX-ob29ZSyA|1T z5`$%_(o29QkC5|vMRQy~jhKni)yd}5iDB2EYxw!og+<~;w<n>WNa`oN2dh2agTuJ% zZzzs$9TR3zQXd;FI#jR^lhIg7<656lh+D``ZI&XnxPIF8rNJM$J-6wnx9p?R*-$zQ zM5*WgQ~JqLnw}{~!|BlAT=ca_EG&Z3qe=ZJl+N}ZJdtcZdLE5y8-2zdmPWVIs8}@b z!9h5}XWVUJ-%#2tY<u6Jcl%$Uue7KD7PZo%*|tS5NjEem^_Sv<1<#*$Cys#6H5?yw zC-lLjJ_wsiyazEvc~?s7<Xy3J4)l7~(Xe()^}|vuT=5cyF#AK}Zqr}d@<mY6fCp0h zlx6}9=cBY{_ZjIQ>A|DQgWjG0#;Hzm6{jMTTqWSzPOb+nE~e?pRFw_6ji=#XqXtQs ziKS9Ksy(3}j&D6IdT&l$22n{Sw=cEC!X2^4Or!BvknBr6r4TBy%do<NgEuv768(LA ztou?!3V&RJ>l@cCka!E5i5*TwECPL`0S>kUU&z3pn{bDc`k`d=NWwP*H}Sz@8O^W5 zkp8}fQr&hX4ehdTv_m02_pWqYLVqs4^*Pado!yWACx~w}{z3NU$BIhzrWWhQ(W{dB zeyL>;&nMb@M3JD`rH@dL(BMObeJ-{89ZSvr_}2a6(IawZcrNvO#l*IARS!$m_c~P{ z$I{g~O1wLNgBU0Ekwjku%(chl?dNgPv)`dDN&VSm^^8OT4BX_ltUH{VVws_jxSi6s z96Cgv<4kZFze$dlRDa^&klI%{v{#=;`#wwiK4i3~UFk2#>fe!-R*<9rfYjek18DFh zL-QnqRL`ZO-TCNw)IXinpO$HXluf^Fg<@|~-;3v|jdEiYvb(7>6OsVf_@FB%#y?Z6 z$!4&QaEQASh_!RpisxGF%69Q7#R`YH>|FjHx|P&(C$T4!`jbrLfjOAij_X_>h*5u1 zhc0_=dD5C&_9XQ^@Mdv)qHi9$ub@&uTqi521W+X)I&Vt9B=a#>FU=Y=C9V&{15air zn&B;<l++v{6zfY}ZV~6ncu{!?9fAzZ+u2#?dZ`{6*@PQAD7WW#bhnidyOZ14)%=V! zv(i;YTGHPqBWou)WJ=ua(7rTZ`+%i=0R5hQPCCB(mP`P2O{Jr){M)&~olM7LlMGV# z{SMum@^$Y@>bvCJxlwT?^v9F><1!J^p3TC@n^qP+o}YzxE52ki_;Rz*Hgs36p_5s7 zRn|}h9U-cRp$xa!gqi+u>UO1*Ee(#T_&;n@IInFIGKDTyZI5jo$z+7se6_W(S%F8( zIOeTXp~A}<bM#_4-5pMqD)n*~(jPo?&wUT{2hI-3h5k%Q;z`}9`1*ZFVUKG#p-+sK zB=rfviRKBsJ;MEMx+j8peu69BV)HfYZmN0edlZEo@(j6%Sen6p-}{##xm3VX1oIA7 zVACb8e*o_mAPZBG4|Af&d!V{_`(SJ~Z{@mWFxl*hA5qVdC4cMoG^T2mVb)qb{Z$U$ z=84>ukN2RGMqP`K#Fm~z(0_MvRt1(u9xRQl2TsYl#<fNRH2G4-Zy9+_q0bQ^r!mi3 zUn(HUxT?gn$kXq$CAk}oN2DB05ybTgdsQ{z-O0y<GQkaZn5)(O6yDb+FX7^=zt;5> z>ulHHEUfB4nDiuylMU{~N_VoslUV6VHk2e*mLwa>5-ZF2RH>c8{FupH@}yoHSNZ$E zSs9l2Sea5K7hBoM3?Y^arL#%>EaHh6AlhdUgJN1V&0>**gR#;qSu?G@Qu;O--SNrU z(H1y{#ik|3+qXl`v}00%`G^(5(YAAZYbA-fEP2=1ImoQz5B*y9435A093qtgV=%RN zwAAVOEuTy$Ei0_fJxU8@mt(d?E$7OUiD~NRB4nzmE+W<DoI`+wfC4Q48hxo9%HkY* zcE|N`OajbzwZt6v?))Ye6Vk&Q)?*mWVi;?<hCJ%FM(3jvDwC7_QjB|yuS>GyOGC)K z+l#XBY`_?AoRpA4su_-%eOw;_r$~QE`eQ^b;^TvwT*t$K1<I<~96~o?no<P)d$`QE zP;!m$$qt>hjmAEi@)fe996Bo2nD{+-oQ7WHKH;$=lmL(T8dGz!F}wmJ-Cp$BBj=4@ z$q4gdZS6-!ygS!o<fzVI4}J-IWf?YL8I~A2RE#Ba;-`t9C7yrl%NPp=)vDp}uS#Tp zaN@oP{SR=WdTh+V2K$))F3LM7Z)2_DF<wDG==V=4`UFCVy;H1M&Y9_F<(Ax*+uyer z3pZbCi)F4FeEs?fU#d+tr9Fxv6B{!!hyXb7H20-$8naWlC_Pn@l-Q^)wY^hdqVGx2 zC*@z|(WzNr$+fYf^uCL*KJltHE{AgImuTk5B>hF^Pc6bR&!%gADW5VTp{KZcHm4-@ z6eoCF*^(Q)ee(7D)^~;Z(QRAbamA(~4Q2OcC?iK_qPZY8oz0dn?oh8_=+^UEMIXN^ zbLF?cw0&?90^mx&f>>qkGe#xNzvR#qq`wUsMk~EPOANOxxzXD<2M?P(g*4gQ_Xym+ zja~5C#&1wNvB`(jpJ~?9^HMxL--hDU3ra7NLZmyT&Uan!?`F6K6I4PUPd|lWC86ny z^>J^UZ;Dc19z_((vaa=hcaR%)??HjhWjTH*#5=)Qb?VXgrNRRfR99q$Eb*I;WVkVQ zO;R7nM4f0JPd>q{>0jwe^z+7hVEW@_7q)&o=lN{VtG#`9$Vb$8PA;H%DPGU#dDsHE zDCw6vG1vVvEyLQL(1+8-U}1)M`-Hqh6r8zov3k2PIh$nzaRmZVf}a{wOO!Mjh><CB zxc;F)$V6lyo?##)gvo6(7MCNoe>fIzLGgvD{?B5u<ovPt2DZQ-AQlg%tXTAMcbxvy zEEfk2URKH{q6~d@?%+`IZeI&Z6}aVD9**4W5EEbOWB*}|TyNi8puGqC1|gm=aj;)I z^Jq4T*CL8ljN)d+AftFSI2`juKy7`~ufnBD_m6R>`i9M&onf9$OMR&?Dlv(^J#tdy zUq11kmJEcL{!j1*xvNJ12u42*Z-N<_*huP;H|$BLH7Ui&6?MO4Lh@E94M^S-3Qb4N z^Y+zbRY*ro>d$5WwUQ3@@25+_Ld_d2%?0nT`CD1mlR27?%Xy6o-&eDlW&c5XH(03o zUQ6@izp(o}=X`x$oMk<czQ<y{-(tP%{aN2rXxZPZE!GDu*6HuhI+SHSnSR}R+q%(W z{VDb|@_nth?*vfiGkSZL{Rio%L8FrOuW^^n#$jvhA1QeLHN2;n%iPoSON*tZds598 zxD=B4pq`)?o-O%Ey)YJYsbfyAj#&>}W)Wu4-ys=4z^L7)?BaXO(^#*SriZK~HY~#r zzMl0@trW@h_#lQup#6lxZF~?fddIyx`uKz@ghMYp-`P*7S76$OsgUviuTQAY$td!X zmz~b+`NR2yYEbU8{aZZR&a4Pq&b{|Fd$cTcX2kgfWfZ9`s01%1<x^0uCK@r_7(Ec` zOI@ZEV%EbtF!k-Mf=jKI%j_2K_F)(=S1Wl7uBX&)?mP>wAE-S&7hIOO)X!xPya)8R zznAl4Wc$EC^M(bP_3Kj2u;{U&3jC0cZAP+VPF4T6O7NsfT?N+uxCgh_AAA12g1&dm z>-yy<Gs*fnw<PAxNz~8r;C2yecV_oLk}!VUwfNoGtMQ|=<idJ%>VWflYsmV|{B`v4 zv7vv&Pxx{ENRG(@JCXvizH!w;ynWXAnT8qEqDC-iYOUeU?odZCqRp+lURzkT;AU-Q zxGP{9fiA5s(AnJ*?C8LnS@<I1ha!PaZA+-5L*w@vT4$`o40U$|HHg*PAtI^;qFP%h z5^ObtZCXojt{zfAP<tfYshLJlt7~p-)K@oY8`d=5xnlKlt$szLUe~my@t(?Ju{qMQ zaC0Q8-52iW_aV^-iiM_C7~R?ue8my!dgyj7|Jo2T4N$bs)4C(U_E3-39*)@h+tAPz zj4Bze+7epQ73d7+OVK++rp-e<`qR~>t*DP`W>~A!40Jjep)X)d^ul7aWst9hyEG%b zg`BN1Q+C+tb!kiZePpbOnfM$Au3aZxTPzG=1UtF~e(X0|MOZ{(hG_13xGTJ+ON(v^ znXQI)U3v7nO078>)G8`ST%0B74ls1(aKXCPNT}PCGPSuC(d#v!z#u<>DHdDAvH*;4 zquKm~haR=`&!2BOK=C@<E7Pb_t7&dpqb=80>y0%{di^}DEv$8gO)c0KGK&Sc<sX%D zQE9}j(jZ`*j?v~?5Zrz}e0{A79!SfhehXC|YnH+SU7=3-{gBoXikjNoNmw!G@Dizk zQ=5MSa*)woS{~EHeVQnbR+q=-2R8@1Of=1J3w8v0B~H6xzSI*$7ElBI8E8RlZSS-} zE0bxS>`8gF5+gy>1-jU8IYc-zY@^|Pou3&=402cw8wV2c+)&fF8bjgMY}mD6PirvP z7S(QEbZ6~6tuxRoecBS#Vo_-c2HAp}D_W4Z^=sB4_2n3aCV{V<{QmN)MKR`yC0CA# z^60I$Nh|8%5G~L_Q+qWt@Gt@nflQMN@^D<_vVb^WzB3RPR1p!X^D-qwmPIs$!{}&N zuN*g#;6oh$A1<D3&Qi*l5Y-jjA|pCUqXMjjx-f#BIRfIIUa`dxJpvWRl#IG%h>($| zziL*mxT~gV#hTUHI!sBZZ`JIfwmHxd3&KT9=_S{dg|}@4J?2?4@b8(-BdG8ESthd= z_0_LtGJ~iWVFPpq^`ofyL++(`53mGv3+nq(AH};1?waTRCX;y<wT8|9Nz?<VJy>Dk z^C@|`KG7&#k9b^Hmbl%IlMb!?9<u~`2LX#x&$7~zmEI4T?jCW+6}R26aL#Pvt5KeM zC6oDA)S{-;(^pVCwW#2SFF=g^PIe=j*Td#Z*@^lRmsnm_R1g#O-ojYVl(NEt*dv9m z4?U0enxUE(>d2+^?m@i>+qOGVPs&{`<!Wf+D;z)YpP_BG-uif9;a|F57=jqu_A<(g z@XIRHS(<_dDTDa4DDMH^;*?SNpo;|afSZN(YWT6uiC?y}aECiyRJg%4RCBE6c#V{% zY+eOA6aG#!!EKuge^E@5ThP=2{3`r*8o<56*OZp*EUYUn+u^P$oe?iuU0PMpP&%V# zsI;u+SZPVk@lsFC3#INdknaQUHt-^3f4u(afj@fSf58KTkK-G76pF&|k_D@1A$GVu z_#9O%!nbVrY*c=WkIzK~=cX%I<Fh-?AB5k2FB9H{@9gm+L=437-7M<;fH?(VR+Do# z$1grll^55_XTZ;Kd<up0FFtJ*_*_-Y?Q?s0KNB^-4<{eb4$wgSRuDe59q&C*(^hOD z!cPLm?f>}VxdEGL8Tz^&r5$B6$_|uIqdbFh0Oc6UPf*@Kc?V_6PPgY$l#ig?jIs=6 zJxV*uW|SQ$pGJ8G<p9btl%Jryfnw`iURQUkHn%?562c~6QRU*wg%t~`u2**=4|z-F zqKXB?;YNtcXm6((XhDrnwq<SDcla<o80i+3SR4f_Yid_in1P2Z=%KDyWlJoCQwyOs zQAx-ML=92d*4qVnsx~7EvpE=v@{@5%W&wWSBEb&QtDEi)Q&fh!LilS2d+-+<fDlmO zwtyKBl|jQVR|tNi4V*TlIQ)S~B+#ok?E6ivAcOEgXQ&m5!w`r+l~Rk6*b<G3O6;UM zv52(2m|OF#30u?&7IpqZ!Rm=&Wbw>EA(*oY&n#9st6*lb%4G#JqlK_@t&lH&aWNNJ z7s~8ZIjdm&h=Gf_tYD4=T*w_(g>ppT+wUwaN1Qx!qwpMgYV0W(-}~Wez*tl;J`Bgj zvnvYbD8X3#nhkRV;j(hPP@c?CW0uW@aztTFW$|hSWRHnLYoziUctwv7%5ibbDwrcx zi0*IL@JtDB%ffQTkZt@^h#7<9)xO-~w;A@>*6+d$K#nSF9x4!1MJ3>k4!8!eJx>w8 z0kHfE7_|%B?Wj2?p#prd=ts@DjWFpy%bP5Ix?DT4i5KlTf|?)e2u;cR7r>+7=bDcE zFQT?D(!T=WrQL21*Ji}Oj{2G>+#asQ2u}b$@M*Vam4&~E?VoXbxXvP;>#DXrID2Hl zsInL3--w38&)WT&CKdyB`YTI}8`A5*+x_QBn)QI~c)AczKVZB6#76+z@pNJ4<$9Oj zgL9-zhkbiUZ(W>+znTYs#{p}={{*lGe{m#DFPJLE0NeSYiJ9VEz|0TgdG6&RC_3?3 zw}<OQ>bp`6QD6xRQIQAVkq7$#^V4$DmqGr9JbWk*{sdq?%Sb<6l!|S6_)h}nM+&xm zpU=bpJz%>()OR=!KkR@t=y(;dY1uceV5S&z;Mu>kfSu=lKBT53U{wFF%!4cQ;OacM z5ioy3w(Y+^58s;y@5+Nep9g;nFpmZVq&-uGe8DBHQ}(@-NB;)ld#76QxLl0p;dw@e zX9_8T@#e1yoX?cKUU3O;@KuP|sPf|)z?1R4T-*qlXB4=HB7YU>@$0+5FXGIn#e}Vk z{$1&SHNX!#VB$Xx*p|=uY<1vC{~5y8{5&1=_2(UU@_#)K7OfF8YR1~zD_ikiU}asS zf7Ob0O@2Riyxd?%@nH6woqim)!fP@d#yY3T?{5qHAL<CV1Umd}W;hb{2Vy;fZw@<x zc-L2X^TLlUhUD`Q`T68k&rv^~jS-yb;>#C*TdcFQ7c36Q&j)r6sr4EVR+~Y*i9`p2 z5%n4js-uS49R;e@fEj{sFRb@Ne!Sc4R1MtyOHk>NZyEg9!iVtG4&oSC)XbxUMavp% z?$Z7G>U#J`Im^D!v9C?|>+e}zbJvPGP&qL2SefuIU$v&TW|e=<vSsV^CVx{+?JAw( z<jJ$vXiU0Ao@eXquCBIEnpMH~fi@@XU(s}ze=<r<chxaQO?>wQX+5{xT#4g#{_a-4 zX~eo7u59TMT#u+DY}Tnbr#Sht&#zv;!2}3V2ko3R>M&eR3y<(Q8~j1J>QSfjCJ_tN z;l0U*DxvzR&gD7V@lMowwIiL--Rndmk(`}S$M$jwat`W&J{tDpg>@S`#MhQNw7CZr zc_z_`=IRtj3-g+Ad@!#CZ;YKSOf05P)Q;)oX+kHNbp+AbB#$UM8(=}JI@IWFb)*WD zOP#2kBv@b_rJQVmukoG|=HOMX<7j0Lft8!>-F{<>$c6wsSiV|0BhN$Hy;Darb40A% z>~FN@hq{hHG>Z9xukmo`Gl$HNOtr@lQ`nwUauZngOdj#fWp*6xoJ4#S6Wa&8xEI7D z9cvjpSFw)fd2jC1?29;F*P?K>OgecU8wd^e_GM3_3(#QGah+~}ZjMca+NP_=J-*cr zQy$mvyDU1jVpnveU5&!mZKUH~bU)}$qi`jUO3LG^c|8grRixwIbpQbOtoCK!^4u@? zouuPF;7KT1f_qyp+gTn);Xal3+#j3*T{Z5VdI5@0pm3K!I_`C6LJ;k-<*^TZSjJIE zSBt{^1iw$<o|$x9L)&z_a8Fz1PKD1c+|c*-MLJ$PQEWQyKdL}CXm=7g+CbV*I_UV^ z9!GF$uR^1BsU3$9djQ+=xV~CcKKVYCq_$rEAWb^<m(TqM(A~{WSeH%r3}Bm1p3lD_ z_YAsC_nd={`yTg=ST8&JVbgsVblg2L#&Z2zHE9!@Y`X8`p1Ug2aUJcx0Nqc3ryA06 zJ?^;x-M<6RSdfnEaQ=S<DXR@tHf|%hx8-raHE|w!v@z|V<GTF}=z7p*U!-Aq6UCOt z^=dZ;mRxjMgrwnh28HdkkL&Ut&~4i{Nm-3{UcX17JgAcw=@wh}tcYWohC*5P^$pNX oA;P-sTh`10`#Q7`;|`8uYTblF`^r$5^G<mUP|Cw9_GQcaZ|c!QZ2$lO literal 19944 zcmc&+dw5jUwckkyh5(tUU{O(zNEC#GrztP%1Tt_!c@+q@wsbNi6Eil+#Cbqsiw46e z(=ke0wX~mA+OH4Ve(g=Y6}a>o2C)R&-rh*5a;?_fw%Qq^HojA<=Kj{&d(WIRnNj-3 z{kmah@Acekuf6s<`|LR<x4G7=%+Jdcy5x&b2!iUyI~gUvg=kvIpu#N@MZzgA6&H)K zz!c)+WD3=?rR%s-t?MGiSAcp9weuAs-zgiao+=@sYi%Lb)L*(dRa4gAT_8bS3t=#V z<jB?oihf{09piO9r0m%DV{M_qbV8F{T*<|ioUZ$oVY=4RG&cH7ReGo9I{^{wq)Jrt zce-X@0Jq_VPy@B==1GRSc}{NVx>=%yuC?5!AV+qdZ7EfZbDDkIDi_XaZYXc|wT9cv z+ZR=qS1zmw`YYzM{lrH@T(z#2CA2>bK-Bjnd}uC-J}124vcFF1uKCpK9e<cUxoKqE z-x^*Zewst=e{QH*C;Z~qV^rlVH-mCs7V6?0`0+XLPvpRVH3xoM4*aYf_<cF><h5+} z&(DFc&w*c`1HU>4{!k8lSq}UUa^N4zfj4sC`++A~X89}-+5B*E4*W$q@V*>)(w$BJ zS90Kgngjo(9QZE-f3CPt#4GF263Bn5VExq7a;X%-P@ul8Lj>CbzSdBqX!N&vTScSS zkLHcuP>|@&z_fT<g5HpDyS;%xtKZ%1ulIy}{#Ft2dKyGyTR2oNnuA{N7l@JcHP$!# zgI<yj`NPfJizn!<Z)t;y`cOxk*S(FDfY1PqqH#yS7h?AMCP2y<vJDcbz~c`<l<al~ zL!Lm$-Qw|)p^9*0i@#M7++x+5n&m6p^D7plTJsjBn)55JffMr2;veM*E8mz@+Rp=p za)ZuC=lgsUDYHDUaQA-Yex$VmkyLQ_BHuXb^G(21_FhxRHRZnZxh22!JkhnnnqYbq z|2e=@zq%Z@;8n_IQrv>4Jg3V^3ts17qV-$w*6Y+63*MTi2P}B9Ntc8LpNcgQhb(wF zB2|Vh_~H~64Hd7Xn{uNrMHc)7jYM5)!DAv)Wr_t~lEPxGTksAGeuf3F=a$HGE%<XS z{EIAj>pFH?@YeY?EqJ;H>9WCspRAFnKW)KZV8Pc}@E^0_n=JS#7JQopf1w56ZoyOT z(xuaar(CCt+4XXf87rJP+Yn|X9x6<%Ks1_Nj~5-+9I_s{=G|F_7%6)X-;T?iXc62* z#N@yTO4;iKQz$3<8Geai3gKj&;Xe^fp_}Ys_!)vJWRv?DK1DEvYH}~bzap4IG}+1U zV+2$9B-<E1LNJA7vX0@038qj?ZeaLF1Q!$RWcWJ-Q|Kk<GW<<~Ddds{!(SzsLM>U! z@Rtdu5K9V%Zzq^SD>?K55M{RzOd*vVU^qZ9g;KJg;hPAi5K6`w-bOHmPO^vL8wjS5 zN$zKOBf*mi-plZ6f+<9joeVE0m_j4j#_$q?DI}7049_Q+LLs?<;j0Oz5J)-!&wHgN z`sC-$=%384zYJ~IT+<itpXC&0-?2Kb`syY+MdBSWzS-!wtXhb}4<TS`&GLPy%&y@Q zGy1~ziw{E^hsn8Hj}l>I0L;4yDYhPOq*9^bUZU5UyIy4l$37^40y8>f9!p$j=AAH~ z{2(+rrER>{=D3XXaQ~gx{_JW)i14|!5KOef;ag7>J_uCa8^<aBjvih>hFvGZg@a#% zTuRw%BrwvyHF*nUsEz1$L(YsIJ3^baUJB8p35+^%7{dj%N>Nv)s554R`b|l_LQ$uu zsBJ|3lB5<g^~BL)P!s#!XML~Dl)cg1%iiuIiPci#cZ#|qMLj^&*^>H*qPkMlA)=N@ z>eolfE-D9gNcP*IsB==XokTqa>el1ziCr%{G5YAEzae$eN8(iVxrV`yNN^3QI-%+T zs{34gN0EFSf-zTr_lCS^ZNItC?4I;XW{X8wOJ2VjgNt1!&6w+?<Dghp?ugt35wpv6 zGB1S-4N<eV2WFYkzQlp|Mn;fxCNuJ3h5Q;L!;^SI6H8&@VVbez)8nCyqz@^^n<V4R zv#=_WEF@b<`iPRAefH8r$vzms(vK?XSN}nlhtH<(fn-!mA63#lQu@lXuzYxM9U}Ch zs|@sCd$RYW)F6G+0X5P$zd-nbtzEMvt!x`pZ1;i<eJ+jA{5$R{r|Iw7IV?iwpc)X` z=Y4RE)LYMbUBfh4?>L0OkY}KuQtAiG=@JY~2KYbFVZxW{XcozJ?Hm%0-7nz^0M`xm zURdGeNk1Q42$aL19~P|c*p*V<l$5%Q!JD`!rS92rtm82Cd2Nbm5iz~>F0{p<4J5jj zNOQIm=@}-~4imZei?Vm=IA=;oE!^k-p4O5c)LznZFL?W0r=eO5x?{Dc&1k=w7dH{_ z#|8?_Lg)2$6!tynq{nf{S>!lGE1<{h-cXDICPZi~z{FtT;h&NLv7Lvjq9@JhlV<d> z-hTr|+S7yXyIiO9Vuf$J46)R8ddK}_G>vImYD_1|nz3nXk~O>{Pn*8@j3W4_(0PbW zIRMcEFl8E>QhVT|%ot3WF;jYhgbl|bENJ*`%p8~<?UQyESr{54amVf-z&dRyUFoIw z9gs<U4!nJ?$AJ`s+hVTA&8~PpTs8(HCj-fWU2#CJ{Q&o)%L$G{G*#3raU7yVLCs=0 z3Sxrm{$3Rw>OIeDQh1nL_c)~(Wp{k3>+v0T6TcZfada#CPY5tcgf&QJk(rOMJh}e1 zYIeQj&I7b8lsMv8B#ynK5yy^9078y(E{ShXY3@rbk!%A;zKe<Jt)jTsj&p!5>UyAS z=L4c+VdBZRM@C`-OUfi^@<(Cs6^7`&);h2UpiM5qKaPc_?#K|#I$~1y`0z>^2bMm@ zZ`rtMp4r_^EHT#u%w<M@iyrPrSIF#VNKQp@auUT&u0Y<4k)Poy+8f<43BX<s<?hG; zbobt1weThyuO!GJE4yT@Oa(RSx~psFU83V^jPTiM21aootMORX{5wpP1APmdzrjmm zu03XbKZemOK3+#&I`tNfY7eeCd9E`t*Ih@1K~9jwYaktU?djUNN8I*H5W$}h6v5oB z*V65mtlch4b$ctim8-9Pxe9^jWC)yzMuySS%iopLYn?~P9C)iU=A0DGr#awcq>L=Z z2yh`hGe&lEuIy$<&tam|wT05MUF5kpl?cyA<UNZSYjc?qX~&L7S;B3spQ1)-4zEsS z&Mu`pUz&4!mCQK@*qlbPhpe$mtk)9K8rl!*Xu6x&b3{{wHtJ?fR$cL8x{ORGRnbV3 zq;Q2jg^lUNQ8F~~E8>hvPOw-aBK`(Z?vpwY+?-4DkW0?U5%oCLJl3NZ`=}86so3ct zHJFw>Jr=qVkGV24YNU>BmCJ&G=-%nbxP7iTl!?JF#$0h*c9Q}+!9_kThe{PCw8m(p zpTmm@l<j~yZNp3e<`iMNyNQ)%133U|o|g3S*QM2CyIgVd8(9Y}$k@nyamSssRmQR; zL6%CTi)TnMo5q{d8YvNOzfO7YH8u+4j*Nj$y$TQlqdY`6TsrWm9qS|qja~@nsGih9 zm>_%F@skf(2&Z3@!yO|-ugGG_sw|e67E7oN&rHj*1a4JY)e`9Xgj@nYwFirJ39Qi) z(vAsfJCdE4n=Ga{!GihW3iCFL6htG7B$g`~_>w^d{qKn@Cb{fE|LY;5+$ZI;1pU!# z)wJD=9_-_=2K{bQLqRXc@urF|3_)I4VClDsCEL}+WE0jR2|sXz1Y|%42)k?NnUN78 zwwEE*zcv-A9($J>(n)<E-H*(hSdF1^q91fX0s8q21o>j|guFZHdf70eI}<Q0L7C#+ zzmXXmFlfM7O;OkIpaZ}#Bcrv$Ctv}AOI?Y;1=OPZj^fa>x;ZiQq+N5Y@cw0nxOSvK z2**A5!ZL6s5Ftg_%!DUl{|svPUivwK2#wJVMa*!}S-d+QzDhG=p<yqcFuPY5V;48X z7nT2(7rpB-qCVGq<eTKL@fE9m&m6s9bR1HOsprLyh1X?gGrP^=bf2^xL!WIx74E&* z5H-=0w2gedSIl+7+iHi_NIqjmvp9!V&cnYY2QPk=Z(=T&0@$#|3M-+xcac@&Bxvk% zy@$MT!%_;c_Z)X#$sx?18w1aU)+#H<65xy#&I2Q2H#&I+8n~9*UC_Ok_snEutjLU_ zR}<B0xY}82Mwge8vLjRAyj0@49CoUSRN<lWoh|FiAd!1Y+DK9~VA>{flkzT%J6~C9 z@XF&UHq@=L3O;o=oDA`$U^r(Fv_Bn!8Kl+`c>v}zg1U6<?gpsBU@(+@8dTJUK4r$% z4rOOS-?(D(Ox^Yh&(!qnj4Gan5U|CA4mnvrS<I8QV^{L~+BRkE?)x-?jg8!4F*cB+ z16~244LPVXoTWDq&NH*KVbxMN51G-YDEOWo)Nz%sOzrA&4O3R46)CS~!;U-Kk)P~~ zm^etm%Y5h|+e;{m6+XI%7B`0DxMzNPaT_#4yDv{8rU5~#{cf;hwJQRgH%%|ypFu~= z^`5@7>WUlk?h201R|Za_g}cnc)ZN4PU($Sa?}Z32{L9B^tq%1zSr^q&44xIy6ojg% zNlx>f;ybxrkI7rP6K3@3#Jw-^)L+6WCsueL)Y%tkFy+Yq__$i2bVZ33{uCfD!|$Pi z-Ltw+#QHl_#|aMiM~C@bB>FVc^&95*$c`gqLTc%KAH6I0?|OMZ-PK1QZNhH$glj~c zaD9N!`<Su_p?be1N0^vTgNtHf=>9ic%$YHHGo9XaM>=s=VDF(CJ(%6D9{ZB705<s) zpFU8gjdW56BQ#Z*c@K$T4hxfKh(l6|aFFg#H5h59U3ZKtP6eToG_>prNN<Pq;CTv( z)rK8phR`x2G++@L7doY&-YaMkp-XQPokU#&80-L@qr_YTd|A@nF1y+h*$dvzog*St z-nsLGyl{z$;qo|O?%-tL^1}`?o9?He(t*Gx|K>ET_aWu!CUg!zjKfUiB@c{)MRK^k zKUNH@(hT{@JHbG6mb^91NmtBSj>zq}B988ktaU_w1h2F86SUnw9H#L4<TdJ2dMmDs zh3`)?;E!WRF2GpjHUAOVkk|qP5F;X4!JUuforS;2JDmDlL&;x|n<e5rb1^b**Vlnb zTt;4x;ZmX9Y&v>zCPT+Ejza<$=ra0U6s}p7cr)>lthnBTb!uAMGPf;OW`(h<LE@r| zMzj{0|2___?$rRhsp&X)-k#DA9~qXpjx_SQ(-A3?SJ5GRxPb8dIoT#dS%-ZY^>_qc zfWP_TaO$rkBaJvvOMV}M6iv7uaSIV=jjKaAJBk(VTcDC8Put4#<+NP{b#mH%L(}#U zRPwa#fFi`=SxuV?V9Xk&4;|2yJkt}`2*qbPaZ5j%^<Oh_({fGRm1F<8iM#Mcnz+b! zu<nyD;Sj<SfH*zBhny$_+>)DUB|3KhC%ENIKb)59{VS%963C}sptRtK+z*=LP-H*! zV@V*tbq(Lfv%cY6gBL3$F*)l)H0wWv9MAeLQkqUkx8tZJS;JjY=hvmXMCLoAZ0x<3 z>_zXJ{z7Ri(k8PnS9Ad$C#4wXg>)Y^5&SaC49m;#nchkB<RI>X8m!6|sFyO`R9WNx z8E_!(dlUyPtJ#jow|Vz2Wn@Zc@tj)jm0BK7(od0C=4X08rYtD_NDDqKWq)qB;Ie<x zg7c)7gUJ^;3&Vnolm&bK%sxPV&E<oqz(GDp{z%JCRkCY7Qudot_Tgl!mc3NTmVTt{ z=cVk=lk>H#p=3}0Ne17AOvq*TrBeQ2@^#!}%ScY3m5SDW9e(wv%&y09aQvq+=@a9A zo~CK4!+O;rZQ8V><aPYRGcsM<Kb!+O+qz|NhV|87W$;Q^j2`)7FlzUZB~j0WrBOQl z?#E`cB>9dG`59^?-}qnYx)vr#*PZQ1NGn#Ox?&R06)(b_@sQ&VzGA)t-DjD2ANy$5 ze@)`edByxm)>NsdX7m+v|A1v8iU)7zc$%YT;d~I0cox}XDYvpsR%H_gr<*apLSs*q z9B&{#YR~j8lB#(poH+hG&4j#f=|dZR(K$Qc(>(o0j)2``k?OMT80X+-Jj;&pIUK9W z9ivp!12v9=uJ@lfp8h?)>iVkaNY$2_=-XAbHPPQ!ZC=w|Hn+&YPxRg8RBu`{^M!eT zFps@oKu?4uUU&{xMqUYBs(;U46Mbn-^zCZs7@72}*>yb6Ts#<li5?XB?AEH!Rc)>M ze3cuI0Hl8Zf8#h72R&P&9wo_BPg-r+xMn_nt}y87w2;>bHhH}vqu$@r=4<u_j2SCt z8uRDQt29>oTRovBPph%Q)6%xh+uV%3I+qOr|BV4pi?PGk+-%UJYDP=AIpk|=_8L%a zG(t_#@C1zpU%*=*@-`UTI_!NB2b47i{4GYP$!n~r-MG=UZnJUy`i-BgS+~lluG#2X zv3dQ*&r}qP?Sba`+XF%4v;H=EG%mQcSQtimQ=73253u=KZ~TOjS+4hmn!r&%+h_}T z8-49Yqd%bgZvdjz8<Zm<J@v*ivZmG3;?30LYVn1%9MLhR)&`@dI%tIa#tNee1NR0< z6Z8agt1(tWzu|8+n*2LRvOXN*L0i3_vd8}+de(<Scp?xk-o!30#*;ry-sU#Zg#Y!z zFM?`%L~ZLATKzj(jo=PnsJ_X#sw{X_g;5*y8s+6AP@H0D^UySw!5y3G1HQHp>osPS z2WJ`}L4cnFEEYS&N)HCnK<3kvjO;fxiRg6B9OVotZ*ez=R)tYjyLr8_%C*k5v1+rc zdbZKvH(LE6!`t8s6_Yf7$uJDEAxqdOP^?ZeW+(_#FcTiTLQW=F%Ytr2Dht=LGEb|o zg&(Cfntj2LF(VC2VVf)w4M-Yuu0~AKOkZ0THpFKQQ5JNTh39y;ds{<5&1vv9dpekA zTs?>T@ggFq2lA<B8|GPir~$o_hi3Cg%7PVG8DfQ}mB!6WhE|F;8WZ56CoY+SnC4|< zA*zYJzG~w-ERQ9r5HP&$^<Hm7(5PJa$>p<+7EcHJb(_}+2iY1dym^)7+Yraq>o;LJ z@VZseFYw@}+g&zyVOYnF($DLqEVx9QS5pn=7@lS_yTb^1zJLILVhS5sa>&t|v5P5z zOn&R+<m@USq(eANL`p<#_WLpL)(&1*0q>2JBQ7saqf?wbPef|<?%-KY^T<gze63jF z*0=$4dxzN3B-#ZktT&DXWr*NtAP-cnt65vMxn})3V-wOA>LrF=g4;dKVJ}>DEqN>N z;)12k;HMw3oj9xKi_tS9BYOb9jd}pJcot{)*nB*Qdu9XmFls02V>ocBLwzw$b~;f% z`tr!ge$>lwFdIiLaA!Gyx()RV`q2bslB`7DEgMB%duiUq6V55xn|Dqr;psWpw*MI! zxmxj1m7QOR>7WsR=hLdMlG2qWQ&v01?<ndN*Il&q>IKuMkv#EK<5PmM6q8L=C8c-d zub4QtpfC?zGra-mVbC8WC#2}#n4syqf!>bW&Kppt==rroX8G>|-2?g)HvNyM^gj;z zXK*x;Oa3pQe+~5S*yO*Jk{<*7Wcc_t8~v6PeLC<V`2GkE(^B>oJTjgPtOlwY^eH%; z@uDr3mz3U<?<$#ccY&+K=pN%LnQ>R4Su*#Iv1ZAlu5;FwIGalrRh7)GDw(mo#8_T3 z1^mlPig+IGf*vRIsHr4vsWNwhliQ`L)&w${imu7URNBWmxt_@1LY$r@VR}%Jihl1! zKa&bqbGb;>J$THI3e7JSO@Hfy5kJ9o`A&SN-^FnjN*MRzT=wKUxz_nY8%QpsGDTKm zvZ{53+ZQhTuBqc%`(jT<eB*$Gi+*NzXsnZAjgKo>+dWsZ3!H~>(f#8Do5$0s_;JX< zu=Xc@Sz_3!=t}(mz0&U&Wp;E>&FcwOKc(syRsFWA#}+$T^a531sp?8quT=FGRX3`7 zyQ=R{_5G^;zN!zZ`h=>VQuT|fep}UJ$E*HTeWj`^RlQQxTU4Dn&Q&W`EHP$Od$;+p z8C_VhxMF_!yty-FOJooiRV*x@M>I5qs0ennggo0&<BbWfn{*5BWq1Q^q5>CWZ$;Je zn(~n6Mg`s28m`zD_TfD!UxTP1sL2y-5)};{t<WdyP(V_)djmmwV}scg;07&#tpW+C zR$FsORQOtb_zrp7@r`Y$4>W&+C*%<o-X=F+gWOFGkkycsaC-s)PluGy?VIYs2JM~} zUp>0^Lm|E@xEHB$TQDdpu%~aq)+N)Q*<gP2BHuZRMDJ=$&5AD&%d+Cfr1F7PSpnYE z+mn@ltkC(w&VP=`w$2KWef0XY^N$npEbFpB6bqdX?EK?XdC`uaAoi<uW5-WSy$5N> zm!$Hk9q$kWvz%5Gw+rxgi++F4N-V$|Mg6!(%`63YlS$`iE3E);xahoW$4?UUSaxP9 zKz7ZRM+(FRsrP2AG6mveLg!sOeu~&rS!YFYyTI~3l$BT@^i?E{rF=R@yhcA0+6rB- z@^JObw4bh1`C_8jn~@(X6uv(LU#0Mw*T?Hw|ApeDvR~)*M#hi!C;f&@{p#y2KrY|F zcV3oxq5WL8aXrTT7{$ly&_XfzTl^O)(!WJr$9c~L+$nsr>3L4^e{i7_Eg^W1gZj_- zke*Lp<U~sd-W#EQ6Cc7~KGlg<ntvPyPWUe>Jnw}-pQ`YeT<Rot!FwRo<fm-*%mN_~ zal3zk6CCNXnDL|MkvOvHaZv~GXJ$NaVLhYc)~)z6*F}K&N5}0R;LpQ&>1_)tdLOZm z@r<&4_2j_+7I?$PDS?+5KYCrfl|#=s7;s(|J(n<kqIlpkCsTQkiPoGP{L6ta#qNn- z@35Ad9Q<1uKRRF4=iuLw10TzQe=rCB;T-s10#ENzitDBQW7Ht}bMXH;2mY-b_(|A6 zX7lq^z?0uH^Vq^1{ALdP)*N_0@P>6lRQp!o&&{7A_GZjiEQg*4iC?6zBicVdVf=++ zOorbMu^wEfRGjlY2>R{=z7&3TKHp@s>NlD{BY*x*>8FQ;xTxwmr6)7ql3LG1C$sat z9a^tyJ%^M6daeQG9p>kz?Q0wcm~FnM0&mzjB``M!zbgm+h8*}-;Avhm$8`(v+4{XV zhn^oXe)PVgCkOu%z-N7rxIPdHhQc_>t;ZS7>J=N^Yic%acDr%nKnEN_Y+T);7B}7n z#!)8T6&{6hyBqxO8=L*xJk9QgkUtP~d&2F4PI#NWIFGHUtgM^|%~_b-v@eyrOgDCp z0lacd2V(Aqa7#-EL@bb-wzD=?byN$hLtdO1V*uWOJfcL`!KP4K5TyDhm?7vCNuAlb zaR%KY5p?>(pzMcFdE7Wc@nKKv#aqh3PzE0?TDh@mt;_9NR}KG2XX&=hz6Rm0{>-|n zwKXfiWufp}&%(WG&HCk4YuxKsuH59>?A~0pe2t6L@r%**!7#hU^18Ltsb7Ys_ntFf z-_D@cY+mb5&)nv<D`?&})A^jBy}EqAnw7V8*hS@g*mfKr%(~?<Da?Wre#zU;<o5Di zfP7s%gT!|pxC_Fex19nUUK6+D`0aB$O1`sh$MI|F8K^McFXz)Z`69cWN@t07%&51} z?PPv!-i|^5+uhgFW@k_@yk{Ws622YdcH3TahuWaujo&>Q;9L3LeVQL{yt`}GW6BzQ zt?qEp+rTkOkr}jx3k8_K0z%Zu0K=ib^ai+aYo@ULvONVohc=z8r+cEn;y)W;N4ZyT zcW+cHenqn<7(@o3TUz`%06Qa{mf}wj*pc!N0@!hGH$qY`Ac|F;P;8NkKKRFg3|To) z>)#$oGc15%^k)dt82Lv6vSjjq4n^lw*jlCbaU$Od2nG89D*BvCLXuavslEaqIvY~# zsry^~_gM_ktOaS>R^|b+%Io{!WlG_68#nEF?WGzZp6BrE{_FCcz|c7wSA5<|Ej+Hl zMP4-(fNC8+<MGk*`o3D9iyc-3I)5WSX?cClwFNj_f>ZMP{@bZLBq2-50LAA)qq8yH zzjLgUxt;33Z;6uC>NKCOzW_R&wQ0Ch$#*JwsZIW^9jpCHt+)jZ@~M`OEBUyR*XMh> z|IG34R`Sc0LVZ3kq~x_9NuKUWGv)6Fj_gwGsdI$(aX_ME-tm&H))EC^mDlGD`;~k= z!{Mb$Sl9Pv$m_q)R7XL95-_+*eQ7z3_$C_G{`GnA=~<FPnW5R)*C_yv{rHf)_P;*o z7*O(^+VS9_qWvc!oHwIkmDlGX`tKYyYerRP`tM+dygoPSr-g}fI>UdN{l~#mf)A|$ zD*8TB|2?Qo{!I8cka6In<@J4Q&jQjmdc2wPXTU=yYI%L$ari9d=^TJ!Ps{6bow$<M ze}78Hr|w_J!HXIF>%W___ZkpTG{1z>u*MI9V6|VL6YW#-Lt0SPT29w*X2|RNusxMh zK-;O+XgLkPiw5CR<5%}n`;>g=0lS1#3#yt9p2+^W8F($fI0LW4N!RCsuKTvKKB@XI t(u|6j0or2UDnIaX3DIN3R4&1XT&hQ-^EZ*R^}nYI1eE787EEUU{|64do@f97 diff --git a/vrsdump b/vrsdump index 8ba0497deb819d75caeef21a3a0d4086b394845b..dbaba30e42b8639969d3bdd4433243eb338adcbe 100755 GIT binary patch literal 11024 zcmb7K4RBONp6^Kpj2M&fp(1cHV&VrUBXH;fSv8S7KD-EHi0Ced!;rl21}8Id=1mM1 zDPe~}rY6~<TvXh%ZsW;qaiwQbD=TpicOxKS)vJmhWpQ_29e0O!6T{x2vWV-)-0#=@ zdh#ZMd)HGv-T(f7|6l+6^?UsuGa8qAJRYG-i6|9>=BB-63(&5=USSpppC}VIifhDl zF&;z2E!YYgRLKCQaTxQWmJ$be!8YJgCj(|Bj<Q*0AusCI=|ZrQUsNf)9D4yc)CMp- zfJ(i@m!RnZeGhP~Il!#MQwQsE&@YE>)&{_=8W;G;Zta-{{-1&$^=9B$HU3`U0e-7c zKGcg_BH<0UL|W%W!qH@xKN0iKSG>g0w`D8u!@shVJU&#)o`TBQ5P$64-FMbKX0Lmz zEO_dB$8S04U-jmG`c;Wa88Q~Wl3D1=v4x*zXZ+ot|HlAfce%j@OhP|223|A<{<ASK z{nmy2D>Z<YaNQUfVJj5kA1y%2&$TX?cxw#2ehfTw46Guj2Fbq+_2`S<GRAMBxLRC> z_Ry0WMznA(T6hg^6Tua$f(g4d91SKDW~=B(+6n%(SfRLxo1s?GZnn3ycZf*BG#`>c z$7azUibP^90(@pXF4`W6hiy}|L}Ce3#5&BVXzPfFqjsAJ2B`@0LvcIU9tuY>vavlD zbw+|>S>uYkmIUYf=fXhD(Bfb52(Pb4{?vRTM^!j{IjJ%PP;B@-{!-=pIJmhT@Fif} z$rcl(hb<=4F185HZnl^-d)Q*qJ<IkIA^O;s39*+g<n3cSL5LUGBAENxmJ4x!EiC9~ zTOq{i)akO^olv;#$o)48kxhM-&*#$v_PE?nVO{EI+1ex0&it)gz>%-nihmB|YiOyw z>cc0&lCPn~7IDKv5~k%AQ)PHS!t}tJN_fA7>51hd+$UjrWWfY6yi3CL%wm*>w@R2E zS_=txNSK~lb%fVTm>yfp2?r!h&#eIAIteoZ)&qp+N|=$b))V$gm=Uq)&~O#tdB1xw z^KYqBX9CSlRv+e}H5Y&PuCe}f2iBpVf#7W0F841xqxy&&?jMA>IY;rAIzPU1T0i6p zgmvP5nU7MZr&vVfhf+tYe*4*xUA^}8qMsv@{`K=EnZvJtJkvAu&Ut(KuO#EU_9V$z z6;Pb-Do!%?9+FGL*4vLmfJjc3bY;0MF!9(pj(MP>ZCC$JETGw{^t;J%BR}cw6k6`5 z%Ai1AiX2XYt+%n-3(xZpe+As?d$*k)fDM_qQnjAPu6>SX1~yIJ<go@2keu;NJ`Y>^ zIn{@Mf%%kO;!O>BvjWp<lL+KYh0hp0sqP-J`6dTlCFP_}dz-BHAtsPp=a#bxa)8@Z zvPtBVJ-OGvmO3)V&Q$kKk<>O!gbk-?gM(K#_$6<7KDjgZs^WY8ZJ7KV|Iz~m=BvPb zj?CK?kz)P?iIKg6q*-I9XXyDM^k|4shAdRHQWl1xBS8B;LCPQonZsaOblBGRO@)ez zr=a3mw~8M_g%t4o`!tJx)Zn#l0BIoik&=a(qQz7~%*_<@PYR_hT?R3!)8*Fpi8-k- zQdqXmi_izG<wR^OLO>A^5h7L=A<89U7ZJA>A*v+e01-2a5K|=L1QDf0h^Z3s6%ikQ zDZ}DeHA5nNPXqBz5uz+(Y)^G>7nR$&mB<1Z@YWhTD<8jtpmQ;{dxkQ`ndjv7$dzV{ zt%JsCCI&-LPnq3HX4W`UYix~Q!SMjc-%#VjuYwrJEOIb8ZukYV8mB#}?$ec>Q$}TN znvgqH5G3btz%nW38rNv{zMZL$%N7mAucnqwL<bex5j3(?n+<(1JiP@;r7rRgQ0IS1 zIQQirWO#6;ucDkR<y=)HCuN-R4$qdn<*@8-g&e^}DYyQX<T)k6iEw!#kZ(z65y%o5 z$QKE^1DSII>B*$KAb!v|1qvC<Hz;<V5}P%0wGtnnR0wCMLXF%5WaUB8hG>?I)TNA5 z2<54n45bzYgP$qL=?#=*?ju9x!2vlB-lLx1ejy_;@)X2_e3K(v`gei^WopFnud3jm zPfrx(A9uAy{+*QmWzx2E?nCX|A1Jd~Da{%uYbCx@s*`i&nK7vNxZ$T6I^$#}&09`Z z{#U*tw$tm!M!YHGq^BS#F#%nL{I9}bQiiU44;0rr-YzSUN&b}aA!7I8C5)Z66v0@h zs1dCEFR9yFNEuI`mk}Gj10yPEw>na#7j>k0PtiC*n^FiG^Tm~2|3J_^DNYo!D;<$> zdtb+`m11Wov039pt;D+~MM$AWqCm<7D;a4?8Slfb_hoizL2zqFL5e%O20oW=N%lf^ z$*hps<xxz7h7x3)@XFhi3cvzKxeUNoTKcY%<^*7BApn0YD~3k1!jb`aTL<8;DR#Ox za;P><yek0f6^dCg<j#t>5rVg6R%lTOL8>4}W(66Fvf|})MOo48$d>*cpdp_s0>{4@ z1^@n7RvdS-qE$L~R6F;NlzE4enKh2rripiDMQRMHkQK)>X>Po-^1mo6jw34^LClKd zg{*J}U0G4%c#EuX$dDDsJt^ZTVs}(#g|-y2Tc)UGR#3Ofifz9in-w!1sWND%>ELUM z#tGW!J?C?5v0Yh_1E{9KKxroZ7cx=<jMSiUh>bgA(ho?q+}RBp2NczQ*`%9+Vy|t` zcnK1Dm(SMe1=_Bb8o78qa<yBc(O;N?#sP;(uX^^iqfA#8F&$FZ)xgSHZcTm$&JLZG z0U0#T(uS;Yws%Te_N2)kOkjG33;BgyNXMeHA|oA0y(Znj{qh~q4I0un<x#5pkg!)~ zjYIO%+70MsjQv~@58>J$sx=09;T1Odu`^Ot7#UBxkqSqo6I;0}%05Y*sl!#C!_uuq zhhgT5(FI-_#(QdjWZnJ3o+bT*m;G?eIFOj+f|-mN<0a0Q<XP)F#-{l*8Jo6L_e;XQ zqVk}`2CR9+EmXKv_kLkdmQ4FCgNT_5kyTpdc8z!PK<+k$NDow|_cGLqU;tY%Z0Q2M z=~`GB$esCA>O7Xd6Cm!hWe&nxN8yJRwwTvS02Ro6pm4a&E?4-<gLM^^zd2C=$}4|! zya1F{9vmtF6XdE=zWUy#fYn7kKa{e3DdVhXIEO8%Gr>mh5GRXs;hmyfXoTtRX_sD( zfkA^_V`}uN=2_M3QO$1Iq#Nio3TDm|g<R0f^2KxE+0k6s<Cv<~x{K#RpOXuFnG1dN z`sgPz_7}(nI>20@XP9LFJ|-6wnz=v+Qm;ujkPE+(xgdR09;LebWG?g-a-lC{>}D?X zAs6~;jlIkTg=H?t5#)k1f?Vj6xuC*j^f6XWE=bLX$GdZ3KFw73ZD|-c#`{#L2F7L5 zeAG>KKkG`1XPFjzM$-bYN{c7lX>t1*878E~6Dlo;4OlNTgx4xus(ZIii`~|nM3gxQ z#QGz`4=6Zm?5mZAbjsb&H$*w|M>>Hl+#<tr#lnlZ+%*MG*X^*Hn7#ia4U=qjCHhX; zKvc$!@@iCssHj4vjD6#W+Zhs0`aGY*PUF$ACs(2L$+f%JJpY5W>v}_96+OS-cmKTn zn$@`)5N<ni`&HZ?&&Woq=k~r_4tcpZ{u|H9sWNnLI`;ZECFyha4ZW}M%4Hj>7iMm* z&NNh)p}PRBH^2MuNthb+Ec!h8uc@Om);<_qcVy)9UGDN3UbDz|F)zdPZAad^5*qpP zh3^qPcwf{RPqZf6JAB_q$JZ8)n0HJNEum;MX8ZX5%2$(^Abx1ZW4?$P-Dq2qWP(^4 z0%fbuj``&4FW-h_TbmhokMo5Yk-pZD9hxB4G_9T|RzhgVhpr=qJqvVZe6jGMG?|HT zs~NR@iSVQ5VveX%6G`HYlMsYfwY4Qo*w!ZHM8XMM5nh-kfwynA>08l|Ak}x$L__T+ zs4h$siiX>L1!dns<7m2=E-A;+<j~A!6k^gVs28)1rlwU*QkO5*X~x?ku}1_H7BGs` z7fZ?@Y=|YJtqFv;ah_&H0OOl|ynu{#qff;^NIi7HQ6?qCL(z@qwPN;aSDZu*l!@7e z&^fj^afjM5OpZIaJ{Pk6W?#a_8_<o?Alr<$hod1IZ&zp4BxXTPK@X)|R8u{|AF{)- zsGEY(0{;bZMb3><$g5Mtv!cN*@*-^7Lzk}aGS>-aBH7*^if`uBUaPK2O>*4?Kq!TH zW5Qu>yT>Sbv5(;?9=A7lV4Uf=W?B6MMJ(Y2r1-k{XT|J92QGb0E8*4&V$^w;J<vBg zzM{cp#OUz1>=;EQ%!iX^w8dPkuXy8%)y=+DYmBC)jjQfgra{HhI9<UtLSGk`<8p}J z3ynnEU`9fl-Kn4S+2NLl;B~Paqm%0dO;<(A@k}qR<%?b~>Ve^Wz5(seMzEbnyBE*= zeQ2lPZ3mx+r=YTU9&HkyEoGkR<zDYj+yi|Wn}KS9{|s7DQMR<A{O-!jY;Tvib6V}} z`PH))V7LzT7Rder?*&CexkoIk8ds7O4V9(IuJKi+CCM$Nrz&2@c>R(3H<my+$QGh@ zp?-yj>kwK|Us0AWsjn!1ymU!L)edic#gx>zl@)VKmRC%vKT=Uuf2^Xsez2mf{*4N6 z703^u&V?V?K#dl>H$I88HV(jiS<BH*-R>>JyF9TMFC(u;%X2UsdCAyJL%SU?{iI#L z|0W;n!8sRR|BHbi;oJc2e!vX+Pf#yIrT!~WS$Oa0!lMW6=s;yGC!*qRCibPgW$f=k z%kvlV@$8NU;$3X43*)$H#b_(;fw5-5=>ES8&+RnR8u;3V+KIXY^(oY!qrQTA4D|!l z|3p29Iv%mQ67_l~W|XmP$&$ss8yn0G;ZW4Kz`w{pf6lzQH>uuO<U;>~IrE4^M+kpn zbGsedfYy$y*3vzk`k3(!;m1O3`s?pnF~<&VbfAsVq<=#)j1$0ctMC)DLJ3RwTQ^4` zPqlVjVQ>pbVBsqQg22Vi2<cU)BVr4GI2y*kZFb?m4FFIv-h74Mw1RES#h}#+P7NuJ zU??6BZB`t*zo`Xe5FTm|w?J_W0`cdUT9m{MiG=XC#M;}Dh59NKw>-Dyh&l~cXQ>KS zv)3x%Ih$}ERe(7o)%;^yDmW|EykuLdPH}~vH>CoHR4ANRY)j=#Q}a*3m$H%bQo(X5 zk@=xu&Tiy0=7xfqJ?i{g!OS9+M+#=b<D3h5rC^@8!hUQI70ekAd;w-QsQhDFDo;gK z{wbK*fpa-$K9@Qxlb+wDPS)ATH${&f918PK!OS|GX%^tA66SddJEb`DbeB>wO|B7o z%qu?0(_^jQ1O4RaaPp%>TrT{8`&@86V7=xLe?MS(B81ih?l!bsU(f)aEPC0&I>m<c z&!FXcMA(CP$n7!#6xzeJK^MY@0c`n8O+Qf#0e0J~Y1xvV>$}#^Q|R9T*75Wpp638- z{ls4ig*u)dtYR|(^K6bYbrS5o#bprJG#+c};zMUG;Pr?PXYQnu%f-Wh_4V+HsbY(Z zp8P)s%<DsXo=NwO!T-X+1C8}_s(5t_{>?G)hk&`xlYWw@5Pam+h5F6{=HZjp_vIM; z<#1HnOMTN+ib@gWpY4KufENKCaOT&<lBr^;3s3qrfZb>8<{12s#=uVk<}qjpyo~qX z0Opa5w)cfG^uGpt!qH!a_#Gj?Ge61yCSc~L;;$5Z<Dm0_^#1~wug<jmQ-FE?%6mEa zhXL#2L+5K3KmEN_Em@L;`0D`ke#?PLxLe-j!ZRMCC2l8dJR<p9aO!{elBOUxOu?YQ zlaIL(TXHiVwA+LDY9MMR@TtMKhJwM?Sa4$`wjmS=w%W0HA{a_`39P>z5fhtf|84WX zw+NCiKosPiK&|URxd|2OPJm~=_RU~%K|$U?ib$PjLuvKWruut~ps}(6W-A|bzlg0> z1RH*^vi_bGOF-qq$nPFRa9QK3yXqT*tClWZZ8Qg)>+fnbC{BJF(UM3?Yvs2Vb#<fP zLj+ee-xC}SRr5Vd7^vpZhKLE?u7$VxH=1^^qa|ot$>>A=4PAmaDfMB6P@iA8#i>s< z+#~$1qhqssBxuU}ocz+mJ+8h0agQjI)psB6arH#(d>-OP;4-<a!#5_y$f9pTK%0mK ztx&WTuJUobh_?81m2Z7u;-+=JLU9kdqR#6i+PI_F-@6nMno(R;=K{8M1g%F9b!-5f zAxsi(E7T_~cXtMxoawtH5=ta6or6JKFg<a2CH4F+zK+rc`Q40LH<Rc8R=Bt2vc}Yv z-;DuKcUHx(m%Qr$a>qbA`F$4<KJ<0rn!qv-Rnu{=Vu7w&V$`3eYXFE-ff(g+57Xn& zsa=cOUz2tvDt8*B<KB8d=&De;*G7Z;mf9<?LCfWXbli&%pu;`5E~I675S9CA(s3`; z45nG=YrPz2eF&BNZuYrH>H?h)eYakK@;fZ<lt{<D`ySA7C!^)jJ}z)6RMOpr%Dw(R z&~>0sI_@JhT@U)Sm3p`~P6gsR^mQQ}%j2k;j(e~=AkIjP`lAh`eF9a}ajl;Vg>fRC zqPu$lYdYQ&_u`?2&nLQQy?=!P($QbuEBZnAo<?F!cYp4pli&N{;pt|K>7wZlV4xrm zd%u3r9oIx?HQle#=MEBKlY0<;r>JolD)iq(pF2y^aWAv|B6J@BPran$o@nPq=>8da zUJKH3FU0R3bIuqVsh8LH6snfTJ*SO_#Ig1f9(K`j@6-jl28`)K8rDxywLI=I4uOt( zbRiAPc~p+mKHjU3g6=}s?Q7sEZ!Rhe=@zN3{3ni;yKc(T<!jK5C&DSZ%a(IM7w<Jf d_%OHr1OszWX&>hn=e%29^>solb`5BG{|oo-*@plC literal 14104 zcmcIreRP!7nZJ`{LJW{e0?`O4F9a%bN+1*?f~ynAz=Vd6MnG#9XNF`#Qj(eMd_-V% zjUC2jHe&IsO+9wy?Ai9XEoT>ZPnD`LgSf=)diJ2Fb#05MochrjgS+vIveugYJ<q-O zotZZ?wf$o+XWo0C-}7;w=eZy6M=tlc+BcNgY(ke3ag!iwXquBDc@<)GIg<)oEh>al zTrK8`av*m6oXnwGwsf6RrgdGR<VsPOQM*I|B~IB;^*l)lU26}irv9?UshYB$u|Sf# z7Q$eF^vKt0#jjrAWn9<8%8z5(AEiem=`B%uOO&3j&yryjUF-NLHu}v|_U4s1K@shw zO0@DdTXQaeZF@V?MeXzRrNH_5PHyOWm4t<^wcb~tM}GdPrCJFt@9W*&ylQ!0*RsCe zKy=@-eXE<7HLq$62OC$i|0G8tZrrkiHFQ1<P}KKq{AetRA8P;dhqIn~^ZGCSz5UhM z|CCOZ*IxS|$vf~P8|<IV7iWd=8$KA(Lkwzaq5f;9!eV+6yrT%ds0hBH2wq<V|7sEZ zsv`JTir{;J8~9nvQUHbGZ7PDd7r}2Xg0BW%Bd!#q4PLYa*0Cy>2c0zR&0-)L3Dc#s z#}^VIzpqR5`};fl2Si`k@88SBz<$y1>+1`4ig2XM9}0=?J43w@zv%1>hW#Qq;17uI zflzNC(k(n5vg`>*e4&V^-`5)evZp^7P>4rtY;Rk)-m|i?X_eVr*?1j!RWjut%{7fm zzipstO6mFh$b;X;G%FPc6c(M+dl^}ZOL1{&p_f}U7b_J;mCgt4Ei^B6sc-Oda~iI4 z>M|*e1}`@VS4*7fB@JG#38!_T%ZdgsHwo8kmVng_UaAD)x%-;4!3#v<yl$8h!rkEI z7Rl33mu(GRZW3mWDcZL+cyX1oNQ7Cu4PI`Od~P0ka&TH>x(qaUxk>UfxFs+98ob;f zd?vT#WvIc+4Z^FqB`@ySg$nnG{qA{&aK}>-d-_Mf-LV%dPD}pebs?}O7e{b)%y*(i zbPq8z=O<AXf1PL>(Px?7O*9QbCdKsaL{sWB$C&OQno^!Q!t^GhDb<<7Os^xFQk)rL zdJWO!c4mO-l|)lYGhU{b5>2VhY-4&M(UiiBlj%7`Q|dA+n64$7QkF58t|XdLm8k~Z z^j=%yl{?&t-?(FMO>EoVHkLX&$0^)nr@UN^4OTcs`c?>j)a{txD#Y<88oXkMd)X)| zckEJ?JMs45+~csu>8#n6B*x@<2p=R+>^j{|rBTx-iNC{r?|-v_Q=gT>fIBhaK9#=N zZ9C(B<+DhgX>Gc;=9o`*xc{NQ=$&f_5v|z)#dH9U?K)%M3CQ;0X&SGjv49-ASw!vQ z4@1v1_C6_0p52u>03B+(@4YaDVN9I3|Fg+ScjCuGsA5dm?pcB<^2r=SxD%(IorNe) z(s(D+NJ;uRh#lwQf2amQkHksO9ZO+WiIb3m&KP%^z88!{oCYCwg05nJQ=WJ=I(ZbG zoct7aO|9vs{gtpk!urqB^kU<QvGikqAa~<SV9^~rL6wM-znhf5&{F=+m<xZi_I`ss z3J$O$?7Yf$><y$gVxLD<JjIrTvUG)M>1wic3JNmvQMOc<zLHd>LEBk(!v1Rj%44XS z9;ZKrt0Oai!s3ro|5C`E_)qxpE^!ktXhWm!8(xS|JO@Y|`L8#<XeKY#nqJhh7xvvO zXWz@#?OmvzrPX$FE2NRt^bcVlE1gVU!=k62r43dN>2@+n{>i|S;3T^Uo6SDk>!2~> zEK8)^i8ILoFpfi2q{}7uclE@rklay|oBln;YySmvXGm_!<o;B0pJQ&d<fcvTQOW%t zb7xC#^*r701Co0WbL%B{waFcjTpx4iNv_xAc1Z4e=CaRm+7K{@s1lBY8!@Xf3KC3} zx!3Z@I=;D>@w!j0;L&C_jkaq7F}_D&ER9thuZNW}*9FQ?@?NvobDvNyAiI_YLXPBN z@X|j9oJm2Hcq0N6&z^Y-WXyHJ7Q6d`W3Wb>qMa>0sH}_#8P)eq`*&qI<`jyhD=>*d zvywlgt~NnJ85`f|9;sW&aZs<YMS;X=A4K3($*FS&dNg%{P{q`#N&W{JvSkgqW3Gv^ z%pxcx*}vERcXD#PGMOQ<U!sl7{OWR=8$9}!Jip3e>pYj3c|OK?-9u2+!@zky4{LD( zV`&?_t>8SLgRn^2uhKIk!o9lA!x{;MX2?8mCdalQ$>$x<h;F30WZW5ZokNb#&8Hko zGaN&$ws2@$i94}_6dcc_FzsiVojAzacV)<LUgD7J!A$=aZ8({(qmX$@TS8u*H?^`M z&y-W^2`J`;d=}OoA}|pb9PY~;?i$mRIQQr}i*QL`uu_J5M?M^~XP)4sLNF1(L>u)8 zSB|H}L7H;+f;(=<Xr8qpN7`C=IuTOl%^W;BBe{*jz4SYT-j<b-24b$4k=B=|QCg+D zoYv<cta_zA<SsLW7r@A@hVwF?50lZ#<S=#c9oDgr&Zd0wCSb|uC5}o@q3lw9jq$pz zP|V9`3i(_|pj@gG$i$fIc?gT-QPZI&?$wn-PDwydp-OTrf@o8`PD{pnVy@>A>GQlu zr4f$wm5UT9iCGuve`Pt=MOq^l>GvU_Ji=(C$}(XyF$cgxVqT)e{0$qj-!qF6!~35l zF`u)xnxUANm}5xHwFJtwmFC18<;1*eCZ=Axe+-Es0iBrlKZawpwvOelt)ocIQC?fp z45#L4h?1aNt}RlquC0G1YiezMliHO@aWz67VO9J6wG=XM>Xwi{XKk&AVqVBc5OOnt ziTHUA_i+w)F*=hsw`--dM-VOv=(San4`<ib5m<U1g6M^+DQoKptu1Yh*Vd8j+S0gQ zTaSN)&}nTc8CqLMY%$m4NbBRgwxqk9Ru6<#ulZ}M8;qQ_bv+raOs=MUu4NtjjWv|d zLbt&m;n`g$ES7T{e3)_j@2iozSc>j=XDR40*I~*Z>S3-&>RurUbsy#X%S%#jNXo_c zVQQ=9fNGA#UxW;S-D7cjs3jNdqcBwH77|&j&Bs!DFTL{`+}dun^z0gfl}+q0-#Vyg zAWpVBb)Sx`Dqz=u-APA&M6O|2`GCNL>u}OTX?^PhTEL%D2qUgf-G^rL3oq<(@JPd2 zP8Vj)m+>%LPz3u1ry+KNlY#BofT(*cuCtWQP3-Pr5%FP`4D(Ei?4%|}gd}-CAEr4s z>|X0S%o9$EMc*;OT2nVV4Kr-mHa;t-qwHYX%Mj(rqvVh~_CmGWhW*QasS1(f0mGgd zl=rV+0~lf7<pafW7QcH)M3&1)F`5_)&H{}=xIQ1I{UgES4jea$ATlb~;`iR4oa~OB z;3*NQcRa&Fkht5F_-jbu8IE%lxe^Jd7OjQ{O_AG3WF$^r<v-ti3ygTm5&vh5ni6my za+kRe#Sd#)JfqW-(4&w%6MqD#P+aQbAI&a4o-n(>;wY2dB*7--CEQK4U3KAj##!Y^ z;^~n+0yV>td?`y+IG(}nU-K%lPqri`(Ai67XT#_$=K9o@d5B(NM(hJKk^X}B$v29u z<$sfFc{vo-T0TZYHd0qdNbcHwlJK$kZAdE3Z8W!Ko9=AWnQg9C&9V4DP`*$wahn;0 zv!`c}vs3R~k(+eCIg5HJT>1tSG>f+r>J^4Ugv;9&bq=J5O;5c?MAm5i9MfNb>1(W} zDK;3og75?fot!}0)8+qDWOZ|TcwSQiu_E?PS=~y6RyXA%c7n5l)$Nq4Tc<0Vq}U10 zvE$%3DB~lXak<X%7{U~sBen4gcZ_MQc8RZLr^8jbTG3xxxb=D5N^N8Oa*VF_CU>Am z?4MQAE<lcB7buszzz4wOE)bBrz%NLMW0bpqS0?kPBo|BB;qxdPIKk5<a-F#c#Cb$H zi!_qqxl=fDgP=KN-5~CIk2eUOUc5n23#+9R-$LXTayuljL2zKaK~RfU?;KO)dWa;i z1DU>xgh%4+`dapP(2?9ioKkQy^i4;x&1ar)vXl64UNAMyr<;9d4?oZ4I!olk|M zI*(l@*(sC#9b(7WtMbe)xX-IUgw-!UBw&wu1R@;ozn{*2Y{K`SmRnmAlPx>j5*J%` zv?YGtvc3J#;?Z&gpP&vcqxzQiYu|4AmHX5mO6kjB`i*h)6n`&rwf<h!o_M!Caj_LP zCTE{>$4=YaH;hN$r4NQ*+tu=yExTIoXz}0^m-&6`!_&wRePdLg6zTggmBCQBE80I` z+=zzJ-P`BCsZw<M0)b$}pwHFD;&7$7-5&}Xeg43nNDqrtiVZ$Ub{UbN!C$+L-O=uD ze<&BH@8iTYx_l8|rP$eVOOx0Fqdo&oWrbQjkn@Mu2m__VAMWk)2O>te_ke#5A+jv) zi_&8i7ecmncZdD(ubXZ4^@bx-xVT&xAKfE<qpdYelAkLV@b&v4SzOK+=<PSmjz33E z_4>#9WqYbuCAXBa6XZzYidgFE=-Ar9eHy_*f2g}Jc&9+eCP#`I!6+wYcQ6|03M1|9 zO<EO+4ed8*U}+564Ve?c{ZJ^XGqw=&1@`zCh^4pW<V`F_XJV<DO67|h3v_EyQsJm^ zE9Czdjc^2i4B5j@Mf{=u-heOS?-C0ahZmwNF1kOmR<y?!42Lh$8w})1P}bmYL0(>v zSqUB~)o(7EYqp50jy9*iKjyMZY&hEA?+fjx>Hjr3K8vHfDnX%`xyMAr{LjV6@*0EE zl#fUD4*;hnyK`g9Z5&9hT5lMZjD2+J2}Z&Lm<o%#i0-Ns*>H1wf^rsbYt3;a3s3PS z%L@DdD(Vk(`q$_w*xq)_c4O;KSI36-t+&dE(8Y!jg(K5$g1~bU01C^3b^&h5ORK-n zw?B8Ah#HaJ&b^2pB}dLRNP7yoFALkT%`IKK3Uc%Zk7MslP7a|y^4rPDZK%JUo}7FV z^$<R+y@YxKbv5p#RA$Rc*ba0E+rDbs+!@m<4%?<x6Fv_=H*73bGE^0o7h(~3B)<fG zPmo|$^@ghYO^)ezRt$-o=d4}&r9}$~CYe_J-htgWYS3t@s=lve{mk;x*K5!<^SS^Z z!zVC5YO$`W`dcNgs`>{?T~)@RGFR1-`|a+k75A09t5(ORZLV_mRjqERTG3LqWL=f9 zuBsmL>#8c)&!bR(9d_iMfsAF#whAW`D^#sHDlO*U0B0!1K)IBkspy~0k@S^{*5?c6 zDw_U~L}iYwMEwFUw<vxpn*Z@<lR=`rB~Dzke;ceQleGSu;Bbkgc``umLHwvpmzAhj zb)BkpRjL~eUT*1JY_p6%{UMAB{VjruVRv$^@d@RR_Im|$g`hu>QPKV5$&2GjDS13Z zFs<{7R|=*dQ+%oY|9{ozIIKPWK#l9usy?IY*HrzEsxPX#e43L@T(0UbsJdCz8&thh z)!nKdRJFDLjqBI1F_yIYclY`N#;V2}8dolBT5+vx2@7*|<Emv%#6v@f#_<0Bh;KLQ zNJ!Q_x`jW;`$Gew5jRJFW6Qd>Wf9*VMePYh8+S*0aSo)nOEePI;|uqQ#;*MV*pqc6 zBssV(hjA0iBRt@Ruu+kMY7O*7L}PED7uSe?AFkaXzzfo&l4$hzc)Dpv^z?K=S5s2M z;|qm+`=y3%f4vi8u<q;c?L^l>7{sNKdyy7*hr^<=GuYpcebAcELUbvu<`U-=7M(Ge zR}e21Hx|Up%ypV;tQ5PhUZ44RxzOu4AD<=)&HqyD3VPk-%U>q+`pd_0yHx8mAD=Gt zewB~U5Qo(~&c|n(=fLvuDxvqeeB2?<tNkw@uf};MXD-C;Qk+DoHwxjkIH%<;AV168 zFLRlt*wyLJ&el>Y>TqtW5PrFN4kTBnly<p>Lh|)uxFDWAN0V<y@9tTY_PH|gK7WqL zqVg<-t$_b@|0uzUier}jp;6%z7Q98_*8A42z->71bELtGR`v`_H@Bze^AK?ASKkLo zhst;Hv*BctbzF`EFBDg?cwb;UHKJmH6Rm7Hi)NubkVGN-=UBCN%6xc_?Mxl_i%Q<= z|7CF0R$$!c1FuCM=rjhE621ySU;ArSJGW{DZsY>0?PYxG{MlQ?&fUPPan~Ge@a9=N z$nsOy-QO0m^LIt?r;6Y&7QtUDf`42DzYK|@^JPye|Mhc0HE@c{x{j^_UMQa{fg5=l zkVFgFFR2%Ym3=L;rHCCL$>T(q-j~Xh!T`(96kavHeuWRQ{FUOEvakKWuZaD}fL9~l zl#*9w#1qQ?kY%0zK*?Lj_g{ch-i}-P{fV+e=YXj2voY$Ej5CyXISbs#LnQH55&28N zDW6t<%J6_#$j;TkYw>hxy^kycUhrIDXDAYm;Im0%Cl3B?THoQJmm`ly;A@C~4_?Rp zAy1^=gM)(se;B6?r$8Q0SJ1PkFSy&+=jn<BLt&3Ex=-LPKhWpLOLSv%b8{0c7ZCE$ z^M-tS@bF8gkk1?V4%ELNDmj#g9#ir})%POydP7IcW|zmcr4??=7<4;NtxI@Xzq+Mm zbK81I<#71uqws8O-@2})-LrMWhFe_QJ=<H>wY$h1pN{MdN7-9_?9%Dfry}Vnq^E8B zW=}R>+c&SLY;E`L?(++J@{va=`P`;O(a#S?$~2$H%opGjo%s+S;mn8V8&^Iu<xpon zTb>uq$K<Co1f1isIwP7dXgMAVg>cZ*;|p{lS~5JaKP!(jqn@^{h`*~h;E9IuO(iFx zGz6lXUd+{D)vO+8)gOSk8XOOv9aS46Pfw(LRFysrTC_F|dOFlBUEk*mhcRpA;a7{C z2g9W242_?j+IgeL(?p%2&DSrmg#Rpv-ZyRdVR_3^;#9S)^!uiyq^xdJ-GCpx<7s{U zJgm>N8{p*@y{~Gl35{HR{oH(`GPp<!s@kgG3j8A833dP85+@LPALfd`D^SZWN%Or~ zkzxxP^bV}`^>esB=RZWrK`F<NntGqFClF;Pe%R7Xef_*%p&Zrk*(6IvnUe&rci>0w zxVnG+T>qHTH<YCIU(4xwFZlG%tZDuHpHlkzJ=^NPGRx<mNmT3W_k;<HzV6=||3T=I z=sIOkzfTxSL4PM8lD>sl^&bF6IU)b3==;Th0<2HS$}K63YXZMqef@rNSn2b(BvU$j z{<~UXk685eeRxQHxago`r8!0GY3MODa{JfsJ3mv7U#10BZT0_%(%1Rd&mZTN{-i}g z=TDn`(yFiCpY;C=!Ha%gv6vH2TlDpNR=pwBKFZV1j-Q58XjI`xYk-P=Zr1;Q#_F$? zei=Fr{ItIQ&Q-sFtWE9Ds{cA<DF0etzuy^uqW&AurKzIz^?RWHe?0pC>*)EZ``7c} z9ZUcE{|#JP2nLFlmsFP4_&6B3{)+~$6m5{zu&m6h*3&hOPp-axZXQ<p+D~mj>uLHE zGzio2>*u>srN2ZAs@kegFRIl43X7c9zrli&EEQeXpso96hPu3>`mfM}3b&AKN3We+ i{qu_?rPuLQAeZ5%{nz_9t<OUJd%r04S6i6Y{{Iin%Cai} diff --git a/x-demo.smp b/x-demo.smp deleted file mode 100755 index 42aafa326bedafbb29b05c84803a43793888e844..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32352 zcmeI*d(h`)SqAVIA|Sv>L~sE|N)R$dFb;BDVL2(M1@tACHNk~<U{k4G+yMugY{!-n zhy(-$7FmNVwpzsEm_bXBtwV$nX2a;%I1HxDFp^QsWbN<zY;iT;`MvW3QY^Fn@$lW} zaNYNP-G}G-9)7Q<9QvL)Cmgr)+(qY1o&BLR7wvq;>F1ul^XPKt$+z$E_E&AO!^HQu zotQXdVq#*&qidVd|F+u5f7iC7tIIF^pMMT6M&oOjXWlOB{yUhou49*pO(%|BcEY58 z&N*QIy!m_WJO8{h&iwE>dz^XRnd#nk;wNkQKC?&vxctJ6*5a=^Y+_=c*|%&qYX5kv zQTydwpZ2QJ_1n_koBlh}|CO}opFA4X^JhQx-1V)QxiWL^PHPVQErSN({)|4h`DpFc zg>SwV&fjL{F`08*5Z<5G=<1BpXN%0auh5KsI8wfpneWZor?(u*Jux%sZ005Dq1#EB zxpmsNrk#~`UfRoQW@~a?`q_J8m?8I9vWoP!;^6e(o>g?XE7w*v55F2K%=|)Zas7jz zUF*zycmL^8yJGFyiF>y{YGj@E*o{Zm-+K3`-6ZY%(;kra&Z9^DS7rW9X>UpUXxfjg z4Vryse<jzO9XGn(>-bUo>di*&YoAyv>#04{ZkL`TbG=Jq<1J~8&Z_yl*63cDKW=om zcDJlODDB=^yHz3Yp8nZs56<XN&qFhM_!vD|v3W+{l$i&lrRU}^NY*$W8h`(REo`Ul zI|sH5^=~HW-#m|Fl69CIT6ainA9{Hl{t)5dAdIt)rw$xgN81e%HIwM&oi~SP{=)XS zwTFf6VTN|(PaioQx8w3+T-J2{j*E(MG2c-k0*6*~C81~6hh}M9)R8`9>7~oBSCYTF zYGHVrs+m1HWO(RbvE4qMJ~BJHUfAw1lZX=A|2NUQLDsO2b)|YG`KxW2d9@jy4LZxl zjlP^Y9G)Va_l6nQ^?dp&Iy}P+Pf&P!@zusItorrtGxW=_HaZdUn$bQzw%3N0aLC*9 zJ$+4&-^|SX4A9KK)F<=l?d@~L%Z>SFi5Fh}cTz(RXRf*U>DV4d?+}07*=%@n7-om) zoymUc&T%N6b<ekM@NAz<hIMRM8J_R1_y1cr*2m}-OXIxRm2f7t?xn757=C#^-&kKb z?7QRjYhT`wUmNnP?+$vuoBrI}J8YlddVlPD4UyKPWcAvYV*hIVuDA5Dd)m9Fe^xm? z8#8(4Ftok*?&0&U9-a9!hu&X?o^3XUn0?nX^QTyiIg``Z^k-@LI8OS^&w<VM^Nqt7 z#(dY(_4f?$e9wnN?+;JHGpVt|3~H~9doR$^d2P7=zOo|<GhNwUd=-T-{auMsG2dC= zUh7d&F|2Y<p5wgM@7iWw*?zoiOkYJe$XXwt1P*J|uzGK>Yup*HV;*lW?BoEyD~4*; zJ@8eDm*V6wte@j*)VK=Pr-iP)>+c!Bj_G_pe0uicpP3K$`o8brk>TAzpXi38?S<jV zcHAz*NBva1>i`~lv@@djqoHn{5iiBPL!W#)AAelY+dMQ&>&y9&{-Q$W4)5<o(ThJH zc2vyVFCDR6H>PKv&f?j%^NDDboBU-IGOb!SSq4XrHv%2>z~Og2@Xf)hIgQ^LF|6l3 zI$Yb#jLT(S>+|7|xAo=uA<g;X<zv^l-F8D|8%Atb;F;%gN36_}l^gCjX2KyaG;i&N zar@xQC%;tD4K-?buD<5yp8M+fhJ1Cb_0{oR?;3p}d_&qJ^3AX>kl&P^Esq(E?w2o+ zuRdyY?c3uAHW^*-m9LH;O8@@3eqX*l-aqZ@ORle-58dgxZ=R3L*Uq~};@!c&Bkc~6 z_}*NT^`+qdW!k?^drD-@O?!G|9hP=jNv1!s_!3)tQ+<#9hUoCI=(b1NCDG@rX?>Nw zP3Bx*x~&c;M@1_d9-r&2qub}xPM=?`&(KFFMU&r(4)o!jpNS^d9zF8NebMLp(d4UX zX~H`^^|@n5Gubs{th2tE>F?EVO>FSpRJ6M7Cq|h65Z(Ch=v?#Q9np$z`)2;aF!Qza zFAp;(l?UbWOwNI7e(#~<o^`|Qd!_ywpZ7<<8u;&T@^4IhE{V492*Z!WqFK4#KlXkn z49klZvE_Sd533kBGIq^P>syiOIUiSP<u!YUQQc4ccx_y!Zxi308oT~H7RkQJT+8&` z5=-BTbx)+dCU$kcA08V|i(RvVHe|Rx*pWZ(yn6mer>j(#MTd2@C35diBv0o0>a;(f z_KxVYcPu(2t=e*Iu4V3~@#E#``R%lF>f&4*{g+%{o%Wfu&!%0R_S0#vNGk{B=5|3| zp8iYHLWb~$==N;d9Zwu(jrR6!M%S0m9ku_o_6J4#%)U9-+NoUcoAwK7KdU`yG}E=2 z%hLaewCASPzt8s1&Ace9K9bSP(z<?Et}jk|O0{pv+S{V-J?W<>{LiK5oV3vBb7Ok8 zh%Fz>b@zWXzO(Aej4qCpJ916K59S(<>$#c3#%E3#S!8rhW@2XB%wf^V>AxkKW0i($ z(!VP0rD?BCi?@q%y(Ft9bA9t`N3xdYTDu_EN2aCQfw{i0JVGDZUXf8=&~GjMcMVIB z&8Nwqyk;a9&sN<OO;$#?bF+#s=y`kQ^P`wKD{>)NyC^-2!~eWolXXI_`Dn**XzkUp z=)#QB_SBM#tL=k!Oy*!_zsz}NyOI7sO8ZVaXU-2|g~)j-GxyKvH*<Yx=G^_=wbkG$ z_~Jxl!WT2&h`qGpQ#@!_XB5x;dqd=!ze%L9{rX5>6f5vHE7w?J-6@%4{*%$uXnS*I z`ad1U4oV%^E;x{3(g)7fnXjJ|m`kFYteKN*9*3qi(;W7)i!AvCQ!c0jwB05C-9H+d z4-*bQn!hR>(vUBV{&KV;5x#5D_;@@nFX-@KdU#OA!DOkKbogZ0gF^@X@UaK;iRcDR ze(66py8T94Yk5Rw$y5ERoH)1kuPUN&r5_p{Xg)vjK+h)=S1|djHNP$vvHhxO1+yau zrmT^JX6nbVm?7nm_>M*LUB6X&ND(JS;m9VVmqs_4*xcgKe71|ItrM~2(uam@Ay-75 z_PSB-^9!EousjUxotADiF$xpUMlXwo_-wmqtAdfpBchaFV2V|d22+gj$j-?HI^coT z?A<x`n)&fu!&EJ`q^ta-V+<xewJ`razPm0Ah!!033)^A-LO2u;EG2y^YgN}Fhh!a7 z42!^F2GJk4B)%;+s=&=5Omdq;k#Kvmo4wG)4|{(<9ux^|VTIa-2hu-SIfWURqS}0z zPQv_xZ5&R<>IG?GlGUTCjnQu>-{G^-d@(@VwwD!lAG(QrI>3B5n0R0X%+=9~mtnpy z_L6&FY6wieCY`-17`a_7#Wn=e-&`5maX3HH^}uvrgMW-QOX}p1!&Skdn^C&KQH_WG zW$&lTUcPJp;vA+7l}%6Qqz4nL?1iajsvFB=J52fBF+)#l;lNxNi!e$0UGbp!$6Nba z4-WT9F0(}x;ZP-U79Da3fo?{fcx6-P2)jCFX2(Xlbv?wMb53(elgE;w>{X2+<M7tl zi<w`ndWa=0dp{lzTI);*lN2*acRwgQ_yUKE!nO#9xl_(a`=);?Ee=`t@5zhi@S!jO zfpmKc_Wq{ySB2OGbEEJ;PrB(}R}&%~rf3n*koBKjda_8gbo|34g$~x<6ZXi}>OVJ_ zlWAd|78^;2qhFMgWv!F5+Wwh3hw!p^u$D!`$l*KDNb^l1om{>q>mAXs{XRE46wI#J zVtC8UhbhwF{89RkDSO4gJi@kB&Ssqvc6oEu2bd=Y4KwV$Hv0~(dWV80Dy;pt#6PZn zFShF!s|!od1A@t35l9vfVvOcDRZg)KCVjMeUKbA4_N65Y&l8E~A%}9RW5!vIZmo&f z;9nAVh>dF^%Y6NI2d4sd-I<6LhfekS<xA(_&BgZY=nPX9i*{>|4JO|;hh}Qo>&=A- z#0*SX&{3g2SjAtgGylQ(0w*FzKV&W4`eX<JCQihdwF|-_D?E$PFJkEc(=Jc$Belzm z!1jx?E(T}|lkJW9`bbyzL@8Nf7$(hk$qvPXc!POWyuWE$J<TEA%rUBZ$WXDWzfVeZ zxFG%&SGc8#O4wd=E_J5*UhPoks7o;2cd)`!0{!B@Yb+1)9qII35KFbzJ{D#~X6KPr zFq=abwf^|@e1pH5Lpjp9k3;s7OE)~Xe~*lRNfcu=A!Vw(=Dx$s?^OL41EjFmE>G6k zwM(*yAL(;;WvEEduRb`9!1Ro_nb9u`NT>M)+2wbQ=6!;dS@va8aQM$*z)YB~VLlW6 z?I{rWf~>D4miSQ%Q$=kL@`(E#u?-W?w?$i+YpR~Zbb1j{y(6Djm5{ci!?d<N((J*! zJ94eXiCv!W?yeJ&inJ*6VO|pHVnz(G2zzP^OgY8B&61ho7Urq7%d-Neon@zD$$X=9 zgN#GZ62(6+u-A2G%Hl*|-?8G5Zj)uNU7qjWkbaoBYJ1g8_THQ5f~lwN?Wee+okcvN z2Zs-(hTvqKFB0dNpI3VB5e^}=U(A_RyL@xFG6?W-sJ<;rKQ#8rUu@IOz5EvofxV>T zhpfi@VR8qinX7^T^QJ_XXn#2UFxhTDg86}XkUkj3p=%z5>0Z7g7AD`xZkXm96&rI( zH>Wr_b|?}>m&j=j?IzB&9W%~yWI5Y+#U@=0kWM$dyj=czG8E>DXsB|+l%ZzYWnf~P zPhs*POZkgM<jQ)OdnFEGVi>0CgzX`R^P?MP;QV3yE8f~`bX%JFIJC>-mZ#Y3niVkB zSTj{xx=jTQGTjbLR*LOE$TiG`nW=g=rW1n5Zw^HxOz%)wM7NH^J~?<ELUX#owCc$` zg&1;3e=XgdYWRp;5_wSM;P9~6$ZM=-uV`U4O!r4HzncuDo2mtwZqB;0;P6xxn0!qi zn7^J3<z>h)Wt<+EpHJ<ANq-hCjbGZ=?2>&v4wGE>^3CCw!vN31ghtl0iE8udvmg>- z{zZ7uFPGVc4OYN(u7+$rOt$kKmb_6?-`Xx7amFCs9w9blD9m}$P(MuPE?!p8v9u;L z@d>l<jJ&U85ijGAMJhHac!tS#Ho~;a>meQHJtZCH{CJt|lNn`^>jTpRlPsf{k%R12 z-*9_zR*{Gq^Wk{MN;e*dY1a_3Fzxcog0@@jmF{;ImTsP1h=+?3U8G}=ui3jKwN7m} z%C575)|L715{E46ih=p|i(Otkh#wa5vM2UK4q<j2s+sZ#J}c}^kl}dVOE*@NNC&kY zhl^vcnNG;;h1PNC-qy@L!#3&mck|c9Olk-(H-}5Zp_ZO@`DN*sn=sXCvS8}h%D86u zKXVS3O(KWAa)j0F#UV~sM=nfrde^Yalk%gg^YrXo{!r{?g}2E#6xAY!y=o5W{r-!d z>|(FC|16q{o-nP#Hq5<imnV@$BFEl3<j~!O%3!qXp<KfuFKBV-iM=>vHHnyMd!6mg zd?1w>rW_$1CVNS_FB!^S5h!BW`>8}M-(iMy9Lfb2`SL*xSx_8`klu;x^4J!8FwNOK z(LUsmw$2+yRbUw*a@dO*{$;OS9)gy{mC>_xWADZ3w<p4MEfQdQPi?KQVwyu0+jlz< zjI#IS;A7Y`J#1*{CZam;*h>diK-SZd;64i)4Po-d(n!al4CS@PB)4<<p=7;m>U*4d zL7OUzE=`77>w64(!si_v$^uX1Foq?2N?XK(q(f#AOcBeX#o0r7P?W+P#-V<?@rWGZ z7w2$2?H4$5pTuioFUHJ=N&ntMMVBn5dHY(7k$!x#5~gpKV6s$yb9h_$hsiEcp@sQq zJgBGlP*tvT`G|0cXZph=-P=Hz&7ta{RvT53uqVdYyD-|iFT>&9;gD{uVDD6BVuro_ zo??sI8TsXbibHRf$!))oA}?TmruG!E&92FyHHQy}nc<#d6~D0PHJM2Y-eA(i?my&E z)_3IhJCx34u`T;Zd^-L$$4-Pp%<v9-eal4K{&Gfcb{wh?JZKaqAK?e)DT!EI(Vx9C zh1Kl6GR#0&6oy5GIE2X}vN}gtZBzwb76kcjzSv%epJzerWrg`LG1HMRVwVTgOqjT0 z9edxJm?8K6I_0vIAKB|PE;31kspg0cm^?@>t#C*#eqcI>I60HWBASbVA%~)chDPbe zIxXEuG@nGzKV?(Lp&d=FfGI;E*v(;zihkPTPJzAW4>%NWq~95~u_tC=l1m>P?mcVt z)e~Qvi9_+<96E=vs5vypzC7fRT^)yVgeEEj-PY-!SYm}cLHB)!ROBzrb$hMfa`v0k zC7CI<*?UD!XyTA(J6|BP@ptO3P1Lc1ZtmqFV-F51co`dg4xuxKtzA|2s=)j!x;pP5 z!~C^aVNRci>3>dPx|erC5Dze|U7DFNMJ#{$@|Isjb?2QdkWH#z>&eFUAh{4=s<)Go z&MzNGmBS<*utf7&Wf56Mv8QH|h;7dV`rO6W3(DTUGcwxt(ix_R)q`6)K<hYklEkg| z@-UY~F1y(4or^4J4r!uwPJS@=P<W7cFiD>(4tK9TR6mw@(C*Ko=Fo{nG#ce!_Oi}= z6^RvM#<xszQ%=#%oQ^|&!HnG;rXH0CrYH9Fc_h}sG?P9!^ksz_vNAJaVq43ieqzrq zn52jw$ok>9<5q#`=83&1<vR@Xiyji4L(H_xz{Cu>Fg^cd#g%36fw^ACPxj>#Q`J?c zd+W{V(#-5Q#P+iEvw~eB0RuSnG=^NV=&9C;OcwcaOdNJD5BKHfa7}c8!`^ZAP`0vy zMECNnz#HAzi|xkLGZBe&n9MbMVTxFOakmB2IlSw(ox)6`FiFQG4%Jv5bPj<@pWZ{A zLwK<3HtXJ)9S3G}XjDyLZ|kNGi$l8glOk_q=q5wy=6)YCOlLWj^T~Q1B0D+`y;<g| ze%iJmY?}%5yhN;-^k<hjTK4+-P8_m=o@|*4G7s*UT;LaH1DImc?%y0fnv)U)EU}ub zHwKL?bL6HTzx$v+ZOIZRVgRN+Vp;Trpr6%Pg=v?kzX)mRY9=Xm`8maE>)&fV84y=3 z%h`Tm5MbKn>A5O3L_Ztbb{2^lo~5T;Xg2;McT(1NrkFzqn)?L@JxPQq8l4LC@U>NI zqQ8C0sQ4H8B<ja@SG*$<fi%GwOsuxO>Jm)PRAHKf0bKoS+3Oqo=1_E5yI(!Qo{Sax zT{nj}29s7D1Lm-Z=Dxn;W&LftZ+rAKhj8SG(XJuQ1HaIOU9*xw4@7^yqY2D~WtaO7 zG4qe9A!N~0C4_l>m=TA*zSEBx`>C}@$Ag_&`su8-)^Aa1WyjI42PVx`C!_qeI#w8c zyq*kTL%&MceiSpfvR~7U#1n!^iZj(!>9L2x#7W!hcU$ViW3|hR-lc^pLouKtkws4} zeSAM@7cjp$TvC_|a)x9PZDD$n?4&o2L&!!wyOT|9(XSeG?egsw-MS`Vru{2o&D<k8 zHzv;6<%zvm{nNTr#uEP7^_z*q+k)2IlH2+6jhw^9Vdot^7Z!(mhC})|N0DX6?=NRM z4n-_vcJVJx<dpuiBCGFi=EO$zQ#|8=ZtY)j$ck?#x?s|u$E}?TCg1t3tA6^Z#_Zxj zm|eSA)Eqj8<F;ijh(&r}s$C?C7IXC2L-~=tR$)d@a|ppnUjJky@(xUI(%DNx{q*nC zns2?t;U=kaFjoW<=hmtZ&}gNfmsv#fK9?HR?^<M9YY(MQb8APKiVi~#aoh8~GZm$x z%PO4cXV)iFfz43|^wYoX@+AolJI9v~{Ch~E3#M->n#0C)F8yK<R;I-Rd=}BXe+7dv z{pNIS@oPjjwk#a_I(o>VD&07;34+!t(baYS-LZFB^f!~e@~-QDWA?9L+*!1}?i@we zFV)j3nExvd<3ZN-zF?*p^R(fn)Go1&VHU~j&WooaaZW6nSAHQ^UJN;GX84i4PUGZS zWv38hxN`S>cVzWBL~QdWOm~iW{$cH*bYlf6YAgg^Ad6k?Yc-bK?x$zR+XdkerkP~X zr}LukQ}`D@bht5llWfwm4kiuP<wE=`-pnLXJrpxAdrxt4*1tNeVjJdUB9@f?osP=W z_R7${FM!#s!h9?zD>bA!RGIq>b4)lCvAw6@=kfZ5U2|wuB+%irbpmhZ`PzKC9TX1D z5smFNbrojcefTx5erRhd7n~$T_44pZ7BpG2PD-RZFLfO9VCU>ap4f{+J1k6DY%R=f z!=ZTSm=}j%uk(3xxFq`X4!dM1R+~dsK%;{UT~-J*5m(m2^fxX@@$NuBG&u#cPr0j# zTl-YkLx1N1LdU$!!l4~!d6;2Q*GZ8!KT>Gk=a8$?-zNdT=*KX*R`G1x>z8!ACaPH{ zX4=2~K1im(yeHCm99MlWe}A3j)Pc4Ohcsse={$%@Qg~3rb{wh?^s(08ix5|>KdWW* zkVAJ6eZp}@vI;*|sVC|Wd)>=pTR%-imrT*qn7fuYMFj?6dZz}{*LV8)g->C+mlv@j zN<W_U(A>Q|DN7?ACO*6F9h`d#wzNf9eRX!&A&2}0-za-A)^Uhcb(IdD_sRk-D;7pi z&tdd<`ecqL_GIy0pKVs8#;RSuz936fuo|Ynsj@7x=&xTU$_rBb)hT{~GmgWqUGnaZ z;6wJ?c2=}Re(C(`o$-Mn&;(|4=-Vwk)0`|b+urx2s@qNamvmxaGE&$@I!p-7VONZ8 svyaHo&O3ic>vy*r{Y|Qe;*rH`|9+kSNA}GpHk)|zn;UOD`V)8m1u~YcZ2$lO diff --git a/x_demo.smp b/x_demo.smp deleted file mode 100755 index 85d0078fdf9789f25069d319d66e24234ae2db19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15619 zcmaLe56s`yRmbs%4hQLAbF;$6Sm>Bl=GfRKmA|fzhLKU&0~CrhoiZNUbj_sfDOQ+} z$*L=XZQZ2&8G|u&h_0B*j0F?~Q9EshorFNfs&l#^`$K}84wZ!X{NAtXZc<|tPA}(s z?m3_HIp^N*{eHi{p8w8smrkF#@T}SOYu^8X)w2sPe&1#9TR0gmT=Dj|y#3($hfN(Y ze`@ODsi~<uo|qGpKL_pS?>RXc9eeWs{_j46$@K+u|4sg0wD<41zy8lZi>6*W_009l zSGc(J#8oR-z3pdLUH(fKum0urZ&`i$>hueyeq@-uc**2{jy-w5xd3}!J2ka<$s-3$ z<cSAQ<b}z%9W)uA+4z*?$I|?1mQNozxoZ5fuHM?!`?|{8hHSo)X8&wfCr^FZWbWPB z|5aDbx;4FsZ_e_)$@7v>vAk=J+Qm!8xz{#V+?9j9xX*P}M)ww%<%5lXI}8U8v&14r zxiZT?%2L+9Kj5b)&v?xQ+g(}yWej|Ah{)$T#X2m#j7V8u+SS987v$~1yx~EVZE23k z24nLZ^FQ7Aud}&*pD0)rYfD%8d`YupC+jbTUo5PeHNRO~lSjRLu9Y7C+}!wo<e{fc z7});qi9GT>6S?8^iQJPsBYAxCLtXug?EiKDiOr%kUrlrFT+1$A@>t`W&YX;Y(AEDx zBA;KIH?jZ6qFk5!$V(=grH!8~);E(k<^O~s)_2qV?imyNW8W~5KXK$FJ8|zUQ&OfU zgzCcbeI)<#J#5)z?us<uD%NN7{CmmoB~LHzcN!m4j<+PQS@^?<zf;6Jk|G{o#3Pbl zEAB^&@?S~Z9@W)nihE1`A4z^cxvaRCB=0WM^RmBppG?QN4;1U@EH@Sl!zVZXa`Mjn z??^t7JijQXB)^{KgmOG0`NHdenCZS<B*)W=cxwJXnY>}B=A~WLKYv@kUr*{E49j$T znX1&jnc|kbqW+QTCyMyG<Z;QTl6#7RVU>NN?8N$;#&0ag4e@s0!0o=7zH5jmqn$-j z*@N<cf$tVqrZ*L3cXC|}|9#`zihEvi-%NFsOx5CoEY~MroxCRb;p8Wi$JfuQygNM8 zA>5sOF?n0^`s6LiYm)mV56{C5jSp#TZCWocPxE|Ne=Vuj){(itnx6fE*&F{`2w!{l zWW|xEE}x9A{;`St^|L1O$seD{-)ekFop5&Jk0-B7{vi9i8ef#$+N_zzOKFm4BsV7? zC@#%@hfJb8-K<Sr6>)3htCGC^VY6sfr04DCFnm7EY;t|_-N~Iv2)|sEJJQ^J&Lr-; z8sC^?KjwJhp%WW(FUjVE&H97JSI(U{7B3NZL;M)yVR<$*mxrAH-%KyZH>Vd7SM1kj z0~?-Upt-17s|NqDy(SDeVNX6E!{3Od>1MsMywq_`S-dL!x+HHHhV8}aNv5CfD*xBU z1AEnx9sjDJzQ!!gdbldwnm1Yh%7FYA)8i0Jo6<Z`7F!yBCb?nghcBdI&juchUDH)O zz#xmG<3V0Je0!F78>{gCVyT60;q!#_#(3LPb|1>m`lMKp?2heS)na8=j|#(~Nq*oL zMHP%yN)+DYyMI1aQ!X3xjA6{<$6AvG3~IM5dwLj*-y5p2CvT|kGP<)&Z*MO4;1L}X zaks^iT?Mx+uTM{-UdDRh{5<nxH9eGON3$+#{CLuuf&sSa^jOkkC&dz<3%ZIiI~Y9J z*0+$8@5~-EdQTVGi&RI|^sVUl$F1x>9eeEMwJpzw*8lLpY_8~PF~3^yBcn&+K}LId z&KqX%pmxUJX$4&$1|IMxYZ&O|#WQB?*t7W;3mYE|!`QKp7KM#EvfSGb^~^EVV(bug zUz2}&JjliPtF0Q<S(hcx%k##A)gkLYPQNirS$r>SuKr9{<v#Y_s_b$8pP`*eBO`U^ zZF^V69rs=ytP8W$eQSPXhp~rZ4`!URm+v^XpQz(aRZuN%DvM2do~?__!W-nOeCiO3 z&Ew5_M;`R8>buIPxN_91uI{cD{Es#~*x6WOn+Nw?_Oez@EBE;D$eq2r54K<E9)ve_ zSBrJc;uE*#@?-AiY@po|dr;X=)C+s?^R}j0R;7K9{~hUd2n=h}*x$ZUS8Pf{&nG`W z)ha%tTF~>UMs_*7$H)@2uc%U3g-u>-^2UR%z<?bC5<EN`hsNjU4Z~K!&M;f`82<Ni z(Hr7^Y}mo<C)POjoU9<RruZ>SrZ*Oa4faHr<B9PDKb%;Smsz^VctiGfON`+eT0LgR zJ~x)2WiR5%>CJ^rMEyg`!WgR8#h%U??*fp|lp}lI$Zxi4#+9x^oE{<9MUcpXUcNYl z!Fj++XD=fduqsnon`;*x{kXf?|9OBPw~*`qjpa4gMFsH#$w@=*ItTu(=@%u>j&le% zr?C&P7ey8rup*}8+zw!t9{YUWtVb2cJpUux`wjQdPc>^DJjolAW2e0_`_bnYs~}W% zBv<YK*p|iBp~cKKts30|xmXuwBVTpDC5?QoO%)ME?)F|4e5w_yzIIU&A;bV?R8SY; zXIrs;W8i^a-0`FVvx=zx(aoY+8E<f6PcFL17=EW^$YFB=hg^1>@}_G1Lv?t1JB$_m zAJu|4e6oi`zqtw_8*9+L23KqH3<IuUyQu2R7klh+Xguz0c+>6Tj#;pm%O&*#PGqz; z3>X;W+Kpx8yl18G&zm&}r+thK|Hd#cC<@D~!k|y^1Bvynhdq^yRlxc7{LG6V5$zuE zj~zSqp0S9cID3zrf3AM!la#3}<h!uGb=9*ZpLS81S`lVpex_OSg3$BJ$R0m<vsy*x zQ)T6NW&N*LXJSJXJ%His)9WsG_Dh>3i@mkZ27B;0Kj^?KV)&S5?dj}_w=rLS_=lEs z&WC(QQTE2I?(A{M=gMq!EacV;uG~Fw@=r1OXc8wp>yzpH=v#M5{z><mt6x2NpJ0VL zC!1>(KtiK8L|Iit9{6Wt3^R=?kn@{`2R7>Kor506A<m8U`DNwe-4y+2hn2gtieMWj zc-TBJ3HhFOD%c<qYf1HG@4ks`p6xmI;oHlCrH<WJ^fkqjsht*w4`we@JiFiVZx!fR zdGSo|Jqe%Qv5a+*qw^jQx`Mqo3^?&@BBB-XL_Cb%M4v7TZ+KoTFMWu;<KlcO8x>sN zc)Z_jN<-?X&oqnXp04gn-kDx+%f&fIb#y7TviM+3dV{w-4?EhU>{J+*1ytjnuVYn^ zHyIuK%-lQt=dgzjb%ep*1;du2TLm|^4;&i?$oXVx?qgkDmW0jI0St@x*|Fc6<;>vo z{>IK2eA;=S)st#!-CYtw{&k>E*5~xE%tnrovvg`=sXEx(UJtmp%4O^#7(C0f-x+4R znJPS)2MFz!W*K8f4~!hrJJ-2)cv>{;t^2UYgIz*)-zu(kbXi%;4wFBfM#Lk-%!79( z&-Zlpj`V7JK;AxF$MQg8V|?d;Px970*mJPwl!*CfT7zS+E-x>b`G;_Ger~SYVSv_t z_;`8@<4UcqIC}!l)y4jR$=COl79JIZ+$=V7^p1V6Wjt6f*0`QD7X6ACmYubHbE{@s zxv=No?r~uHF>5)Vk{|k~ssc9L(dePwl?PRWQ|-huK7H^;gYAokH#X2t=gpJ*m#UPW zv<9#1s-2ByMH>4XCe;pmst=XBhU&~TOJ|N;@y|wA>;JXc!@RLE_ISXjvE2zO@5i=e z&+|F)pw<ti$E1$sAAUaZpo`SS{%PzUblZT9UZuQa(V2XTc-l}4n4hha$C_enTb_4i z4+B4s)enD?)c-QV8_va5DOd5#v&t^bzi%<>^>DE~-MH#ZsAt@{Sn54`IIS{Sz;M;_ z$tg<(cNXjK2Ckfz;n|p8|M2;NR*hJmf^p?6I+Oj1BoA_AuSTlis;?*fy9dGP+-t1j zcssBiX*@m7D;EBp<lSYk!~+cce1CY;r7N6=S<>h_v#eHYjg4GB)t)0?oX>{D=@C~V znkC;g**Kxmh~*6C6v5tHe%$w+a9q{@R<2VSoVw2bZ|=Gx+5^qKwhD^AxvMaopWZBa z`OZ7`CqH7@?R`D8LZ6OX?*=#JnK!k-;dJ^h#GZaOS9UM7vu)1?&-{q%PO+t{)+YQg z@UQpO(N3lRpB+{=3|20LuJT|9+gg<ClJM(ZZ{}&<)YV-{6&!aVHaM4yv0jDnt~jUp zxq4e&U=UqKc=*v`y{BBDU6e)^-e9PX{^3n@V@&F8oLe=n!fY<yX7aDE*tm*46%<_^ zA(tJ^$~?>tQpb+`n5CLl6Ax_cIiid8(!9AB)4-`iSQ_Jy4gGk(<DbNg?pn`(6;U<$ z;sG<xqIN1ZvJ>LpSy3#N`bs`AZ<cOZlO8trEN|W*(Hkr;s9V-$kEMIN*FdY9?z1%b z^j;SmZzv;o7P~GR{KynqcOn&hq=@$??Y;2e4MKR#-InG4VUvYtZF{(G)J4m)#GCy@ z6*i^+c)NrOe!HH>Joe1OhJ2yAf7r*c;S6SlF3U5tIER@=?erdItatT2EB0_=pO=dq zVS{!>XywQ!ZwI7@K@=YL<{LIoUQqFDw}e3l;#|FEn>C$0Gzp=nBv&yb%6NCc01Qy+ z1aCi_pCR{FP`&uPb%-Tv9Voh|FweQ7o8{`bHbtiwUET5NDi8ecwJADI^r5w87Wpr+ zZEq3LTyjSqu%t%h%Jj~Va@Sov=uh8<U>1F6v%D2i9T<FT=93>j)oynP7bMl<Rr#@d zjI|b*Pvh~c_dU(B8y}N5Il`t=5b8;N^=GY6ai8nX%foEm*x;YMr}MC@a>TjnSiia& zd-T@nSjQ7v*RZjH!LLCuBS&Ld8_P?tvhfWCo{g<gIqGxouFVp~)AYW-`q0CRVsBFn zsIRISLn4;ljAvhetl6<f)A_OItEMbS=XP0$ZmtvfnEOnA?AWAxsCwbtc^<1{m3g*O zSkkP?rwWd>FxMU{JDHm64)ya@5KHQd6Tb$LHUDt39Q%P!@AQs~b8$tqW3LRMQ=GYL z)3AI+voOZL`uYN;dzWP|cQ{pnrMD;|+Obv8Ed28<J9jjA;CCwE*?9ow@ePbS3vX(T za~e`b#&=5c@)b-6E-jaFkM%Ufo84(y{Xb&Bo9@*)du!TVQoi_nJpZ18<*VYxJg|gz zyhEu4g!08OW^iQ};*;K<qf)$)c5FCjL#3C@rME+xYu~n-Tvc(%cjW<QeRWbAII*`m z4Q^E&2Kn-XTY0IwKH*;-{hr5IF5m8%h-Pb1#F}m_3s1r9ak#Fl^0jlSss6#nc*cN= zrE`wC^q7Z%#FCv*hxh`e>-gtwyfglD_Y2%&&)$ory?6YOV^6-ki7R*aTpmP$RxN0p zJ$&bac6pwmwFc?OUmSU}#M`)w+Ba~kXM8h-M@G2vtfAucv&EfBvcZWl44%l?%ajKl zg&%R{Me}U;Tq}zo9cAwwu~|Xu!yt>XIyk|DeZcxscRqO&1%7q$><q1|zN29elQJ?E z*V_+SjB{0xe{86fSo~}&3;VE$ey8Cr2Ue|)aTY)Bq~gA*9Sp0o8+TVM;Z0n-AI~&a zoQyn)>q$JzOLg$+y$uYqySEC8{!A-f7UNqWIf})n^DPfNlaJ<YWBhDNj$amJq}Jy0 z=JaTmuZ?)H2Gv3q?B)KE?%->SLhq}b=N%c%c9lIFxwy(RxvE;&qu8?~)rdDI7PT1f zxvt7${D!D|bp;ObKQC;Mh~nfXQ%LUH=PZY3e$;wAE$al>uqSJ~;!F`eJL_|L-KaYB zW?6~qMZ;!iesm@_#xL^N8>KTXY%svDQvC3bCHE$rSY^(@m}HNK1tDQMzTdzwZt=;+ z&M<Z|&iyuT{8gbHOx;iEOkyoV=y$3x>s4Lkm$$}{`>m9H3?8%KA?*WD`N}2=40d3- zTQ%zC7gn;v?RBxC7Iqu;h0rX$fxWfao8`$x+#A!ghYC)!U~n(n*s2lTT(yS$&%4`V zRX<qWo-y5RN3P6b38xOn8_pr|y#sQ3_VWFOp<d%oC||$)hhbfrUXs08av{ai^Rn~B zSqHL#?I)K{zDGcAMX0!lD~n<s`67wQ)v>21-BrhqQZ@UhDx2k<q3Y-jSDn}wlncz* zFm|V26B17}{QIS)UiJJdBf0o@j{c1px#93hrgPu;rw*JtVCva_m^W|oPucz(%|Jkx -- 2.39.5